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