As far as I know, you should be able to start executing code at any memory address in your executable, but you wouldn't know that address anyway.
As for actually running an executable that is WITHIN another executable, I'm pretty sure Windows is not capable of doing that. Therefore, the only way to do that would be to find the adress where the executable started, extract it, write it to another file, and execute. Or, you may be able to find an Windows executable emulator or something like that. It's unlikely though.
What exactly is your aim in all this? Maybe there's another way to go about it.
I give u a more detailed idea of what I want to do. I have an exe file that shows a dialog. The user need to type in a product id, a vendor id and need to select a file to do the locking. When the user have have completed these tasks and clicked on the OK button, a dialog box (created by CFileDialog) will appear and ask the user where he/she want to save the second exe file to. After that, the first exe file will create the second exe file which will hold all the information that the user has typed and also the file that the user has selected previously.
When the user open the second exe, it will need the user to type his/her username and password before he/she can open up the file which is attached to it.
Can you give mi some ideas on the following:
1) How can I create an exe file using another exe file?
2) How can I attach a file to the second exe file?
3) How to pass in the values from the first exe file to the second exe file?
I have merged the threads. This is the same question. If you don't like the answers you are getting, perhaps you have been asking the wrong questions...
ok. sorri that I opened another similiar thread and sorri for any inconvience caused.
First off where are you from? The use of i over y is distrubing.
It appears what you really want to do is lock the program until the user registers it. If so I'm sure there are much easier ways.
Creating an EXE from another is something that not many here are fimilar with or capable of doing. Minor mistakes when writing the program could lead to big problems when you try to run the other exe. Trust me I've edited both win95 and win98's explorer.exe to change my start button to over 5 characters. I ended up having to reload explorer.exe at least 2 dozen times due to mistakes.
ok. If that's the case, are there any better ways to do this?
Dunno, at first guess I'd say a registery entry combined with a check when the program starts.
ok. by the way, do you know if there is any way to include exe files as resources in C++?
Ya. So how can I solve this problem?
This is part of my code:
hExe = LoadLibrary("Locker.EXE");
hRes = FindResource(hExe, "IDD_EXE1", RT_RCDATA);
hResLoad = LoadResource(hExe, hRes);
lpResLock = LockResource(hResLoad);
HANDLE hFile = CreateFile(_T("C:\\Testing.EXE"),
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
What's wrong with the code?
That's pretty damn clever Salem.