NE: Difference between revisions

From OSDev.wiki
Jump to navigation Jump to search
[unchecked revision][unchecked revision]
Content added Content deleted
(Added info opn fromat. Incomplete, more to be added soon (time restriction). Please do not delete.)
(added to NE structure)
Line 13: Line 13:
==Overview==
==Overview==
===DOS Stub===
===DOS Stub===
The DOS stub is a valid MZ exe. This enables the develper to package both an MS-DOS and Win16 version of the program, but nromally just prints "This Program requires Microsoft Windows". The e_lfanew field (offset 0x3C) points to the NE header.
The DOS stub is a valid [[MZ]] exe. This enables the develper to package both an MS-DOS and Win16 version of the program, but nromally just prints "This Program requires Microsoft Windows". The e_lfanew field (offset 0x3C) points to the NE header.


===NE Header===
===NE Header===
The NE header is a relatively large structure with multiple characteristics. The structure is as below:
The NE header is a relatively large structure with multiple characteristics. Because of the age of the format some items are unclear in meaning. The structure is as below (some comments may be wrong. If so please change):
<source lang="c">
<source lang="cpp">
struct NE_header {
struct NE_header {
char sig[2]; //"NE"
char sig[2]; //"NE"
Line 24: Line 24:
uint16 EntryTableOffset; //Offset of entry table, see below
uint16 EntryTableOffset; //Offset of entry table, see below
uint16 EntryTableLength; //Length of entry table in bytes
uint16 EntryTableLength; //Length of entry table in bytes
uint32 FileLoadCRC; //
uint32 FileLoadCRC; //UNKNOWN - PLEASE ADD INFO
uint8 ProgFlags; //Program flags, bitmapped
uint8 ApplFlags; //Application flags, bitmapped
uint8 AutoDataSegIndex; //The automatic data segment index
uint16 InitHeapSize; //The intial local heap size
uint16 InitStackSize; //The inital stack size
uint32 EntryPoint; //CS:IP entry point, CS is index into segment table
uint32 InitStack; //SS:SP inital stack pointer, SS is index into segment table
uint16 SegCount; //Number of segments in segment table
uint16 ModRefs; //Number of module references (DLLs)
uint16 NoResNamesTabSiz; //Size of non-resident names table, in bytes (Please clarify non-resident names table)
uint16 SegTableOffset; //Offset of Segment table
uint16 ResTableOffset; //Offset of resources table
uint16 ResidNamTable; //Offset of resident names table
uint16 ModRefTable; //Offset of module reference table
uint16 ImportNameTable; //Offset of imported names table (array of counted strings, terminated with string of length 00h)
uint32 OffStartNonResTab; //Offset from start of file to non-resident names table
uint16 MovEntryCount; //Count of moveable entry point listed in entry table
uint16 FileAlnSzShftCnt; //File alligbment size shift count (0=9(default 512 byte pages))
uint16 nResTabEntries; //Number of resource table entries
uint8 targOS; //Target OS
uint8 OS2EXEFlags; //Other OS/2 flags
uint16 retThunkOffset; //Offset to return thunks or start of gangload area - what is gangload?
uint16 segrefthunksoff; //Offset to segment reference thunks or size of gangload area
uint16 mincodeswap; //Minimum code swap area size
uint8 expctwinver[2]; //Expected windows version (minor first)
};


//Program flags
enum dgrouptype {
none,
sinshared,
multiple,
null
};
};
#define GLOBINIT 1<<2
#define PMODEONLY 1<<3
#define INSTRUC86 1<<4
#define INSTRU286 1<<5
#define INSTRU386 1<<6
#define INSTRUx87 1<<7
</source>
</source>



Revision as of 12:38, 22 October 2012

This page is a stub.
You can help the wiki by accurately adding more contents to it.
Executable Formats
Microsoft

16 bit:
COM
MZ
NE
Mixed (16/32 bit):
LE
32/64 bit:
PE
COFF

*nix
Apple

NE

Introduction

The WIN-NE executable format, designed for Windows 3.x, was the "NE", or "New Executable" format. Again, a 16bit format, it alleviated the maximum size restrictions that the MZ format had.

Support

Operating Systems that use it: Windows 1.01 through 3.xx. The format can be run on later 32 bit windows systems (in a VDM), but is not the native format.
Because of 64 bit lack of v8086, support is discarded on 64 bit windows.

Inside the NE file

Overview

DOS Stub

The DOS stub is a valid MZ exe. This enables the develper to package both an MS-DOS and Win16 version of the program, but nromally just prints "This Program requires Microsoft Windows". The e_lfanew field (offset 0x3C) points to the NE header.

NE Header

The NE header is a relatively large structure with multiple characteristics. Because of the age of the format some items are unclear in meaning. The structure is as below (some comments may be wrong. If so please change):

struct NE_header {
    char sig[2];               //"NE"
    uint8 MajLinkerVersion;    //The major linker version
    uint8 MinLinkerVersion;    //The minor linker version
    uint16 EntryTableOffset;   //Offset of entry table, see below
    uint16 EntryTableLength;   //Length of entry table in bytes
    uint32 FileLoadCRC;        //UNKNOWN - PLEASE ADD INFO
    uint8 ProgFlags;           //Program flags, bitmapped
    uint8 ApplFlags;           //Application flags, bitmapped
    uint8 AutoDataSegIndex;    //The automatic data segment index
    uint16 InitHeapSize;       //The intial local heap size
    uint16 InitStackSize;      //The inital stack size
    uint32 EntryPoint;         //CS:IP entry point, CS is index into segment table
    uint32 InitStack;          //SS:SP inital stack pointer, SS is index into segment table
    uint16 SegCount;           //Number of segments in segment table
    uint16 ModRefs;            //Number of module references (DLLs)
    uint16 NoResNamesTabSiz;   //Size of non-resident names table, in bytes (Please clarify non-resident names table)
    uint16 SegTableOffset;     //Offset of Segment table
    uint16 ResTableOffset;     //Offset of resources table
    uint16 ResidNamTable;      //Offset of resident names table
    uint16 ModRefTable;        //Offset of module reference table
    uint16 ImportNameTable;    //Offset of imported names table (array of counted strings, terminated with string of length 00h)
    uint32 OffStartNonResTab;  //Offset from start of file to non-resident names table
    uint16 MovEntryCount;      //Count of moveable entry point listed in entry table
    uint16 FileAlnSzShftCnt;   //File alligbment size shift count (0=9(default 512 byte pages))
    uint16 nResTabEntries;     //Number of resource table entries
    uint8 targOS;              //Target OS
    uint8 OS2EXEFlags;         //Other OS/2 flags
    uint16 retThunkOffset;     //Offset to return thunks or start of gangload area - what is gangload?
    uint16 segrefthunksoff;    //Offset to segment reference thunks or size of gangload area
    uint16 mincodeswap;        //Minimum code swap area size
    uint8 expctwinver[2];      //Expected windows version (minor first)
};

//Program flags
enum dgrouptype {
    none,
    sinshared,
    multiple,
    null
};
#define GLOBINIT 1<<2
#define PMODEONLY 1<<3
#define INSTRUC86 1<<4
#define INSTRU286 1<<5
#define INSTRU386 1<<6
#define INSTRUx87 1<<7

See Also

NE

Executables