Moved ADVAPI32 files to dlls/advapi32.
[wine/multimedia.git] / include / winnt.h
blobc98c36537fb23ebe50f7b4035050c678337c7439
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 "windows.h"
12 /* Defines */
14 #define ANYSIZE_ARRAY 1
16 #define FIELD_OFFSET(type, field) \
17 ((LONG)(INT32)&(((type *)0)->field))
19 #define CONTAINING_RECORD(address, type, field) \
20 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
22 /* Types */
24 typedef BYTE BOOLEAN;
25 typedef BOOLEAN *PBOOLEAN;
27 typedef struct _LIST_ENTRY32 {
28 struct _LIST_ENTRY32 *Flink;
29 struct _LIST_ENTRY32 *Blink;
30 } LIST_ENTRY32, *PLIST_ENTRY32;
32 typedef struct _SINGLE_LIST_ENTRY32 {
33 struct _SINGLE_LIST_ENTRY32 *Next;
34 } SINGLE_LIST_ENTRY32, *PSINGLE_LIST_ENTRY32;
36 /* Heap flags */
38 #define HEAP_NO_SERIALIZE 0x00000001
39 #define HEAP_GROWABLE 0x00000002
40 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
41 #define HEAP_ZERO_MEMORY 0x00000008
42 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
43 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
44 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
45 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
46 #define HEAP_CREATE_ALIGN_16 0x00010000
47 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
48 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
49 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
50 #define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
52 /* Processor feature flags. */
53 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
54 #define PF_FLOATING_POINT_EMULATED 1
55 #define PF_COMPARE_EXCHANGE_DOUBLE 2
56 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
57 #define PF_PPC_MOVEMEM_64BIT_OK 4
58 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
61 /* The Win32 register context */
63 #define CONTEXT_i386 0x00010000
64 #define CONTEXT_i486 CONTEXT_i386
65 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
66 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
67 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
68 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
69 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
70 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
72 #define SIZE_OF_80387_REGISTERS 80
74 typedef struct
76 DWORD ControlWord;
77 DWORD StatusWord;
78 DWORD TagWord;
79 DWORD ErrorOffset;
80 DWORD ErrorSelector;
81 DWORD DataOffset;
82 DWORD DataSelector;
83 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
84 DWORD Cr0NpxState;
85 } FLOATING_SAVE_AREA;
87 typedef struct
89 DWORD ContextFlags;
91 /* These are selected by CONTEXT_DEBUG_REGISTERS */
92 DWORD Dr0;
93 DWORD Dr1;
94 DWORD Dr2;
95 DWORD Dr3;
96 DWORD Dr6;
97 DWORD Dr7;
99 /* These are selected by CONTEXT_FLOATING_POINT */
100 FLOATING_SAVE_AREA FloatSave;
102 /* These are selected by CONTEXT_SEGMENTS */
103 DWORD SegGs;
104 DWORD SegFs;
105 DWORD SegEs;
106 DWORD SegDs;
108 /* These are selected by CONTEXT_INTEGER */
109 DWORD Edi;
110 DWORD Esi;
111 DWORD Ebx;
112 DWORD Edx;
113 DWORD Ecx;
114 DWORD Eax;
116 /* These are selected by CONTEXT_CONTROL */
117 DWORD Ebp;
118 DWORD Eip;
119 DWORD SegCs;
120 DWORD EFlags;
121 DWORD Esp;
122 DWORD SegSs;
123 } CONTEXT, *PCONTEXT;
125 typedef HANDLE32 *PHANDLE;
127 #ifdef __WINE__
129 /* Macros for easier access to context registers */
131 #define EAX_reg(context) ((context)->Eax)
132 #define EBX_reg(context) ((context)->Ebx)
133 #define ECX_reg(context) ((context)->Ecx)
134 #define EDX_reg(context) ((context)->Edx)
135 #define ESI_reg(context) ((context)->Esi)
136 #define EDI_reg(context) ((context)->Edi)
137 #define EBP_reg(context) ((context)->Ebp)
139 #define CS_reg(context) ((context)->SegCs)
140 #define DS_reg(context) ((context)->SegDs)
141 #define ES_reg(context) ((context)->SegEs)
142 #define FS_reg(context) ((context)->SegFs)
143 #define GS_reg(context) ((context)->SegGs)
144 #define SS_reg(context) ((context)->SegSs)
146 #define EFL_reg(context) ((context)->EFlags)
147 #define EIP_reg(context) ((context)->Eip)
148 #define ESP_reg(context) ((context)->Esp)
150 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
151 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
152 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
153 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
154 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
155 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
156 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
158 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
159 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
160 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
161 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
162 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
163 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
164 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
165 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
167 #define IP_reg(context) (*(WORD*)&EIP_reg(context))
168 #define SP_reg(context) (*(WORD*)&ESP_reg(context))
170 #define FL_reg(context) (*(WORD*)&EFL_reg(context))
172 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
173 #define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
174 #define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
175 #define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
177 #define ISV86(context) (EFL_reg(context) & 0x00020000)
178 #define V86BASE(context) ((context)->Dr7) /* ugly */
180 #endif /* __WINE__ */
183 * Exception codes
186 #define STATUS_WAIT_0 0x00000000
187 #define STATUS_ABANDONED_WAIT_0 0x00000080
188 #define STATUS_USER_APC 0x000000C0
189 #define STATUS_TIMEOUT 0x00000102
190 #define STATUS_PENDING 0x00000103
191 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
192 #define STATUS_BREAKPOINT 0x80000003
193 #define STATUS_SINGLE_STEP 0x80000004
194 #define STATUS_ACCESS_VIOLATION 0xC0000005
195 #define STATUS_IN_PAGE_ERROR 0xC0000006
196 #define STATUS_NO_MEMORY 0xC0000017
197 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
198 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
199 #define STATUS_INVALID_DISPOSITION 0xC0000026
200 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
201 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
202 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
203 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
204 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
205 #define STATUS_FLOAT_OVERFLOW 0xC0000091
206 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
207 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
208 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
209 #define STATUS_INTEGER_OVERFLOW 0xC0000095
210 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
211 #define STATUS_STACK_OVERFLOW 0xC00000FD
212 #define STATUS_CONTROL_C_EXIT 0xC000013A
214 #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
215 #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
216 #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
217 #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
218 #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
219 #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
220 #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
221 #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
222 #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
223 #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
224 #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
225 #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
226 #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
227 #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
228 #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
229 #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
231 #define MAXIMUM_WAIT_OBJECTS 64
232 #define MAXIMUM_SUSPEND_COUNT 127
236 * Return values from the actual exception handlers
239 #define ExceptionContinueExecution 0
240 #define ExceptionContinueSearch 1
241 #define ExceptionNestedException 2
242 #define ExceptionCollidedUnwind 3
245 * Return values from filters in except() and from UnhandledExceptionFilter
248 #define EXCEPTION_EXECUTE_HANDLER 1
249 #define EXCEPTION_CONTINUE_SEARCH 0
250 #define EXCEPTION_CONTINUE_EXECUTION -1
253 * From OS/2 2.0 exception handling
254 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
257 #define EH_NONCONTINUABLE 0x01
258 #define EH_UNWINDING 0x02
259 #define EH_EXIT_UNWIND 0x04
260 #define EH_STACK_INVALID 0x08
261 #define EH_NESTED_CALL 0x10
263 #define EXCEPTION_CONTINUABLE 0
264 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
267 * The exception record used by Win32 to give additional information
268 * about exception to exception handlers.
271 #define EXCEPTION_MAXIMUM_PARAMETERS 15
273 typedef struct __EXCEPTION_RECORD
275 DWORD ExceptionCode;
276 DWORD ExceptionFlags;
277 struct __EXCEPTION_RECORD *ExceptionRecord;
279 LPVOID ExceptionAddress;
280 DWORD NumberParameters;
281 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
282 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
285 * The exception pointers structure passed to exception filters
286 * in except() and the UnhandledExceptionFilter().
289 typedef struct _EXCEPTION_POINTERS
291 PEXCEPTION_RECORD ExceptionRecord;
292 PCONTEXT ContextRecord;
293 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
296 * function pointer to a exception filter
299 typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
300 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
302 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
303 LPTOP_LEVEL_EXCEPTION_FILTER
304 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
307 * Here follows typedefs for security and tokens.
311 * First a constant for the following typdefs.
314 #define ANYSIZE_ARRAY 1
317 * TOKEN_INFORMATION_CLASS
320 typedef enum _TOKEN_INFORMATION_CLASS {
321 TokenUser = 1,
322 TokenGroups,
323 TokenPrivileges,
324 TokenOwner,
325 TokenPrimaryGroup,
326 TokenDefaultDacl,
327 TokenSource,
328 TokenType,
329 TokenImpersonationLevel,
330 TokenStatistics
331 } TOKEN_INFORMATION_CLASS;
334 * SID_AND_ATTRIBUTES
337 typedef struct _SID_AND_ATTRIBUTES {
338 PSID Sid;
339 DWORD Attributes;
340 } SID_AND_ATTRIBUTES ;
343 * TOKEN_USER
346 typedef struct _TOKEN_USER {
347 SID_AND_ATTRIBUTES User;
348 } TOKEN_USER;
351 * TOKEN_GROUPS
354 typedef struct _TOKEN_GROUPS {
355 DWORD GroupCount;
356 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
357 } TOKEN_GROUPS;
360 * LUID_AND_ATTRIBUTES
363 typedef struct _LUID_AND_ATTRIBUTES {
364 LUID Luid;
365 DWORD Attributes;
366 } LUID_AND_ATTRIBUTES;
369 * TOKEN_PRIVILEGES
372 typedef struct _TOKEN_PRIVILEGES {
373 DWORD PrivilegeCount;
374 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
375 } TOKEN_PRIVILEGES;
378 * TOKEN_OWNER
381 typedef struct _TOKEN_OWNER {
382 PSID Owner;
383 } TOKEN_OWNER;
386 * TOKEN_PRIMARY_GROUP
389 typedef struct _TOKEN_PRIMARY_GROUP {
390 PSID PrimaryGroup;
391 } TOKEN_PRIMARY_GROUP;
395 * ACL (and PACL LPACL?).
399 are defined in ntddl.h.
400 typedef struct _ACL {
401 BYTE AclRevision;
402 BYTE Sbz1;
403 WORD AclSize;
404 WORD AceCount;
405 WORD Sbz2;
406 } ACL, *PACL; PACL <=> LPACL? */
409 * TOKEN_DEFAULT_DACL
412 typedef struct _TOKEN_DEFAULT_DACL {
413 LPACL DefaultDacl;
414 } TOKEN_DEFAULT_DACL;
417 * TOKEN_SOURCEL
420 typedef struct _TOKEN_SOURCE {
421 char Sourcename[8];
422 LUID SourceIdentifier;
423 } TOKEN_SOURCE;
426 * TOKEN_TYPE
429 typedef enum tagTOKEN_TYPE {
430 TokenPrimary = 1,
431 TokenImpersonation
432 } TOKEN_TYPE;
435 * SECURITY_IMPERSONATION_LEVEL
438 typedef enum _SECURITY_IMPERSONATION_LEVEL {
439 SecurityAnonymous,
440 SecurityIdentification,
441 SecurityImpersonation,
442 SecurityDelegation
443 } SECURITY_IMPERSONATION_LEVEL;
447 * TOKEN_STATISTICS
450 typedef struct _TOKEN_STATISTICS {
451 LUID TokenId;
452 LUID AuthenticationId;
453 LARGE_INTEGER ExpirationTime;
454 TOKEN_TYPE TokenType;
455 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
456 DWORD DynamicCharged;
457 DWORD DynamicAvailable;
458 DWORD GroupCount;
459 DWORD PrivilegeCount;
460 LUID ModifiedId;
461 } TOKEN_STATISTICS;
464 /* I moved the Language IDs to winnls.h (David Lee Lambert) */
467 /* Access rights */
469 #define DELETE 0x00010000
470 #define READ_CONTROL 0x00020000
471 #define WRITE_DAC 0x00040000
472 #define WRITE_OWNER 0x00080000
473 #define SYNCHRONIZE 0x00100000
474 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
476 #define STANDARD_RIGHTS_READ READ_CONTROL
477 #define STANDARD_RIGHTS_WRITE READ_CONTROL
478 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
480 #define STANDARD_RIGHTS_ALL 0x001f0000
482 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
484 #define GENERIC_READ 0x80000000
485 #define GENERIC_WRITE 0x40000000
486 #define GENERIC_EXECUTE 0x20000000
487 #define GENERIC_ALL 0x10000000
489 #define EVENT_MODIFY_STATE 0x0002
490 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
492 #define SEMAPHORE_MODIFY_STATE 0x0002
493 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
495 #define MUTEX_MODIFY_STATE 0x0001
496 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
498 #define PROCESS_TERMINATE 0x0001
499 #define PROCESS_CREATE_THREAD 0x0002
500 #define PROCESS_VM_OPERATION 0x0008
501 #define PROCESS_VM_READ 0x0010
502 #define PROCESS_VM_WRITE 0x0020
503 #define PROCESS_DUP_HANDLE 0x0040
504 #define PROCESS_CREATE_PROCESS 0x0080
505 #define PROCESS_SET_QUOTA 0x0100
506 #define PROCESS_SET_INFORMATION 0x0200
507 #define PROCESS_QUERY_INFORMATION 0x0400
508 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
510 #define THREAD_TERMINATE 0x0001
511 #define THREAD_SUSPEND_RESUME 0x0002
512 #define THREAD_GET_CONTEXT 0x0008
513 #define THREAD_SET_CONTEXT 0x0010
514 #define THREAD_SET_INFORMATION 0x0020
515 #define THREAD_QUERY_INFORMATION 0x0040
516 #define THREAD_SET_THREAD_TOKEN 0x0080
517 #define THREAD_IMPERSONATE 0x0100
518 #define THREAD_DIRECT_IMPERSONATION 0x0200
519 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
521 #define FILE_READ_DATA 0x0001 /* file & pipe */
522 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
523 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
524 #define FILE_ADD_FILE 0x0002 /* directory */
525 #define FILE_APPEND_DATA 0x0004 /* file */
526 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
527 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
528 #define FILE_READ_EA 0x0008 /* file & directory */
529 #define FILE_READ_PROPERTIES FILE_READ_EA
530 #define FILE_WRITE_EA 0x0010 /* file & directory */
531 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
532 #define FILE_EXECUTE 0x0020 /* file */
533 #define FILE_TRAVERSE 0x0020 /* directory */
534 #define FILE_DELETE_CHILD 0x0040 /* directory */
535 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
536 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
537 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
539 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
540 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
541 SYNCHRONIZE)
542 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
543 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
544 FILE_APPEND_DATA | SYNCHRONIZE)
545 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
546 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
549 /* Registry security values */
550 #define OWNER_SECURITY_INFORMATION 0x00000001
551 #define GROUP_SECURITY_INFORMATION 0x00000002
552 #define DACL_SECURITY_INFORMATION 0x00000004
553 #define SACL_SECURITY_INFORMATION 0x00000008
555 #endif /* __WINE_WINNT_H */