Imported-Name Table
The imported-name table contains the names of modules that the executable
file imports. Each entry contains two parts: a single byte that specifies
the length of the string and the string itself. The strings in this table
are not null-terminated.
Entry Table
The entry table contains bundles of entry points from the executable file
(the linker generates each bundle). The numbering system for these ordinal
values is 1-based--that is, the ordinal value corresponding to the first
entry point is 1.
The linker generates the densest possible bundles under the restriction that
it cannot reorder the entry points. This restriction is necessary because
other executable files may refer to entry points within a given bundle by
their ordinal values.
The entry-table data is organized by bundle, each of which begins with a
2-byte header. The first byte of the header specifies the number of entries
in the bundle (a value of 00h designates the end of the table). The second
byte specifies whether the corresponding segment is movable or fixed. If the
value in this byte is 0FFh, the segment is movable. If the value in this
byte is 0FEh, the entry does not refer to a segment but refers, instead, to
a constant defined within the module. If the value in this byte is neither
0FFh nor 0FEh, it is a segment index.
For movable segments, each entry consists of 6 bytes and has the following
form:
- 00h: Specifies a byte value. This value can be a combination of the
following bits:
Bit(s): Meaning
- 0: If this bit is set, the entry is exported.
- 1: If this bit is set, the segment uses a global (shared) data segment.
- 3-7: If the executable file contains code that performs ring
transitions, these bits specify the number of words that compose the
stack. At the time of the ring transition, these words must be copied
from one ring to the other.
- 01h: An int 3fh instruction.
- 03h: The segment number.
- 04h: The segment offset.
For fixed segments, each entry consists of 3 bytes and has the following form:
- 00h: Specifies a byte value. This value can be a combination of the
following bits:
- 0: If this bit is set, the entry is exported.
- 1: If this bit is set, the entry uses a global (shared) data segment.
(This may be set only for SINGLEDATA library modules.)
- 3-7: If the executable file contains code that performs ring transitions,
these bits specify the number of words that compose the stack. At the time
of the ring transition, these words must be copied from one ring to the
other.
- 01h: Specifies an offset.
Nonresident-Name Table
The nonresident-name table contains strings that identify exported functions
in the executable file. As the name implies, these strings are not always
resident in system memory and are discardable. The nonresident-name strings
are case-sensitive; they are not null-terminated. The following list
summarizes the values found in the nonresident-name table (the specified
locations are relative to the beginning of each entry):
- 00h: The length, in bytes, of a string. If this byte is 00h, there are no
more strings in the table.
- 01h - xxh: The nonresident-name text. This string is case-sensitive and
is not null-terminated.
- xx + 01h: An ordinal number that is an index to the entry table.
The first name that appears in the nonresident-name table is the module
description string (which was specified in the module-definition file).
Code Segments and Relocation Data
Code and data segments follow the Windows header. Some of the code segments
may contain calls to functions in other segments and may, therefore, require
relocation data to resolve those references. This relocation data is stored
in a relocation table that appears immediately after the code or data in the
segment. The first 2 bytes in this table specify the number of relocation
items the table contains. A relocation item is a collection of bytes
specifying the following information:
- Address type (segment only, offset only, segment and offset)
- Relocation type (internal reference, imported ordinal, imported name)
- Segment number or ordinal identifier (for internal references)
- Reference-table index or function ordinal number (for imported ordinals)
- Reference-table index or name-table offset (for imported names)
Each relocation item contains 8 bytes of data, the first byte of which
specifies one of the following relocation-address types:
- 0: Low byte at the specified offset
- 2: 16-bit selector
- 3: 32-bit pointer
- 5: 16-bit offset
- 11: 48-bit pointer
- 13: 32-bit offset
The second byte specifies one of the following relocation types:
- 0: Internal reference
- 1: Imported ordinal
- 2: Imported name
- 3: OSFIXUP
The third and fourth bytes specify the offset of the relocation item within
the segment.
If the relocation type is imported ordinal, the fifth and sixth bytes
specify an index to a module's reference table and the seventh and eighth
bytes specify a function ordinal value.
If the relocation type is imported name, the fifth and sixth bytes specify
an index to a module's reference table and the seventh and eighth bytes
specify an offset to an imported-name table.
If the relocation type is internal reference and the segment is fixed, the
fifth byte specifies the segment number, the sixth byte is zero, and the
seventh and eighth bytes specify an offset to the segment. If the relocation
type is internal reference and the segment is movable, the fifth byte
specifies 0FFh, the sixth byte is zero; and the seventh and eighth bytes
specify an ordinal value found in the segment's entry table.