Create an exe using an exe

This is hard to explain, but here goes.

So say I made something that gives you options to do something

Such as umm.. i don't know, open up firefox.

I would like to have my program, create another program capable of doing that.

Now i know how to open up firefox, and all, but how would you create another program (exe) just to open firefox, using ur program thats built already...

I'm sorry if i'm making this confusing

Thx in advance
Google CreateProcess
That wasn't exactly what I was looking for... thx for the help though... I'm going to rephrase my question -->

Does anyone know sub7??!? NO NO thats not what I'm looking for...

But it has an edit server... and using that you can modify an exe... or create another one via the executable that your running already (editserver)

this is what I would like to know how to do
A compiler creates a program out of some text input.

What about writing a program that spits out source code for some programing language and then run the compiler (using CreateProcess or system) from your program.

Alternatively, you can create batch files or other script files that are directly executable using some interpreted language (e.g. as python, ruby or shell-scripts).


Ciao, Imi.
I’m not sure if I understand correctly what you want to do, but I will post my suggestions anyway:) I think that you have basically two options:

1) Easier, although it’s only good for creating programs dynamically: Your application may just generate source code in a high-level language (higher level = better). Then you can call a compiler (if required, you may as well use some kind of interpreted language like JavaScript), and execute the created exe.

2) Harder, non portable, try it only if you feel comfortable with low-level programming: Work on machine-code level. You can load an exe into a memory, and modify its instructions (for example, replacing jump to function XXX with a jump to function YYY). Or you can just generate the whole functions dynamically and call them from your application. I suggest you to look at source code of some patcher-type programs.
I don't know if I'm quite understanding what you're asking, but here goes or nothing.
Simply put, you can't write a program that will modify an arbitrary executable into doing X task without the near certainty of corrupting the target. This can be done, but it has to be done by hand using a hex editor and a lot of patience.

Why do you want to do this, anyway? Frankly, it sounds like you're up to no good.
Well.... it was because... I want to change a string for an FTP server.... but... when I close my program... the string won't be there anymore... and I'd have to set it up again... and if i transfer my program.... then whoever downloaded it would have to set that up again..... so I guess my question is.... how to permanently change a string... i figured by transfering everything from one exe and sorta recompiling from within my program that would work for me.... but it ain't and seems complicated...

1) Download OllyDbg or similar program.
2) Run it and open the program you want to modify.
3) Find the string you want to change (most probably it will be somewhere in section .rodata).
4) If your new string is not longer than the old one then simply overwrite the old one and save changes. Otherwise you must find unused area of the appropriate size, write your string there, and modify all accesses to the string (find all instructions which contain constant equal to address of the old string, and replace this constant with address of the new string).
I think you can only do this with interpreted code or in assembly language. Any higher level AOT-compiled language won't really work because you can't choose where your .data section goes.
Be careful there on 4) because you might have collisions between your string's address and other things...
This is retarded. There has to be a configuration file somewhere.
umm... I'm guessin i should start with XML
There are a million ways of doing the same thing.

You can do this the hard way:
1) Write your own assembler/disassembler (Read Intel Software Developer Reference)
2) Parse PE File (Read tutorials on PE files and how they work)
3) Have program 'A' ask for options which then uses above knowledge to modify program 'B'

Or you can do this an easier way:
1) Have program 'A' ask for options and program 'A' writes your own script into program 'B' global memory buffer. (Just open file and write to it at the correct position)
2) Have program 'B' read a certain global memory buffer each time it starts up and program 'B' to parse that buffer into the commands it needs to do.

There are so many things you can do. You could even write program 'B' to load DLLs in the current directory. Your own plugin system.
Topic archived. No new replies allowed.