source: Daodan/MinGW/include/winnt.h@ 1051

Last change on this file since 1051 was 1046, checked in by alloc, 8 years ago

Daodan: Added Windows MinGW and build batch file

File size: 138.7 KB
Line 
1/*
2 * winnt.h
3 *
4 * Win32-API macros and definitions originating from the WinNT product line.
5 *
6 * $Id: winnt.h,v 9bdd9bcd51f9 2016/06/04 13:44:52 keithmarshall $
7 *
8 * Written by Anders Norlander <anorland@hem2.passagen.se>
9 * Copyright (C) 1998-2011, 2016, MinGW.org Project
10 *
11 *
12 * Permission is hereby granted, free of charge, to any person obtaining a
13 * copy of this software and associated documentation files (the "Software"),
14 * to deal in the Software without restriction, including without limitation
15 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
16 * and/or sell copies of the Software, and to permit persons to whom the
17 * Software is furnished to do so, subject to the following conditions:
18 *
19 * The above copyright notice and this permission notice (including the next
20 * paragraph) shall be included in all copies or substantial portions of the
21 * Software.
22 *
23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
28 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
29 * DEALINGS IN THE SOFTWARE.
30 *
31 */
32#ifndef _WINNT_H
33#pragma GCC system_header
34#define _WINNT_H
35
36#include <winerror.h>
37
38#ifndef RC_INVOKED
39#include <string.h>
40
41_BEGIN_C_DECLS
42
43/* FIXME: add more architectures. Is there a way to specify this in GCC? */
44#ifdef _X86_
45#define UNALIGNED
46#else
47#define UNALIGNED
48#endif
49
50#ifndef DECLSPEC_ALIGN
51#ifdef __GNUC__
52#define DECLSPEC_ALIGN(x) __attribute__((__aligned__(x)))
53#else
54#define DECLSPEC_ALIGN(x)
55#endif
56#endif
57
58#ifndef DECLSPEC_SELECTANY
59#if (__GNUC__ >= 4)
60#define DECLSPEC_SELECTANY __attribute__((__selectany__))
61#else
62#define DECLSPEC_SELECTANY
63#endif
64#endif
65
66#ifndef FORCEINLINE
67#if (__GNUC__ >= 3)
68#define FORCEINLINE __inline__ __attribute__((__always_inline__))
69#else
70#define FORCEINLINE __inline__
71#endif
72#endif
73
74#ifndef C_ASSERT
75#define C_ASSERT(expr) typedef char __C_ASSERT__[(expr)?1:-1]
76#endif
77
78#ifndef VOID
79#define VOID void
80#endif
81typedef char CHAR;
82typedef short SHORT;
83typedef long LONG;
84typedef char CCHAR, *PCCHAR;
85typedef unsigned char UCHAR, *PUCHAR;
86typedef unsigned short USHORT, *PUSHORT;
87typedef unsigned long ULONG, *PULONG;
88typedef char *PSZ;
89
90typedef void *PVOID, *LPVOID;
91
92/* FIXME for __WIN64 */
93#ifndef __ptr64
94#define __ptr64
95#endif
96typedef void *__ptr64 PVOID64;
97
98#ifndef _WCHAR_T_DEFINED
99#define _WCHAR_T_DEFINED
100#ifndef _WCHAR_T_
101#define _WCHAR_T_
102#undef __need_wchar_t
103#ifndef __cplusplus
104typedef unsigned short wchar_t;
105#endif
106#endif
107#endif
108
109typedef wchar_t WCHAR;
110typedef WCHAR *PWCHAR, *LPWCH, *PWCH, *NWPSTR, *LPWSTR, *PWSTR;
111typedef CONST WCHAR *LPCWCH, *PCWCH, *LPCWSTR, *PCWSTR;
112typedef CHAR *PCHAR, *LPCH, *PCH, *NPSTR, *LPSTR, *PSTR;
113typedef CONST CHAR *LPCCH, *PCSTR, *LPCSTR;
114#ifndef _TCHAR_DEFINED
115#define _TCHAR_DEFINED
116#ifdef UNICODE
117/*
118 * NOTE: This tests UNICODE, which is different from the _UNICODE define
119 * used to differentiate standard C runtime calls.
120 */
121typedef WCHAR TCHAR;
122typedef WCHAR _TCHAR;
123#else
124typedef CHAR TCHAR;
125typedef CHAR _TCHAR;
126#endif
127#endif
128typedef TCHAR TBYTE, *PTCH, *PTBYTE;
129typedef TCHAR *LPTCH, *PTSTR, *LPTSTR, *LP, *PTCHAR;
130typedef const TCHAR *LPCTSTR;
131#ifdef UNICODE
132/*
133 * __TEXT is a private macro whose specific use is to force the expansion of a
134 * macro passed as an argument to the macro TEXT. DO NOT use this
135 * macro within your programs. It's name and function could change without
136 * notice.
137 */
138#define __TEXT(q) L##q
139#else
140#define __TEXT(q) q
141#endif
142/*
143 * UNICODE a constant string when UNICODE is defined, else returns the string
144 * unmodified.
145 * The corresponding macros _TEXT() and _T() for mapping _UNICODE strings
146 * passed to C runtime functions are defined in mingw/tchar.h
147 */
148#define TEXT(q) __TEXT(q)
149typedef SHORT *PSHORT;
150typedef LONG *PLONG;
151#ifdef STRICT
152typedef void *HANDLE;
153#define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
154#else
155typedef PVOID HANDLE;
156#define DECLARE_HANDLE(n) typedef HANDLE n
157#endif
158typedef HANDLE *PHANDLE, *LPHANDLE;
159typedef DWORD LCID;
160typedef PDWORD PLCID;
161typedef WORD LANGID;
162#ifdef __GNUC__
163#define _HAVE_INT64
164#define _INTEGRAL_MAX_BITS 64
165#undef __int64
166#define __int64 long long
167#elif defined(__WATCOMC__) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
168#define _HAVE_INT64
169#endif /* __GNUC__/__WATCOMC */
170#if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
171typedef __int64 LONGLONG;
172typedef unsigned __int64 DWORDLONG;
173#else
174typedef double LONGLONG, DWORDLONG;
175#endif
176typedef LONGLONG *PLONGLONG;
177typedef DWORDLONG *PDWORDLONG;
178typedef DWORDLONG ULONGLONG, *PULONGLONG;
179typedef LONGLONG USN;
180#ifdef _HAVE_INT64
181#define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
182#define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
183#define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
184#define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
185#define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
186#endif
187#define ANSI_NULL '\0'
188#define UNICODE_NULL L'\0'
189typedef BYTE BOOLEAN, *PBOOLEAN;
190
191_END_C_DECLS
192
193#endif /* ! RC_INVOKED */
194
195typedef BYTE FCHAR;
196typedef WORD FSHORT;
197typedef DWORD FLONG;
198
199#define NTAPI __stdcall
200#include <basetsd.h>
201#define ACE_OBJECT_TYPE_PRESENT 0x00000001
202#define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
203#define APPLICATION_ERROR_MASK 0x20000000
204#define ERROR_SEVERITY_SUCCESS 0x00000000
205#define ERROR_SEVERITY_INFORMATIONAL 0x40000000
206#define ERROR_SEVERITY_WARNING 0x80000000
207#define ERROR_SEVERITY_ERROR 0xC0000000
208/* also in ddk/ntifs.h */
209#define COMPRESSION_FORMAT_NONE (0x0000)
210#define COMPRESSION_FORMAT_DEFAULT (0x0001)
211#define COMPRESSION_FORMAT_LZNT1 (0x0002)
212#define COMPRESSION_ENGINE_STANDARD (0x0000)
213#define COMPRESSION_ENGINE_MAXIMUM (0x0100)
214#define COMPRESSION_ENGINE_HIBER (0x0200)
215#define ACCESS_ALLOWED_ACE_TYPE (0x0)
216#define ACCESS_DENIED_ACE_TYPE (0x1)
217#define SYSTEM_AUDIT_ACE_TYPE (0x2)
218#define SYSTEM_ALARM_ACE_TYPE (0x3)
219/*end ntifs.h */
220#define ANYSIZE_ARRAY 1
221#define OBJECT_INHERIT_ACE 1
222#define CONTAINER_INHERIT_ACE 2
223#define NO_PROPAGATE_INHERIT_ACE 4
224#define INHERIT_ONLY_ACE 8
225#define INHERITED_ACE 16
226
227#define VALID_INHERIT_FLAGS \
228 OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | NO_PROPAGATE_INHERIT_ACE | \
229 INHERIT_ONLY_ACE | INHERITED_ACE
230
231#define SUCCESSFUL_ACCESS_ACE_FLAG 64
232#define FAILED_ACCESS_ACE_FLAG 128
233#define DELETE 0x00010000L
234#define READ_CONTROL 0x20000L
235#define WRITE_DAC 0x40000L
236#define WRITE_OWNER 0x80000L
237#define SYNCHRONIZE 0x100000L
238#define STANDARD_RIGHTS_REQUIRED 0xF0000
239#define STANDARD_RIGHTS_READ 0x20000
240#define STANDARD_RIGHTS_WRITE 0x20000
241#define STANDARD_RIGHTS_EXECUTE 0x20000
242#define STANDARD_RIGHTS_ALL 0x1F0000
243#define SPECIFIC_RIGHTS_ALL 0xFFFF
244#define ACCESS_SYSTEM_SECURITY 0x1000000
245
246#define MAXIMUM_ALLOWED 0x2000000
247#define GENERIC_READ 0x80000000
248#define GENERIC_WRITE 0x40000000
249#define GENERIC_EXECUTE 0x20000000
250#define GENERIC_ALL 0x10000000
251
252#define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
253
254/* Also in ddk/winddk.h */
255#define FILE_LIST_DIRECTORY 0x00000001
256#define FILE_READ_DATA 0x00000001
257#define FILE_ADD_FILE 0x00000002
258#define FILE_WRITE_DATA 0x00000002
259#define FILE_ADD_SUBDIRECTORY 0x00000004
260#define FILE_APPEND_DATA 0x00000004
261#define FILE_CREATE_PIPE_INSTANCE 0x00000004
262#define FILE_READ_EA 0x00000008
263#define FILE_READ_PROPERTIES 0x00000008
264#define FILE_WRITE_EA 0x00000010
265#define FILE_WRITE_PROPERTIES 0x00000010
266#define FILE_EXECUTE 0x00000020
267#define FILE_TRAVERSE 0x00000020
268#define FILE_DELETE_CHILD 0x00000040
269#define FILE_READ_ATTRIBUTES 0x00000080
270#define FILE_WRITE_ATTRIBUTES 0x00000100
271
272#define FILE_SHARE_READ 0x00000001
273#define FILE_SHARE_WRITE 0x00000002
274#define FILE_SHARE_DELETE 0x00000004
275#define FILE_SHARE_VALID_FLAGS 0x00000007
276
277#define FILE_ATTRIBUTE_READONLY 0x00000001
278#define FILE_ATTRIBUTE_HIDDEN 0x00000002
279#define FILE_ATTRIBUTE_SYSTEM 0x00000004
280#define FILE_ATTRIBUTE_DIRECTORY 0x00000010
281#define FILE_ATTRIBUTE_ARCHIVE 0x00000020
282#define FILE_ATTRIBUTE_DEVICE 0x00000040
283#define FILE_ATTRIBUTE_NORMAL 0x00000080
284#define FILE_ATTRIBUTE_TEMPORARY 0x00000100
285#define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
286#define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
287#define FILE_ATTRIBUTE_COMPRESSED 0x00000800
288#define FILE_ATTRIBUTE_OFFLINE 0x00001000
289#define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
290#define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
291#define FILE_ATTRIBUTE_VIRTUAL 0x00010000
292#define FILE_ATTRIBUTE_VALID_FLAGS 0x00017fb7
293#define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
294
295#define FILE_COPY_STRUCTURED_STORAGE 0x00000041
296#define FILE_STRUCTURED_STORAGE 0x00000441
297
298#define FILE_VALID_OPTION_FLAGS 0x00ffffff
299#define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
300#define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
301#define FILE_VALID_SET_FLAGS 0x00000036
302
303#define FILE_SUPERSEDE 0x00000000
304#define FILE_OPEN 0x00000001
305#define FILE_CREATE 0x00000002
306#define FILE_OPEN_IF 0x00000003
307#define FILE_OVERWRITE 0x00000004
308#define FILE_OVERWRITE_IF 0x00000005
309#define FILE_MAXIMUM_DISPOSITION 0x00000005
310
311#define FILE_DIRECTORY_FILE 0x00000001
312#define FILE_WRITE_THROUGH 0x00000002
313#define FILE_SEQUENTIAL_ONLY 0x00000004
314#define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
315#define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
316#define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
317#define FILE_NON_DIRECTORY_FILE 0x00000040
318#define FILE_CREATE_TREE_CONNECTION 0x00000080
319#define FILE_COMPLETE_IF_OPLOCKED 0x00000100
320#define FILE_NO_EA_KNOWLEDGE 0x00000200
321#define FILE_OPEN_FOR_RECOVERY 0x00000400
322#define FILE_RANDOM_ACCESS 0x00000800
323#define FILE_DELETE_ON_CLOSE 0x00001000
324#define FILE_OPEN_BY_FILE_ID 0x00002000
325#define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
326#define FILE_NO_COMPRESSION 0x00008000
327#define FILE_RESERVE_OPFILTER 0x00100000
328#define FILE_OPEN_REPARSE_POINT 0x00200000
329#define FILE_OPEN_NO_RECALL 0x00400000
330#define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
331
332#define FILE_ALL_ACCESS ( STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF )
333
334#define FILE_GENERIC_EXECUTE \
335 ( STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE \
336 )
337#define FILE_GENERIC_READ \
338 ( STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | \
339 FILE_READ_EA | SYNCHRONIZE \
340 )
341#define FILE_GENERIC_WRITE \
342 ( STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | \
343 FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE \
344 )
345/* end winddk.h */
346/* also in ddk/ntifs.h */
347#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
348#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
349#define FILE_NOTIFY_CHANGE_NAME 0x00000003
350#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
351#define FILE_NOTIFY_CHANGE_SIZE 0x00000008
352#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
353#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
354#define FILE_NOTIFY_CHANGE_CREATION 0x00000040
355#define FILE_NOTIFY_CHANGE_EA 0x00000080
356#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
357#define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
358#define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
359#define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
360#define FILE_NOTIFY_VALID_MASK 0x00000fff
361
362#define FILE_CASE_SENSITIVE_SEARCH 0x00000001
363#define FILE_CASE_PRESERVED_NAMES 0x00000002
364#define FILE_UNICODE_ON_DISK 0x00000004
365#define FILE_PERSISTENT_ACLS 0x00000008
366#define FILE_FILE_COMPRESSION 0x00000010
367#define FILE_VOLUME_QUOTAS 0x00000020
368#define FILE_SUPPORTS_SPARSE_FILES 0x00000040
369#define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
370#define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
371#define FS_LFN_APIS 0x00004000
372#define FILE_VOLUME_IS_COMPRESSED 0x00008000
373#define FILE_SUPPORTS_OBJECT_IDS 0x00010000
374#define FILE_SUPPORTS_ENCRYPTION 0x00020000
375#define FILE_NAMED_STREAMS 0x00040000
376#define FILE_READ_ONLY_VOLUME 0x00080000
377#define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000
378#define FILE_SUPPORTS_TRANSACTIONS 0x00200000
379/* Note: These flags only have a meaning starting with Windows 7/2008 R2.
380 Their absence on older OSes does NOT mean that a filesystem is missing
381 that property. */
382#define FILE_SUPPORTS_HARD_LINKS 0x00400000
383#define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000
384#define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000
385#define FILE_SUPPORTS_USN_JOURNAL 0x02000000
386
387
388#define IO_COMPLETION_QUERY_STATE 0x0001
389#define IO_COMPLETION_MODIFY_STATE 0x0002
390#define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
391/* end ntifs.h */
392
393/* also in ddk/winddk.h */
394#define DUPLICATE_CLOSE_SOURCE 0x00000001
395#define DUPLICATE_SAME_ACCESS 0x00000002
396#define DUPLICATE_SAME_ATTRIBUTES 0x00000004
397/* end winddk.k */
398
399#define MAILSLOT_NO_MESSAGE ((DWORD)-1)
400#define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
401#define PROCESS_TERMINATE 1
402#define PROCESS_CREATE_THREAD 2
403#define PROCESS_SET_SESSIONID 4
404#define PROCESS_VM_OPERATION 8
405#define PROCESS_VM_READ 16
406#define PROCESS_VM_WRITE 32
407#define PROCESS_DUP_HANDLE 64
408#define PROCESS_CREATE_PROCESS 128
409#define PROCESS_SET_QUOTA 256
410#define PROCESS_SUSPEND_RESUME 0x0800
411#define PROCESS_SET_INFORMATION 512
412#define PROCESS_QUERY_INFORMATION 1024
413#define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
414
415#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
416#define THREAD_TERMINATE 1
417#define THREAD_SUSPEND_RESUME 2
418#define THREAD_GET_CONTEXT 8
419#define THREAD_SET_CONTEXT 16
420#define THREAD_SET_INFORMATION 32
421#define THREAD_QUERY_INFORMATION 64
422#define THREAD_SET_THREAD_TOKEN 128
423#define THREAD_IMPERSONATE 256
424#define THREAD_DIRECT_IMPERSONATION 0x200
425#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
426#define THREAD_BASE_PRIORITY_LOWRT 15
427#define THREAD_BASE_PRIORITY_MAX 2
428#define THREAD_BASE_PRIORITY_MIN (-2)
429#define THREAD_BASE_PRIORITY_IDLE (-15)
430#define EXCEPTION_NONCONTINUABLE 1
431#define EXCEPTION_MAXIMUM_PARAMETERS 15
432#define MUTANT_QUERY_STATE 0x0001
433#define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
434#define TIMER_QUERY_STATE 0x0001
435#define TIMER_MODIFY_STATE 0x0002
436#define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
437/*
438 * To prevent gcc compiler warnings, bracket these defines when initialising
439 * a SID_IDENTIFIER_AUTHORITY, eg.
440 * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
441 */
442#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
443#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
444#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
445#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
446#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
447#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
448#define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
449#define SECURITY_NULL_RID 0
450#define SECURITY_WORLD_RID (0x00000000L)
451#define SECURITY_LOCAL_RID 0
452#define SECURITY_CREATOR_OWNER_RID 0
453#define SECURITY_CREATOR_GROUP_RID 1
454#define SECURITY_DIALUP_RID 1
455#define SECURITY_NETWORK_RID 2
456#define SECURITY_BATCH_RID 3
457#define SECURITY_INTERACTIVE_RID 4
458#define SECURITY_LOGON_IDS_RID 5
459#define SECURITY_SERVICE_RID 6
460#define SECURITY_LOCAL_SYSTEM_RID 18
461#define SECURITY_BUILTIN_DOMAIN_RID 32
462#define SECURITY_PRINCIPAL_SELF_RID 10
463#define SECURITY_CREATOR_OWNER_SERVER_RID 0x2
464#define SECURITY_CREATOR_GROUP_SERVER_RID 0x3
465#define SECURITY_LOGON_IDS_RID_COUNT 0x3
466#define SECURITY_ANONYMOUS_LOGON_RID 0x7
467#define SECURITY_PROXY_RID 0x8
468#define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x9
469#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
470#define SECURITY_AUTHENTICATED_USER_RID 0xB
471#define SECURITY_RESTRICTED_CODE_RID 0xC
472#define SECURITY_NT_NON_UNIQUE_RID 0x15
473#define SID_REVISION 1
474#if (_WIN32_WINNT >= 0x0600)
475#define SID_HASH_SIZE 32
476#endif
477#define DOMAIN_USER_RID_ADMIN 0x1F4L
478#define DOMAIN_USER_RID_GUEST 0x1F5L
479#define DOMAIN_GROUP_RID_ADMINS 0x200L
480#define DOMAIN_GROUP_RID_USERS 0x201L
481#define DOMAIN_ALIAS_RID_ADMINS 0x220L
482#define DOMAIN_ALIAS_RID_USERS 0x221L
483#define DOMAIN_ALIAS_RID_GUESTS 0x222L
484#define DOMAIN_ALIAS_RID_POWER_USERS 0x223L
485#define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x224L
486#define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x225L
487#define DOMAIN_ALIAS_RID_PRINT_OPS 0x226L
488#define DOMAIN_ALIAS_RID_BACKUP_OPS 0x227L
489#define DOMAIN_ALIAS_RID_REPLICATOR 0x228L
490#define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x22BL
491#define SECURITY_MANDATORY_UNTRUSTED_RID 0
492#define SECURITY_MANDATORY_LOW_RID 0x1000
493#define SECURITY_MANDATORY_MEDIUM_RID 0x2000
494#define SECURITY_MANDATORY_HIGH_RID 0x3000
495#define SECURITY_MANDATORY_SYSTEM_RID 0x4000
496#define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x5000
497
498#define SECURITY_MANDATORY_MAXIMUM_USER_RID SECURITY_MANDATORY_SYSTEM_RID
499#define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
500#define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
501#define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
502#define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
503#define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
504#define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
505#define SE_TCB_NAME TEXT("SeTcbPrivilege")
506#define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
507#define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
508#define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
509#define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
510#define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
511#define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
512#define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
513#define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
514#define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
515#define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
516#define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
517#define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
518#define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
519#define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
520#define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
521#define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
522#define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
523#define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
524#define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
525#define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
526#define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
527#define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
528#define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege")
529#define SE_TRUSTED_CREDMAN_ACCESS_NAME TEXT("SeTrustedCredManAccessPrivilege")
530#define SE_RELABEL_NAME TEXT("SeRelabelPrivilege")
531#define SE_INCREASE_WORKING_SET_NAME TEXT("SeIncreaseWorkingSetPrivilege")
532#define SE_TIME_ZONE_NAME TEXT("SeTimeZonePrivilege")
533#define SE_CREATE_SYMBOLIC_LINK_NAME TEXT("SeCreateSymbolicLinkPrivilege")
534#define SE_GROUP_MANDATORY 1
535#define SE_GROUP_ENABLED_BY_DEFAULT 2
536#define SE_GROUP_ENABLED 4
537#define SE_GROUP_OWNER 8
538#define SE_GROUP_USE_FOR_DENY_ONLY 16
539#define SE_GROUP_INTEGRITY 32
540#define SE_GROUP_INTEGRITY_ENABLED 64
541#define SE_GROUP_LOGON_ID 3221225472U
542#define SE_GROUP_RESOURCE 536870912
543#define LANG_NEUTRAL 0x00
544#define LANG_ARABIC 0x01
545#define LANG_BULGARIAN 0x02
546#define LANG_CATALAN 0x03
547#define LANG_CHINESE 0x04
548#define LANG_CZECH 0x05
549#define LANG_DANISH 0x06
550#define LANG_GERMAN 0x07
551#define LANG_GREEK 0x08
552#define LANG_ENGLISH 0x09
553#define LANG_SPANISH 0x0a
554#define LANG_FINNISH 0x0b
555#define LANG_FRENCH 0x0c
556#define LANG_HEBREW 0x0d
557#define LANG_HUNGARIAN 0x0e
558#define LANG_ICELANDIC 0x0f
559#define LANG_ITALIAN 0x10
560#define LANG_JAPANESE 0x11
561#define LANG_KOREAN 0x12
562#define LANG_DUTCH 0x13
563#define LANG_NORWEGIAN 0x14
564#define LANG_POLISH 0x15
565#define LANG_PORTUGUESE 0x16
566#define LANG_ROMANIAN 0x18
567#define LANG_RUSSIAN 0x19
568#define LANG_CROATIAN 0x1a
569#define LANG_SERBIAN 0x1a
570#define LANG_SERBIAN_NEUTRAL 0x7c1a
571#define LANG_BOSNIAN 0x1a
572#define LANG_BOSNIAN_NEUTRAL 0x781a
573#define LANG_SLOVAK 0x1b
574#define LANG_ALBANIAN 0x1c
575#define LANG_SWEDISH 0x1d
576#define LANG_THAI 0x1e
577#define LANG_TURKISH 0x1f
578#define LANG_URDU 0x20
579#define LANG_INDONESIAN 0x21
580#define LANG_UKRAINIAN 0x22
581#define LANG_BELARUSIAN 0x23
582#define LANG_SLOVENIAN 0x24
583#define LANG_ESTONIAN 0x25
584#define LANG_LATVIAN 0x26
585#define LANG_LITHUANIAN 0x27
586#define LANG_PERSIAN 0x29
587#define LANG_FARSI LANG_PERSIAN
588#define LANG_VIETNAMESE 0x2a
589#define LANG_ARMENIAN 0x2b
590#define LANG_AZERI 0x2c
591#define LANG_BASQUE 0x2d
592#define LANG_LOWER_SORBIAN 0x2e
593#define LANG_UPPER_SORBIAN 0x2e
594#define LANG_MACEDONIAN 0x2f
595#define LANG_TSWANA 0x32
596#define LANG_XHOSA 0x34
597#define LANG_ZULU 0x35
598#define LANG_AFRIKAANS 0x36
599#define LANG_GEORGIAN 0x37
600#define LANG_FAEROESE 0x38
601#define LANG_HINDI 0x39
602#define LANG_MALTESE 0x3a
603#define LANG_SAMI 0x3b
604#define LANG_IRISH 0x3c
605#define LANG_MALAY 0x3e
606#define LANG_KAZAK 0x3f
607#define LANG_KYRGYZ 0x40
608#define LANG_SWAHILI 0x41
609#define LANG_UZBEK 0x43
610#define LANG_TATAR 0x44
611#define LANG_BENGALI 0x45
612#define LANG_PUNJABI 0x46
613#define LANG_GUJARATI 0x47
614#define LANG_ORIYA 0x48
615#define LANG_TAMIL 0x49
616#define LANG_TELUGU 0x4a
617#define LANG_KANNADA 0x4b
618#define LANG_MALAYALAM 0x4c
619#define LANG_ASSAMESE 0x4d
620#define LANG_MARATHI 0x4e
621#define LANG_SANSKRIT 0x4f
622#define LANG_MONGOLIAN 0x50
623#define LANG_TIBETAN 0x51
624#define LANG_WELSH 0x52
625#define LANG_KHMER 0x53
626#define LANG_LAO 0x54
627#define LANG_GALICIAN 0x56
628#define LANG_KONKANI 0x57
629#define LANG_MANIPURI 0x58
630#define LANG_SINDHI 0x59
631#define LANG_SYRIAC 0x5a
632#define LANG_SINHALESE 0x5b
633#define LANG_INUKTITUT 0x5d
634#define LANG_AMHARIC 0x5e
635#define LANG_TAMAZIGHT 0x5f
636#define LANG_KASHMIRI 0x60
637#define LANG_NEPALI 0x61
638#define LANG_FRISIAN 0x62
639#define LANG_PASHTO 0x63
640#define LANG_FILIPINO 0x64
641#define LANG_DIVEHI 0x65
642#define LANG_HAUSA 0x68
643#define LANG_YORUBA 0x6a
644#define LANG_QUECHUA 0x6b
645#define LANG_SOTHO 0x6c
646#define LANG_BASHKIR 0x6d
647#define LANG_LUXEMBOURGISH 0x6e
648#define LANG_GREENLANDIC 0x6f
649#define LANG_IGBO 0x70
650#define LANG_TIGRIGNA 0x73
651#define LANG_YI 0x78
652#define LANG_MAPUDUNGUN 0x7a
653#define LANG_MOHAWK 0x7c
654#define LANG_BRETON 0x7e
655#define LANG_INVARIANT 0x7f
656#define LANG_UIGHUR 0x80
657#define LANG_MAORI 0x81
658#define LANG_OCCITAN 0x82
659#define LANG_CORSICAN 0x83
660#define LANG_ALSATIAN 0x84
661#define LANG_YAKUT 0x85
662#define LANG_KICHE 0x86
663#define LANG_KINYARWANDA 0x87
664#define LANG_WOLOF 0x88
665#define LANG_DARI 0x8c
666#define LANG_MALAGASY 0x8d
667#define SUBLANG_NEUTRAL 0x00
668#define SUBLANG_DEFAULT 0x01
669#define SUBLANG_SYS_DEFAULT 0x02
670#define SUBLANG_CUSTOM_DEFAULT 0x03
671#define SUBLANG_CUSTOM_UNSPECIFIED 0x04
672#define SUBLANG_UI_CUSTOM_DEFAULT 0x05
673#define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
674#define SUBLANG_ALBANIAN_ALBANIA 0x01
675#define SUBLANG_ALSATIAN_FRANCE 0x01
676#define SUBLANG_AMHARIC_ETHIOPIA 0x01
677#define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
678#define SUBLANG_ARABIC_IRAQ 0x02
679#define SUBLANG_ARABIC_EGYPT 0x03
680#define SUBLANG_ARABIC_LIBYA 0x04
681#define SUBLANG_ARABIC_ALGERIA 0x05
682#define SUBLANG_ARABIC_MOROCCO 0x06
683#define SUBLANG_ARABIC_TUNISIA 0x07
684#define SUBLANG_ARABIC_OMAN 0x08
685#define SUBLANG_ARABIC_YEMEN 0x09
686#define SUBLANG_ARABIC_SYRIA 0x0a
687#define SUBLANG_ARABIC_JORDAN 0x0b
688#define SUBLANG_ARABIC_LEBANON 0x0c
689#define SUBLANG_ARABIC_KUWAIT 0x0d
690#define SUBLANG_ARABIC_UAE 0x0e
691#define SUBLANG_ARABIC_BAHRAIN 0x0f
692#define SUBLANG_ARABIC_QATAR 0x10
693#define SUBLANG_ARMENIAN_ARMENIA 0x01
694#define SUBLANG_ASSAMESE_INDIA 0x01
695#define SUBLANG_AZERI_LATIN 0x01
696#define SUBLANG_AZERI_CYRILLIC 0x02
697#define SUBLANG_BASHKIR_RUSSIA 0x01
698#define SUBLANG_BASQUE_BASQUE 0x01
699#define SUBLANG_BELARUSIAN_BELARUS 0x01
700#define SUBLANG_BENGALI_INDIA 0x01
701#define SUBLANG_BENGALI_BANGLADESH 0x02
702#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
703#define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
704#define SUBLANG_BRETON_FRANCE 0x01
705#define SUBLANG_BULGARIAN_BULGARIA 0x01
706#define SUBLANG_CATALAN_CATALAN 0x01
707#define SUBLANG_CHINESE_TRADITIONAL 0x01
708#define SUBLANG_CHINESE_SIMPLIFIED 0x02
709#define SUBLANG_CHINESE_HONGKONG 0x03
710#define SUBLANG_CHINESE_SINGAPORE 0x04
711#define SUBLANG_CHINESE_MACAU 0x05
712#define SUBLANG_CORSICAN_FRANCE 0x01
713#define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
714#define SUBLANG_CROATIAN_CROATIA 0x01
715#define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
716#define SUBLANG_DANISH_DENMARK 0x01
717#define SUBLANG_DIVEHI_MALDIVES 0x01
718#define SUBLANG_DUTCH 0x01
719#define SUBLANG_DUTCH_BELGIAN 0x02
720#define SUBLANG_ENGLISH_US 0x01
721#define SUBLANG_ENGLISH_UK 0x02
722#define SUBLANG_ENGLISH_AUS 0x03
723#define SUBLANG_ENGLISH_CAN 0x04
724#define SUBLANG_ENGLISH_NZ 0x05
725#if (WINVER >= 0x0600)
726#define SUBLANG_ENGLISH_IRELAND 0x06
727#endif
728#define SUBLANG_ENGLISH_EIRE 0x06
729#define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
730#define SUBLANG_ENGLISH_JAMAICA 0x08
731#define SUBLANG_ENGLISH_CARIBBEAN 0x09
732#define SUBLANG_ENGLISH_BELIZE 0x0a
733#define SUBLANG_ENGLISH_TRINIDAD 0x0b
734#define SUBLANG_ENGLISH_ZIMBABWE 0x0c
735#define SUBLANG_ENGLISH_PHILIPPINES 0x0d
736#define SUBLANG_ENGLISH_INDIA 0x10
737#define SUBLANG_ENGLISH_MALAYSIA 0x11
738#define SUBLANG_ENGLISH_SINGAPORE 0x12
739#define SUBLANG_ESTONIAN_ESTONIA 0x01
740#define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
741#define SUBLANG_FILIPINO_PHILIPPINES 0x01
742#define SUBLANG_FINNISH_FINLAND 0x01
743#define SUBLANG_FRENCH 0x01
744#define SUBLANG_FRENCH_BELGIAN 0x02
745#define SUBLANG_FRENCH_CANADIAN 0x03
746#define SUBLANG_FRENCH_SWISS 0x04
747#define SUBLANG_FRENCH_LUXEMBOURG 0x05
748#define SUBLANG_FRENCH_MONACO 0x06
749#define SUBLANG_FRISIAN_NETHERLANDS 0x01
750#define SUBLANG_GALICIAN_GALICIAN 0x01
751#define SUBLANG_GEORGIAN_GEORGIA 0x01
752#define SUBLANG_GERMAN 0x01
753#define SUBLANG_GERMAN_SWISS 0x02
754#define SUBLANG_GERMAN_AUSTRIAN 0x03
755#define SUBLANG_GERMAN_LUXEMBOURG 0x04
756#define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
757#define SUBLANG_GREEK_GREECE 0x01
758#define SUBLANG_GREENLANDIC_GREENLAND 0x01
759#define SUBLANG_GUJARATI_INDIA 0x01
760#define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
761#define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN /* SUBLANG_HAUSA_NIGERIA_LATIN is what MS defines */
762#define SUBLANG_HEBREW_ISRAEL 0x01
763#define SUBLANG_HINDI_INDIA 0x01
764#define SUBLANG_HUNGARIAN_HUNGARY 0x01
765#define SUBLANG_ICELANDIC_ICELAND 0x01
766#define SUBLANG_IGBO_NIGERIA 0x01
767#define SUBLANG_INDONESIAN_INDONESIA 0x01
768#define SUBLANG_INUKTITUT_CANADA 0x01
769#define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
770#define SUBLANG_IRISH_IRELAND 0x02
771#define SUBLANG_ITALIAN 0x01
772#define SUBLANG_ITALIAN_SWISS 0x02
773#define SUBLANG_JAPANESE_JAPAN 0x01
774#define SUBLANG_KASHMIRI_INDIA 0x02
775#define SUBLANG_KASHMIRI_SASIA 0x02
776#define SUBLANG_KAZAK_KAZAKHSTAN 0x01
777#define SUBLANG_KHMER_CAMBODIA 0x01
778#define SUBLANG_KICHE_GUATEMALA 0x01
779#define SUBLANG_KINYARWANDA_RWANDA 0x01
780#define SUBLANG_KONKANI_INDIA 0x01
781#define SUBLANG_KOREAN 0x01
782#define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
783#define SUBLANG_LAO_LAO 0x01
784#define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO /* SUBLANG_LAO_LAO is what MS defines */
785#define SUBLANG_LATVIAN_LATVIA 0x01
786#if (WINVER >= 0x0600)
787#define SUBLANG_LITHUANIAN_LITHUANIA 0x01
788#endif
789#define SUBLANG_LITHUANIAN 0x01
790#define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
791#define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
792#define SUBLANG_MACEDONIAN_MACEDONIA 0x01
793#define SUBLANG_MALAY_MALAYSIA 0x01
794#define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
795#define SUBLANG_MALAYALAM_INDIA 0x01
796#define SUBLANG_MALTESE_MALTA 0x01
797#define SUBLANG_MAORI_NEW_ZEALAND 0x01
798#define SUBLANG_MAPUDUNGUN_CHILE 0x01
799#define SUBLANG_MARATHI_INDIA 0x01
800#define SUBLANG_MOHAWK_MOHAWK 0x01
801#define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
802#define SUBLANG_MONGOLIAN_PRC 0x02
803#define SUBLANG_NEPALI_NEPAL 0x01
804#define SUBLANG_NEPALI_INDIA 0x02
805#define SUBLANG_NORWEGIAN_BOKMAL 0x01
806#define SUBLANG_NORWEGIAN_NYNORSK 0x02
807#define SUBLANG_OCCITAN_FRANCE 0x01
808#define SUBLANG_ORIYA_INDIA 0x01
809#define SUBLANG_PASHTO_AFGHANISTAN 0x01
810#define SUBLANG_PERSIAN_IRAN 0x01
811#define SUBLANG_POLISH_POLAND 0x01
812#define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
813#if (WINVER >= 0x0600)
814#define SUBLANG_PORTUGUESE_PORTUGAL 0x02
815#endif
816#define SUBLANG_PORTUGUESE 0x02
817#define SUBLANG_PUNJABI_INDIA 0x01
818/* ??? #define SUBLANG_PUNJABI_PAKISTAN 0x01 ??? */
819#define SUBLANG_QUECHUA_BOLIVIA 0x01
820#define SUBLANG_QUECHUA_ECUADOR 0x02
821#define SUBLANG_QUECHUA_PERU 0x03
822#define SUBLANG_ROMANIAN_ROMANIA 0x01
823/* ??? #define SUBLANG_ROMANIAN_MOLDOVA 0x01 ??? */
824#define SUBLANG_ROMANSH_SWITZERLAND 0x01
825#define SUBLANG_RUSSIAN_RUSSIA 0x01
826#define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
827#define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
828#define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
829#define SUBLANG_SAMI_LULE_NORWAY 0x04
830#define SUBLANG_SAMI_LULE_SWEDEN 0x05
831#define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
832#define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
833#define SUBLANG_SAMI_SKOLT_FINLAND 0x08
834#define SUBLANG_SAMI_INARI_FINLAND 0x09
835#define SUBLANG_SANSKRIT_INDIA 0x01
836#define SUBLANG_SERBIAN_LATIN 0x02
837#define SUBLANG_SERBIAN_CYRILLIC 0x03
838#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
839#define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
840#define SUBLANG_SINDHI_AFGHANISTAN 0x02
841#define SUBLANG_SINHALESE_SRI_LANKA 0x01
842#define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
843#define SUBLANG_SLOVAK_SLOVAKIA 0x01
844#define SUBLANG_SLOVENIAN_SLOVENIA 0x01
845#define SUBLANG_SPANISH 0x01
846#define SUBLANG_SPANISH_MEXICAN 0x02
847#define SUBLANG_SPANISH_MODERN 0x03
848#define SUBLANG_SPANISH_GUATEMALA 0x04
849#define SUBLANG_SPANISH_COSTA_RICA 0x05
850#define SUBLANG_SPANISH_PANAMA 0x06
851#define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
852#define SUBLANG_SPANISH_VENEZUELA 0x08
853#define SUBLANG_SPANISH_COLOMBIA 0x09
854#define SUBLANG_SPANISH_PERU 0x0a
855#define SUBLANG_SPANISH_ARGENTINA 0x0b
856#define SUBLANG_SPANISH_ECUADOR 0x0c
857#define SUBLANG_SPANISH_CHILE 0x0d
858#define SUBLANG_SPANISH_URUGUAY 0x0e
859#define SUBLANG_SPANISH_PARAGUAY 0x0f
860#define SUBLANG_SPANISH_BOLIVIA 0x10
861#define SUBLANG_SPANISH_EL_SALVADOR 0x11
862#define SUBLANG_SPANISH_HONDURAS 0x12
863#define SUBLANG_SPANISH_NICARAGUA 0x13
864#define SUBLANG_SPANISH_PUERTO_RICO 0x14
865#define SUBLANG_SPANISH_US 0x15
866#if (WINVER >= 0x0600)
867#define SUBLANG_SWEDISH_SWEDEN 0x01
868#endif
869#define SUBLANG_SWEDISH 0x01
870#define SUBLANG_SWEDISH_FINLAND 0x02
871#define SUBLANG_SYRIAC 0x01
872#define SUBLANG_SYRIAC_SYRIA SUBLANG_SYRIAC /* SUBLANG_SYRIAC_SYRIA is what MSDN mentions */
873#define SUBLANG_TAJIK_TAJIKISTAN 0x01
874#define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
875#define SUBLANG_TAMIL_INDIA 0x01
876#define SUBLANG_TATAR_RUSSIA 0x01
877#define SUBLANG_TELUGU_INDIA 0x01
878#define SUBLANG_THAI_THAILAND 0x01
879#define SUBLANG_TIBETAN_PRC 0x01
880#define SUBLANG_TIBETAN_BHUTAN 0x02
881#define SUBLANG_TIGRIGNA_ERITREA 0x02
882#define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
883#define SUBLANG_TURKISH_TURKEY 0x01
884#define SUBLANG_TURKMEN_TURKMENISTAN 0x01
885#define SUBLANG_UIGHUR_PRC 0x01
886#define SUBLANG_UKRAINIAN_UKRAINE 0x01
887#define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
888#define SUBLANG_URDU_PAKISTAN 0x01
889#define SUBLANG_URDU_INDIA 0x02
890#define SUBLANG_UZBEK_LATIN 0x01
891#define SUBLANG_UZBEK_CYRILLIC 0x02
892#define SUBLANG_VIETNAMESE_VIETNAM 0x01
893#define SUBLANG_WELSH_UNITED_KINGDOM 0x01
894#define SUBLANG_WOLOF_SENEGAL 0x01
895#define SUBLANG_YORUBA_NIGERIA 0x01
896#define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
897#define SUBLANG_YAKUT_RUSSIA 0x01
898#define SUBLANG_YI_PRC 0x01
899#define SUBLANG_ZULU_SOUTH_AFRICA 0x01
900#define NLS_VALID_LOCALE_MASK 1048575
901#define SORT_DEFAULT 0
902#define SORT_JAPANESE_XJIS 0
903#define SORT_JAPANESE_UNICODE 1
904#define SORT_CHINESE_BIG5 0
905#define SORT_CHINESE_PRCP 0
906#define SORT_CHINESE_UNICODE 1
907#define SORT_CHINESE_PRC 2
908#define SORT_CHINESE_BOPOMOFO 3
909#define SORT_KOREAN_KSC 0
910#define SORT_KOREAN_UNICODE 1
911#define SORT_GERMAN_PHONE_BOOK 1
912#define SORT_HUNGARIAN_DEFAULT 0
913#define SORT_HUNGARIAN_TECHNICAL 1
914#define SORT_GEORGIAN_TRADITIONAL 0
915#define SORT_GEORGIAN_MODERN 1
916#define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
917#define MAKELCID(l,s) ((DWORD)((((DWORD)((WORD)(s)))<<16)|((DWORD)((WORD)(l)))))
918#define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
919#define SORTIDFROMLCID(l) ((WORD)((((DWORD)(l))&NLS_VALID_LOCALE_MASK)>>16))
920#define SORTVERSIONFROMLCID(l) ((WORD)((((DWORD)(l))>>20)&0xf))
921#define SUBLANGID(l) ((WORD)(l)>>10)
922#define LANGIDFROMLCID(l) ((WORD)(l))
923#define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)
924#define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
925#define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)
926#define ACL_REVISION 2
927#define ACL_REVISION_DS 4
928#define ACL_REVISION1 1
929#define ACL_REVISION2 2
930#define ACL_REVISION3 3
931#define ACL_REVISION4 4
932#define MIN_ACL_REVISION 2
933#define MAX_ACL_REVISION 4
934#define MINCHAR 0x80
935#define MAXCHAR 0x7f
936#define MINSHORT 0x8000
937#define MAXSHORT 0x7fff
938#define MINLONG 0x80000000
939#define MAXLONG 0x7fffffff
940#define MAXBYTE 0xff
941#define MAXWORD 0xffff
942#define MAXDWORD 0xffffffff
943#define PROCESSOR_INTEL_386 386
944#define PROCESSOR_INTEL_486 486
945#define PROCESSOR_INTEL_PENTIUM 586
946#define PROCESSOR_MIPS_R4000 4000
947#define PROCESSOR_ALPHA_21064 21064
948#define PROCESSOR_INTEL_IA64 2200
949#define PROCESSOR_ARCHITECTURE_INTEL 0
950#define PROCESSOR_ARCHITECTURE_MIPS 1
951#define PROCESSOR_ARCHITECTURE_ALPHA 2
952#define PROCESSOR_ARCHITECTURE_PPC 3
953#define PROCESSOR_ARCHITECTURE_SHX 4
954#define PROCESSOR_ARCHITECTURE_ARM 5
955#define PROCESSOR_ARCHITECTURE_IA64 6
956#define PROCESSOR_ARCHITECTURE_ALPHA64 7
957#define PROCESSOR_ARCHITECTURE_MSIL 8
958#define PROCESSOR_ARCHITECTURE_AMD64 9
959#define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
960#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
961#define PF_FLOATING_POINT_PRECISION_ERRATA 0
962#define PF_FLOATING_POINT_EMULATED 1
963#define PF_COMPARE_EXCHANGE_DOUBLE 2
964#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
965#define PF_PPC_MOVEMEM_64BIT_OK 4
966#define PF_ALPHA_BYTE_INSTRUCTIONS 5
967#define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
968#define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
969#define PF_RDTSC_INSTRUCTION_AVAILABLE 8
970#define PF_PAE_ENABLED 9
971#define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
972/* also in ddk/ntifs.h */
973#define FILE_ACTION_ADDED 0x00000001
974#define FILE_ACTION_REMOVED 0x00000002
975#define FILE_ACTION_MODIFIED 0x00000003
976#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
977#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
978#define FILE_ACTION_ADDED_STREAM 0x00000006
979#define FILE_ACTION_REMOVED_STREAM 0x00000007
980#define FILE_ACTION_MODIFIED_STREAM 0x00000008
981#define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
982#define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
983#define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
984/* end ntifs.h */
985#define HEAP_NO_SERIALIZE 1
986#define HEAP_GROWABLE 2
987#define HEAP_GENERATE_EXCEPTIONS 4
988#define HEAP_ZERO_MEMORY 8
989#define HEAP_REALLOC_IN_PLACE_ONLY 16
990#define HEAP_TAIL_CHECKING_ENABLED 32
991#define HEAP_FREE_CHECKING_ENABLED 64
992#define HEAP_DISABLE_COALESCE_ON_FREE 128
993#define HEAP_CREATE_ALIGN_16 0x0000
994#define HEAP_CREATE_ENABLE_TRACING 0x20000
995#define HEAP_MAXIMUM_TAG 0xFFF
996#define HEAP_PSEUDO_TAG_FLAG 0x8000
997#define HEAP_TAG_SHIFT 16
998#define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16))
999#define KEY_QUERY_VALUE 1
1000#define KEY_SET_VALUE 2
1001#define KEY_CREATE_SUB_KEY 4
1002#define KEY_ENUMERATE_SUB_KEYS 8
1003#define KEY_NOTIFY 16
1004#define KEY_CREATE_LINK 32
1005#define KEY_WRITE 0x20006
1006#define KEY_EXECUTE 0x20019
1007#define KEY_READ 0x20019
1008#if (_WIN32_WINNT >= 0x0502)
1009#define KEY_WOW64_64KEY 0x0100
1010#define KEY_WOW64_32KEY 0x0200
1011#endif
1012#define KEY_ALL_ACCESS 0xf003f
1013#define REG_WHOLE_HIVE_VOLATILE 1
1014#define REG_REFRESH_HIVE 2
1015#define REG_NO_LAZY_FLUSH 4
1016#define REG_OPTION_RESERVED 0
1017#define REG_OPTION_NON_VOLATILE 0
1018#define REG_OPTION_VOLATILE 1
1019#define REG_OPTION_CREATE_LINK 2
1020#define REG_OPTION_BACKUP_RESTORE 4
1021#define REG_OPTION_OPEN_LINK 8
1022#define REG_LEGAL_OPTION 15
1023#define OWNER_SECURITY_INFORMATION 0x00000001
1024#define GROUP_SECURITY_INFORMATION 0x00000002
1025#define DACL_SECURITY_INFORMATION 0x00000004
1026#define SACL_SECURITY_INFORMATION 0x00000008
1027#define LABEL_SECURITY_INFORMATION 0x00000010
1028#define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
1029#define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
1030#define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
1031#define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
1032#define MAXIMUM_PROCESSORS 32
1033#define PAGE_NOACCESS 0x0001
1034#define PAGE_READONLY 0x0002
1035#define PAGE_READWRITE 0x0004
1036#define PAGE_WRITECOPY 0x0008
1037#define PAGE_EXECUTE 0x0010
1038#define PAGE_EXECUTE_READ 0x0020
1039#define PAGE_EXECUTE_READWRITE 0x0040
1040#define PAGE_EXECUTE_WRITECOPY 0x0080
1041#define PAGE_GUARD 0x0100
1042#define PAGE_NOCACHE 0x0200
1043#define PAGE_WRITECOMBINE 0x0400
1044#define MEM_COMMIT 0x1000
1045#define MEM_RESERVE 0x2000
1046#define MEM_DECOMMIT 0x4000
1047#define MEM_RELEASE 0x8000
1048#define MEM_FREE 0x10000
1049#define MEM_PRIVATE 0x20000
1050#define MEM_MAPPED 0x40000
1051#define MEM_RESET 0x80000
1052#define MEM_TOP_DOWN 0x100000
1053#define MEM_WRITE_WATCH 0x200000 /* 98/Me */
1054#define MEM_PHYSICAL 0x400000
1055#define MEM_4MB_PAGES 0x80000000
1056/* also in ddk/ntifs.h */
1057#define MEM_IMAGE SEC_IMAGE
1058#define SEC_BASED 0x00200000
1059#define SEC_NO_CHANGE 0x00400000
1060#define SEC_FILE 0x00800000
1061#define SEC_IMAGE 0x01000000
1062#define SEC_VLM 0x02000000
1063#define SEC_RESERVE 0x04000000
1064#define SEC_COMMIT 0x08000000
1065#define SEC_NOCACHE 0x10000000
1066/* end ntifs.h */
1067#define SECTION_EXTEND_SIZE 16
1068#define SECTION_MAP_READ 4
1069#define SECTION_MAP_WRITE 2
1070#define SECTION_QUERY 1
1071#define SECTION_MAP_EXECUTE 8
1072#define SECTION_ALL_ACCESS 0xf001f
1073#define MESSAGE_RESOURCE_UNICODE 1
1074#define RTL_CRITSECT_TYPE 0
1075#define RTL_RESOURCE_TYPE 1
1076/* Also in winddk.h */
1077#define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
1078#ifndef CONTAINING_RECORD
1079#define CONTAINING_RECORD(address, type, field) \
1080 ((type*)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
1081#endif
1082/* end winddk.h */
1083#define IMAGE_SIZEOF_FILE_HEADER 20
1084#define IMAGE_FILE_RELOCS_STRIPPED 1
1085#define IMAGE_FILE_EXECUTABLE_IMAGE 2
1086#define IMAGE_FILE_LINE_NUMS_STRIPPED 4
1087#define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
1088#define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
1089#define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
1090#define IMAGE_FILE_BYTES_REVERSED_LO 128
1091#define IMAGE_FILE_32BIT_MACHINE 256
1092#define IMAGE_FILE_DEBUG_STRIPPED 512
1093#define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
1094#define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
1095#define IMAGE_FILE_SYSTEM 4096
1096#define IMAGE_FILE_DLL 8192
1097#define IMAGE_FILE_UP_SYSTEM_ONLY 16384
1098#define IMAGE_FILE_BYTES_REVERSED_HI 32768
1099
1100#define IMAGE_FILE_MACHINE_UNKNOWN 0x0000
1101#define IMAGE_FILE_MACHINE_AM33 0x01d3 /* Matsushita AM33 */
1102#define IMAGE_FILE_MACHINE_AMD64 0x8664 /* x64 */
1103#define IMAGE_FILE_MACHINE_ARM 0x01c0 /* ARM little endian */
1104#define IMAGE_FILE_MACHINE_EBC 0x0ebc /* EFI byte code */
1105#define IMAGE_FILE_MACHINE_I386 0x014c /* Intel 386 or later processors and compatible processors */
1106#define IMAGE_FILE_MACHINE_IA64 0x0200 /* Intel Itanium processor family */
1107#define IMAGE_FILE_MACHINE_M32R 0x9041 /* Mitsubishi M32R little endian */
1108#define IMAGE_FILE_MACHINE_MIPS16 0x0266 /* MIPS16 */
1109#define IMAGE_FILE_MACHINE_MIPSFPU 0x0366 /* MIPS with FPU */
1110#define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466 /* MIPS16 with FPU */
1111#define IMAGE_FILE_MACHINE_POWERPC 0x01f0 /* Power PC little endian */
1112#define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1 /* Power PC with floating point support */
1113#define IMAGE_FILE_MACHINE_R4000 0x0166 /* MIPS little endian */
1114#define IMAGE_FILE_MACHINE_SH3 0x01a2 /* Hitachi SH3 */
1115#define IMAGE_FILE_MACHINE_SH3DSP 0x01a3 /* Hitachi SH3 DSP */
1116#define IMAGE_FILE_MACHINE_SH4 0x01a6 /* Hitachi SH4 */
1117#define IMAGE_FILE_MACHINE_SH5 0x01a8 /* Hitachi SH5 */
1118#define IMAGE_FILE_MACHINE_THUMB 0x01c2 /* Thumb */
1119#define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169 /* MIPS little-endian WCE v2 */
1120
1121#define IMAGE_DOS_SIGNATURE 0x5A4D
1122#define IMAGE_OS2_SIGNATURE 0x454E
1123#define IMAGE_OS2_SIGNATURE_LE 0x454C
1124#define IMAGE_VXD_SIGNATURE 0x454C
1125#define IMAGE_NT_SIGNATURE 0x00004550
1126#define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
1127#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
1128#ifdef _WIN64
1129#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
1130#else
1131#define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
1132#endif
1133#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1134#define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
1135#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1136#define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1137#define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1138#define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1139#define IMAGE_SIZEOF_SHORT_NAME 8
1140#define IMAGE_SIZEOF_SECTION_HEADER 40
1141#define IMAGE_SIZEOF_SYMBOL 18
1142#define IMAGE_SIZEOF_AUX_SYMBOL 18
1143#define IMAGE_SIZEOF_RELOCATION 10
1144#define IMAGE_SIZEOF_BASE_RELOCATION 8
1145#define IMAGE_SIZEOF_LINENUMBER 6
1146#define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1147#define SIZEOF_RFPO_DATA 16
1148
1149#define IMAGE_SUBSYSTEM_UNKNOWN 0
1150#define IMAGE_SUBSYSTEM_NATIVE 1
1151#define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
1152#define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
1153#define IMAGE_SUBSYSTEM_OS2_CUI 5 /* Not in PECOFF v8 spec */
1154#define IMAGE_SUBSYSTEM_POSIX_CUI 7
1155#define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* Not in PECOFF v8 spec */
1156#define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
1157#define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1158#define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1159#define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1160#define IMAGE_SUBSYSTEM_EFI_ROM 13
1161#define IMAGE_SUBSYSTEM_XBOX 14
1162
1163#define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
1164#define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
1165#define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
1166#define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
1167#define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
1168#define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
1169#define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
1170#define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
1171
1172/* Keep broken definitions for backward compatibility. */
1173#define IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE
1174#define IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY
1175#define IMAGE_DLL_CHARACTERISTICS_NX_COMPAT IMAGE_DLLCHARACTERISTICS_NX_COMPAT
1176
1177#define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((DWORD)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
1178#define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1179#define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1180#define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1181#define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1182#define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1183#define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1184#define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1185#define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1186#define IMAGE_DIRECTORY_ENTRY_ARCHITECTURE 7
1187#define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
1188#define IMAGE_DIRECTORY_ENTRY_TLS 9
1189#define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1190#define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1191#define IMAGE_DIRECTORY_ENTRY_IAT 12
1192#define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1193#define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1194#define IMAGE_SCN_TYPE_REG 0
1195#define IMAGE_SCN_TYPE_DSECT 1
1196#define IMAGE_SCN_TYPE_NOLOAD 2
1197#define IMAGE_SCN_TYPE_GROUP 4
1198#define IMAGE_SCN_TYPE_NO_PAD 8
1199#define IMAGE_SCN_TYPE_COPY 16
1200#define IMAGE_SCN_CNT_CODE 32
1201#define IMAGE_SCN_CNT_INITIALIZED_DATA 64
1202#define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
1203#define IMAGE_SCN_LNK_OTHER 256
1204#define IMAGE_SCN_LNK_INFO 512
1205#define IMAGE_SCN_TYPE_OVER 1024
1206#define IMAGE_SCN_LNK_REMOVE 2048
1207#define IMAGE_SCN_LNK_COMDAT 4096
1208#define IMAGE_SCN_GPREL 0x8000 /* Valid only for IA64 */
1209#define IMAGE_SCN_MEM_FARDATA 0x8000 /* Not in PECOFF v8 spec */
1210#define IMAGE_SCN_MEM_PURGEABLE 0x20000
1211#define IMAGE_SCN_MEM_16BIT 0x20000
1212#define IMAGE_SCN_MEM_LOCKED 0x40000
1213#define IMAGE_SCN_MEM_PRELOAD 0x80000
1214#define IMAGE_SCN_ALIGN_1BYTES 0x100000
1215#define IMAGE_SCN_ALIGN_2BYTES 0x200000
1216#define IMAGE_SCN_ALIGN_4BYTES 0x300000
1217#define IMAGE_SCN_ALIGN_8BYTES 0x400000
1218#define IMAGE_SCN_ALIGN_16BYTES 0x500000
1219#define IMAGE_SCN_ALIGN_32BYTES 0x600000
1220#define IMAGE_SCN_ALIGN_64BYTES 0x700000
1221#define IMAGE_SCN_ALIGN_128BYTES 0x800000
1222#define IMAGE_SCN_ALIGN_256BYTES 0x900000
1223#define IMAGE_SCN_ALIGN_512BYTES 0xa00000
1224#define IMAGE_SCN_ALIGN_1024BYTES 0xb00000
1225#define IMAGE_SCN_ALIGN_2048BYTES 0xc00000
1226#define IMAGE_SCN_ALIGN_4096BYTES 0xd00000
1227#define IMAGE_SCN_ALIGN_8192BYTES 0xe00000
1228#define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
1229#define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
1230#define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
1231#define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
1232#define IMAGE_SCN_MEM_SHARED 0x10000000
1233#define IMAGE_SCN_MEM_EXECUTE 0x20000000
1234#define IMAGE_SCN_MEM_READ 0x40000000
1235#define IMAGE_SCN_MEM_WRITE 0x80000000
1236#define IMAGE_SYM_UNDEFINED 0
1237#define IMAGE_SYM_ABSOLUTE (-1)
1238#define IMAGE_SYM_DEBUG (-2)
1239#define IMAGE_SYM_TYPE_NULL 0
1240#define IMAGE_SYM_TYPE_VOID 1
1241#define IMAGE_SYM_TYPE_CHAR 2
1242#define IMAGE_SYM_TYPE_SHORT 3
1243#define IMAGE_SYM_TYPE_INT 4
1244#define IMAGE_SYM_TYPE_LONG 5
1245#define IMAGE_SYM_TYPE_FLOAT 6
1246#define IMAGE_SYM_TYPE_DOUBLE 7
1247#define IMAGE_SYM_TYPE_STRUCT 8
1248#define IMAGE_SYM_TYPE_UNION 9
1249#define IMAGE_SYM_TYPE_ENUM 10
1250#define IMAGE_SYM_TYPE_MOE 11
1251#define IMAGE_SYM_TYPE_BYTE 12
1252#define IMAGE_SYM_TYPE_WORD 13
1253#define IMAGE_SYM_TYPE_UINT 14
1254#define IMAGE_SYM_TYPE_DWORD 15
1255#define IMAGE_SYM_TYPE_PCODE 32768
1256#define IMAGE_SYM_DTYPE_NULL 0
1257#define IMAGE_SYM_DTYPE_POINTER 1
1258#define IMAGE_SYM_DTYPE_FUNCTION 2
1259#define IMAGE_SYM_DTYPE_ARRAY 3
1260#define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1261#define IMAGE_SYM_CLASS_NULL 0
1262#define IMAGE_SYM_CLASS_AUTOMATIC 1
1263#define IMAGE_SYM_CLASS_EXTERNAL 2
1264#define IMAGE_SYM_CLASS_STATIC 3
1265#define IMAGE_SYM_CLASS_REGISTER 4
1266#define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1267#define IMAGE_SYM_CLASS_LABEL 6
1268#define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1269#define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1270#define IMAGE_SYM_CLASS_ARGUMENT 9
1271#define IMAGE_SYM_CLASS_STRUCT_TAG 10
1272#define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1273#define IMAGE_SYM_CLASS_UNION_TAG 12
1274#define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1275#define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1276#define IMAGE_SYM_CLASS_ENUM_TAG 15
1277#define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1278#define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1279#define IMAGE_SYM_CLASS_BIT_FIELD 18
1280#define IMAGE_SYM_CLASS_FAR_EXTERNAL 68 /* Not in PECOFF v8 spec */
1281#define IMAGE_SYM_CLASS_BLOCK 100
1282#define IMAGE_SYM_CLASS_FUNCTION 101
1283#define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1284#define IMAGE_SYM_CLASS_FILE 103
1285#define IMAGE_SYM_CLASS_SECTION 104
1286#define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1287#define IMAGE_SYM_CLASS_CLR_TOKEN 107
1288
1289#define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1290#define IMAGE_COMDAT_SELECT_ANY 2
1291#define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1292#define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1293#define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1294#define IMAGE_COMDAT_SELECT_LARGEST 6
1295#define IMAGE_COMDAT_SELECT_NEWEST 7 /* Not in PECOFF v8 spec */
1296
1297#define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1298#define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1299#define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1300
1301#define IMAGE_REL_I386_ABSOLUTE 0x0000
1302#define IMAGE_REL_I386_DIR16 0x0001
1303#define IMAGE_REL_I386_REL16 0x0002
1304#define IMAGE_REL_I386_DIR32 0x0006
1305#define IMAGE_REL_I386_DIR32NB 0x0007
1306#define IMAGE_REL_I386_SEG12 0x0009
1307#define IMAGE_REL_I386_SECTION 0x000A
1308#define IMAGE_REL_I386_SECREL 0x000B
1309#define IMAGE_REL_I386_TOKEN 0x000C
1310#define IMAGE_REL_I386_SECREL7 0x000D
1311#define IMAGE_REL_I386_REL32 0x0014
1312
1313#define IMAGE_REL_AMD64_ABSOLUTE 0x0000
1314#define IMAGE_REL_AMD64_ADDR64 0x0001
1315#define IMAGE_REL_AMD64_ADDR32 0x0002
1316#define IMAGE_REL_AMD64_ADDR32NB 0x0003
1317#define IMAGE_REL_AMD64_REL32 0x0004
1318#define IMAGE_REL_AMD64_REL32_1 0x0005
1319#define IMAGE_REL_AMD64_REL32_2 0x0006
1320#define IMAGE_REL_AMD64_REL32_3 0x0007
1321#define IMAGE_REL_AMD64_REL32_4 0x0008
1322#define IMAGE_REL_AMD64_REL32_5 0x0009
1323#define IMAGE_REL_AMD64_SECTION 0x000A
1324#define IMAGE_REL_AMD64_SECREL 0x000B
1325#define IMAGE_REL_AMD64_SECREL7 0x000C
1326#define IMAGE_REL_AMD64_TOKEN 0x000D
1327#define IMAGE_REL_AMD64_SREL32 0x000E
1328#define IMAGE_REL_AMD64_PAIR 0x000F
1329#define IMAGE_REL_AMD64_SSPAN32 0x0010
1330
1331#define IMAGE_REL_IA64_ABSOLUTE 0x0000
1332#define IMAGE_REL_IA64_IMM14 0x0001
1333#define IMAGE_REL_IA64_IMM22 0x0002
1334#define IMAGE_REL_IA64_IMM64 0x0003
1335#define IMAGE_REL_IA64_DIR32 0x0004
1336#define IMAGE_REL_IA64_DIR64 0x0005
1337#define IMAGE_REL_IA64_PCREL21B 0x0006
1338#define IMAGE_REL_IA64_PCREL21M 0x0007
1339#define IMAGE_REL_IA64_PCREL21F 0x0008
1340#define IMAGE_REL_IA64_GPREL22 0x0009
1341#define IMAGE_REL_IA64_LTOFF22 0x000A
1342#define IMAGE_REL_IA64_SECTION 0x000B
1343#define IMAGE_REL_IA64_SECREL22 0x000C
1344#define IMAGE_REL_IA64_SECREL64I 0x000D
1345#define IMAGE_REL_IA64_SECREL32 0x000E
1346#define IMAGE_REL_IA64_DIR32NB 0x0010
1347#define IMAGE_REL_IA64_SREL14 0x0011
1348#define IMAGE_REL_IA64_SREL22 0x0012
1349#define IMAGE_REL_IA64_SREL32 0x0013
1350#define IMAGE_REL_IA64_UREL32 0x0014
1351#define IMAGE_REL_IA64_PCREL60X 0x0015
1352#define IMAGE_REL_IA64_PCREL60B 0x0016
1353#define IMAGE_REL_IA64_PCREL60F 0x0017
1354#define IMAGE_REL_IA64_PCREL60I 0x0018
1355#define IMAGE_REL_IA64_PCREL60M 0x0019
1356#define IMAGE_REL_IA64_IMMGPREL64 0x001a
1357#define IMAGE_REL_IA64_TOKEN 0x001b
1358#define IMAGE_REL_IA64_GPREL32 0x001c
1359#define IMAGE_REL_IA64_ADDEND 0x001F
1360
1361#define IMAGE_REL_SH3_ABSOLUTE 0x0000
1362#define IMAGE_REL_SH3_DIRECT16 0x0001
1363#define IMAGE_REL_SH3_DIRECT32 0x0002
1364#define IMAGE_REL_SH3_DIRECT8 0x0003
1365#define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
1366#define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
1367#define IMAGE_REL_SH3_DIRECT4 0x0006
1368#define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
1369#define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
1370#define IMAGE_REL_SH3_PCREL8_WORD 0x0009
1371#define IMAGE_REL_SH3_PCREL8_LONG 0x000A
1372#define IMAGE_REL_SH3_PCREL12_WORD 0x000B
1373#define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
1374#define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
1375#define IMAGE_REL_SH3_SECTION 0x000E
1376#define IMAGE_REL_SH3_SECREL 0x000F
1377#define IMAGE_REL_SH3_DIRECT32_NB 0x0010
1378#define IMAGE_REL_SH3_GPREL4_LONG 0x0011
1379#define IMAGE_REL_SH3_TOKEN 0x0012
1380#define IMAGE_REL_SHM_PCRELPT 0x0013
1381#define IMAGE_REL_SHM_REFLO 0x0014
1382#define IMAGE_REL_SHM_REFHALF 0x0015
1383#define IMAGE_REL_SHM_RELLO 0x0016
1384#define IMAGE_REL_SHM_RELHALF 0x0017
1385#define IMAGE_REL_SHM_PAIR 0x0018
1386#define IMAGE_REL_SHM_NOMODE 0x8000
1387
1388#define IMAGE_REL_M32R_ABSOLUTE 0x0000
1389#define IMAGE_REL_M32R_ADDR32 0x0001
1390#define IMAGE_REL_M32R_ADDR32NB 0x0002
1391#define IMAGE_REL_M32R_ADDR24 0x0003
1392#define IMAGE_REL_M32R_GPREL16 0x0004
1393#define IMAGE_REL_M32R_PCREL24 0x0005
1394#define IMAGE_REL_M32R_PCREL16 0x0006
1395#define IMAGE_REL_M32R_PCREL8 0x0007
1396#define IMAGE_REL_M32R_REFHALF 0x0008
1397#define IMAGE_REL_M32R_REFHI 0x0009
1398#define IMAGE_REL_M32R_REFLO 0x000A
1399#define IMAGE_REL_M32R_PAIR 0x000B
1400#define IMAGE_REL_M32R_SECTION 0x000C
1401#define IMAGE_REL_M32R_SECREL 0x000D
1402#define IMAGE_REL_M32R_TOKEN 0x000E
1403
1404#define IMAGE_REL_MIPS_ABSOLUTE 0x0000
1405#define IMAGE_REL_MIPS_REFHALF 0x0001
1406#define IMAGE_REL_MIPS_REFWORD 0x0002
1407#define IMAGE_REL_MIPS_JMPADDR 0x0003
1408#define IMAGE_REL_MIPS_REFHI 0x0004
1409#define IMAGE_REL_MIPS_REFLO 0x0005
1410#define IMAGE_REL_MIPS_GPREL 0x0006
1411#define IMAGE_REL_MIPS_LITERAL 0x0007
1412#define IMAGE_REL_MIPS_SECTION 0x000A
1413#define IMAGE_REL_MIPS_SECREL 0x000B
1414#define IMAGE_REL_MIPS_SECRELLO 0x000C
1415#define IMAGE_REL_MIPS_SECRELHI 0x000D
1416#define IMAGE_REL_MIPS_JMPADDR16 0x0010
1417#define IMAGE_REL_MIPS_REFWORDNB 0x0022
1418#define IMAGE_REL_MIPS_PAIR 0x0025
1419
1420#define IMAGE_REL_ALPHA_ABSOLUTE 0
1421#define IMAGE_REL_ALPHA_REFLONG 1
1422#define IMAGE_REL_ALPHA_REFQUAD 2
1423#define IMAGE_REL_ALPHA_GPREL32 3
1424#define IMAGE_REL_ALPHA_LITERAL 4
1425#define IMAGE_REL_ALPHA_LITUSE 5
1426#define IMAGE_REL_ALPHA_GPDISP 6
1427#define IMAGE_REL_ALPHA_BRADDR 7
1428#define IMAGE_REL_ALPHA_HINT 8
1429#define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1430#define IMAGE_REL_ALPHA_REFHI 10
1431#define IMAGE_REL_ALPHA_REFLO 11
1432#define IMAGE_REL_ALPHA_PAIR 12
1433#define IMAGE_REL_ALPHA_MATCH 13
1434#define IMAGE_REL_ALPHA_SECTION 14
1435#define IMAGE_REL_ALPHA_SECREL 15
1436#define IMAGE_REL_ALPHA_REFLONGNB 16
1437#define IMAGE_REL_ALPHA_SECRELLO 17
1438#define IMAGE_REL_ALPHA_SECRELHI 18
1439#define IMAGE_REL_PPC_ABSOLUTE 0
1440#define IMAGE_REL_PPC_ADDR64 1
1441#define IMAGE_REL_PPC_ADDR32 2
1442#define IMAGE_REL_PPC_ADDR24 3
1443#define IMAGE_REL_PPC_ADDR16 4
1444#define IMAGE_REL_PPC_ADDR14 5
1445#define IMAGE_REL_PPC_REL24 6
1446#define IMAGE_REL_PPC_REL14 7
1447#define IMAGE_REL_PPC_TOCREL16 8
1448#define IMAGE_REL_PPC_TOCREL14 9
1449#define IMAGE_REL_PPC_ADDR32NB 10
1450#define IMAGE_REL_PPC_SECREL 11
1451#define IMAGE_REL_PPC_SECTION 12
1452#define IMAGE_REL_PPC_IFGLUE 13
1453#define IMAGE_REL_PPC_IMGLUE 14
1454#define IMAGE_REL_PPC_SECREL16 15
1455#define IMAGE_REL_PPC_REFHI 16
1456#define IMAGE_REL_PPC_REFLO 17
1457#define IMAGE_REL_PPC_PAIR 18
1458#define IMAGE_REL_PPC_TYPEMASK 255
1459#define IMAGE_REL_PPC_NEG 256
1460#define IMAGE_REL_PPC_BRTAKEN 512
1461#define IMAGE_REL_PPC_BRNTAKEN 1024
1462#define IMAGE_REL_PPC_TOCDEFN 2048
1463#define IMAGE_REL_BASED_ABSOLUTE 0
1464#define IMAGE_REL_BASED_HIGH 1
1465#define IMAGE_REL_BASED_LOW 2
1466#define IMAGE_REL_BASED_HIGHLOW 3
1467#define IMAGE_REL_BASED_HIGHADJ 4
1468#define IMAGE_REL_BASED_MIPS_JMPADDR 5
1469#define IMAGE_ARCHIVE_START_SIZE 8
1470#define IMAGE_ARCHIVE_START "!<arch>\n"
1471#define IMAGE_ARCHIVE_END "`\n"
1472#define IMAGE_ARCHIVE_PAD "\n"
1473#define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1474#define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1475#define IMAGE_ORDINAL_FLAG32 0x80000000
1476#define IMAGE_SNAP_BY_ORDINAL32(o) ((o&IMAGE_ORDINAL_FLAG32)!=0)
1477#define IMAGE_ORDINAL32(o) (o&0xffff)
1478#define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL
1479#define IMAGE_SNAP_BY_ORDINAL64(o) ((o&IMAGE_ORDINAL_FLAG64)!=0)
1480#define IMAGE_ORDINAL64(o) (o&0xffff)
1481#ifdef _WIN64
1482#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
1483#define IMAGE_SNAP_BY_ORDINAL(o) IMAGE_SNAP_BY_ORDINAL64(o)
1484#define IMAGE_ORDINAL(o) IMAGE_ORDINAL64(o)
1485#else
1486#define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
1487#define IMAGE_SNAP_BY_ORDINAL(o) IMAGE_SNAP_BY_ORDINAL32(o)
1488#define IMAGE_ORDINAL(o) IMAGE_ORDINAL32(o)
1489#endif
1490#define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1491#define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1492#define IMAGE_DEBUG_TYPE_UNKNOWN 0
1493#define IMAGE_DEBUG_TYPE_COFF 1
1494#define IMAGE_DEBUG_TYPE_CODEVIEW 2
1495#define IMAGE_DEBUG_TYPE_FPO 3
1496#define IMAGE_DEBUG_TYPE_MISC 4
1497#define IMAGE_DEBUG_TYPE_EXCEPTION 5
1498#define IMAGE_DEBUG_TYPE_FIXUP 6
1499#define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
1500#define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
1501#define IMAGE_DEBUG_TYPE_BORLAND 9
1502#define FRAME_FPO 0
1503#define FRAME_TRAP 1
1504#define FRAME_TSS 2
1505#define FRAME_NONFPO 3
1506#define IMAGE_DEBUG_MISC_EXENAME 1
1507#define N_BTMASK 0x000F
1508#define N_TMASK 0x0030
1509#define N_TMASK1 0x00C0
1510#define N_TMASK2 0x00F0
1511#define N_BTSHFT 4
1512#define N_TSHIFT 2
1513#define IS_TEXT_UNICODE_ASCII16 1
1514#define IS_TEXT_UNICODE_REVERSE_ASCII16 16
1515#define IS_TEXT_UNICODE_STATISTICS 2
1516#define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
1517#define IS_TEXT_UNICODE_CONTROLS 4
1518#define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
1519#define IS_TEXT_UNICODE_SIGNATURE 8
1520#define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
1521#define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
1522#define IS_TEXT_UNICODE_ODD_LENGTH 512
1523#define IS_TEXT_UNICODE_NULL_BYTES 4096
1524#define IS_TEXT_UNICODE_UNICODE_MASK 15
1525#define IS_TEXT_UNICODE_REVERSE_MASK 240
1526#define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
1527#define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
1528#define SERVICE_KERNEL_DRIVER 1
1529#define SERVICE_FILE_SYSTEM_DRIVER 2
1530#define SERVICE_ADAPTER 4
1531#define SERVICE_RECOGNIZER_DRIVER 8
1532#define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
1533#define SERVICE_WIN32_OWN_PROCESS 16
1534#define SERVICE_WIN32_SHARE_PROCESS 32
1535#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
1536#define SERVICE_INTERACTIVE_PROCESS 256
1537#define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
1538#define SERVICE_BOOT_START 0
1539#define SERVICE_SYSTEM_START 1
1540#define SERVICE_AUTO_START 2
1541#define SERVICE_DEMAND_START 3
1542#define SERVICE_DISABLED 4
1543#define SERVICE_ERROR_IGNORE 0
1544#define SERVICE_ERROR_NORMAL 1
1545#define SERVICE_ERROR_SEVERE 2
1546#define SERVICE_ERROR_CRITICAL 3
1547#define SE_OWNER_DEFAULTED 1
1548#define SE_GROUP_DEFAULTED 2
1549#define SE_DACL_PRESENT 4
1550#define SE_DACL_DEFAULTED 8
1551#define SE_SACL_PRESENT 16
1552#define SE_SACL_DEFAULTED 32
1553#define SE_DACL_AUTO_INHERIT_REQ 256
1554#define SE_SACL_AUTO_INHERIT_REQ 512
1555#define SE_DACL_AUTO_INHERITED 1024
1556#define SE_SACL_AUTO_INHERITED 2048
1557#define SE_DACL_PROTECTED 4096
1558#define SE_SACL_PROTECTED 8192
1559#define SE_SELF_RELATIVE 0x8000
1560#define SECURITY_DESCRIPTOR_MIN_LENGTH 20
1561#define SECURITY_DESCRIPTOR_REVISION 1
1562#define SECURITY_DESCRIPTOR_REVISION1 1
1563#define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
1564#define SE_PRIVILEGE_ENABLED 2
1565#define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
1566#define PRIVILEGE_SET_ALL_NECESSARY 1
1567#define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
1568#define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
1569#define SECURITY_DYNAMIC_TRACKING TRUE
1570#define SECURITY_STATIC_TRACKING FALSE
1571/* also in ddk/ntifs.h */
1572#define TOKEN_ASSIGN_PRIMARY (0x0001)
1573#define TOKEN_DUPLICATE (0x0002)
1574#define TOKEN_IMPERSONATE (0x0004)
1575#define TOKEN_QUERY (0x0008)
1576#define TOKEN_QUERY_SOURCE (0x0010)
1577#define TOKEN_ADJUST_PRIVILEGES (0x0020)
1578#define TOKEN_ADJUST_GROUPS (0x0040)
1579#define TOKEN_ADJUST_DEFAULT (0x0080)
1580
1581#define TOKEN_ALL_ACCESS \
1582 ( STANDARD_RIGHTS_REQUIRED | TOKEN_ASSIGN_PRIMARY | TOKEN_DUPLICATE | \
1583 TOKEN_IMPERSONATE | TOKEN_QUERY | TOKEN_QUERY_SOURCE | \
1584 TOKEN_ADJUST_PRIVILEGES | TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT \
1585 )
1586#define TOKEN_READ ( STANDARD_RIGHTS_READ | TOKEN_QUERY )
1587#define TOKEN_WRITE \
1588 ( STANDARD_RIGHTS_WRITE | TOKEN_ADJUST_PRIVILEGES | \
1589 TOKEN_ADJUST_GROUPS | TOKEN_ADJUST_DEFAULT \
1590 )
1591#define TOKEN_EXECUTE ( STANDARD_RIGHTS_EXECUTE )
1592
1593#define TOKEN_SOURCE_LENGTH 8
1594#if (_WIN32_WINNT >= 0x0600)
1595#define TOKEN_MANDATORY_POLICY_OFF 0
1596#define TOKEN_MANDATORY_POLICY_NO_WRITE_UP 1
1597#define TOKEN_MANDATORY_POLICY_NEW_PROCESS_MIN 2
1598#define TOKEN_MANDATORY_POLICY_VALID_MASK 3
1599#endif
1600/* end ddk/ntifs.h */
1601#define DLL_PROCESS_DETACH 0
1602#define DLL_PROCESS_ATTACH 1
1603#define DLL_THREAD_ATTACH 2
1604#define DLL_THREAD_DETACH 3
1605#define DBG_CONTINUE 0x10002
1606#define DBG_TERMINATE_THREAD 0x40010003
1607#define DBG_TERMINATE_PROCESS 0x40010004
1608#define DBG_CONTROL_C 0x40010005
1609#define DBG_CONTROL_BREAK 0x40010008
1610#define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1611#define TAPE_ABSOLUTE_POSITION 0
1612#define TAPE_LOGICAL_POSITION 1
1613#define TAPE_PSEUDO_LOGICAL_POSITION 2
1614#define TAPE_REWIND 0
1615#define TAPE_ABSOLUTE_BLOCK 1
1616#define TAPE_LOGICAL_BLOCK 2
1617#define TAPE_PSEUDO_LOGICAL_BLOCK 3
1618#define TAPE_SPACE_END_OF_DATA 4
1619#define TAPE_SPACE_RELATIVE_BLOCKS 5
1620#define TAPE_SPACE_FILEMARKS 6
1621#define TAPE_SPACE_SEQUENTIAL_FMKS 7
1622#define TAPE_SPACE_SETMARKS 8
1623#define TAPE_SPACE_SEQUENTIAL_SMKS 9
1624#define TAPE_DRIVE_FIXED 1
1625#define TAPE_DRIVE_SELECT 2
1626#define TAPE_DRIVE_INITIATOR 4
1627#define TAPE_DRIVE_ERASE_SHORT 16
1628#define TAPE_DRIVE_ERASE_LONG 32
1629#define TAPE_DRIVE_ERASE_BOP_ONLY 64
1630#define TAPE_DRIVE_ERASE_IMMEDIATE 128
1631#define TAPE_DRIVE_TAPE_CAPACITY 256
1632#define TAPE_DRIVE_TAPE_REMAINING 512
1633#define TAPE_DRIVE_FIXED_BLOCK 1024
1634#define TAPE_DRIVE_VARIABLE_BLOCK 2048
1635#define TAPE_DRIVE_WRITE_PROTECT 4096
1636#define TAPE_DRIVE_EOT_WZ_SIZE 8192
1637#define TAPE_DRIVE_ECC 0x10000
1638#define TAPE_DRIVE_COMPRESSION 0x20000
1639#define TAPE_DRIVE_PADDING 0x40000
1640#define TAPE_DRIVE_REPORT_SMKS 0x80000
1641#define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
1642#define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
1643#define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
1644#define TAPE_DRIVE_EJECT_MEDIA 0x1000000
1645#define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
1646#define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
1647#define TAPE_DRIVE_RESERVED_BIT 0x80000000
1648#define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
1649#define TAPE_DRIVE_TENSION 0x80000002
1650#define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
1651#define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
1652#define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
1653#define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
1654#define TAPE_DRIVE_TENSION_IMMED 0x80000040
1655#define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
1656#define TAPE_DRIVE_SET_ECC 0x80000100
1657#define TAPE_DRIVE_SET_COMPRESSION 0x80000200
1658#define TAPE_DRIVE_SET_PADDING 0x80000400
1659#define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
1660#define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
1661#define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
1662#define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1663#define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1664#define TAPE_DRIVE_END_OF_DATA 0x80010000
1665#define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1666#define TAPE_DRIVE_FILEMARKS 0x80040000
1667#define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1668#define TAPE_DRIVE_SETMARKS 0x80100000
1669#define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1670#define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1671#define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1672#define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1673#define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1674#define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1675#define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1676#define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1677#define TAPE_DRIVE_FORMAT 0xA0000000
1678#define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1679#define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1680#define TAPE_FIXED_PARTITIONS 0
1681#define TAPE_INITIATOR_PARTITIONS 2
1682#define TAPE_SELECT_PARTITIONS 1
1683#define TAPE_FILEMARKS 1
1684#define TAPE_LONG_FILEMARKS 3
1685#define TAPE_SETMARKS 0
1686#define TAPE_SHORT_FILEMARKS 2
1687#define TAPE_ERASE_LONG 1
1688#define TAPE_ERASE_SHORT 0
1689#define TAPE_LOAD 0
1690#define TAPE_UNLOAD 1
1691#define TAPE_TENSION 2
1692#define TAPE_LOCK 3
1693#define TAPE_UNLOCK 4
1694#define TAPE_FORMAT 5
1695#if (_WIN32_WINNT >= 0x0500)
1696#define VER_MINORVERSION 0x0000001
1697#define VER_MAJORVERSION 0x0000002
1698#define VER_BUILDNUMBER 0x0000004
1699#define VER_PLATFORMID 0x0000008
1700#define VER_SERVICEPACKMINOR 0x0000010
1701#define VER_SERVICEPACKMAJOR 0x0000020
1702#define VER_SUITENAME 0x0000040
1703#define VER_PRODUCT_TYPE 0x0000080
1704#define VER_EQUAL 1
1705#define VER_GREATER 2
1706#define VER_GREATER_EQUAL 3
1707#define VER_LESS 4
1708#define VER_LESS_EQUAL 5
1709#define VER_AND 6
1710#define VER_OR 7
1711#endif
1712#define VER_PLATFORM_WIN32s 0
1713#define VER_PLATFORM_WIN32_WINDOWS 1
1714#define VER_PLATFORM_WIN32_NT 2
1715#define VER_NT_WORKSTATION 1
1716#define VER_NT_DOMAIN_CONTROLLER 2
1717#define VER_NT_SERVER 3
1718#define VER_SUITE_SMALLBUSINESS 1
1719#define VER_SUITE_ENTERPRISE 2
1720#define VER_SUITE_BACKOFFICE 4
1721#define VER_SUITE_TERMINAL 16
1722#define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
1723#define VER_SUITE_EMBEDDEDNT 64
1724#define VER_SUITE_DATACENTER 128
1725#define VER_SUITE_SINGLEUSERTS 256
1726#define VER_SUITE_PERSONAL 512
1727#define VER_SUITE_BLADE 1024
1728#define VER_SUITE_STORAGE_SERVER 8192
1729#define VER_SUITE_COMPUTE_SERVER 16384
1730#define WT_EXECUTEDEFAULT 0x00000000
1731#define WT_EXECUTEINIOTHREAD 0x00000001
1732#define WT_EXECUTEINWAITTHREAD 0x00000004
1733#define WT_EXECUTEONLYONCE 0x00000008
1734#define WT_EXECUTELONGFUNCTION 0x00000010
1735#define WT_EXECUTEINTIMERTHREAD 0x00000020
1736#define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1737#define WT_TRANSFER_IMPERSONATION 0x00000100
1738#if (_WIN32_WINNT >= 0x0501)
1739#define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1740#define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1741#define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1742#define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1743#define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1744#define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1745#define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1746#define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1747#endif /* (_WIN32_WINNT >= 0x0501) */
1748
1749#define BTYPE(x) ((x)&N_BTMASK)
1750#define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1751#define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1752#define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1753#define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1754#define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1755#define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1756
1757#define TLS_MINIMUM_AVAILABLE 64
1758#define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
1759#define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1760#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1761#define IO_REPARSE_TAG_RESERVED_ZERO 0
1762#define IO_REPARSE_TAG_RESERVED_ONE 1
1763#define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1764#define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1765#define IsReparseTagHighLatency(x) ((x)&0x40000000)
1766#define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1767#define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1768#define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1769#define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1770#define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1771#define IO_REPARSE_TAG_SYMLINK 0xA000000C
1772
1773#define WT_SET_MAX_THREADPOOL_THREADS(Flags,Limit) ((Flags)|=(Limit)<<16)
1774#ifndef RC_INVOKED
1775
1776_BEGIN_C_DECLS
1777
1778typedef DWORD ACCESS_MASK, *PACCESS_MASK;
1779
1780#ifdef _GUID_DEFINED
1781# warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1782#endif
1783
1784#if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1785#define GUID_DEFINED
1786typedef struct _GUID
1787{ unsigned long Data1;
1788 unsigned short Data2;
1789 unsigned short Data3;
1790 unsigned char Data4[8];
1791} GUID, *REFGUID, *LPGUID;
1792#define SYSTEM_LUID { 0x3e7, 0x0 }
1793#endif /* GUID_DEFINED */
1794
1795typedef struct _GENERIC_MAPPING
1796{ ACCESS_MASK GenericRead;
1797 ACCESS_MASK GenericWrite;
1798 ACCESS_MASK GenericExecute;
1799 ACCESS_MASK GenericAll;
1800} GENERIC_MAPPING, *PGENERIC_MAPPING;
1801
1802typedef struct _ACE_HEADER
1803{ BYTE AceType;
1804 BYTE AceFlags;
1805 WORD AceSize;
1806} ACE_HEADER, *PACE_HEADER;
1807
1808typedef struct _ACCESS_ALLOWED_ACE
1809{ ACE_HEADER Header;
1810 ACCESS_MASK Mask;
1811 DWORD SidStart;
1812} ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
1813
1814typedef struct _ACCESS_DENIED_ACE
1815{ ACE_HEADER Header;
1816 ACCESS_MASK Mask;
1817 DWORD SidStart;
1818} ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
1819
1820typedef struct _SYSTEM_AUDIT_ACE
1821{ ACE_HEADER Header;
1822 ACCESS_MASK Mask;
1823 DWORD SidStart;
1824} SYSTEM_AUDIT_ACE;
1825typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
1826
1827typedef struct _SYSTEM_ALARM_ACE
1828{ ACE_HEADER Header;
1829 ACCESS_MASK Mask;
1830 DWORD SidStart;
1831} SYSTEM_ALARM_ACE, *PSYSTEM_ALARM_ACE;
1832
1833typedef struct _ACCESS_ALLOWED_OBJECT_ACE
1834{ ACE_HEADER Header;
1835 ACCESS_MASK Mask;
1836 DWORD Flags;
1837 GUID ObjectType;
1838 GUID InheritedObjectType;
1839 DWORD SidStart;
1840} ACCESS_ALLOWED_OBJECT_ACE, *PACCESS_ALLOWED_OBJECT_ACE;
1841
1842typedef struct _ACCESS_DENIED_OBJECT_ACE
1843{ ACE_HEADER Header;
1844 ACCESS_MASK Mask;
1845 DWORD Flags;
1846 GUID ObjectType;
1847 GUID InheritedObjectType;
1848 DWORD SidStart;
1849} ACCESS_DENIED_OBJECT_ACE, *PACCESS_DENIED_OBJECT_ACE;
1850
1851typedef struct _SYSTEM_AUDIT_OBJECT_ACE
1852{ ACE_HEADER Header;
1853 ACCESS_MASK Mask;
1854 DWORD Flags;
1855 GUID ObjectType;
1856 GUID InheritedObjectType;
1857 DWORD SidStart;
1858} SYSTEM_AUDIT_OBJECT_ACE, *PSYSTEM_AUDIT_OBJECT_ACE;
1859
1860typedef struct _SYSTEM_ALARM_OBJECT_ACE
1861{ ACE_HEADER Header;
1862 ACCESS_MASK Mask;
1863 DWORD Flags;
1864 GUID ObjectType;
1865 GUID InheritedObjectType;
1866 DWORD SidStart;
1867} SYSTEM_ALARM_OBJECT_ACE, *PSYSTEM_ALARM_OBJECT_ACE;
1868
1869typedef struct _ACL
1870{ BYTE AclRevision;
1871 BYTE Sbz1;
1872 WORD AclSize;
1873 WORD AceCount;
1874 WORD Sbz2;
1875} ACL, *PACL;
1876
1877typedef struct _ACL_REVISION_INFORMATION
1878{ DWORD AclRevision;
1879} ACL_REVISION_INFORMATION;
1880
1881typedef struct _ACL_SIZE_INFORMATION
1882{ DWORD AceCount;
1883 DWORD AclBytesInUse;
1884 DWORD AclBytesFree;
1885} ACL_SIZE_INFORMATION;
1886
1887/* FIXME: add more machines */
1888#ifdef _X86_
1889#define SIZE_OF_80387_REGISTERS 80
1890#define CONTEXT_i386 0x10000
1891#define CONTEXT_i486 0x10000
1892#define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
1893#define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
1894#define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
1895#define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
1896#define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
1897#define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
1898
1899#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
1900
1901#define MAXIMUM_SUPPORTED_EXTENSION 512
1902
1903typedef struct _FLOATING_SAVE_AREA
1904{ DWORD ControlWord;
1905 DWORD StatusWord;
1906 DWORD TagWord;
1907 DWORD ErrorOffset;
1908 DWORD ErrorSelector;
1909 DWORD DataOffset;
1910 DWORD DataSelector;
1911 BYTE RegisterArea[80];
1912 DWORD Cr0NpxState;
1913} FLOATING_SAVE_AREA;
1914
1915typedef struct _CONTEXT
1916{ DWORD ContextFlags;
1917 DWORD Dr0;
1918 DWORD Dr1;
1919 DWORD Dr2;
1920 DWORD Dr3;
1921 DWORD Dr6;
1922 DWORD Dr7;
1923 FLOATING_SAVE_AREA FloatSave;
1924 DWORD SegGs;
1925 DWORD SegFs;
1926 DWORD SegEs;
1927 DWORD SegDs;
1928 DWORD Edi;
1929 DWORD Esi;
1930 DWORD Ebx;
1931 DWORD Edx;
1932 DWORD Ecx;
1933 DWORD Eax;
1934 DWORD Ebp;
1935 DWORD Eip;
1936 DWORD SegCs;
1937 DWORD EFlags;
1938 DWORD Esp;
1939 DWORD SegSs;
1940 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
1941} CONTEXT;
1942
1943#elif defined(_M_PPC)
1944#define CONTEXT_CONTROL 1L
1945#define CONTEXT_FLOATING_POINT 2L
1946#define CONTEXT_INTEGER 4L
1947#define CONTEXT_DEBUG_REGISTERS 8L
1948#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1949
1950typedef struct
1951{ double Fpr0;
1952 double Fpr1;
1953 double Fpr2;
1954 double Fpr3;
1955 double Fpr4;
1956 double Fpr5;
1957 double Fpr6;
1958 double Fpr7;
1959 double Fpr8;
1960 double Fpr9;
1961 double Fpr10;
1962 double Fpr11;
1963 double Fpr12;
1964 double Fpr13;
1965 double Fpr14;
1966 double Fpr15;
1967 double Fpr16;
1968 double Fpr17;
1969 double Fpr18;
1970 double Fpr19;
1971 double Fpr20;
1972 double Fpr21;
1973 double Fpr22;
1974 double Fpr23;
1975 double Fpr24;
1976 double Fpr25;
1977 double Fpr26;
1978 double Fpr27;
1979 double Fpr28;
1980 double Fpr29;
1981 double Fpr30;
1982 double Fpr31;
1983 double Fpscr;
1984 DWORD Gpr0;
1985 DWORD Gpr1;
1986 DWORD Gpr2;
1987 DWORD Gpr3;
1988 DWORD Gpr4;
1989 DWORD Gpr5;
1990 DWORD Gpr6;
1991 DWORD Gpr7;
1992 DWORD Gpr8;
1993 DWORD Gpr9;
1994 DWORD Gpr10;
1995 DWORD Gpr11;
1996 DWORD Gpr12;
1997 DWORD Gpr13;
1998 DWORD Gpr14;
1999 DWORD Gpr15;
2000 DWORD Gpr16;
2001 DWORD Gpr17;
2002 DWORD Gpr18;
2003 DWORD Gpr19;
2004 DWORD Gpr20;
2005 DWORD Gpr21;
2006 DWORD Gpr22;
2007 DWORD Gpr23;
2008 DWORD Gpr24;
2009 DWORD Gpr25;
2010 DWORD Gpr26;
2011 DWORD Gpr27;
2012 DWORD Gpr28;
2013 DWORD Gpr29;
2014 DWORD Gpr30;
2015 DWORD Gpr31;
2016 DWORD Cr;
2017 DWORD Xer;
2018 DWORD Msr;
2019 DWORD Iar;
2020 DWORD Lr;
2021 DWORD Ctr;
2022 DWORD ContextFlags;
2023 DWORD Fill[3];
2024 DWORD Dr0;
2025 DWORD Dr1;
2026 DWORD Dr2;
2027 DWORD Dr3;
2028 DWORD Dr4;
2029 DWORD Dr5;
2030 DWORD Dr6;
2031 DWORD Dr7;
2032} CONTEXT;
2033
2034#elif defined(_M_ALPHA)
2035#define CONTEXT_ALPHA 0x20000
2036#define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
2037#define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
2038#define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
2039#define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
2040
2041typedef struct _CONTEXT
2042{ ULONGLONG FltF0;
2043 ULONGLONG FltF1;
2044 ULONGLONG FltF2;
2045 ULONGLONG FltF3;
2046 ULONGLONG FltF4;
2047 ULONGLONG FltF5;
2048 ULONGLONG FltF6;
2049 ULONGLONG FltF7;
2050 ULONGLONG FltF8;
2051 ULONGLONG FltF9;
2052 ULONGLONG FltF10;
2053 ULONGLONG FltF11;
2054 ULONGLONG FltF12;
2055 ULONGLONG FltF13;
2056 ULONGLONG FltF14;
2057 ULONGLONG FltF15;
2058 ULONGLONG FltF16;
2059 ULONGLONG FltF17;
2060 ULONGLONG FltF18;
2061 ULONGLONG FltF19;
2062 ULONGLONG FltF20;
2063 ULONGLONG FltF21;
2064 ULONGLONG FltF22;
2065 ULONGLONG FltF23;
2066 ULONGLONG FltF24;
2067 ULONGLONG FltF25;
2068 ULONGLONG FltF26;
2069 ULONGLONG FltF27;
2070 ULONGLONG FltF28;
2071 ULONGLONG FltF29;
2072 ULONGLONG FltF30;
2073 ULONGLONG FltF31;
2074 ULONGLONG IntV0;
2075 ULONGLONG IntT0;
2076 ULONGLONG IntT1;
2077 ULONGLONG IntT2;
2078 ULONGLONG IntT3;
2079 ULONGLONG IntT4;
2080 ULONGLONG IntT5;
2081 ULONGLONG IntT6;
2082 ULONGLONG IntT7;
2083 ULONGLONG IntS0;
2084 ULONGLONG IntS1;
2085 ULONGLONG IntS2;
2086 ULONGLONG IntS3;
2087 ULONGLONG IntS4;
2088 ULONGLONG IntS5;
2089 ULONGLONG IntFp;
2090 ULONGLONG IntA0;
2091 ULONGLONG IntA1;
2092 ULONGLONG IntA2;
2093 ULONGLONG IntA3;
2094 ULONGLONG IntA4;
2095 ULONGLONG IntA5;
2096 ULONGLONG IntT8;
2097 ULONGLONG IntT9;
2098 ULONGLONG IntT10;
2099 ULONGLONG IntT11;
2100 ULONGLONG IntRa;
2101 ULONGLONG IntT12;
2102 ULONGLONG IntAt;
2103 ULONGLONG IntGp;
2104 ULONGLONG IntSp;
2105 ULONGLONG IntZero;
2106 ULONGLONG Fpcr;
2107 ULONGLONG SoftFpcr;
2108 ULONGLONG Fir;
2109 DWORD Psr;
2110 DWORD ContextFlags;
2111 DWORD Fill[4];
2112} CONTEXT;
2113
2114#elif defined(SHx)
2115/* These are the debug or break registers on the SH3 */
2116typedef struct _DEBUG_REGISTERS
2117{ ULONG BarA;
2118 UCHAR BasrA;
2119 UCHAR BamrA;
2120 USHORT BbrA;
2121 ULONG BarB;
2122 UCHAR BasrB;
2123 UCHAR BamrB;
2124 USHORT BbrB;
2125 ULONG BdrB;
2126 ULONG BdmrB;
2127 USHORT Brcr;
2128 USHORT Align;
2129} DEBUG_REGISTERS, *PDEBUG_REGISTERS;
2130
2131/* The following flags control the contents of the CONTEXT structure. */
2132
2133#define CONTEXT_SH3 0x00000040
2134#define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
2135
2136#ifdef SH3
2137#define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
2138#define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
2139#define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
2140#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
2141#else /* SH4 */
2142#define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
2143#define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
2144#define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
2145#define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
2146#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
2147#endif
2148
2149/* Context Frame
2150 * -------------
2151 *
2152 * This frame is used to store a limited processor context into the
2153 * thread structure for CPUs which have no floating point support.
2154 */
2155typedef struct _CONTEXT
2156{ /* The flags values within this structure control the contents
2157 * of a CONTEXT record.
2158 *
2159 * If the context record is used as an input parameter, then
2160 * for each portion of the context record controlled by a flag
2161 * whose value is set, it is assumed that that portion of the
2162 * context record contains valid context. If the context record
2163 * is being used to modify a thread's context, then only that
2164 * portion of the threads context will be modified.
2165 *
2166 * If the context record is used as an IN OUT parameter to
2167 * capture the context of a thread, then only those portions
2168 * of the thread's context corresponding to set flags will be
2169 * returned.
2170 *
2171 * The context record is never used as an OUT only parameter.
2172 */
2173 ULONG ContextFlags;
2174 /*
2175 * This section is specified/returned if the ContextFlags word
2176 * contains the flag CONTEXT_INTEGER.
2177 *
2178 * N.B. The registers RA and R15 are defined in this section,
2179 * but are considered part of the control context rather than
2180 * part of the integer context.
2181 */
2182 ULONG PR;
2183 ULONG MACH;
2184 ULONG MACL;
2185 ULONG GBR;
2186 ULONG R0;
2187 ULONG R1;
2188 ULONG R2;
2189 ULONG R3;
2190 ULONG R4;
2191 ULONG R5;
2192 ULONG R6;
2193 ULONG R7;
2194 ULONG R8;
2195 ULONG R9;
2196 ULONG R10;
2197 ULONG R11;
2198 ULONG R12;
2199 ULONG R13;
2200 ULONG R14;
2201 ULONG R15;
2202 /*
2203 * This section is specified/returned if the ContextFlags
2204 * word contains the flag CONTEXT_CONTROL.
2205 *
2206 * N.B. The registers r15 and ra are defined in the integer
2207 * section, but are considered part of the control context
2208 * rather than part of the integer context.
2209 */
2210 ULONG Fir;
2211 ULONG Psr;
2212#if !defined(SH3e) && !defined(SH4)
2213 ULONG OldStuff[2];
2214 DEBUG_REGISTERS DebugRegisters;
2215#else
2216 ULONG Fpscr;
2217 ULONG Fpul;
2218 ULONG FRegs[16];
2219#if defined(SH4)
2220 ULONG xFRegs[16];
2221#endif
2222#endif
2223} CONTEXT;
2224
2225#elif defined(_M_MRX000) /* MIPS */
2226
2227/* The following flags control the contents of the CONTEXT structure.
2228 */
2229#define CONTEXT_R4000 0x00010000 /* r4000 context */
2230
2231#define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
2232#define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
2233#define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
2234
2235#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
2236
2237/* Context Frame
2238 * -------------
2239 *
2240 * N.B. This frame must be exactly a multiple of 16 bytes in
2241 * length; it has a several purposes:--
2242 *
2243 * 1) it is used as an argument to NtContinue;
2244 * 2) it is used to constuct a call frame for APC delivery;
2245 * 3) it is used to construct a call frame for exception
2246 * dispatching in user mode;
2247 * 4) it is used in user level thread creation routines.
2248 *
2249 * The layout of the record conforms to a standard call frame.
2250 */
2251typedef struct _CONTEXT
2252{ /* This section is always present and is used as an argument
2253 * build area.
2254 */
2255 DWORD Argument[4];
2256 /*
2257 * This section is specified/returned if the ContextFlags word
2258 * contains the flag CONTEXT_FLOATING_POINT.
2259 */
2260 DWORD FltF0;
2261 DWORD FltF1;
2262 DWORD FltF2;
2263 DWORD FltF3;
2264 DWORD FltF4;
2265 DWORD FltF5;
2266 DWORD FltF6;
2267 DWORD FltF7;
2268 DWORD FltF8;
2269 DWORD FltF9;
2270 DWORD FltF10;
2271 DWORD FltF11;
2272 DWORD FltF12;
2273 DWORD FltF13;
2274 DWORD FltF14;
2275 DWORD FltF15;
2276 DWORD FltF16;
2277 DWORD FltF17;
2278 DWORD FltF18;
2279 DWORD FltF19;
2280 DWORD FltF20;
2281 DWORD FltF21;
2282 DWORD FltF22;
2283 DWORD FltF23;
2284 DWORD FltF24;
2285 DWORD FltF25;
2286 DWORD FltF26;
2287 DWORD FltF27;
2288 DWORD FltF28;
2289 DWORD FltF29;
2290 DWORD FltF30;
2291 DWORD FltF31;
2292 /*
2293 * This section is specified/returned if the ContextFlags word
2294 * contains the flag CONTEXT_INTEGER.
2295 *
2296 * N.B. The registers gp, sp, and ra are defined in this section,
2297 * but are considered part of the control context rather than part
2298 * of the integer context.
2299 *
2300 * N.B. Register zero is not stored in the frame.
2301 */
2302 DWORD IntZero;
2303 DWORD IntAt;
2304 DWORD IntV0;
2305 DWORD IntV1;
2306 DWORD IntA0;
2307 DWORD IntA1;
2308 DWORD IntA2;
2309 DWORD IntA3;
2310 DWORD IntT0;
2311 DWORD IntT1;
2312 DWORD IntT2;
2313 DWORD IntT3;
2314 DWORD IntT4;
2315 DWORD IntT5;
2316 DWORD IntT6;
2317 DWORD IntT7;
2318 DWORD IntS0;
2319 DWORD IntS1;
2320 DWORD IntS2;
2321 DWORD IntS3;
2322 DWORD IntS4;
2323 DWORD IntS5;
2324 DWORD IntS6;
2325 DWORD IntS7;
2326 DWORD IntT8;
2327 DWORD IntT9;
2328 DWORD IntK0;
2329 DWORD IntK1;
2330 DWORD IntGp;
2331 DWORD IntSp;
2332 DWORD IntS8;
2333 DWORD IntRa;
2334 DWORD IntLo;
2335 DWORD IntHi;
2336 /*
2337 * This section is specified/returned if the ContextFlags word
2338 * contains the flag CONTEXT_FLOATING_POINT.
2339 */
2340 DWORD Fsr;
2341 /*
2342 * This section is specified/returned if the ContextFlags word
2343 * contains the flag CONTEXT_CONTROL.
2344 *
2345 * N.B. The registers gp, sp, and ra are defined in the integer
2346 * section, but are considered part of the control context rather
2347 * than part of the integer context.
2348 */
2349 DWORD Fir;
2350 DWORD Psr;
2351 /*
2352 * The bits within the following flag control the contents of
2353 * a CONTEXT record. If the context record is used as an input
2354 * parameter, then for each portion of the context record which is
2355 * controlled by a flag bit whose value is set, it is assumed that
2356 * the associated portion of the context record specifies valid
2357 * context. If the context record is being used to modify a
2358 * thread's context, then only that portion of the thread's
2359 * context will be modified.
2360 *
2361 * If the context record is used as an IN OUT parameter, to
2362 * capture the context of a thread, then only those portions of
2363 * the thread's context corresponding to flag bits which have
2364 * been set will be returned.
2365 *
2366 * The context record is never used as an OUT only parameter.
2367 */
2368 DWORD ContextFlags;
2369 DWORD Fill[2];
2370} CONTEXT;
2371
2372#elif defined(_M_ARM)
2373/* The following flags control the contents of the CONTEXT structure.
2374 */
2375#define CONTEXT_ARM 0x0000040
2376#define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
2377#define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
2378
2379#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
2380
2381typedef struct _CONTEXT
2382{ /* The bit values within this flag control the contents of
2383 * a CONTEXT record.
2384 *
2385 * If the context record is used as an input parameter, then
2386 * for each portion of the context record controlled by a bit
2387 * flag which is set, it is assumed that the associated portion
2388 * of the context record contains valid context. If the context
2389 * record is being used to modify a thread's context, then only
2390 * that portion of the thread's context will be modified.
2391 *
2392 * If the context record is used as an IN OUT parameter to,
2393 * capture the context of a thread, then only those portions
2394 * of the thread's context corresponding to flag bits which
2395 * have been set will be returned.
2396 *
2397 * The context record is never used as an OUT only parameter.
2398 */
2399 ULONG ContextFlags;
2400 /*
2401 * This section is specified/returned if the ContextFlags word
2402 * contains the flag CONTEXT_INTEGER.
2403 */
2404 ULONG R0;
2405 ULONG R1;
2406 ULONG R2;
2407 ULONG R3;
2408 ULONG R4;
2409 ULONG R5;
2410 ULONG R6;
2411 ULONG R7;
2412 ULONG R8;
2413 ULONG R9;
2414 ULONG R10;
2415 ULONG R11;
2416 ULONG R12;
2417 ULONG Sp;
2418 ULONG Lr;
2419 ULONG Pc;
2420 ULONG Psr;
2421} CONTEXT;
2422
2423#else
2424#error "undefined processor type"
2425#endif
2426typedef CONTEXT *PCONTEXT, *LPCONTEXT;
2427
2428typedef struct _EXCEPTION_RECORD
2429{ DWORD ExceptionCode;
2430 DWORD ExceptionFlags;
2431 struct _EXCEPTION_RECORD *ExceptionRecord;
2432 PVOID ExceptionAddress;
2433 DWORD NumberParameters;
2434 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2435} EXCEPTION_RECORD, *PEXCEPTION_RECORD, *LPEXCEPTION_RECORD;
2436
2437typedef struct _EXCEPTION_POINTERS
2438{ PEXCEPTION_RECORD ExceptionRecord;
2439 PCONTEXT ContextRecord;
2440} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
2441
2442typedef union _LARGE_INTEGER
2443{ struct
2444 { DWORD LowPart;
2445 LONG HighPart;
2446 } u;
2447#if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2448 _ANONYMOUS_STRUCT struct
2449 { DWORD LowPart;
2450 LONG HighPart;
2451 };
2452#endif /* NONAMELESSUNION */
2453 LONGLONG QuadPart;
2454} LARGE_INTEGER, *PLARGE_INTEGER;
2455
2456typedef union _ULARGE_INTEGER
2457{ struct
2458 { DWORD LowPart;
2459 DWORD HighPart;
2460 } u;
2461#if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2462 _ANONYMOUS_STRUCT struct
2463 { DWORD LowPart;
2464 DWORD HighPart;
2465 };
2466#endif /* NONAMELESSUNION */
2467 ULONGLONG QuadPart;
2468} ULARGE_INTEGER, *PULARGE_INTEGER;
2469
2470typedef struct _LUID
2471{ DWORD LowPart;
2472 LONG HighPart;
2473} LUID, *PLUID;
2474#pragma pack(push,4)
2475
2476typedef struct _LUID_AND_ATTRIBUTES
2477{ LUID Luid;
2478 DWORD Attributes;
2479} LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2480#pragma pack(pop)
2481typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2482typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
2483
2484typedef struct _PRIVILEGE_SET
2485{ DWORD PrivilegeCount;
2486 DWORD Control;
2487 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2488} PRIVILEGE_SET, *PPRIVILEGE_SET;
2489
2490typedef struct _SECURITY_ATTRIBUTES
2491{ DWORD nLength;
2492 LPVOID lpSecurityDescriptor;
2493 BOOL bInheritHandle;
2494} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
2495
2496typedef enum _SECURITY_IMPERSONATION_LEVEL
2497{ SecurityAnonymous,
2498 SecurityIdentification,
2499 SecurityImpersonation,
2500 SecurityDelegation
2501} SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
2502typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, *PSECURITY_CONTEXT_TRACKING_MODE;
2503
2504typedef struct _SECURITY_QUALITY_OF_SERVICE
2505{ DWORD Length;
2506 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2507 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2508 BOOLEAN EffectiveOnly;
2509} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
2510typedef PVOID PACCESS_TOKEN;
2511
2512typedef struct _SE_IMPERSONATION_STATE
2513{ PACCESS_TOKEN Token;
2514 BOOLEAN CopyOnOpen;
2515 BOOLEAN EffectiveOnly;
2516 SECURITY_IMPERSONATION_LEVEL Level;
2517} SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE;
2518
2519typedef struct _SID_IDENTIFIER_AUTHORITY
2520{ BYTE Value[6];
2521} SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY, *LPSID_IDENTIFIER_AUTHORITY;
2522typedef PVOID PSID;
2523
2524typedef struct _SID
2525{ BYTE Revision;
2526 BYTE SubAuthorityCount;
2527 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2528 DWORD SubAuthority[ANYSIZE_ARRAY];
2529} SID, *PISID;
2530
2531typedef struct _SID_AND_ATTRIBUTES
2532{ PSID Sid;
2533 DWORD Attributes;
2534} SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
2535typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2536typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
2537
2538#if (_WIN32_WINNT >= 0x0600)
2539typedef ULONG_PTR SID_HASH_ENTRY, *PSID_HASH_ENTRY;
2540
2541typedef struct _SID_AND_ATTRIBUTES_HASH
2542{ DWORD SidCount;
2543 PSID_AND_ATTRIBUTES SidAttr;
2544 SID_HASH_ENTRY Hash[SID_HASH_SIZE];
2545} SID_AND_ATTRIBUTES_HASH, *PSID_AND_ATTRIBUTES_HASH;
2546#endif
2547
2548typedef struct _TOKEN_SOURCE
2549{ CHAR SourceName[TOKEN_SOURCE_LENGTH];
2550 LUID SourceIdentifier;
2551} TOKEN_SOURCE, *PTOKEN_SOURCE;
2552
2553typedef struct _TOKEN_CONTROL
2554{ LUID TokenId;
2555 LUID AuthenticationId;
2556 LUID ModifiedId;
2557 TOKEN_SOURCE TokenSource;
2558} TOKEN_CONTROL, *PTOKEN_CONTROL;
2559
2560typedef struct _TOKEN_DEFAULT_DACL
2561{ PACL DefaultDacl;
2562} TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
2563
2564typedef struct _TOKEN_GROUPS
2565{ DWORD GroupCount;
2566 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2567} TOKEN_GROUPS, *PTOKEN_GROUPS, *LPTOKEN_GROUPS;
2568
2569typedef struct _TOKEN_OWNER
2570{ PSID Owner;
2571} TOKEN_OWNER, *PTOKEN_OWNER;
2572
2573typedef struct _TOKEN_PRIMARY_GROUP
2574{ PSID PrimaryGroup;
2575} TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
2576
2577typedef struct _TOKEN_PRIVILEGES
2578{ DWORD PrivilegeCount;
2579 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
2580} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES, *LPTOKEN_PRIVILEGES;
2581
2582typedef enum tagTOKEN_TYPE
2583{ TokenPrimary = 1,
2584 TokenImpersonation
2585} TOKEN_TYPE, *PTOKEN_TYPE;
2586
2587typedef struct _TOKEN_STATISTICS
2588{ LUID TokenId;
2589 LUID AuthenticationId;
2590 LARGE_INTEGER ExpirationTime;
2591 TOKEN_TYPE TokenType;
2592 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2593 DWORD DynamicCharged;
2594 DWORD DynamicAvailable;
2595 DWORD GroupCount;
2596 DWORD PrivilegeCount;
2597 LUID ModifiedId;
2598} TOKEN_STATISTICS, *PTOKEN_STATISTICS;
2599
2600typedef struct _TOKEN_USER
2601{ SID_AND_ATTRIBUTES User;
2602} TOKEN_USER, *PTOKEN_USER;
2603#if (_WIN32_WINNT >= 0x0600)
2604
2605typedef struct _TOKEN_LINKED_TOKEN
2606{ HANDLE LinkedToken;
2607} TOKEN_LINKED_TOKEN, *PTOKEN_LINKED_TOKEN;
2608
2609typedef struct _TOKEN_MANDATORY_LABEL
2610{ SID_AND_ATTRIBUTES Label;
2611} TOKEN_MANDATORY_LABEL, *PTOKEN_MANDATORY_LABEL;
2612
2613typedef struct _TOKEN_MANDATORY_POLICY
2614{ DWORD Policy;
2615} TOKEN_MANDATORY_POLICY, *PTOKEN_MANDATORY_POLICY;
2616
2617typedef struct _TOKEN_ELEVATION
2618{ DWORD TokenIsElevated;
2619} TOKEN_ELEVATION, *PTOKEN_ELEVATION;
2620
2621typedef struct _TOKEN_ACCESS_INFORMATION
2622{ PSID_AND_ATTRIBUTES_HASH SidHash;
2623 PSID_AND_ATTRIBUTES_HASH RestrictedSidHash;
2624 PTOKEN_PRIVILEGES Privileges;
2625 LUID AuthenticationId;
2626 TOKEN_TYPE TokenType;
2627 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2628 TOKEN_MANDATORY_POLICY MandatoryPolicy;
2629 DWORD Flags;
2630} TOKEN_ACCESS_INFORMATION, *PTOKEN_ACCESS_INFORMATION;
2631#endif
2632typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2633typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
2634
2635typedef struct _SECURITY_DESCRIPTOR
2636{ BYTE Revision;
2637 BYTE Sbz1;
2638 SECURITY_DESCRIPTOR_CONTROL Control;
2639 PSID Owner;
2640 PSID Group;
2641 PACL Sacl;
2642 PACL Dacl;
2643} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
2644
2645typedef enum _TOKEN_INFORMATION_CLASS
2646{ TokenUser = 1,
2647 TokenGroups,
2648 TokenPrivileges,
2649 TokenOwner,
2650 TokenPrimaryGroup,
2651 TokenDefaultDacl,
2652 TokenSource,
2653 TokenType,
2654 TokenImpersonationLevel,
2655 TokenStatistics,
2656 TokenRestrictedSids,
2657 TokenSessionId,
2658 TokenGroupsAndPrivileges,
2659 TokenSessionReference,
2660 TokenSandBoxInert,
2661 TokenAuditPolicy,
2662 TokenOrigin,
2663#if (_WIN32_WINNT >= 0x0600)
2664 TokenElevationType,
2665 TokenLinkedToken,
2666 TokenElevation,
2667 TokenHasRestrictions,
2668 TokenAccessInformation,
2669 TokenVirtualizationAllowed,
2670 TokenVirtualizationEnabled,
2671 TokenIntegrityLevel,
2672 TokenUIAccess,
2673 TokenMandatoryPolicy,
2674 TokenLogonSid,
2675#endif
2676 MaxTokenInfoClass
2677} TOKEN_INFORMATION_CLASS;
2678
2679typedef enum _SID_NAME_USE
2680{ SidTypeUser = 1,
2681 SidTypeGroup,
2682 SidTypeDomain,
2683 SidTypeAlias,
2684 SidTypeWellKnownGroup,
2685 SidTypeDeletedAccount,
2686 SidTypeInvalid,
2687 SidTypeUnknown,
2688 SidTypeComputer
2689} SID_NAME_USE, *PSID_NAME_USE;
2690
2691typedef struct _QUOTA_LIMITS
2692{ SIZE_T PagedPoolLimit;
2693 SIZE_T NonPagedPoolLimit;
2694 SIZE_T MinimumWorkingSetSize;
2695 SIZE_T MaximumWorkingSetSize;
2696 SIZE_T PagefileLimit;
2697 LARGE_INTEGER TimeLimit;
2698} QUOTA_LIMITS, *PQUOTA_LIMITS;
2699
2700typedef struct _IO_COUNTERS
2701{ ULONGLONG ReadOperationCount;
2702 ULONGLONG WriteOperationCount;
2703 ULONGLONG OtherOperationCount;
2704 ULONGLONG ReadTransferCount;
2705 ULONGLONG WriteTransferCount;
2706 ULONGLONG OtherTransferCount;
2707} IO_COUNTERS, *PIO_COUNTERS;
2708
2709typedef struct _FILE_NOTIFY_INFORMATION
2710{ DWORD NextEntryOffset;
2711 DWORD Action;
2712 DWORD FileNameLength;
2713 WCHAR FileName[1];
2714} FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
2715
2716typedef struct _TAPE_ERASE
2717{ DWORD Type;
2718 BOOLEAN Immediate;
2719} TAPE_ERASE, *PTAPE_ERASE;
2720
2721typedef struct _TAPE_GET_DRIVE_PARAMETERS
2722{ BOOLEAN ECC;
2723 BOOLEAN Compression;
2724 BOOLEAN DataPadding;
2725 BOOLEAN ReportSetmarks;
2726 DWORD DefaultBlockSize;
2727 DWORD MaximumBlockSize;
2728 DWORD MinimumBlockSize;
2729 DWORD MaximumPartitionCount;
2730 DWORD FeaturesLow;
2731 DWORD FeaturesHigh;
2732 DWORD EOTWarningZoneSize;
2733} TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
2734
2735typedef struct _TAPE_GET_MEDIA_PARAMETERS
2736{ LARGE_INTEGER Capacity;
2737 LARGE_INTEGER Remaining;
2738 DWORD BlockSize;
2739 DWORD PartitionCount;
2740 BOOLEAN WriteProtected;
2741} TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
2742
2743typedef struct _TAPE_GET_POSITION
2744{ ULONG Type;
2745 ULONG Partition;
2746 ULONG OffsetLow;
2747 ULONG OffsetHigh;
2748} TAPE_GET_POSITION, *PTAPE_GET_POSITION;
2749
2750typedef struct _TAPE_PREPARE
2751{ DWORD Operation;
2752 BOOLEAN Immediate;
2753} TAPE_PREPARE, *PTAPE_PREPARE;
2754
2755typedef struct _TAPE_SET_DRIVE_PARAMETERS
2756{ BOOLEAN ECC;
2757 BOOLEAN Compression;
2758 BOOLEAN DataPadding;
2759 BOOLEAN ReportSetmarks;
2760 ULONG EOTWarningZoneSize;
2761} TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
2762
2763typedef struct _TAPE_SET_MEDIA_PARAMETERS
2764{ ULONG BlockSize;
2765} TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
2766
2767typedef struct _TAPE_SET_POSITION
2768{ DWORD Method;
2769 DWORD Partition;
2770 LARGE_INTEGER Offset;
2771 BOOLEAN Immediate;
2772} TAPE_SET_POSITION, *PTAPE_SET_POSITION;
2773
2774typedef struct _TAPE_WRITE_MARKS
2775{ DWORD Type;
2776 DWORD Count;
2777 BOOLEAN Immediate;
2778} TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
2779
2780typedef struct _TAPE_CREATE_PARTITION
2781{ DWORD Method;
2782 DWORD Count;
2783 DWORD Size;
2784} TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
2785
2786typedef struct _MEMORY_BASIC_INFORMATION
2787{ PVOID BaseAddress;
2788 PVOID AllocationBase;
2789 DWORD AllocationProtect;
2790 DWORD RegionSize;
2791 DWORD State;
2792 DWORD Protect;
2793 DWORD Type;
2794} MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
2795
2796typedef struct _MESSAGE_RESOURCE_ENTRY
2797{ WORD Length;
2798 WORD Flags;
2799 BYTE Text[1];
2800} MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
2801
2802typedef struct _MESSAGE_RESOURCE_BLOCK
2803{ DWORD LowId;
2804 DWORD HighId;
2805 DWORD OffsetToEntries;
2806} MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
2807
2808typedef struct _MESSAGE_RESOURCE_DATA
2809{ DWORD NumberOfBlocks;
2810 MESSAGE_RESOURCE_BLOCK Blocks[1];
2811} MESSAGE_RESOURCE_DATA, *PMESSAGE_RESOURCE_DATA;
2812
2813typedef struct _LIST_ENTRY
2814{ struct _LIST_ENTRY *Flink;
2815 struct _LIST_ENTRY *Blink;
2816} LIST_ENTRY, *PLIST_ENTRY;
2817
2818typedef struct _SINGLE_LIST_ENTRY
2819{ struct _SINGLE_LIST_ENTRY *Next;
2820} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
2821
2822#ifndef _SLIST_HEADER_
2823#define _SLIST_HEADER_
2824#define SLIST_ENTRY SINGLE_LIST_ENTRY
2825#define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2826#define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2827
2828typedef union _SLIST_HEADER
2829{ ULONGLONG Alignment;
2830 _ANONYMOUS_STRUCT struct
2831 { SLIST_ENTRY Next;
2832 WORD Depth;
2833 WORD Sequence;
2834 } DUMMYSTRUCTNAME;
2835} SLIST_HEADER, *PSLIST_HEADER;
2836#endif /* !_SLIST_HEADER_ */
2837
2838typedef struct _RTL_CRITICAL_SECTION_DEBUG
2839{ WORD Type;
2840 WORD CreatorBackTraceIndex;
2841 struct _RTL_CRITICAL_SECTION *CriticalSection;
2842 LIST_ENTRY ProcessLocksList;
2843 DWORD EntryCount;
2844 DWORD ContentionCount;
2845 DWORD Spare[2];
2846} RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG;
2847
2848typedef struct _RTL_CRITICAL_SECTION
2849{ PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
2850 LONG LockCount;
2851 LONG RecursionCount;
2852 HANDLE OwningThread;
2853 HANDLE LockSemaphore;
2854 DWORD Reserved;
2855} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
2856
2857typedef struct _EVENTLOGRECORD
2858{ DWORD Length;
2859 DWORD Reserved;
2860 DWORD RecordNumber;
2861 DWORD TimeGenerated;
2862 DWORD TimeWritten;
2863 DWORD EventID;
2864 WORD EventType;
2865 WORD NumStrings;
2866 WORD EventCategory;
2867 WORD ReservedFlags;
2868 DWORD ClosingRecordNumber;
2869 DWORD StringOffset;
2870 DWORD UserSidLength;
2871 DWORD UserSidOffset;
2872 DWORD DataLength;
2873 DWORD DataOffset;
2874} EVENTLOGRECORD, *PEVENTLOGRECORD;
2875
2876typedef struct _OSVERSIONINFOA
2877{ DWORD dwOSVersionInfoSize;
2878 DWORD dwMajorVersion;
2879 DWORD dwMinorVersion;
2880 DWORD dwBuildNumber;
2881 DWORD dwPlatformId;
2882 CHAR szCSDVersion[128];
2883} OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
2884
2885typedef struct _OSVERSIONINFOW
2886{ DWORD dwOSVersionInfoSize;
2887 DWORD dwMajorVersion;
2888 DWORD dwMinorVersion;
2889 DWORD dwBuildNumber;
2890 DWORD dwPlatformId;
2891 WCHAR szCSDVersion[128];
2892} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW;
2893
2894typedef struct _OSVERSIONINFOEXA
2895{ DWORD dwOSVersionInfoSize;
2896 DWORD dwMajorVersion;
2897 DWORD dwMinorVersion;
2898 DWORD dwBuildNumber;
2899 DWORD dwPlatformId;
2900 CHAR szCSDVersion[128];
2901 WORD wServicePackMajor;
2902 WORD wServicePackMinor;
2903 WORD wSuiteMask;
2904 BYTE wProductType;
2905 BYTE wReserved;
2906} OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2907
2908typedef struct _OSVERSIONINFOEXW
2909{ DWORD dwOSVersionInfoSize;
2910 DWORD dwMajorVersion;
2911 DWORD dwMinorVersion;
2912 DWORD dwBuildNumber;
2913 DWORD dwPlatformId;
2914 WCHAR szCSDVersion[128];
2915 WORD wServicePackMajor;
2916 WORD wServicePackMinor;
2917 WORD wSuiteMask;
2918 BYTE wProductType;
2919 BYTE wReserved;
2920} OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
2921
2922#pragma pack(push,2)
2923typedef struct _IMAGE_VXD_HEADER
2924{ WORD e32_magic;
2925 BYTE e32_border;
2926 BYTE e32_worder;
2927 DWORD e32_level;
2928 WORD e32_cpu;
2929 WORD e32_os;
2930 DWORD e32_ver;
2931 DWORD e32_mflags;
2932 DWORD e32_mpages;
2933 DWORD e32_startobj;
2934 DWORD e32_eip;
2935 DWORD e32_stackobj;
2936 DWORD e32_esp;
2937 DWORD e32_pagesize;
2938 DWORD e32_lastpagesize;
2939 DWORD e32_fixupsize;
2940 DWORD e32_fixupsum;
2941 DWORD e32_ldrsize;
2942 DWORD e32_ldrsum;
2943 DWORD e32_objtab;
2944 DWORD e32_objcnt;
2945 DWORD e32_objmap;
2946 DWORD e32_itermap;
2947 DWORD e32_rsrctab;
2948 DWORD e32_rsrccnt;
2949 DWORD e32_restab;
2950 DWORD e32_enttab;
2951 DWORD e32_dirtab;
2952 DWORD e32_dircnt;
2953 DWORD e32_fpagetab;
2954 DWORD e32_frectab;
2955 DWORD e32_impmod;
2956 DWORD e32_impmodcnt;
2957 DWORD e32_impproc;
2958 DWORD e32_pagesum;
2959 DWORD e32_datapage;
2960 DWORD e32_preload;
2961 DWORD e32_nrestab;
2962 DWORD e32_cbnrestab;
2963 DWORD e32_nressum;
2964 DWORD e32_autodata;
2965 DWORD e32_debuginfo;
2966 DWORD e32_debuglen;
2967 DWORD e32_instpreload;
2968 DWORD e32_instdemand;
2969 DWORD e32_heapsize;
2970 BYTE e32_res3[12];
2971 DWORD e32_winresoff;
2972 DWORD e32_winreslen;
2973 WORD e32_devid;
2974 WORD e32_ddkver;
2975} IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2976#pragma pack(pop)
2977
2978#pragma pack(push,4)
2979typedef struct _IMAGE_FILE_HEADER
2980{ WORD Machine;
2981 WORD NumberOfSections;
2982 DWORD TimeDateStamp;
2983 DWORD PointerToSymbolTable;
2984 DWORD NumberOfSymbols;
2985 WORD SizeOfOptionalHeader;
2986 WORD Characteristics;
2987} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2988
2989typedef struct _IMAGE_DATA_DIRECTORY
2990{ DWORD VirtualAddress;
2991 DWORD Size;
2992} IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2993
2994typedef struct _IMAGE_OPTIONAL_HEADER
2995{ WORD Magic;
2996 BYTE MajorLinkerVersion;
2997 BYTE MinorLinkerVersion;
2998 DWORD SizeOfCode;
2999 DWORD SizeOfInitializedData;
3000 DWORD SizeOfUninitializedData;
3001 DWORD AddressOfEntryPoint;
3002 DWORD BaseOfCode;
3003 DWORD BaseOfData;
3004 DWORD ImageBase;
3005 DWORD SectionAlignment;
3006 DWORD FileAlignment;
3007 WORD MajorOperatingSystemVersion;
3008 WORD MinorOperatingSystemVersion;
3009 WORD MajorImageVersion;
3010 WORD MinorImageVersion;
3011 WORD MajorSubsystemVersion;
3012 WORD MinorSubsystemVersion;
3013 DWORD Win32VersionValue;
3014 DWORD SizeOfImage;
3015 DWORD SizeOfHeaders;
3016 DWORD CheckSum;
3017 WORD Subsystem;
3018 WORD DllCharacteristics;
3019 DWORD SizeOfStackReserve;
3020 DWORD SizeOfStackCommit;
3021 DWORD SizeOfHeapReserve;
3022 DWORD SizeOfHeapCommit;
3023 DWORD LoaderFlags;
3024 DWORD NumberOfRvaAndSizes;
3025 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
3026} IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
3027
3028typedef struct _IMAGE_OPTIONAL_HEADER64
3029{ WORD Magic;
3030 BYTE MajorLinkerVersion;
3031 BYTE MinorLinkerVersion;
3032 DWORD SizeOfCode;
3033 DWORD SizeOfInitializedData;
3034 DWORD SizeOfUninitializedData;
3035 DWORD AddressOfEntryPoint;
3036 DWORD BaseOfCode;
3037 ULONGLONG ImageBase;
3038 DWORD SectionAlignment;
3039 DWORD FileAlignment;
3040 WORD MajorOperatingSystemVersion;
3041 WORD MinorOperatingSystemVersion;
3042 WORD MajorImageVersion;
3043 WORD MinorImageVersion;
3044 WORD MajorSubsystemVersion;
3045 WORD MinorSubsystemVersion;
3046 DWORD Win32VersionValue;
3047 DWORD SizeOfImage;
3048 DWORD SizeOfHeaders;
3049 DWORD CheckSum;
3050 WORD Subsystem;
3051 WORD DllCharacteristics;
3052 ULONGLONG SizeOfStackReserve;
3053 ULONGLONG SizeOfStackCommit;
3054 ULONGLONG SizeOfHeapReserve;
3055 ULONGLONG SizeOfHeapCommit;
3056 DWORD LoaderFlags;
3057 DWORD NumberOfRvaAndSizes;
3058 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
3059} IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
3060#ifdef _WIN64
3061typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
3062typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
3063#else
3064typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
3065typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
3066#endif
3067
3068typedef struct _IMAGE_ROM_OPTIONAL_HEADER
3069{ WORD Magic;
3070 BYTE MajorLinkerVersion;
3071 BYTE MinorLinkerVersion;
3072 DWORD SizeOfCode;
3073 DWORD SizeOfInitializedData;
3074 DWORD SizeOfUninitializedData;
3075 DWORD AddressOfEntryPoint;
3076 DWORD BaseOfCode;
3077 DWORD BaseOfData;
3078 DWORD BaseOfBss;
3079 DWORD GprMask;
3080 DWORD CprMask[4];
3081 DWORD GpValue;
3082} IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
3083#pragma pack(pop)
3084
3085#pragma pack(push,2)
3086typedef struct _IMAGE_DOS_HEADER
3087{ WORD e_magic;
3088 WORD e_cblp;
3089 WORD e_cp;
3090 WORD e_crlc;
3091 WORD e_cparhdr;
3092 WORD e_minalloc;
3093 WORD e_maxalloc;
3094 WORD e_ss;
3095 WORD e_sp;
3096 WORD e_csum;
3097 WORD e_ip;
3098 WORD e_cs;
3099 WORD e_lfarlc;
3100 WORD e_ovno;
3101 WORD e_res[4];
3102 WORD e_oemid;
3103 WORD e_oeminfo;
3104 WORD e_res2[10];
3105 LONG e_lfanew;
3106} IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
3107
3108typedef struct _IMAGE_OS2_HEADER
3109{ WORD ne_magic;
3110 CHAR ne_ver;
3111 CHAR ne_rev;
3112 WORD ne_enttab;
3113 WORD ne_cbenttab;
3114 LONG ne_crc;
3115 WORD ne_flags;
3116 WORD ne_autodata;
3117 WORD ne_heap;
3118 WORD ne_stack;
3119 LONG ne_csip;
3120 LONG ne_sssp;
3121 WORD ne_cseg;
3122 WORD ne_cmod;
3123 WORD ne_cbnrestab;
3124 WORD ne_segtab;
3125 WORD ne_rsrctab;
3126 WORD ne_restab;
3127 WORD ne_modtab;
3128 WORD ne_imptab;
3129 LONG ne_nrestab;
3130 WORD ne_cmovent;
3131 WORD ne_align;
3132 WORD ne_cres;
3133 BYTE ne_exetyp;
3134 BYTE ne_flagsothers;
3135 WORD ne_pretthunks;
3136 WORD ne_psegrefbytes;
3137 WORD ne_swaparea;
3138 WORD ne_expver;
3139} IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
3140#pragma pack(pop)
3141
3142#pragma pack(push,4)
3143typedef struct _IMAGE_NT_HEADERS
3144{ DWORD Signature;
3145 IMAGE_FILE_HEADER FileHeader;
3146 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
3147} IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
3148
3149typedef struct _IMAGE_NT_HEADERS64
3150{ DWORD Signature;
3151 IMAGE_FILE_HEADER FileHeader;
3152 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
3153} IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
3154#ifdef _WIN64
3155typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
3156typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
3157#else
3158typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
3159typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
3160#endif
3161
3162typedef struct _IMAGE_ROM_HEADERS
3163{ IMAGE_FILE_HEADER FileHeader;
3164 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
3165} IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
3166
3167typedef struct _IMAGE_SECTION_HEADER
3168{ BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
3169 union
3170 { DWORD PhysicalAddress;
3171 DWORD VirtualSize;
3172 } Misc;
3173 DWORD VirtualAddress;
3174 DWORD SizeOfRawData;
3175 DWORD PointerToRawData;
3176 DWORD PointerToRelocations;
3177 DWORD PointerToLinenumbers;
3178 WORD NumberOfRelocations;
3179 WORD NumberOfLinenumbers;
3180 DWORD Characteristics;
3181} IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
3182#pragma pack(pop)
3183
3184#pragma pack(push,2)
3185typedef struct _IMAGE_SYMBOL
3186{ union
3187 { BYTE ShortName[8];
3188 struct
3189 { DWORD Short;
3190 DWORD Long;
3191 } Name;
3192 PBYTE LongName[2];
3193 } N;
3194 DWORD Value;
3195 SHORT SectionNumber;
3196 WORD Type;
3197 BYTE StorageClass;
3198 BYTE NumberOfAuxSymbols;
3199} IMAGE_SYMBOL, *PIMAGE_SYMBOL;
3200
3201typedef union _IMAGE_AUX_SYMBOL
3202{ struct
3203 { DWORD TagIndex;
3204 union
3205 { struct
3206 { WORD Linenumber;
3207 WORD Size;
3208 } LnSz;
3209 DWORD TotalSize;
3210 } Misc;
3211 union
3212 { struct
3213 { DWORD PointerToLinenumber;
3214 DWORD PointerToNextFunction;
3215 } Function;
3216 struct
3217 { WORD Dimension[4];
3218 } Array;
3219 } FcnAry;
3220 WORD TvIndex;
3221 } Sym;
3222 struct
3223 { BYTE Name[IMAGE_SIZEOF_SYMBOL];
3224 } File;
3225 struct
3226 { DWORD Length;
3227 WORD NumberOfRelocations;
3228 WORD NumberOfLinenumbers;
3229 DWORD CheckSum;
3230 SHORT Number;
3231 BYTE Selection;
3232 } Section;
3233} IMAGE_AUX_SYMBOL, *PIMAGE_AUX_SYMBOL;
3234
3235typedef struct _IMAGE_COFF_SYMBOLS_HEADER
3236{ DWORD NumberOfSymbols;
3237 DWORD LvaToFirstSymbol;
3238 DWORD NumberOfLinenumbers;
3239 DWORD LvaToFirstLinenumber;
3240 DWORD RvaToFirstByteOfCode;
3241 DWORD RvaToLastByteOfCode;
3242 DWORD RvaToFirstByteOfData;
3243 DWORD RvaToLastByteOfData;
3244} IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3245
3246typedef struct _IMAGE_RELOCATION
3247{ _ANONYMOUS_UNION union
3248 { DWORD VirtualAddress;
3249 DWORD RelocCount;
3250 } DUMMYUNIONNAME;
3251 DWORD SymbolTableIndex;
3252 WORD Type;
3253} IMAGE_RELOCATION, *PIMAGE_RELOCATION;
3254#pragma pack(pop)
3255
3256#pragma pack(push,4)
3257typedef struct _IMAGE_BASE_RELOCATION
3258{ DWORD VirtualAddress;
3259 DWORD SizeOfBlock;
3260} IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION;
3261#pragma pack(pop)
3262
3263#pragma pack(push,2)
3264typedef struct _IMAGE_LINENUMBER
3265{ union
3266 { DWORD SymbolTableIndex;
3267 DWORD VirtualAddress;
3268 } Type;
3269 WORD Linenumber;
3270} IMAGE_LINENUMBER, *PIMAGE_LINENUMBER;
3271#pragma pack(pop)
3272
3273#pragma pack(push,4)
3274typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3275{ BYTE Name[16];
3276 BYTE Date[12];
3277 BYTE UserID[6];
3278 BYTE GroupID[6];
3279 BYTE Mode[8];
3280 BYTE Size[10];
3281 BYTE EndHeader[2];
3282} IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3283
3284typedef struct _IMAGE_EXPORT_DIRECTORY
3285{ DWORD Characteristics;
3286 DWORD TimeDateStamp;
3287 WORD MajorVersion;
3288 WORD MinorVersion;
3289 DWORD Name;
3290 DWORD Base;
3291 DWORD NumberOfFunctions;
3292 DWORD NumberOfNames;
3293 DWORD AddressOfFunctions;
3294 DWORD AddressOfNames;
3295 DWORD AddressOfNameOrdinals;
3296} IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
3297
3298typedef struct _IMAGE_IMPORT_BY_NAME
3299{ WORD Hint;
3300 BYTE Name[1];
3301} IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
3302
3303typedef struct _IMAGE_THUNK_DATA32
3304{ union
3305 { DWORD ForwarderString;
3306 DWORD Function;
3307 DWORD Ordinal;
3308 DWORD AddressOfData;
3309 } u1;
3310} IMAGE_THUNK_DATA32, *PIMAGE_THUNK_DATA32;
3311
3312typedef struct _IMAGE_THUNK_DATA64
3313{ union
3314 { ULONGLONG ForwarderString;
3315 ULONGLONG Function;
3316 ULONGLONG Ordinal;
3317 ULONGLONG AddressOfData;
3318 } u1;
3319} IMAGE_THUNK_DATA64, *PIMAGE_THUNK_DATA64;
3320#ifdef __WIN64
3321typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3322typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3323#else
3324typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3325typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3326#endif
3327
3328typedef struct _IMAGE_IMPORT_DESCRIPTOR
3329{ _ANONYMOUS_UNION union
3330 { DWORD Characteristics;
3331 DWORD OriginalFirstThunk;
3332 } DUMMYUNIONNAME;
3333 DWORD TimeDateStamp;
3334 DWORD ForwarderChain;
3335 DWORD Name;
3336 DWORD FirstThunk;
3337} IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR;
3338
3339typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3340{ DWORD TimeDateStamp;
3341 WORD OffsetModuleName;
3342 WORD NumberOfModuleForwarderRefs;
3343} IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3344
3345typedef struct _IMAGE_BOUND_FORWARDER_REF
3346{ DWORD TimeDateStamp;
3347 WORD OffsetModuleName;
3348 WORD Reserved;
3349} IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3350typedef void(NTAPI *PIMAGE_TLS_CALLBACK)(PVOID,DWORD,PVOID);
3351
3352typedef struct _IMAGE_TLS_DIRECTORY32
3353{ DWORD StartAddressOfRawData;
3354 DWORD EndAddressOfRawData;
3355 DWORD AddressOfIndex;
3356 DWORD AddressOfCallBacks;
3357 DWORD SizeOfZeroFill;
3358 DWORD Characteristics;
3359} IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3360
3361typedef struct _IMAGE_TLS_DIRECTORY64
3362{ ULONGLONG StartAddressOfRawData;
3363 ULONGLONG EndAddressOfRawData;
3364 ULONGLONG AddressOfIndex;
3365 ULONGLONG AddressOfCallBacks;
3366 DWORD SizeOfZeroFill;
3367 DWORD Characteristics;
3368} IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3369#ifdef __WIN64
3370typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3371typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3372#else
3373typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3374typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3375#endif
3376
3377typedef struct _IMAGE_RESOURCE_DIRECTORY
3378{ DWORD Characteristics;
3379 DWORD TimeDateStamp;
3380 WORD MajorVersion;
3381 WORD MinorVersion;
3382 WORD NumberOfNamedEntries;
3383 WORD NumberOfIdEntries;
3384} IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
3385
3386_ANONYMOUS_STRUCT typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
3387{ _ANONYMOUS_UNION union
3388 { _ANONYMOUS_STRUCT struct
3389 { DWORD NameOffset : 31;
3390 DWORD NameIsString : 1;
3391 } DUMMYSTRUCTNAME;
3392 DWORD Name;
3393 WORD Id;
3394 } DUMMYUNIONNAME;
3395 _ANONYMOUS_UNION union
3396 { DWORD OffsetToData;
3397 _ANONYMOUS_STRUCT struct
3398 { DWORD OffsetToDirectory:31;
3399 DWORD DataIsDirectory:1;
3400 } DUMMYSTRUCTNAME2;
3401 } DUMMYUNIONNAME2;
3402} IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3403
3404typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
3405{ WORD Length;
3406 CHAR NameString[1];
3407} IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING;
3408
3409typedef struct _IMAGE_RESOURCE_DIR_STRING_U
3410{ WORD Length;
3411 WCHAR NameString[1];
3412} IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
3413
3414typedef struct _IMAGE_RESOURCE_DATA_ENTRY
3415{ DWORD OffsetToData;
3416 DWORD Size;
3417 DWORD CodePage;
3418 DWORD Reserved;
3419} IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
3420
3421typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
3422{ DWORD Characteristics;
3423 DWORD TimeDateStamp;
3424 WORD MajorVersion;
3425 WORD MinorVersion;
3426 DWORD GlobalFlagsClear;
3427 DWORD GlobalFlagsSet;
3428 DWORD CriticalSectionDefaultTimeout;
3429 DWORD DeCommitFreeBlockThreshold;
3430 DWORD DeCommitTotalFreeThreshold;
3431 PVOID LockPrefixTable;
3432 DWORD MaximumAllocationSize;
3433 DWORD VirtualMemoryThreshold;
3434 DWORD ProcessHeapFlags;
3435 DWORD Reserved[4];
3436} IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3437
3438typedef struct
3439{ DWORD Characteristics;
3440 DWORD TimeDateStamp;
3441 WORD MajorVersion;
3442 WORD MinorVersion;
3443 DWORD GlobalFlagsClear;
3444 DWORD GlobalFlagsSet;
3445 DWORD CriticalSectionDefaultTimeout;
3446 ULONGLONG DeCommitFreeBlockThreshold;
3447 ULONGLONG DeCommitTotalFreeThreshold;
3448 ULONGLONG LockPrefixTable;
3449 ULONGLONG MaximumAllocationSize;
3450 ULONGLONG VirtualMemoryThreshold;
3451 ULONGLONG ProcessAffinityMask;
3452 DWORD ProcessHeapFlags;
3453 WORD CSDFlags;
3454 WORD Reserved1;
3455 ULONGLONG EditList;
3456 DWORD Reserved[2];
3457} IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64;
3458
3459typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY
3460{ DWORD BeginAddress;
3461 DWORD EndAddress;
3462 PVOID ExceptionHandler;
3463 PVOID HandlerData;
3464 DWORD PrologEndAddress;
3465} IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY;
3466
3467typedef struct _IMAGE_CE_RUNTIME_FUNCTION_ENTRY
3468{ unsigned int FuncStart:32;
3469 unsigned int PrologLen:8;
3470 unsigned int FuncLen:22;
3471 unsigned int ThirtyTwoBit:1;
3472 unsigned int ExceptionFlag:1;
3473} IMAGE_CE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_CE_RUNTIME_FUNCTION_ENTRY;
3474
3475typedef struct _IMAGE_DEBUG_DIRECTORY
3476{ DWORD Characteristics;
3477 DWORD TimeDateStamp;
3478 WORD MajorVersion;
3479 WORD MinorVersion;
3480 DWORD Type;
3481 DWORD SizeOfData;
3482 DWORD AddressOfRawData;
3483 DWORD PointerToRawData;
3484} IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3485
3486typedef struct _FPO_DATA
3487{ DWORD ulOffStart;
3488 DWORD cbProcSize;
3489 DWORD cdwLocals;
3490 WORD cdwParams;
3491 WORD cbProlog:8;
3492 WORD cbRegs:3;
3493 WORD fHasSEH:1;
3494 WORD fUseBP:1;
3495 WORD reserved:1;
3496 WORD cbFrame:2;
3497} FPO_DATA, *PFPO_DATA;
3498
3499typedef struct _IMAGE_DEBUG_MISC
3500{ DWORD DataType;
3501 DWORD Length;
3502 BOOLEAN Unicode;
3503 BYTE Reserved[3];
3504 BYTE Data[1];
3505} IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3506
3507typedef struct _IMAGE_FUNCTION_ENTRY
3508{ DWORD StartingAddress;
3509 DWORD EndingAddress;
3510 DWORD EndOfPrologue;
3511} IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3512
3513typedef struct _IMAGE_FUNCTION_ENTRY64
3514{ ULONGLONG StartingAddress;
3515 ULONGLONG EndingAddress;
3516 _ANONYMOUS_UNION union
3517 { ULONGLONG EndOfPrologue;
3518 ULONGLONG UnwindInfoAddress;
3519 } DUMMYUNIONNAME;
3520} IMAGE_FUNCTION_ENTRY64, *PIMAGE_FUNCTION_ENTRY64;
3521
3522typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
3523{ WORD Signature;
3524 WORD Flags;
3525 WORD Machine;
3526 WORD Characteristics;
3527 DWORD TimeDateStamp;
3528 DWORD CheckSum;
3529 DWORD ImageBase;
3530 DWORD SizeOfImage;
3531 DWORD NumberOfSections;
3532 DWORD ExportedNamesSize;
3533 DWORD DebugDirectorySize;
3534 DWORD SectionAlignment;
3535 DWORD Reserved[2];
3536} IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
3537#pragma pack(pop)
3538
3539typedef enum _CM_SERVICE_NODE_TYPE
3540{ DriverType = SERVICE_KERNEL_DRIVER,
3541 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3542 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3543 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3544 AdapterType = SERVICE_ADAPTER,
3545 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3546} SERVICE_NODE_TYPE;
3547
3548typedef enum _CM_SERVICE_LOAD_TYPE
3549{ BootLoad = SERVICE_BOOT_START,
3550 SystemLoad = SERVICE_SYSTEM_START,
3551 AutoLoad = SERVICE_AUTO_START,
3552 DemandLoad = SERVICE_DEMAND_START,
3553 DisableLoad = SERVICE_DISABLED
3554} SERVICE_LOAD_TYPE;
3555
3556typedef enum _CM_ERROR_CONTROL_TYPE
3557{ IgnoreError = SERVICE_ERROR_IGNORE,
3558 NormalError = SERVICE_ERROR_NORMAL,
3559 SevereError = SERVICE_ERROR_SEVERE,
3560 CriticalError = SERVICE_ERROR_CRITICAL
3561} SERVICE_ERROR_TYPE;
3562
3563typedef struct _NT_TIB
3564{ struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
3565 PVOID StackBase;
3566 PVOID StackLimit;
3567 PVOID SubSystemTib;
3568 _ANONYMOUS_UNION union
3569 { PVOID FiberData;
3570 DWORD Version;
3571 } DUMMYUNIONNAME;
3572 PVOID ArbitraryUserPointer;
3573 struct _NT_TIB *Self;
3574} NT_TIB, *PNT_TIB;
3575
3576typedef struct _REPARSE_DATA_BUFFER
3577{ DWORD ReparseTag;
3578 WORD ReparseDataLength;
3579 WORD Reserved;
3580 _ANONYMOUS_UNION union
3581 { struct
3582 { WORD SubstituteNameOffset;
3583 WORD SubstituteNameLength;
3584 WORD PrintNameOffset;
3585 WORD PrintNameLength;
3586 ULONG Flags;
3587 WCHAR PathBuffer[1];
3588 } SymbolicLinkReparseBuffer;
3589 struct
3590 { WORD SubstituteNameOffset;
3591 WORD SubstituteNameLength;
3592 WORD PrintNameOffset;
3593 WORD PrintNameLength;
3594 WCHAR PathBuffer[1];
3595 } MountPointReparseBuffer;
3596 struct
3597 { BYTE DataBuffer[1];
3598 } GenericReparseBuffer;
3599 } DUMMYUNIONNAME;
3600} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
3601
3602typedef struct _REPARSE_GUID_DATA_BUFFER
3603{ DWORD ReparseTag;
3604 WORD ReparseDataLength;
3605 WORD Reserved;
3606 GUID ReparseGuid;
3607 struct
3608 { BYTE DataBuffer[1];
3609 } GenericReparseBuffer;
3610} REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;
3611
3612typedef struct _REPARSE_POINT_INFORMATION
3613{ WORD ReparseDataLength;
3614 WORD UnparsedNameLength;
3615} REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
3616
3617
3618typedef union _FILE_SEGMENT_ELEMENT
3619{ PVOID64 Buffer;
3620 ULONGLONG Alignment;
3621} FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3622
3623/* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
3624#define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
3625#define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
3626#define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
3627#define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
3628#define JOB_OBJECT_LIMIT_AFFINITY 0x0010
3629#define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
3630#define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
3631#define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
3632#define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
3633#define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
3634#define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
3635#define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x0800
3636#define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x1000
3637
3638/* Wrong definitions, but keep for backward compatibility. */
3639#define JOB_OBJECT_BREAKAWAY_OK JOB_OBJECT_LIMIT_BREAKAWAY_OK
3640#define JOB_OBJECT_SILENT_BREAKAWAY JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK
3641
3642/* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
3643#define JOB_OBJECT_UILIMIT_HANDLES 0x0001
3644#define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
3645#define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
3646#define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
3647#define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
3648#define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
3649#define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
3650#define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
3651
3652/* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
3653#define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
3654#define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
3655#define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
3656#define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
3657
3658/* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
3659#define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
3660#define JOB_OBJECT_POST_AT_END_OF_JOB 1
3661
3662#define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
3663#define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
3664#define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
3665#define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
3666#define JOB_OBJECT_MSG_NEW_PROCESS 6
3667#define JOB_OBJECT_MSG_EXIT_PROCESS 7
3668#define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
3669#define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
3670#define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
3671
3672
3673typedef enum _JOBOBJECTINFOCLASS
3674{ JobObjectBasicAccountingInformation = 1,
3675 JobObjectBasicLimitInformation,
3676 JobObjectBasicProcessIdList,
3677 JobObjectBasicUIRestrictions,
3678 JobObjectSecurityLimitInformation,
3679 JobObjectEndOfJobTimeInformation,
3680 JobObjectAssociateCompletionPortInformation,
3681 JobObjectBasicAndIoAccountingInformation,
3682 JobObjectExtendedLimitInformation,
3683 JobObjectJobSetInformation,
3684 MaxJobObjectInfoClass
3685} JOBOBJECTINFOCLASS;
3686
3687typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION
3688{ LARGE_INTEGER TotalUserTime;
3689 LARGE_INTEGER TotalKernelTime;
3690 LARGE_INTEGER ThisPeriodTotalUserTime;
3691 LARGE_INTEGER ThisPeriodTotalKernelTime;
3692 DWORD TotalPageFaultCount;
3693 DWORD TotalProcesses;
3694 DWORD ActiveProcesses;
3695 DWORD TotalTerminatedProcesses;
3696} JOBOBJECT_BASIC_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3697
3698typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION
3699{ LARGE_INTEGER PerProcessUserTimeLimit;
3700 LARGE_INTEGER PerJobUserTimeLimit;
3701 DWORD LimitFlags;
3702 SIZE_T MinimumWorkingSetSize;
3703 SIZE_T MaximumWorkingSetSize;
3704 DWORD ActiveProcessLimit;
3705 ULONG_PTR Affinity;
3706 DWORD PriorityClass;
3707 DWORD SchedulingClass;
3708} JOBOBJECT_BASIC_LIMIT_INFORMATION, *PJOBOBJECT_BASIC_LIMIT_INFORMATION;
3709
3710typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST
3711{ DWORD NumberOfAssignedProcesses;
3712 DWORD NumberOfProcessIdsInList;
3713 ULONG_PTR ProcessIdList[1];
3714} JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
3715
3716typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS
3717{ DWORD UIRestrictionsClass;
3718} JOBOBJECT_BASIC_UI_RESTRICTIONS, *PJOBOBJECT_BASIC_UI_RESTRICTIONS;
3719
3720typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION
3721{ DWORD SecurityLimitFlags;
3722 HANDLE JobToken;
3723 PTOKEN_GROUPS SidsToDisable;
3724 PTOKEN_PRIVILEGES PrivilegesToDelete;
3725 PTOKEN_GROUPS RestrictedSids;
3726} JOBOBJECT_SECURITY_LIMIT_INFORMATION, *PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
3727
3728typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION
3729{ DWORD EndOfJobTimeAction;
3730} JOBOBJECT_END_OF_JOB_TIME_INFORMATION, *PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3731
3732typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT
3733{ PVOID CompletionKey;
3734 HANDLE CompletionPort;
3735} JOBOBJECT_ASSOCIATE_COMPLETION_PORT, *PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3736
3737typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION
3738{ JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
3739 IO_COUNTERS IoInfo;
3740} JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION, *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3741
3742typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION
3743{ JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
3744 IO_COUNTERS IoInfo;
3745 SIZE_T ProcessMemoryLimit;
3746 SIZE_T JobMemoryLimit;
3747 SIZE_T PeakProcessMemoryUsed;
3748 SIZE_T PeakJobMemoryUsed;
3749} JOBOBJECT_EXTENDED_LIMIT_INFORMATION, *PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3750
3751typedef struct _JOBOBJECT_JOBSET_INFORMATION
3752{ DWORD MemberLevel;
3753} JOBOBJECT_JOBSET_INFORMATION, *PJOBOBJECT_JOBSET_INFORMATION;
3754
3755/* Fixme: Making these defines conditional on WINVER will break ddk includes */
3756#if 1 /* (WINVER >= 0x0500) */
3757#include <pshpack4.h>
3758
3759#define ES_SYSTEM_REQUIRED 0x00000001
3760#define ES_DISPLAY_REQUIRED 0x00000002
3761#define ES_USER_PRESENT 0x00000004
3762#define ES_CONTINUOUS 0x80000000
3763
3764
3765typedef enum _LATENCY_TIME
3766{ LT_DONT_CARE,
3767 LT_LOWEST_LATENCY
3768} LATENCY_TIME, *PLATENCY_TIME;
3769
3770
3771typedef enum _SYSTEM_POWER_STATE
3772{ PowerSystemUnspecified,
3773 PowerSystemWorking,
3774 PowerSystemSleeping1,
3775 PowerSystemSleeping2,
3776 PowerSystemSleeping3,
3777 PowerSystemHibernate,
3778 PowerSystemShutdown,
3779 PowerSystemMaximum
3780} SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
3781#define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
3782
3783typedef enum
3784{ PowerActionNone,
3785 PowerActionReserved,
3786 PowerActionSleep,
3787 PowerActionHibernate,
3788 PowerActionShutdown,
3789 PowerActionShutdownReset,
3790 PowerActionShutdownOff,
3791 PowerActionWarmEject
3792} POWER_ACTION, *PPOWER_ACTION;
3793
3794#if (_WIN32_WINNT >= 0x0600)
3795
3796typedef enum
3797{ PoAc = 0,
3798 PoDc = 1,
3799 PoHot = 2,
3800 PoConditionMaximum = 3
3801} SYSTEM_POWER_CONDITION, *PSYSTEM_POWER_CONDITION;
3802#endif
3803
3804
3805typedef enum _DEVICE_POWER_STATE
3806{ PowerDeviceUnspecified,
3807 PowerDeviceD0,
3808 PowerDeviceD1,
3809 PowerDeviceD2,
3810 PowerDeviceD3,
3811 PowerDeviceMaximum
3812} DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3813
3814
3815typedef struct
3816{ DWORD Granularity;
3817 DWORD Capacity;
3818} BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
3819
3820
3821typedef struct _POWER_ACTION_POLICY
3822{ POWER_ACTION Action;
3823 ULONG Flags;
3824 ULONG EventCode;
3825} POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
3826
3827/* POWER_ACTION_POLICY.Flags constants */
3828#define POWER_ACTION_QUERY_ALLOWED 0x00000001
3829#define POWER_ACTION_UI_ALLOWED 0x00000002
3830#define POWER_ACTION_OVERRIDE_APPS 0x00000004
3831#define POWER_ACTION_LIGHTEST_FIRST 0x10000000
3832#define POWER_ACTION_LOCK_CONSOLE 0x20000000
3833#define POWER_ACTION_DISABLE_WAKES 0x40000000
3834#define POWER_ACTION_CRITICAL 0x80000000
3835
3836/* POWER_ACTION_POLICY.EventCode constants */
3837#define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
3838#define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
3839#define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
3840#define POWER_USER_NOTIFY_BUTTON 0x00000008
3841#define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
3842#define POWER_FORCE_TRIGGER_RESET 0x80000000
3843
3844#define DISCHARGE_POLICY_CRITICAL 0
3845#define DISCHARGE_POLICY_LOW 1
3846#define NUM_DISCHARGE_POLICIES 4
3847
3848#define PO_THROTTLE_NONE 0
3849#define PO_THROTTLE_CONSTANT 1
3850#define PO_THROTTLE_DEGRADE 2
3851#define PO_THROTTLE_ADAPTIVE 3
3852#define PO_THROTTLE_MAXIMUM 4
3853
3854typedef struct _SYSTEM_POWER_LEVEL
3855{ BOOLEAN Enable;
3856 UCHAR Spare[3];
3857 ULONG BatteryLevel;
3858 POWER_ACTION_POLICY PowerPolicy;
3859 SYSTEM_POWER_STATE MinSystemState;
3860} SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
3861
3862typedef struct _SYSTEM_POWER_POLICY
3863{ ULONG Revision;
3864 POWER_ACTION_POLICY PowerButton;
3865 POWER_ACTION_POLICY SleepButton;
3866 POWER_ACTION_POLICY LidClose;
3867 SYSTEM_POWER_STATE LidOpenWake;
3868 ULONG Reserved;
3869 POWER_ACTION_POLICY Idle;
3870 ULONG IdleTimeout;
3871 UCHAR IdleSensitivity;
3872 UCHAR DynamicThrottle;
3873 UCHAR Spare2[2];
3874 SYSTEM_POWER_STATE MinSleep;
3875 SYSTEM_POWER_STATE MaxSleep;
3876 SYSTEM_POWER_STATE ReducedLatencySleep;
3877 ULONG WinLogonFlags;
3878 ULONG Spare3;
3879 ULONG DozeS4Timeout;
3880 ULONG BroadcastCapacityResolution;
3881 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
3882 ULONG VideoTimeout;
3883 BOOLEAN VideoDimDisplay;
3884 ULONG VideoReserved[3];
3885 ULONG SpindownTimeout;
3886 BOOLEAN OptimizeForPower;
3887 UCHAR FanThrottleTolerance;
3888 UCHAR ForcedThrottle;
3889 UCHAR MinThrottle;
3890 POWER_ACTION_POLICY OverThrottled;
3891} SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
3892
3893
3894typedef struct _SYSTEM_POWER_CAPABILITIES
3895{ BOOLEAN PowerButtonPresent;
3896 BOOLEAN SleepButtonPresent;
3897 BOOLEAN LidPresent;
3898 BOOLEAN SystemS1;
3899 BOOLEAN SystemS2;
3900 BOOLEAN SystemS3;
3901 BOOLEAN SystemS4;
3902 BOOLEAN SystemS5;
3903 BOOLEAN HiberFilePresent;
3904 BOOLEAN FullWake;
3905 BOOLEAN VideoDimPresent;
3906 BOOLEAN ApmPresent;
3907 BOOLEAN UpsPresent;
3908 BOOLEAN ThermalControl;
3909 BOOLEAN ProcessorThrottle;
3910 UCHAR ProcessorMinThrottle;
3911 UCHAR ProcessorMaxThrottle;
3912 BOOLEAN FastSystemS4;
3913 UCHAR spare2[3];
3914 BOOLEAN DiskSpinDown;
3915 UCHAR spare3[8];
3916 BOOLEAN SystemBatteriesPresent;
3917 BOOLEAN BatteriesAreShortTerm;
3918 BATTERY_REPORTING_SCALE BatteryScale[3];
3919 SYSTEM_POWER_STATE AcOnLineWake;
3920 SYSTEM_POWER_STATE SoftLidWake;
3921 SYSTEM_POWER_STATE RtcWake;
3922 SYSTEM_POWER_STATE MinDeviceWakeState;
3923 SYSTEM_POWER_STATE DefaultLowLatencyWake;
3924} SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
3925
3926
3927typedef struct _SYSTEM_BATTERY_STATE
3928{ BOOLEAN AcOnLine;
3929 BOOLEAN BatteryPresent;
3930 BOOLEAN Charging;
3931 BOOLEAN Discharging;
3932 BOOLEAN Spare1[4];
3933 ULONG MaxCapacity;
3934 ULONG RemainingCapacity;
3935 ULONG Rate;
3936 ULONG EstimatedTime;
3937 ULONG DefaultAlert1;
3938 ULONG DefaultAlert2;
3939} SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
3940
3941
3942typedef enum _POWER_INFORMATION_LEVEL
3943{ SystemPowerPolicyAc,
3944 SystemPowerPolicyDc,
3945 VerifySystemPolicyAc,
3946 VerifySystemPolicyDc,
3947 SystemPowerCapabilities,
3948 SystemBatteryState,
3949 SystemPowerStateHandler,
3950 ProcessorStateHandler,
3951 SystemPowerPolicyCurrent,
3952 AdministratorPowerPolicy,
3953 SystemReserveHiberFile,
3954 ProcessorInformation,
3955 SystemPowerInformation,
3956 ProcessorStateHandler2,
3957 LastWakeTime,
3958 LastSleepTime,
3959 SystemExecutionState,
3960 SystemPowerStateNotifyHandler,
3961 ProcessorPowerPolicyAc,
3962 ProcessorPowerPolicyDc,
3963 VerifyProcessorPowerPolicyAc,
3964 VerifyProcessorPowerPolicyDc,
3965 ProcessorPowerPolicyCurrent
3966} POWER_INFORMATION_LEVEL;
3967
3968#if (_WIN32_WINNT >= 0x0500)
3969typedef LONG (WINAPI *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS);
3970#endif
3971#if 1 /* (WIN32_WINNT >= 0x0500) */
3972
3973typedef struct _SYSTEM_POWER_INFORMATION
3974{ ULONG MaxIdlenessAllowed;
3975 ULONG Idleness;
3976 ULONG TimeRemaining;
3977 UCHAR CoolingMode;
3978} SYSTEM_POWER_INFORMATION, *PSYSTEM_POWER_INFORMATION;
3979#endif
3980
3981#if (_WIN32_WINNT >= 0x0501)
3982
3983typedef enum _HEAP_INFORMATION_CLASS
3984{ HeapCompatibilityInformation
3985} HEAP_INFORMATION_CLASS;
3986
3987typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
3988{ ActivationContextBasicInformation = 1,
3989 ActivationContextDetailedInformation,
3990 AssemblyDetailedInformationInActivationContext,
3991 FileInformationInAssemblyOfAssemblyInActivationContext
3992} ACTIVATION_CONTEXT_INFO_CLASS;
3993
3994typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
3995{ DWORD ulFlags;
3996 DWORD ulEncodedAssemblyIdentityLength;
3997 DWORD ulManifestPathType;
3998 DWORD ulManifestPathLength;
3999 LARGE_INTEGER liManifestLastWriteTime;
4000 DWORD ulPolicyPathType;
4001 DWORD ulPolicyPathLength;
4002 LARGE_INTEGER liPolicyLastWriteTime;
4003 DWORD ulMetadataSatelliteRosterIndex;
4004 DWORD ulManifestVersionMajor;
4005 DWORD ulManifestVersionMinor;
4006 DWORD ulPolicyVersionMajor;
4007 DWORD ulPolicyVersionMinor;
4008 DWORD ulAssemblyDirectoryNameLength;
4009 PCWSTR lpAssemblyEncodedAssemblyIdentity;
4010 PCWSTR lpAssemblyManifestPath;
4011 PCWSTR lpAssemblyPolicyPath;
4012 PCWSTR lpAssemblyDirectoryName;
4013} ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
4014typedef const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
4015
4016typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
4017{ DWORD dwFlags;
4018 DWORD ulFormatVersion;
4019 DWORD ulAssemblyCount;
4020 DWORD ulRootManifestPathType;
4021 DWORD ulRootManifestPathChars;
4022 DWORD ulRootConfigurationPathType;
4023 DWORD ulRootConfigurationPathChars;
4024 DWORD ulAppDirPathType;
4025 DWORD ulAppDirPathChars;
4026 PCWSTR lpRootManifestPath;
4027 PCWSTR lpRootConfigurationPath;
4028 PCWSTR lpAppDirPath;
4029} ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
4030typedef const ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION;
4031
4032typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
4033{ ULONG ulAssemblyIndex;
4034 ULONG ulFileIndexInAssembly;
4035} ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
4036typedef const ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
4037
4038typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
4039{ DWORD ulFlags;
4040 DWORD ulFilenameLength;
4041 DWORD ulPathLength;
4042 PCWSTR lpFileName;
4043 PCWSTR lpFilePath;
4044} ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
4045typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
4046#endif /* (WIN32_WINNT >= 0x0501) */
4047
4048typedef struct _PROCESSOR_POWER_POLICY_INFO
4049{ ULONG TimeCheck;
4050 ULONG DemoteLimit;
4051 ULONG PromoteLimit;
4052 UCHAR DemotePercent;
4053 UCHAR PromotePercent;
4054 UCHAR Spare[2];
4055 ULONG AllowDemotion : 1;
4056 ULONG AllowPromotion : 1;
4057 ULONG Reserved : 30;
4058} PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
4059
4060typedef struct _PROCESSOR_POWER_POLICY
4061{ ULONG Revision;
4062 UCHAR DynamicThrottle;
4063 UCHAR Spare[3];
4064 ULONG Reserved;
4065 ULONG PolicyCount;
4066 PROCESSOR_POWER_POLICY_INFO Policy[3];
4067} PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
4068
4069typedef struct _ADMINISTRATOR_POWER_POLICY
4070{ SYSTEM_POWER_STATE MinSleep;
4071 SYSTEM_POWER_STATE MaxSleep;
4072 ULONG MinVideoTimeout;
4073 ULONG MaxVideoTimeout;
4074 ULONG MinSpindownTimeout;
4075 ULONG MaxSpindownTimeout;
4076} ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
4077#include <poppack.h>
4078#endif /* WINVER >= 0x0500 */
4079
4080#if (_WIN32_WINNT >= 0x0500)
4081typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN);
4082#endif
4083
4084#ifdef UNICODE
4085typedef OSVERSIONINFOW OSVERSIONINFO, *POSVERSIONINFO, *LPOSVERSIONINFO;
4086typedef OSVERSIONINFOEXW OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;
4087#else
4088typedef OSVERSIONINFOA OSVERSIONINFO, *POSVERSIONINFO, *LPOSVERSIONINFO;
4089typedef OSVERSIONINFOEXA OSVERSIONINFOEX, *POSVERSIONINFOEX, *LPOSVERSIONINFOEX;
4090#endif
4091
4092#if (_WIN32_WINNT >= 0x0500)
4093ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
4094#define VER_SET_CONDITION(ConditionMask, TypeBitMask, ComparisonType) \
4095 ((ConditionMask) = VerSetConditionMask((ConditionMask), \
4096 (TypeBitMask), (ComparisonType)))
4097#endif
4098
4099#if defined(__GNUC__)
4100#if defined(_M_IX86) || defined(_M_X64) || defined(_M_IA64)
4101/* On regular _WIN32 and _WIN64 hardware platforms, provide inline
4102 * assembler pseudo-intrinsics to access the thread information block,
4103 * and the fiber data referenced therein.
4104 */
4105#ifndef _WIN64 /* Not 64-bit, so assume 32-bit */
4106/* On 32-bit Windows, TIB data is located via the FS segment, with
4107 * offsets computed in terms of the size of 4-byte pointers; thus the
4108 * offset of FiberData, preceded by four pointer fields, is 0x10, and
4109 * Self, preceded by six pointers, is at offset 0x18...
4110 */
4111#define __tib_fiber_data__ "fs:0x10"
4112#define __tib_self_refptr__ "fs:0x18"
4113
4114#else
4115/* ...whereas, on 64-bit, the pointer size is doubled to eight bytes,
4116 * so the offsets double to 0x20 for FiberData, and 0x30 for Self,
4117 * respectively.
4118 */
4119#define __tib_fiber_data__ "gs:0x20"
4120#define __tib_self_refptr__ "gs:0x30"
4121#endif
4122
4123#if (__GNUC__ >= 3)
4124/* From GCC-3.x onwards, the user may specify -masm=intel, and so
4125 * generate assembly language intermediate output in Intel/Microsoft
4126 * syntax; we must specify dual mode inline assembly code to support
4127 * this, (in addition to the default AT&T syntax).
4128 */
4129static __inline__ PVOID GetCurrentFiber (void)
4130{
4131 void *ret;
4132 __asm__ __volatile__ (
4133 "mov{%z0}\t{%%"__tib_fiber_data__", %0|%0, "__tib_fiber_data__"}"
4134 : "=a" (ret) /* resultant pointer will be returned in eax/rax */
4135 );
4136 return ret;
4137}
4138
4139static __inline__ PVOID GetFiberData (void)
4140{
4141 void *ret;
4142 __asm__ __volatile__ (
4143 "mov{%z0}\t{%%"__tib_fiber_data__", %0|%0, "__tib_fiber_data__"}\n\t"
4144 "mov{%z0}\t{(%0), %0|%0, [%0]}"
4145 : "=r" (ret) /* likely eax/rax, but must support indexing */
4146 );
4147 return ret;
4148}
4149
4150static __inline__ struct _TEB *NtCurrentTeb (void)
4151{
4152 struct _TEB *ret;
4153 __asm__ __volatile__ (
4154 "mov{%z0}\t{%%"__tib_self_refptr__", %0|%0, "__tib_self_refptr__"}"
4155 : "=a" (ret) /* resultant pointer will be returned in eax/rax */
4156 : /* no inputs */
4157 );
4158 return ret;
4159}
4160#else /* __GNUC__ < 3 */
4161/* Older versions of GCC, predating GCC-3.x, did not support -masm=intel;
4162 * specify inline assembly code in AT&T syntax only.
4163 */
4164static __inline__ PVOID GetCurrentFiber (void)
4165{
4166 void *ret;
4167 __asm__ __volatile__ (
4168 "mov%z0\t%%"__tib_fiber_data__", %0"
4169 : "=a" (ret) /* resultant pointer will be returned in eax/rax */
4170 );
4171 return ret;
4172}
4173
4174static __inline__ PVOID GetFiberData (void)
4175{
4176 void *ret;
4177 __asm__ __volatile__ (
4178 "mov%z0\t%%"__tib_fiber_data__", %0\n\t"
4179 "mov%z0\t(%0), %0"
4180 : "=r" (ret) /* likely eax/rax, but must support indexing */
4181 );
4182 return ret;
4183}
4184
4185static __inline__ struct _TEB *NtCurrentTeb (void)
4186{
4187 struct _TEB *ret;
4188 __asm__ __volatile__ (
4189 "mov%z0\t%%"__tib_self_refptr__", %0"
4190 : "=a" (ret) /* resultant pointer will be returned in eax/rax */
4191 : /* no inputs */
4192 );
4193 return ret;
4194}
4195#endif /* __GNUC__ < 3 */
4196#endif /* _M_IX86 || _M_X64 || _M_IA64 */
4197#else /* !__GNUC__ */
4198/* The (unidentified) compiler is not GCC.
4199 * FIXME: If it isn't GCC, what is it? Given that what follows is
4200 * inline assembly code, it surely can't be generically suitable for
4201 * use with any non-GCC compiler? Google suggests that this syntax
4202 * may be applicable for WATCOM compilers. More to the point: given
4203 * that our mission is to deliver GCC for Windows, why is this here
4204 * at all? Do we REALLY want to carry this maintenance burden?
4205 */
4206#if defined(_M_IX86)
4207PVOID GetCurrentFiber (void);
4208#pragma aux GetCurrentFiber = \
4209 "mov eax, dword ptr fs:0x10" \
4210 value [eax] \
4211 modify [eax];
4212
4213PVOID GetFiberData (void);
4214#pragma aux GetFiberData = \
4215 "mov eax, dword ptr fs:0x10" \
4216 "mov eax, [eax]" \
4217 value [eax] \
4218 modify [eax];
4219
4220struct _TEB *NtCurrentTeb (void);
4221#pragma aux NtCurrentTeb = \
4222 "mov eax, dword ptr fs:0x18" \
4223 value [eax] \
4224 modify [eax];
4225
4226#endif /* _M_IX86 */
4227#endif /* !__GNUC__ */
4228
4229/* MemoryBarrier() Implementation
4230 * ------------------------------
4231 * https://msdn.microsoft.com/en-us/library/windows/desktop/ms684208%28v=vs.85%29.aspx
4232 *
4233 * MSDN says that this requires one of Vista, or Windows Server-2003,
4234 * or later; I don't see why that should be, since neither Microsoft's
4235 * implementation, nor the following, actually exhibits any dependency
4236 * on any OS feature specific to these, or later versions.
4237 *
4238 * For this MinGW.org MemoryBarrier() implementation, we aim to rely,
4239 * to the maximum practicable extent, on the intrinsic implementations
4240 * provided by the GCC compiler itself; thus, for those recent versions
4241 * of GCC, (those which implement the sequentially consistent model for
4242 * atomic memory access)...
4243 */
4244#if defined(__ATOMIC_SEQ_CST)
4245 /* ...we implement barriers using the __atomic_thread_fence() intrinsic
4246 * function, in sequentially consistent mode.
4247 */
4248# define __mingw_fence_type__ __ATOMIC_SEQ_CST
4249# define __mingw_thread_fence __atomic_thread_fence
4250
4251 /* For earlier compiler versions, which lack __atomic_thread_fence(),
4252 * we fall back on legacy mechanisms; thus, from GCC-4.4 onward...
4253 */
4254#elif ((__GNUC__ << 8) + __GNUC_MINOR__) >= 0x404
4255 /* ...we fall back to the __sync_synchronize() intrinsic function; (this
4256 * was first mentioned in the documentation for GCC-4.1, but comments in
4257 * the GCC source code suggest that it did not achieve a robust state of
4258 * implementation, until GCC-4.4).
4259 */
4260# define __mingw_thread_fence __sync_synchronize
4261# define __mingw_fence_type__
4262
4263#else
4264 /* Finally, when there is no viable intrinsic implementation, we fall
4265 * back on inline assembly code. This is CPU architecture dependent:
4266 * we choose the instructions, for each architecture, as best we can
4267 * to match the code emitted by __atomic_thread_fence(), in versions
4268 * of GCC which support it; thus...
4269 */
4270# define __mingw_thread_fence __asm__ __volatile__
4271# define __mingw_fence_type__ __mingw_fence_insn__:::"memory"
4272
4273# if defined(_M_X64) || defined(_M_AMD64) || (_M_IX86_FP >= 2)
4274 /* ...for X86-64, AMD-64, and 32-bit X86 processors with support for
4275 * SSE2 instructions, we may issue an "mfence" instruction directly...
4276 */
4277# define __mingw_fence_insn__ "mfence"
4278
4279# elif defined(_M_IA64)
4280 /* ...while for IA-64 (Itanium), the equivalent is "mf"...
4281 */
4282# define __mingw_fence_insn__ "mf"
4283
4284# elif defined(_M_IX86)
4285 /* ...and, for 32-bit X86 processors without support for the SSE2
4286 * instruction set, (nominally, our default supported architecture),
4287 * we perform a bus-locked memory fetch and store, (OR with zero).
4288 */
4289# define __mingw_fence_insn__ "lock or{l}\t{$0, (%%esp)|DWORD PTR [esp], 0}"
4290
4291 /* FIXME: To support other CPU architectures, any appropriate fall
4292 * back instructions must be identified here, (with an appropriate
4293 * "#elif defined(_M_ARCH)" clause for each)...
4294 */
4295# else
4296 /* ...and, as a last resort, we arrange to inject NOTHING into the
4297 * code stream; (notwthstanding, this may still suffice as a light
4298 * weight barrier, insofar as it should prevent reordering of code,
4299 * which might otherwise result from compiler optimizations, about
4300 * the barrier placement point).
4301 */
4302# define __mingw_fence_insn__ ""
4303# endif
4304#endif
4305
4306/* Finally, the preceding implementation choices are encapsulated
4307 * into the actual MemoryBarrier() implementation; this is provided
4308 * in the form of a function, with static scope, and defined such
4309 * that it must always be expanded in-line...
4310 */
4311static FORCEINLINE void MemoryBarrier (void)
4312{ __mingw_thread_fence(__mingw_fence_type__); }
4313
4314/* ...before purging the implementation choice macros, (which are
4315 * no longer needed), from the pre-processor namespace.
4316 */
4317#undef __mingw_fence_type__
4318#undef __mingw_thread_fence
4319#undef __mingw_fence_insn__
4320
4321_END_C_DECLS
4322
4323#endif /* ! RC_INVOKED */
4324#endif /* !_WINNT_H: $RCSfile: winnt.h,v $: end of file */
Note: See TracBrowser for help on using the repository browser.