[8003] | 1 | /* $Id: NEexe.h,v 1.1 2002-02-24 02:47:23 bird Exp $
|
---|
| 2 | *
|
---|
| 3 | * NE DEFINITIONS AND DECLARATIONS.
|
---|
| 4 | * --------------------------------
|
---|
| 5 | *
|
---|
| 6 | * Copyright Robert J. Amstadt, 1993
|
---|
| 7 | * Copyright knut st. osmundsen (2001) (I've messed them up ;-)
|
---|
| 8 | *
|
---|
| 9 | */
|
---|
| 10 |
|
---|
| 11 | #ifndef _NEexe_h_
|
---|
| 12 | #define _NEexe_h_
|
---|
| 13 |
|
---|
| 14 | #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
---|
| 15 |
|
---|
| 16 | /*
|
---|
| 17 | * This is the Windows executable (NE) header.
|
---|
| 18 | * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
|
---|
| 19 | */
|
---|
| 20 | typedef struct
|
---|
| 21 | {
|
---|
| 22 | unsigned short ne_magic; /* 00 NE signature 'NE' */
|
---|
| 23 | unsigned char ne_ver; /* 02 Linker version number */
|
---|
| 24 | unsigned char ne_rev; /* 03 Linker revision number */
|
---|
| 25 | unsigned short ne_enttab; /* 04 Offset to entry table relative to NE */
|
---|
| 26 | unsigned short ne_cbenttab; /* 06 Length of entry table in bytes */
|
---|
| 27 | unsigned long ne_crc; /* 08 Checksum */
|
---|
| 28 | unsigned short ne_flags; /* 0c Flags about segments in this file */
|
---|
| 29 | unsigned short ne_autodata; /* 0e Automatic data segment number */
|
---|
| 30 | unsigned short ne_heap; /* 10 Initial size of local heap */
|
---|
| 31 | unsigned short ne_stack; /* 12 Initial size of stack */
|
---|
| 32 | unsigned long ne_csip; /* 14 Initial CS:IP */
|
---|
| 33 | unsigned long ne_sssp; /* 18 Initial SS:SP */
|
---|
| 34 | unsigned short ne_cseg; /* 1c # of entries in segment table */
|
---|
| 35 | unsigned short ne_cmod; /* 1e # of entries in module reference tab. */
|
---|
| 36 | unsigned short ne_cbnrestab; /* 20 Length of nonresident-name table */
|
---|
| 37 | unsigned short ne_segtab; /* 22 Offset to segment table */
|
---|
| 38 | unsigned short ne_rsrctab; /* 24 Offset to resource table */
|
---|
| 39 | unsigned short ne_restab; /* 26 Offset to resident-name table */
|
---|
| 40 | unsigned short ne_modtab; /* 28 Offset to module reference table */
|
---|
| 41 | unsigned short ne_imptab; /* 2a Offset to imported name table */
|
---|
| 42 | unsigned long ne_nrestab; /* 2c Offset to nonresident-name table */
|
---|
| 43 | unsigned short ne_cmovent; /* 30 # of movable entry points */
|
---|
| 44 | unsigned short ne_align; /* 32 Logical sector alignment shift count */
|
---|
| 45 | unsigned short ne_cres; /* 34 # of resource segments */
|
---|
| 46 | unsigned char ne_exetyp; /* 36 Flags indicating target OS */
|
---|
| 47 | unsigned char ne_flagsothers; /* 37 Additional information flags */
|
---|
| 48 | unsigned short fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/
|
---|
| 49 | unsigned short fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */
|
---|
| 50 | unsigned short ne_swaparea; /* 3c Reserved by Microsoft */
|
---|
| 51 | unsigned short ne_expver; /* 3e Expected Windows version number */
|
---|
| 52 | } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
|
---|
| 53 |
|
---|
| 54 | /*
|
---|
| 55 | * NE Header FORMAT FLAGS
|
---|
| 56 | */
|
---|
| 57 | #define NE_FFLAGS_SINGLEDATA 0x0001
|
---|
| 58 | #define NE_FFLAGS_MULTIPLEDATA 0x0002
|
---|
| 59 | #define NE_FFLAGS_WIN32 0x0010
|
---|
| 60 | #define NE_FFLAGS_BUILTIN 0x0020 /* Wine built-in module */
|
---|
| 61 | #define NE_FFLAGS_FRAMEBUF 0x0100 /* OS/2 fullscreen app */
|
---|
| 62 | #define NE_FFLAGS_CONSOLE 0x0200 /* OS/2 console app */
|
---|
| 63 | #define NE_FFLAGS_GUI 0x0300 /* right, (NE_FFLAGS_FRAMEBUF | NE_FFLAGS_CONSOLE) */
|
---|
| 64 | #define NE_FFLAGS_SELFLOAD 0x0800
|
---|
| 65 | #define NE_FFLAGS_LINKERROR 0x2000
|
---|
| 66 | #define NE_FFLAGS_CALLWEP 0x4000
|
---|
| 67 | #define NE_FFLAGS_LIBMODULE 0x8000
|
---|
| 68 |
|
---|
| 69 | /*
|
---|
| 70 | * NE Header OPERATING SYSTEM
|
---|
| 71 | */
|
---|
| 72 | #define NE_OSFLAGS_UNKNOWN 0x01
|
---|
| 73 | #define NE_OSFLAGS_WINDOWS 0x04
|
---|
| 74 |
|
---|
| 75 | /*
|
---|
| 76 | * NE Header ADDITIONAL FLAGS
|
---|
| 77 | */
|
---|
| 78 | #define NE_AFLAGS_WIN2_PROTMODE 0x02
|
---|
| 79 | #define NE_AFLAGS_WIN2_PROFONTS 0x04
|
---|
| 80 | #define NE_AFLAGS_FASTLOAD 0x08
|
---|
| 81 |
|
---|
| 82 | /*
|
---|
| 83 | * Segment table entry
|
---|
| 84 | */
|
---|
| 85 | struct ne_segment_table_entry_s
|
---|
| 86 | {
|
---|
| 87 | unsigned short seg_data_offset; /* Sector offset of segment data */
|
---|
| 88 | unsigned short seg_data_length; /* Length of segment data */
|
---|
| 89 | unsigned short seg_flags; /* Flags associated with this segment */
|
---|
| 90 | unsigned short min_alloc; /* Minimum allocation size for this */
|
---|
| 91 | };
|
---|
| 92 |
|
---|
| 93 | /*
|
---|
| 94 | * Segment Flags
|
---|
| 95 | */
|
---|
| 96 | #define NE_SEGFLAGS_DATA 0x0001
|
---|
| 97 | #define NE_SEGFLAGS_ALLOCATED 0x0002
|
---|
| 98 | #define NE_SEGFLAGS_LOADED 0x0004
|
---|
| 99 | #define NE_SEGFLAGS_ITERATED 0x0008
|
---|
| 100 | #define NE_SEGFLAGS_MOVEABLE 0x0010
|
---|
| 101 | #define NE_SEGFLAGS_SHAREABLE 0x0020
|
---|
| 102 | #define NE_SEGFLAGS_PRELOAD 0x0040
|
---|
| 103 | #define NE_SEGFLAGS_EXECUTEONLY 0x0080
|
---|
| 104 | #define NE_SEGFLAGS_READONLY 0x0080
|
---|
| 105 | #define NE_SEGFLAGS_RELOC_DATA 0x0100
|
---|
| 106 | #define NE_SEGFLAGS_SELFLOAD 0x0800
|
---|
| 107 | #define NE_SEGFLAGS_DISCARDABLE 0x1000
|
---|
| 108 |
|
---|
| 109 | /*
|
---|
| 110 | * Relocation table entry
|
---|
| 111 | */
|
---|
| 112 | struct relocation_entry_s
|
---|
| 113 | {
|
---|
| 114 | unsigned char address_type; /* Relocation address type */
|
---|
| 115 | unsigned char relocation_type; /* Relocation type */
|
---|
| 116 | unsigned short offset; /* Offset in segment to fixup */
|
---|
| 117 | unsigned short target1; /* Target specification */
|
---|
| 118 | unsigned short target2; /* Target specification */
|
---|
| 119 | };
|
---|
| 120 |
|
---|
| 121 | /*
|
---|
| 122 | * Relocation address types
|
---|
| 123 | */
|
---|
| 124 | #define NE_RADDR_LOWBYTE 0
|
---|
| 125 | #define NE_RADDR_SELECTOR 2
|
---|
| 126 | #define NE_RADDR_POINTER32 3
|
---|
| 127 | #define NE_RADDR_OFFSET16 5
|
---|
| 128 | #define NE_RADDR_POINTER48 11
|
---|
| 129 | #define NE_RADDR_OFFSET32 13
|
---|
| 130 |
|
---|
| 131 | /*
|
---|
| 132 | * Relocation types
|
---|
| 133 | */
|
---|
| 134 | #define NE_RELTYPE_INTERNAL 0
|
---|
| 135 | #define NE_RELTYPE_ORDINAL 1
|
---|
| 136 | #define NE_RELTYPE_NAME 2
|
---|
| 137 | #define NE_RELTYPE_OSFIXUP 3
|
---|
| 138 | #define NE_RELFLAG_ADDITIVE 4
|
---|
| 139 |
|
---|
| 140 | /*
|
---|
| 141 | * Resource table structures.
|
---|
| 142 | */
|
---|
| 143 | struct resource_nameinfo_s
|
---|
| 144 | {
|
---|
| 145 | unsigned short offset;
|
---|
| 146 | unsigned short length;
|
---|
| 147 | unsigned short flags;
|
---|
| 148 | unsigned short id;
|
---|
| 149 | unsigned short handle;
|
---|
| 150 | unsigned short usage;
|
---|
| 151 | };
|
---|
| 152 |
|
---|
| 153 | struct resource_typeinfo_s
|
---|
| 154 | {
|
---|
| 155 | unsigned short type_id; /* Type identifier */
|
---|
| 156 | unsigned short count; /* Number of resources of this type */
|
---|
| 157 | unsigned long resloader; /* SetResourceHandler() */
|
---|
| 158 | /*
|
---|
| 159 | * Name info array.
|
---|
| 160 | */
|
---|
| 161 | };
|
---|
| 162 |
|
---|
| 163 | #define NE_RSCTYPE_ACCELERATOR 0x8009
|
---|
| 164 | #define NE_RSCTYPE_BITMAP 0x8002
|
---|
| 165 | #define NE_RSCTYPE_CURSOR 0x8001
|
---|
| 166 | #define NE_RSCTYPE_DIALOG 0x8005
|
---|
| 167 | #define NE_RSCTYPE_FONT 0x8008
|
---|
| 168 | #define NE_RSCTYPE_FONTDIR 0x8007
|
---|
| 169 | #define NE_RSCTYPE_GROUP_CURSOR 0x800c
|
---|
| 170 | #define NE_RSCTYPE_GROUP_ICON 0x800e
|
---|
| 171 | #define NE_RSCTYPE_ICON 0x8003
|
---|
| 172 | #define NE_RSCTYPE_MENU 0x8004
|
---|
| 173 | #define NE_RSCTYPE_RCDATA 0x800a
|
---|
| 174 | #define NE_RSCTYPE_STRING 0x8006
|
---|
| 175 |
|
---|
| 176 | #endif
|
---|