Release 970415
[wine/multimedia.git] / include / winnt.h
blob4bd7387596243f83a7e8ca929fccb973fa1f9975
1 /*
2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINNT_H
8 #define __WINE_WINNT_H
10 #include "wintypes.h"
12 /* Heap flags */
14 #define HEAP_NO_SERIALIZE 0x00000001
15 #define HEAP_GROWABLE 0x00000002
16 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
17 #define HEAP_ZERO_MEMORY 0x00000008
18 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
19 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
20 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
21 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
22 #define HEAP_CREATE_ALIGN_16 0x00010000
23 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
24 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
25 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
27 /* The Win32 register context */
29 #define CONTEXT_i386 0x00010000
30 #define CONTEXT_i486 CONTEXT_i386
31 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
32 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
33 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
34 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
35 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
36 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
38 #define SIZE_OF_80387_REGISTERS 80
40 typedef struct
42 DWORD ControlWord;
43 DWORD StatusWord;
44 DWORD TagWord;
45 DWORD ErrorOffset;
46 DWORD ErrorSelector;
47 DWORD DataOffset;
48 DWORD DataSelector;
49 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
50 DWORD Cr0NpxState;
51 } FLOATING_SAVE_AREA;
53 typedef struct
55 DWORD ContextFlags;
57 /* These are selected by CONTEXT_DEBUG_REGISTERS */
58 DWORD Dr0;
59 DWORD Dr1;
60 DWORD Dr2;
61 DWORD Dr3;
62 DWORD Dr6;
63 DWORD Dr7;
65 /* These are selected by CONTEXT_FLOATING_POINT */
66 FLOATING_SAVE_AREA FloatSave;
68 /* These are selected by CONTEXT_SEGMENTS */
69 DWORD SegGs;
70 DWORD SegFs;
71 DWORD SegEs;
72 DWORD SegDs;
74 /* These are selected by CONTEXT_INTEGER */
75 DWORD Edi;
76 DWORD Esi;
77 DWORD Ebx;
78 DWORD Edx;
79 DWORD Ecx;
80 DWORD Eax;
82 /* These are selected by CONTEXT_CONTROL */
83 DWORD Ebp;
84 DWORD Eip;
85 DWORD SegCs;
86 DWORD EFlags;
87 DWORD Esp;
88 DWORD SegSs;
89 } CONTEXT, *PCONTEXT;
92 #ifdef __WINE__
94 /* Macros for easier access to context registers */
96 #define EAX_reg(context) ((context)->Eax)
97 #define EBX_reg(context) ((context)->Ebx)
98 #define ECX_reg(context) ((context)->Ecx)
99 #define EDX_reg(context) ((context)->Edx)
100 #define ESI_reg(context) ((context)->Esi)
101 #define EDI_reg(context) ((context)->Edi)
102 #define EBP_reg(context) ((context)->Ebp)
104 #define CS_reg(context) ((context)->SegCs)
105 #define DS_reg(context) ((context)->SegDs)
106 #define ES_reg(context) ((context)->SegEs)
107 #define FS_reg(context) ((context)->SegFs)
108 #define GS_reg(context) ((context)->SegGs)
109 #define SS_reg(context) ((context)->SegSs)
111 #define EFL_reg(context) ((context)->EFlags)
112 #define EIP_reg(context) ((context)->Eip)
113 #define ESP_reg(context) ((context)->Esp)
115 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
116 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
117 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
118 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
119 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
120 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
121 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
123 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
124 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
125 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
126 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
127 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
128 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
129 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
130 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
132 #define IP_reg(context) (*(WORD*)&EIP_reg(context))
133 #define SP_reg(context) (*(WORD*)&ESP_reg(context))
135 #define FL_reg(context) (*(WORD*)&EFL_reg(context))
137 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
138 #define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
140 #endif /* __WINE__ */
143 * Exception codes
146 #define STATUS_WAIT_0 0x00000000
147 #define STATUS_ABANDONED_WAIT_0 0x00000080
148 #define STATUS_USER_APC 0x000000C0
149 #define STATUS_TIMEOUT 0x00000102
150 #define STATUS_PENDING 0x00000103
151 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
152 #define STATUS_BREAKPOINT 0x80000003
153 #define STATUS_SINGLE_STEP 0x80000004
154 #define STATUS_ACCESS_VIOLATION 0xC0000005
155 #define STATUS_IN_PAGE_ERROR 0xC0000006
156 #define STATUS_NO_MEMORY 0xC0000017
157 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
158 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
159 #define STATUS_INVALID_DISPOSITION 0xC0000026
160 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
161 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
162 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
163 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
164 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
165 #define STATUS_FLOAT_OVERFLOW 0xC0000091
166 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
167 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
168 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
169 #define STATUS_INTEGER_OVERFLOW 0xC0000095
170 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
171 #define STATUS_STACK_OVERFLOW 0xC00000FD
172 #define STATUS_CONTROL_C_EXIT 0xC000013A
174 #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
175 #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
176 #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
177 #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
178 #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
179 #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
180 #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
181 #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
182 #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
183 #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
184 #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
185 #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
186 #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
187 #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
188 #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
189 #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
192 * Return values from the actual exception handlers
195 #define ExceptionContinueExecution 0
196 #define ExceptionContinueSearch 1
197 #define ExceptionNestedException 2
198 #define ExceptionCollidedUnwind 3
201 * Return values from filters in except() and from UnhandledExceptionFilter
204 #define EXCEPTION_EXECUTE_HANDLER 1
205 #define EXCEPTION_CONTINUE_SEARCH 0
206 #define EXCEPTION_CONTINUE_EXECUTION -1
209 * From OS/2 2.0 exception handling
210 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
213 #define EH_NONCONTINUABLE 0x01
214 #define EH_UNWINDING 0x02
215 #define EH_EXIT_UNWIND 0x04
216 #define EH_STACK_INVALID 0x08
217 #define EH_NESTED_CALL 0x10
219 #define EXCEPTION_CONTINUABLE 0
220 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
223 * The exception record used by Win32 to give additional information
224 * about exception to exception handlers.
227 #define EXCEPTION_MAXIMUM_PARAMETERS 15
229 typedef struct __EXCEPTION_RECORD
231 DWORD ExceptionCode;
232 DWORD ExceptionFlags;
233 struct __EXCEPTION_RECORD *ExceptionRecord;
235 LPVOID ExceptionAddress;
236 DWORD NumberParameters;
237 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
238 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
241 * The exception pointers structure passed to exception filters
242 * in except() and the UnhandledExceptionFilter().
245 typedef struct _EXCEPTION_POINTERS
247 PEXCEPTION_RECORD ExceptionRecord;
248 PCONTEXT ContextRecord;
249 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
252 * function pointer to a exception filter
255 typedef LONG (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
256 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
258 DWORD UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
259 LPTOP_LEVEL_EXCEPTION_FILTER
260 SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
262 /* Language IDs */
264 #define LANG_NEUTRAL 0x00
265 #define LANG_ARABIC 0x01
266 #define LANG_AFRIKAANS 0x36
267 #define LANG_ALBANIAN 0x1c
268 #define LANG_BASQUE 0x2d
269 #define LANG_BULGARIAN 0x02
270 #define LANG_BYELORUSSIAN 0x23
271 #define LANG_CATALAN 0x03
272 #define LANG_CHINESE 0x04
273 #define LANG_CROATIAN 0x1a
274 #define LANG_CZECH 0x05
275 #define LANG_DANISH 0x06
276 #define LANG_DUTCH 0x13
277 #define LANG_ENGLISH 0x09
278 #define LANG_ESTONIAN 0x25
279 #define LANG_FAEROESE 0x38
280 #define LANG_FARSI 0x29
281 #define LANG_FINNISH 0x0b
282 #define LANG_FRENCH 0x0c
283 #define LANG_GERMAN 0x07
284 #define LANG_GREEK 0x08
285 #define LANG_HEBREW 0x0D
286 #define LANG_HUNGARIAN 0x0e
287 #define LANG_ICELANDIC 0x0f
288 #define LANG_INDONESIAN 0x21
289 #define LANG_ITALIAN 0x10
290 #define LANG_JAPANESE 0x11
291 #define LANG_KOREAN 0x12
292 #define LANG_LATVIAN 0x26
293 #define LANG_LITHUANIAN 0x27
294 #define LANG_NORWEGIAN 0x14
295 #define LANG_POLISH 0x15
296 #define LANG_PORTUGUESE 0x16
297 #define LANG_ROMANIAN 0x18
298 #define LANG_RUSSIAN 0x19
299 #define LANG_SLOVAK 0x1b
300 #define LANG_SLOVENIAN 0x24
301 #define LANG_SORBIAN 0x2e
302 #define LANG_SPANISH 0x0a
303 #define LANG_SWEDISH 0x1d
304 #define LANG_THAI 0x1e
305 #define LANG_TURKISH 0x1f
306 #define LANG_UKRAINIAN 0x22
308 #endif /* __WINE_WINNT_H */