en:docs:tk:formats:newexe

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
en:docs:tk:formats:newexe [2024/09/25 06:08] prokusheven:docs:tk:formats:newexe [2024/10/13 14:35] (current) prokushev
Line 1: Line 1:
 +====== New Executable file format ======
 +
 +New Executable (NE) file format used by set of operating system including OS/2, Windows, Multitasking MS-DOS 4 and set of DOS Extenders. It is designed to be store on disk and in-memory usage. In-disk format is same for all OSes, but In-memory usage is mostly specific for Windows systems.
 +
 ^ Offset ^ Size ^ Name ^ Description ^ ^ Offset ^ Size ^ Name ^ Description ^
 | 00h | WORD | ne_magic | Signature word NEMAGIC | | 00h | WORD | ne_magic | Signature word NEMAGIC |
Line 71: Line 75:
     } ns_union;     } ns_union;
 }; };
 +
 +Relocation table header
  
 ^ Offset ^ Size ^ Name ^ Description ^ ^ Offset ^ Size ^ Name ^ Description ^
-| 00h | WORD | nr_nreloc | ??? |+| 00h | WORD | nr_nreloc | Number of relocation table entries |
  
 +Relocation table entry
 +
 +^ Offset ^ Size ^ Name ^ Description ^
 +| 00h | char | nr_stype | Source type (0Fh = NRSTYP - source mask): 00h = LOBYTE, 02h = SEGMENT, 03h = FAR_ADDR (32-bit pointer), 05h = OFFSET (16-bit offset) |
 +| 01h | char | nr_flags | Flags byte (03h = TARGET_MASK): 00h = INTERNALREF, 01h = IMPORTORDINAL, 02h = IMPORTNAME, 03h = OSFIXUP, 04h = ADDITIVE |
 +| 02h | WORD | nr_soff | Offset within this segment of the source chain. If the ADDITIVE flag is set, then target value is added to the source contents, instead of replacing the source and following the chain. The source chain is an 0FFFFh terminated linked list within this segment of all references to the target |
 +| Internal fixup ||||
 +| 04h | char | nr_segno | Segment number (for fixed segment) or 0FFh (for movable segment) |
 +| 05h | char | nr_res | Reserved (usually zero) |
 +| 06h | WORD | nr_entry | Entry table number (for movable segment) offset segment |
 +| Import ||||
 +| 04h | WORD | nr_mod | ??? |
 +| 06h | WORD | nr_proc | ??? |
 +| OS Fixup ||||
 +| 04h | WORD | nr_ostype | ??? |
 +| 06h | WORD | nr_osres | ??? |
  
-struct new_rlc { 
-    char            nr_stype; 
-    char            nr_flags; 
-    WORD  nr_soff; 
-    union { 
-        struct { 
-            char            nr_segno; 
-            char            nr_res; 
-            WORD  nr_entry; 
-          } nr_intref; 
-        struct { 
-            WORD  nr_mod; 
-            WORD  nr_proc; 
-          } nr_import; 
-        struct { 
-            WORD  nr_ostype; 
-            WORD  nr_osres; 
-          } nr_osfix; 
-      } nr_union; 
-}; 
  
 ^ Offset ^ Size ^ Name ^ Description ^ ^ Offset ^ Size ^ Name ^ Description ^