Release 0.2.0
[wine/multimedia.git] / neexe.h
blob839ac3ed4efff975f14094c9f2b48615011c35ab
1 /* $Id: neexe.h,v 1.4 1993/07/04 04:04:21 root Exp root $
2 */
3 /*
4 * Copyright Robert J. Amstadt, 1993
5 */
6 #ifndef NEEXE_H
7 #define NEEXE_H
9 /*
10 * Old MZ header for DOS programs. Actually just a couple of fields
11 * from it, so that we can find the start of the NE header.
13 struct mz_header_s
15 u_char dont_care1[0x18]; /* MZ Header stuff */
16 u_char must_be_0x40; /* 0x40 for non-MZ program */
17 u_char dont_care2[0x23]; /* More MZ header stuff */
18 u_short ne_offset; /* Offset to extended header */
22 * This is the Windows executable (NE) header.
24 struct ne_header_s
26 char header_type[2]; /* Must contain 'N' 'E' */
27 u_char linker_version; /* Linker version number */
28 u_char linker_revision; /* Linker revision number */
29 u_short entry_tab_offset; /* Offset to entry table relative to NE */
30 u_short entry_tab_length; /* Length of etnry table in bytes */
31 u_long reserved1; /* Reserved by Microsoft */
32 u_short format_flags; /* Flags that segments in this file */
33 u_short auto_data_seg; /* Automatic data segment number */
34 u_short local_heap_length; /* Initial size of local heap */
35 u_short stack_length; /* Initial size of stack */
36 u_short ip; /* Initial IP */
37 u_short cs; /* Initial CS */
38 u_short sp; /* Initial SP */
39 u_short ss; /* Initial SS */
40 u_short n_segment_tab; /* # of entries in segment table */
41 u_short n_mod_ref_tab; /* # of entries in module reference tab.*/
42 u_short nrname_tab_length; /* Length of nonresident-name table */
43 u_short segment_tab_offset; /* Offset to segment table */
44 u_short resource_tab_offset;/* Offset to resource table */
45 u_short rname_tab_offset; /* Offset to resident-name table */
46 u_short moduleref_tab_offset;/* Offset to module reference table */
47 u_short iname_tab_offset; /* Offset to imported name table */
48 u_long nrname_tab_offset; /* Offset to nonresident-name table */
49 u_short n_mov_entry_points; /* # of movable entry points */
50 u_short align_shift_count; /* Logical sector alignment shift count */
51 u_short n_resource_seg; /* # of resource segments */
52 u_char operating_system; /* Flags indicating target OS */
53 u_char additional_flags; /* Additional information flags */
54 u_short fastload_offset; /* Offset to fast load area */
55 u_short fastload_length; /* Length of fast load area */
56 u_short reserved2; /* Reserved by Microsoft */
57 u_short expect_version; /* Expected Windows version number */
61 * NE Header FORMAT FLAGS
63 #define NE_FFLAGS_SINGLEDATA 0x0001
64 #define NE_FFLAGS_MULTIPLEDATA 0x0002
65 #define NE_FFLAGS_SELFLOAD 0x0800
66 #define NE_FFLAGS_LINKERROR 0x2000
67 #define NE_FFLAGS_LIBMODULE 0x8000
70 * NE Header OPERATING SYSTEM
72 #define NE_OSFLAGS_UNKNOWN 0x01
73 #define NE_OSFLAGS_WINDOWS 0x04
76 * NE Header ADDITIONAL FLAGS
78 #define NE_AFLAGS_WIN2_PROTMODE 0x02
79 #define NE_AFLAGS_WIN2_PROFONTS 0x04
80 #define NE_AFLAGS_FASTLOAD 0x08
83 * Segment table entry
85 struct ne_segment_table_entry_s
87 u_short seg_data_offset; /* Sector offset of segment data */
88 u_short seg_data_length; /* Length of segment data */
89 u_short seg_flags; /* Flags associated with this segment */
90 u_short min_alloc; /* Minimum allocation size for this */
94 * Segment Flags
96 #define NE_SEGFLAGS_DATA 0x0001
97 #define NE_SEGFLAGS_ALLOCATED 0x0002
98 #define NE_SEGFLAGS_LOADED 0x0004
99 #define NE_SEGFLAGS_MOVEABLE 0x0010
100 #define NE_SEGFLAGS_SHAREABLE 0x0020
101 #define NE_SEGFLAGS_PRELOAD 0x0040
102 #define NE_SEGFLAGS_EXECUTEONLY 0x0080
103 #define NE_SEGFLAGS_READONLY 0x0080
104 #define NE_SEGFLAGS_RELOC_DATA 0x0100
105 #define NE_SEGFLAGS_DISCARDABLE 0x1000
108 * Relocation table entry
110 struct relocation_entry_s
112 u_char address_type; /* Relocation address type */
113 u_char relocation_type; /* Relocation type */
114 u_short offset; /* Offset in segment to fixup */
115 u_short target1; /* Target specification */
116 u_short target2; /* Target specification */
120 * Relocation address types
122 #define NE_RADDR_LOWBYTE 0
123 #define NE_RADDR_SELECTOR 2
124 #define NE_RADDR_POINTER32 3
125 #define NE_RADDR_OFFSET16 5
126 #define NE_RADDR_POINTER48 11
127 #define NE_RADDR_OFFSET32 13
130 * Relocation types
132 #define NE_RELTYPE_INTERNAL 0
133 #define NE_RELTYPE_ORDINAL 1
134 #define NE_RELTYPE_NAME 2
135 #define NE_RELTYPE_OSFIXUP 3
138 * DOS PSP
140 struct dos_psp_s
142 unsigned short pspInt20;
143 unsigned short pspNextParagraph;
144 unsigned char pspReserved1;
145 unsigned char pspDispatcher[5];
146 unsigned short pspTerminateVector[2];
147 unsigned short pspControlCVector[2];
148 unsigned short pspCritErrorVector[2];
149 unsigned short pspReserved2[11];
150 unsigned short pspEnvironment;
151 unsigned short pspReserved3[23];
152 unsigned char pspFCB_1[16];
153 unsigned char pspFCB_2[16];
154 unsigned char pspCommandTailCount;
155 unsigned char pspCommandTail[128];
159 * Entry table structures.
161 struct entry_tab_header_s
163 unsigned char n_entries;
164 unsigned char seg_number;
167 struct entry_tab_movable_s
169 unsigned char flags;
170 unsigned char int3f[2];
171 unsigned char seg_number;
172 unsigned short offset;
175 struct entry_tab_fixed_s
177 unsigned char flags;
178 unsigned char offset[2];
182 * Resource table structures.
184 struct resource_nameinfo_s
186 unsigned short offset;
187 unsigned short length;
188 unsigned short flags;
189 unsigned short id;
190 unsigned short handle;
191 unsigned short usage;
194 struct resource_typeinfo_s
196 unsigned short type_id; /* Type identifier */
197 unsigned short count; /* Number of resources of this type */
198 unsigned long reserved;
200 * Name info array.
204 #define NE_RSCTYPE_ACCELERATOR 0x8009
205 #define NE_RSCTYPE_BITMAP 0x8002
206 #define NE_RSCTYPE_CURSOR 0x8001
207 #define NE_RSCTYPE_DIALOG 0x8005
208 #define NE_RSCTYPE_FONT 0x8008
209 #define NE_RSCTYPE_FONTDIR 0x8007
210 #define NE_RSCTYPE_GROUP_CURSOR 0x800c
211 #define NE_RSCTYPE_GROUP_ICON 0x800e
212 #define NE_RSCTYPE_ICON 0x8003
213 #define NE_RSCTYPE_MENU 0x8004
214 #define NE_RSCTYPE_RCDATA 0x800a
215 #define NE_RSCTYPE_STRING 0x8006
217 #endif /* NEEXE_H */