Jump to content

Copy ?


rufus777
 Share

Recommended Posts

I know that I'm stupid, But "copy /B file1 + file 2 file3"

In c + + so I've created a file "system (" echo Mickey was here !!!"); and a file that has "system (" echo ... and here !!!");.

( mikke.exe / mikke2.exe )

Thus, copy /B mikke.exe + mikke2.exe mikke3.exe

When I take mikke3.exe to run it, so I get the "Mickey was here!" to nothing more ...

hehe, I know it's a bit stupid, but help me? :)

Link to comment
Share on other sites

I'm not a programmer, but if you wanted to have two programs in one, I think you need to explicitly call the second program from the first one if your condition is met, ie: If program 1 is done doing its routine and was successful, execute program 2, else exit. There are ways to "package" multiple executables together, but I don't know that a straight binary copy of 2 files into a third output will warrant the results you are after.

Edited by digip
Link to comment
Share on other sites

Thus, copy /B mikke.exe + mikke2.exe mikke3.exe

When I take mikke3.exe to run it, so I get the "Mickey was here!" to nothing more ...

The answer here is to learn a bit about the layout of a Window PE file (Portable Executable). A very simple outline of a PE file is

DOS Executable code
PE Header
Section
Section
Section

The DOS executable code is there to tell the user that they can't use the program in DOS if they run it from DOS (Note that with windows XP and beyond not being built on top of DOS in the modern day it doesn't do anything)

The PE header tells windows dynamic linker how to map the sections into memory and some other information to do with the program, like where to start.

When you append another program onto the end of an existing one the file would look like

DOS Executable code
PE Header
Section
Section
Section
DOS Executable code
PE Header
Section
Section
Section

Windows takes the program and uses the first PE Header to map it all into memory and starts running the code from where the PE header tells it. Windows doesn't see the second PE header so the sections for the second program don't get mapped into memory, and they don't get run.

Link to comment
Share on other sites

The answer here is to learn a bit about the layout of a Window PE file (Portable Executable). A very simple outline of a PE file is

DOS Executable code
PE Header
Section
Section
Section

The DOS executable code is there to tell the user that they can't use the program in DOS if they run it from DOS (Note that with windows XP and beyond not being built on top of DOS in the modern day it doesn't do anything)

The PE header tells windows dynamic linker how to map the sections into memory and some other information to do with the program, like where to start.

When you append another program onto the end of an existing one the file would look like

DOS Executable code
PE Header
Section
Section
Section
DOS Executable code
PE Header
Section
Section
Section

Windows takes the program and uses the first PE Header to map it all into memory and starts running the code from where the PE header tells it. Windows doesn't see the second PE header so the sections for the second program don't get mapped into memory, and they don't get run.

what about linux?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...