Solved

Combining two into one

Posted on 1999-01-08
14
188 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
 
LVL 3

Expert Comment

by:Matvey
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Author Comment

by:new_x
Comment Utility
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
Comment Utility
Tell us about your results somtimes...
0
 
LVL 1

Author Comment

by:new_x
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thanx RoadRunner,

  Here the points
Regards,
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
System restore point 4 77
ddeman not working in activex 3 78
Newbie Thread Programming 1 116
Dev Express grid collapse 2 33
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

763 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now