Merge winnt.h
[reactos.git] / reactos / include / psdk / winnt.h
1 #ifndef _WINNT_H
2 #define _WINNT_H
3
4 #if !defined(__ROS_LONG64__)
5 #ifdef __WINESRC__
6 #define __ROS_LONG64__
7 #endif
8 #endif
9
10 #ifdef __GNUC__
11 #include <msvctarget.h>
12 #endif
13
14 #if defined(_M_IX86) && !defined(_X86_)
15 #define _X86_
16 #elif defined(_M_ALPHA) && !defined(_ALPHA_)
17 #define _ALPHA_
18 #elif defined(_M_ARM) && !defined(_ARM_)
19 #define _ARM_
20 #elif defined(_M_PPC) && !defined(_PPC_)
21 #define _PPC_
22 #elif defined(_M_MRX000) && !defined(_MIPS_)
23 #define _MIPS_
24 #elif defined(_M_M68K) && !defined(_68K_)
25 #define _68K_
26 #endif
27
28 #ifndef DECLSPEC_ALIGN
29 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
30 # define DECLSPEC_ALIGN(x) __declspec(align(x))
31 # elif defined(__GNUC__)
32 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
33 # else
34 # define DECLSPEC_ALIGN(x)
35 # endif
36 #endif
37
38 # define DECLSPEC_HIDDEN
39
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43
44 #include <excpt.h>
45 #include <basetsd.h>
46 #include <guiddef.h>
47
48 #include <ctype.h>
49 #undef __need_wchar_t
50
51 #include <winerror.h>
52 #include <stddef.h>
53 #include <sdkddkver.h>
54
55 #ifndef RC_INVOKED
56 #include <string.h>
57
58 /* FIXME: add more architectures. Is there a way to specify this in GCC? */
59 #if defined(_M_AMD64)
60 #undef UNALIGNED
61 #define UNALIGNED __unaligned
62 #else
63 #define UNALIGNED
64 #endif
65
66 #ifndef DECLSPEC_ADDRSAFE
67 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
68 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
69 #else
70 #define DECLSPEC_ADDRSAFE
71 #endif
72 #endif
73
74 /*#ifdef _WINE*/
75 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
76 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
77 #else
78 #define __WINE_ALLOC_SIZE(x)
79 #endif
80 /*#endif*/
81
82 #ifndef FORCEINLINE
83 #if (_MSC_VER >= 1200)
84 #define FORCEINLINE __forceinline
85 #elif (_MSC_VER)
86 #define FORCEINLINE __inline
87 #else
88 #define FORCEINLINE static __inline__ __attribute__((always_inline))
89 #endif
90 #endif
91
92 #if !defined(_NTSYSTEM_)
93 #define NTSYSAPI DECLSPEC_IMPORT
94 #define NTSYSCALLAPI DECLSPEC_IMPORT
95 #else
96 #define NTSYSAPI
97 #if defined(_NTDLLBUILD_)
98 #define NTSYSCALLAPI
99 #else
100 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
101 #endif
102 #endif
103
104 #ifndef VOID
105 #define VOID void
106 #endif
107 typedef char CHAR;
108 typedef short SHORT;
109 #if !defined(__ROS_LONG64__) || defined(_M_AMD64)
110 typedef long LONG;
111 #else
112 typedef int LONG;
113 #endif
114 typedef char CCHAR, *PCCHAR;
115 typedef void *PVOID;
116
117 /* FIXME for __WIN64 */
118 #ifndef __ptr64
119 #define __ptr64
120 #endif
121 typedef void* __ptr64 PVOID64;
122
123 #ifdef __cplusplus
124 # define EXTERN_C extern "C"
125 #else
126 # define EXTERN_C extern
127 #endif
128
129 #define STDMETHODCALLTYPE __stdcall
130 #define STDMETHODVCALLTYPE __cdecl
131 #define STDAPICALLTYPE __stdcall
132 #define STDAPIVCALLTYPE __cdecl
133
134 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
135 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
136 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
137 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
138 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
139 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
140 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
141 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
142
143 typedef wchar_t WCHAR;
144 typedef WCHAR *PWCHAR,*LPWCH,*PWCH,*NWPSTR,*LPWSTR,*PWSTR;
145 typedef CONST WCHAR *LPCWCH,*PCWCH,*LPCWSTR,*PCWSTR;
146 typedef CHAR *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
147 typedef CONST CHAR *LPCCH,*PCCH,*PCSTR,*LPCSTR;
148 typedef PWSTR *PZPWSTR;
149 typedef CONST PWSTR *PCZPWSTR;
150 typedef WCHAR UNALIGNED *LPUWSTR,*PUWSTR;
151 typedef PCWSTR *PZPCWSTR;
152 typedef CONST WCHAR UNALIGNED *LPCUWSTR,*PCUWSTR;
153 typedef PSTR *PZPSTR;
154 typedef CONST PSTR *PCZPSTR;
155 typedef PCSTR *PZPCSTR;
156
157 #ifdef UNICODE
158 #ifndef _TCHAR_DEFINED
159 #define _TCHAR_DEFINED
160 typedef WCHAR TCHAR,*PTCHAR;
161 typedef WCHAR TBYTE ,*PTBYTE;
162 #endif
163 typedef LPWSTR LPTCH,PTCH,PTSTR,LPTSTR,LP;
164 typedef LPCWSTR PCTSTR,LPCTSTR;
165 typedef LPUWSTR PUTSTR,LPUTSTR;
166 typedef LPCUWSTR PCUTSTR,LPCUTSTR;
167 #define __TEXT(quote) L##quote
168 #else
169 #ifndef _TCHAR_DEFINED
170 #define _TCHAR_DEFINED
171 typedef char TCHAR,*PTCHAR;
172 typedef unsigned char TBYTE ,*PTBYTE;
173 #endif
174 typedef LPSTR LPTCH,PTCH,PTSTR,LPTSTR,PUTSTR,LPUTSTR;
175 typedef LPCSTR PCTSTR,LPCTSTR,PCUTSTR,LPCUTSTR;
176 #define __TEXT(quote) quote
177 #endif
178
179 #define TEXT(quote) __TEXT(quote)
180
181 typedef SHORT *PSHORT;
182 typedef LONG *PLONG;
183 #ifdef STRICT
184 typedef void *HANDLE;
185 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
186 #else
187 typedef PVOID HANDLE;
188 #define DECLARE_HANDLE(n) typedef HANDLE n
189 #endif
190 typedef HANDLE *PHANDLE;
191 typedef DWORD LCID;
192 typedef PDWORD PLCID;
193 typedef WORD LANGID;
194 #ifdef __GNUC__
195 #define _HAVE_INT64
196 #ifndef _INTEGRAL_MAX_BITS
197 # define _INTEGRAL_MAX_BITS 64
198 #endif
199 #undef __int64
200 #define __int64 long long
201 #elif (defined(__WATCOMC__) || defined(_MSC_VER)) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
202 #define _HAVE_INT64
203 #endif /* __GNUC__/__WATCOMC */
204 #if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
205 typedef __int64 LONGLONG;
206 typedef unsigned __int64 DWORDLONG;
207 #else
208 typedef double LONGLONG,DWORDLONG;
209 #endif
210 typedef LONGLONG *PLONGLONG;
211 typedef DWORDLONG *PDWORDLONG;
212 typedef DWORDLONG ULONGLONG,*PULONGLONG;
213 typedef LONGLONG USN;
214 #ifdef _HAVE_INT64
215 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
216 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
217 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
218 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
219 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
220 #endif
221 #define ANSI_NULL ((CHAR)0)
222 #define UNICODE_NULL ((WCHAR)0)
223 typedef BYTE BOOLEAN,*PBOOLEAN;
224 #endif
225 typedef BYTE FCHAR;
226 typedef WORD FSHORT;
227 typedef DWORD FLONG;
228
229 #define C_ASSERT(expr) extern char (*c_assert(void)) [(expr) ? 1 : -1]
230
231 #include "intrin.h"
232
233 #define NTAPI __stdcall
234 #include <basetsd.h>
235
236 #ifdef _MSC_VER
237 #pragma warning(push)
238 #pragma warning(disable:4201)
239 #pragma warning(disable:4214)
240 #pragma warning(disable:4820)
241 #endif
242
243 #define ACE_OBJECT_TYPE_PRESENT 0x00000001
244 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
245 #define APPLICATION_ERROR_MASK 0x20000000
246 #define ERROR_SEVERITY_SUCCESS 0x00000000
247 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
248 #define ERROR_SEVERITY_WARNING 0x80000000
249 #define ERROR_SEVERITY_ERROR 0xC0000000
250 /* also in ddk/ntifs.h */
251 #define COMPRESSION_FORMAT_NONE (0x0000)
252 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
253 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
254 #define COMPRESSION_ENGINE_STANDARD (0x0000)
255 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
256 #define COMPRESSION_ENGINE_HIBER (0x0200)
257 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
258 #define ACCESS_DENIED_ACE_TYPE (0x1)
259 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
260 #define SYSTEM_ALARM_ACE_TYPE (0x3)
261 /*end ntifs.h */
262 #define ANYSIZE_ARRAY 1
263 #define OBJECT_INHERIT_ACE 1
264 #define CONTAINER_INHERIT_ACE 2
265 #define NO_PROPAGATE_INHERIT_ACE 4
266 #define INHERIT_ONLY_ACE 8
267 #define INHERITED_ACE 10
268 #define VALID_INHERIT_FLAGS 0x1F
269 #define SUCCESSFUL_ACCESS_ACE_FLAG 64
270 #define FAILED_ACCESS_ACE_FLAG 128
271 #define DELETE 0x00010000L
272 #define READ_CONTROL 0x20000L
273 #define WRITE_DAC 0x40000L
274 #define WRITE_OWNER 0x80000L
275 #define SYNCHRONIZE 0x100000L
276 #define STANDARD_RIGHTS_REQUIRED 0xF0000
277 #define STANDARD_RIGHTS_READ 0x20000
278 #define STANDARD_RIGHTS_WRITE 0x20000
279 #define STANDARD_RIGHTS_EXECUTE 0x20000
280 #define STANDARD_RIGHTS_ALL 0x1F0000
281 #define SPECIFIC_RIGHTS_ALL 0xFFFF
282 #define ACCESS_SYSTEM_SECURITY 0x1000000
283
284 #define REG_STANDARD_FORMAT 1
285 #define REG_LATEST_FORMAT 2
286 #define REG_NO_COMPRESSION 4
287
288 #ifndef WIN32_NO_STATUS
289
290 #define STATUS_WAIT_0 ((DWORD)0x00000000)
291 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080)
292 #define STATUS_USER_APC ((DWORD)0x000000C0)
293 #define STATUS_TIMEOUT ((DWORD)0x00000102)
294 #define STATUS_PENDING ((DWORD)0x00000103)
295 #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005)
296 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001)
297 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002)
298 #define STATUS_BREAKPOINT ((DWORD)0x80000003)
299 #define STATUS_SINGLE_STEP ((DWORD)0x80000004)
300 #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005)
301 #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006)
302 #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008)
303 #define STATUS_NO_MEMORY ((DWORD)0xC0000017)
304 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D)
305 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025)
306 #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026)
307 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C)
308 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D)
309 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E)
310 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F)
311 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090)
312 #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091)
313 #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092)
314 #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093)
315 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094)
316 #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095)
317 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096)
318 #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD)
319 #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A)
320 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4)
321 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5)
322 #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9)
323 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F)
324 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010)
325
326 #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001)
327 #define DBG_CONTINUE ((DWORD)0x00010002)
328 #define DBG_TERMINATE_THREAD ((DWORD)0x40010003)
329 #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004)
330 #define DBG_CONTROL_C ((DWORD)0x40010005)
331 #define DBG_CONTROL_BREAK ((DWORD)0x40010008)
332 #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009)
333 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001)
334
335 #endif /* WIN32_NO_STATUS */
336
337 #define MAXIMUM_ALLOWED 0x2000000
338 #define GENERIC_READ 0x80000000
339 #define GENERIC_WRITE 0x40000000
340 #define GENERIC_EXECUTE 0x20000000
341 #define GENERIC_ALL 0x10000000
342
343 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
344
345 /* Also in ddk/winddk.h */
346 #define FILE_LIST_DIRECTORY 0x00000001
347 #define FILE_READ_DATA 0x00000001
348 #define FILE_ADD_FILE 0x00000002
349 #define FILE_WRITE_DATA 0x00000002
350 #define FILE_ADD_SUBDIRECTORY 0x00000004
351 #define FILE_APPEND_DATA 0x00000004
352 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
353 #define FILE_READ_EA 0x00000008
354 #define FILE_READ_PROPERTIES 0x00000008
355 #define FILE_WRITE_EA 0x00000010
356 #define FILE_WRITE_PROPERTIES 0x00000010
357 #define FILE_EXECUTE 0x00000020
358 #define FILE_TRAVERSE 0x00000020
359 #define FILE_DELETE_CHILD 0x00000040
360 #define FILE_READ_ATTRIBUTES 0x00000080
361 #define FILE_WRITE_ATTRIBUTES 0x00000100
362
363 #define FILE_SHARE_READ 0x00000001
364 #define FILE_SHARE_WRITE 0x00000002
365 #define FILE_SHARE_DELETE 0x00000004
366 #define FILE_SHARE_VALID_FLAGS 0x00000007
367
368 #define FILE_ATTRIBUTE_READONLY 0x00000001
369 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
370 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
371 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
372 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
373 #define FILE_ATTRIBUTE_DEVICE 0x00000040
374 #define FILE_ATTRIBUTE_NORMAL 0x00000080
375 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
376 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
377 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
378 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
379 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
380 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
381 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
382 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
383 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
384
385 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
386 #define FILE_STRUCTURED_STORAGE 0x00000441
387
388 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
389 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
390 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
391 #define FILE_VALID_SET_FLAGS 0x00000036
392
393 #define FILE_DIRECTORY_FILE 0x00000001
394 #define FILE_WRITE_THROUGH 0x00000002
395 #define FILE_SEQUENTIAL_ONLY 0x00000004
396 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
397 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
398 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
399 #define FILE_NON_DIRECTORY_FILE 0x00000040
400 #define FILE_CREATE_TREE_CONNECTION 0x00000080
401 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
402 #define FILE_NO_EA_KNOWLEDGE 0x00000200
403 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
404 #define FILE_RANDOM_ACCESS 0x00000800
405 #define FILE_DELETE_ON_CLOSE 0x00001000
406 #define FILE_OPEN_BY_FILE_ID 0x00002000
407 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
408 #define FILE_NO_COMPRESSION 0x00008000
409 #define FILE_RESERVE_OPFILTER 0x00100000
410 #define FILE_OPEN_REPARSE_POINT 0x00200000
411 #define FILE_OPEN_NO_RECALL 0x00400000
412 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
413
414 #define FILE_ALL_ACCESS \
415 (STANDARD_RIGHTS_REQUIRED | \
416 SYNCHRONIZE | \
417 0x1FF)
418
419 #define FILE_GENERIC_EXECUTE \
420 (STANDARD_RIGHTS_EXECUTE | \
421 FILE_READ_ATTRIBUTES | \
422 FILE_EXECUTE | \
423 SYNCHRONIZE)
424
425 #define FILE_GENERIC_READ \
426 (STANDARD_RIGHTS_READ | \
427 FILE_READ_DATA | \
428 FILE_READ_ATTRIBUTES | \
429 FILE_READ_EA | \
430 SYNCHRONIZE)
431
432 #define FILE_GENERIC_WRITE \
433 (STANDARD_RIGHTS_WRITE | \
434 FILE_WRITE_DATA | \
435 FILE_WRITE_ATTRIBUTES | \
436 FILE_WRITE_EA | \
437 FILE_APPEND_DATA | \
438 SYNCHRONIZE)
439 /* end winddk.h */
440 /* also in ddk/ntifs.h */
441 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
442 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
443 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
444 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
445 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
446 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
447 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
448 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
449 #define FILE_NOTIFY_CHANGE_EA 0x00000080
450 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
451 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
452 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
453 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
454 #define FILE_NOTIFY_VALID_MASK 0x00000fff
455
456 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
457 #define FILE_CASE_PRESERVED_NAMES 0x00000002
458 #define FILE_UNICODE_ON_DISK 0x00000004
459 #define FILE_PERSISTENT_ACLS 0x00000008
460 #define FILE_FILE_COMPRESSION 0x00000010
461 #define FILE_VOLUME_QUOTAS 0x00000020
462 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
463 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
464 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
465 #define FS_LFN_APIS 0x00004000
466 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
467 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
468 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
469 #define FILE_NAMED_STREAMS 0x00040000
470
471 #define IO_COMPLETION_QUERY_STATE 0x0001
472 #define IO_COMPLETION_MODIFY_STATE 0x0002
473 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
474 /* end ntifs.h */
475
476 /* also in ddk/winddk.h */
477 #define DUPLICATE_CLOSE_SOURCE 0x00000001
478 #define DUPLICATE_SAME_ACCESS 0x00000002
479 /* end winddk.k */
480
481 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
482 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
483 #define PROCESS_TERMINATE 1
484 #define PROCESS_CREATE_THREAD 2
485 #define PROCESS_SET_SESSIONID 4
486 #define PROCESS_VM_OPERATION 8
487 #define PROCESS_VM_READ 16
488 #define PROCESS_VM_WRITE 32
489 #define PROCESS_CREATE_PROCESS 128
490 #define PROCESS_SET_QUOTA 256
491 #define PROCESS_SET_INFORMATION 512
492 #define PROCESS_QUERY_INFORMATION 1024
493 #define PROCESS_SUSPEND_RESUME 2048
494 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
495 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
496 #define PROCESS_DUP_HANDLE 64
497 #define THREAD_TERMINATE 1
498 #define THREAD_SUSPEND_RESUME 2
499 #define THREAD_GET_CONTEXT 8
500 #define THREAD_SET_CONTEXT 16
501 #define THREAD_SET_INFORMATION 32
502 #define THREAD_QUERY_INFORMATION 64
503 #define THREAD_SET_THREAD_TOKEN 128
504 #define THREAD_IMPERSONATE 256
505 #define THREAD_DIRECT_IMPERSONATION 0x200
506 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
507 #define MUTANT_QUERY_STATE 0x0001
508 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
509 #define TIMER_QUERY_STATE 0x0001
510 #define TIMER_MODIFY_STATE 0x0002
511 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
512 #define THREAD_BASE_PRIORITY_LOWRT 15
513 #define THREAD_BASE_PRIORITY_MAX 2
514 #define THREAD_BASE_PRIORITY_MIN (-2)
515 #define THREAD_BASE_PRIORITY_IDLE (-15)
516 /*
517 * To prevent gcc compiler warnings, bracket these defines when initialising
518 * a SID_IDENTIFIER_AUTHORITY, eg.
519 * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
520 */
521 #define SID_MAX_SUB_AUTHORITIES 15
522
523 /* security entities */
524 #define SECURITY_NULL_RID (0x00000000L)
525 #define SECURITY_WORLD_RID (0x00000000L)
526 #define SECURITY_LOCAL_RID (0X00000000L)
527
528 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
529
530 /* S-1-1 */
531 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
532
533 /* S-1-2 */
534 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
535
536 /* S-1-3 */
537 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
538 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
539 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
540 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
541 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
542
543 /* S-1-4 */
544 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
545
546 /* S-1-5 */
547 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
548 #define SECURITY_DIALUP_RID 0x00000001L
549 #define SECURITY_NETWORK_RID 0x00000002L
550 #define SECURITY_BATCH_RID 0x00000003L
551 #define SECURITY_INTERACTIVE_RID 0x00000004L
552 #define SECURITY_LOGON_IDS_RID 0x00000005L
553 #define SECURITY_SERVICE_RID 0x00000006L
554 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
555 #define SECURITY_PROXY_RID 0x00000008L
556 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
557 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
558 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
559 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
560 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
561 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
562 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
563 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
564 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
565 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
566 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
567 #define SECURITY_NT_NON_UNIQUE 0x00000015L
568 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
569
570 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
571 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
572 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
573 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
574 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
575
576 #define SECURITY_LOGON_IDS_RID_COUNT 0x3
577 #define SID_REVISION 1
578
579 #define FOREST_USER_RID_MAX 0x000001F3L
580 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
581 #define DOMAIN_USER_RID_GUEST 0x000001F5L
582 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
583 #define DOMAIN_USER_RID_MAX 0x000003E7L
584
585 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
586 #define DOMAIN_GROUP_RID_USERS 0x00000201L
587 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
588 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
589 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
590 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
591 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
592 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
593 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
594
595 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
596 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
597 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
598 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
599 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
600 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
601 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
602
603 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
604 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
605 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
606 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
607
608 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
609 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
610 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
611 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
612
613 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
614 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
615 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
616 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
617 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
618 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
619
620 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
621 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
622 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
623 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
624 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
625
626 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
627
628 typedef enum {
629 WinNullSid = 0,
630 WinWorldSid = 1,
631 WinLocalSid = 2,
632 WinCreatorOwnerSid = 3,
633 WinCreatorGroupSid = 4,
634 WinCreatorOwnerServerSid = 5,
635 WinCreatorGroupServerSid = 6,
636 WinNtAuthoritySid = 7,
637 WinDialupSid = 8,
638 WinNetworkSid = 9,
639 WinBatchSid = 10,
640 WinInteractiveSid = 11,
641 WinServiceSid = 12,
642 WinAnonymousSid = 13,
643 WinProxySid = 14,
644 WinEnterpriseControllersSid = 15,
645 WinSelfSid = 16,
646 WinAuthenticatedUserSid = 17,
647 WinRestrictedCodeSid = 18,
648 WinTerminalServerSid = 19,
649 WinRemoteLogonIdSid = 20,
650 WinLogonIdsSid = 21,
651 WinLocalSystemSid = 22,
652 WinLocalServiceSid = 23,
653 WinNetworkServiceSid = 24,
654 WinBuiltinDomainSid = 25,
655 WinBuiltinAdministratorsSid = 26,
656 WinBuiltinUsersSid = 27,
657 WinBuiltinGuestsSid = 28,
658 WinBuiltinPowerUsersSid = 29,
659 WinBuiltinAccountOperatorsSid = 30,
660 WinBuiltinSystemOperatorsSid = 31,
661 WinBuiltinPrintOperatorsSid = 32,
662 WinBuiltinBackupOperatorsSid = 33,
663 WinBuiltinReplicatorSid = 34,
664 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
665 WinBuiltinRemoteDesktopUsersSid = 36,
666 WinBuiltinNetworkConfigurationOperatorsSid = 37,
667 WinAccountAdministratorSid = 38,
668 WinAccountGuestSid = 39,
669 WinAccountKrbtgtSid = 40,
670 WinAccountDomainAdminsSid = 41,
671 WinAccountDomainUsersSid = 42,
672 WinAccountDomainGuestsSid = 43,
673 WinAccountComputersSid = 44,
674 WinAccountControllersSid = 45,
675 WinAccountCertAdminsSid = 46,
676 WinAccountSchemaAdminsSid = 47,
677 WinAccountEnterpriseAdminsSid = 48,
678 WinAccountPolicyAdminsSid = 49,
679 WinAccountRasAndIasServersSid = 50,
680 WinNTLMAuthenticationSid = 51,
681 WinDigestAuthenticationSid = 52,
682 WinSChannelAuthenticationSid = 53,
683 WinThisOrganizationSid = 54,
684 WinOtherOrganizationSid = 55,
685 WinBuiltinIncomingForestTrustBuildersSid = 56,
686 WinBuiltinPerfMonitoringUsersSid = 57,
687 WinBuiltinPerfLoggingUsersSid = 58,
688 WinBuiltinAuthorizationAccessSid = 59,
689 WinBuiltinTerminalServerLicenseServersSid = 60,
690 WinBuiltinDCOMUsersSid = 61,
691 WinBuiltinIUsersSid = 62,
692 WinIUserSid = 63,
693 WinBuiltinCryptoOperatorsSid = 64,
694 WinUntrustedLabelSid = 65,
695 WinLowLabelSid = 66,
696 WinMediumLabelSid = 67,
697 WinHighLabelSid = 68,
698 WinSystemLabelSid = 69,
699 WinWriteRestrictedCodeSid = 70,
700 WinCreatorOwnerRightsSid = 71,
701 WinCacheablePrincipalsGroupSid = 72,
702 WinNonCacheablePrincipalsGroupSid = 73,
703 WinEnterpriseReadonlyControllersSid = 74,
704 WinAccountReadonlyControllersSid = 75,
705 WinBuiltinEventLogReadersGroup = 76
706 } WELL_KNOWN_SID_TYPE;
707
708 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
709 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
710 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
711 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
712 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
713 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
714 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
715 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
716 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
717 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
718 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
719 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
720 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
721 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
722 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
723 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
724 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
725 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
726 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
727 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
728 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
729 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
730 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
731 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
732 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
733 #define SE_GROUP_MANDATORY 1
734 #define SE_GROUP_ENABLED_BY_DEFAULT 2
735 #define SE_GROUP_ENABLED 4
736 #define SE_GROUP_OWNER 8
737 #define SE_GROUP_USE_FOR_DENY_ONLY 16
738 #define SE_GROUP_LOGON_ID 3221225472U
739 #define SE_GROUP_RESOURCE 536870912
740 #define LANG_NEUTRAL 0x00
741 #define LANG_INVARIANT 0x7f
742 #define LANG_AFRIKAANS 0x36
743 #define LANG_ALBANIAN 0x1c
744 #define LANG_ALSATIAN 0x84
745 #define LANG_AMHARIC 0x5e
746 #define LANG_ARABIC 0x01
747 #define LANG_ARMENIAN 0x2b
748 #define LANG_ASSAMESE 0x4d
749 #define LANG_AZERI 0x2c
750 #define LANG_BASHKIR 0x6d
751 #define LANG_BASQUE 0x2d
752 #define LANG_BELARUSIAN 0x23
753 #define LANG_BENGALI 0x45
754 #define LANG_BOSNIAN 0x1a
755 #define LANG_BRETON 0x7e
756 #define LANG_BULGARIAN 0x02
757 #define LANG_CATALAN 0x03
758 #define LANG_CHINESE 0x04
759 #define LANG_CHINESE_SIMPLIFIED 0x04
760 #define LANG_CORSICAN 0x83
761 #define LANG_CROATIAN 0x1a
762 #define LANG_CROATIAN 0x1a
763 #define LANG_CZECH 0x05
764 #define LANG_DANISH 0x06
765 #define LANG_DARI 0x8c
766 #define LANG_DIVEHI 0x65
767 #define LANG_DUTCH 0x13
768 #define LANG_ENGLISH 0x09
769 #define LANG_ESTONIAN 0x25
770 #define LANG_FAEROESE 0x38
771 #define LANG_FILIPINO 0x64
772 #define LANG_FINNISH 0x0b
773 #define LANG_FRENCH 0x0c
774 #define LANG_FRISIAN 0x62
775 #define LANG_GALICIAN 0x56
776 #define LANG_GEORGIAN 0x37
777 #define LANG_GERMAN 0x07
778 #define LANG_GREEK 0x08
779 #define LANG_GREENLANDIC 0x6f
780 #define LANG_GUJARATI 0x47
781 #define LANG_HAUSA 0x68
782 #define LANG_HEBREW 0x0d
783 #define LANG_HINDI 0x39
784 #define LANG_HUNGARIAN 0x0e
785 #define LANG_ICELANDIC 0x0f
786 #define LANG_IGBO 0x70
787 #define LANG_INDONESIAN 0x21
788 #define LANG_INUKTITUT 0x5d
789 #define LANG_IRISH 0x3c
790 #define LANG_ITALIAN 0x10
791 #define LANG_JAPANESE 0x11
792 #define LANG_KANNADA 0x4b
793 #define LANG_KASHMIRI 0x60
794 #define LANG_KAZAK 0x3f
795 #define LANG_KHMER 0x53
796 #define LANG_KICHE 0x86
797 #define LANG_KINYARWANDA 0x87
798 #define LANG_KONKANI 0x57
799 #define LANG_KOREAN 0x12
800 #define LANG_KYRGYZ 0x40
801 #define LANG_LAO 0x54
802 #define LANG_LATVIAN 0x26
803 #define LANG_LITHUANIAN 0x27
804 #define LANG_LOWER_SORBIAN 0x2e
805 #define LANG_LUXEMBOURGISH 0x6e
806 #define LANG_MACEDONIAN 0x2f
807 #define LANG_MALAY 0x3e
808 #define LANG_MALAYALAM 0x4c
809 #define LANG_MALTESE 0x3a
810 #define LANG_MANIPURI 0x58
811 #define LANG_MAORI 0x81
812 #define LANG_MAPUDUNGUN 0x7a
813 #define LANG_MARATHI 0x4e
814 #define LANG_MOHAWK 0x7c
815 #define LANG_MONGOLIAN 0x50
816 #define LANG_NEPALI 0x61
817 #define LANG_NORWEGIAN 0x14
818 #define LANG_OCCITAN 0x82
819 #define LANG_ORIYA 0x48
820 #define LANG_PASHTO 0x63
821 #define LANG_FARSI 0x29
822 #define LANG_POLISH 0x15
823 #define LANG_PORTUGUESE 0x16
824 #define LANG_PUNJABI 0x46
825 #define LANG_QUECHUA 0x6b
826 #define LANG_ROMANIAN 0x18
827 #define LANG_ROMANSH 0x17
828 #define LANG_RUSSIAN 0x19
829 #define LANG_SAMI 0x3b
830 #define LANG_SANSKRIT 0x4f
831 #define LANG_SERBIAN 0x1a
832 #define LANG_SOTHO 0x6c
833 #define LANG_TSWANA 0x32
834 #define LANG_SINDHI 0x59
835 #define LANG_SINHALESE 0x5b
836 #define LANG_SLOVAK 0x1b
837 #define LANG_SLOVENIAN 0x24
838 #define LANG_SPANISH 0x0a
839 #define LANG_SWAHILI 0x41
840 #define LANG_SWEDISH 0x1d
841 #define LANG_SYRIAC 0x5a
842 #define LANG_TAJIK 0x28
843 #define LANG_TAMAZIGHT 0x5f
844 #define LANG_TAMIL 0x49
845 #define LANG_TATAR 0x44
846 #define LANG_TELUGU 0x4a
847 #define LANG_THAI 0x1e
848 #define LANG_TIBETAN 0x51
849 #define LANG_TIGRIGNA 0x73
850 #define LANG_TURKISH 0x1f
851 #define LANG_TURKMEN 0x42
852 #define LANG_UIGHUR 0x80
853 #define LANG_UKRAINIAN 0x22
854 #define LANG_UPPER_SORBIAN 0x2e
855 #define LANG_URDU 0x20
856 #define LANG_UZBEK 0x43
857 #define LANG_VIETNAMESE 0x2a
858 #define LANG_WELSH 0x52
859 #define LANG_WOLOF 0x88
860 #define LANG_XHOSA 0x34
861 #define LANG_YAKUT 0x85
862 #define LANG_YI 0x78
863 #define LANG_YORUBA 0x6a
864 #define LANG_ZULU 0x35
865
866 /* FIXME: non-standard */
867 #define LANG_ESPERANTO 0x8f
868 #define LANG_WALON 0x90
869 #define LANG_CORNISH 0x91
870
871 /* FIXME: not present in the official headers */
872 #define LANG_GAELIC 0x94
873 #define LANG_SAAMI 0x3b
874 #define LANG_SUTU 0x30
875 #define LANG_TSONGA 0x31
876 #define LANG_VENDA 0x33
877
878 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
879 #define SUBLANG_CUSTOM_DEFAULT 0x03
880 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
881 #define SUBLANG_NEUTRAL 0x00
882 #define SUBLANG_SYS_DEFAULT 0x02
883 #define SUBLANG_DEFAULT 0x01
884 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
885 #define SUBLANG_ALBANIAN_ALBANIA 0x01
886 #define SUBLANG_ALSATIAN_FRANCE 0x01
887 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
888 #define SUBLANG_ARABIC_ALGERIA 0x05
889 #define SUBLANG_ARABIC_BAHRAIN 0x0f
890 #define SUBLANG_ARABIC_EGYPT 0x03
891 #define SUBLANG_ARABIC_IRAQ 0x02
892 #define SUBLANG_ARABIC_JORDAN 0x0b
893 #define SUBLANG_ARABIC_KUWAIT 0x0d
894 #define SUBLANG_ARABIC_LEBANON 0x0c
895 #define SUBLANG_ARABIC_LIBYA 0x04
896 #define SUBLANG_ARABIC_MOROCCO 0x06
897 #define SUBLANG_ARABIC_OMAN 0x08
898 #define SUBLANG_ARABIC_QATAR 0x10
899 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
900 #define SUBLANG_ARABIC_SYRIA 0x0a
901 #define SUBLANG_ARABIC_TUNISIA 0x07
902 #define SUBLANG_ARABIC_UAE 0x0e
903 #define SUBLANG_ARABIC_YEMEN 0x09
904 #define SUBLANG_ARMENIAN_ARMENIA 0x01
905 #define SUBLANG_ASSAMESE_INDIA 0x01
906 #define SUBLANG_AZERI_CYRILLIC 0x02
907 #define SUBLANG_AZERI_LATIN 0x01
908 #define SUBLANG_BASHKIR_RUSSIA 0x01
909 #define SUBLANG_BASQUE_BASQUE 0x01
910 #define SUBLANG_BELARUSIAN_BELARUS 0x01
911 #define SUBLANG_BENGALI_BANGLADESH 0x02
912 #define SUBLANG_BENGALI_INDIA 0x01
913 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
914 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
915 #define SUBLANG_BRETON_FRANCE 0x01
916 #define SUBLANG_BULGARIAN_BULGARIA 0x01
917 #define SUBLANG_CATALAN_CATALAN 0x01
918 #define SUBLANG_CHINESE_HONGKONG 0x03
919 #define SUBLANG_CHINESE_MACAU 0x05
920 #define SUBLANG_CHINESE_SINGAPORE 0x04
921 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
922 #define SUBLANG_CHINESE_TRADITIONAL 0x01
923 #define SUBLANG_CORSICAN_FRANCE 0x01
924 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
925 #define SUBLANG_CROATIAN_CROATIA 0x01
926 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
927 #define SUBLANG_DANISH_DENMARK 0x01
928 #define SUBLANG_DARI_AFGHANISTAN 0x01
929 #define SUBLANG_DIVEHI_MALDIVES 0x01
930 #define SUBLANG_DUTCH_BELGIAN 0x02
931 #define SUBLANG_DUTCH 0x01
932 #define SUBLANG_ENGLISH_AUS 0x03
933 #define SUBLANG_ENGLISH_BELIZE 0x0a
934 #define SUBLANG_ENGLISH_CAN 0x04
935 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
936 #define SUBLANG_ENGLISH_INDIA 0x10
937 #define SUBLANG_ENGLISH_EIRE 0x06
938 #define SUBLANG_ENGLISH_IRELAND 0x06
939 #define SUBLANG_ENGLISH_JAMAICA 0x08
940 #define SUBLANG_ENGLISH_MALAYSIA 0x11
941 #define SUBLANG_ENGLISH_NZ 0x05
942 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
943 #define SUBLANG_ENGLISH_SINGAPORE 0x12
944 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
945 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
946 #define SUBLANG_ENGLISH_UK 0x02
947 #define SUBLANG_ENGLISH_US 0x01
948 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
949 #define SUBLANG_ESTONIAN_ESTONIA 0x01
950 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
951 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
952 #define SUBLANG_FINNISH_FINLAND 0x01
953 #define SUBLANG_FRENCH_BELGIAN 0x02
954 #define SUBLANG_FRENCH_CANADIAN 0x03
955 #define SUBLANG_FRENCH 0x01
956 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
957 #define SUBLANG_FRENCH_MONACO 0x06
958 #define SUBLANG_FRENCH_SWISS 0x04
959 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
960 #define SUBLANG_GALICIAN_GALICIAN 0x01
961 #define SUBLANG_GEORGIAN_GEORGIA 0x01
962 #define SUBLANG_GERMAN_AUSTRIAN 0x03
963 #define SUBLANG_GERMAN 0x01
964 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
965 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
966 #define SUBLANG_GERMAN_SWISS 0x02
967 #define SUBLANG_GREEK_GREECE 0x01
968 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
969 #define SUBLANG_GUJARATI_INDIA 0x01
970 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
971 #define SUBLANG_HEBREW_ISRAEL 0x01
972 #define SUBLANG_HINDI_INDIA 0x01
973 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
974 #define SUBLANG_ICELANDIC_ICELAND 0x01
975 #define SUBLANG_IGBO_NIGERIA 0x01
976 #define SUBLANG_INDONESIAN_INDONESIA 0x01
977 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
978 #define SUBLANG_INUKTITUT_CANADA 0x01
979 #define SUBLANG_IRISH_IRELAND 0x02
980 #define SUBLANG_ITALIAN 0x01
981 #define SUBLANG_ITALIAN_SWISS 0x02
982 #define SUBLANG_JAPANESE_JAPAN 0x01
983 #define SUBLANG_KANNADA_INDIA 0x01
984 #define SUBLANG_KASHMIRI_INDIA 0x02
985 #define SUBLANG_KASHMIRI_SASIA 0x02
986 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
987 #define SUBLANG_KHMER_CAMBODIA 0x01
988 #define SUBLANG_KICHE_GUATEMALA 0x01
989 #define SUBLANG_KINYARWANDA_RWANDA 0x01
990 #define SUBLANG_KONKANI_INDIA 0x01
991 #define SUBLANG_KOREAN 0x01
992 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
993 #define SUBLANG_LAO_LAO 0x01
994 #define SUBLANG_LATVIAN_LATVIA 0x01
995 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
996 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
997 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
998 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
999 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1000 #define SUBLANG_MALAY_MALAYSIA 0x01
1001 #define SUBLANG_MALAYALAM_INDIA 0x01
1002 #define SUBLANG_MALTESE_MALTA 0x01
1003 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1004 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1005 #define SUBLANG_MARATHI_INDIA 0x01
1006 #define SUBLANG_MOHAWK_MOHAWK 0x01
1007 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1008 #define SUBLANG_MONGOLIAN_PRC 0x02
1009 #define SUBLANG_NEPALI_NEPAL 0x01
1010 #define SUBLANG_NEPALI_INDIA 0x02
1011 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1012 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1013 #define SUBLANG_OCCITAN_FRANCE 0x01
1014 #define SUBLANG_ORIYA_INDIA 0x01
1015 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1016 #define SUBLANG_PERSIAN_IRAN 0x01
1017 #define SUBLANG_POLISH_POLAND 0x01
1018 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1019 #define SUBLANG_PORTUGUESE 0x02
1020 #define SUBLANG_PORTUGUESE_PORTUGAL 0x02
1021 #define SUBLANG_PUNJABI_INDIA 0x01
1022 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1023 #define SUBLANG_QUECHUA_ECUADOR 0x02
1024 #define SUBLANG_QUECHUA_PERU 0x03
1025 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1026 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1027 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1028 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1029 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1030 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1031 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1032 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1033 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1034 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1035 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1036 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1037 #define SUBLANG_SANSKRIT_INDIA 0x01
1038 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1039 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1040 #define SUBLANG_SERBIAN_CROATIA 0x01
1041 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1042 #define SUBLANG_SERBIAN_LATIN 0x02
1043 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1044 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1045 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1046 #define SUBLANG_SINDHI_PAKISTAN 0x01
1047 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1048 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1049 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1050 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1051 #define SUBLANG_SPANISH_BOLIVIA 0x10
1052 #define SUBLANG_SPANISH_CHILE 0x0d
1053 #define SUBLANG_SPANISH_COLOMBIA 0x09
1054 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1055 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1056 #define SUBLANG_SPANISH_ECUADOR 0x0c
1057 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1058 #define SUBLANG_SPANISH_GUATEMALA 0x04
1059 #define SUBLANG_SPANISH_HONDURAS 0x12
1060 #define SUBLANG_SPANISH_MEXICAN 0x02
1061 #define SUBLANG_SPANISH_MODERN 0x03
1062 #define SUBLANG_SPANISH_NICARAGUA 0x13
1063 #define SUBLANG_SPANISH_PANAMA 0x06
1064 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1065 #define SUBLANG_SPANISH_PERU 0x0a
1066 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1067 #define SUBLANG_SPANISH 0x01
1068 #define SUBLANG_SPANISH_US 0x15
1069 #define SUBLANG_SPANISH_URUGUAY 0x0e
1070 #define SUBLANG_SPANISH_VENEZUELA 0x08
1071 #define SUBLANG_SWAHILI 0x01
1072 #define SUBLANG_SWEDISH_FINLAND 0x02
1073 #define SUBLANG_SWEDISH 0x01
1074 #define SUBLANG_SWEDISH_SWEDEN 0x01
1075 #define SUBLANG_SYRIAC 0x01
1076 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1077 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1078 #define SUBLANG_TAMIL_INDIA 0x01
1079 #define SUBLANG_TATAR_RUSSIA 0x01
1080 #define SUBLANG_TELUGU_INDIA 0x01
1081 #define SUBLANG_THAI_THAILAND 0x01
1082 #define SUBLANG_TIBETAN_PRC 0x01
1083 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1084 #define SUBLANG_TURKISH_TURKEY 0x01
1085 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1086 #define SUBLANG_UIGHUR_PRC 0x01
1087 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1088 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1089 #define SUBLANG_URDU_INDIA 0x02
1090 #define SUBLANG_URDU_PAKISTAN 0x01
1091 #define SUBLANG_UZBEK_CYRILLIC 0x02
1092 #define SUBLANG_UZBEK_LATIN 0x01
1093 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1094 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1095 #define SUBLANG_WOLOF_SENEGAL 0x01
1096 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1097 #define SUBLANG_YAKUT_RUSSIA 0x01
1098 #define SUBLANG_YI_PRC 0x01
1099 #define SUBLANG_YORUBA_NIGERIA 0x01
1100 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1101 #define NLS_VALID_LOCALE_MASK 1048575
1102 #define SORT_DEFAULT 0
1103 #define SORT_JAPANESE_XJIS 0
1104 #define SORT_JAPANESE_UNICODE 1
1105 #define SORT_CHINESE_BIG5 0
1106 #define SORT_CHINESE_PRCP 0
1107 #define SORT_CHINESE_UNICODE 1
1108 #define SORT_CHINESE_PRC 2
1109 #define SORT_CHINESE_BOPOMOFO 3
1110 #define SORT_KOREAN_KSC 0
1111 #define SORT_KOREAN_UNICODE 1
1112 #define SORT_GERMAN_PHONE_BOOK 1
1113 #define SORT_HUNGARIAN_DEFAULT 0
1114 #define SORT_HUNGARIAN_TECHNICAL 1
1115 #define SORT_GEORGIAN_TRADITIONAL 0
1116 #define SORT_GEORGIAN_MODERN 1
1117 #define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
1118 #define MAKELCID(l,s) ((DWORD)((((DWORD)((WORD)(s)))<<16)|((DWORD)((WORD)(l)))))
1119 #define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
1120 #define SORTIDFROMLCID(l) ((WORD)((((DWORD)(l))&NLS_VALID_LOCALE_MASK)>>16))
1121 #define SORTVERSIONFROMLCID(l) ((WORD)((((DWORD)(l))>>20)&0xf))
1122 #define SUBLANGID(l) ((WORD)(l)>>10)
1123 #define LANGIDFROMLCID(l) ((WORD)(l))
1124 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)
1125 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
1126 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)
1127 #define LOCALE_INVARIANT MAKELCID(MAKELANGID(LANG_INVARIANT, SUBLANG_NEUTRAL), SORT_DEFAULT)
1128 #define ACL_REVISION 2
1129 #define ACL_REVISION_DS 4
1130 #define ACL_REVISION1 1
1131 #define ACL_REVISION2 2
1132 #define ACL_REVISION3 3
1133 #define ACL_REVISION4 4
1134 #define MIN_ACL_REVISION 2
1135 #define MAX_ACL_REVISION 4
1136 #define MINCHAR 0x80
1137 #define MAXCHAR 0x7f
1138 #define MINSHORT 0x8000
1139 #define MAXSHORT 0x7fff
1140 #define MINLONG 0x80000000
1141 #define MAXLONG 0x7fffffff
1142 #define MAXBYTE 0xff
1143 #define MAXWORD 0xffff
1144 #define MAXDWORD 0xffffffff
1145 #define PROCESSOR_INTEL_386 386
1146 #define PROCESSOR_INTEL_486 486
1147 #define PROCESSOR_INTEL_PENTIUM 586
1148 #define PROCESSOR_MIPS_R4000 4000
1149 #define PROCESSOR_ALPHA_21064 21064
1150 #define PROCESSOR_INTEL_IA64 2200
1151 #define PROCESSOR_PPC_601 601
1152 #define PROCESSOR_PPC_603 603
1153 #define PROCESSOR_PPC_604 604
1154 #define PROCESSOR_PPC_620 620
1155 #define PROCESSOR_ARCHITECTURE_INTEL 0
1156 #define PROCESSOR_ARCHITECTURE_MIPS 1
1157 #define PROCESSOR_ARCHITECTURE_ALPHA 2
1158 #define PROCESSOR_ARCHITECTURE_PPC 3
1159 #define PROCESSOR_ARCHITECTURE_SHX 4
1160 #define PROCESSOR_ARCHITECTURE_ARM 5
1161 #define PROCESSOR_ARCHITECTURE_IA64 6
1162 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
1163 #define PROCESSOR_ARCHITECTURE_MSIL 8
1164 #define PROCESSOR_ARCHITECTURE_AMD64 9
1165 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
1166 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
1167 #define PF_FLOATING_POINT_EMULATED 1
1168 #define PF_COMPARE_EXCHANGE_DOUBLE 2
1169 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
1170 #define PF_PPC_MOVEMEM_64BIT_OK 4
1171 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
1172 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
1173 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
1174 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
1175 #define PF_PAE_ENABLED 9
1176 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
1177 /* also in ddk/ntifs.h */
1178 #define FILE_ACTION_ADDED 0x00000001
1179 #define FILE_ACTION_REMOVED 0x00000002
1180 #define FILE_ACTION_MODIFIED 0x00000003
1181 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
1182 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
1183 #define FILE_ACTION_ADDED_STREAM 0x00000006
1184 #define FILE_ACTION_REMOVED_STREAM 0x00000007
1185 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
1186 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
1187 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
1188 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
1189 /* end ntifs.h */
1190 #define HEAP_NO_SERIALIZE 1
1191 #define HEAP_GROWABLE 2
1192 #define HEAP_GENERATE_EXCEPTIONS 4
1193 #define HEAP_ZERO_MEMORY 8
1194 #define HEAP_REALLOC_IN_PLACE_ONLY 16
1195 #define HEAP_TAIL_CHECKING_ENABLED 32
1196 #define HEAP_FREE_CHECKING_ENABLED 64
1197 #define HEAP_DISABLE_COALESCE_ON_FREE 128
1198 #define HEAP_CREATE_ALIGN_16 0x10000
1199 #define HEAP_CREATE_ENABLE_TRACING 0x20000
1200 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
1201 #define HEAP_MAXIMUM_TAG 0xFFF
1202 #define HEAP_PSEUDO_TAG_FLAG 0x8000
1203 #define HEAP_TAG_SHIFT 16
1204 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
1205
1206 #define KEY_QUERY_VALUE 1
1207 #define KEY_SET_VALUE 2
1208 #define KEY_CREATE_SUB_KEY 4
1209 #define KEY_ENUMERATE_SUB_KEYS 8
1210 #define KEY_NOTIFY 16
1211 #define KEY_CREATE_LINK 32
1212 #define KEY_WOW64_64KEY 0x00000100
1213 #define KEY_WOW64_32KEY 0x00000200
1214 #define KEY_WOW64_RES 0x00000300
1215
1216 #define KEY_WRITE 0x20006
1217 #define KEY_EXECUTE 0x20019
1218 #define KEY_READ 0x20019
1219 #define KEY_ALL_ACCESS 0xf003f
1220 #define REG_WHOLE_HIVE_VOLATILE 1
1221 #define REG_REFRESH_HIVE 2
1222 #define REG_NO_LAZY_FLUSH 4
1223 #define REG_OPTION_RESERVED 0
1224 #define REG_OPTION_NON_VOLATILE 0
1225 #define REG_OPTION_VOLATILE 1
1226 #define REG_OPTION_CREATE_LINK 2
1227 #define REG_OPTION_BACKUP_RESTORE 4
1228 #define REG_OPTION_OPEN_LINK 8
1229 #define REG_LEGAL_OPTION 15
1230 #define OWNER_SECURITY_INFORMATION 1
1231 #define GROUP_SECURITY_INFORMATION 2
1232 #define DACL_SECURITY_INFORMATION 4
1233 #define SACL_SECURITY_INFORMATION 8
1234 #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
1235 #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
1236 #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
1237 #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
1238 #define MAXIMUM_PROCESSORS 32
1239 #define PAGE_NOACCESS 0x0001
1240 #define PAGE_READONLY 0x0002
1241 #define PAGE_READWRITE 0x0004
1242 #define PAGE_WRITECOPY 0x0008
1243 #define PAGE_EXECUTE 0x0010
1244 #define PAGE_EXECUTE_READ 0x0020
1245 #define PAGE_EXECUTE_READWRITE 0x0040
1246 #define PAGE_EXECUTE_WRITECOPY 0x0080
1247 #define PAGE_GUARD 0x0100
1248 #define PAGE_NOCACHE 0x0200
1249 #define PAGE_WRITECOMBINE 0x0400
1250 #define MEM_COMMIT 0x1000
1251 #define MEM_RESERVE 0x2000
1252 #define MEM_DECOMMIT 0x4000
1253 #define MEM_RELEASE 0x8000
1254 #define MEM_FREE 0x10000
1255 #define MEM_PRIVATE 0x20000
1256 #define MEM_MAPPED 0x40000
1257 #define MEM_RESET 0x80000
1258 #define MEM_TOP_DOWN 0x100000
1259 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
1260 #define MEM_PHYSICAL 0x400000
1261 #define MEM_4MB_PAGES 0x80000000
1262 #define MEM_IMAGE SEC_IMAGE
1263 #define SEC_NO_CHANGE 0x00400000
1264 #define SEC_FILE 0x00800000
1265 #define SEC_IMAGE 0x01000000
1266 #define SEC_VLM 0x02000000
1267 #define SEC_RESERVE 0x04000000
1268 #define SEC_COMMIT 0x08000000
1269 #define SEC_NOCACHE 0x10000000
1270 #define SECTION_EXTEND_SIZE 16
1271 #define SECTION_MAP_READ 4
1272 #define SECTION_MAP_WRITE 2
1273 #define SECTION_QUERY 1
1274 #define SECTION_MAP_EXECUTE 8
1275 #define SECTION_ALL_ACCESS 0xf001f
1276 #define WRITE_WATCH_FLAG_RESET 0x01
1277 #define MESSAGE_RESOURCE_UNICODE 1
1278 #define RTL_CRITSECT_TYPE 0
1279 #define RTL_RESOURCE_TYPE 1
1280 /* Also in winddk.h */
1281 #if !defined(__GNUC__)
1282 #define FIELD_OFFSET(t,f) ((LONG)(LONG_PTR)&(((t*) 0)->f))
1283 #else
1284 #define FIELD_OFFSET(t,f) ((LONG)__builtin_offsetof(t,f))
1285 #endif
1286 #ifndef CONTAINING_RECORD
1287 #define CONTAINING_RECORD(address, type, field) \
1288 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
1289 #endif
1290 /* end winddk.h */
1291 #define IMAGE_SIZEOF_FILE_HEADER 20
1292 #define IMAGE_FILE_RELOCS_STRIPPED 1
1293 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
1294 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
1295 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
1296 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
1297 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
1298 #define IMAGE_FILE_BYTES_REVERSED_LO 128
1299 #define IMAGE_FILE_32BIT_MACHINE 256
1300 #define IMAGE_FILE_DEBUG_STRIPPED 512
1301 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
1302 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
1303 #define IMAGE_FILE_SYSTEM 4096
1304 #define IMAGE_FILE_DLL 8192
1305 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
1306 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
1307 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1308
1309 #define IMAGE_FILE_MACHINE_AM33 0x1d3
1310 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1311 #define IMAGE_FILE_MACHINE_ARM 0x1c0
1312 #define IMAGE_FILE_MACHINE_EBC 0xebc
1313 #define IMAGE_FILE_MACHINE_I386 0x14c
1314 #define IMAGE_FILE_MACHINE_IA64 0x200
1315 #define IMAGE_FILE_MACHINE_M32R 0x9041
1316 #define IMAGE_FILE_MACHINE_MIPS16 0x266
1317 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366
1318 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466
1319 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0
1320 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1
1321 #define IMAGE_FILE_MACHINE_R4000 0x166
1322 #define IMAGE_FILE_MACHINE_SH3 0x1a2
1323 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1324 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3
1325 #define IMAGE_FILE_MACHINE_SH4 0x1a6
1326 #define IMAGE_FILE_MACHINE_SH5 0x1a8
1327 #define IMAGE_FILE_MACHINE_THUMB 0x1c2
1328 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169
1329 #define IMAGE_FILE_MACHINE_R3000 0x162
1330 #define IMAGE_FILE_MACHINE_R10000 0x168
1331 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1332 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1333 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1334 #define IMAGE_FILE_MACHINE_CEE 0xC0EE
1335 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1336 #define IMAGE_FILE_MACHINE_CEF 0x0CEF
1337
1338 #define IMAGE_DOS_SIGNATURE 0x5A4D
1339 #define IMAGE_OS2_SIGNATURE 0x454E
1340 #define IMAGE_OS2_SIGNATURE_LE 0x454C
1341 #define IMAGE_VXD_SIGNATURE 0x454C
1342 #define IMAGE_NT_SIGNATURE 0x00004550
1343 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
1344 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
1345 #ifdef _WIN64
1346 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
1347 #else
1348 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
1349 #endif
1350 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1351 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
1352 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1353 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1354 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1355 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1356 #define IMAGE_SIZEOF_SHORT_NAME 8
1357 #define IMAGE_SIZEOF_SECTION_HEADER 40
1358 #define IMAGE_SIZEOF_SYMBOL 18
1359 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1360 #define IMAGE_SIZEOF_RELOCATION 10
1361 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1362 #define IMAGE_SIZEOF_LINENUMBER 6
1363 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1364 #define SIZEOF_RFPO_DATA 16
1365
1366 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1367 #define IMAGE_SUBSYSTEM_NATIVE 1
1368 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
1369 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
1370 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1371 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1372 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
1373 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
1374 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1375 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1376 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1377 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1378 #define IMAGE_SUBSYSTEM_XBOX 14
1379
1380 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
1381 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
1382 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
1383 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
1384 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
1385 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
1386 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1387 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1388 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1389 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1390 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1391 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1392 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1393 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1394 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
1395 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1396 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1397 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1398 #define IMAGE_DIRECTORY_ENTRY_IAT 12
1399 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1400 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1401 #define IMAGE_SCN_TYPE_REG 0
1402 #define IMAGE_SCN_TYPE_DSECT 1
1403 //#define IMAGE_SCN_TYPE_NOLOAD 2
1404 #define IMAGE_SCN_TYPE_GROUP 4
1405 #define IMAGE_SCN_TYPE_NO_PAD 8
1406 #define IMAGE_SCN_CNT_CODE 32
1407 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
1408 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
1409 #define IMAGE_SCN_LNK_OTHER 256
1410 #define IMAGE_SCN_LNK_INFO 512
1411 #define IMAGE_SCN_LNK_REMOVE 2048
1412 #define IMAGE_SCN_LNK_COMDAT 4096
1413 #define IMAGE_SCN_MEM_FARDATA 0x8000
1414 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
1415 #define IMAGE_SCN_MEM_16BIT 0x20000
1416 #define IMAGE_SCN_MEM_LOCKED 0x40000
1417 #define IMAGE_SCN_MEM_PRELOAD 0x80000
1418 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
1419 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
1420 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
1421 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
1422 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
1423 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
1424 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
1425 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
1426 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
1427 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
1428 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
1429 #define IMAGE_SCN_MEM_SHARED 0x10000000
1430 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1431 #define IMAGE_SCN_MEM_READ 0x40000000
1432 #define IMAGE_SCN_MEM_WRITE 0x80000000
1433 #define IMAGE_SYM_UNDEFINED 0
1434 #define IMAGE_SYM_ABSOLUTE (-1)
1435 #define IMAGE_SYM_DEBUG (-2)
1436 #define IMAGE_SYM_TYPE_NULL 0
1437 #define IMAGE_SYM_TYPE_VOID 1
1438 #define IMAGE_SYM_TYPE_CHAR 2
1439 #define IMAGE_SYM_TYPE_SHORT 3
1440 #define IMAGE_SYM_TYPE_INT 4
1441 #define IMAGE_SYM_TYPE_LONG 5
1442 #define IMAGE_SYM_TYPE_FLOAT 6
1443 #define IMAGE_SYM_TYPE_DOUBLE 7
1444 #define IMAGE_SYM_TYPE_STRUCT 8
1445 #define IMAGE_SYM_TYPE_UNION 9
1446 #define IMAGE_SYM_TYPE_ENUM 10
1447 #define IMAGE_SYM_TYPE_MOE 11
1448 #define IMAGE_SYM_TYPE_BYTE 12
1449 #define IMAGE_SYM_TYPE_WORD 13
1450 #define IMAGE_SYM_TYPE_UINT 14
1451 #define IMAGE_SYM_TYPE_DWORD 15
1452 #define IMAGE_SYM_TYPE_PCODE 32768
1453 #define IMAGE_SYM_DTYPE_NULL 0
1454 #define IMAGE_SYM_DTYPE_POINTER 1
1455 #define IMAGE_SYM_DTYPE_FUNCTION 2
1456 #define IMAGE_SYM_DTYPE_ARRAY 3
1457 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1458 #define IMAGE_SYM_CLASS_NULL 0
1459 #define IMAGE_SYM_CLASS_AUTOMATIC 1
1460 #define IMAGE_SYM_CLASS_EXTERNAL 2
1461 #define IMAGE_SYM_CLASS_STATIC 3
1462 #define IMAGE_SYM_CLASS_REGISTER 4
1463 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1464 #define IMAGE_SYM_CLASS_LABEL 6
1465 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1466 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1467 #define IMAGE_SYM_CLASS_ARGUMENT 9
1468 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
1469 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1470 #define IMAGE_SYM_CLASS_UNION_TAG 12
1471 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1472 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1473 #define IMAGE_SYM_CLASS_ENUM_TAG 15
1474 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1475 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1476 #define IMAGE_SYM_CLASS_BIT_FIELD 18
1477 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
1478 #define IMAGE_SYM_CLASS_BLOCK 100
1479 #define IMAGE_SYM_CLASS_FUNCTION 101
1480 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1481 #define IMAGE_SYM_CLASS_FILE 103
1482 #define IMAGE_SYM_CLASS_SECTION 104
1483 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1484 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1485 #define IMAGE_COMDAT_SELECT_ANY 2
1486 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1487 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1488 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1489 #define IMAGE_COMDAT_SELECT_LARGEST 6
1490 #define IMAGE_COMDAT_SELECT_NEWEST 7
1491 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1492 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1493 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1494 #define IMAGE_REL_I386_ABSOLUTE 0
1495 #define IMAGE_REL_I386_DIR16 1
1496 #define IMAGE_REL_I386_REL16 2
1497 #define IMAGE_REL_I386_DIR32 6
1498 #define IMAGE_REL_I386_DIR32NB 7
1499 #define IMAGE_REL_I386_SEG12 9
1500 #define IMAGE_REL_I386_SECTION 10
1501 #define IMAGE_REL_I386_SECREL 11
1502 #define IMAGE_REL_I386_REL32 20
1503 #define IMAGE_REL_MIPS_ABSOLUTE 0
1504 #define IMAGE_REL_MIPS_REFHALF 1
1505 #define IMAGE_REL_MIPS_REFWORD 2
1506 #define IMAGE_REL_MIPS_JMPADDR 3
1507 #define IMAGE_REL_MIPS_REFHI 4
1508 #define IMAGE_REL_MIPS_REFLO 5
1509 #define IMAGE_REL_MIPS_GPREL 6
1510 #define IMAGE_REL_MIPS_LITERAL 7
1511 #define IMAGE_REL_MIPS_SECTION 10
1512 #define IMAGE_REL_MIPS_SECREL 11
1513 #define IMAGE_REL_MIPS_SECRELLO 12
1514 #define IMAGE_REL_MIPS_SECRELHI 13
1515 #define IMAGE_REL_MIPS_REFWORDNB 34
1516 #define IMAGE_REL_MIPS_PAIR 35
1517 #define IMAGE_REL_ALPHA_ABSOLUTE 0
1518 #define IMAGE_REL_ALPHA_REFLONG 1
1519 #define IMAGE_REL_ALPHA_REFQUAD 2
1520 #define IMAGE_REL_ALPHA_GPREL32 3
1521 #define IMAGE_REL_ALPHA_LITERAL 4
1522 #define IMAGE_REL_ALPHA_LITUSE 5
1523 #define IMAGE_REL_ALPHA_GPDISP 6
1524 #define IMAGE_REL_ALPHA_BRADDR 7
1525 #define IMAGE_REL_ALPHA_HINT 8
1526 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1527 #define IMAGE_REL_ALPHA_REFHI 10
1528 #define IMAGE_REL_ALPHA_REFLO 11
1529 #define IMAGE_REL_ALPHA_PAIR 12
1530 #define IMAGE_REL_ALPHA_MATCH 13
1531 #define IMAGE_REL_ALPHA_SECTION 14
1532 #define IMAGE_REL_ALPHA_SECREL 15
1533 #define IMAGE_REL_ALPHA_REFLONGNB 16
1534 #define IMAGE_REL_ALPHA_SECRELLO 17
1535 #define IMAGE_REL_ALPHA_SECRELHI 18
1536 #define IMAGE_REL_PPC_ABSOLUTE 0
1537 #define IMAGE_REL_PPC_ADDR64 1
1538 #define IMAGE_REL_PPC_ADDR32 2
1539 #define IMAGE_REL_PPC_ADDR24 3
1540 #define IMAGE_REL_PPC_ADDR16 4
1541 #define IMAGE_REL_PPC_ADDR14 5
1542 #define IMAGE_REL_PPC_REL24 6
1543 #define IMAGE_REL_PPC_REL14 7
1544 #define IMAGE_REL_PPC_TOCREL16 8
1545 #define IMAGE_REL_PPC_TOCREL14 9
1546 #define IMAGE_REL_PPC_ADDR32NB 10
1547 #define IMAGE_REL_PPC_SECREL 11
1548 #define IMAGE_REL_PPC_SECTION 12
1549 #define IMAGE_REL_PPC_IFGLUE 13
1550 #define IMAGE_REL_PPC_IMGLUE 14
1551 #define IMAGE_REL_PPC_SECREL16 15
1552 #define IMAGE_REL_PPC_REFHI 16
1553 #define IMAGE_REL_PPC_REFLO 17
1554 #define IMAGE_REL_PPC_PAIR 18
1555 #define IMAGE_REL_PPC_TYPEMASK 255
1556 #define IMAGE_REL_PPC_NEG 256
1557 #define IMAGE_REL_PPC_BRTAKEN 512
1558 #define IMAGE_REL_PPC_BRNTAKEN 1024
1559 #define IMAGE_REL_PPC_TOCDEFN 2048
1560 #define IMAGE_REL_BASED_ABSOLUTE 0
1561 #define IMAGE_REL_BASED_HIGH 1
1562 #define IMAGE_REL_BASED_LOW 2
1563 #define IMAGE_REL_BASED_HIGHLOW 3
1564 #define IMAGE_REL_BASED_HIGHADJ 4
1565 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1566 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
1567 #define IMAGE_REL_BASED_IA64_IMM64 9
1568 #define IMAGE_REL_BASED_DIR64 10
1569 #define IMAGE_ARCHIVE_START_SIZE 8
1570 #define IMAGE_ARCHIVE_START "!<arch>\n"
1571 #define IMAGE_ARCHIVE_END "`\n"
1572 #define IMAGE_ARCHIVE_PAD "\n"
1573 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1574 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1575 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1576 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1577 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
1578 #define IMAGE_DEBUG_TYPE_COFF 1
1579 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
1580 #define IMAGE_DEBUG_TYPE_FPO 3
1581 #define IMAGE_DEBUG_TYPE_MISC 4
1582 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
1583 #define IMAGE_DEBUG_TYPE_FIXUP 6
1584 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
1585 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
1586 #define FRAME_FPO 0
1587 #define FRAME_TRAP 1
1588 #define FRAME_TSS 2
1589 #define FRAME_NONFPO 3
1590 #define IMAGE_DEBUG_MISC_EXENAME 1
1591 #define N_BTMASK 0x000F
1592 #define N_TMASK 0x0030
1593 #define N_TMASK1 0x00C0
1594 #define N_TMASK2 0x00F0
1595 #define N_BTSHFT 4
1596 #define N_TSHIFT 2
1597 #define IS_TEXT_UNICODE_ASCII16 1
1598 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
1599 #define IS_TEXT_UNICODE_STATISTICS 2
1600 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
1601 #define IS_TEXT_UNICODE_CONTROLS 4
1602 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
1603 #define IS_TEXT_UNICODE_SIGNATURE 8
1604 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
1605 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
1606 #define IS_TEXT_UNICODE_ODD_LENGTH 512
1607 #define IS_TEXT_UNICODE_NULL_BYTES 4096
1608 #define IS_TEXT_UNICODE_UNICODE_MASK 15
1609 #define IS_TEXT_UNICODE_REVERSE_MASK 240
1610 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
1611 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
1612 #define SERVICE_KERNEL_DRIVER 1
1613 #define SERVICE_FILE_SYSTEM_DRIVER 2
1614 #define SERVICE_ADAPTER 4
1615 #define SERVICE_RECOGNIZER_DRIVER 8
1616 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
1617 #define SERVICE_WIN32_OWN_PROCESS 16
1618 #define SERVICE_WIN32_SHARE_PROCESS 32
1619 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
1620 #define SERVICE_INTERACTIVE_PROCESS 256
1621 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
1622 #define SERVICE_BOOT_START 0
1623 #define SERVICE_SYSTEM_START 1
1624 #define SERVICE_AUTO_START 2
1625 #define SERVICE_DEMAND_START 3
1626 #define SERVICE_DISABLED 4
1627 #define SERVICE_ERROR_IGNORE 0
1628 #define SERVICE_ERROR_NORMAL 1
1629 #define SERVICE_ERROR_SEVERE 2
1630 #define SERVICE_ERROR_CRITICAL 3
1631 #define SE_OWNER_DEFAULTED 1
1632 #define SE_GROUP_DEFAULTED 2
1633 #define SE_DACL_PRESENT 4
1634 #define SE_DACL_DEFAULTED 8
1635 #define SE_SACL_PRESENT 16
1636 #define SE_SACL_DEFAULTED 32
1637 #define SE_DACL_AUTO_INHERIT_REQ 256
1638 #define SE_SACL_AUTO_INHERIT_REQ 512
1639 #define SE_DACL_AUTO_INHERITED 1024
1640 #define SE_SACL_AUTO_INHERITED 2048
1641 #define SE_DACL_PROTECTED 4096
1642 #define SE_SACL_PROTECTED 8192
1643 #define SE_RM_CONTROL_VALID 0x4000
1644 #define SE_SELF_RELATIVE 0x8000
1645 #define SECURITY_DESCRIPTOR_MIN_LENGTH 20
1646 #define SECURITY_DESCRIPTOR_REVISION 1
1647 #define SECURITY_DESCRIPTOR_REVISION1 1
1648 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
1649 #define SE_PRIVILEGE_ENABLED 2
1650 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
1651 #define PRIVILEGE_SET_ALL_NECESSARY 1
1652 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
1653 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
1654 #define SECURITY_DYNAMIC_TRACKING TRUE
1655 #define SECURITY_STATIC_TRACKING FALSE
1656 /* also in ddk/ntifs.h */
1657 #define TOKEN_ASSIGN_PRIMARY (0x0001)
1658 #define TOKEN_DUPLICATE (0x0002)
1659 #define TOKEN_IMPERSONATE (0x0004)
1660 #define TOKEN_QUERY (0x0008)
1661 #define TOKEN_QUERY_SOURCE (0x0010)
1662 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
1663 #define TOKEN_ADJUST_GROUPS (0x0040)
1664 #define TOKEN_ADJUST_DEFAULT (0x0080)
1665 #define TOKEN_ADJUST_SESSIONID (0x0100)
1666 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
1667 TOKEN_ASSIGN_PRIMARY |\
1668 TOKEN_DUPLICATE |\
1669 TOKEN_IMPERSONATE |\
1670 TOKEN_QUERY |\
1671 TOKEN_QUERY_SOURCE |\
1672 TOKEN_ADJUST_PRIVILEGES |\
1673 TOKEN_ADJUST_GROUPS |\
1674 TOKEN_ADJUST_DEFAULT |\
1675 TOKEN_ADJUST_SESSIONID)
1676 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
1677 TOKEN_QUERY)
1678 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
1679 TOKEN_ADJUST_PRIVILEGES |\
1680 TOKEN_ADJUST_GROUPS |\
1681 TOKEN_ADJUST_DEFAULT)
1682
1683 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
1684 #define TOKEN_SOURCE_LENGTH 8
1685 /* end ddk/ntifs.h */
1686 #define DLL_PROCESS_DETACH 0
1687 #define DLL_PROCESS_ATTACH 1
1688 #define DLL_THREAD_ATTACH 2
1689 #define DLL_THREAD_DETACH 3
1690 #ifdef __WINESRC__
1691 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */
1692 #endif
1693 #define TAPE_ABSOLUTE_POSITION 0
1694 #define TAPE_LOGICAL_POSITION 1
1695 #define TAPE_PSEUDO_LOGICAL_POSITION 2
1696 #define TAPE_REWIND 0
1697 #define TAPE_ABSOLUTE_BLOCK 1
1698 #define TAPE_LOGICAL_BLOCK 2
1699 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
1700 #define TAPE_SPACE_END_OF_DATA 4
1701 #define TAPE_SPACE_RELATIVE_BLOCKS 5
1702 #define TAPE_SPACE_FILEMARKS 6
1703 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
1704 #define TAPE_SPACE_SETMARKS 8
1705 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
1706 #define TAPE_DRIVE_FIXED 1
1707 #define TAPE_DRIVE_SELECT 2
1708 #define TAPE_DRIVE_INITIATOR 4
1709 #define TAPE_DRIVE_ERASE_SHORT 16
1710 #define TAPE_DRIVE_ERASE_LONG 32
1711 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
1712 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
1713 #define TAPE_DRIVE_TAPE_CAPACITY 256
1714 #define TAPE_DRIVE_TAPE_REMAINING 512
1715 #define TAPE_DRIVE_FIXED_BLOCK 1024
1716 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
1717 #define TAPE_DRIVE_WRITE_PROTECT 4096
1718 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
1719 #define TAPE_DRIVE_ECC 0x10000
1720 #define TAPE_DRIVE_COMPRESSION 0x20000
1721 #define TAPE_DRIVE_PADDING 0x40000
1722 #define TAPE_DRIVE_REPORT_SMKS 0x80000
1723 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
1724 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
1725 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
1726 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
1727 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
1728 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
1729 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
1730 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
1731 #define TAPE_DRIVE_TENSION 0x80000002
1732 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
1733 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
1734 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
1735 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
1736 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
1737 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
1738 #define TAPE_DRIVE_SET_ECC 0x80000100
1739 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
1740 #define TAPE_DRIVE_SET_PADDING 0x80000400
1741 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
1742 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
1743 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
1744 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1745 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1746 #define TAPE_DRIVE_END_OF_DATA 0x80010000
1747 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1748 #define TAPE_DRIVE_FILEMARKS 0x80040000
1749 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1750 #define TAPE_DRIVE_SETMARKS 0x80100000
1751 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1752 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1753 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1754 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1755 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1756 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1757 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1758 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1759 #define TAPE_DRIVE_FORMAT 0xA0000000
1760 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1761 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1762 #define TAPE_FIXED_PARTITIONS 0
1763 #define TAPE_INITIATOR_PARTITIONS 2
1764 #define TAPE_SELECT_PARTITIONS 1
1765 #define TAPE_FILEMARKS 1
1766 #define TAPE_LONG_FILEMARKS 3
1767 #define TAPE_SETMARKS 0
1768 #define TAPE_SHORT_FILEMARKS 2
1769 #define TAPE_ERASE_LONG 1
1770 #define TAPE_ERASE_SHORT 0
1771 #define TAPE_LOAD 0
1772 #define TAPE_UNLOAD 1
1773 #define TAPE_TENSION 2
1774 #define TAPE_LOCK 3
1775 #define TAPE_UNLOCK 4
1776 #define TAPE_FORMAT 5
1777 #if (_WIN32_WINNT >= 0x0500)
1778 #define VER_MINORVERSION 0x0000001
1779 #define VER_MAJORVERSION 0x0000002
1780 #define VER_BUILDNUMBER 0x0000004
1781 #define VER_PLATFORMID 0x0000008
1782 #define VER_SERVICEPACKMINOR 0x0000010
1783 #define VER_SERVICEPACKMAJOR 0x0000020
1784 #define VER_SUITENAME 0x0000040
1785 #define VER_PRODUCT_TYPE 0x0000080
1786 #define VER_EQUAL 1
1787 #define VER_GREATER 2
1788 #define VER_GREATER_EQUAL 3
1789 #define VER_LESS 4
1790 #define VER_LESS_EQUAL 5
1791 #define VER_AND 6
1792 #define VER_OR 7
1793 #endif
1794 #define VER_PLATFORM_WIN32s 0
1795 #define VER_PLATFORM_WIN32_WINDOWS 1
1796 #define VER_PLATFORM_WIN32_NT 2
1797 #define VER_NT_WORKSTATION 1
1798 #define VER_NT_DOMAIN_CONTROLLER 2
1799 #define VER_NT_SERVER 3
1800 #define VER_SUITE_SMALLBUSINESS 1
1801 #define VER_SUITE_ENTERPRISE 2
1802 #define VER_SUITE_BACKOFFICE 4
1803 #define VER_SUITE_TERMINAL 16
1804 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
1805 #define VER_SUITE_EMBEDDEDNT 64
1806 #define VER_SUITE_DATACENTER 128
1807 #define VER_SUITE_SINGLEUSERTS 256
1808 #define VER_SUITE_PERSONAL 512
1809 #define VER_SUITE_BLADE 1024
1810 #define WT_EXECUTEDEFAULT 0x00000000
1811 #define WT_EXECUTEINIOTHREAD 0x00000001
1812 #define WT_EXECUTEINUITHREAD 0x00000002
1813 #define WT_EXECUTEINWAITTHREAD 0x00000004
1814 #define WT_EXECUTEONLYONCE 0x00000008
1815 #define WT_EXECUTELONGFUNCTION 0x00000010
1816 #define WT_EXECUTEINTIMERTHREAD 0x00000020
1817 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
1818 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1819 #define WT_TRANSFER_IMPERSONATION 0x00000100
1820 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16)
1821 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
1822 #if (_WIN32_WINNT >= 0x0501)
1823 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1824 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1825 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1826 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1827 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1828 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1829 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1830 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1831 #endif /* (_WIN32_WINNT >= 0x0501) */
1832 #define BTYPE(x) ((x)&N_BTMASK)
1833 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1834 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1835 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1836 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1837 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1838 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1839 #define TLS_MINIMUM_AVAILABLE 64
1840 #define FLS_MAXIMUM_AVAILABLE 128
1841 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1842 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1843 #define IO_REPARSE_TAG_RESERVED_ZERO 0
1844 #define IO_REPARSE_TAG_RESERVED_ONE 1
1845 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1846 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1847 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
1848 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1849 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1850 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1851 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1852 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1853 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
1854 #ifndef RC_INVOKED
1855 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
1856
1857 #ifdef _GUID_DEFINED
1858 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1859 #endif
1860
1861 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1862 #define GUID_DEFINED
1863 typedef struct _GUID {
1864 unsigned long Data1;
1865 unsigned short Data2;
1866 unsigned short Data3;
1867 unsigned char Data4[8];
1868 } GUID, *REFGUID, *LPGUID;
1869 #endif /* GUID_DEFINED */
1870
1871 #define SYSTEM_LUID { 0x3E7, 0x0 }
1872
1873 /* ACE Access Types, also in ntifs.h */
1874 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
1875 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
1876 #define ACCESS_DENIED_ACE_TYPE (0x1)
1877 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
1878 #define SYSTEM_ALARM_ACE_TYPE (0x3)
1879 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
1880 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
1881 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
1882 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
1883 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
1884 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
1885 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
1886 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
1887 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
1888 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
1889 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
1890 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
1891 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
1892 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
1893 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
1894 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
1895 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
1896 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
1897 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
1898 #define SYSTEM_MANDATORY_LABEL_ACE_TYPE (0x11)
1899 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x11)
1900 /* end ntifs.h */
1901 typedef struct _GENERIC_MAPPING {
1902 ACCESS_MASK GenericRead;
1903 ACCESS_MASK GenericWrite;
1904 ACCESS_MASK GenericExecute;
1905 ACCESS_MASK GenericAll;
1906 } GENERIC_MAPPING, *PGENERIC_MAPPING;
1907 typedef struct _ACE_HEADER {
1908 BYTE AceType;
1909 BYTE AceFlags;
1910 WORD AceSize;
1911 } ACE_HEADER, *PACE_HEADER;
1912
1913 typedef struct _ACCESS_ALLOWED_ACE {
1914 ACE_HEADER Header;
1915 ACCESS_MASK Mask;
1916 DWORD SidStart;
1917 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
1918 typedef struct _ACCESS_DENIED_ACE {
1919 ACE_HEADER Header;
1920 ACCESS_MASK Mask;
1921 DWORD SidStart;
1922 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
1923 typedef struct _SYSTEM_AUDIT_ACE {
1924 ACE_HEADER Header;
1925 ACCESS_MASK Mask;
1926 DWORD SidStart;
1927 } SYSTEM_AUDIT_ACE;
1928 typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
1929 typedef struct _SYSTEM_ALARM_ACE {
1930 ACE_HEADER Header;
1931 ACCESS_MASK Mask;
1932 DWORD SidStart;
1933 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
1934 typedef struct _SYSTEM_MANDATORY_LABEL_ACE {
1935 ACE_HEADER Header;
1936 ACCESS_MASK Mask;
1937 DWORD SidStart;
1938 } SYSTEM_MANDATORY_LABEL_ACE, *PSYSTEM_MANDATORY_LABEL_ACE;
1939 #define SYSTEM_MANDATORY_LABEL_NO_WRITE_UP 0x1
1940 #define SYSTEM_MANDATORY_LABEL_NO_READ_UP 0x2
1941 #define SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP 0x4
1942 #define SYSTEM_MANDATORY_LABEL_VALID_MASK (SYSTEM_MANDATORY_LABEL_NO_WRITE_UP | SYSTEM_MANDATORY_LABEL_NO_READ_UP | SYSTEM_MANDATORY_LABEL_NO_EXECUTE_UP)
1943 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
1944 ACE_HEADER Header;
1945 ACCESS_MASK Mask;
1946 DWORD Flags;
1947 GUID ObjectType;
1948 GUID InheritedObjectType;
1949 DWORD SidStart;
1950 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
1951 typedef struct _ACCESS_DENIED_OBJECT_ACE {
1952 ACE_HEADER Header;
1953 ACCESS_MASK Mask;
1954 DWORD Flags;
1955 GUID ObjectType;
1956 GUID InheritedObjectType;
1957 DWORD SidStart;
1958 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
1959 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
1960 ACE_HEADER Header;
1961 ACCESS_MASK Mask;
1962 DWORD Flags;
1963 GUID ObjectType;
1964 GUID InheritedObjectType;
1965 DWORD SidStart;
1966 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
1967 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
1968 ACE_HEADER Header;
1969 ACCESS_MASK Mask;
1970 DWORD Flags;
1971 GUID ObjectType;
1972 GUID InheritedObjectType;
1973 DWORD SidStart;
1974 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
1975 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
1976 ACE_HEADER Header;
1977 ACCESS_MASK Mask;
1978 DWORD SidStart;
1979 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE;
1980 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
1981 ACE_HEADER Header;
1982 ACCESS_MASK Mask;
1983 DWORD SidStart;
1984 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE;
1985 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
1986 ACE_HEADER Header;
1987 ACCESS_MASK Mask;
1988 DWORD SidStart;
1989 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE;
1990 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
1991 ACE_HEADER Header;
1992 ACCESS_MASK Mask;
1993 DWORD SidStart;
1994 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE;
1995 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
1996 ACE_HEADER Header;
1997 ACCESS_MASK Mask;
1998 DWORD Flags;
1999 GUID ObjectType;
2000 GUID InheritedObjectType;
2001 DWORD SidStart;
2002 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2003 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2004 ACE_HEADER Header;
2005 ACCESS_MASK Mask;
2006 DWORD Flags;
2007 GUID ObjectType;
2008 GUID InheritedObjectType;
2009 DWORD SidStart;
2010 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
2011 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2012 ACE_HEADER Header;
2013 ACCESS_MASK Mask;
2014 DWORD Flags;
2015 GUID ObjectType;
2016 GUID InheritedObjectType;
2017 DWORD SidStart;
2018 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2019 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2020 ACE_HEADER Header;
2021 ACCESS_MASK Mask;
2022 DWORD Flags;
2023 GUID ObjectType;
2024 GUID InheritedObjectType;
2025 DWORD SidStart;
2026 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2027 typedef struct _ACL {
2028 BYTE AclRevision;
2029 BYTE Sbz1;
2030 WORD AclSize;
2031 WORD AceCount;
2032 WORD Sbz2;
2033 } ACL,*PACL;
2034 typedef enum _ACL_INFORMATION_CLASS
2035 {
2036 AclRevisionInformation = 1,
2037 AclSizeInformation
2038 } ACL_INFORMATION_CLASS;
2039 typedef struct _ACL_REVISION_INFORMATION {
2040 DWORD AclRevision;
2041 } ACL_REVISION_INFORMATION;
2042 typedef struct _ACL_SIZE_INFORMATION {
2043 DWORD AceCount;
2044 DWORD AclBytesInUse;
2045 DWORD AclBytesFree;
2046 } ACL_SIZE_INFORMATION;
2047
2048 #ifndef _LDT_ENTRY_DEFINED
2049 #define _LDT_ENTRY_DEFINED
2050 typedef struct _LDT_ENTRY
2051 {
2052 USHORT LimitLow;
2053 USHORT BaseLow;
2054 union
2055 {
2056 struct
2057 {
2058 UCHAR BaseMid;
2059 UCHAR Flags1;
2060 UCHAR Flags2;
2061 UCHAR BaseHi;
2062 } Bytes;
2063 struct
2064 {
2065 ULONG BaseMid:8;
2066 ULONG Type:5;
2067 ULONG Dpl:2;
2068 ULONG Pres:1;
2069 ULONG LimitHi:4;
2070 ULONG Sys:1;
2071 ULONG Reserved_0:1;
2072 ULONG Default_Big:1;
2073 ULONG Granularity:1;
2074 ULONG BaseHi:8;
2075 } Bits;
2076 } HighWord;
2077 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
2078 #endif
2079
2080 /* FIXME: add more machines */
2081 #if defined(_X86_) && !defined(__PowerPC__)
2082 #define SIZE_OF_80387_REGISTERS 80
2083 #define CONTEXT_i386 0x10000
2084 #define CONTEXT_i486 0x10000
2085 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
2086 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
2087 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
2088 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
2089 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
2090 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
2091 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
2092 #define MAXIMUM_SUPPORTED_EXTENSION 512
2093
2094 #define EXCEPTION_READ_FAULT 0
2095 #define EXCEPTION_WRITE_FAULT 1
2096 #define EXCEPTION_EXECUTE_FAULT 8
2097
2098 typedef struct _FLOATING_SAVE_AREA {
2099 DWORD ControlWord;
2100 DWORD StatusWord;
2101 DWORD TagWord;
2102 DWORD ErrorOffset;
2103 DWORD ErrorSelector;
2104 DWORD DataOffset;
2105 DWORD DataSelector;
2106 BYTE RegisterArea[80];
2107 DWORD Cr0NpxState;
2108 } FLOATING_SAVE_AREA;
2109 typedef struct _CONTEXT {
2110 DWORD ContextFlags;
2111 DWORD Dr0;
2112 DWORD Dr1;
2113 DWORD Dr2;
2114 DWORD Dr3;
2115 DWORD Dr6;
2116 DWORD Dr7;
2117 FLOATING_SAVE_AREA FloatSave;
2118 DWORD SegGs;
2119 DWORD SegFs;
2120 DWORD SegEs;
2121 DWORD SegDs;
2122 DWORD Edi;
2123 DWORD Esi;
2124 DWORD Ebx;
2125 DWORD Edx;
2126 DWORD Ecx;
2127 DWORD Eax;
2128 DWORD Ebp;
2129 DWORD Eip;
2130 DWORD SegCs;
2131 DWORD EFlags;
2132 DWORD Esp;
2133 DWORD SegSs;
2134 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
2135 } CONTEXT;
2136 #elif defined(__x86_64__)
2137
2138
2139 #define CONTEXT_AMD64 0x100000
2140
2141 #if !defined(RC_INVOKED)
2142 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
2143 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
2144 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
2145 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
2146 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
2147
2148 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
2149 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
2150
2151 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
2152 #define CONTEXT_SERVICE_ACTIVE 0x10000000
2153 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
2154 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
2155 #endif
2156
2157 #define INITIAL_MXCSR 0x1f80
2158 #define INITIAL_FPCSR 0x027f
2159 #define EXCEPTION_READ_FAULT 0
2160 #define EXCEPTION_WRITE_FAULT 1
2161 #define EXCEPTION_EXECUTE_FAULT 8
2162
2163 typedef struct DECLSPEC_ALIGN(16) _M128A {
2164 ULONGLONG Low;
2165 LONGLONG High;
2166 } M128A, *PM128A;
2167
2168 typedef struct _XMM_SAVE_AREA32 {
2169 WORD ControlWord;
2170 WORD StatusWord;
2171 BYTE TagWord;
2172 BYTE Reserved1;
2173 WORD ErrorOpcode;
2174 DWORD ErrorOffset;
2175 WORD ErrorSelector;
2176 WORD Reserved2;
2177 DWORD DataOffset;
2178 WORD DataSelector;
2179 WORD Reserved3;
2180 DWORD MxCsr;
2181 DWORD MxCsr_Mask;
2182 M128A FloatRegisters[8];
2183 M128A XmmRegisters[16];
2184 BYTE Reserved4[96];
2185 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
2186
2187 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
2188 DWORD64 P1Home;
2189 DWORD64 P2Home;
2190 DWORD64 P3Home;
2191 DWORD64 P4Home;
2192 DWORD64 P5Home;
2193 DWORD64 P6Home;
2194
2195 /* Control flags */
2196 DWORD ContextFlags;
2197 DWORD MxCsr;
2198
2199 /* Segment */
2200 WORD SegCs;
2201 WORD SegDs;
2202 WORD SegEs;
2203 WORD SegFs;
2204 WORD SegGs;
2205 WORD SegSs;
2206 DWORD EFlags;
2207
2208 /* Debug */
2209 DWORD64 Dr0;
2210 DWORD64 Dr1;
2211 DWORD64 Dr2;
2212 DWORD64 Dr3;
2213 DWORD64 Dr6;
2214 DWORD64 Dr7;
2215
2216 /* Integer */
2217 DWORD64 Rax;
2218 DWORD64 Rcx;
2219 DWORD64 Rdx;
2220 DWORD64 Rbx;
2221 DWORD64 Rsp;
2222 DWORD64 Rbp;
2223 DWORD64 Rsi;
2224 DWORD64 Rdi;
2225 DWORD64 R8;
2226 DWORD64 R9;
2227 DWORD64 R10;
2228 DWORD64 R11;
2229 DWORD64 R12;
2230 DWORD64 R13;
2231 DWORD64 R14;
2232 DWORD64 R15;
2233
2234 /* Counter */
2235 DWORD64 Rip;
2236
2237 /* Floating point */
2238 union {
2239 XMM_SAVE_AREA32 FltSave;
2240 struct {
2241 M128A Header[2];
2242 M128A Legacy[8];
2243 M128A Xmm0;
2244 M128A Xmm1;
2245 M128A Xmm2;
2246 M128A Xmm3;
2247 M128A Xmm4;
2248 M128A Xmm5;
2249 M128A Xmm6;
2250 M128A Xmm7;
2251 M128A Xmm8;
2252 M128A Xmm9;
2253 M128A Xmm10;
2254 M128A Xmm11;
2255 M128A Xmm12;
2256 M128A Xmm13;
2257 M128A Xmm14;
2258 M128A Xmm15;
2259 } DUMMYSTRUCTNAME;
2260 } DUMMYUNIONNAME;
2261
2262 /* Vector */
2263 M128A VectorRegister[26];
2264 DWORD64 VectorControl;
2265
2266 /* Debug control */
2267 DWORD64 DebugControl;
2268 DWORD64 LastBranchToRip;
2269 DWORD64 LastBranchFromRip;
2270 DWORD64 LastExceptionToRip;
2271 DWORD64 LastExceptionFromRip;
2272 } CONTEXT;
2273
2274
2275 typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
2276 union {
2277 PM128A FloatingContext[16];
2278 struct {
2279 PM128A Xmm0;
2280 PM128A Xmm1;
2281 PM128A Xmm2;
2282 PM128A Xmm3;
2283 PM128A Xmm4;
2284 PM128A Xmm5;
2285 PM128A Xmm6;
2286 PM128A Xmm7;
2287 PM128A Xmm8;
2288 PM128A Xmm9;
2289 PM128A Xmm10;
2290 PM128A Xmm11;
2291 PM128A Xmm12;
2292 PM128A Xmm13;
2293 PM128A Xmm14;
2294 PM128A Xmm15;
2295 };
2296 };
2297
2298 union {
2299 PULONG64 IntegerContext[16];
2300 struct {
2301 PULONG64 Rax;
2302 PULONG64 Rcx;
2303 PULONG64 Rdx;
2304 PULONG64 Rbx;
2305 PULONG64 Rsp;
2306 PULONG64 Rbp;
2307 PULONG64 Rsi;
2308 PULONG64 Rdi;
2309 PULONG64 R8;
2310 PULONG64 R9;
2311 PULONG64 R10;
2312 PULONG64 R11;
2313 PULONG64 R12;
2314 PULONG64 R13;
2315 PULONG64 R14;
2316 PULONG64 R15;
2317 };
2318 };
2319 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
2320
2321 #define RUNTIME_FUNCTION_INDIRECT 0x1
2322
2323 typedef struct _RUNTIME_FUNCTION {
2324 DWORD BeginAddress;
2325 DWORD EndAddress;
2326 DWORD UnwindData;
2327 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
2328
2329 #define UNWIND_HISTORY_TABLE_SIZE 12
2330
2331 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
2332 {
2333 ULONG64 ImageBase;
2334 PRUNTIME_FUNCTION FunctionEntry;
2335 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
2336
2337 typedef struct _UNWIND_HISTORY_TABLE
2338 {
2339 ULONG Count;
2340 UCHAR Search;
2341 ULONG64 LowAddress;
2342 ULONG64 HighAddress;
2343 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
2344 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
2345
2346 typedef PRUNTIME_FUNCTION (*PGET_RUNTIME_FUNCTION_CALLBACK)(DWORD64 ControlPc,PVOID Context);
2347 typedef DWORD (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(HANDLE Process,PVOID TableAddress,PDWORD Entries,PRUNTIME_FUNCTION *Functions);
2348
2349 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
2350
2351 NTSYSAPI
2352 VOID
2353 __cdecl
2354 RtlRestoreContext(struct _CONTEXT *ContextRecord,
2355 struct _EXCEPTION_RECORD *ExceptionRecord);
2356
2357 NTSYSAPI
2358 BOOLEAN
2359 __cdecl
2360 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,
2361 DWORD EntryCount,
2362 DWORD64 BaseAddress);
2363
2364 NTSYSAPI
2365 BOOLEAN
2366 __cdecl
2367 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,
2368 DWORD64 BaseAddress,
2369 DWORD Length,
2370 PGET_RUNTIME_FUNCTION_CALLBACK Callback,
2371 PVOID Context,
2372 PCWSTR OutOfProcessCallbackDll);
2373
2374 NTSYSAPI
2375 BOOLEAN
2376 __cdecl
2377 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
2378
2379 #elif defined(_PPC_)
2380 #define CONTEXT_CONTROL 1L
2381 #define CONTEXT_FLOATING_POINT 2L
2382 #define CONTEXT_INTEGER 4L
2383 #define CONTEXT_DEBUG_REGISTERS 8L
2384 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2385 typedef struct _FLOATING_SAVE_AREA
2386 {
2387 double Fpr0;
2388 double Fpr1;
2389 double Fpr2;
2390 double Fpr3;
2391 double Fpr4;
2392 double Fpr5;
2393 double Fpr6;
2394 double Fpr7;
2395 double Fpr8;
2396 double Fpr9;
2397 double Fpr10;
2398 double Fpr11;
2399 double Fpr12;
2400 double Fpr13;
2401 double Fpr14;
2402 double Fpr15;
2403 double Fpr16;
2404 double Fpr17;
2405 double Fpr18;
2406 double Fpr19;
2407 double Fpr20;
2408 double Fpr21;
2409 double Fpr22;
2410 double Fpr23;
2411 double Fpr24;
2412 double Fpr25;
2413 double Fpr26;
2414 double Fpr27;
2415 double Fpr28;
2416 double Fpr29;
2417 double Fpr30;
2418 double Fpr31;
2419 double Fpscr;
2420 } FLOATING_SAVE_AREA;
2421
2422 typedef struct _CONTEXT {
2423 FLOATING_SAVE_AREA FloatSave;
2424 DWORD Gpr0;
2425 DWORD Gpr1;
2426 DWORD Gpr2;
2427 DWORD Gpr3;
2428 DWORD Gpr4;
2429 DWORD Gpr5;
2430 DWORD Gpr6;
2431 DWORD Gpr7;
2432 DWORD Gpr8;
2433 DWORD Gpr9;
2434 DWORD Gpr10;
2435 DWORD Gpr11;
2436 DWORD Gpr12;
2437 DWORD Gpr13;
2438 DWORD Gpr14;
2439 DWORD Gpr15;
2440 DWORD Gpr16;
2441 DWORD Gpr17;
2442 DWORD Gpr18;
2443 DWORD Gpr19;
2444 DWORD Gpr20;
2445 DWORD Gpr21;
2446 DWORD Gpr22;
2447 DWORD Gpr23;
2448 DWORD Gpr24;
2449 DWORD Gpr25;
2450 DWORD Gpr26;
2451 DWORD Gpr27;
2452 DWORD Gpr28;
2453 DWORD Gpr29;
2454 DWORD Gpr30;
2455 DWORD Gpr31;
2456 DWORD Cr;
2457 DWORD Xer;
2458 DWORD Msr;
2459 DWORD Iar;
2460 DWORD Lr;
2461 DWORD Ctr;
2462 DWORD ContextFlags;
2463 DWORD Fill[3];
2464 DWORD Dr0;
2465 DWORD Dr1;
2466 DWORD Dr2;
2467 DWORD Dr3;
2468 DWORD Dr4;
2469 DWORD Dr5;
2470 DWORD Dr6;
2471 DWORD Dr7;
2472 } CONTEXT;
2473 #elif defined(_ALPHA_)
2474 #define CONTEXT_ALPHA 0x20000
2475 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
2476 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
2477 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
2478 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2479 typedef struct _CONTEXT {
2480 ULONGLONG FltF0;
2481 ULONGLONG FltF1;
2482 ULONGLONG FltF2;
2483 ULONGLONG FltF3;
2484 ULONGLONG FltF4;
2485 ULONGLONG FltF5;
2486 ULONGLONG FltF6;
2487 ULONGLONG FltF7;
2488 ULONGLONG FltF8;
2489 ULONGLONG FltF9;
2490 ULONGLONG FltF10;
2491 ULONGLONG FltF11;
2492 ULONGLONG FltF12;
2493 ULONGLONG FltF13;
2494 ULONGLONG FltF14;
2495 ULONGLONG FltF15;
2496 ULONGLONG FltF16;
2497 ULONGLONG FltF17;
2498 ULONGLONG FltF18;
2499 ULONGLONG FltF19;
2500 ULONGLONG FltF20;
2501 ULONGLONG FltF21;
2502 ULONGLONG FltF22;
2503 ULONGLONG FltF23;
2504 ULONGLONG FltF24;
2505 ULONGLONG FltF25;
2506 ULONGLONG FltF26;
2507 ULONGLONG FltF27;
2508 ULONGLONG FltF28;
2509 ULONGLONG FltF29;
2510 ULONGLONG FltF30;
2511 ULONGLONG FltF31;
2512 ULONGLONG IntV0;
2513 ULONGLONG IntT0;
2514 ULONGLONG IntT1;
2515 ULONGLONG IntT2;
2516 ULONGLONG IntT3;
2517 ULONGLONG IntT4;
2518 ULONGLONG IntT5;
2519 ULONGLONG IntT6;
2520 ULONGLONG IntT7;
2521 ULONGLONG IntS0;
2522 ULONGLONG IntS1;
2523 ULONGLONG IntS2;
2524 ULONGLONG IntS3;
2525 ULONGLONG IntS4;
2526 ULONGLONG IntS5;
2527 ULONGLONG IntFp;
2528 ULONGLONG IntA0;
2529 ULONGLONG IntA1;
2530 ULONGLONG IntA2;
2531 ULONGLONG IntA3;
2532 ULONGLONG IntA4;
2533 ULONGLONG IntA5;
2534 ULONGLONG IntT8;
2535 ULONGLONG IntT9;
2536 ULONGLONG IntT10;
2537 ULONGLONG IntT11;
2538 ULONGLONG IntRa;
2539 ULONGLONG IntT12;
2540 ULONGLONG IntAt;
2541 ULONGLONG IntGp;
2542 ULONGLONG IntSp;
2543 ULONGLONG IntZero;
2544 ULONGLONG Fpcr;
2545 ULONGLONG SoftFpcr;
2546 ULONGLONG Fir;
2547 DWORD Psr;
2548 DWORD ContextFlags;
2549 DWORD Fill[4];
2550 } CONTEXT;
2551 #elif defined(SHx)
2552
2553 /* These are the debug or break registers on the SH3 */
2554 typedef struct _DEBUG_REGISTERS {
2555 ULONG BarA;
2556 UCHAR BasrA;
2557 UCHAR BamrA;
2558 USHORT BbrA;
2559 ULONG BarB;
2560 UCHAR BasrB;
2561 UCHAR BamrB;
2562 USHORT BbrB;
2563 ULONG BdrB;
2564 ULONG BdmrB;
2565 USHORT Brcr;
2566 USHORT Align;
2567 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
2568
2569 /* The following flags control the contents of the CONTEXT structure. */
2570
2571 #define CONTEXT_SH3 0x00000040
2572 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
2573
2574 #ifdef SH3
2575 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
2576 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
2577 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
2578 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
2579 #else /* SH4 */
2580 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
2581 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
2582 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
2583 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
2584 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
2585 #endif
2586
2587 /* Context Frame */
2588
2589 /* This frame is used to store a limited processor context into the */
2590 /* Thread structure for CPUs which have no floating point support. */
2591
2592 typedef struct _CONTEXT {
2593 /* The flags values within this flag control the contents of */
2594 /* a CONTEXT record. */
2595
2596 /* If the context record is used as an input parameter, then */
2597 /* for each portion of the context record controlled by a flag */
2598 /* whose value is set, it is assumed that that portion of the */
2599 /* context record contains valid context. If the context record */
2600 /* is being used to modify a thread's context, then only that */
2601 /* portion of the threads context will be modified. */
2602
2603 /* If the context record is used as an IN OUT parameter to capture */
2604 /* the context of a thread, then only those portions of the thread's */
2605 /* context corresponding to set flags will be returned. */
2606
2607 /* The context record is never used as an OUT only parameter. */
2608
2609
2610 ULONG ContextFlags;
2611
2612 /* This section is specified/returned if the ContextFlags word contains */
2613 /* the flag CONTEXT_INTEGER. */
2614
2615 /* N.B. The registers RA and R15 are defined in this section, but are */
2616 /* considered part of the control context rather than part of the integer */
2617 /* context. */
2618
2619 ULONG PR;
2620 ULONG MACH;
2621 ULONG MACL;
2622 ULONG GBR;
2623 ULONG R0;
2624 ULONG R1;
2625 ULONG R2;
2626 ULONG R3;
2627 ULONG R4;
2628 ULONG R5;
2629 ULONG R6;
2630 ULONG R7;
2631 ULONG R8;
2632 ULONG R9;
2633 ULONG R10;
2634 ULONG R11;
2635 ULONG R12;
2636 ULONG R13;
2637 ULONG R14;
2638 ULONG R15;
2639
2640 /* This section is specified/returned if the ContextFlags word contains */
2641 /* the flag CONTEXT_CONTROL. */
2642
2643 /* N.B. The registers r15 and ra are defined in the integer section, */
2644 /* but are considered part of the control context rather than part of */
2645 /* the integer context. */
2646
2647 ULONG Fir;
2648 ULONG Psr;
2649
2650 #if !defined(SH3e) && !defined(SH4)
2651 ULONG OldStuff[2];
2652 DEBUG_REGISTERS DebugRegisters;
2653 #else
2654 ULONG Fpscr;
2655 ULONG Fpul;
2656 ULONG FRegs[16];
2657 #if defined(SH4)
2658 ULONG xFRegs[16];
2659 #endif
2660 #endif
2661 } CONTEXT;
2662
2663 #elif defined(_MIPS_)
2664
2665 /* The following flags control the contents of the CONTEXT structure. */
2666
2667 #define CONTEXT_R4000 0x00010000 /* r4000 context */
2668
2669 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
2670 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
2671 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
2672
2673 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2674
2675 /* Context Frame */
2676
2677 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
2678
2679 /* This frame has a several purposes: 1) it is used as an argument to */
2680 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
2681 /* 3) it is used to construct a call frame for exception dispatching */
2682 /* in user mode, and 4) it is used in the user level thread creation */
2683 /* routines. */
2684
2685 /* The layout of the record conforms to a standard call frame. */
2686
2687
2688 typedef struct _CONTEXT {
2689
2690 /* This section is always present and is used as an argument build */
2691 /* area. */
2692
2693 DWORD Argument[4];
2694
2695 /* This section is specified/returned if the ContextFlags word contains */
2696 /* the flag CONTEXT_FLOATING_POINT. */
2697
2698 DWORD FltF0;
2699 DWORD FltF1;
2700 DWORD FltF2;
2701 DWORD FltF3;
2702 DWORD FltF4;
2703 DWORD FltF5;
2704 DWORD FltF6;
2705 DWORD FltF7;
2706 DWORD FltF8;
2707 DWORD FltF9;
2708 DWORD FltF10;
2709 DWORD FltF11;
2710 DWORD FltF12;
2711 DWORD FltF13;
2712 DWORD FltF14;
2713 DWORD FltF15;
2714 DWORD FltF16;
2715 DWORD FltF17;
2716 DWORD FltF18;
2717 DWORD FltF19;
2718 DWORD FltF20;
2719 DWORD FltF21;
2720 DWORD FltF22;
2721 DWORD FltF23;
2722 DWORD FltF24;
2723 DWORD FltF25;
2724 DWORD FltF26;
2725 DWORD FltF27;
2726 DWORD FltF28;
2727 DWORD FltF29;
2728 DWORD FltF30;
2729 DWORD FltF31;
2730
2731 /* This section is specified/returned if the ContextFlags word contains */
2732 /* the flag CONTEXT_INTEGER. */
2733
2734 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
2735 /* considered part of the control context rather than part of the integer */
2736 /* context. */
2737
2738 /* N.B. Register zero is not stored in the frame. */
2739
2740 DWORD IntZero;
2741 DWORD IntAt;
2742 DWORD IntV0;
2743 DWORD IntV1;
2744 DWORD IntA0;
2745 DWORD IntA1;
2746 DWORD IntA2;
2747 DWORD IntA3;
2748 DWORD IntT0;
2749 DWORD IntT1;
2750 DWORD IntT2;
2751 DWORD IntT3;
2752 DWORD IntT4;
2753 DWORD IntT5;
2754 DWORD IntT6;
2755 DWORD IntT7;
2756 DWORD IntS0;
2757 DWORD IntS1;
2758 DWORD IntS2;
2759 DWORD IntS3;
2760 DWORD IntS4;
2761 DWORD IntS5;
2762 DWORD IntS6;
2763 DWORD IntS7;
2764 DWORD IntT8;
2765 DWORD IntT9;
2766 DWORD IntK0;
2767 DWORD IntK1;
2768 DWORD IntGp;
2769 DWORD IntSp;
2770 DWORD IntS8;
2771 DWORD IntRa;
2772 DWORD IntLo;
2773 DWORD IntHi;
2774
2775 /* This section is specified/returned if the ContextFlags word contains */
2776 /* the flag CONTEXT_FLOATING_POINT. */
2777
2778 DWORD Fsr;
2779
2780 /* This section is specified/returned if the ContextFlags word contains */
2781 /* the flag CONTEXT_CONTROL. */
2782
2783 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
2784 /* but are considered part of the control context rather than part of */
2785 /* the integer context. */
2786
2787 DWORD Fir;
2788 DWORD Psr;
2789
2790 /* The flags values within this flag control the contents of */
2791 /* a CONTEXT record. */
2792
2793 /* If the context record is used as an input parameter, then */
2794 /* for each portion of the context record controlled by a flag */
2795 /* whose value is set, it is assumed that that portion of the */
2796 /* context record contains valid context. If the context record */
2797 /* is being used to modify a thread's context, then only that */
2798 /* portion of the threads context will be modified. */
2799
2800 /* If the context record is used as an IN OUT parameter to capture */
2801 /* the context of a thread, then only those portions of the thread's */
2802 /* context corresponding to set flags will be returned. */
2803
2804 /* The context record is never used as an OUT only parameter. */
2805
2806 DWORD ContextFlags;
2807
2808 DWORD Fill[2];
2809
2810 } CONTEXT;
2811 #elif defined(ARM)
2812
2813 #ifndef PAGE_SIZE
2814 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
2815 #endif
2816
2817 /* The following flags control the contents of the CONTEXT structure. */
2818
2819 #define CONTEXT_ARM 0x0000040
2820 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
2821 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
2822
2823 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
2824
2825 typedef struct _CONTEXT {
2826 /* The flags values within this flag control the contents of
2827 a CONTEXT record.
2828
2829 If the context record is used as an input parameter, then
2830 for each portion of the context record controlled by a flag
2831 whose value is set, it is assumed that that portion of the
2832 context record contains valid context. If the context record
2833 is being used to modify a thread's context, then only that
2834 portion of the threads context will be modified.
2835
2836 If the context record is used as an IN OUT parameter to capture
2837 the context of a thread, then only those portions of the thread's
2838 context corresponding to set flags will be returned.
2839
2840 The context record is never used as an OUT only parameter. */
2841
2842 ULONG ContextFlags;
2843
2844 /* This section is specified/returned if the ContextFlags word contains
2845 the flag CONTEXT_INTEGER. */
2846 ULONG R0;
2847 ULONG R1;
2848 ULONG R2;
2849 ULONG R3;
2850 ULONG R4;
2851 ULONG R5;
2852 ULONG R6;
2853 ULONG R7;
2854 ULONG R8;
2855 ULONG R9;
2856 ULONG R10;
2857 ULONG R11;
2858 ULONG R12;
2859
2860 ULONG Sp;
2861 ULONG Lr;
2862 ULONG Pc;
2863 ULONG Psr;
2864 } CONTEXT;
2865
2866 #else
2867 #error "undefined processor type"
2868 #endif
2869 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
2870
2871 #define EXCEPTION_NONCONTINUABLE 1
2872 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2873
2874 typedef struct _EXCEPTION_RECORD {
2875 DWORD ExceptionCode;
2876 DWORD ExceptionFlags;
2877 struct _EXCEPTION_RECORD *ExceptionRecord;
2878 PVOID ExceptionAddress;
2879 DWORD NumberParameters;
2880 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2881 } EXCEPTION_RECORD;
2882
2883 typedef EXCEPTION_RECORD *PEXCEPTION_RECORD;
2884
2885 typedef struct _EXCEPTION_RECORD32 {
2886 DWORD ExceptionCode;
2887 DWORD ExceptionFlags;
2888 DWORD ExceptionRecord;
2889 DWORD ExceptionAddress;
2890 DWORD NumberParameters;
2891 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2892 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
2893
2894 typedef struct _EXCEPTION_RECORD64 {
2895 DWORD ExceptionCode;
2896 DWORD ExceptionFlags;
2897 DWORD64 ExceptionRecord;
2898 DWORD64 ExceptionAddress;
2899 DWORD NumberParameters;
2900 DWORD __unusedAlignment;
2901 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2902 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
2903
2904 typedef struct _EXCEPTION_POINTERS {
2905 PEXCEPTION_RECORD ExceptionRecord;
2906 PCONTEXT ContextRecord;
2907 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
2908
2909 #ifdef _M_PPC
2910 #define LARGE_INTEGER_ORDER(x) x HighPart; DWORD LowPart;
2911 #else
2912 #define LARGE_INTEGER_ORDER(x) DWORD LowPart; x HighPart;
2913 #endif
2914
2915 typedef union _LARGE_INTEGER {
2916 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2917 _ANONYMOUS_STRUCT struct {
2918 LARGE_INTEGER_ORDER(LONG)
2919 };
2920 #endif /* NONAMELESSUNION */
2921 struct {
2922 LARGE_INTEGER_ORDER(LONG)
2923 } u;
2924 LONGLONG QuadPart;
2925 } LARGE_INTEGER, *PLARGE_INTEGER;
2926 typedef union _ULARGE_INTEGER {
2927 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2928 _ANONYMOUS_STRUCT struct {
2929 LARGE_INTEGER_ORDER(DWORD)
2930 };
2931 #endif /* NONAMELESSUNION */
2932 struct {
2933 LARGE_INTEGER_ORDER(DWORD)
2934 } u;
2935 ULONGLONG QuadPart;
2936 } ULARGE_INTEGER, *PULARGE_INTEGER;
2937 typedef struct _LUID {
2938 LARGE_INTEGER_ORDER(LONG)
2939 } LUID, *PLUID;
2940
2941 #include <pshpack4.h>
2942 typedef struct _LUID_AND_ATTRIBUTES {
2943 LUID Luid;
2944 DWORD Attributes;
2945 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2946 #include <poppack.h>
2947
2948 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2949 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
2950 typedef struct _PRIVILEGE_SET {
2951 DWORD PrivilegeCount;
2952 DWORD Control;
2953 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2954 } PRIVILEGE_SET,*PPRIVILEGE_SET;
2955 typedef struct _SECURITY_ATTRIBUTES {
2956 DWORD nLength;
2957 LPVOID lpSecurityDescriptor;
2958 BOOL bInheritHandle;
2959 } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
2960 typedef enum _SECURITY_IMPERSONATION_LEVEL {
2961 SecurityAnonymous,
2962 SecurityIdentification,
2963 SecurityImpersonation,
2964 SecurityDelegation
2965 } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
2966 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
2967 typedef struct _SECURITY_QUALITY_OF_SERVICE {
2968 DWORD Length;
2969 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2970 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2971 BOOLEAN EffectiveOnly;
2972 } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
2973 typedef PVOID PACCESS_TOKEN;
2974 typedef struct _SE_IMPERSONATION_STATE {
2975 PACCESS_TOKEN Token;
2976 BOOLEAN CopyOnOpen;
2977 BOOLEAN EffectiveOnly;
2978 SECURITY_IMPERSONATION_LEVEL Level;
2979 } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
2980 typedef struct _SID_IDENTIFIER_AUTHORITY {
2981 BYTE Value[6];
2982 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
2983 typedef PVOID PSID;
2984 typedef struct _SID {
2985 BYTE Revision;
2986 BYTE SubAuthorityCount;
2987 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2988 DWORD SubAuthority[ANYSIZE_ARRAY];
2989 } SID, *PISID;
2990 #define SECURITY_MIN_SID_SIZE (sizeof(SID))
2991 #define SECURITY_MAX_SID_SIZE (FIELD_OFFSET(SID, SubAuthority) + SID_MAX_SUB_AUTHORITIES * sizeof(DWORD))
2992 typedef struct _SID_AND_ATTRIBUTES {
2993 PSID Sid;
2994 DWORD Attributes;
2995 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
2996 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2997 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
2998 typedef struct _TOKEN_SOURCE {
2999 CHAR SourceName[TOKEN_SOURCE_LENGTH];
3000 LUID SourceIdentifier;
3001 } TOKEN_SOURCE,*PTOKEN_SOURCE;
3002 typedef struct _TOKEN_CONTROL {
3003 LUID TokenId;
3004 LUID AuthenticationId;
3005 LUID ModifiedId;
3006 TOKEN_SOURCE TokenSource;
3007 } TOKEN_CONTROL,*PTOKEN_CONTROL;
3008 typedef struct _TOKEN_DEFAULT_DACL {
3009 PACL DefaultDacl;
3010 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
3011 typedef struct _TOKEN_GROUPS {
3012 DWORD GroupCount;
3013 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3014 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
3015 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
3016 ULONG SidCount;
3017 ULONG SidLength;
3018 PSID_AND_ATTRIBUTES Sids;
3019 ULONG RestrictedSidCount;
3020 ULONG RestrictedSidLength;
3021 PSID_AND_ATTRIBUTES RestrictedSids;
3022 ULONG PrivilegeCount;
3023 ULONG PrivilegeLength;
3024 PLUID_AND_ATTRIBUTES Privileges;
3025 LUID AuthenticationId;
3026 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
3027 typedef struct _TOKEN_ORIGIN {
3028 LUID OriginatingLogonSession;
3029 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
3030 typedef struct _TOKEN_OWNER {
3031 PSID Owner;
3032 } TOKEN_OWNER,*PTOKEN_OWNER;
3033 typedef struct _TOKEN_PRIMARY_GROUP {
3034 PSID PrimaryGroup;
3035 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
3036 typedef struct _TOKEN_PRIVILEGES {
3037 DWORD PrivilegeCount;
3038 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3039 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
3040 typedef enum tagTOKEN_TYPE {
3041 TokenPrimary = 1,
3042 TokenImpersonation
3043 } TOKEN_TYPE,*PTOKEN_TYPE;
3044
3045 #include <pshpack4.h>
3046 typedef struct _TOKEN_STATISTICS {
3047 LUID TokenId;
3048 LUID AuthenticationId;
3049 LARGE_INTEGER ExpirationTime;
3050 TOKEN_TYPE TokenType;
3051 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3052 DWORD DynamicCharged;
3053 DWORD DynamicAvailable;
3054 DWORD GroupCount;
3055 DWORD PrivilegeCount;
3056 LUID ModifiedId;
3057 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
3058 #include <poppack.h>
3059
3060 typedef struct _TOKEN_USER {
3061 SID_AND_ATTRIBUTES User;
3062 } TOKEN_USER, *PTOKEN_USER;
3063 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
3064 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
3065
3066 #ifndef _SECURITY_ATTRIBUTES_
3067 #define _SECURITY_ATTRIBUTES_
3068 typedef struct _SECURITY_DESCRIPTOR {
3069 BYTE Revision;
3070 BYTE Sbz1;
3071 SECURITY_DESCRIPTOR_CONTROL Control;
3072 PSID Owner;
3073 PSID Group;
3074 PACL Sacl;
3075 PACL Dacl;
3076 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3077 typedef PVOID PSECURITY_DESCRIPTOR;
3078 #endif
3079 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
3080 BYTE Revision;
3081 BYTE Sbz1;
3082 SECURITY_DESCRIPTOR_CONTROL Control;
3083 DWORD Owner;
3084 DWORD Group;
3085 DWORD Sacl;
3086 DWORD Dacl;
3087 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3088
3089 typedef enum _TOKEN_INFORMATION_CLASS {
3090 TokenUser = 1,
3091 TokenGroups,
3092 TokenPrivileges,
3093 TokenOwner,
3094 TokenPrimaryGroup,
3095 TokenDefaultDacl,
3096 TokenSource,
3097 TokenType,
3098 TokenImpersonationLevel,
3099 TokenStatistics,
3100 TokenRestrictedSids,
3101 TokenSessionId,
3102 TokenGroupsAndPrivileges,
3103 TokenSessionReference,
3104 TokenSandBoxInert,
3105 TokenAuditPolicy,
3106 TokenOrigin,
3107 TokenElevationType,
3108 TokenLinkedToken,
3109 TokenElevation,
3110 TokenHasRestrictions,
3111 TokenAccessInformation,
3112 TokenVirtualizationAllowed,
3113 TokenVirtualizationEnabled,
3114 TokenIntegrityLevel,
3115 TokenUIAccess,
3116 TokenMandatoryPolicy,
3117 TokenLogonSid,
3118 MaxTokenInfoClass
3119 } TOKEN_INFORMATION_CLASS;
3120
3121 typedef enum _SID_NAME_USE {
3122 SidTypeUser=1,SidTypeGroup,SidTypeDomain,SidTypeAlias,
3123 SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,
3124 SidTypeUnknown
3125 } SID_NAME_USE,*PSID_NAME_USE;
3126 typedef struct _QUOTA_LIMITS {
3127 SIZE_T PagedPoolLimit;
3128 SIZE_T NonPagedPoolLimit;
3129 SIZE_T MinimumWorkingSetSize;
3130 SIZE_T MaximumWorkingSetSize;
3131 SIZE_T PagefileLimit;
3132 LARGE_INTEGER TimeLimit;
3133 } QUOTA_LIMITS,*PQUOTA_LIMITS;
3134 typedef struct _IO_COUNTERS {
3135 ULONGLONG ReadOperationCount;
3136 ULONGLONG WriteOperationCount;
3137 ULONGLONG OtherOperationCount;
3138 ULONGLONG ReadTransferCount;
3139 ULONGLONG WriteTransferCount;
3140 ULONGLONG OtherTransferCount;
3141 } IO_COUNTERS, *PIO_COUNTERS;
3142 typedef struct _FILE_NOTIFY_INFORMATION {
3143 DWORD NextEntryOffset;
3144 DWORD Action;
3145 DWORD FileNameLength;
3146 WCHAR FileName[1];
3147 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
3148 typedef struct _TAPE_ERASE {
3149 DWORD Type;
3150 BOOLEAN Immediate;
3151 } TAPE_ERASE,*PTAPE_ERASE;
3152 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
3153 BOOLEAN ECC;
3154 BOOLEAN Compression;
3155 BOOLEAN DataPadding;
3156 BOOLEAN ReportSetmarks;
3157 DWORD DefaultBlockSize;
3158 DWORD MaximumBlockSize;
3159 DWORD MinimumBlockSize;
3160 DWORD MaximumPartitionCount;
3161 DWORD FeaturesLow;
3162 DWORD FeaturesHigh;
3163 DWORD EOTWarningZoneSize;
3164 } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS;
3165 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
3166 LARGE_INTEGER Capacity;
3167 LARGE_INTEGER Remaining;
3168 DWORD BlockSize;
3169 DWORD PartitionCount;
3170 BOOLEAN WriteProtected;
3171 } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS;
3172 typedef struct _TAPE_GET_POSITION {
3173 ULONG Type;
3174 ULONG Partition;
3175 LARGE_INTEGER Offset;
3176 } TAPE_GET_POSITION,*PTAPE_GET_POSITION;
3177 typedef struct _TAPE_PREPARE {
3178 DWORD Operation;
3179 BOOLEAN Immediate;
3180 } TAPE_PREPARE,*PTAPE_PREPARE;
3181 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
3182 BOOLEAN ECC;
3183 BOOLEAN Compression;
3184 BOOLEAN DataPadding;
3185 BOOLEAN ReportSetmarks;
3186 ULONG EOTWarningZoneSize;
3187 } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS;
3188 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
3189 ULONG BlockSize;
3190 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
3191 typedef struct _TAPE_SET_POSITION {
3192 DWORD Method;
3193 DWORD Partition;
3194 LARGE_INTEGER Offset;
3195 BOOLEAN Immediate;
3196 } TAPE_SET_POSITION,*PTAPE_SET_POSITION;
3197 typedef struct _TAPE_WRITE_MARKS {
3198 DWORD Type;
3199 DWORD Count;
3200 BOOLEAN Immediate;
3201 } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS;
3202 typedef struct _TAPE_CREATE_PARTITION {
3203 DWORD Method;
3204 DWORD Count;
3205 DWORD Size;
3206 } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION;
3207 typedef struct _MEMORY_BASIC_INFORMATION {
3208 PVOID BaseAddress;
3209 PVOID AllocationBase;
3210 DWORD AllocationProtect;
3211 SIZE_T RegionSize;
3212 DWORD State;
3213 DWORD Protect;
3214 DWORD Type;
3215 } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
3216 typedef struct _MESSAGE_RESOURCE_ENTRY {
3217 WORD Length;
3218 WORD Flags;
3219 BYTE Text[1];
3220 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3221 typedef struct _MESSAGE_RESOURCE_BLOCK {
3222 DWORD LowId;
3223 DWORD HighId;
3224 DWORD OffsetToEntries;
3225 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3226 typedef struct _MESSAGE_RESOURCE_DATA {
3227 DWORD NumberOfBlocks;
3228 MESSAGE_RESOURCE_BLOCK Blocks[1];
3229 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3230 typedef struct _LIST_ENTRY {
3231 struct _LIST_ENTRY *Flink;
3232 struct _LIST_ENTRY *Blink;
3233 } LIST_ENTRY,*PLIST_ENTRY;
3234 typedef struct _LIST_ENTRY32 {
3235 DWORD Flink;
3236 DWORD Blink;
3237 } LIST_ENTRY32,*PLIST_ENTRY32;
3238 typedef struct _LIST_ENTRY64 {
3239 ULONGLONG Flink;
3240 ULONGLONG Blink;
3241 } LIST_ENTRY64,*PLIST_ENTRY64;
3242
3243 typedef struct _SINGLE_LIST_ENTRY {
3244 struct _SINGLE_LIST_ENTRY *Next;
3245 } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY;
3246
3247 //
3248 // Slist Header
3249 //
3250 #ifndef _SLIST_HEADER_
3251 #define _SLIST_HEADER_
3252
3253 #if defined(_WIN64)
3254 typedef struct _SLIST_ENTRY *PSLIST_ENTRY;
3255 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
3256 PSLIST_ENTRY Next;
3257 } SLIST_ENTRY;
3258 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
3259 struct {
3260 ULONGLONG Alignment;
3261 ULONGLONG Region;
3262 } DUMMYSTRUCTNAME;
3263 struct {
3264 ULONGLONG Depth:16;
3265 ULONGLONG Sequence:9;
3266 ULONGLONG NextEntry:39;
3267 ULONGLONG HeaderType:1;
3268 ULONGLONG Init:1;
3269 ULONGLONG Reserved:59;
3270 ULONGLONG Region:3;
3271 } Header8;
3272 struct {
3273 ULONGLONG Depth:16;
3274 ULONGLONG Sequence:48;
3275 ULONGLONG HeaderType:1;
3276 ULONGLONG Init:1;
3277 ULONGLONG Reserved:2;
3278 ULONGLONG NextEntry:60;
3279 } Header16;
3280 } SLIST_HEADER, *PSLIST_HEADER;
3281 #else
3282 #define SLIST_ENTRY SINGLE_LIST_ENTRY
3283 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
3284 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
3285 typedef union _SLIST_HEADER {
3286 ULONGLONG Alignment;
3287 struct {
3288 SLIST_ENTRY Next;
3289 USHORT Depth;
3290 USHORT Sequence;
3291 } DUMMYSTRUCTNAME;
3292 } SLIST_HEADER, *PSLIST_HEADER;
3293 #endif
3294
3295 #endif /* _SLIST_HEADER_ */
3296
3297
3298 NTSYSAPI
3299 VOID
3300 NTAPI
3301 RtlInitializeSListHead (
3302 IN PSLIST_HEADER ListHead
3303 );
3304
3305 NTSYSAPI
3306 PSLIST_ENTRY
3307 NTAPI
3308 RtlFirstEntrySList (
3309 IN const SLIST_HEADER *ListHead
3310 );
3311
3312 NTSYSAPI
3313 PSLIST_ENTRY
3314 NTAPI
3315 RtlInterlockedPopEntrySList (
3316 IN PSLIST_HEADER ListHead
3317 );
3318
3319 NTSYSAPI
3320 PSLIST_ENTRY
3321 NTAPI
3322 RtlInterlockedPushEntrySList (
3323 IN PSLIST_HEADER ListHead,
3324 IN PSLIST_ENTRY ListEntry
3325 );
3326
3327 NTSYSAPI
3328 PSLIST_ENTRY
3329 NTAPI
3330 RtlInterlockedFlushSList (
3331 IN PSLIST_HEADER ListHead
3332 );
3333
3334 NTSYSAPI
3335 WORD
3336 NTAPI
3337 RtlQueryDepthSList (
3338 IN PSLIST_HEADER ListHead
3339 );
3340
3341 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
3342 WORD Type;
3343 WORD CreatorBackTraceIndex;
3344 struct _RTL_CRITICAL_SECTION *CriticalSection;
3345 LIST_ENTRY ProcessLocksList;
3346 DWORD EntryCount;
3347 DWORD ContentionCount;
3348 DWORD Flags;
3349 WORD CreatorBackTraceIndexHigh;
3350 WORD SpareWORD;
3351 } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG;
3352 typedef struct _RTL_CRITICAL_SECTION {
3353 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3354 LONG LockCount;
3355 LONG RecursionCount;
3356 HANDLE OwningThread;
3357 HANDLE LockSemaphore;
3358 ULONG_PTR SpinCount;
3359 } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
3360
3361 NTSYSAPI
3362 WORD
3363 NTAPI
3364 RtlCaptureStackBackTrace(
3365 IN DWORD FramesToSkip,
3366 IN DWORD FramesToCapture,
3367 OUT PVOID *BackTrace,
3368 OUT PDWORD BackTraceHash OPTIONAL
3369 );
3370
3371 NTSYSAPI
3372 VOID
3373 NTAPI
3374 RtlCaptureContext(
3375 PCONTEXT ContextRecord
3376 );
3377
3378 NTSYSAPI
3379 PVOID
3380 NTAPI
3381 RtlPcToFileHeader(
3382 IN PVOID PcValue,
3383 PVOID* BaseOfImage
3384 );
3385
3386 NTSYSAPI
3387 VOID
3388 NTAPI
3389 RtlUnwind (
3390 IN PVOID TargetFrame OPTIONAL,
3391 IN PVOID TargetIp OPTIONAL,
3392 IN PEXCEPTION_RECORD ExceptionRecord OPTIONAL,
3393 IN PVOID ReturnValue
3394 );
3395
3396 #define RTL_SRWLOCK_INIT {0}
3397 typedef struct _RTL_SRWLOCK
3398 {
3399 PVOID Ptr;
3400 } RTL_SRWLOCK, *PRTL_SRWLOCK;
3401
3402 #define RTL_CONDITION_VARIABLE_INIT {0}
3403 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
3404 typedef struct _RTL_CONDITION_VARIABLE
3405 {
3406 PVOID Ptr;
3407 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
3408
3409 typedef LONG
3410 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
3411 struct _EXCEPTION_POINTERS *ExceptionInfo
3412 );
3413
3414 typedef struct _GROUP_AFFINITY {
3415 KAFFINITY Mask;
3416 WORD Group;
3417 WORD Reserved[3];
3418 } GROUP_AFFINITY, *PGROUP_AFFINITY;
3419
3420 typedef struct _EVENTLOGRECORD {
3421 DWORD Length;
3422 DWORD Reserved;
3423 DWORD RecordNumber;
3424 DWORD TimeGenerated;
3425 DWORD TimeWritten;
3426 DWORD EventID;
3427 WORD EventType;
3428 WORD NumStrings;
3429 WORD EventCategory;
3430 WORD ReservedFlags;
3431 DWORD ClosingRecordNumber;
3432 DWORD StringOffset;
3433 DWORD UserSidLength;
3434 DWORD UserSidOffset;
3435 DWORD DataLength;
3436 DWORD DataOffset;
3437 } EVENTLOGRECORD,*PEVENTLOGRECORD;
3438
3439 typedef struct _OSVERSIONINFOA {
3440 DWORD dwOSVersionInfoSize;
3441 DWORD dwMajorVersion;
3442 DWORD dwMinorVersion;
3443 DWORD dwBuildNumber;
3444 DWORD dwPlatformId;
3445 CHAR szCSDVersion[128];
3446 } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA;
3447
3448 typedef struct _OSVERSIONINFOW {
3449 DWORD dwOSVersionInfoSize;
3450 DWORD dwMajorVersion;
3451 DWORD dwMinorVersion;
3452 DWORD dwBuildNumber;
3453 DWORD dwPlatformId;
3454 WCHAR szCSDVersion[128];
3455 } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW;
3456
3457 typedef struct _OSVERSIONINFOEXA {
3458 DWORD dwOSVersionInfoSize;
3459 DWORD dwMajorVersion;
3460 DWORD dwMinorVersion;
3461 DWORD dwBuildNumber;
3462 DWORD dwPlatformId;
3463 CHAR szCSDVersion[128];
3464 WORD wServicePackMajor;
3465 WORD wServicePackMinor;
3466 WORD wSuiteMask;
3467 BYTE wProductType;
3468 BYTE wReserved;
3469 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
3470
3471 typedef struct _OSVERSIONINFOEXW {
3472 DWORD dwOSVersionInfoSize;
3473 DWORD dwMajorVersion;
3474 DWORD dwMinorVersion;
3475 DWORD dwBuildNumber;
3476 DWORD dwPlatformId;
3477 WCHAR szCSDVersion[128];
3478 WORD wServicePackMajor;
3479 WORD wServicePackMinor;
3480 WORD wSuiteMask;
3481 BYTE wProductType;
3482 BYTE wReserved;
3483 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
3484
3485 #include <pshpack2.h>
3486 typedef struct _IMAGE_VXD_HEADER {
3487 WORD e32_magic;
3488 BYTE e32_border;
3489 BYTE e32_worder;
3490 DWORD e32_level;
3491 WORD e32_cpu;
3492 WORD e32_os;
3493 DWORD e32_ver;
3494 DWORD e32_mflags;
3495 DWORD e32_mpages;
3496 DWORD e32_startobj;
3497 DWORD e32_eip;
3498 DWORD e32_stackobj;
3499 DWORD e32_esp;
3500 DWORD e32_pagesize;
3501 DWORD e32_lastpagesize;
3502 DWORD e32_fixupsize;
3503 DWORD e32_fixupsum;
3504 DWORD e32_ldrsize;
3505 DWORD e32_ldrsum;
3506 DWORD e32_objtab;
3507 DWORD e32_objcnt;
3508 DWORD e32_objmap;
3509 DWORD e32_itermap;
3510 DWORD e32_rsrctab;
3511 DWORD e32_rsrccnt;
3512 DWORD e32_restab;
3513 DWORD e32_enttab;
3514 DWORD e32_dirtab;
3515 DWORD e32_dircnt;
3516 DWORD e32_fpagetab;
3517 DWORD e32_frectab;
3518 DWORD e32_impmod;
3519 DWORD e32_impmodcnt;
3520 DWORD e32_impproc;
3521 DWORD e32_pagesum;
3522 DWORD e32_datapage;
3523 DWORD e32_preload;
3524 DWORD e32_nrestab;
3525 DWORD e32_cbnrestab;
3526 DWORD e32_nressum;
3527 DWORD e32_autodata;
3528 DWORD e32_debuginfo;
3529 DWORD e32_debuglen;
3530 DWORD e32_instpreload;
3531 DWORD e32_instdemand;
3532 DWORD e32_heapsize;
3533 BYTE e32_res3[12];
3534 DWORD e32_winresoff;
3535 DWORD e32_winreslen;
3536 WORD e32_devid;
3537 WORD e32_ddkver;
3538 } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER;
3539 #include <poppack.h>
3540
3541 typedef struct _IMAGE_FILE_HEADER {
3542 WORD Machine;
3543 WORD NumberOfSections;
3544 DWORD TimeDateStamp;
3545 DWORD PointerToSymbolTable;
3546 DWORD NumberOfSymbols;
3547 WORD SizeOfOptionalHeader;
3548 WORD Characteristics;
3549 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
3550
3551 typedef struct _IMAGE_DATA_DIRECTORY {
3552 DWORD VirtualAddress;
3553 DWORD Size;
3554 } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
3555
3556 typedef struct _IMAGE_OPTIONAL_HEADER32 {
3557 WORD Magic;
3558 BYTE MajorLinkerVersion;
3559 BYTE MinorLinkerVersion;
3560 DWORD SizeOfCode;
3561 DWORD SizeOfInitializedData;
3562 DWORD SizeOfUninitializedData;
3563 DWORD AddressOfEntryPoint;
3564 DWORD BaseOfCode;
3565 DWORD BaseOfData;
3566 DWORD ImageBase;
3567 DWORD SectionAlignment;
3568 DWORD FileAlignment;
3569 WORD MajorOperatingSystemVersion;
3570 WORD MinorOperatingSystemVersion;
3571 WORD MajorImageVersion;
3572 WORD MinorImageVersion;
3573 WORD MajorSubsystemVersion;
3574 WORD MinorSubsystemVersion;
3575 DWORD Win32VersionValue;
3576 DWORD SizeOfImage;
3577 DWORD SizeOfHeaders;
3578 DWORD CheckSum;
3579 WORD Subsystem;
3580 WORD DllCharacteristics;
3581 DWORD SizeOfStackReserve;
3582 DWORD SizeOfStackCommit;
3583 DWORD SizeOfHeapReserve;
3584 DWORD SizeOfHeapCommit;
3585 DWORD LoaderFlags;
3586 DWORD NumberOfRvaAndSizes;
3587 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
3588 } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
3589
3590 typedef struct _IMAGE_OPTIONAL_HEADER64 {
3591 WORD Magic;
3592 BYTE MajorLinkerVersion;
3593 BYTE MinorLinkerVersion;
3594 DWORD SizeOfCode;
3595 DWORD SizeOfInitializedData;
3596 DWORD SizeOfUninitializedData;
3597 DWORD AddressOfEntryPoint;
3598 DWORD BaseOfCode;
3599 ULONGLONG ImageBase;
3600 DWORD SectionAlignment;
3601 DWORD FileAlignment;
3602 WORD MajorOperatingSystemVersion;
3603 WORD MinorOperatingSystemVersion;
3604 WORD MajorImageVersion;
3605 WORD MinorImageVersion;
3606 WORD MajorSubsystemVersion;
3607 WORD MinorSubsystemVersion;
3608 DWORD Win32VersionValue;
3609 DWORD SizeOfImage;
3610 DWORD SizeOfHeaders;
3611 DWORD CheckSum;
3612 WORD Subsystem;
3613 WORD DllCharacteristics;
3614 ULONGLONG SizeOfStackReserve;
3615 ULONGLONG SizeOfStackCommit;
3616 ULONGLONG SizeOfHeapReserve;
3617 ULONGLONG SizeOfHeapCommit;
3618 DWORD LoaderFlags;
3619 DWORD NumberOfRvaAndSizes;
3620 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
3621 } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
3622
3623 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
3624 WORD Magic;
3625 BYTE MajorLinkerVersion;
3626 BYTE MinorLinkerVersion;
3627 DWORD SizeOfCode;
3628 DWORD SizeOfInitializedData;
3629 DWORD SizeOfUninitializedData;
3630 DWORD AddressOfEntryPoint;
3631 DWORD BaseOfCode;
3632 DWORD BaseOfData;
3633 DWORD BaseOfBss;
3634 DWORD GprMask;
3635 DWORD CprMask[4];
3636 DWORD GpValue;
3637 } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER;
3638
3639 #include <pshpack2.h>
3640 typedef struct _IMAGE_DOS_HEADER {
3641 WORD e_magic;
3642 WORD e_cblp;
3643 WORD e_cp;
3644 WORD e_crlc;
3645 WORD e_cparhdr;
3646 WORD e_minalloc;
3647 WORD e_maxalloc;
3648 WORD e_ss;
3649 WORD e_sp;
3650 WORD e_csum;
3651 WORD e_ip;
3652 WORD e_cs;
3653 WORD e_lfarlc;
3654 WORD e_ovno;
3655 WORD e_res[4];
3656 WORD e_oemid;
3657 WORD e_oeminfo;
3658 WORD e_res2[10];
3659 LONG e_lfanew;
3660 } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
3661
3662 typedef struct _IMAGE_OS2_HEADER {
3663 WORD ne_magic;
3664 CHAR ne_ver;
3665 CHAR ne_rev;
3666 WORD ne_enttab;
3667 WORD ne_cbenttab;
3668 LONG ne_crc;
3669 WORD ne_flags;
3670 WORD ne_autodata;
3671 WORD ne_heap;
3672 WORD ne_stack;
3673 LONG ne_csip;
3674 LONG ne_sssp;
3675 WORD ne_cseg;
3676 WORD ne_cmod;
3677 WORD ne_cbnrestab;
3678 WORD ne_segtab;
3679 WORD ne_rsrctab;
3680 WORD ne_restab;
3681 WORD ne_modtab;
3682 WORD ne_imptab;
3683 LONG ne_nrestab;
3684 WORD ne_cmovent;
3685 WORD ne_align;
3686 WORD ne_cres;
3687 BYTE ne_exetyp;
3688 BYTE ne_flagsothers;
3689 WORD ne_pretthunks;
3690 WORD ne_psegrefbytes;
3691 WORD ne_swaparea;
3692 WORD ne_expver;
3693 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
3694 #include <poppack.h>
3695
3696 typedef struct _IMAGE_NT_HEADERS32 {
3697 DWORD Signature;