COFFI
1.2
               
msdos_header Struct Reference

MS-DOS file header. More...

Data Fields

uint16_t signature
 0x4d, 0x5a. This is the "magic number" of an EXE file
 
uint16_t bytes_in_last_block
 The number of bytes in the last block of the program that are actually used. More...
 
uint16_t blocks_in_file
 Number of blocks in the file that are part of the EXE file. More...
 
uint16_t num_relocs
 Number of relocation entries stored after the header. May be zero.
 
uint16_t header_paragraphs
 Number of paragraphs in the header. More...
 
uint16_t min_extra_paragraphs
 Number of paragraphs of additional memory that the program will need. More...
 
uint16_t max_extra_paragraphs
 Maximum number of paragraphs of additional memory. More...
 
uint16_t ss
 Relative value of the stack segment. More...
 
uint16_t sp
 Initial value of the SP register.
 
uint16_t checksum
 Word checksum. More...
 
uint16_t ip
 Initial value of the IP register (entry point).
 
uint16_t cs
 Initial value of the CS register, relative to the segment the program was loaded at.
 
uint16_t reloc_table_offset
 Offset of the first relocation item in the file.
 
uint16_t overlay_number
 Overlay number. Normally zero, meaning that it's the main program.
 
uint16_t reserved1 [4]
 
uint16_t oem_id
 
uint16_t oem_info
 
uint16_t reserved2 [10]
 
int32_t pe_sign_location
 Location of PE format signature.
 

Detailed Description

MS-DOS file header.

Definition at line 659 of file coffi_types.hpp.

Field Documentation

◆ blocks_in_file

uint16_t blocks_in_file

Number of blocks in the file that are part of the EXE file.

If [02-03] is non-zero, only that much of the last block is used

Definition at line 670 of file coffi_types.hpp.

◆ bytes_in_last_block

uint16_t bytes_in_last_block

The number of bytes in the last block of the program that are actually used.

If this value is zero, that means the entire last block is used (i.e. the effective value is 512)

Definition at line 666 of file coffi_types.hpp.

◆ checksum

uint16_t checksum

Word checksum.

If set properly, the 16-bit sum of all words in the file should be zero. Usually, this isn't filled in.

Definition at line 697 of file coffi_types.hpp.

◆ header_paragraphs

uint16_t header_paragraphs

Number of paragraphs in the header.

The program's data begins just after the header, and this field can be used to calculate the appropriate file offset. The header includes the relocation entries. Note that some OSs and/or programs may fail if the header is not a multiple of 512 bytes.

Definition at line 678 of file coffi_types.hpp.

◆ max_extra_paragraphs

uint16_t max_extra_paragraphs

Maximum number of paragraphs of additional memory.

Normally, the OS reserves all the remaining conventional memory for your program, but you can limit it with this field.

Definition at line 687 of file coffi_types.hpp.

◆ min_extra_paragraphs

uint16_t min_extra_paragraphs

Number of paragraphs of additional memory that the program will need.

This is the equivalent of the BSS size in a Unix program. The program can't be loaded if there isn't at least this much memory available to it

Definition at line 683 of file coffi_types.hpp.

◆ ss

uint16_t ss

Relative value of the stack segment.

This value is added to the segment the program was loaded at, and the result is used to initialize the SS register.

Definition at line 691 of file coffi_types.hpp.


The documentation for this struct was generated from the following file: