[XDK][PSDK][DDK] Share more Se types between winnt and ntddk/ntifs/wdm. Also add...
[reactos.git] / reactos / include / xdk / winnt_old.h
1
2 #if defined(__ROS_LONG64__)
3 #undef InterlockedExchange
4 #define InterlockedExchange(a,b) _InterlockedExchange((long*)a,b)
5 #undef InterlockedExchangeAdd
6 #define InterlockedExchangeAdd(a,b) _InterlockedExchangeAdd((long*)a,b)
7 #undef InterlockedCompareExchange
8 #define InterlockedCompareExchange(a,b,c) _InterlockedCompareExchange((long*)a,b,c)
9 #undef InterlockedIncrement
10 #define InterlockedIncrement(a) _InterlockedIncrement((long*)a)
11 #undef InterlockedDecrement
12 #define InterlockedDecrement(a) _InterlockedDecrement((long*)a)
13 #endif
14
15 #undef __C89_NAMELESS
16 #undef __C89_NAMELESSSTRUCTNAME
17 #undef __C89_NAMELESSSTRUCTNAME1
18 #undef __C89_NAMELESSSTRUCTNAME2
19 #undef __C89_NAMELESSSTRUCTNAME3
20 #undef __C89_NAMELESSSTRUCTNAME4
21 #undef __C89_NAMELESSSTRUCTNAME5
22 #undef __C89_NAMELESSUNIONNAME
23 #undef __C89_NAMELESSUNIONNAME1
24 #undef __C89_NAMELESSUNIONNAME2
25 #undef __C89_NAMELESSUNIONNAME3
26 #undef __C89_NAMELESSUNIONNAME4
27 #undef __C89_NAMELESSUNIONNAME5
28 #undef __C89_NAMELESSUNIONNAME6
29 #undef __C89_NAMELESSUNIONNAME7
30 #undef __C89_NAMELESSUNIONNAME8
31
32 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
33 # ifdef __GNUC__
34 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
35 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
36 # define __C89_NAMELESS __extension__
37 # endif
38 # elif defined(_MSC_VER)
39 # define __C89_NAMELESS
40 # endif
41 #endif
42
43 #ifdef __C89_NAMELESS
44 # define __C89_NAMELESSSTRUCTNAME
45 # define __C89_NAMELESSSTRUCTNAME1
46 # define __C89_NAMELESSSTRUCTNAME2
47 # define __C89_NAMELESSSTRUCTNAME3
48 # define __C89_NAMELESSSTRUCTNAME4
49 # define __C89_NAMELESSSTRUCTNAME5
50 # define __C89_NAMELESSUNIONNAME
51 # define __C89_NAMELESSUNIONNAME1
52 # define __C89_NAMELESSUNIONNAME2
53 # define __C89_NAMELESSUNIONNAME3
54 # define __C89_NAMELESSUNIONNAME4
55 # define __C89_NAMELESSUNIONNAME5
56 # define __C89_NAMELESSUNIONNAME6
57 # define __C89_NAMELESSUNIONNAME7
58 # define __C89_NAMELESSUNIONNAME8
59 #else
60 # define __C89_NAMELESS
61 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
62 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
63 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
64 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
65 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
66 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
67 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
68 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
69 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
70 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
71 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
72 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
73 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
74 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
75 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
76 #endif
77
78 #define DECLSPEC_HIDDEN
79
80 /*#ifdef _WINE*/
81 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
82 # define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
83 #else
84 # define __WINE_ALLOC_SIZE(x)
85 #endif
86 /*#endif*/
87
88 #ifdef __GNUC__
89 # define _HAVE_INT64
90 # ifndef _INTEGRAL_MAX_BITS
91 # define _INTEGRAL_MAX_BITS 64
92 # endif
93 # undef __int64
94 # define __int64 long long
95 #elif (defined(__WATCOMC__) || defined(_MSC_VER)) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
96 # define _HAVE_INT64
97 #endif /* __GNUC__/__WATCOMC */
98
99 #ifdef _MSC_VER
100 # pragma warning(push)
101 # pragma warning(disable:4201)
102 # pragma warning(disable:4214)
103 # pragma warning(disable:4820)
104 #endif
105
106 #define ACE_OBJECT_TYPE_PRESENT 0x00000001
107 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
108
109 /* also in ddk/ntifs.h */
110 #define COMPRESSION_FORMAT_NONE (0x0000)
111 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
112 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
113 #define COMPRESSION_ENGINE_STANDARD (0x0000)
114 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
115 #define COMPRESSION_ENGINE_HIBER (0x0200)
116 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
117 #define ACCESS_DENIED_ACE_TYPE (0x1)
118 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
119 #define SYSTEM_ALARM_ACE_TYPE (0x3)
120 /*end ntifs.h */
121
122 #define REG_STANDARD_FORMAT 1
123 #define REG_LATEST_FORMAT 2
124 #define REG_NO_COMPRESSION 4
125
126 #ifndef WIN32_NO_STATUS
127
128 #define STATUS_WAIT_0 ((DWORD)0x00000000)
129 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080)
130 #define STATUS_USER_APC ((DWORD)0x000000C0)
131 #define STATUS_TIMEOUT ((DWORD)0x00000102)
132 #define STATUS_PENDING ((DWORD)0x00000103)
133 #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005)
134 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001)
135 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002)
136 #define STATUS_BREAKPOINT ((DWORD)0x80000003)
137 #define STATUS_SINGLE_STEP ((DWORD)0x80000004)
138 #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005)
139 #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006)
140 #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008)
141 #define STATUS_NO_MEMORY ((DWORD)0xC0000017)
142 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D)
143 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025)
144 #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026)
145 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C)
146 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D)
147 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E)
148 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F)
149 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090)
150 #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091)
151 #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092)
152 #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093)
153 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094)
154 #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095)
155 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096)
156 #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD)
157 #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A)
158 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4)
159 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5)
160 #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9)
161 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F)
162 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010)
163
164 #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001)
165 #define DBG_CONTINUE ((DWORD)0x00010002)
166 #define DBG_TERMINATE_THREAD ((DWORD)0x40010003)
167 #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004)
168 #define DBG_CONTROL_C ((DWORD)0x40010005)
169 #define DBG_CONTROL_BREAK ((DWORD)0x40010008)
170 #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009)
171 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001)
172
173 #endif /* WIN32_NO_STATUS */
174
175 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
176
177 /* Also in ddk/winddk.h */
178 #define FILE_LIST_DIRECTORY 0x00000001
179 #define FILE_READ_DATA 0x00000001
180 #define FILE_ADD_FILE 0x00000002
181 #define FILE_WRITE_DATA 0x00000002
182 #define FILE_ADD_SUBDIRECTORY 0x00000004
183 #define FILE_APPEND_DATA 0x00000004
184 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
185 #define FILE_READ_EA 0x00000008
186 #define FILE_READ_PROPERTIES 0x00000008
187 #define FILE_WRITE_EA 0x00000010
188 #define FILE_WRITE_PROPERTIES 0x00000010
189 #define FILE_EXECUTE 0x00000020
190 #define FILE_TRAVERSE 0x00000020
191 #define FILE_DELETE_CHILD 0x00000040
192 #define FILE_READ_ATTRIBUTES 0x00000080
193 #define FILE_WRITE_ATTRIBUTES 0x00000100
194
195 #define FILE_SHARE_READ 0x00000001
196 #define FILE_SHARE_WRITE 0x00000002
197 #define FILE_SHARE_DELETE 0x00000004
198 #define FILE_SHARE_VALID_FLAGS 0x00000007
199
200 #define FILE_ATTRIBUTE_READONLY 0x00000001
201 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
202 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
203 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
204 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
205 #define FILE_ATTRIBUTE_DEVICE 0x00000040
206 #define FILE_ATTRIBUTE_NORMAL 0x00000080
207 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
208 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
209 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
210 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
211 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
212 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
213 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
214 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
215 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
216
217 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
218 #define FILE_STRUCTURED_STORAGE 0x00000441
219
220 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
221 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
222 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
223 #define FILE_VALID_SET_FLAGS 0x00000036
224
225 #define FILE_DIRECTORY_FILE 0x00000001
226 #define FILE_WRITE_THROUGH 0x00000002
227 #define FILE_SEQUENTIAL_ONLY 0x00000004
228 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
229 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
230 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
231 #define FILE_NON_DIRECTORY_FILE 0x00000040
232 #define FILE_CREATE_TREE_CONNECTION 0x00000080
233 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
234 #define FILE_NO_EA_KNOWLEDGE 0x00000200
235 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400
236 #define FILE_RANDOM_ACCESS 0x00000800
237 #define FILE_DELETE_ON_CLOSE 0x00001000
238 #define FILE_OPEN_BY_FILE_ID 0x00002000
239 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
240 #define FILE_NO_COMPRESSION 0x00008000
241 #define FILE_RESERVE_OPFILTER 0x00100000
242 #define FILE_OPEN_REPARSE_POINT 0x00200000
243 #define FILE_OPEN_NO_RECALL 0x00400000
244 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
245
246 #define FILE_ALL_ACCESS \
247 (STANDARD_RIGHTS_REQUIRED | \
248 SYNCHRONIZE | \
249 0x1FF)
250
251 #define FILE_GENERIC_EXECUTE \
252 (STANDARD_RIGHTS_EXECUTE | \
253 FILE_READ_ATTRIBUTES | \
254 FILE_EXECUTE | \
255 SYNCHRONIZE)
256
257 #define FILE_GENERIC_READ \
258 (STANDARD_RIGHTS_READ | \
259 FILE_READ_DATA | \
260 FILE_READ_ATTRIBUTES | \
261 FILE_READ_EA | \
262 SYNCHRONIZE)
263
264 #define FILE_GENERIC_WRITE \
265 (STANDARD_RIGHTS_WRITE | \
266 FILE_WRITE_DATA | \
267 FILE_WRITE_ATTRIBUTES | \
268 FILE_WRITE_EA | \
269 FILE_APPEND_DATA | \
270 SYNCHRONIZE)
271 /* end winddk.h */
272 /* also in ddk/ntifs.h */
273 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
274 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
275 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
276 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
277 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
278 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
279 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
280 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
281 #define FILE_NOTIFY_CHANGE_EA 0x00000080
282 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
283 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
284 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
285 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
286 #define FILE_NOTIFY_VALID_MASK 0x00000fff
287
288 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
289 #define FILE_CASE_PRESERVED_NAMES 0x00000002
290 #define FILE_UNICODE_ON_DISK 0x00000004
291 #define FILE_PERSISTENT_ACLS 0x00000008
292 #define FILE_FILE_COMPRESSION 0x00000010
293 #define FILE_VOLUME_QUOTAS 0x00000020
294 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
295 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
296 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
297 #define FS_LFN_APIS 0x00004000
298 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
299 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
300 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
301 #define FILE_NAMED_STREAMS 0x00040000
302
303 #define IO_COMPLETION_QUERY_STATE 0x0001
304 #define IO_COMPLETION_MODIFY_STATE 0x0002
305 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
306 /* end ntifs.h */
307
308 /* also in ddk/winddk.h */
309 #define DUPLICATE_CLOSE_SOURCE 0x00000001
310 #define DUPLICATE_SAME_ACCESS 0x00000002
311 /* end winddk.k */
312
313 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
314 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
315 #define PROCESS_TERMINATE 1
316 #define PROCESS_CREATE_THREAD 2
317 #define PROCESS_SET_SESSIONID 4
318 #define PROCESS_VM_OPERATION 8
319 #define PROCESS_VM_READ 16
320 #define PROCESS_VM_WRITE 32
321 #define PROCESS_CREATE_PROCESS 128
322 #define PROCESS_SET_QUOTA 256
323 #define PROCESS_SET_INFORMATION 512
324 #define PROCESS_QUERY_INFORMATION 1024
325 #define PROCESS_SUSPEND_RESUME 2048
326 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
327 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
328 #define PROCESS_DUP_HANDLE 64
329 #define THREAD_TERMINATE 1
330 #define THREAD_SUSPEND_RESUME 2
331 #define THREAD_GET_CONTEXT 8
332 #define THREAD_SET_CONTEXT 16
333 #define THREAD_SET_INFORMATION 32
334 #define THREAD_QUERY_INFORMATION 64
335 #define THREAD_SET_THREAD_TOKEN 128
336 #define THREAD_IMPERSONATE 256
337 #define THREAD_DIRECT_IMPERSONATION 0x200
338 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
339 #define MUTANT_QUERY_STATE 0x0001
340 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
341 #define TIMER_QUERY_STATE 0x0001
342 #define TIMER_MODIFY_STATE 0x0002
343 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
344 #define THREAD_BASE_PRIORITY_LOWRT 15
345 #define THREAD_BASE_PRIORITY_MAX 2
346 #define THREAD_BASE_PRIORITY_MIN (-2)
347 #define THREAD_BASE_PRIORITY_IDLE (-15)
348
349 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
350 #define THREAD_RESUME 0x1000
351
352 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
353 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
354 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
355 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
356 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
357 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
358 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
359 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
360 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
361 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
362 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
363 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
364 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
365 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
366 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
367 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
368 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
369 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
370 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
371 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
372 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
373 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
374 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
375 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
376 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
377 #define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege")
378 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
379 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
380 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
381 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
382
383 #define SE_GROUP_MANDATORY 0x00000001
384 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
385 #define SE_GROUP_ENABLED 0x00000004
386 #define SE_GROUP_OWNER 0x00000008
387 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
388 #define SE_GROUP_INTEGRITY 0x00000020
389 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
390 #define SE_GROUP_LOGON_ID 0xC0000000
391 #define SE_GROUP_RESOURCE 0x20000000
392 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
393
394 /* FIXME: non-standard */
395 #define LANG_ESPERANTO 0x8f
396 #define LANG_WALON 0x90
397 #define LANG_CORNISH 0x92
398
399 /* FIXME: not present in the official headers */
400 #define LANG_MALAGASY 0x8d
401 #define LANG_GAELIC 0x94
402 #define LANG_SAAMI 0x3b
403 #define LANG_SUTU 0x30
404 #define LANG_TSONGA 0x31
405 #define LANG_VENDA 0x33
406 #define LANG_MANX_GAELIC 0x94
407 #define SUBLANG_PORTUGUESE_PORTUGAL 0x02
408
409 #define PROCESSOR_INTEL_386 386
410 #define PROCESSOR_INTEL_486 486
411 #define PROCESSOR_INTEL_PENTIUM 586
412 #define PROCESSOR_MIPS_R4000 4000
413 #define PROCESSOR_ALPHA_21064 21064
414 #define PROCESSOR_INTEL_IA64 2200
415 #define PROCESSOR_PPC_601 601
416 #define PROCESSOR_PPC_603 603
417 #define PROCESSOR_PPC_604 604
418 #define PROCESSOR_PPC_620 620
419 #define PROCESSOR_INTEL_860 860
420 #define PROCESSOR_AMD_X8664 8664
421 #define PROCESSOR_MIPS_R2000 2000
422 #define PROCESSOR_MIPS_R3000 3000
423 #define PROCESSOR_HITACHI_SH3 10003
424 #define PROCESSOR_HITACHI_SH3E 10004
425 #define PROCESSOR_HITACHI_SH4 10005
426 #define PROCESSOR_MOTOROLA_821 821
427 #define PROCESSOR_SHx_SH3 103
428 #define PROCESSOR_SHx_SH4 104
429 #define PROCESSOR_STRONGARM 2577
430 #define PROCESSOR_ARM720 1824
431 #define PROCESSOR_ARM820 2080
432 #define PROCESSOR_ARM920 2336
433 #define PROCESSOR_ARM_7TDMI 70001
434 #define PROCESSOR_ARCHITECTURE_INTEL 0
435 #define PROCESSOR_ARCHITECTURE_MIPS 1
436 #define PROCESSOR_ARCHITECTURE_ALPHA 2
437 #define PROCESSOR_ARCHITECTURE_PPC 3
438 #define PROCESSOR_ARCHITECTURE_SHX 4
439 #define PROCESSOR_ARCHITECTURE_ARM 5
440 #define PROCESSOR_ARCHITECTURE_IA64 6
441 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
442 #define PROCESSOR_ARCHITECTURE_MSIL 8
443 #define PROCESSOR_ARCHITECTURE_AMD64 9
444 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
445
446 /* Processor features */
447 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
448 #define PF_FLOATING_POINT_EMULATED 1
449 #define PF_COMPARE_EXCHANGE_DOUBLE 2
450 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
451 #define PF_PPC_MOVEMEM_64BIT_OK 4
452 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
453 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
454 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
455 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
456 #define PF_PAE_ENABLED 9
457 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
458 #define PF_SSE_DAZ_MODE_AVAILABLE 11
459 #define PF_NX_ENABLED 12
460 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
461 #define PF_COMPARE_EXCHANGE128 14
462 #define PF_COMPARE64_EXCHANGE128 15
463 #define PF_CHANNELS_ENABLED 16
464 #define PF_XSAVE_ENABLED 17
465 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
466 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
467 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
468 #define PF_VIRT_FIRMWARE_ENABLED 21
469 #define PF_RDWRFSGSBASE_AVAILABLE 22
470 #define PF_FASTFAIL_AVAILABLE 23
471 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
472 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
473 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
474 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
475 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
476 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
477 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
478 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
479
480 /* also in ddk/ntifs.h */
481 #define FILE_ACTION_ADDED 0x00000001
482 #define FILE_ACTION_REMOVED 0x00000002
483 #define FILE_ACTION_MODIFIED 0x00000003
484 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
485 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
486 #define FILE_ACTION_ADDED_STREAM 0x00000006
487 #define FILE_ACTION_REMOVED_STREAM 0x00000007
488 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
489 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
490 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
491 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
492 /* end ntifs.h */
493 #define HEAP_NO_SERIALIZE 1
494 #define HEAP_GROWABLE 2
495 #define HEAP_GENERATE_EXCEPTIONS 4
496 #define HEAP_ZERO_MEMORY 8
497 #define HEAP_REALLOC_IN_PLACE_ONLY 16
498 #define HEAP_TAIL_CHECKING_ENABLED 32
499 #define HEAP_FREE_CHECKING_ENABLED 64
500 #define HEAP_DISABLE_COALESCE_ON_FREE 128
501 #define HEAP_CREATE_ALIGN_16 0x10000
502 #define HEAP_CREATE_ENABLE_TRACING 0x20000
503 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
504 #define HEAP_MAXIMUM_TAG 0xFFF
505 #define HEAP_PSEUDO_TAG_FLAG 0x8000
506 #define HEAP_TAG_SHIFT 16
507 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
508
509 #define KEY_QUERY_VALUE 1
510 #define KEY_SET_VALUE 2
511 #define KEY_CREATE_SUB_KEY 4
512 #define KEY_ENUMERATE_SUB_KEYS 8
513 #define KEY_NOTIFY 16
514 #define KEY_CREATE_LINK 32
515 #define KEY_WOW64_64KEY 0x00000100
516 #define KEY_WOW64_32KEY 0x00000200
517 #define KEY_WOW64_RES 0x00000300
518
519 #define KEY_WRITE 0x20006
520 #define KEY_EXECUTE 0x20019
521 #define KEY_READ 0x20019
522 #define KEY_ALL_ACCESS 0xf003f
523 #define REG_WHOLE_HIVE_VOLATILE 1
524 #define REG_REFRESH_HIVE 2
525 #define REG_NO_LAZY_FLUSH 4
526 #define REG_FORCE_RESTORE 8
527 #define REG_OPTION_RESERVED 0
528 #define REG_OPTION_NON_VOLATILE 0
529 #define REG_OPTION_VOLATILE 1
530 #define REG_OPTION_CREATE_LINK 2
531 #define REG_OPTION_BACKUP_RESTORE 4
532 #define REG_OPTION_OPEN_LINK 8
533 #define REG_LEGAL_OPTION 15
534 #define MAXIMUM_PROCESSORS 32
535 #define PAGE_NOACCESS 0x0001
536 #define PAGE_READONLY 0x0002
537 #define PAGE_READWRITE 0x0004
538 #define PAGE_WRITECOPY 0x0008
539 #define PAGE_EXECUTE 0x0010
540 #define PAGE_EXECUTE_READ 0x0020
541 #define PAGE_EXECUTE_READWRITE 0x0040
542 #define PAGE_EXECUTE_WRITECOPY 0x0080
543 #define PAGE_GUARD 0x0100
544 #define PAGE_NOCACHE 0x0200
545 #define PAGE_WRITECOMBINE 0x0400
546 #define MEM_COMMIT 0x1000
547 #define MEM_RESERVE 0x2000
548 #define MEM_DECOMMIT 0x4000
549 #define MEM_RELEASE 0x8000
550 #define MEM_FREE 0x10000
551 #define MEM_PRIVATE 0x20000
552 #define MEM_MAPPED 0x40000
553 #define MEM_RESET 0x80000
554 #define MEM_TOP_DOWN 0x100000
555 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
556 #define MEM_PHYSICAL 0x400000
557 #define MEM_4MB_PAGES 0x80000000
558 #define MEM_IMAGE SEC_IMAGE
559 #define SEC_NO_CHANGE 0x00400000
560 #define SEC_FILE 0x00800000
561 #define SEC_IMAGE 0x01000000
562 #define SEC_VLM 0x02000000
563 #define SEC_RESERVE 0x04000000
564 #define SEC_COMMIT 0x08000000
565 #define SEC_NOCACHE 0x10000000
566 #define SEC_WRITECOMBINE 0x40000000
567 #define SEC_LARGE_PAGES 0x80000000
568 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
569 #define SECTION_EXTEND_SIZE 16
570 #define SECTION_MAP_READ 4
571 #define SECTION_MAP_WRITE 2
572 #define SECTION_QUERY 1
573 #define SECTION_MAP_EXECUTE 8
574 #define SECTION_ALL_ACCESS 0xf001f
575 #define WRITE_WATCH_FLAG_RESET 0x01
576 #define MESSAGE_RESOURCE_UNICODE 1
577 #define RTL_CRITSECT_TYPE 0
578 #define RTL_RESOURCE_TYPE 1
579
580 #define IMAGE_SIZEOF_FILE_HEADER 20
581 #define IMAGE_FILE_RELOCS_STRIPPED 1
582 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
583 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
584 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
585 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
586 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
587 #define IMAGE_FILE_BYTES_REVERSED_LO 128
588 #define IMAGE_FILE_32BIT_MACHINE 256
589 #define IMAGE_FILE_DEBUG_STRIPPED 512
590 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
591 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
592 #define IMAGE_FILE_SYSTEM 4096
593 #define IMAGE_FILE_DLL 8192
594 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
595 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
596 #define IMAGE_FILE_MACHINE_UNKNOWN 0
597
598 #define IMAGE_FILE_MACHINE_AM33 0x1d3
599 #define IMAGE_FILE_MACHINE_AMD64 0x8664
600 #define IMAGE_FILE_MACHINE_ARM 0x1c0
601 #define IMAGE_FILE_MACHINE_ARMNT 0x1c4
602 #define IMAGE_FILE_MACHINE_EBC 0xebc
603 #define IMAGE_FILE_MACHINE_I386 0x14c
604 #define IMAGE_FILE_MACHINE_IA64 0x200
605 #define IMAGE_FILE_MACHINE_M32R 0x9041
606 #define IMAGE_FILE_MACHINE_MIPS16 0x266
607 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366
608 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466
609 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0
610 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1
611 #define IMAGE_FILE_MACHINE_R4000 0x166
612 #define IMAGE_FILE_MACHINE_SH3 0x1a2
613 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
614 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3
615 #define IMAGE_FILE_MACHINE_SH4 0x1a6
616 #define IMAGE_FILE_MACHINE_SH5 0x1a8
617 #define IMAGE_FILE_MACHINE_THUMB 0x1c2
618 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169
619 #define IMAGE_FILE_MACHINE_R3000 0x162
620 #define IMAGE_FILE_MACHINE_R10000 0x168
621 #define IMAGE_FILE_MACHINE_ALPHA 0x184
622 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
623 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
624 #define IMAGE_FILE_MACHINE_CEE 0xC0EE
625 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
626 #define IMAGE_FILE_MACHINE_CEF 0x0CEF
627
628 /* Wine extension */
629 #define IMAGE_FILE_MACHINE_ARM64 0x1c5
630
631 #define IMAGE_FILE_EXPORT_DIRECTORY 0
632 #define IMAGE_FILE_IMPORT_DIRECTORY 1
633 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
634 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
635 #define IMAGE_FILE_SECURITY_DIRECTORY 4
636 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
637 #define IMAGE_FILE_DEBUG_DIRECTORY 6
638 #define IMAGE_FILE_DESCRIPTION_STRING 7
639 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
640 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
641 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
642
643 #define IMAGE_DOS_SIGNATURE 0x5A4D
644 #define IMAGE_OS2_SIGNATURE 0x454E
645 #define IMAGE_OS2_SIGNATURE_LE 0x454C
646 #define IMAGE_VXD_SIGNATURE 0x454C
647 #define IMAGE_NT_SIGNATURE 0x00004550
648 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
649 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
650 #ifdef _WIN64
651 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
652 #else
653 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
654 #endif
655 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
656 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
657 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
658 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
659 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
660 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
661 #define IMAGE_SIZEOF_SHORT_NAME 8
662 #define IMAGE_SIZEOF_SECTION_HEADER 40
663 #define IMAGE_SIZEOF_SYMBOL 18
664 #define IMAGE_SIZEOF_AUX_SYMBOL 18
665 #define IMAGE_SIZEOF_RELOCATION 10
666 #define IMAGE_SIZEOF_BASE_RELOCATION 8
667 #define IMAGE_SIZEOF_LINENUMBER 6
668 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
669 #define SIZEOF_RFPO_DATA 16
670
671 #define IMAGE_SUBSYSTEM_UNKNOWN 0
672 #define IMAGE_SUBSYSTEM_NATIVE 1
673 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
674 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
675 #define IMAGE_SUBSYSTEM_OS2_CUI 5
676 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
677 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
678 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
679 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
680 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
681 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
682 #define IMAGE_SUBSYSTEM_EFI_ROM 13
683 #define IMAGE_SUBSYSTEM_XBOX 14
684
685 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
686 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
687 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
688 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
689 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
690 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
691 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
692 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
693 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
694 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
695 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
696 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
697 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
698 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
699 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
700 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
701 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
702 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
703 #define IMAGE_DIRECTORY_ENTRY_TLS 9
704 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
705 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
706 #define IMAGE_DIRECTORY_ENTRY_IAT 12
707 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
708 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
709 #define IMAGE_SCN_TYPE_REG 0
710 #define IMAGE_SCN_TYPE_DSECT 1
711 //#define IMAGE_SCN_TYPE_NOLOAD 2
712 #define IMAGE_SCN_TYPE_GROUP 4
713 #define IMAGE_SCN_TYPE_NO_PAD 8
714 #define IMAGE_SCN_CNT_CODE 32
715 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
716 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
717 #define IMAGE_SCN_LNK_OTHER 256
718 #define IMAGE_SCN_LNK_INFO 512
719 #define IMAGE_SCN_LNK_REMOVE 2048
720 #define IMAGE_SCN_LNK_COMDAT 4096
721 #define IMAGE_SCN_MEM_FARDATA 0x8000
722 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
723 #define IMAGE_SCN_MEM_16BIT 0x20000
724 #define IMAGE_SCN_MEM_LOCKED 0x40000
725 #define IMAGE_SCN_MEM_PRELOAD 0x80000
726 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
727 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
728 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
729 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
730 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
731 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
732 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
733 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
734 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
735 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
736 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
737 #define IMAGE_SCN_MEM_SHARED 0x10000000
738 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
739 #define IMAGE_SCN_MEM_READ 0x40000000
740 #define IMAGE_SCN_MEM_WRITE 0x80000000
741 #define IMAGE_SYM_UNDEFINED 0
742 #define IMAGE_SYM_ABSOLUTE (-1)
743 #define IMAGE_SYM_DEBUG (-2)
744 #define IMAGE_SYM_TYPE_NULL 0
745 #define IMAGE_SYM_TYPE_VOID 1
746 #define IMAGE_SYM_TYPE_CHAR 2
747 #define IMAGE_SYM_TYPE_SHORT 3
748 #define IMAGE_SYM_TYPE_INT 4
749 #define IMAGE_SYM_TYPE_LONG 5
750 #define IMAGE_SYM_TYPE_FLOAT 6
751 #define IMAGE_SYM_TYPE_DOUBLE 7
752 #define IMAGE_SYM_TYPE_STRUCT 8
753 #define IMAGE_SYM_TYPE_UNION 9
754 #define IMAGE_SYM_TYPE_ENUM 10
755 #define IMAGE_SYM_TYPE_MOE 11
756 #define IMAGE_SYM_TYPE_BYTE 12
757 #define IMAGE_SYM_TYPE_WORD 13
758 #define IMAGE_SYM_TYPE_UINT 14
759 #define IMAGE_SYM_TYPE_DWORD 15
760 #define IMAGE_SYM_TYPE_PCODE 32768
761 #define IMAGE_SYM_DTYPE_NULL 0
762 #define IMAGE_SYM_DTYPE_POINTER 1
763 #define IMAGE_SYM_DTYPE_FUNCTION 2
764 #define IMAGE_SYM_DTYPE_ARRAY 3
765 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
766 #define IMAGE_SYM_CLASS_NULL 0
767 #define IMAGE_SYM_CLASS_AUTOMATIC 1
768 #define IMAGE_SYM_CLASS_EXTERNAL 2
769 #define IMAGE_SYM_CLASS_STATIC 3
770 #define IMAGE_SYM_CLASS_REGISTER 4
771 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
772 #define IMAGE_SYM_CLASS_LABEL 6
773 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
774 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
775 #define IMAGE_SYM_CLASS_ARGUMENT 9
776 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
777 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
778 #define IMAGE_SYM_CLASS_UNION_TAG 12
779 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
780 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
781 #define IMAGE_SYM_CLASS_ENUM_TAG 15
782 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
783 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
784 #define IMAGE_SYM_CLASS_BIT_FIELD 18
785 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
786 #define IMAGE_SYM_CLASS_BLOCK 100
787 #define IMAGE_SYM_CLASS_FUNCTION 101
788 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
789 #define IMAGE_SYM_CLASS_FILE 103
790 #define IMAGE_SYM_CLASS_SECTION 104
791 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
792 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
793 #define IMAGE_COMDAT_SELECT_ANY 2
794 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
795 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
796 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
797 #define IMAGE_COMDAT_SELECT_LARGEST 6
798 #define IMAGE_COMDAT_SELECT_NEWEST 7
799 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
800 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
801 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
802 #define IMAGE_REL_I386_ABSOLUTE 0
803 #define IMAGE_REL_I386_DIR16 1
804 #define IMAGE_REL_I386_REL16 2
805 #define IMAGE_REL_I386_DIR32 6
806 #define IMAGE_REL_I386_DIR32NB 7
807 #define IMAGE_REL_I386_SEG12 9
808 #define IMAGE_REL_I386_SECTION 10
809 #define IMAGE_REL_I386_SECREL 11
810 #define IMAGE_REL_I386_REL32 20
811 #define IMAGE_REL_MIPS_ABSOLUTE 0
812 #define IMAGE_REL_MIPS_REFHALF 1
813 #define IMAGE_REL_MIPS_REFWORD 2
814 #define IMAGE_REL_MIPS_JMPADDR 3
815 #define IMAGE_REL_MIPS_REFHI 4
816 #define IMAGE_REL_MIPS_REFLO 5
817 #define IMAGE_REL_MIPS_GPREL 6
818 #define IMAGE_REL_MIPS_LITERAL 7
819 #define IMAGE_REL_MIPS_SECTION 10
820 #define IMAGE_REL_MIPS_SECREL 11
821 #define IMAGE_REL_MIPS_SECRELLO 12
822 #define IMAGE_REL_MIPS_SECRELHI 13
823 #define IMAGE_REL_MIPS_REFWORDNB 34
824 #define IMAGE_REL_MIPS_PAIR 35
825 #define IMAGE_REL_ALPHA_ABSOLUTE 0
826 #define IMAGE_REL_ALPHA_REFLONG 1
827 #define IMAGE_REL_ALPHA_REFQUAD 2
828 #define IMAGE_REL_ALPHA_GPREL32 3
829 #define IMAGE_REL_ALPHA_LITERAL 4
830 #define IMAGE_REL_ALPHA_LITUSE 5
831 #define IMAGE_REL_ALPHA_GPDISP 6
832 #define IMAGE_REL_ALPHA_BRADDR 7
833 #define IMAGE_REL_ALPHA_HINT 8
834 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
835 #define IMAGE_REL_ALPHA_REFHI 10
836 #define IMAGE_REL_ALPHA_REFLO 11
837 #define IMAGE_REL_ALPHA_PAIR 12
838 #define IMAGE_REL_ALPHA_MATCH 13
839 #define IMAGE_REL_ALPHA_SECTION 14
840 #define IMAGE_REL_ALPHA_SECREL 15
841 #define IMAGE_REL_ALPHA_REFLONGNB 16
842 #define IMAGE_REL_ALPHA_SECRELLO 17
843 #define IMAGE_REL_ALPHA_SECRELHI 18
844 #define IMAGE_REL_PPC_ABSOLUTE 0
845 #define IMAGE_REL_PPC_ADDR64 1
846 #define IMAGE_REL_PPC_ADDR32 2
847 #define IMAGE_REL_PPC_ADDR24 3
848 #define IMAGE_REL_PPC_ADDR16 4
849 #define IMAGE_REL_PPC_ADDR14 5
850 #define IMAGE_REL_PPC_REL24 6
851 #define IMAGE_REL_PPC_REL14 7
852 #define IMAGE_REL_PPC_TOCREL16 8
853 #define IMAGE_REL_PPC_TOCREL14 9
854 #define IMAGE_REL_PPC_ADDR32NB 10
855 #define IMAGE_REL_PPC_SECREL 11
856 #define IMAGE_REL_PPC_SECTION 12
857 #define IMAGE_REL_PPC_IFGLUE 13
858 #define IMAGE_REL_PPC_IMGLUE 14
859 #define IMAGE_REL_PPC_SECREL16 15
860 #define IMAGE_REL_PPC_REFHI 16
861 #define IMAGE_REL_PPC_REFLO 17
862 #define IMAGE_REL_PPC_PAIR 18
863 #define IMAGE_REL_PPC_TYPEMASK 255
864 #define IMAGE_REL_PPC_NEG 256
865 #define IMAGE_REL_PPC_BRTAKEN 512
866 #define IMAGE_REL_PPC_BRNTAKEN 1024
867 #define IMAGE_REL_PPC_TOCDEFN 2048
868 #define IMAGE_REL_BASED_ABSOLUTE 0
869 #define IMAGE_REL_BASED_HIGH 1
870 #define IMAGE_REL_BASED_LOW 2
871 #define IMAGE_REL_BASED_HIGHLOW 3
872 #define IMAGE_REL_BASED_HIGHADJ 4
873 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
874 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
875 #define IMAGE_REL_BASED_IA64_IMM64 9
876 #define IMAGE_REL_BASED_DIR64 10
877 #define IMAGE_ARCHIVE_START_SIZE 8
878 #define IMAGE_ARCHIVE_START "!<arch>\n"
879 #define IMAGE_ARCHIVE_END "`\n"
880 #define IMAGE_ARCHIVE_PAD "\n"
881 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
882 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
883 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
884 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
885 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
886 #define IMAGE_DEBUG_TYPE_COFF 1
887 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
888 #define IMAGE_DEBUG_TYPE_FPO 3
889 #define IMAGE_DEBUG_TYPE_MISC 4
890 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
891 #define IMAGE_DEBUG_TYPE_FIXUP 6
892 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
893 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
894 #define FRAME_FPO 0
895 #define FRAME_TRAP 1
896 #define FRAME_TSS 2
897 #define FRAME_NONFPO 3
898 #define IMAGE_DEBUG_MISC_EXENAME 1
899 #define N_BTMASK 0x000F
900 #define N_TMASK 0x0030
901 #define N_TMASK1 0x00C0
902 #define N_TMASK2 0x00F0
903 #define N_BTSHFT 4
904 #define N_TSHIFT 2
905 #define IS_TEXT_UNICODE_ASCII16 1
906 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
907 #define IS_TEXT_UNICODE_STATISTICS 2
908 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
909 #define IS_TEXT_UNICODE_CONTROLS 4
910 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
911 #define IS_TEXT_UNICODE_SIGNATURE 8
912 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
913 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
914 #define IS_TEXT_UNICODE_ODD_LENGTH 512
915 #define IS_TEXT_UNICODE_NULL_BYTES 4096
916 #define IS_TEXT_UNICODE_UNICODE_MASK 15
917 #define IS_TEXT_UNICODE_REVERSE_MASK 240
918 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
919 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
920 #define SERVICE_KERNEL_DRIVER 1
921 #define SERVICE_FILE_SYSTEM_DRIVER 2
922 #define SERVICE_ADAPTER 4
923 #define SERVICE_RECOGNIZER_DRIVER 8
924 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
925 #define SERVICE_WIN32_OWN_PROCESS 16
926 #define SERVICE_WIN32_SHARE_PROCESS 32
927 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
928 #define SERVICE_INTERACTIVE_PROCESS 256
929 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
930 #define SERVICE_BOOT_START 0
931 #define SERVICE_SYSTEM_START 1
932 #define SERVICE_AUTO_START 2
933 #define SERVICE_DEMAND_START 3
934 #define SERVICE_DISABLED 4
935 #define SERVICE_ERROR_IGNORE 0
936 #define SERVICE_ERROR_NORMAL 1
937 #define SERVICE_ERROR_SEVERE 2
938 #define SERVICE_ERROR_CRITICAL 3
939
940 /* also in ddk/ntifs.h */
941 #define TOKEN_ASSIGN_PRIMARY (0x0001)
942 #define TOKEN_DUPLICATE (0x0002)
943 #define TOKEN_IMPERSONATE (0x0004)
944 #define TOKEN_QUERY (0x0008)
945 #define TOKEN_QUERY_SOURCE (0x0010)
946 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
947 #define TOKEN_ADJUST_GROUPS (0x0040)
948 #define TOKEN_ADJUST_DEFAULT (0x0080)
949 #define TOKEN_ADJUST_SESSIONID (0x0100)
950 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
951 TOKEN_ASSIGN_PRIMARY |\
952 TOKEN_DUPLICATE |\
953 TOKEN_IMPERSONATE |\
954 TOKEN_QUERY |\
955 TOKEN_QUERY_SOURCE |\
956 TOKEN_ADJUST_PRIVILEGES |\
957 TOKEN_ADJUST_GROUPS |\
958 TOKEN_ADJUST_DEFAULT |\
959 TOKEN_ADJUST_SESSIONID)
960 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
961 TOKEN_QUERY)
962 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
963 TOKEN_ADJUST_PRIVILEGES |\
964 TOKEN_ADJUST_GROUPS |\
965 TOKEN_ADJUST_DEFAULT)
966
967 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
968 #define TOKEN_SOURCE_LENGTH 8
969 /* end ddk/ntifs.h */
970 #define DLL_PROCESS_DETACH 0
971 #define DLL_PROCESS_ATTACH 1
972 #define DLL_THREAD_ATTACH 2
973 #define DLL_THREAD_DETACH 3
974 #ifdef __WINESRC__
975 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */
976 #endif
977 #define TAPE_ABSOLUTE_POSITION 0
978 #define TAPE_LOGICAL_POSITION 1
979 #define TAPE_PSEUDO_LOGICAL_POSITION 2
980 #define TAPE_REWIND 0
981 #define TAPE_ABSOLUTE_BLOCK 1
982 #define TAPE_LOGICAL_BLOCK 2
983 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
984 #define TAPE_SPACE_END_OF_DATA 4
985 #define TAPE_SPACE_RELATIVE_BLOCKS 5
986 #define TAPE_SPACE_FILEMARKS 6
987 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
988 #define TAPE_SPACE_SETMARKS 8
989 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
990 #define TAPE_DRIVE_FIXED 1
991 #define TAPE_DRIVE_SELECT 2
992 #define TAPE_DRIVE_INITIATOR 4
993 #define TAPE_DRIVE_ERASE_SHORT 16
994 #define TAPE_DRIVE_ERASE_LONG 32
995 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
996 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
997 #define TAPE_DRIVE_TAPE_CAPACITY 256
998 #define TAPE_DRIVE_TAPE_REMAINING 512
999 #define TAPE_DRIVE_FIXED_BLOCK 1024
1000 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
1001 #define TAPE_DRIVE_WRITE_PROTECT 4096
1002 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
1003 #define TAPE_DRIVE_ECC 0x10000
1004 #define TAPE_DRIVE_COMPRESSION 0x20000
1005 #define TAPE_DRIVE_PADDING 0x40000
1006 #define TAPE_DRIVE_REPORT_SMKS 0x80000
1007 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
1008 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
1009 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
1010 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
1011 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
1012 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
1013 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
1014 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
1015 #define TAPE_DRIVE_TENSION 0x80000002
1016 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
1017 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
1018 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
1019 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
1020 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
1021 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
1022 #define TAPE_DRIVE_SET_ECC 0x80000100
1023 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
1024 #define TAPE_DRIVE_SET_PADDING 0x80000400
1025 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
1026 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
1027 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
1028 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1029 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1030 #define TAPE_DRIVE_END_OF_DATA 0x80010000
1031 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1032 #define TAPE_DRIVE_FILEMARKS 0x80040000
1033 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1034 #define TAPE_DRIVE_SETMARKS 0x80100000
1035 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1036 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1037 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1038 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1039 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1040 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1041 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1042 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1043 #define TAPE_DRIVE_FORMAT 0xA0000000
1044 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1045 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1046 #define TAPE_FIXED_PARTITIONS 0
1047 #define TAPE_INITIATOR_PARTITIONS 2
1048 #define TAPE_SELECT_PARTITIONS 1
1049 #define TAPE_FILEMARKS 1
1050 #define TAPE_LONG_FILEMARKS 3
1051 #define TAPE_SETMARKS 0
1052 #define TAPE_SHORT_FILEMARKS 2
1053 #define TAPE_ERASE_LONG 1
1054 #define TAPE_ERASE_SHORT 0
1055 #define TAPE_LOAD 0
1056 #define TAPE_UNLOAD 1
1057 #define TAPE_TENSION 2
1058 #define TAPE_LOCK 3
1059 #define TAPE_UNLOCK 4
1060 #define TAPE_FORMAT 5
1061 #if (_WIN32_WINNT >= 0x0500)
1062 #define VER_MINORVERSION 0x0000001
1063 #define VER_MAJORVERSION 0x0000002
1064 #define VER_BUILDNUMBER 0x0000004
1065 #define VER_PLATFORMID 0x0000008
1066 #define VER_SERVICEPACKMINOR 0x0000010
1067 #define VER_SERVICEPACKMAJOR 0x0000020
1068 #define VER_SUITENAME 0x0000040
1069 #define VER_PRODUCT_TYPE 0x0000080
1070 #define VER_EQUAL 1
1071 #define VER_GREATER 2
1072 #define VER_GREATER_EQUAL 3
1073 #define VER_LESS 4
1074 #define VER_LESS_EQUAL 5
1075 #define VER_AND 6
1076 #define VER_OR 7
1077 #endif
1078
1079 #define VER_PLATFORM_WIN32s 0
1080 #define VER_PLATFORM_WIN32_WINDOWS 1
1081 #define VER_PLATFORM_WIN32_NT 2
1082 #define VER_NT_WORKSTATION 1
1083 #define VER_NT_DOMAIN_CONTROLLER 2
1084 #define VER_NT_SERVER 3
1085
1086 #define WT_EXECUTEDEFAULT 0x00000000
1087 #define WT_EXECUTEINIOTHREAD 0x00000001
1088 #define WT_EXECUTEINUITHREAD 0x00000002
1089 #define WT_EXECUTEINWAITTHREAD 0x00000004
1090 #define WT_EXECUTEONLYONCE 0x00000008
1091 #define WT_EXECUTELONGFUNCTION 0x00000010
1092 #define WT_EXECUTEINTIMERTHREAD 0x00000020
1093 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
1094 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1095 #define WT_TRANSFER_IMPERSONATION 0x00000100
1096 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16)
1097 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
1098 #if (_WIN32_WINNT >= 0x0501)
1099 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1100 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1101 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1102 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1103 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1104 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1105 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1106 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1107 #endif /* (_WIN32_WINNT >= 0x0501) */
1108 #define BTYPE(x) ((x)&N_BTMASK)
1109 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1110 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1111 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1112 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1113 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1114 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1115 #define TLS_MINIMUM_AVAILABLE 64
1116 #define FLS_MAXIMUM_AVAILABLE 128
1117 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1118 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1119 #define IO_REPARSE_TAG_RESERVED_ZERO 0
1120 #define IO_REPARSE_TAG_RESERVED_ONE 1
1121 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1122 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1123 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
1124 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1125 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1126 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1127 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1128 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1129 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
1130 #ifndef RC_INVOKED
1131
1132 #ifdef _GUID_DEFINED
1133 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1134 #endif
1135
1136 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1137 #define GUID_DEFINED
1138 typedef struct _GUID {
1139 unsigned long Data1;
1140 unsigned short Data2;
1141 unsigned short Data3;
1142 unsigned char Data4[8];
1143 } GUID, *REFGUID, *LPGUID;
1144 #endif /* GUID_DEFINED */
1145
1146 typedef enum _ACL_INFORMATION_CLASS {
1147 AclRevisionInformation = 1,
1148 AclSizeInformation
1149 } ACL_INFORMATION_CLASS;
1150
1151 typedef struct _ACL_REVISION_INFORMATION {
1152 DWORD AclRevision;
1153 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
1154
1155 typedef struct _ACL_SIZE_INFORMATION {
1156 DWORD AceCount;
1157 DWORD AclBytesInUse;
1158 DWORD AclBytesFree;
1159 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
1160
1161 #ifndef _LDT_ENTRY_DEFINED
1162 #define _LDT_ENTRY_DEFINED
1163
1164 typedef struct _LDT_ENTRY {
1165 WORD LimitLow;
1166 WORD BaseLow;
1167 union {
1168 struct {
1169 BYTE BaseMid;
1170 BYTE Flags1;
1171 BYTE Flags2;
1172 BYTE BaseHi;
1173 } Bytes;
1174 struct {
1175 DWORD BaseMid:8;
1176 DWORD Type:5;
1177 DWORD Dpl:2;
1178 DWORD Pres:1;
1179 DWORD LimitHi:4;
1180 DWORD Sys:1;
1181 DWORD Reserved_0:1;
1182 DWORD Default_Big:1;
1183 DWORD Granularity:1;
1184 DWORD BaseHi:8;
1185 } Bits;
1186 } HighWord;
1187 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
1188
1189 #endif /* _LDT_ENTRY_DEFINED */
1190
1191 /* FIXME: add more machines */
1192 #if defined(_X86_)
1193 #define SIZE_OF_80387_REGISTERS 80
1194 #define CONTEXT_i386 0x10000
1195 #define CONTEXT_i486 0x10000
1196 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
1197 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
1198 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
1199 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
1200 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
1201 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
1202 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
1203 #define MAXIMUM_SUPPORTED_EXTENSION 512
1204
1205 #define EXCEPTION_READ_FAULT 0
1206 #define EXCEPTION_WRITE_FAULT 1
1207 #define EXCEPTION_EXECUTE_FAULT 8
1208
1209 typedef struct _FLOATING_SAVE_AREA {
1210 DWORD ControlWord;
1211 DWORD StatusWord;
1212 DWORD TagWord;
1213 DWORD ErrorOffset;
1214 DWORD ErrorSelector;
1215 DWORD DataOffset;
1216 DWORD DataSelector;
1217 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
1218 DWORD Cr0NpxState;
1219 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
1220
1221 typedef struct _CONTEXT {
1222 DWORD ContextFlags;
1223 DWORD Dr0;
1224 DWORD Dr1;
1225 DWORD Dr2;
1226 DWORD Dr3;
1227 DWORD Dr6;
1228 DWORD Dr7;
1229 FLOATING_SAVE_AREA FloatSave;
1230 DWORD SegGs;
1231 DWORD SegFs;
1232 DWORD SegEs;
1233 DWORD SegDs;
1234 DWORD Edi;
1235 DWORD Esi;
1236 DWORD Ebx;
1237 DWORD Edx;
1238 DWORD Ecx;
1239 DWORD Eax;
1240 DWORD Ebp;
1241 DWORD Eip;
1242 DWORD SegCs;
1243 DWORD EFlags;
1244 DWORD Esp;
1245 DWORD SegSs;
1246 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
1247 } CONTEXT;
1248 #elif defined(_AMD64_)
1249
1250 #define CONTEXT_AMD64 0x100000
1251
1252 #if !defined(RC_INVOKED)
1253 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
1254 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
1255 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
1256 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
1257 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
1258
1259 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1260 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1261
1262 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1263 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1264 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1265 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1266 #endif
1267
1268 #define INITIAL_MXCSR 0x1f80
1269 #define INITIAL_FPCSR 0x027f
1270 #define EXCEPTION_READ_FAULT 0
1271 #define EXCEPTION_WRITE_FAULT 1
1272 #define EXCEPTION_EXECUTE_FAULT 8
1273
1274 typedef struct DECLSPEC_ALIGN(16) _M128A {
1275 ULONGLONG Low;
1276 LONGLONG High;
1277 } M128A, *PM128A;
1278
1279 typedef struct _XMM_SAVE_AREA32 {
1280 WORD ControlWord;
1281 WORD StatusWord;
1282 BYTE TagWord;
1283 BYTE Reserved1;
1284 WORD ErrorOpcode;
1285 DWORD ErrorOffset;
1286 WORD ErrorSelector;
1287 WORD Reserved2;
1288 DWORD DataOffset;
1289 WORD DataSelector;
1290 WORD Reserved3;
1291 DWORD MxCsr;
1292 DWORD MxCsr_Mask;
1293 M128A FloatRegisters[8];
1294 M128A XmmRegisters[16];
1295 BYTE Reserved4[96];
1296 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
1297
1298 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
1299 DWORD64 P1Home;
1300 DWORD64 P2Home;
1301 DWORD64 P3Home;
1302 DWORD64 P4Home;
1303 DWORD64 P5Home;
1304 DWORD64 P6Home;
1305
1306 /* Control flags */
1307 DWORD ContextFlags;
1308 DWORD MxCsr;
1309
1310 /* Segment */
1311 WORD SegCs;
1312 WORD SegDs;
1313 WORD SegEs;
1314 WORD SegFs;
1315 WORD SegGs;
1316 WORD SegSs;
1317 DWORD EFlags;
1318
1319 /* Debug */
1320 DWORD64 Dr0;
1321 DWORD64 Dr1;
1322 DWORD64 Dr2;
1323 DWORD64 Dr3;
1324 DWORD64 Dr6;
1325 DWORD64 Dr7;
1326
1327 /* Integer */
1328 DWORD64 Rax;
1329 DWORD64 Rcx;
1330 DWORD64 Rdx;
1331 DWORD64 Rbx;
1332 DWORD64 Rsp;
1333 DWORD64 Rbp;
1334 DWORD64 Rsi;
1335 DWORD64 Rdi;
1336 DWORD64 R8;
1337 DWORD64 R9;
1338 DWORD64 R10;
1339 DWORD64 R11;
1340 DWORD64 R12;
1341 DWORD64 R13;
1342 DWORD64 R14;
1343 DWORD64 R15;
1344
1345 /* Counter */
1346 DWORD64 Rip;
1347
1348 /* Floating point */
1349 union {
1350 XMM_SAVE_AREA32 FltSave;
1351 struct {
1352 M128A Header[2];
1353 M128A Legacy[8];
1354 M128A Xmm0;
1355 M128A Xmm1;
1356 M128A Xmm2;
1357 M128A Xmm3;
1358 M128A Xmm4;
1359 M128A Xmm5;
1360 M128A Xmm6;
1361 M128A Xmm7;
1362 M128A Xmm8;
1363 M128A Xmm9;
1364 M128A Xmm10;
1365 M128A Xmm11;
1366 M128A Xmm12;
1367 M128A Xmm13;
1368 M128A Xmm14;
1369 M128A Xmm15;
1370 } DUMMYSTRUCTNAME;
1371 } DUMMYUNIONNAME;
1372
1373 /* Vector */
1374 M128A VectorRegister[26];
1375 DWORD64 VectorControl;
1376
1377 /* Debug control */
1378 DWORD64 DebugControl;
1379 DWORD64 LastBranchToRip;
1380 DWORD64 LastBranchFromRip;
1381 DWORD64 LastExceptionToRip;
1382 DWORD64 LastExceptionFromRip;
1383 } CONTEXT;
1384
1385
1386 typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
1387 union {
1388 PM128A FloatingContext[16];
1389 struct {
1390 PM128A Xmm0;
1391 PM128A Xmm1;
1392 PM128A Xmm2;
1393 PM128A Xmm3;
1394 PM128A Xmm4;
1395 PM128A Xmm5;
1396 PM128A Xmm6;
1397 PM128A Xmm7;
1398 PM128A Xmm8;
1399 PM128A Xmm9;
1400 PM128A Xmm10;
1401 PM128A Xmm11;
1402 PM128A Xmm12;
1403 PM128A Xmm13;
1404 PM128A Xmm14;
1405 PM128A Xmm15;
1406 } DUMMYSTRUCTNAME;
1407 } DUMMYUNIONNAME;
1408
1409 union {
1410 PULONG64 IntegerContext[16];
1411 struct {
1412 PULONG64 Rax;
1413 PULONG64 Rcx;
1414 PULONG64 Rdx;
1415 PULONG64 Rbx;
1416 PULONG64 Rsp;
1417 PULONG64 Rbp;
1418 PULONG64 Rsi;
1419 PULONG64 Rdi;
1420 PULONG64 R8;
1421 PULONG64 R9;
1422 PULONG64 R10;
1423 PULONG64 R11;
1424 PULONG64 R12;
1425 PULONG64 R13;
1426 PULONG64 R14;
1427 PULONG64 R15;
1428 } DUMMYSTRUCTNAME;
1429 } DUMMYUNIONNAME2;
1430 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1431
1432 #define RUNTIME_FUNCTION_INDIRECT 0x1
1433
1434 typedef struct _RUNTIME_FUNCTION {
1435 DWORD BeginAddress;
1436 DWORD EndAddress;
1437 DWORD UnwindData;
1438 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
1439
1440 #define UNWIND_HISTORY_TABLE_SIZE 12
1441
1442 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1443 {
1444 DWORD64 ImageBase;
1445 PRUNTIME_FUNCTION FunctionEntry;
1446 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1447
1448 typedef struct _UNWIND_HISTORY_TABLE
1449 {
1450 DWORD Count;
1451 UCHAR Search;
1452 ULONG64 LowAddress;
1453 ULONG64 HighAddress;
1454 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1455 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1456
1457 typedef
1458 _Function_class_(GET_RUNTIME_FUNCTION_CALLBACK)
1459 PRUNTIME_FUNCTION
1460 (*PGET_RUNTIME_FUNCTION_CALLBACK)(
1461 _In_ DWORD64 ControlPc,
1462 _In_opt_ PVOID Context);
1463
1464 typedef
1465 _Function_class_(OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)
1466 _Must_inspect_result_
1467 DWORD
1468 (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(
1469 _In_ HANDLE Process,
1470 _In_ PVOID TableAddress,
1471 _Out_ PDWORD Entries,
1472 _Out_ PRUNTIME_FUNCTION *Functions);
1473
1474 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
1475
1476 NTSYSAPI
1477 VOID
1478 __cdecl
1479 RtlRestoreContext(struct _CONTEXT *ContextRecord,
1480 struct _EXCEPTION_RECORD *ExceptionRecord);
1481
1482 NTSYSAPI
1483 BOOLEAN
1484 __cdecl
1485 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,
1486 DWORD EntryCount,
1487 DWORD64 BaseAddress);
1488
1489 NTSYSAPI
1490 BOOLEAN
1491 __cdecl
1492 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,
1493 DWORD64 BaseAddress,
1494 DWORD Length,
1495 PGET_RUNTIME_FUNCTION_CALLBACK Callback,
1496 PVOID Context,
1497 PCWSTR OutOfProcessCallbackDll);
1498
1499 NTSYSAPI
1500 BOOLEAN
1501 __cdecl
1502 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
1503
1504 NTSYSAPI
1505 PRUNTIME_FUNCTION
1506 NTAPI
1507 RtlLookupFunctionEntry(
1508 _In_ DWORD64 ControlPc,
1509 _Out_ PDWORD64 ImageBase,
1510 _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable);
1511
1512 NTSYSAPI
1513 PEXCEPTION_ROUTINE
1514 NTAPI
1515 RtlVirtualUnwind(
1516 _In_ DWORD HandlerType,
1517 _In_ DWORD64 ImageBase,
1518 _In_ DWORD64 ControlPc,
1519 _In_ PRUNTIME_FUNCTION FunctionEntry,
1520 _Inout_ struct _CONTEXT *ContextRecord,
1521 _Out_ PVOID *HandlerData,
1522 _Out_ PDWORD64 EstablisherFrame,
1523 _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
1524
1525 #elif defined(_PPC_)
1526 #define CONTEXT_CONTROL 1L
1527 #define CONTEXT_FLOATING_POINT 2L
1528 #define CONTEXT_INTEGER 4L
1529 #define CONTEXT_DEBUG_REGISTERS 8L
1530 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1531 typedef struct _FLOATING_SAVE_AREA
1532 {
1533 double Fpr0;
1534 double Fpr1;
1535 double Fpr2;
1536 double Fpr3;
1537 double Fpr4;
1538 double Fpr5;
1539 double Fpr6;
1540 double Fpr7;
1541 double Fpr8;
1542 double Fpr9;
1543 double Fpr10;
1544 double Fpr11;
1545 double Fpr12;
1546 double Fpr13;
1547 double Fpr14;
1548 double Fpr15;
1549 double Fpr16;
1550 double Fpr17;
1551 double Fpr18;
1552 double Fpr19;
1553 double Fpr20;
1554 double Fpr21;
1555 double Fpr22;
1556 double Fpr23;
1557 double Fpr24;
1558 double Fpr25;
1559 double Fpr26;
1560 double Fpr27;
1561 double Fpr28;
1562 double Fpr29;
1563 double Fpr30;
1564 double Fpr31;
1565 double Fpscr;
1566 } FLOATING_SAVE_AREA;
1567
1568 typedef struct _CONTEXT {
1569 FLOATING_SAVE_AREA FloatSave;
1570 DWORD Gpr0;
1571 DWORD Gpr1;
1572 DWORD Gpr2;
1573 DWORD Gpr3;
1574 DWORD Gpr4;
1575 DWORD Gpr5;
1576 DWORD Gpr6;
1577 DWORD Gpr7;
1578 DWORD Gpr8;
1579 DWORD Gpr9;
1580 DWORD Gpr10;
1581 DWORD Gpr11;
1582 DWORD Gpr12;
1583 DWORD Gpr13;
1584 DWORD Gpr14;
1585 DWORD Gpr15;
1586 DWORD Gpr16;
1587 DWORD Gpr17;
1588 DWORD Gpr18;
1589 DWORD Gpr19;
1590 DWORD Gpr20;
1591 DWORD Gpr21;
1592 DWORD Gpr22;
1593 DWORD Gpr23;
1594 DWORD Gpr24;
1595 DWORD Gpr25;
1596 DWORD Gpr26;
1597 DWORD Gpr27;
1598 DWORD Gpr28;
1599 DWORD Gpr29;
1600 DWORD Gpr30;
1601 DWORD Gpr31;
1602 DWORD Cr;
1603 DWORD Xer;
1604 DWORD Msr;
1605 DWORD Iar;
1606 DWORD Lr;
1607 DWORD Ctr;
1608 DWORD ContextFlags;
1609 DWORD Fill[3];
1610 DWORD Dr0;
1611 DWORD Dr1;
1612 DWORD Dr2;
1613 DWORD Dr3;
1614 DWORD Dr4;
1615 DWORD Dr5;
1616 DWORD Dr6;
1617 DWORD Dr7;
1618 } CONTEXT;
1619 #elif defined(_ALPHA_)
1620 #define CONTEXT_ALPHA 0x20000
1621 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1622 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1623 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1624 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1625 typedef struct _CONTEXT {
1626 ULONGLONG FltF0;
1627 ULONGLONG FltF1;
1628 ULONGLONG FltF2;
1629 ULONGLONG FltF3;
1630 ULONGLONG FltF4;
1631 ULONGLONG FltF5;
1632 ULONGLONG FltF6;
1633 ULONGLONG FltF7;
1634 ULONGLONG FltF8;
1635 ULONGLONG FltF9;
1636 ULONGLONG FltF10;
1637 ULONGLONG FltF11;
1638 ULONGLONG FltF12;
1639 ULONGLONG FltF13;
1640 ULONGLONG FltF14;
1641 ULONGLONG FltF15;
1642 ULONGLONG FltF16;
1643 ULONGLONG FltF17;
1644 ULONGLONG FltF18;
1645 ULONGLONG FltF19;
1646 ULONGLONG FltF20;
1647 ULONGLONG FltF21;
1648 ULONGLONG FltF22;
1649 ULONGLONG FltF23;
1650 ULONGLONG FltF24;
1651 ULONGLONG FltF25;
1652 ULONGLONG FltF26;
1653 ULONGLONG FltF27;
1654 ULONGLONG FltF28;
1655 ULONGLONG FltF29;
1656 ULONGLONG FltF30;
1657 ULONGLONG FltF31;
1658 ULONGLONG IntV0;
1659 ULONGLONG IntT0;
1660 ULONGLONG IntT1;
1661 ULONGLONG IntT2;
1662 ULONGLONG IntT3;
1663 ULONGLONG IntT4;
1664 ULONGLONG IntT5;
1665 ULONGLONG IntT6;
1666 ULONGLONG IntT7;
1667 ULONGLONG IntS0;
1668 ULONGLONG IntS1;
1669 ULONGLONG IntS2;
1670 ULONGLONG IntS3;
1671 ULONGLONG IntS4;
1672 ULONGLONG IntS5;
1673 ULONGLONG IntFp;
1674 ULONGLONG IntA0;
1675 ULONGLONG IntA1;
1676 ULONGLONG IntA2;
1677 ULONGLONG IntA3;
1678 ULONGLONG IntA4;
1679 ULONGLONG IntA5;
1680 ULONGLONG IntT8;
1681 ULONGLONG IntT9;
1682 ULONGLONG IntT10;
1683 ULONGLONG IntT11;
1684 ULONGLONG IntRa;
1685 ULONGLONG IntT12;
1686 ULONGLONG IntAt;
1687 ULONGLONG IntGp;
1688 ULONGLONG IntSp;
1689 ULONGLONG IntZero;
1690 ULONGLONG Fpcr;
1691 ULONGLONG SoftFpcr;
1692 ULONGLONG Fir;
1693 DWORD Psr;
1694 DWORD ContextFlags;
1695 DWORD Fill[4];
1696 } CONTEXT;
1697 #elif defined(_SH_)
1698
1699 /* These are the debug or break registers on the SH3 */
1700 typedef struct _DEBUG_REGISTERS {
1701 DWORD BarA;
1702 UCHAR BasrA;
1703 UCHAR BamrA;
1704 USHORT BbrA;
1705 DWORD BarB;
1706 UCHAR BasrB;
1707 UCHAR BamrB;
1708 USHORT BbrB;
1709 DWORD BdrB;
1710 DWORD BdmrB;
1711 USHORT Brcr;
1712 USHORT Align;
1713 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
1714
1715 /* The following flags control the contents of the CONTEXT structure. */
1716
1717 #define CONTEXT_SH3 0x00000040
1718 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
1719
1720 #ifdef SH3
1721 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
1722 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
1723 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
1724 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
1725 #else /* SH4 */
1726 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
1727 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
1728 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
1729 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
1730 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
1731 #endif
1732
1733 /* Context Frame */
1734
1735 /* This frame is used to store a limited processor context into the */
1736 /* Thread structure for CPUs which have no floating point support. */
1737
1738 typedef struct _CONTEXT {
1739 /* The flags values within this flag control the contents of */
1740 /* a CONTEXT record. */
1741
1742 /* If the context record is used as an input parameter, then */
1743 /* for each portion of the context record controlled by a flag */
1744 /* whose value is set, it is assumed that that portion of the */
1745 /* context record contains valid context. If the context record */
1746 /* is being used to modify a thread's context, then only that */
1747 /* portion of the threads context will be modified. */
1748
1749 /* If the context record is used as an IN OUT parameter to capture */
1750 /* the context of a thread, then only those portions of the thread's */
1751 /* context corresponding to set flags will be returned. */
1752
1753 /* The context record is never used as an OUT only parameter. */
1754
1755
1756 DWORD ContextFlags;
1757
1758 /* This section is specified/returned if the ContextFlags word contains */
1759 /* the flag CONTEXT_INTEGER. */
1760
1761 /* N.B. The registers RA and R15 are defined in this section, but are */
1762 /* considered part of the control context rather than part of the integer */
1763 /* context. */
1764
1765 DWORD PR;
1766 DWORD MACH;
1767 DWORD MACL;
1768 DWORD GBR;
1769 DWORD R0;
1770 DWORD R1;
1771 DWORD R2;
1772 DWORD R3;
1773 DWORD R4;
1774 DWORD R5;
1775 DWORD R6;
1776 DWORD R7;
1777 DWORD R8;
1778 DWORD R9;
1779 DWORD R10;
1780 DWORD R11;
1781 DWORD R12;
1782 DWORD R13;
1783 DWORD R14;
1784 DWORD R15;
1785
1786 /* This section is specified/returned if the ContextFlags word contains */
1787 /* the flag CONTEXT_CONTROL. */
1788
1789 /* N.B. The registers r15 and ra are defined in the integer section, */
1790 /* but are considered part of the control context rather than part of */
1791 /* the integer context. */
1792
1793 DWORD Fir;
1794 DWORD Psr;
1795
1796 #if !defined(SH3e) && !defined(SH4)
1797 DWORD OldStuff[2];
1798 DEBUG_REGISTERS DebugRegisters;
1799 #else
1800 DWORD Fpscr;
1801 DWORD Fpul;
1802 DWORD FRegs[16];
1803 #if defined(SH4)
1804 DWORD xFRegs[16];
1805 #endif
1806 #endif
1807 } CONTEXT;
1808
1809 #elif defined(_MIPS_)
1810
1811 /* The following flags control the contents of the CONTEXT structure. */
1812
1813 #define CONTEXT_R4000 0x00010000 /* r4000 context */
1814
1815 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
1816 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
1817 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
1818
1819 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1820
1821 /* Context Frame */
1822
1823 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
1824
1825 /* This frame has a several purposes: 1) it is used as an argument to */
1826 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
1827 /* 3) it is used to construct a call frame for exception dispatching */
1828 /* in user mode, and 4) it is used in the user level thread creation */
1829 /* routines. */
1830
1831 /* The layout of the record conforms to a standard call frame. */
1832
1833
1834 typedef struct _CONTEXT {
1835
1836 /* This section is always present and is used as an argument build */
1837 /* area. */
1838
1839 DWORD Argument[4];
1840
1841 /* This section is specified/returned if the ContextFlags word contains */
1842 /* the flag CONTEXT_FLOATING_POINT. */
1843
1844 DWORD FltF0;
1845 DWORD FltF1;
1846 DWORD FltF2;
1847 DWORD FltF3;
1848 DWORD FltF4;
1849 DWORD FltF5;
1850 DWORD FltF6;
1851 DWORD FltF7;
1852 DWORD FltF8;
1853 DWORD FltF9;
1854 DWORD FltF10;
1855 DWORD FltF11;
1856 DWORD FltF12;
1857 DWORD FltF13;
1858 DWORD FltF14;
1859 DWORD FltF15;
1860 DWORD FltF16;
1861 DWORD FltF17;
1862 DWORD FltF18;
1863 DWORD FltF19;
1864 DWORD FltF20;
1865 DWORD FltF21;
1866 DWORD FltF22;
1867 DWORD FltF23;
1868 DWORD FltF24;
1869 DWORD FltF25;
1870 DWORD FltF26;
1871 DWORD FltF27;
1872 DWORD FltF28;
1873 DWORD FltF29;
1874 DWORD FltF30;
1875 DWORD FltF31;
1876
1877 /* This section is specified/returned if the ContextFlags word contains */
1878 /* the flag CONTEXT_INTEGER. */
1879
1880 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
1881 /* considered part of the control context rather than part of the integer */
1882 /* context. */
1883
1884 /* N.B. Register zero is not stored in the frame. */
1885
1886 DWORD IntZero;
1887 DWORD IntAt;
1888 DWORD IntV0;
1889 DWORD IntV1;
1890 DWORD IntA0;
1891 DWORD IntA1;
1892 DWORD IntA2;
1893 DWORD IntA3;
1894 DWORD IntT0;
1895 DWORD IntT1;
1896 DWORD IntT2;
1897 DWORD IntT3;
1898 DWORD IntT4;
1899 DWORD IntT5;
1900 DWORD IntT6;
1901 DWORD IntT7;
1902 DWORD IntS0;
1903 DWORD IntS1;
1904 DWORD IntS2;
1905 DWORD IntS3;
1906 DWORD IntS4;
1907 DWORD IntS5;
1908 DWORD IntS6;
1909 DWORD IntS7;
1910 DWORD IntT8;
1911 DWORD IntT9;
1912 DWORD IntK0;
1913 DWORD IntK1;
1914 DWORD IntGp;
1915 DWORD IntSp;
1916 DWORD IntS8;
1917 DWORD IntRa;
1918 DWORD IntLo;
1919 DWORD IntHi;
1920
1921 /* This section is specified/returned if the ContextFlags word contains */
1922 /* the flag CONTEXT_FLOATING_POINT. */
1923
1924 DWORD Fsr;
1925
1926 /* This section is specified/returned if the ContextFlags word contains */
1927 /* the flag CONTEXT_CONTROL. */
1928
1929 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
1930 /* but are considered part of the control context rather than part of */
1931 /* the integer context. */
1932
1933 DWORD Fir;
1934 DWORD Psr;
1935
1936 /* The flags values within this flag control the contents of */
1937 /* a CONTEXT record. */
1938
1939 /* If the context record is used as an input parameter, then */
1940 /* for each portion of the context record controlled by a flag */
1941 /* whose value is set, it is assumed that that portion of the */
1942 /* context record contains valid context. If the context record */
1943 /* is being used to modify a thread's context, then only that */
1944 /* portion of the threads context will be modified. */
1945
1946 /* If the context record is used as an IN OUT parameter to capture */
1947 /* the context of a thread, then only those portions of the thread's */
1948 /* context corresponding to set flags will be returned. */
1949
1950 /* The context record is never used as an OUT only parameter. */
1951
1952 DWORD ContextFlags;
1953
1954 DWORD Fill[2];
1955
1956 } CONTEXT;
1957 #elif defined(_ARM_)
1958
1959 #ifndef PAGE_SIZE
1960 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
1961 #endif
1962
1963 /* The following flags control the contents of the CONTEXT structure. */
1964
1965 #define CONTEXT_ARM 0x200000L
1966 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1967 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1968 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
1969 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
1970 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1971
1972 #define EXCEPTION_READ_FAULT 0
1973 #define EXCEPTION_WRITE_FAULT 1
1974 #define EXCEPTION_EXECUTE_FAULT 8
1975
1976 typedef struct _NEON128
1977 {
1978 ULONGLONG Low;
1979 LONGLONG High;
1980 } NEON128, *PNEON128;
1981
1982 #define ARM_MAX_BREAKPOINTS 8
1983 #define ARM_MAX_WATCHPOINTS 1
1984
1985 typedef struct _CONTEXT
1986 {
1987 /* The flags values within this flag control the contents of
1988 a CONTEXT record.
1989
1990 If the context record is used as an input parameter, then
1991 for each portion of the context record controlled by a flag
1992 whose value is set, it is assumed that that portion of the
1993 context record contains valid context. If the context record
1994 is being used to modify a thread's context, then only that
1995 portion of the threads context will be modified.
1996
1997 If the context record is used as an IN OUT parameter to capture
1998 the context of a thread, then only those portions of the thread's
1999 context corresponding to set flags will be returned.
2000
2001 The context record is never used as an OUT only parameter. */
2002 DWORD ContextFlags;
2003
2004 /* This section is specified/returned if the ContextFlags word contains
2005 the flag CONTEXT_INTEGER. */
2006 DWORD R0;
2007 DWORD R1;
2008 DWORD R2;
2009 DWORD R3;
2010 DWORD R4;
2011 DWORD R5;
2012 DWORD R6;
2013 DWORD R7;
2014 DWORD R8;
2015 DWORD R9;
2016 DWORD R10;
2017 DWORD R11;
2018 DWORD R12;
2019
2020 DWORD Sp;
2021 DWORD Lr;
2022 DWORD Pc;
2023 DWORD Cpsr;
2024
2025 /* Floating Point/NEON Registers */
2026 DWORD Fpscr;
2027 DWORD Padding;
2028 union
2029 {
2030 NEON128 Q[16];
2031 ULONGLONG D[32];
2032 DWORD S[32];
2033 } DUMMYUNIONNAME;
2034
2035 /* Debug registers */
2036 DWORD Bvr[ARM_MAX_BREAKPOINTS];
2037 DWORD Bcr[ARM_MAX_BREAKPOINTS];
2038 DWORD Wvr[ARM_MAX_WATCHPOINTS];
2039 DWORD Wcr[ARM_MAX_WATCHPOINTS];
2040
2041 DWORD Padding2[2];
2042 } CONTEXT;
2043
2044 #else
2045 #error "undefined processor type"
2046 #endif
2047 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
2048
2049 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2050 #define EXCEPTION_NONCONTINUABLE 0x01
2051 #define EXCEPTION_UNWINDING 0x02
2052 #define EXCEPTION_EXIT_UNWIND 0x04
2053 #define EXCEPTION_STACK_INVALID 0x08
2054 #define EXCEPTION_NESTED_CALL 0x10
2055 #define EXCEPTION_TARGET_UNWIND 0x20
2056 #define EXCEPTION_COLLIDED_UNWIND 0x40
2057 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
2058 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
2059
2060 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
2061 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
2062 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
2063
2064 typedef struct _EXCEPTION_RECORD {
2065 DWORD ExceptionCode;
2066 DWORD ExceptionFlags;
2067 struct _EXCEPTION_RECORD *ExceptionRecord;
2068 PVOID ExceptionAddress;
2069 DWORD NumberParameters;
2070 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2071 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2072
2073 typedef struct _EXCEPTION_RECORD32 {
2074 DWORD ExceptionCode;
2075 DWORD ExceptionFlags;
2076 DWORD ExceptionRecord;
2077 DWORD ExceptionAddress;
2078 DWORD NumberParameters;
2079 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2080 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
2081
2082 typedef struct _EXCEPTION_RECORD64 {
2083 DWORD ExceptionCode;
2084 DWORD ExceptionFlags;
2085 DWORD64 ExceptionRecord;
2086 DWORD64 ExceptionAddress;
2087 DWORD NumberParameters;
2088 DWORD __unusedAlignment;
2089 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2090 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
2091
2092 typedef struct _EXCEPTION_POINTERS {
2093 PEXCEPTION_RECORD ExceptionRecord;
2094 PCONTEXT ContextRecord;
2095 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
2096
2097 typedef struct _SECURITY_ATTRIBUTES {
2098 DWORD nLength;
2099 LPVOID lpSecurityDescriptor;
2100 BOOL bInheritHandle;
2101 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
2102
2103 #define SECURITY_MIN_SID_SIZE (sizeof(SID))
2104
2105 $include(setypes.h)
2106
2107 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
2108 ACE_HEADER Header;
2109 ACCESS_MASK Mask;
2110 DWORD Flags;
2111 GUID ObjectType;
2112 GUID InheritedObjectType;
2113 DWORD SidStart;
2114 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
2115
2116 typedef struct _ACCESS_DENIED_OBJECT_ACE {
2117 ACE_HEADER Header;
2118 ACCESS_MASK Mask;
2119 DWORD Flags;
2120 GUID ObjectType;
2121 GUID InheritedObjectType;
2122 DWORD SidStart;
2123 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
2124
2125 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
2126 ACE_HEADER Header;
2127 ACCESS_MASK Mask;
2128 DWORD Flags;
2129 GUID ObjectType;
2130 GUID InheritedObjectType;
2131 DWORD SidStart;
2132 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
2133
2134 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
2135 ACE_HEADER Header;
2136 ACCESS_MASK Mask;
2137 DWORD Flags;
2138 GUID ObjectType;
2139 GUID InheritedObjectType;
2140 DWORD SidStart;
2141 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
2142
2143 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
2144 ACE_HEADER Header;
2145 ACCESS_MASK Mask;
2146 DWORD SidStart;
2147 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE;
2148
2149 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
2150 ACE_HEADER Header;
2151 ACCESS_MASK Mask;
2152 DWORD SidStart;
2153 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE;
2154
2155 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
2156 ACE_HEADER Header;
2157 ACCESS_MASK Mask;
2158 DWORD SidStart;
2159 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE;
2160
2161 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
2162 ACE_HEADER Header;
2163 ACCESS_MASK Mask;
2164 DWORD SidStart;
2165 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE;
2166
2167 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
2168 ACE_HEADER Header;
2169 ACCESS_MASK Mask;
2170 DWORD Flags;
2171 GUID ObjectType;
2172 GUID InheritedObjectType;
2173 DWORD SidStart;
2174 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2175
2176 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2177 ACE_HEADER Header;
2178 ACCESS_MASK Mask;
2179 DWORD Flags;
2180 GUID ObjectType;
2181 GUID InheritedObjectType;
2182 DWORD SidStart;
2183 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
2184
2185 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2186 ACE_HEADER Header;
2187 ACCESS_MASK Mask;
2188 DWORD Flags;
2189 GUID ObjectType;
2190 GUID InheritedObjectType;
2191 DWORD SidStart;
2192 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2193
2194 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2195 ACE_HEADER Header;
2196 ACCESS_MASK Mask;
2197 DWORD Flags;
2198 GUID ObjectType;
2199 GUID InheritedObjectType;
2200 DWORD SidStart;
2201 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2202
2203 typedef struct _TOKEN_SOURCE {
2204 CHAR SourceName[TOKEN_SOURCE_LENGTH];
2205 LUID SourceIdentifier;
2206 } TOKEN_SOURCE,*PTOKEN_SOURCE;
2207
2208 typedef struct _TOKEN_CONTROL {
2209 LUID TokenId;
2210 LUID AuthenticationId;
2211 LUID ModifiedId;
2212 TOKEN_SOURCE TokenSource;
2213 } TOKEN_CONTROL,*PTOKEN_CONTROL;
2214
2215 typedef struct _TOKEN_DEFAULT_DACL {
2216 PACL DefaultDacl;
2217 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
2218
2219 typedef struct _TOKEN_GROUPS {
2220 DWORD GroupCount;
2221 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2222 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
2223
2224 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
2225 DWORD SidCount;
2226 DWORD SidLength;
2227 PSID_AND_ATTRIBUTES Sids;
2228 DWORD RestrictedSidCount;
2229 DWORD RestrictedSidLength;
2230 PSID_AND_ATTRIBUTES RestrictedSids;
2231 DWORD PrivilegeCount;
2232 DWORD PrivilegeLength;
2233 PLUID_AND_ATTRIBUTES Privileges;
2234 LUID AuthenticationId;
2235 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
2236
2237 typedef struct _TOKEN_ORIGIN {
2238 LUID OriginatingLogonSession;
2239 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
2240
2241 typedef struct _TOKEN_OWNER {
2242 PSID Owner;
2243 } TOKEN_OWNER,*PTOKEN_OWNER;
2244
2245 typedef struct _TOKEN_PRIMARY_GROUP {
2246 PSID PrimaryGroup;
2247 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
2248
2249 typedef struct _TOKEN_PRIVILEGES {
2250 DWORD PrivilegeCount;
2251 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
2252 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
2253
2254 typedef enum tagTOKEN_TYPE {
2255 TokenPrimary = 1,
2256 TokenImpersonation
2257 } TOKEN_TYPE,*PTOKEN_TYPE;
2258
2259 typedef enum _TOKEN_ELEVATION_TYPE {
2260 TokenElevationTypeDefault = 1,
2261 TokenElevationTypeFull,
2262 TokenElevationTypeLimited,
2263 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
2264
2265 typedef struct _TOKEN_MANDATORY_LABEL {
2266 SID_AND_ATTRIBUTES Label;
2267 } TOKEN_MANDATORY_LABEL, * PTOKEN_MANDATORY_LABEL;
2268
2269 #include <pshpack4.h>
2270 typedef struct _TOKEN_STATISTICS {
2271 LUID TokenId;
2272 LUID AuthenticationId;
2273 LARGE_INTEGER ExpirationTime;
2274 TOKEN_TYPE TokenType;
2275 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2276 DWORD DynamicCharged;
2277 DWORD DynamicAvailable;
2278 DWORD GroupCount;
2279 DWORD PrivilegeCount;
2280 LUID ModifiedId;
2281 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
2282 #include <poppack.h>
2283
2284 typedef struct _TOKEN_USER {
2285 SID_AND_ATTRIBUTES User;
2286 } TOKEN_USER, *PTOKEN_USER;
2287
2288 typedef enum _TOKEN_INFORMATION_CLASS {
2289 TokenUser = 1,
2290 TokenGroups,
2291 TokenPrivileges,
2292 TokenOwner,
2293 TokenPrimaryGroup,
2294 TokenDefaultDacl,
2295 TokenSource,
2296 TokenType,
2297 TokenImpersonationLevel,
2298 TokenStatistics,
2299 TokenRestrictedSids,
2300 TokenSessionId,
2301 TokenGroupsAndPrivileges,
2302 TokenSessionReference,
2303 TokenSandBoxInert,
2304 TokenAuditPolicy,
2305 TokenOrigin,
2306 TokenElevationType,
2307 TokenLinkedToken,
2308 TokenElevation,
2309 TokenHasRestrictions,
2310 TokenAccessInformation,
2311 TokenVirtualizationAllowed,
2312 TokenVirtualizationEnabled,
2313 TokenIntegrityLevel,
2314 TokenUIAccess,
2315 TokenMandatoryPolicy,
2316 TokenLogonSid,
2317 MaxTokenInfoClass
2318 } TOKEN_INFORMATION_CLASS;
2319
2320 typedef struct _QUOTA_LIMITS {
2321 SIZE_T PagedPoolLimit;
2322 SIZE_T NonPagedPoolLimit;
2323 SIZE_T MinimumWorkingSetSize;
2324 SIZE_T MaximumWorkingSetSize;
2325 SIZE_T PagefileLimit;
2326 LARGE_INTEGER TimeLimit;
2327 } QUOTA_LIMITS,*PQUOTA_LIMITS;
2328
2329 typedef union _RATE_QUOTA_LIMIT {
2330 DWORD RateData;
2331 struct {
2332 DWORD RatePercent : 7;
2333 DWORD Reserved0 : 25;
2334 } DUMMYSTRUCTNAME;
2335 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT;
2336
2337 typedef struct _QUOTA_LIMITS_EX {
2338 SIZE_T PagedPoolLimit;
2339 SIZE_T NonPagedPoolLimit;
2340 SIZE_T MinimumWorkingSetSize;
2341 SIZE_T MaximumWorkingSetSize;
2342 SIZE_T PagefileLimit;
2343 LARGE_INTEGER TimeLimit;
2344 SIZE_T Reserved1;
2345 SIZE_T Reserved2;
2346 SIZE_T Reserved3;
2347 SIZE_T Reserved4;
2348 DWORD Flags;
2349 RATE_QUOTA_LIMIT CpuRateLimit;
2350 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
2351
2352 typedef struct _IO_COUNTERS {
2353 ULONGLONG ReadOperationCount;
2354 ULONGLONG WriteOperationCount;
2355 ULONGLONG OtherOperationCount;
2356 ULONGLONG ReadTransferCount;
2357 ULONGLONG WriteTransferCount;
2358 ULONGLONG OtherTransferCount;
2359 } IO_COUNTERS, *PIO_COUNTERS;
2360
2361 typedef struct _FILE_NOTIFY_INFORMATION {
2362 DWORD NextEntryOffset;
2363 DWORD Action;
2364 DWORD FileNameLength;
2365 WCHAR FileName[1];
2366 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
2367
2368 typedef struct _TAPE_ERASE {
2369 DWORD Type;
2370 BOOLEAN Immediate;
2371 } TAPE_ERASE, *PTAPE_ERASE;
2372
2373 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
2374 BOOLEAN ECC;
2375 BOOLEAN Compression;
2376 BOOLEAN DataPadding;
2377 BOOLEAN ReportSetmarks;
2378 DWORD DefaultBlockSize;
2379 DWORD MaximumBlockSize;
2380 DWORD MinimumBlockSize;
2381 DWORD MaximumPartitionCount;
2382 DWORD FeaturesLow;
2383 DWORD FeaturesHigh;
2384 DWORD EOTWarningZoneSize;
2385 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
2386
2387 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
2388 LARGE_INTEGER Capacity;
2389 LARGE_INTEGER Remaining;
2390 DWORD BlockSize;
2391 DWORD PartitionCount;
2392 BOOLEAN WriteProtected;
2393 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
2394
2395 typedef struct _TAPE_GET_POSITION {
2396 DWORD Type;
2397 DWORD Partition;
2398 LARGE_INTEGER Offset;
2399 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
2400
2401 typedef struct _TAPE_PREPARE {
2402 DWORD Operation;
2403 BOOLEAN Immediate;
2404 } TAPE_PREPARE, *PTAPE_PREPARE;
2405
2406 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
2407 BOOLEAN ECC;
2408 BOOLEAN Compression;
2409 BOOLEAN DataPadding;
2410 BOOLEAN ReportSetmarks;
2411 DWORD EOTWarningZoneSize;
2412 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
2413
2414 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
2415 DWORD BlockSize;
2416 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
2417
2418 typedef struct _TAPE_SET_POSITION {
2419 DWORD Method;
2420 DWORD Partition;
2421 LARGE_INTEGER Offset;
2422 BOOLEAN Immediate;
2423 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
2424
2425 typedef struct _TAPE_WRITE_MARKS {
2426 DWORD Type;
2427 DWORD Count;
2428 BOOLEAN Immediate;
2429 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
2430
2431 typedef struct _TAPE_CREATE_PARTITION {
2432 DWORD Method;
2433 DWORD Count;
2434 DWORD Size;
2435 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
2436
2437 typedef struct _MEMORY_BASIC_INFORMATION {
2438 PVOID BaseAddress;
2439 PVOID AllocationBase;
2440 DWORD AllocationProtect;
2441 SIZE_T RegionSize;
2442 DWORD State;
2443 DWORD Protect;
2444 DWORD Type;
2445 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
2446
2447 typedef struct _MESSAGE_RESOURCE_ENTRY {
2448 WORD Length;
2449 WORD Flags;
2450 BYTE Text[1];
2451 } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
2452
2453 typedef struct _MESSAGE_RESOURCE_BLOCK {
2454 DWORD LowId;
2455 DWORD HighId;
2456 DWORD OffsetToEntries;
2457 } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
2458
2459 typedef struct _MESSAGE_RESOURCE_DATA {
2460 DWORD NumberOfBlocks;
2461 MESSAGE_RESOURCE_BLOCK Blocks[1];
2462 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2463
2464 //
2465 // Slist Header
2466 //
2467 #ifndef _SLIST_HEADER_
2468 #define _SLIST_HEADER_
2469
2470 #if defined(_WIN64)
2471
2472 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
2473 struct _SLIST_ENTRY *Next;
2474 } SLIST_ENTRY, *PSLIST_ENTRY;
2475
2476 typedef struct _SLIST_ENTRY32 {
2477 DWORD Next;
2478 } SLIST_ENTRY32, *PSLIST_ENTRY32;
2479
2480 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
2481 _ANONYMOUS_STRUCT struct {
2482 ULONGLONG Alignment;
2483 ULONGLONG Region;
2484 } DUMMYSTRUCTNAME;
2485 struct {
2486 ULONGLONG Depth:16;
2487 ULONGLONG Sequence:9;
2488 ULONGLONG NextEntry:39;
2489 ULONGLONG HeaderType:1;
2490 ULONGLONG Init:1;
2491 ULONGLONG Reserved:59;
2492 ULONGLONG Region:3;
2493 } Header8;
2494 struct {
2495 ULONGLONG Depth:16;
2496 ULONGLONG Sequence:48;
2497 ULONGLONG HeaderType:1;
2498 ULONGLONG Init:1;
2499 ULONGLONG Reserved:2;
2500 ULONGLONG NextEntry:60;
2501 } Header16;
2502 struct {
2503 ULONGLONG Depth:16;
2504 ULONGLONG Sequence:48;
2505 ULONGLONG HeaderType:1;
2506 ULONGLONG Reserved:3;
2507 ULONGLONG NextEntry:60;
2508 } HeaderX64;
2509 } SLIST_HEADER, *PSLIST_HEADER;
2510
2511 typedef union _SLIST_HEADER32{
2512 ULONGLONG Alignment;
2513 _ANONYMOUS_STRUCT struct {
2514 SLIST_ENTRY32 Next;
2515 WORD Depth;
2516 WORD Sequence;
2517 } DUMMYSTRUCTNAME;
2518 } SLIST_HEADER32, *PSLIST_HEADER32;
2519
2520 #else
2521
2522 #define SLIST_ENTRY SINGLE_LIST_ENTRY
2523 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2524 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2525
2526 typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32;
2527
2528 typedef union _SLIST_HEADER {
2529 ULONGLONG Alignment;
2530 _ANONYMOUS_STRUCT struct {
2531 SLIST_ENTRY Next;
2532 WORD Depth;
2533 WORD Sequence;
2534 } DUMMYSTRUCTNAME;
2535 } SLIST_HEADER, *PSLIST_HEADER;
2536
2537 typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32;
2538
2539 #endif /* defined(_WIN64) */
2540
2541 #endif /* _SLIST_HEADER_ */
2542
2543 NTSYSAPI
2544 VOID
2545 NTAPI
2546 RtlInitializeSListHead(
2547 _Out_ PSLIST_HEADER ListHead);
2548
2549 _Must_inspect_result_
2550 NTSYSAPI
2551 PSLIST_ENTRY
2552 NTAPI
2553 RtlFirstEntrySList(
2554 _In_ const SLIST_HEADER *ListHead);
2555
2556 NTSYSAPI
2557 PSLIST_ENTRY
2558 NTAPI
2559 RtlInterlockedPopEntrySList(
2560 _Inout_ PSLIST_HEADER ListHead);
2561
2562 NTSYSAPI
2563 PSLIST_ENTRY
2564 NTAPI
2565 RtlInterlockedPushEntrySList(
2566 _Inout_ PSLIST_HEADER ListHead,
2567 _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry);
2568
2569 NTSYSAPI
2570 PSLIST_ENTRY
2571 NTAPI
2572 RtlInterlockedFlushSList(
2573 _Inout_ PSLIST_HEADER ListHead);
2574
2575 NTSYSAPI
2576 WORD
2577 NTAPI
2578 RtlQueryDepthSList(
2579 _In_ PSLIST_HEADER ListHead);
2580
2581 #ifndef _RTL_RUN_ONCE_DEF
2582 #define _RTL_RUN_ONCE_DEF
2583
2584 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL
2585 #define RTL_RUN_ONCE_ASYNC 0x00000002UL
2586 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL
2587
2588 #define RTL_RUN_ONCE_INIT {0}
2589
2590 typedef union _RTL_RUN_ONCE {
2591 PVOID Ptr;
2592 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
2593
2594 typedef DWORD WINAPI RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE, PVOID, PVOID*);
2595 typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN;
2596
2597 NTSYSAPI
2598 DWORD
2599 WINAPI
2600 RtlRunOnceComplete(
2601 PRTL_RUN_ONCE,
2602 DWORD,
2603 PVOID);
2604
2605 #endif
2606
2607 #define RTL_CONDITION_VARIABLE_INIT {0}
2608 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
2609
2610 typedef struct _RTL_CONDITION_VARIABLE {
2611 PVOID Ptr;
2612 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
2613
2614 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
2615 WORD Type;
2616 WORD CreatorBackTraceIndex;
2617 struct _RTL_CRITICAL_SECTION *CriticalSection;
2618 LIST_ENTRY ProcessLocksList;
2619 DWORD EntryCount;
2620 DWORD ContentionCount;
2621 DWORD Flags;
2622 WORD CreatorBackTraceIndexHigh;
2623 WORD SpareWORD;
2624 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
2625
2626 #include "pshpack8.h"
2627 typedef struct _RTL_CRITICAL_SECTION {
2628 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
2629 LONG LockCount;
2630 LONG RecursionCount;
2631 HANDLE OwningThread;
2632 HANDLE LockSemaphore;
2633 ULONG_PTR SpinCount;
2634 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
2635 #include "poppack.h"
2636
2637 NTSYSAPI
2638 WORD
2639 NTAPI
2640 RtlCaptureStackBackTrace(
2641 IN DWORD FramesToSkip,
2642 IN DWORD FramesToCapture,
2643 OUT PVOID *BackTrace,
2644 OUT PDWORD BackTraceHash OPTIONAL
2645 );
2646
2647 NTSYSAPI
2648 VOID
2649 NTAPI
2650 RtlCaptureContext(
2651 _Out_ PCONTEXT ContextRecord
2652 );
2653
2654 NTSYSAPI
2655 PVOID
2656 NTAPI
2657 RtlPcToFileHeader(
2658 _In_ PVOID PcValue,
2659 _Out_ PVOID* BaseOfImage);
2660
2661 NTSYSAPI
2662 VOID
2663 NTAPI
2664 RtlUnwind(
2665 _In_opt_ PVOID TargetFrame,
2666 _In_opt_ PVOID TargetIp,
2667 _In_opt_ PEXCEPTION_RECORD ExceptionRecord,
2668 _In_ PVOID ReturnValue);
2669
2670 #define RTL_SRWLOCK_INIT {0}
2671
2672 typedef struct _RTL_SRWLOCK {
2673 PVOID Ptr;
2674 } RTL_SRWLOCK, *PRTL_SRWLOCK;
2675
2676 typedef LONG
2677 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
2678 struct _EXCEPTION_POINTERS *ExceptionInfo
2679 );
2680
2681 typedef struct _EVENTLOGRECORD {
2682 DWORD Length;
2683 DWORD Reserved;
2684 DWORD RecordNumber;
2685 DWORD TimeGenerated;
2686 DWORD TimeWritten;
2687 DWORD EventID;
2688 WORD EventType;
2689 WORD NumStrings;
2690 WORD EventCategory;
2691 WORD ReservedFlags;
2692 DWORD ClosingRecordNumber;
2693 DWORD StringOffset;
2694 DWORD UserSidLength;
2695 DWORD UserSidOffset;
2696 DWORD DataLength;
2697 DWORD DataOffset;
2698 } EVENTLOGRECORD, *PEVENTLOGRECORD;
2699
2700 typedef struct _OSVERSIONINFOA {
2701 DWORD dwOSVersionInfoSize;
2702 DWORD dwMajorVersion;
2703 DWORD dwMinorVersion;
2704 DWORD dwBuildNumber;
2705 DWORD dwPlatformId;
2706 CHAR szCSDVersion[128];
2707 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
2708
2709 typedef struct _OSVERSIONINFOW {
2710 DWORD dwOSVersionInfoSize;
2711 DWORD dwMajorVersion;
2712 DWORD dwMinorVersion;
2713 DWORD dwBuildNumber;
2714 DWORD dwPlatformId;
2715 WCHAR szCSDVersion[128];
2716 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
2717
2718 typedef struct _OSVERSIONINFOEXA {
2719 DWORD dwOSVersionInfoSize;
2720 DWORD dwMajorVersion;
2721 DWORD dwMinorVersion;
2722 DWORD dwBuildNumber;
2723 DWORD dwPlatformId;
2724 CHAR szCSDVersion[128];
2725 WORD wServicePackMajor;
2726 WORD wServicePackMinor;
2727 WORD wSuiteMask;
2728 BYTE wProductType;
2729 BYTE wReserved;
2730 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2731
2732 typedef struct _OSVERSIONINFOEXW {
2733 DWORD dwOSVersionInfoSize;
2734 DWORD dwMajorVersion;
2735 DWORD dwMinorVersion;
2736 DWORD dwBuildNumber;
2737 DWORD dwPlatformId;
2738 WCHAR szCSDVersion[128];
2739 WORD wServicePackMajor;
2740 WORD wServicePackMinor;
2741 WORD wSuiteMask;
2742 BYTE wProductType;
2743 BYTE wReserved;
2744 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
2745
2746 #include <pshpack2.h>
2747
2748 typedef struct _IMAGE_VXD_HEADER {
2749 WORD e32_magic;
2750 BYTE e32_border;
2751 BYTE e32_worder;
2752 DWORD e32_level;
2753 WORD e32_cpu;
2754 WORD e32_os;
2755 DWORD e32_ver;
2756 DWORD e32_mflags;
2757 DWORD e32_mpages;
2758 DWORD e32_startobj;
2759 DWORD e32_eip;
2760 DWORD e32_stackobj;
2761 DWORD e32_esp;
2762 DWORD e32_pagesize;
2763 DWORD e32_lastpagesize;
2764 DWORD e32_fixupsize;
2765 DWORD e32_fixupsum;
2766 DWORD e32_ldrsize;
2767 DWORD e32_ldrsum;
2768 DWORD e32_objtab;
2769 DWORD e32_objcnt;
2770 DWORD e32_objmap;
2771 DWORD e32_itermap;
2772 DWORD e32_rsrctab;
2773 DWORD e32_rsrccnt;
2774 DWORD e32_restab;
2775 DWORD e32_enttab;
2776 DWORD e32_dirtab;
2777 DWORD e32_dircnt;
2778 DWORD e32_fpagetab;
2779 DWORD e32_frectab;
2780 DWORD e32_impmod;
2781 DWORD e32_impmodcnt;
2782 DWORD e32_impproc;
2783 DWORD e32_pagesum;
2784 DWORD e32_datapage;
2785 DWORD e32_preload;
2786 DWORD e32_nrestab;
2787 DWORD e32_cbnrestab;
2788 DWORD e32_nressum;
2789 DWORD e32_autodata;
2790 DWORD e32_debuginfo;
2791 DWORD e32_debuglen;
2792 DWORD e32_instpreload;
2793 DWORD e32_instdemand;
2794 DWORD e32_heapsize;
2795 BYTE e32_res3[12];
2796 DWORD e32_winresoff;
2797 DWORD e32_winreslen;
2798 WORD e32_devid;
2799 WORD e32_ddkver;
2800 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2801
2802 typedef struct _IMAGE_DOS_HEADER {
2803 WORD e_magic;
2804 WORD e_cblp;
2805 WORD e_cp;
2806 WORD e_crlc;
2807 WORD e_cparhdr;
2808 WORD e_minalloc;
2809 WORD e_maxalloc;
2810 WORD e_ss;
2811 WORD e_sp;
2812 WORD e_csum;
2813 WORD e_ip;
2814 WORD e_cs;
2815 WORD e_lfarlc;
2816 WORD e_ovno;
2817 WORD e_res[4];
2818 WORD e_oemid;
2819 WORD e_oeminfo;
2820 WORD e_res2[10];
2821 LONG e_lfanew;
2822 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2823
2824 typedef struct _IMAGE_OS2_HEADER {
2825 WORD ne_magic;
2826 CHAR ne_ver;
2827 CHAR ne_rev;
2828 WORD ne_enttab;
2829 WORD ne_cbenttab;
2830 LONG ne_crc;
2831 WORD ne_flags;
2832 WORD ne_autodata;
2833 WORD ne_heap;
2834 WORD ne_stack;
2835 LONG ne_csip;
2836 LONG ne_sssp;
2837 WORD ne_cseg;
2838 WORD ne_cmod;
2839 WORD ne_cbnrestab;
2840 WORD ne_segtab;
2841 WORD ne_rsrctab;
2842 WORD ne_restab;
2843 WORD ne_modtab;
2844 WORD ne_imptab;
2845 LONG ne_nrestab;
2846 WORD ne_cmovent;
2847 WORD ne_align;
2848 WORD ne_cres;
2849 BYTE ne_exetyp;
2850 BYTE ne_flagsothers;
2851 WORD ne_pretthunks;
2852 WORD ne_psegrefbytes;
2853 WORD ne_swaparea;
2854 WORD ne_expver;
2855 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2856
2857 #include <poppack.h>
2858
2859 typedef struct _IMAGE_FILE_HEADER {
2860 WORD Machine;
2861 WORD NumberOfSections;
2862 DWORD TimeDateStamp;
2863 DWORD PointerToSymbolTable;
2864 DWORD NumberOfSymbols;
2865 WORD SizeOfOptionalHeader;
2866 WORD Characteristics;
2867 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2868
2869 typedef struct _IMAGE_DATA_DIRECTORY {
2870 DWORD VirtualAddress;
2871 DWORD Size;
2872 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2873
2874 typedef struct _IMAGE_OPTIONAL_HEADER32 {
2875 WORD Magic;
2876 BYTE MajorLinkerVersion;
2877 BYTE MinorLinkerVersion;
2878 DWORD SizeOfCode;
2879 DWORD SizeOfInitializedData;
2880 DWORD SizeOfUninitializedData;
2881 DWORD AddressOfEntryPoint;
2882 DWORD BaseOfCode;
2883 DWORD BaseOfData;
2884 DWORD ImageBase;
2885 DWORD SectionAlignment;
2886 DWORD FileAlignment;
2887 WORD MajorOperatingSystemVersion;
2888 WORD MinorOperatingSystemVersion;
2889 WORD MajorImageVersion;
2890 WORD MinorImageVersion;
2891 WORD MajorSubsystemVersion;
2892 WORD MinorSubsystemVersion;
2893 DWORD Win32VersionValue;
2894 DWORD SizeOfImage;
2895 DWORD SizeOfHeaders;
2896 DWORD CheckSum;
2897 WORD Subsystem;
2898 WORD DllCharacteristics;
2899 DWORD SizeOfStackReserve;
2900 DWORD SizeOfStackCommit;
2901 DWORD SizeOfHeapReserve;
2902 DWORD SizeOfHeapCommit;
2903 DWORD LoaderFlags;
2904 DWORD NumberOfRvaAndSizes;
2905 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2906 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2907
2908 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2909 WORD Magic;
2910 BYTE MajorLinkerVersion;
2911 BYTE MinorLinkerVersion;
2912 DWORD SizeOfCode;
2913 DWORD SizeOfInitializedData;
2914 DWORD SizeOfUninitializedData;
2915 DWORD AddressOfEntryPoint;
2916 DWORD BaseOfCode;
2917 ULONGLONG ImageBase;
2918 DWORD SectionAlignment;
2919 DWORD FileAlignment;
2920 WORD MajorOperatingSystemVersion;
2921 WORD MinorOperatingSystemVersion;
2922 WORD MajorImageVersion;
2923 WORD MinorImageVersion;
2924 WORD MajorSubsystemVersion;
2925 WORD MinorSubsystemVersion;
2926 DWORD Win32VersionValue;
2927 DWORD SizeOfImage;
2928 DWORD SizeOfHeaders;
2929 DWORD CheckSum;
2930 WORD Subsystem;
2931 WORD DllCharacteristics;
2932 ULONGLONG SizeOfStackReserve;
2933 ULONGLONG SizeOfStackCommit;
2934 ULONGLONG SizeOfHeapReserve;
2935 ULONGLONG SizeOfHeapCommit;
2936 DWORD LoaderFlags;
2937 DWORD NumberOfRvaAndSizes;
2938 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2939 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2940
2941 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
2942 WORD Magic;
2943 BYTE MajorLinkerVersion;
2944 BYTE MinorLinkerVersion;
2945 DWORD SizeOfCode;
2946 DWORD SizeOfInitializedData;
2947 DWORD SizeOfUninitializedData;
2948 DWORD AddressOfEntryPoint;
2949 DWORD BaseOfCode;
2950 DWORD BaseOfData;
2951 DWORD BaseOfBss;
2952 DWORD GprMask;
2953 DWORD CprMask[4];
2954 DWORD GpValue;
2955 } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
2956
2957 typedef struct _IMAGE_NT_HEADERS32 {
2958 DWORD Signature;
2959 IMAGE_FILE_HEADER FileHeader;
2960 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
2961 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2962
2963 typedef struct _IMAGE_NT_HEADERS64 {
2964 DWORD Signature;
2965 IMAGE_FILE_HEADER FileHeader;
2966 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2967 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2968
2969 #ifdef _WIN64
2970 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2971 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2972 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2973 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2974 #else
2975 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2976 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2977 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2978 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2979 #endif
2980
2981 typedef struct _IMAGE_ROM_HEADERS {
2982 IMAGE_FILE_HEADER FileHeader;
2983 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
2984 } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
2985
2986 typedef struct _IMAGE_SECTION_HEADER {
2987 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2988 union {
2989 DWORD PhysicalAddress;
2990 DWORD VirtualSize;
2991 } Misc;
2992 DWORD VirtualAddress;
2993 DWORD SizeOfRawData;
2994 DWORD PointerToRawData;
2995 DWORD PointerToRelocations;
2996 DWORD PointerToLinenumbers;
2997 WORD NumberOfRelocations;
2998 WORD NumberOfLinenumbers;
2999 DWORD Characteristics;
3000 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
3001
3002 #include <pshpack2.h>
3003
3004 typedef struct _IMAGE_SYMBOL {
3005 union {
3006 BYTE ShortName[8];
3007 struct {
3008 DWORD Short;
3009 DWORD Long;
3010 } Name;
3011 PBYTE LongName[2];
3012 } N;
3013 DWORD Value;
3014 SHORT SectionNumber;
3015 WORD Type;
3016 BYTE StorageClass;
3017 BYTE NumberOfAuxSymbols;
3018 } IMAGE_SYMBOL, *PIMAGE_SYMBOL;
3019
3020 typedef struct _IMAGE_LINENUMBER {
3021 union {
3022 DWORD SymbolTableIndex;
3023 DWORD VirtualAddress;
3024 } Type;
3025 WORD Linenumber;
3026 } IMAGE_LINENUMBER, UNALIGNED *PIMAGE_LINENUMBER;
3027
3028 typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF {
3029 BYTE bAuxType;
3030 BYTE bReserved;
3031 DWORD SymbolTableIndex;
3032 BYTE rgbReserved[12];
3033 } IMAGE_AUX_SYMBOL_TOKEN_DEF, UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF;
3034
3035 typedef union _IMAGE_AUX_SYMBOL {
3036 struct {
3037 DWORD TagIndex;
3038 union {
3039 struct {
3040 WORD Linenumber;
3041 WORD Size;
3042 } LnSz;
3043 DWORD TotalSize;
3044 } Misc;
3045 union {
3046 struct {
3047 DWORD PointerToLinenumber;
3048 DWORD PointerToNextFunction;
3049 } Function;
3050 struct {
3051 WORD Dimension[4];
3052 } Array;
3053 } FcnAry;
3054 WORD TvIndex;
3055 } Sym;
3056 struct {
3057 BYTE Name[IMAGE_SIZEOF_SYMBOL];
3058 } File;
3059 struct {
3060 DWORD Length;
3061 WORD NumberOfRelocations;
3062 WORD NumberOfLinenumbers;
3063 DWORD CheckSum;
3064 SHORT Number;
3065 BYTE Selection;
3066 BYTE bReserved;
3067 SHORT HighNumber;
3068 } Section;
3069 IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
3070 struct {
3071 DWORD crc;
3072 BYTE rgbReserved[14];
3073 } CRC;
3074 } IMAGE_AUX_SYMBOL, *PIMAGE_AUX_SYMBOL;
3075
3076 typedef struct _IMAGE_RELOCATION {
3077 _ANONYMOUS_UNION union {
3078 DWORD VirtualAddress;
3079 DWORD RelocCount;
3080 } DUMMYUNIONNAME;
3081 DWORD SymbolTableIndex;
3082 WORD Type;
3083 } IMAGE_RELOCATION, UNALIGNED *PIMAGE_RELOCATION;
3084
3085 #include <poppack.h>
3086
3087 #ifndef __IMAGE_COR20_HEADER_DEFINED__
3088 #define __IMAGE_COR20_HEADER_DEFINED__
3089
3090 typedef enum ReplacesCorHdrNumericDefines {
3091 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3092 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3093 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3094 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3095 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010,
3096 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3097 COR_VERSION_MAJOR_V2 = 2,
3098 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3099 COR_VERSION_MINOR = 0,
3100 COR_DELETED_NAME_LENGTH = 8,
3101 COR_VTABLEGAP_NAME_LENGTH = 8,
3102 NATIVE_TYPE_MAX_CB = 1,
3103 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xFF,
3104 IMAGE_COR_MIH_METHODRVA = 0x01,
3105 IMAGE_COR_MIH_EHRVA = 0x02,
3106 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3107 COR_VTABLE_32BIT = 0x01,
3108 COR_VTABLE_64BIT = 0x02,
3109 COR_VTABLE_FROM_UNMANAGED = 0x04,
3110 COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = 0x08,
3111 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3112 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3113 MAX_CLASS_NAME = 1024,
3114 MAX_PACKAGE_NAME = 1024
3115 } ReplacesCorHdrNumericDefines;
3116
3117 typedef struct IMAGE_COR20_HEADER {
3118 DWORD cb;
3119 WORD MajorRuntimeVersion;
3120 WORD MinorRuntimeVersion;
3121 IMAGE_DATA_DIRECTORY MetaData;
3122 DWORD Flags;
3123 _ANONYMOUS_UNION union {
3124 DWORD EntryPointToken;
3125 DWORD EntryPointRVA;
3126 } DUMMYUNIONNAME;
3127 IMAGE_DATA_DIRECTORY Resources;
3128 IMAGE_DATA_DIRECTORY StrongNameSignature;
3129 IMAGE_DATA_DIRECTORY CodeManagerTable;
3130 IMAGE_DATA_DIRECTORY VTableFixups;
3131 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3132 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3133 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3134
3135 #endif /* __IMAGE_COR20_HEADER_DEFINED__ */
3136
3137 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3138 DWORD NumberOfSymbols;
3139 DWORD LvaToFirstSymbol;
3140 DWORD NumberOfLinenumbers;
3141 DWORD LvaToFirstLinenumber;
3142 DWORD RvaToFirstByteOfCode;
3143 DWORD RvaToLastByteOfCode;
3144 DWORD RvaToFirstByteOfData;
3145 DWORD RvaToLastByteOfData;
3146 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3147
3148 typedef struct _IMAGE_BASE_RELOCATION {
3149 DWORD VirtualAddress;
3150 DWORD SizeOfBlock;
3151 } IMAGE_BASE_RELOCATION, UNALIGNED *PIMAGE_BASE_RELOCATION;
3152
3153 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
3154 BYTE Name[16];
3155 BYTE Date[12];
3156 BYTE UserID[6];
3157 BYTE GroupID[6];
3158 BYTE Mode[8];
3159 BYTE Size[10];
3160 BYTE EndHeader[2];
3161 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3162
3163 typedef struct _IMAGE_EXPORT_DIRECTORY {
3164 DWORD Characteristics;
3165 DWORD TimeDateStamp;
3166 WORD MajorVersion;
3167 WORD MinorVersion;
3168 DWORD Name;
3169 DWORD Base;
3170 DWORD NumberOfFunctions;
3171 DWORD NumberOfNames;
3172 DWORD AddressOfFunctions;
3173 DWORD AddressOfNames;
3174 DWORD AddressOfNameOrdinals;
3175 } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
3176
3177 typedef struct _IMAGE_IMPORT_BY_NAME {
3178 WORD Hint;
3179 BYTE Name[1];
3180 } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
3181
3182 #include <pshpack8.h>
3183 typedef struct _IMAGE_THUNK_DATA64 {
3184 union {
3185 ULONGLONG ForwarderString;
3186 ULONGLONG Function;
3187 ULONGLONG Ordinal;
3188 ULONGLONG AddressOfData;
3189 } u1;
3190 } IMAGE_THUNK_DATA64, *PIMAGE_THUNK_DATA64;
3191 #include <poppack.h>
3192
3193 typedef struct _IMAGE_THUNK_DATA32 {
3194 union {
3195 DWORD ForwarderString;
3196 DWORD Function;
3197 DWORD Ordinal;
3198 DWORD AddressOfData;
3199 } u1;
3200 } IMAGE_THUNK_DATA32, *PIMAGE_THUNK_DATA32;
3201
3202 #define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL
3203 #define IMAGE_ORDINAL_FLAG32 0x80000000
3204 #define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffff)
3205 #define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff)
3206 #define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0)
3207 #define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0)
3208
3209 typedef VOID
3210 (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved);
3211
3212 typedef struct _IMAGE_TLS_DIRECTORY64 {
3213 ULONGLONG StartAddressOfRawData;
3214 ULONGLONG EndAddressOfRawData;
3215 ULONGLONG AddressOfIndex;
3216 ULONGLONG AddressOfCallBacks;
3217 DWORD SizeOfZeroFill;
3218 DWORD Characteristics;
3219 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3220
3221 typedef struct _IMAGE_TLS_DIRECTORY32 {
3222 DWORD StartAddressOfRawData;
3223 DWORD EndAddressOfRawData;
3224 DWORD AddressOfIndex;
3225 DWORD AddressOfCallBacks;
3226 DWORD SizeOfZeroFill;
3227 DWORD Characteristics;
3228 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3229
3230 #ifdef _WIN64
3231 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3232 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3233 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3234 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3235 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3236 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3237 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3238 #else
3239 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3240 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3241 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3242 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3243 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3244 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3245 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3246 #endif
3247
3248 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3249 _ANONYMOUS_UNION union {
3250 DWORD Characteristics;
3251 DWORD OriginalFirstThunk;
3252 } DUMMYUNIONNAME;
3253 DWORD TimeDateStamp;
3254 DWORD ForwarderChain;
3255 DWORD Name;
3256 DWORD FirstThunk;
3257 } IMAGE_IMPORT_DESCRIPTOR, UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR;
3258
3259 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR {
3260 DWORD TimeDateStamp;
3261 WORD OffsetModuleName;
3262 WORD NumberOfModuleForwarderRefs;
3263 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3264
3265 typedef struct _IMAGE_BOUND_FORWARDER_REF {
3266 DWORD TimeDateStamp;
3267 WORD OffsetModuleName;
3268 WORD Reserved;
3269 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3270
3271 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR {
3272 union {
3273 DWORD AllAttributes;
3274 struct {
3275 DWORD RvaBased:1;
3276 DWORD ReservedAttributes:31;
3277 };
3278 } Attributes;
3279 DWORD DllNameRVA;
3280 DWORD ModuleHandleRVA;
3281 DWORD ImportAddressTableRVA;
3282 DWORD ImportNameTableRVA;
3283 DWORD BoundImportAddressTableRVA;
3284 DWORD UnloadInformationTableRVA;
3285 DWORD TimeDateStamp;
3286 } IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;
3287
3288 typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR;
3289
3290 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3291 DWORD Characteristics;
3292 DWORD TimeDateStamp;
3293 WORD MajorVersion;
3294 WORD MinorVersion;
3295 WORD NumberOfNamedEntries;
3296 WORD NumberOfIdEntries;
3297 } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
3298
3299 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3300 _ANONYMOUS_UNION union {
3301 _ANONYMOUS_STRUCT struct {
3302 DWORD NameOffset:31;
3303 DWORD NameIsString:1;
3304 } DUMMYSTRUCTNAME;
3305 DWORD Name;
3306 WORD Id;
3307 } DUMMYUNIONNAME;
3308 _ANONYMOUS_UNION union {
3309 DWORD OffsetToData;
3310 _ANONYMOUS_STRUCT struct {
3311 DWORD OffsetToDirectory:31;
3312 DWORD DataIsDirectory:1;
3313 } DUMMYSTRUCTNAME2;
3314 } DUMMYUNIONNAME2;
3315 } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3316
3317 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3318 WORD Length;
3319 CHAR NameString[1];
3320 } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING;
3321
3322 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3323 WORD Length;
3324 WCHAR NameString[1];
3325 } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
3326
3327 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3328 DWORD OffsetToData;
3329 DWORD Size;
3330 DWORD CodePage;
3331 DWORD Reserved;
3332 } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
3333
3334 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 {
3335 DWORD Size;
3336 DWORD TimeDateStamp;
3337 WORD MajorVersion;
3338 WORD MinorVersion;
3339 DWORD GlobalFlagsClear;
3340 DWORD GlobalFlagsSet;
3341 DWORD CriticalSectionDefaultTimeout;
3342 DWORD DeCommitFreeBlockThreshold;
3343 DWORD DeCommitTotalFreeThreshold;
3344 DWORD LockPrefixTable;
3345 DWORD MaximumAllocationSize;
3346 DWORD VirtualMemoryThreshold;
3347 DWORD ProcessHeapFlags;
3348 DWORD ProcessAffinityMask;
3349 WORD CSDVersion;
3350 WORD Reserved1;
3351 DWORD EditList;
3352 DWORD SecurityCookie;
3353 DWORD SEHandlerTable;
3354 DWORD SEHandlerCount;
3355 } IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32;
3356
3357 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 {
3358 DWORD Size;
3359 DWORD TimeDateStamp;
3360 WORD MajorVersion;
3361 WORD MinorVersion;
3362 DWORD GlobalFlagsClear;
3363 DWORD GlobalFlagsSet;
3364 DWORD CriticalSectionDefaultTimeout;
3365 ULONGLONG DeCommitFreeBlockThreshold;
3366 ULONGLONG DeCommitTotalFreeThreshold;
3367 ULONGLONG LockPrefixTable;
3368 ULONGLONG MaximumAllocationSize;
3369 ULONGLONG VirtualMemoryThreshold;
3370 ULONGLONG ProcessAffinityMask;
3371 DWORD ProcessHeapFlags;
3372 WORD CSDVersion;
3373 WORD Reserved1;
3374 ULONGLONG EditList;
3375 ULONGLONG SecurityCookie;
3376 ULONGLONG SEHandlerTable;
3377 ULONGLONG SEHandlerCount;
3378 } IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64;
3379
3380 #ifdef _WIN64
3381 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY;
3382 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY;
3383 #else
3384 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY;
3385 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY;
3386 #endif
3387
3388 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
3389 DWORD BeginAddress;
3390 DWORD EndAddress;
3391 DWORD UnwindInfoAddress;
3392 } IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY;
3393
3394 typedef struct _IMAGE_DEBUG_DIRECTORY {
3395 DWORD Characteristics;
3396 DWORD TimeDateStamp;
3397 WORD MajorVersion;
3398 WORD MinorVersion;
3399 DWORD Type;
3400 DWORD SizeOfData;
3401 DWORD AddressOfRawData;
3402 DWORD PointerToRawData;
3403 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3404
3405 typedef struct _FPO_DATA {
3406 DWORD ulOffStart;
3407 DWORD cbProcSize;
3408 DWORD cdwLocals;
3409 WORD cdwParams;
3410 WORD cbProlog:8;
3411 WORD cbRegs:3;
3412 WORD fHasSEH:1;
3413 WORD fUseBP:1;
3414 WORD reserved:1;
3415 WORD cbFrame:2;
3416 } FPO_DATA, *PFPO_DATA;
3417
3418 typedef struct _IMAGE_DEBUG_MISC {
3419 DWORD DataType;
3420 DWORD Length;
3421 BOOLEAN Unicode;
3422 BYTE Reserved[3];
3423 BYTE Data[1];
3424 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3425
3426 typedef struct _IMAGE_FUNCTION_ENTRY {
3427 DWORD StartingAddress;
3428 DWORD EndingAddress;
3429 DWORD EndOfPrologue;
3430 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3431
3432 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3433 WORD Signature;
3434 WORD Flags;
3435 WORD Machine;
3436 WORD Characteristics;
3437 DWORD TimeDateStamp;
3438 DWORD CheckSum;
3439 DWORD ImageBase;
3440 DWORD SizeOfImage;
3441 DWORD NumberOfSections;
3442 DWORD ExportedNamesSize;
3443 DWORD DebugDirectorySize;
3444 DWORD SectionAlignment;
3445 DWORD Reserved[2];
3446 } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
3447
3448 typedef enum _CM_SERVICE_NODE_TYPE {
3449 DriverType = SERVICE_KERNEL_DRIVER,
3450 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3451 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3452 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3453 AdapterType = SERVICE_ADAPTER,
3454 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3455 } SERVICE_NODE_TYPE;
3456
3457 typedef enum _CM_SERVICE_LOAD_TYPE {
3458 BootLoad = SERVICE_BOOT_START,
3459 SystemLoad = SERVICE_SYSTEM_START,
3460 AutoLoad = SERVICE_AUTO_START,
3461 DemandLoad = SERVICE_DEMAND_START,
3462 DisableLoad = SERVICE_DISABLED
3463 } SERVICE_LOAD_TYPE;
3464
3465 typedef enum _CM_ERROR_CONTROL_TYPE {
3466 IgnoreError = SERVICE_ERROR_IGNORE,
3467 NormalError = SERVICE_ERROR_NORMAL,
3468 SevereError = SERVICE_ERROR_SEVERE,
3469 CriticalError = SERVICE_ERROR_CRITICAL
3470 } SERVICE_ERROR_TYPE;
3471
3472 typedef struct _NT_TIB {
3473 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
3474 PVOID StackBase;
3475 PVOID StackLimit;
3476 PVOID SubSystemTib;
3477 _ANONYMOUS_UNION union {
3478 PVOID FiberData;
3479 DWORD Version;
3480 } DUMMYUNIONNAME;
3481 PVOID ArbitraryUserPointer;
3482 struct _NT_TIB *Self;
3483 } NT_TIB,*PNT_TIB;
3484
3485 typedef struct _NT_TIB32 {
3486 DWORD ExceptionList;
3487 DWORD StackBase;
3488 DWORD StackLimit;
3489 DWORD SubSystemTib;
3490 _ANONYMOUS_UNION union {
3491 DWORD FiberData;
3492 DWORD Version;
3493 } DUMMYUNIONNAME;
3494 DWORD ArbitraryUserPointer;
3495 DWORD Self;
3496 } NT_TIB32,*PNT_TIB32;
3497
3498 typedef struct _NT_TIB64 {
3499 DWORD64 ExceptionList;
3500 DWORD64 StackBase;
3501 DWORD64 StackLimit;
3502 DWORD64 SubSystemTib;
3503 _ANONYMOUS_UNION union {
3504 DWORD64 FiberData;
3505 DWORD Version;
3506 } DUMMYUNIONNAME;
3507 DWORD64 ArbitraryUserPointer;
3508 DWORD64 Self;
3509 } NT_TIB64,*PNT_TIB64;
3510
3511 typedef struct _REPARSE_GUID_DATA_BUFFER {
3512 DWORD ReparseTag;
3513 WORD ReparseDataLength;
3514 WORD Reserved;
3515 GUID ReparseGuid;
3516 struct {
3517 BYTE DataBuffer[1];
3518 } GenericReparseBuffer;
3519 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;
3520
3521 typedef struct _REPARSE_POINT_INFORMATION {
3522 WORD ReparseDataLength;
3523 WORD UnparsedNameLength;
3524 } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
3525
3526 typedef union _FILE_SEGMENT_ELEMENT {
3527 PVOID64 Buffer;
3528 ULONGLONG Alignment;
3529 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3530
3531 /* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
3532 #define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
3533 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
3534 #define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
3535 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
3536 #define JOB_OBJECT_LIMIT_AFFINITY 0x0010
3537 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
3538 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
3539 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
3540 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
3541 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
3542 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
3543 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x0800
3544 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x1000
3545 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x2000
3546
3547 /* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
3548 #define JOB_OBJECT_UILIMIT_HANDLES 0x0001
3549 #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
3550 #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
3551 #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
3552 #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
3553 #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
3554 #define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
3555 #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
3556
3557 /* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
3558 #define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
3559 #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
3560 #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
3561 #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
3562
3563 /* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
3564 #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
3565 #define JOB_OBJECT_POST_AT_END_OF_JOB 1
3566
3567 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
3568 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
3569 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
3570 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
3571 #define JOB_OBJECT_MSG_NEW_PROCESS 6
3572 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
3573 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
3574 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
3575 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
3576
3577 #define JOB_OBJECT_ASSIGN_PROCESS 1
3578 #define JOB_OBJECT_SET_ATTRIBUTES 2
3579 #define JOB_OBJECT_QUERY 4
3580 #define JOB_OBJECT_TERMINATE 8
3581 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 16
3582 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
3583
3584 typedef enum _JOBOBJECTINFOCLASS {
3585 JobObjectBasicAccountingInformation = 1,
3586 JobObjectBasicLimitInformation,
3587 JobObjectBasicProcessIdList,
3588 JobObjectBasicUIRestrictions,
3589 JobObjectSecurityLimitInformation,
3590 JobObjectEndOfJobTimeInformation,
3591 JobObjectAssociateCompletionPortInformation,
3592 JobObjectBasicAndIoAccountingInformation,
3593 JobObjectExtendedLimitInformation,
3594 JobObjectJobSetInformation,
3595 JobObjectGroupInformation,
3596 MaxJobObjectInfoClass
3597 } JOBOBJECTINFOCLASS;
3598
3599 typedef struct _JOB_SET_ARRAY {
3600 HANDLE JobHandle;
3601 DWORD MemberLevel;
3602 DWORD Flags;
3603 } JOB_SET_ARRAY, *PJOB_SET_ARRAY;
3604
3605 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
3606 LARGE_INTEGER TotalUserTime;
3607 LARGE_INTEGER TotalKernelTime;
3608 LARGE_INTEGER ThisPeriodTotalUserTime;
3609 LARGE_INTEGER ThisPeriodTotalKernelTime;
3610 DWORD TotalPageFaultCount;
3611 DWORD TotalProcesses;
3612 DWORD ActiveProcesses;
3613 DWORD TotalTerminatedProcesses;
3614 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3615
3616 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
3617 LARGE_INTEGER PerProcessUserTimeLimit;
3618 LARGE_INTEGER PerJobUserTimeLimit;
3619 DWORD LimitFlags;
3620 SIZE_T MinimumWorkingSetSize;
3621 SIZE_T MaximumWorkingSetSize;
3622 DWORD ActiveProcessLimit;
3623 ULONG_PTR Affinity;
3624 DWORD PriorityClass;
3625 DWORD SchedulingClass;
3626 } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION;
3627
3628 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
3629 DWORD NumberOfAssignedProcesses;
3630 DWORD NumberOfProcessIdsInList;
3631 ULONG_PTR ProcessIdList[1];
3632 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
3633
3634 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
3635 DWORD UIRestrictionsClass;
3636 } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
3637
3638 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
3639 DWORD SecurityLimitFlags;
3640 HANDLE JobToken;
3641 PTOKEN_GROUPS SidsToDisable;
3642 PTOKEN_PRIVILEGES PrivilegesToDelete;
3643 PTOKEN_GROUPS RestrictedSids;
3644 } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
3645
3646 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
3647 DWORD EndOfJobTimeAction;
3648 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3649
3650 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
3651 PVOID CompletionKey;
3652 HANDLE CompletionPort;
3653 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3654
3655 typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
3656 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
3657 IO_COUNTERS IoInfo;
3658 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3659
3660 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
3661 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
3662 IO_COUNTERS IoInfo;
3663 SIZE_T ProcessMemoryLimit;
3664 SIZE_T JobMemoryLimit;
3665 SIZE_T PeakProcessMemoryUsed;
3666 SIZE_T PeakJobMemoryUsed;
3667 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3668
3669 typedef struct _JOBOBJECT_JOBSET_INFORMATION {
3670 DWORD MemberLevel;
3671 } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION;
3672
3673 /* Fixme: Making these defines conditional on WINVER will break ddk includes */
3674 #if 1 /* (WINVER >= 0x0500) */
3675
3676 #define ES_SYSTEM_REQUIRED 0x00000001
3677 #define ES_DISPLAY_REQUIRED 0x00000002
3678 #define ES_USER_PRESENT 0x00000004
3679 #define ES_CONTINUOUS 0x80000000
3680
3681 typedef enum _LATENCY_TIME {
3682 LT_DONT_CARE,
3683 LT_LOWEST_LATENCY
3684 } LATENCY_TIME, *PLATENCY_TIME;
3685
3686 typedef enum _SYSTEM_POWER_STATE {
3687 PowerSystemUnspecified = 0,
3688 PowerSystemWorking,
3689 PowerSystemSleeping1,
3690 PowerSystemSleeping2,
3691 PowerSystemSleeping3,
3692 PowerSystemHibernate,
3693 PowerSystemShutdown,
3694 PowerSystemMaximum
3695 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
3696
3697 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
3698
3699 typedef enum {
3700 PowerActionNone = 0,