Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright Robert J. Amstadt, 1993 |
| 3 | */ |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 4 | #ifndef __WINE_NEEXE_H |
| 5 | #define __WINE_NEEXE_H |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 6 | |
Jim Aston | 2e1cafa | 1999-03-14 16:35:05 +0000 | [diff] [blame] | 7 | #include "windef.h" |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 8 | |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 9 | /* |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 10 | * Old MZ header for DOS programs. |
| 11 | * We check only the magic and the e_lfanew offset to the new executable |
| 12 | * header. |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 13 | */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 14 | typedef struct |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 15 | { |
Alexandre Julliard | a69b88b | 1998-03-15 20:29:56 +0000 | [diff] [blame] | 16 | WORD e_magic; /* 00: MZ Header signature */ |
| 17 | WORD e_cblp; /* 02: Bytes on last page of file */ |
| 18 | WORD e_cp; /* 04: Pages in file */ |
| 19 | WORD e_crlc; /* 06: Relocations */ |
| 20 | WORD e_cparhdr; /* 08: Size of header in paragraphs */ |
| 21 | WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */ |
| 22 | WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */ |
| 23 | WORD e_ss; /* 0e: Initial (relative) SS value */ |
| 24 | WORD e_sp; /* 10: Initial SP value */ |
| 25 | WORD e_csum; /* 12: Checksum */ |
| 26 | WORD e_ip; /* 14: Initial IP value */ |
| 27 | WORD e_cs; /* 16: Initial (relative) CS value */ |
| 28 | WORD e_lfarlc; /* 18: File address of relocation table */ |
| 29 | WORD e_ovno; /* 1a: Overlay number */ |
| 30 | WORD e_res[4]; /* 1c: Reserved words */ |
| 31 | WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */ |
| 32 | WORD e_oeminfo; /* 26: OEM information; e_oemid specific */ |
| 33 | WORD e_res2[10]; /* 28: Reserved words */ |
Alexandre Julliard | 54c2711 | 1998-03-29 19:44:57 +0000 | [diff] [blame] | 34 | DWORD e_lfanew; /* 3c: Offset to extended header */ |
Uwe Bonnes | 73d6c13 | 1998-10-16 09:30:33 +0000 | [diff] [blame] | 35 | } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER; |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 36 | |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 37 | #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */ |
| 38 | #define IMAGE_OS2_SIGNATURE 0x454E /* NE */ |
| 39 | #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */ |
Alexandre Julliard | 670cdc4 | 1997-08-24 16:00:30 +0000 | [diff] [blame] | 40 | #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 41 | #define IMAGE_VXD_SIGNATURE 0x454C /* LE */ |
| 42 | #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */ |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 43 | |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 44 | /* |
| 45 | * This is the Windows executable (NE) header. |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 46 | * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way. |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 47 | */ |
Alexandre Julliard | 23946ad | 1997-06-16 17:43:53 +0000 | [diff] [blame] | 48 | typedef struct |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 49 | { |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 50 | WORD ne_magic; /* 00 NE signature 'NE' */ |
| 51 | BYTE linker_version; /* 02 Linker version number */ |
| 52 | BYTE linker_revision; /* 03 Linker revision number */ |
| 53 | WORD entry_tab_offset; /* 04 Offset to entry table relative to NE */ |
| 54 | WORD entry_tab_length; /* 06 Length of entry table in bytes */ |
| 55 | DWORD reserved1; /* 08 Reserved by Microsoft */ |
| 56 | WORD format_flags; /* 0c Flags about segments in this file */ |
| 57 | WORD auto_data_seg; /* 0e Automatic data segment number */ |
| 58 | WORD local_heap_length; /* 10 Initial size of local heap */ |
| 59 | WORD stack_length; /* 12 Initial size of stack */ |
| 60 | WORD ip; /* 14 Initial IP */ |
| 61 | WORD cs; /* 16 Initial CS */ |
| 62 | WORD sp; /* 18 Initial SP */ |
| 63 | WORD ss; /* 1a Initial SS */ |
| 64 | WORD n_segment_tab; /* 1c # of entries in segment table */ |
| 65 | WORD n_mod_ref_tab; /* 1e # of entries in module reference tab. */ |
| 66 | WORD nrname_tab_length; /* 20 Length of nonresident-name table */ |
| 67 | WORD segment_tab_offset; /* 22 Offset to segment table */ |
| 68 | WORD resource_tab_offset; /* 24 Offset to resource table */ |
| 69 | WORD rname_tab_offset; /* 26 Offset to resident-name table */ |
| 70 | WORD moduleref_tab_offset; /* 28 Offset to module reference table */ |
| 71 | WORD iname_tab_offset; /* 2a Offset to imported name table */ |
| 72 | DWORD nrname_tab_offset; /* 2c Offset to nonresident-name table */ |
| 73 | WORD n_mov_entry_points; /* 30 # of movable entry points */ |
| 74 | WORD align_shift_count; /* 32 Logical sector alignment shift count */ |
| 75 | WORD n_resource_seg; /* 34 # of resource segments */ |
| 76 | BYTE operating_system; /* 36 Flags indicating target OS */ |
| 77 | BYTE additional_flags; /* 37 Additional information flags */ |
| 78 | WORD fastload_offset; /* 38 Offset to fast load area */ |
| 79 | WORD fastload_length; /* 3a Length of fast load area */ |
| 80 | WORD reserved2; /* 3c Reserved by Microsoft */ |
| 81 | WORD expect_version; /* 3e Expected Windows version number */ |
Uwe Bonnes | 73d6c13 | 1998-10-16 09:30:33 +0000 | [diff] [blame] | 82 | } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER; |
Alexandre Julliard | fa68b75 | 1995-04-03 16:55:37 +0000 | [diff] [blame] | 83 | |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 84 | /* |
| 85 | * NE Header FORMAT FLAGS |
| 86 | */ |
| 87 | #define NE_FFLAGS_SINGLEDATA 0x0001 |
| 88 | #define NE_FFLAGS_MULTIPLEDATA 0x0002 |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 89 | #define NE_FFLAGS_WIN32 0x0010 |
| 90 | #define NE_FFLAGS_BUILTIN 0x0020 /* Wine built-in module */ |
Alexandre Julliard | 77b9918 | 1997-09-14 17:17:23 +0000 | [diff] [blame] | 91 | #define NE_FFLAGS_FRAMEBUF 0x0100 /* OS/2 fullscreen app */ |
| 92 | #define NE_FFLAGS_CONSOLE 0x0200 /* OS/2 console app */ |
| 93 | #define NE_FFLAGS_GUI 0x0300 /* right, (NE_FFLAGS_FRAMEBUF | NE_FFLAGS_CONSOLE) */ |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 94 | #define NE_FFLAGS_SELFLOAD 0x0800 |
| 95 | #define NE_FFLAGS_LINKERROR 0x2000 |
Alexandre Julliard | c981d0b | 1996-03-31 16:40:13 +0000 | [diff] [blame] | 96 | #define NE_FFLAGS_CALLWEP 0x4000 |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 97 | #define NE_FFLAGS_LIBMODULE 0x8000 |
| 98 | |
| 99 | /* |
| 100 | * NE Header OPERATING SYSTEM |
| 101 | */ |
| 102 | #define NE_OSFLAGS_UNKNOWN 0x01 |
| 103 | #define NE_OSFLAGS_WINDOWS 0x04 |
| 104 | |
| 105 | /* |
| 106 | * NE Header ADDITIONAL FLAGS |
| 107 | */ |
| 108 | #define NE_AFLAGS_WIN2_PROTMODE 0x02 |
| 109 | #define NE_AFLAGS_WIN2_PROFONTS 0x04 |
| 110 | #define NE_AFLAGS_FASTLOAD 0x08 |
| 111 | |
| 112 | /* |
| 113 | * Segment table entry |
| 114 | */ |
| 115 | struct ne_segment_table_entry_s |
| 116 | { |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 117 | WORD seg_data_offset; /* Sector offset of segment data */ |
| 118 | WORD seg_data_length; /* Length of segment data */ |
| 119 | WORD seg_flags; /* Flags associated with this segment */ |
| 120 | WORD min_alloc; /* Minimum allocation size for this */ |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 121 | }; |
| 122 | |
| 123 | /* |
| 124 | * Segment Flags |
| 125 | */ |
| 126 | #define NE_SEGFLAGS_DATA 0x0001 |
| 127 | #define NE_SEGFLAGS_ALLOCATED 0x0002 |
| 128 | #define NE_SEGFLAGS_LOADED 0x0004 |
Alexandre Julliard | ded3038 | 1995-07-06 17:18:27 +0000 | [diff] [blame] | 129 | #define NE_SEGFLAGS_ITERATED 0x0008 |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 130 | #define NE_SEGFLAGS_MOVEABLE 0x0010 |
| 131 | #define NE_SEGFLAGS_SHAREABLE 0x0020 |
| 132 | #define NE_SEGFLAGS_PRELOAD 0x0040 |
| 133 | #define NE_SEGFLAGS_EXECUTEONLY 0x0080 |
| 134 | #define NE_SEGFLAGS_READONLY 0x0080 |
| 135 | #define NE_SEGFLAGS_RELOC_DATA 0x0100 |
Andreas Mohr | e6c12ee | 1998-10-11 17:36:46 +0000 | [diff] [blame] | 136 | #define NE_SEGFLAGS_SELFLOAD 0x0800 |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 137 | #define NE_SEGFLAGS_DISCARDABLE 0x1000 |
Ulrich Weigand | 5e59b1a | 1999-07-15 14:31:44 +0000 | [diff] [blame] | 138 | #define NE_SEGFLAGS_32BIT 0x2000 |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 139 | |
| 140 | /* |
| 141 | * Relocation table entry |
| 142 | */ |
| 143 | struct relocation_entry_s |
| 144 | { |
Alexandre Julliard | 594997c | 1995-04-30 10:05:20 +0000 | [diff] [blame] | 145 | BYTE address_type; /* Relocation address type */ |
| 146 | BYTE relocation_type; /* Relocation type */ |
| 147 | WORD offset; /* Offset in segment to fixup */ |
| 148 | WORD target1; /* Target specification */ |
| 149 | WORD target2; /* Target specification */ |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 150 | }; |
| 151 | |
| 152 | /* |
| 153 | * Relocation address types |
| 154 | */ |
| 155 | #define NE_RADDR_LOWBYTE 0 |
| 156 | #define NE_RADDR_SELECTOR 2 |
| 157 | #define NE_RADDR_POINTER32 3 |
| 158 | #define NE_RADDR_OFFSET16 5 |
| 159 | #define NE_RADDR_POINTER48 11 |
| 160 | #define NE_RADDR_OFFSET32 13 |
| 161 | |
| 162 | /* |
| 163 | * Relocation types |
| 164 | */ |
| 165 | #define NE_RELTYPE_INTERNAL 0 |
| 166 | #define NE_RELTYPE_ORDINAL 1 |
| 167 | #define NE_RELTYPE_NAME 2 |
| 168 | #define NE_RELTYPE_OSFIXUP 3 |
Alexandre Julliard | e2abbb1 | 1995-03-19 17:39:39 +0000 | [diff] [blame] | 169 | #define NE_RELFLAG_ADDITIVE 4 |
Alexandre Julliard | 5f721f8 | 1994-01-04 20:14:34 +0000 | [diff] [blame] | 170 | |
Alexandre Julliard | 2c25c3e | 1993-06-29 16:33:12 +0000 | [diff] [blame] | 171 | /* |
Alexandre Julliard | 066d1e0 | 1993-07-01 10:58:21 +0000 | [diff] [blame] | 172 | * Resource table structures. |
| 173 | */ |
| 174 | struct resource_nameinfo_s |
| 175 | { |
| 176 | unsigned short offset; |
| 177 | unsigned short length; |
| 178 | unsigned short flags; |
| 179 | unsigned short id; |
Alexandre Julliard | d90840e | 1996-06-11 16:02:08 +0000 | [diff] [blame] | 180 | HANDLE16 handle; |
Alexandre Julliard | 066d1e0 | 1993-07-01 10:58:21 +0000 | [diff] [blame] | 181 | unsigned short usage; |
| 182 | }; |
| 183 | |
| 184 | struct resource_typeinfo_s |
| 185 | { |
| 186 | unsigned short type_id; /* Type identifier */ |
| 187 | unsigned short count; /* Number of resources of this type */ |
Alexandre Julliard | 46ea8b3 | 1998-05-03 19:01:20 +0000 | [diff] [blame] | 188 | FARPROC16 resloader; /* SetResourceHandler() */ |
Alexandre Julliard | 066d1e0 | 1993-07-01 10:58:21 +0000 | [diff] [blame] | 189 | /* |
| 190 | * Name info array. |
| 191 | */ |
| 192 | }; |
| 193 | |
| 194 | #define NE_RSCTYPE_ACCELERATOR 0x8009 |
| 195 | #define NE_RSCTYPE_BITMAP 0x8002 |
| 196 | #define NE_RSCTYPE_CURSOR 0x8001 |
| 197 | #define NE_RSCTYPE_DIALOG 0x8005 |
| 198 | #define NE_RSCTYPE_FONT 0x8008 |
| 199 | #define NE_RSCTYPE_FONTDIR 0x8007 |
| 200 | #define NE_RSCTYPE_GROUP_CURSOR 0x800c |
| 201 | #define NE_RSCTYPE_GROUP_ICON 0x800e |
| 202 | #define NE_RSCTYPE_ICON 0x8003 |
| 203 | #define NE_RSCTYPE_MENU 0x8004 |
| 204 | #define NE_RSCTYPE_RCDATA 0x800a |
| 205 | #define NE_RSCTYPE_STRING 0x8006 |
| 206 | |
Alexandre Julliard | c6c0944 | 1997-01-12 18:32:19 +0000 | [diff] [blame] | 207 | #endif /* __WINE_NEEXE_H */ |