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