pe exe

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
slacker

pe exe

Post by slacker »

what do i have to do in loading a pe exe to memory
Schol-R-LEA

Re:pe exe

Post 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.
slacker

Re:pe exe

Post by slacker »

so all i have to do is load the exe to the preferred base address and jump to the entry point?
User avatar
Pype.Clicker
Member
Member
Posts: 5964
Joined: Wed Oct 18, 2006 2:31 am
Location: In a galaxy, far, far away
Contact:

Re:pe exe

Post 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 ...
slacker

Re:pe exe

Post by slacker »

is there anyway to know if there are unresolved links?
Tim

Re:pe exe

Post 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
Post Reply