{Ä Fido Pascal Conference ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ PASCAL Ä Msg : 275 of 298 From : Amir Geva 2:403/138.0 04 Apr 93 01:02 To : Eric Ort Subj : " .EXE " File Headers... ÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ Hi. EO> Could anyone out there tell me how to read in a .EXE File Header, so EO> I can manipulate a program based on the info therein ?? } ===================================================================== == The format of an EXE load module. == ===================================================================== Byte Offset 0000H First part of EXE file signature (4DH) 0001H Seconed part of EXE signature (5AH) 0002H Length of file MOD 512 0004H Size of file in 512-byte pages, including header 0006H Number of relocation table items 0008H Size of header in paragraphs 000AH Minimum number of paragraphs needed above program 000CH Maximum number of paragraphs desired above program 000EH Segment displacement of stack module 0010H Contents of SP register at entry 0012H Word checksum 0014H Contents of IP register at entry 0016H Segment displacement of code module 0018H Offset of first relocation item in file 001AH Overlay number (0 for resident part of program) 001BH Variable reserved space . . Relocation table . . Varible reserved space . . . Program and data segments . . . . Stack segment . . ===================================================================== ===================================================================== == A memory image of a typical EXE file just after loading == ===================================================================== +---------------------------------------+ SS:SP | | | Stack segment: stack grows | | downward from top of segment | | | +---------------------------------------+ SS:0000H | | | Data Segemnt | | | +---------------------------------------+ | | | | | Program Code | | | | | +---------------------------------------+ CS:0000H | | | Program Segment Prefix | | | +---------------------------------------+ DS:0000H bye Amir @ 2:401/450