Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 195
  • Last Modified:

Combining two into one


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
new_x
Asked:
new_x
  • 6
  • 5
  • 2
  • +1
1 Solution
 
MadshiCommented:
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
 
Roadrunner100598Commented:
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
 
new_xAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
MatveyCommented:
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
 
new_xAuthor Commented:
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
 
MadshiCommented:
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
 
Roadrunner100598Commented:
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
 
new_xAuthor Commented:
Hi all,

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

Regards,

0
 
Roadrunner100598Commented:
Tell us about your results somtimes...
0
 
new_xAuthor Commented:
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
 
Roadrunner100598Commented:
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
 
new_xAuthor Commented:
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
 
Roadrunner100598Commented:
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
 
new_xAuthor Commented:
Thanx RoadRunner,

  Here the points
Regards,
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 6
  • 5
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now