Format:NE (New Executable)
| Platforms | Platform:Win16, OS/2 1.x |
|---|---|
| Magic | 4E 45 ("NE"), at the offset stored at 0x3C |
| Extensions | .exe, .dll, .drv, .fon |
| Endianness | little |
| On this wiki | Facts · Code · Notes · Topics |
16-bit segmented executable format of Windows 1.x–3.x, OS/2 1.x and multitasking MS-DOS 4, used for .EXE, .DLL, .DRV and .FON files. An MZ stub's offset at 0x3C points to the NE header, whose signature is "NE".
Layout
The file starts with an MS-DOS MZ stub (Format:DOS MZ executable, whose header and stub are shared with Format:PE (Portable Executable)). The DWORD at offset 0x3C is the file offset of the NE header, which starts with the bytes 4E 45. The header gives the offsets, relative to itself, of the segment table, resource table, resident-name table, module-reference table, imported-name table and entry table; the non-resident-name table offset is relative to the start of the file.
Each segment table entry gives the segment's position in sectors (shifted by the file's alignment shift count), its length, flags and minimum allocation size. A segment with relocations has its relocation records right after its data.
Code refers to other segments with far calls that the loader patches through those relocation records, which is why addresses in a disassembly are written as segment:offset (CS:, DS:).
Resources
The resource table starts with a WORD alignment shift. Type entries follow, each with a WORD type ID, a WORD resource count and 4 reserved bytes, then one 12-byte entry per resource: offset and length (both in units of 2^shift bytes), flags, resource ID and 4 reserved bytes. A type or resource ID with the high bit set is an integer (for example type 0x8002 is RT_BITMAP); otherwise it is an offset to a length-prefixed name. A type ID of 0 ends the table.
Bitmap resources are stored without the 14-byte BITMAPFILEHEADER, starting at the BITMAPINFOHEADER (or the older BITMAPCOREHEADER). To save one as a .bmp file, prepend a BITMAPFILEHEADER whose pixel-data offset accounts for the header and color table sizes.
.FON font files are code-less NE modules whose resources are bitmap or vector fonts: type 0x8007 (RT_FONTDIR, one directory) and 0x8008 (RT_FONT, one Windows FNT font per point size, starting with dfVersion 0x0200 or 0x0300 and dfSize; bit 0 of dfType set means a vector font), often with 0x8010 (RT_VERSION). All 192 .fon files of a Windows 11 font directory are NE files of this shape (179 with RT_VERSION, 3 with type 0x800F). Library:FreeType's winfonts driver opens them directly (NE, and PE .fon files with RT_FONT 8) and bare .fnt resources, but only bitmap FNT fonts: vector ones fail with Unknown_File_Format (src/winfonts/winfnt.c, lines 227-259 and 567 at VER-2-15-0).
Observed in
- Software:SkiFree: 86 integer-ID RT_BITMAP resources, all 4 bpp.