Merge Two .Exe's

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fabez
    New Member
    • Oct 2008
    • 29

    Merge Two .Exe's

    Is it possible to merge two Windows .Exe's using C, C++ or another high level language ? If it is any pointers or advice would be greatly appreciated, if not which language is it possible to code a binder in ? Also is it possible in C, C++ or another high level language to insert code into another .Exe ?
  • TamusJRoyce
    New Member
    • Apr 2008
    • 108

    #2
    You could use notepad to copy the two files together :P Sorry. Couldn't help but joke about that (And I'm guilty of that when I first started using a computer as a kid--along with getting in trouble).

    This isn't really a C++ question unless you are curious how to do it in C/C++.

    I don't believe there is any way to access one Exe's functions from another. Usually you want to hide everything you are doing in an Exe so no one can steal your code. And since both functions contain a main function (point of execution), after merging them, there would be no way to tell which main function to run.

    Look into COM as it's like an executable which advertises all it's functions (so your Exe can execute the functions from COM). .NET is the upgrade to .COM files, so the same holds true for .NET libraries.

    I think you would most likely be looking for how to make libraries, though. A .DLL library (being windows specific here : ) can have a main execution point in it, while holding all the functions and everything you would want. And then from your Exe you could access the functions from there.

    Or you could make a program in C++ which deligates between program A and program B what goes on. If program A and B are command line programs, it's a matter of sending and receiving command line arguments/buffer data between them. If they are graphical programs, you can use the Windows API (or for linux, you would use it's subsystem) to get each Window ID and deligate what input/output goes where (tough to do, but it's possible).

    But this is really a very abstract question, so what does the two exe's that you are trying to combined do?

    Comment

    • Fabez
      New Member
      • Oct 2008
      • 29

      #3
      It is a password protection program I am making, so I have control over one of the .Exe's source code. The other .Exe is the one that the user has opted to have password protected, so I do not have any control over it. I tried binding them in notepad at first, but it didnt work :D

      Comment

      • TamusJRoyce
        New Member
        • Apr 2008
        • 108

        #4
        Notepad converts every character (a 0-255 ascii based number) to half of that (0-128 numbers). This means that when you open up a binary file with notepad, you have already ruined the machine code. Also, code is written in english (like the C/C++ Language) then compiled to a machine code executable. You can't program in machine code (Assembly Code is the closest to it, and it even produces poor code compared to using a c++ compiler) or do anything with it except execute it.

        I would go to say if you are an advanced computer programmer, then yes, assembly language can produce better code than C++ or any other language possible (smaller, tighter, with less memory usage). But by the time it takes you to write a small amount of assembly, you could finish a large program which would run about the same speed, anyways, in most cases.

        Inside the source of the executable you have, you can have it execute the other .exe and send/recieve data through pipes (since it sounds command line like). You'll have to be able to compile that source code into the respective .exe to get that to work.

        Look into something like batch file programming (.bat shell programming in windows, and .sh shell programming in linux), otherwise. With this type of programming you can use pipes to send data from one .exe to the other.

        The general section may have some more info on how to do what you are wanting to do, as it's not really a C++ thing--unless you have some specific code you are working on you can show.

        -Programming project for you. Write a hello world application in each of these languages: C++, C#, Java, and Visual Basic using: Microsoft Visual Studio Express .Net and Netbeans (Both open source, public licensed, and free).

        Comment

        • blackjack2150
          New Member
          • Feb 2007
          • 79

          #5
          Originally posted by TamusJRoyce
          -Programming project for you. Write a hello world application in each of these languages: C++, C#, Java, and Visual Basic using: Microsoft Visual Studio Express .Net and Netbeans (Both open source, public licensed, and free).
          You're kidding, right? VS Express is free, but nowhere near open source.

          Comment

          • Fabez
            New Member
            • Oct 2008
            • 29

            #6
            TamusJRoyce the notepad idea was a joke and I knew what you told me but thanks anyway. Im not going to do your little project as it is in no way related to what I have asked. Ashitpro, thanks for the information, I will take a look at the link and see what else I can find. I would use ADS, but that is NTFS dependant, so does anyone know the FAT32 equivilent ?

            Comment

            • TamusJRoyce
              New Member
              • Apr 2008
              • 108

              #7
              Ah... I was assuming you where a beginner programmer. Merging two exe's isn't really a C++ thing, more of an Operating Systems thing from how the question was described. I usually see kids just first getting into programming who think they can program an exe by copy & pasting the executables together. I meant no disrespect...An d thanks for changing the question to be more readable : )

              Read into COFF file format utilities for executables if you are still looking to merge the two executables. But it sounds like the executable you are having problems with is accessing the Registry or something to determine if it can run? Or maybe it depends on the location of this executable (with it being in the system directory, or program files). It may very well rely on some DLL's which get disabled when you disable access to notepad.exe.

              You may be able to run Microsoft Spy (forget the name) utility to determine everything it accesses.

              There are really no Fat32 equivelents that I know of besides MS-FAT-8/16/32. FAT has been around long before MS, though their implementation of it became the most popular (with their simple file system header). Try searching some Minix custom file systems for something similar?

              I work over 85 hours a week, so take my reply's kinda half heartedly. If it helps, go for it. Otherwise, just consider it un-useful info & reply about it being so (which you've done).

              Hopefully Helpful,

              Tamus J. Royce

              Comment

              • donbock
                Recognized Expert Top Contributor
                • Mar 2008
                • 2427

                #8
                Perhaps you could research how self-extracting zip files are created. I don't know, but perhaps you could modify that process to end up with something like what you want.

                Comment

                Working...