Joing with another program?

Pages: 12
Hello. Is there any way that I can write a program that can join itself onto another program file, so when the target program file is run, both itself and my program is executed. I dont want to have to create a third program or move the target program file or anything like that. If its possible, do you think you could give me some tips on how to go about doing it? Thankyou
Let me check I understand this; you have a program, B, and when it runs, you want another program, A, to also start, but you cannot alter B and you don't want to create a third program to watch out for when B starts, and have that third program start A?

No.
I only know how to do it in windows, using either:
1. CreateRemoteThread() - load a DLL in target process
2. executable patching, modifying binary EXE file of target process at assembly level

All this stuff is used by virus makers to hide malicious code in well known and legitimate processes.
Batch file?
Batch file?

That'd be a third program, surely, albeit written in a scripting language rather than C++?
Last edited on
Yea but cmon, it would take all but 5 minutes to write up.

But yea, I think what OP wants is impossible. No work != outcome
@Mostchops

No, Program A runs and 'joins' itself onto program B. Next time program B runs program A must run too, but the original program A can be moved or deleted, so they both share the same file
So you want program A to permanently alter program B, such that every time B starts, it also starts A, except that A no longer exists - all its functionality is now part of program B? So you actually just want a way to add functionality to an exisiting executable?
Last edited on
I love riddles :D

So, are the both programs created by yourself?

You can write a program, that starts automatically on windows logon. Then this program takes snapshots of the current running processes. And when program A is in the process list, so your program starts program B and vice versa.
You can write a program, that starts automatically on windows logon.


Nu uh! That's a third program!
Nu uh! That's a third program!


I missed that point :(
=> This riddle is not solvable!
@Moschops

Yes. For everyone else, I appoligise if my orginal post was a bit cryptic, but I will give an example:

MyProgram.exe
AnotherProgram.exe

Users runs MyProgram.exe

MyProgram.exe joins with AnotherProgram.exe

User runs AnotherProgram.exe

The code for MyProgram.exe and AnotherProgram.exe are both executed, as they are in the same file
I think (having clarified it a bit) that the answer is Modoran's above - executable patching. Which is generally the province of crackers and malware and virii writers.
What the hell does "joins with" mean in this context? Does it merge with it? Does it become associated in some way so that running one runs the other (entanglement anyone)? Does it join a civil union with the other program?

What are you trying to accomplish?
Last edited on
Oh okay, so does that mean I have to learn the x86 assembly language and merge my program into the code of the other program?

@residentBiscuit

the reason I say 'join' is because I have seen programs similar to mine called 'exe joiners' where two programs could be loaded and joined together, then you could delete the original program files and just run the new one and it would run the code of the two programs
Last edited on
This is starting to sound a lot like some malicious code, which I'm pretty certain modern OS won't let you do.
Im not up to anything dastardly, I'm just curious to see if it could be done. It sounds like quite an interesting programming project
Last edited on
the reason I say 'join' is because I have seen programs similar to mine called 'exe joiners' where two programs could be loaded and joined together, then you could delete the original program files and just run the new one and it would run the code of the two programs


I've personally never seen one of these, but that's a third program. You're asking to join two programs without making a third.

Learn a little about what a compiler does, and maybe a bit on general von Neumann architecture and you'll see why this is almost* impossible.
Presumably, you could take two programs, cat them together (or some other such easily reversible smooshing together), and stick them as data onto a program that simply silently unsmooshes them and runs them.
But then we're writing a 3rd program :(
Pages: 12