Solved

Combining two into one

Posted on 1999-01-08
14
189 Views
Last Modified: 2010-04-06

Hi all,

  I am wroking on a project, which is about to control some devices using PC com port.  But the real part of the project was already done  This part has a good Interface which has a look similiar to the device front panell, and this part also manages the controlling of device(capable of sending the commands, and requesting some info from the devices.) So it is good. (This part of the program is an exe  and comes with the device on purchase.)

What I really want to do is that,  write a simple interface  in Delphi, create a form which asks some information to the user and then store this information to a log file and start the controller part. But I want to give one executable file to the user and want to combine these two exes (the one that already in hand and the one that I will write).

So is it posiible to manage this work.
PS. I know one way
I can modify my program in a way, that will make it extract
the controller exe , from a resource to disk and then start it.
But anyway I want to make the program look like as a whole one program, and do not want to involve into file managing stuff(extracting , executing and deleting the extracted portion from HD)
So any suggestion.
0
Comment
Question by:new_x
  • 6
  • 5
  • 2
  • +1
14 Comments
 
LVL 20

Expert Comment

by:Madshi
ID: 1355463
Hmmm.
How about that: You could rename the other exe to "device.dll", then it looks like your program does all the work, then just before starting the other exe you could rename it to "device.exe" and afterwards back to "device.dll".

I don't know a better solution than yours or mine. I don't think it is possible (without very hard work), to really combine these two programs into one...  :-(

Regards, Madshi.
0
 
LVL 1

Expert Comment

by:Roadrunner100598
ID: 1355464
Looks like you need a link virus... ;-)

You know - those neat little programs that hook themselfs into the startup code of your program and execute their own code, copied somewhere into your EXE file (probably at the end). Maybe a scheme like this could work for your problem?
0
 
LVL 1

Author Comment

by:new_x
ID: 1355465
Hi everybody,

 Thanx for your replies. For Madshi, thank again for your reply, but this is not exactly what I want to do. ,
For Roadrunner (your username is a cartoon caharacter name , that I really like.) your suggestion sounds that I want to do, but is it possible... and If it is how can I do that.. Thanx

0
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

 
LVL 3

Expert Comment

by:Matvey
ID: 1355466
Do you mean you have no access to the controller application sources? Is it legal anyway? I'm not Judge Greg, but I can't imagine what pulic it's intended to?

It's not so difficult, but involves assembler, machine code, and a good friend of mine.
0
 
LVL 1

Author Comment

by:new_x
ID: 1355467
Hi
 You right Matvey, it may be not legal. But it is not too bad I think. Anyway the usage of  application  will be very limited and there is no commercial intention.

Regards,

0
 
LVL 20

Expert Comment

by:Madshi
ID: 1355468
I see some problems with that:

(1) You have to know the entry point of the original program.
(2) Perhaps the original program uses absolute addressing. That means you would have to change all the pointers in the code of the original program...  :-(((

Regards, Madshi.
0
 
LVL 1

Expert Comment

by:Roadrunner100598
ID: 1355469
Hello new_x,

I have never tried anything like linking in other code myself, but anyhow I figure it might work like that:

1. Find the entry point (this is available in the 'Schnellansicht' (well what's it in english? mybe 'preview'?) from the context menu of WinNT/95/98.)
2. Write your program as procedure of a DLL - this is to avoide all problems regarding initialization, ressources, etc.
3. Add to the original program a JMP at the entry point to some code at the end of your program.
4. Your code should only
- Load DLL
- Execute your procedure
- Unload DLL
- Execute original code

The code for loading/unloading the DLL you can get by writing it in delphi, and then disassembling it via delphi's integrated debugger.
As you want to do this for one special file only, it is possible to do all the work manually

(On behalf of 'Roadrunner': there is a laserdisc available 'If at first you don't succeed' - 90 minutes of roadrunner vs. coyote - simply brilliant)

Beep, beep

0
 
LVL 1

Author Comment

by:new_x
ID: 1355470
Hi all,

 Thanks again for your comments, I will try to the something based on your oppinions.

Regards,

0
 
LVL 1

Expert Comment

by:Roadrunner100598
ID: 1355471
Tell us about your results somtimes...
0
 
LVL 1

Author Comment

by:new_x
ID: 1355472
Sorry for being quiet so long

I was unable to connect to internet for days, (some long works took my time longer than I expected.). Sorry my friends,

RoadRunner, My first question I could not understand how I can find the entry point. The other steps you listed are clear.


Thanx and sorry again

0
 
LVL 1

Expert Comment

by:Roadrunner100598
ID: 1355473
Hello new_x,

I'm nearly never at home these days, therefore the delay on my line...

I user Windows NT 4.0 (german version) and in this version there is a context menu item called 'Schnellansicht' giving you a preview on some filetypes and additional informations on EXE and DLLs, like the needed DLLs imported functions and THE ENTRY POINT adress. Try EXPLORER.EXE as an example. I don't know the name of the menu item in the english version, but 'quick preview' would be a straight forward translation.

It's in the section 'image optional header' (I checked my delphi programs, they have this header information included).

If you can't find it, please mail again - there is also some API magic that could do the trick, but I need some time to look it up...


Roadrunner
0
 
LVL 1

Author Comment

by:new_x
ID: 1355474
Hi all,

 It is very  nice to speak with you again. I thought that you decided not to write to me.

Ok Road Runner please send your comment as answer, and if you could look the APIs and send  them here, I would also very pleased

Thanx

0
 
LVL 1

Accepted Solution

by:
Roadrunner100598 earned 200 total points
ID: 1355475
Hello new_x,

I'm back on line... I thought the information on entry point would be available via te ShellAPI, but I failed to find it. But playing with a HexViewer and the Preview I found that like in good old DOS times the entry point is insinde the EXE Header.

Look at adress 000000A8 of any EXE file - you find the entry point there (low byte first).

So long,

Roadrunner


0
 
LVL 1

Author Comment

by:new_x
ID: 1355476
Thanx RoadRunner,

  Here the points
Regards,
0

Featured Post

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
TVirtualStringTree  search using TEdit 7 121
Send message from delphi to whatsapp, is it possible? 3 1,422
FMX StringGrid1->Canvas->FillRect Problem 3 150
LAN or WAN ? 11 90
Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
In a recent question (https://www.experts-exchange.com/questions/28997919/Pagination-in-Adobe-Acrobat.html) here at Experts Exchange, a member asked how to add page numbers to a PDF file using Adobe Acrobat XI Pro. This short video Micro Tutorial sh…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question