Page 1 of 1
pe exe
Posted: Sun Jan 25, 2004 11:46 am
by slacker
what do i have to do in loading a pe exe to memory
Re:pe exe
Posted: Sun Jan 25, 2004 12:11 pm
by Schol-R-LEA
AFIAK, the best source of information about loading executables is the book
Linkers and Loaders; an early version of which can be found
online.
Details of the PE format itself can be gotten from
Microsoft's website. A more basic
overview can be found on MSDN.
You may want to read
reply #6 in this thread first, for a quick explanation of the principles of relocatable file formats. HTH.
Re:pe exe
Posted: Sun Jan 25, 2004 7:08 pm
by slacker
so all i have to do is load the exe to the preferred base address and jump to the entry point?
Re:pe exe
Posted: Mon Jan 26, 2004 3:14 am
by Pype.Clicker
if it doesn't have unresolved links, yes ... otherwise, you might also need to load DLLs first and link the EXE with those DLLs ...
Re:pe exe
Posted: Mon Jan 26, 2004 11:01 am
by slacker
is there anyway to know if there are unresolved links?
Re:pe exe
Posted: Mon Jan 26, 2004 11:43 am
by Tim
In the kernel: There won't be unresolved links, unless you wanted there to be.
In applications: The import directory (see the PE format spec) tells you which DLLs the application references, and which functions it wants in those DLLs.
So:
For each DLL in the import directory
Load the DLL
For each function imported from that DLL
Look up the export from the DLL
Put a pointer to the export into the import address table
End For
End For