O.K., here's tha deal. I want to use an executable (.EXE) in my program. I know you can load bitmap (.BMP) files into a resource (.RC) file.....so how do you load executables? I think I have my resource file coded right, but how can I run tha executable from my program code? I want my program to run an executable, but not like a ShellExecute or the like; I need tha .EXE to be IN the program, kinda like a "binded" program. Thanx in advance, *unknown*
Posted on 2000-12-28 03:26:00 by *unknown*
For the first part of your question, you can load exe from resource with the LoadResource api, here is a exemple : invoke FindResource, 0, 100, 300 mov temp, eax invoke LoadResource, 0, eax invoke LockResource, eax mov mPointer, eax and then your prog is in mPointer in your rc file : 100 300 exe_name (100 is the ID, 300 the custom resource TYPE) but for the last question... i don't know... you could save this prog in WINDOWS/SYSTEM for example and then run it from there... (scalp)
Posted on 2000-12-28 06:12:00 by (scalp)
Hi, I think, this will be quite complicated. You must rebuild the complete windows exe loader, with dll runtime-linking, relocating and much more. Maybe you can try to write the exe to a temporary drive (f.e. c:\windows\temp) and execute it from there. Try also a look into the imagehlp.dll docu (found it in my win32.hlp file). beaster.
Posted on 2000-12-28 06:36:00 by beaster
First off, I've never tried anything like this, but... Riechter did some articles circa 95-6 about 'dll injection' into another process, I'm wondering if these technicues could be used to start another process, then 'inject' the code you have read from your resource. Wish I had the URL's for this, I'd check his injection art, AND one just after that for sefl-deleting programs (which loaded code into another process, such that the orgional process could terminate and have the 2nd process delete it's .exe).
Posted on 2000-12-28 22:50:00 by Ernie
Thanx (scalp), much appreciated ;-) Until then, *unknown*
Posted on 2000-12-29 01:11:00 by *unknown*
Unknown, Theree are a couple of ways of storing a binary file within another EXE file, either add it as a binary resource in the RC file and build it like normal or have a look at a tool in MASM32 that is designed to store binary data in DB format directly in the code of a file. The tool is BIN2DB.EXE and it will convert a binary file into a DB sequence. You then use the start label address at the start of the DB sequence and write the correct number of bytes to wherever you like. Thrying to run the file directly in memory is a task that is probably beyond you as it involves understanding a PE loader in very high detail, better to run it from a disk file that you write yourself. Regards, hutch@pbq.com.au
Posted on 2000-12-29 06:51:00 by hutch--
.......much apprechiated Hutch ;-) .....oh yeah, props on the work you did with the MASM files!
Posted on 2000-12-31 15:47:00 by *unknown*
To get things strait, about the only way to start a new process from an exe file in Win32 is using an API. Surely there could (and probably will be) a ring0 interupt function to create a new context for a new process etc, this would of course be emtpy and would need all the nesscery mem allocations etc, and then that is where pe loader vxd kicks in and fills it will all information it requires etc. If you are dead serious in creating a new process from code inside a resource then i would suggest looking into the DDK. Or, a less obvious solution, is to the first time,your exe is run (using a method such as a Semaphore, a shared data section inside you exe or File Mapping etc), it re-executes itself, the second time, seen your exe knows it is been run a second time, it could run a different way, e.g. call a difference procedure, etc. This here kinda does effectivly create two false exe's, inside your one excuteable image. Feel free to email me if you want to know more, k
Posted on 2000-12-31 18:21:00 by randy