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