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