Launching program from resources

This is a discussion on Launching program from resources within the Windows Programming forums, part of the Platform Specific Boards category; Hi. I wanted to create a locking program that stores information needed for another exe. When the person enters all ...

  1. #1
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Creating an exe file using another exe file

    Hi. I wanted to create a locking program that stores information needed for another exe. When the person enters all the information needed and the file that he/she wants to lock, the exe file will create another exe file that stores all the information being typed previously and also the file. When the user double click on the exe, the exe will need the user to enter the required information before it lets the user use the file.

    How can I let the exe file create another exe which has a file in it?
    Last edited by rickykoh1983; 08-26-2003 at 10:17 PM.

  2. #2
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    I think that would be very difficult, because it would require you to change the way the windows operating system reads in executables. Another way to do this would be to encrypt the executable, then use an exe to decrypt and run it.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  3. #3
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Thanks

    Thanks. By the way, are there any similiar examples out there?

  4. #4
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    It's a bit complicated, but here are the basic steps...

    Compile a program that asks for password and username with long enough but blank strings (make sure these are compiled as a chain of \0 in the exe, so you can fill them in *after* compilation). Try to use api calls to keep the thing small.

    To add this password-check to a programm, you will need to do a few things:

    - Load the password-checker into a buffer and fill in the two strings (to find their location in the executable, you could compile the password-checker once with two different strings like "password-here\0\0\0.....") and search them using a hex editor).
    - Determine the size of your target executable, then append your buffer.
    - In the exe header (that one you want to protect), redirect the programm entry point to the the end of the executable where your password-checker is located.
    - Replace one of your password checkers exit-point with the protected executables entry point. Make sure you password checker has another exit back to windows if the password was wrong.
    - Now, I don't know much about assembler programming, but I think you need to offset all jumps in your password-checker by the size of the protected executable. If jumps are relative to the origin, thats of course not needed. No clue here.

    I'm pretty sure the concept works for DOS-apps. It's the reversal of what anti virus tools do. Retrieve the original executables entry point from the virus (it's its exit point) and restore the infected exe header with it, then truncate the parasite and the file is clean again.
    (I once had to write an anti virus with QuickBasic because MSAV didn't recognize it... ah the good old times... errr...)
    [code]

    your code here....

    [/code]

  5. #5
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Thanks

    Thanks for helping. But, can u explain it to mi in a more simple way? I don't quite understand.

  6. #6
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314

    Re: Thanks

    Originally posted by rickykoh1983
    Thanks for helping. But, can u explain it to mi in a more simple way? I don't quite understand.
    Could you be more precise about what exactly do you not understand?
    If you want me to go into implementation details - I can't give you those. I wrote a basic AV for DOS some years ago, I don't know about all the current windows specifcs. Also what I did was the reversal of what I suggested you to do. I didn't need to know about the assembler stuff like offsetting the jmp's etc. because that was the job of the virus coder - mine was it to get rid of it
    You would have to do some research on your own there (i.e. you could check wotsit for the exe header format).
    However, if you have a question about the concept - just ask.

    btw, you didn't mention it, but if you are new to C++ or even "coding in general", it's probably not a very good idea to start with something that much complicated.
    [code]

    your code here....

    [/code]

  7. #7
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Thanks

    Thanks. By the way, I am not new to C++ or "coding in general". It's just that I have not learned the more advanced C++ and I really need to do this project cause it's part of my homework. So, can u help mi?

  8. #8
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Thanks

    Thanks. I only have the first interface. The code is quite simple. Can u help mi with the part where i can create another exe using my present exe?

  9. #9
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Thanks

    Thanks for the code. But what if i want to do this in an mfc application (i'm doing my coding in C++.net)?
    Last edited by rickykoh1983; 08-28-2003 at 02:29 AM.

  10. #10
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    I understand

    I understand the code. But from what i have compiled, the code only creates a .c file, not an exe. How can I create an exe instead of a .c file?

  11. #11
    *******argv[] - hu? darksaidin's Avatar
    Join Date
    Jul 2003
    Posts
    314
    It's just that I have not learned the more advanced C++ and I really need to do this project cause it's part of my homework.
    If thats part of your homework, I seriously doubt you are supposed to do it the way I suggested because it doesn't fit the "homework-style" (it teaches you nothing about C++).

    I just read your first post again and I'm not sure anymore that this is what you want to do. There may be a much simpler way for your purpose as Salem pointed out.
    [code]

    your code here....

    [/code]

  12. #12
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    I understand

    Ok. So is there any similiar way or examples that I can refer to? (By the way, I am not asking for u all to help mi do my homework. I only need the concept and some examples for mi to see)

  13. #13
    Registered User
    Join Date
    Aug 2003
    Posts
    17

    Launching program from resources

    Hi. How can I include exe files as resources in another exe file and excute them out through the exe file?

  14. #14
    mustang benny bennyandthejets's Avatar
    Join Date
    Jul 2002
    Posts
    1,401
    Sounds kind of ambitious to me, I don't think it's possible. There was another thread a few days back about encapsulating .exe files in another .exe files, you may want to have a look.

    EDIT: Hey that was your thread! This may be considered a bump by some people, it's basically the same thread.
    Last edited by bennyandthejets; 09-01-2003 at 03:02 AM.
    benforbes@optusnet.com.au
    Microsoft Visual Studio .NET 2003 Enterprise Architect
    Windows XP Pro

    Code Tags
    Programming FAQ
    Tutorials

  15. #15
    Registered User
    Join Date
    Aug 2003
    Posts
    17
    I know. But quite few people reply and their answers were not relevant to what I am doing. So if anyone could help, please help. I need all the help that I can get. Thanks

Page 1 of 2 12 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Can someome help me with a program please?
    By WinterInChicago in forum C++ Programming
    Replies: 3
    Last Post: 09-21-2006, 10:58 PM
  2. Launching an application from my program
    By tao in forum Windows Programming
    Replies: 6
    Last Post: 07-04-2006, 01:15 PM
  3. Launching a program on startup
    By beanroaster in forum C++ Programming
    Replies: 5
    Last Post: 05-20-2006, 01:21 PM
  4. Launching web documents through a program?
    By carey_sizer in forum C Programming
    Replies: 3
    Last Post: 09-08-2004, 06:51 PM
  5. My program, anyhelp
    By @licomb in forum C Programming
    Replies: 14
    Last Post: 08-14-2001, 10:04 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21