2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
15 #define HEAP_NO_SERIALIZE 0x00000001
16 #define HEAP_GROWABLE 0x00000002
17 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
18 #define HEAP_ZERO_MEMORY 0x00000008
19 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
20 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
21 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
22 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
23 #define HEAP_CREATE_ALIGN_16 0x00010000
24 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
25 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
26 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
28 /* Processor feature flags. */
29 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
30 #define PF_FLOATING_POINT_EMULATED 1
31 #define PF_COMPARE_EXCHANGE_DOUBLE 2
32 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
33 #define PF_PPC_MOVEMEM_64BIT_OK 4
34 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
37 /* The Win32 register context */
39 #define CONTEXT_i386 0x00010000
40 #define CONTEXT_i486 CONTEXT_i386
41 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
42 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
43 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
44 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
45 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
46 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
48 #define SIZE_OF_80387_REGISTERS 80
59 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
67 /* These are selected by CONTEXT_DEBUG_REGISTERS */
75 /* These are selected by CONTEXT_FLOATING_POINT */
76 FLOATING_SAVE_AREA FloatSave
;
78 /* These are selected by CONTEXT_SEGMENTS */
84 /* These are selected by CONTEXT_INTEGER */
92 /* These are selected by CONTEXT_CONTROL */
101 typedef HANDLE32
*PHANDLE
;
105 /* Macros for easier access to context registers */
107 #define EAX_reg(context) ((context)->Eax)
108 #define EBX_reg(context) ((context)->Ebx)
109 #define ECX_reg(context) ((context)->Ecx)
110 #define EDX_reg(context) ((context)->Edx)
111 #define ESI_reg(context) ((context)->Esi)
112 #define EDI_reg(context) ((context)->Edi)
113 #define EBP_reg(context) ((context)->Ebp)
115 #define CS_reg(context) ((context)->SegCs)
116 #define DS_reg(context) ((context)->SegDs)
117 #define ES_reg(context) ((context)->SegEs)
118 #define FS_reg(context) ((context)->SegFs)
119 #define GS_reg(context) ((context)->SegGs)
120 #define SS_reg(context) ((context)->SegSs)
122 #define EFL_reg(context) ((context)->EFlags)
123 #define EIP_reg(context) ((context)->Eip)
124 #define ESP_reg(context) ((context)->Esp)
126 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
127 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
128 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
129 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
130 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
131 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
132 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
134 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
135 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
136 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
137 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
138 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
139 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
140 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
141 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
143 #define IP_reg(context) (*(WORD*)&EIP_reg(context))
144 #define SP_reg(context) (*(WORD*)&ESP_reg(context))
146 #define FL_reg(context) (*(WORD*)&EFL_reg(context))
148 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
149 #define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
151 #endif /* __WINE__ */
157 #define STATUS_WAIT_0 0x00000000
158 #define STATUS_ABANDONED_WAIT_0 0x00000080
159 #define STATUS_USER_APC 0x000000C0
160 #define STATUS_TIMEOUT 0x00000102
161 #define STATUS_PENDING 0x00000103
162 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
163 #define STATUS_BREAKPOINT 0x80000003
164 #define STATUS_SINGLE_STEP 0x80000004
165 #define STATUS_ACCESS_VIOLATION 0xC0000005
166 #define STATUS_IN_PAGE_ERROR 0xC0000006
167 #define STATUS_NO_MEMORY 0xC0000017
168 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
169 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
170 #define STATUS_INVALID_DISPOSITION 0xC0000026
171 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
172 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
173 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
174 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
175 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
176 #define STATUS_FLOAT_OVERFLOW 0xC0000091
177 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
178 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
179 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
180 #define STATUS_INTEGER_OVERFLOW 0xC0000095
181 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
182 #define STATUS_STACK_OVERFLOW 0xC00000FD
183 #define STATUS_CONTROL_C_EXIT 0xC000013A
185 #define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
186 #define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
187 #define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
188 #define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
189 #define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
190 #define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
191 #define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
192 #define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
193 #define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
194 #define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
195 #define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
196 #define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
197 #define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
198 #define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
199 #define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
200 #define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
202 #define MAXIMUM_WAIT_OBJECTS 64
203 #define MAXIMUM_SUSPEND_COUNT 127
207 * Return values from the actual exception handlers
210 #define ExceptionContinueExecution 0
211 #define ExceptionContinueSearch 1
212 #define ExceptionNestedException 2
213 #define ExceptionCollidedUnwind 3
216 * Return values from filters in except() and from UnhandledExceptionFilter
219 #define EXCEPTION_EXECUTE_HANDLER 1
220 #define EXCEPTION_CONTINUE_SEARCH 0
221 #define EXCEPTION_CONTINUE_EXECUTION -1
224 * From OS/2 2.0 exception handling
225 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
228 #define EH_NONCONTINUABLE 0x01
229 #define EH_UNWINDING 0x02
230 #define EH_EXIT_UNWIND 0x04
231 #define EH_STACK_INVALID 0x08
232 #define EH_NESTED_CALL 0x10
234 #define EXCEPTION_CONTINUABLE 0
235 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
238 * The exception record used by Win32 to give additional information
239 * about exception to exception handlers.
242 #define EXCEPTION_MAXIMUM_PARAMETERS 15
244 typedef struct __EXCEPTION_RECORD
247 DWORD ExceptionFlags
;
248 struct __EXCEPTION_RECORD
*ExceptionRecord
;
250 LPVOID ExceptionAddress
;
251 DWORD NumberParameters
;
252 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
253 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
256 * The exception pointers structure passed to exception filters
257 * in except() and the UnhandledExceptionFilter().
260 typedef struct _EXCEPTION_POINTERS
262 PEXCEPTION_RECORD ExceptionRecord
;
263 PCONTEXT ContextRecord
;
264 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
267 * function pointer to a exception filter
270 typedef LONG (CALLBACK
*PTOP_LEVEL_EXCEPTION_FILTER
)(PEXCEPTION_POINTERS ExceptionInfo
);
271 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
;
273 DWORD WINAPI
UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers
);
274 LPTOP_LEVEL_EXCEPTION_FILTER
275 WINAPI
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter
);
278 * Here follows typedefs for security and tokens.
282 * First a constant for the following typdefs.
285 #define ANYSIZE_ARRAY 1
288 * TOKEN_INFORMATION_CLASS
291 typedef enum _TOKEN_INFORMATION_CLASS
{
300 TokenImpersonationLevel
,
302 } TOKEN_INFORMATION_CLASS
;
308 typedef struct _SID_AND_ATTRIBUTES
{
311 } SID_AND_ATTRIBUTES
;
317 typedef struct _TOKEN_USER
{
318 SID_AND_ATTRIBUTES User
;
325 typedef struct _TOKEN_GROUPS
{
327 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
331 * LUID_AND_ATTRIBUTES
334 typedef struct _LUID_AND_ATTRIBUTES
{
337 } LUID_AND_ATTRIBUTES
;
343 typedef struct _TOKEN_PRIVILEGES
{
344 DWORD PrivilegeCount
;
345 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
352 typedef struct _TOKEN_OWNER
{
357 * TOKEN_PRIMARY_GROUP
360 typedef struct _TOKEN_PRIMARY_GROUP
{
362 } TOKEN_PRIMARY_GROUP
;
366 * ACL (and PACL LPACL?).
370 are defined in ntddl.h.
371 typedef struct _ACL {
377 } ACL, *PACL; PACL <=> LPACL? */
383 typedef struct _TOKEN_DEFAULT_DACL
{
385 } TOKEN_DEFAULT_DACL
;
391 typedef struct _TOKEN_SOURCE
{
393 LUID SourceIdentifier
;
400 typedef enum tagTOKEN_TYPE
{
406 * SECURITY_IMPERSONATION_LEVEL
409 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
411 SecurityIdentification
,
412 SecurityImpersonation
,
414 } SECURITY_IMPERSONATION_LEVEL
;
421 typedef struct _TOKEN_STATISTICS
{
423 LUID AuthenticationId
;
424 LARGE_INTEGER ExpirationTime
;
425 TOKEN_TYPE TokenType
;
426 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
427 DWORD DynamicCharged
;
428 DWORD DynamicAvailable
;
430 DWORD PrivilegeCount
;
435 /* I moved the Language IDs to winnls.h (David Lee Lambert) */
440 #define DELETE 0x00010000
441 #define READ_CONTROL 0x00020000
442 #define WRITE_DAC 0x00040000
443 #define WRITE_OWNER 0x00080000
444 #define SYNCHRONIZE 0x00100000
445 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
447 #define STANDARD_RIGHTS_READ READ_CONTROL
448 #define STANDARD_RIGHTS_WRITE READ_CONTROL
449 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
451 #define STANDARD_RIGHTS_ALL 0x001f0000
453 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
455 #define GENERIC_READ 0x80000000
456 #define GENERIC_WRITE 0x40000000
457 #define GENERIC_EXECUTE 0x20000000
458 #define GENERIC_ALL 0x10000000
460 #define EVENT_MODIFY_STATE 0x0002
461 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
463 #define SEMAPHORE_MODIFY_STATE 0x0002
464 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
466 #define MUTEX_MODIFY_STATE 0x0001
467 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
469 #define PROCESS_TERMINATE 0x0001
470 #define PROCESS_CREATE_THREAD 0x0002
471 #define PROCESS_VM_OPERATION 0x0008
472 #define PROCESS_VM_READ 0x0010
473 #define PROCESS_VM_WRITE 0x0020
474 #define PROCESS_DUP_HANDLE 0x0040
475 #define PROCESS_CREATE_PROCESS 0x0080
476 #define PROCESS_SET_QUOTA 0x0100
477 #define PROCESS_SET_INFORMATION 0x0200
478 #define PROCESS_QUERY_INFORMATION 0x0400
479 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
481 #define THREAD_TERMINATE 0x0001
482 #define THREAD_SUSPEND_RESUME 0x0002
483 #define THREAD_GET_CONTEXT 0x0008
484 #define THREAD_SET_CONTEXT 0x0010
485 #define THREAD_SET_INFORMATION 0x0020
486 #define THREAD_QUERY_INFORMATION 0x0040
487 #define THREAD_SET_THREAD_TOKEN 0x0080
488 #define THREAD_IMPERSONATE 0x0100
489 #define THREAD_DIRECT_IMPERSONATION 0x0200
490 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
492 #define FILE_READ_DATA 0x0001 /* file & pipe */
493 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
494 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
495 #define FILE_ADD_FILE 0x0002 /* directory */
496 #define FILE_APPEND_DATA 0x0004 /* file */
497 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
498 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
499 #define FILE_READ_EA 0x0008 /* file & directory */
500 #define FILE_READ_PROPERTIES FILE_READ_EA
501 #define FILE_WRITE_EA 0x0010 /* file & directory */
502 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
503 #define FILE_EXECUTE 0x0020 /* file */
504 #define FILE_TRAVERSE 0x0020 /* directory */
505 #define FILE_DELETE_CHILD 0x0040 /* directory */
506 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
507 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
508 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
510 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
511 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
513 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
514 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
515 FILE_APPEND_DATA | SYNCHRONIZE)
516 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
517 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
520 /* Registry security values */
521 #define OWNER_SECURITY_INFORMATION 0x00000001
522 #define GROUP_SECURITY_INFORMATION 0x00000002
523 #define DACL_SECURITY_INFORMATION 0x00000004
524 #define SACL_SECURITY_INFORMATION 0x00000008
526 #endif /* __WINE_WINNT_H */