1 | /* $Id: neexe.h,v 1.3 2003-04-02 11:02:35 sandervl Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Copyright Robert J. Amstadt, 1993
|
---|
5 | */
|
---|
6 | #ifndef __WINE_NEEXE_H
|
---|
7 | #define __WINE_NEEXE_H
|
---|
8 |
|
---|
9 | #ifdef __WIN32OS2__
|
---|
10 | #ifndef _OS2WIN_H
|
---|
11 | #include <win32type.h>
|
---|
12 | #endif
|
---|
13 | #else
|
---|
14 | #include "windef.h"
|
---|
15 | #endif
|
---|
16 |
|
---|
17 | /*
|
---|
18 | * Old MZ header for DOS programs.
|
---|
19 | * We check only the magic and the e_lfanew offset to the new executable
|
---|
20 | * header.
|
---|
21 | */
|
---|
22 | #include "pshpack2.h"
|
---|
23 | typedef struct
|
---|
24 | {
|
---|
25 | WORD e_magic; /* 00: MZ Header signature */
|
---|
26 | WORD e_cblp; /* 02: Bytes on last page of file */
|
---|
27 | WORD e_cp; /* 04: Pages in file */
|
---|
28 | WORD e_crlc; /* 06: Relocations */
|
---|
29 | WORD e_cparhdr; /* 08: Size of header in paragraphs */
|
---|
30 | WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
|
---|
31 | WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
|
---|
32 | WORD e_ss; /* 0e: Initial (relative) SS value */
|
---|
33 | WORD e_sp; /* 10: Initial SP value */
|
---|
34 | WORD e_csum; /* 12: Checksum */
|
---|
35 | WORD e_ip; /* 14: Initial IP value */
|
---|
36 | WORD e_cs; /* 16: Initial (relative) CS value */
|
---|
37 | WORD e_lfarlc; /* 18: File address of relocation table */
|
---|
38 | WORD e_ovno; /* 1a: Overlay number */
|
---|
39 | WORD e_res[4]; /* 1c: Reserved words */
|
---|
40 | WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
|
---|
41 | WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
|
---|
42 | WORD e_res2[10]; /* 28: Reserved words */
|
---|
43 | DWORD e_lfanew; /* 3c: Offset to extended header */
|
---|
44 | } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
|
---|
45 | #include "poppack.h"
|
---|
46 |
|
---|
47 | #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
|
---|
48 | #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
|
---|
49 | #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
|
---|
50 | #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
|
---|
51 | #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
|
---|
52 | #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
|
---|
53 |
|
---|
54 | /*
|
---|
55 | * This is the Windows executable (NE) header.
|
---|
56 | * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
|
---|
57 | */
|
---|
58 | #include "pshpack2.h"
|
---|
59 | typedef struct
|
---|
60 | {
|
---|
61 | WORD ne_magic; /* 00 NE signature 'NE' */
|
---|
62 | BYTE ne_ver; /* 02 Linker version number */
|
---|
63 | BYTE ne_rev; /* 03 Linker revision number */
|
---|
64 | WORD ne_enttab; /* 04 Offset to entry table relative to NE */
|
---|
65 | WORD ne_cbenttab; /* 06 Length of entry table in bytes */
|
---|
66 | LONG ne_crc; /* 08 Checksum */
|
---|
67 | WORD ne_flags; /* 0c Flags about segments in this file */
|
---|
68 | WORD ne_autodata; /* 0e Automatic data segment number */
|
---|
69 | WORD ne_heap; /* 10 Initial size of local heap */
|
---|
70 | WORD ne_stack; /* 12 Initial size of stack */
|
---|
71 | DWORD ne_csip; /* 14 Initial CS:IP */
|
---|
72 | DWORD ne_sssp; /* 18 Initial SS:SP */
|
---|
73 | WORD ne_cseg; /* 1c # of entries in segment table */
|
---|
74 | WORD ne_cmod; /* 1e # of entries in module reference tab. */
|
---|
75 | WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
|
---|
76 | WORD ne_segtab; /* 22 Offset to segment table */
|
---|
77 | WORD ne_rsrctab; /* 24 Offset to resource table */
|
---|
78 | WORD ne_restab; /* 26 Offset to resident-name table */
|
---|
79 | WORD ne_modtab; /* 28 Offset to module reference table */
|
---|
80 | WORD ne_imptab; /* 2a Offset to imported name table */
|
---|
81 | DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
|
---|
82 | WORD ne_cmovent; /* 30 # of movable entry points */
|
---|
83 | WORD ne_align; /* 32 Logical sector alignment shift count */
|
---|
84 | WORD ne_cres; /* 34 # of resource segments */
|
---|
85 | BYTE ne_exetyp; /* 36 Flags indicating target OS */
|
---|
86 | BYTE ne_flagsothers; /* 37 Additional information flags */
|
---|
87 | WORD ne_pretthunks; /* 38 Offset to return thunks */
|
---|
88 | WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
|
---|
89 | WORD ne_swaparea; /* 3c Reserved by Microsoft */
|
---|
90 | WORD ne_expver; /* 3e Expected Windows version number */
|
---|
91 | } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
|
---|
92 | #include "poppack.h"
|
---|
93 | /*
|
---|
94 | * NE Header FORMAT FLAGS
|
---|
95 | */
|
---|
96 | #define NE_FFLAGS_SINGLEDATA 0x0001
|
---|
97 | #define NE_FFLAGS_MULTIPLEDATA 0x0002
|
---|
98 | #define NE_FFLAGS_WIN32 0x0010
|
---|
99 | #define NE_FFLAGS_BUILTIN 0x0020 /* Wine built-in module */
|
---|
100 | #define NE_FFLAGS_FRAMEBUF 0x0100 /* OS/2 fullscreen app */
|
---|
101 | #define NE_FFLAGS_CONSOLE 0x0200 /* OS/2 console app */
|
---|
102 | #define NE_FFLAGS_GUI 0x0300 /* right, (NE_FFLAGS_FRAMEBUF | NE_FFLAGS_CONSOLE) */
|
---|
103 | #define NE_FFLAGS_SELFLOAD 0x0800
|
---|
104 | #define NE_FFLAGS_LINKERROR 0x2000
|
---|
105 | #define NE_FFLAGS_CALLWEP 0x4000
|
---|
106 | #define NE_FFLAGS_LIBMODULE 0x8000
|
---|
107 |
|
---|
108 | /*
|
---|
109 | * NE Header OPERATING SYSTEM
|
---|
110 | */
|
---|
111 | #define NE_OSFLAGS_UNKNOWN 0x01
|
---|
112 | #define NE_OSFLAGS_WINDOWS 0x04
|
---|
113 |
|
---|
114 | /*
|
---|
115 | * NE Header ADDITIONAL FLAGS
|
---|
116 | */
|
---|
117 | #define NE_AFLAGS_WIN2_PROTMODE 0x02
|
---|
118 | #define NE_AFLAGS_WIN2_PROFONTS 0x04
|
---|
119 | #define NE_AFLAGS_FASTLOAD 0x08
|
---|
120 |
|
---|
121 | /*
|
---|
122 | * Segment table entry
|
---|
123 | */
|
---|
124 | struct ne_segment_table_entry_s
|
---|
125 | {
|
---|
126 | WORD seg_data_offset; /* Sector offset of segment data */
|
---|
127 | WORD seg_data_length; /* Length of segment data */
|
---|
128 | WORD seg_flags; /* Flags associated with this segment */
|
---|
129 | WORD min_alloc; /* Minimum allocation size for this */
|
---|
130 | };
|
---|
131 |
|
---|
132 | /*
|
---|
133 | * Segment Flags
|
---|
134 | */
|
---|
135 | #define NE_SEGFLAGS_DATA 0x0001
|
---|
136 | #define NE_SEGFLAGS_ALLOCATED 0x0002
|
---|
137 | #define NE_SEGFLAGS_LOADED 0x0004
|
---|
138 | #define NE_SEGFLAGS_ITERATED 0x0008
|
---|
139 | #define NE_SEGFLAGS_MOVEABLE 0x0010
|
---|
140 | #define NE_SEGFLAGS_SHAREABLE 0x0020
|
---|
141 | #define NE_SEGFLAGS_PRELOAD 0x0040
|
---|
142 | #define NE_SEGFLAGS_EXECUTEONLY 0x0080
|
---|
143 | #define NE_SEGFLAGS_READONLY 0x0080
|
---|
144 | #define NE_SEGFLAGS_RELOC_DATA 0x0100
|
---|
145 | #define NE_SEGFLAGS_SELFLOAD 0x0800
|
---|
146 | #define NE_SEGFLAGS_DISCARDABLE 0x1000
|
---|
147 |
|
---|
148 | /*
|
---|
149 | * Relocation table entry
|
---|
150 | */
|
---|
151 | struct relocation_entry_s
|
---|
152 | {
|
---|
153 | BYTE address_type; /* Relocation address type */
|
---|
154 | BYTE relocation_type; /* Relocation type */
|
---|
155 | WORD offset; /* Offset in segment to fixup */
|
---|
156 | WORD target1; /* Target specification */
|
---|
157 | WORD target2; /* Target specification */
|
---|
158 | };
|
---|
159 |
|
---|
160 | /*
|
---|
161 | * Relocation address types
|
---|
162 | */
|
---|
163 | #define NE_RADDR_LOWBYTE 0
|
---|
164 | #define NE_RADDR_SELECTOR 2
|
---|
165 | #define NE_RADDR_POINTER32 3
|
---|
166 | #define NE_RADDR_OFFSET16 5
|
---|
167 | #define NE_RADDR_POINTER48 11
|
---|
168 | #define NE_RADDR_OFFSET32 13
|
---|
169 |
|
---|
170 | /*
|
---|
171 | * Relocation types
|
---|
172 | */
|
---|
173 | #define NE_RELTYPE_INTERNAL 0
|
---|
174 | #define NE_RELTYPE_ORDINAL 1
|
---|
175 | #define NE_RELTYPE_NAME 2
|
---|
176 | #define NE_RELTYPE_OSFIXUP 3
|
---|
177 | #define NE_RELFLAG_ADDITIVE 4
|
---|
178 |
|
---|
179 | /*
|
---|
180 | * Resource table structures.
|
---|
181 | */
|
---|
182 | struct resource_nameinfo_s
|
---|
183 | {
|
---|
184 | unsigned short offset;
|
---|
185 | unsigned short length;
|
---|
186 | unsigned short flags;
|
---|
187 | unsigned short id;
|
---|
188 | HANDLE16 handle;
|
---|
189 | unsigned short usage;
|
---|
190 | };
|
---|
191 |
|
---|
192 | struct resource_typeinfo_s
|
---|
193 | {
|
---|
194 | unsigned short type_id; /* Type identifier */
|
---|
195 | unsigned short count; /* Number of resources of this type */
|
---|
196 | FARPROC16 resloader; /* SetResourceHandler() */
|
---|
197 | /*
|
---|
198 | * Name info array.
|
---|
199 | */
|
---|
200 | };
|
---|
201 |
|
---|
202 | #define NE_RSCTYPE_ACCELERATOR 0x8009
|
---|
203 | #define NE_RSCTYPE_BITMAP 0x8002
|
---|
204 | #define NE_RSCTYPE_CURSOR 0x8001
|
---|
205 | #define NE_RSCTYPE_DIALOG 0x8005
|
---|
206 | #define NE_RSCTYPE_FONT 0x8008
|
---|
207 | #define NE_RSCTYPE_FONTDIR 0x8007
|
---|
208 | #define NE_RSCTYPE_GROUP_CURSOR 0x800c
|
---|
209 | #define NE_RSCTYPE_GROUP_ICON 0x800e
|
---|
210 | #define NE_RSCTYPE_ICON 0x8003
|
---|
211 | #define NE_RSCTYPE_MENU 0x8004
|
---|
212 | #define NE_RSCTYPE_RCDATA 0x800a
|
---|
213 | #define NE_RSCTYPE_STRING 0x8006
|
---|
214 |
|
---|
215 | #endif /* __WINE_NEEXE_H */
|
---|