a13ce8c65bd02925c1a228b2af4215afa9756e20
[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_QUERY_LIMITED_INFORMATION 0x0800
339 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
340 #define MUTANT_QUERY_STATE 0x0001
341 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
342 #define TIMER_QUERY_STATE 0x0001
343 #define TIMER_MODIFY_STATE 0x0002
344 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
345 #define THREAD_BASE_PRIORITY_LOWRT 15
346 #define THREAD_BASE_PRIORITY_MAX 2
347 #define THREAD_BASE_PRIORITY_MIN (-2)
348 #define THREAD_BASE_PRIORITY_IDLE (-15)
349
350 #define PROCESS_SET_LIMITED_INFORMATION 0x2000
351 #define THREAD_RESUME 0x1000
352
353 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
354 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
355 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
356 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
357 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
358 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
359 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
360 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
361 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
362 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
363 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
364 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
365 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
366 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
367 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
368 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
369 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
370 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
371 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
372 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
373 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
374 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
375 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
376 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
377 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
378 #define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege")
379 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
380 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
381 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
382 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
383
384 #define SE_GROUP_MANDATORY 0x00000001
385 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
386 #define SE_GROUP_ENABLED 0x00000004
387 #define SE_GROUP_OWNER 0x00000008
388 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
389 #define SE_GROUP_INTEGRITY 0x00000020
390 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040
391 #define SE_GROUP_LOGON_ID 0xC0000000
392 #define SE_GROUP_RESOURCE 0x20000000
393 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F
394
395 /* FIXME: non-standard */
396 #define LANG_ESPERANTO 0x8f
397 #define LANG_WALON 0x90
398 #define LANG_CORNISH 0x92
399
400 /* FIXME: not present in the official headers */
401 #define LANG_MALAGASY 0x8d
402 #define LANG_GAELIC 0x94
403 #define LANG_SAAMI 0x3b
404 #define LANG_SUTU 0x30
405 #define LANG_TSONGA 0x31
406 #define LANG_VENDA 0x33
407 #define LANG_MANX_GAELIC 0x94
408 #define SUBLANG_PORTUGUESE_PORTUGAL 0x02
409
410 #define PROCESSOR_INTEL_386 386
411 #define PROCESSOR_INTEL_486 486
412 #define PROCESSOR_INTEL_PENTIUM 586
413 #define PROCESSOR_MIPS_R4000 4000
414 #define PROCESSOR_ALPHA_21064 21064
415 #define PROCESSOR_INTEL_IA64 2200
416 #define PROCESSOR_PPC_601 601
417 #define PROCESSOR_PPC_603 603
418 #define PROCESSOR_PPC_604 604
419 #define PROCESSOR_PPC_620 620
420 #define PROCESSOR_INTEL_860 860
421 #define PROCESSOR_AMD_X8664 8664
422 #define PROCESSOR_MIPS_R2000 2000
423 #define PROCESSOR_MIPS_R3000 3000
424 #define PROCESSOR_HITACHI_SH3 10003
425 #define PROCESSOR_HITACHI_SH3E 10004
426 #define PROCESSOR_HITACHI_SH4 10005
427 #define PROCESSOR_MOTOROLA_821 821
428 #define PROCESSOR_SHx_SH3 103
429 #define PROCESSOR_SHx_SH4 104
430 #define PROCESSOR_STRONGARM 2577
431 #define PROCESSOR_ARM720 1824
432 #define PROCESSOR_ARM820 2080
433 #define PROCESSOR_ARM920 2336
434 #define PROCESSOR_ARM_7TDMI 70001
435 #define PROCESSOR_ARCHITECTURE_INTEL 0
436 #define PROCESSOR_ARCHITECTURE_MIPS 1
437 #define PROCESSOR_ARCHITECTURE_ALPHA 2
438 #define PROCESSOR_ARCHITECTURE_PPC 3
439 #define PROCESSOR_ARCHITECTURE_SHX 4
440 #define PROCESSOR_ARCHITECTURE_ARM 5
441 #define PROCESSOR_ARCHITECTURE_IA64 6
442 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
443 #define PROCESSOR_ARCHITECTURE_MSIL 8
444 #define PROCESSOR_ARCHITECTURE_AMD64 9
445 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
446
447 /* Processor features */
448 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
449 #define PF_FLOATING_POINT_EMULATED 1
450 #define PF_COMPARE_EXCHANGE_DOUBLE 2
451 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
452 #define PF_PPC_MOVEMEM_64BIT_OK 4
453 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
454 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
455 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
456 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
457 #define PF_PAE_ENABLED 9
458 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
459 #define PF_SSE_DAZ_MODE_AVAILABLE 11
460 #define PF_NX_ENABLED 12
461 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
462 #define PF_COMPARE_EXCHANGE128 14
463 #define PF_COMPARE64_EXCHANGE128 15
464 #define PF_CHANNELS_ENABLED 16
465 #define PF_XSAVE_ENABLED 17
466 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
467 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
468 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
469 #define PF_VIRT_FIRMWARE_ENABLED 21
470 #define PF_RDWRFSGSBASE_AVAILABLE 22
471 #define PF_FASTFAIL_AVAILABLE 23
472 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24
473 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25
474 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26
475 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27
476 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28
477 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29
478 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30
479 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31
480
481 /* also in ddk/ntifs.h */
482 #define FILE_ACTION_ADDED 0x00000001
483 #define FILE_ACTION_REMOVED 0x00000002
484 #define FILE_ACTION_MODIFIED 0x00000003
485 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
486 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
487 #define FILE_ACTION_ADDED_STREAM 0x00000006
488 #define FILE_ACTION_REMOVED_STREAM 0x00000007
489 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
490 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
491 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
492 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
493 /* end ntifs.h */
494 #define HEAP_NO_SERIALIZE 1
495 #define HEAP_GROWABLE 2
496 #define HEAP_GENERATE_EXCEPTIONS 4
497 #define HEAP_ZERO_MEMORY 8
498 #define HEAP_REALLOC_IN_PLACE_ONLY 16
499 #define HEAP_TAIL_CHECKING_ENABLED 32
500 #define HEAP_FREE_CHECKING_ENABLED 64
501 #define HEAP_DISABLE_COALESCE_ON_FREE 128
502 #define HEAP_CREATE_ALIGN_16 0x10000
503 #define HEAP_CREATE_ENABLE_TRACING 0x20000
504 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
505 #define HEAP_MAXIMUM_TAG 0xFFF
506 #define HEAP_PSEUDO_TAG_FLAG 0x8000
507 #define HEAP_TAG_SHIFT 16
508 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
509
510 #define KEY_QUERY_VALUE 1
511 #define KEY_SET_VALUE 2
512 #define KEY_CREATE_SUB_KEY 4
513 #define KEY_ENUMERATE_SUB_KEYS 8
514 #define KEY_NOTIFY 16
515 #define KEY_CREATE_LINK 32
516 #define KEY_WOW64_64KEY 0x00000100
517 #define KEY_WOW64_32KEY 0x00000200
518 #define KEY_WOW64_RES 0x00000300
519
520 #define KEY_WRITE 0x20006
521 #define KEY_EXECUTE 0x20019
522 #define KEY_READ 0x20019
523 #define KEY_ALL_ACCESS 0xf003f
524 #define REG_WHOLE_HIVE_VOLATILE 1
525 #define REG_REFRESH_HIVE 2
526 #define REG_NO_LAZY_FLUSH 4
527 #define REG_FORCE_RESTORE 8
528 #define REG_OPTION_RESERVED 0
529 #define REG_OPTION_NON_VOLATILE 0
530 #define REG_OPTION_VOLATILE 1
531 #define REG_OPTION_CREATE_LINK 2
532 #define REG_OPTION_BACKUP_RESTORE 4
533 #define REG_OPTION_OPEN_LINK 8
534 #define REG_LEGAL_OPTION 15
535 #define MAXIMUM_PROCESSORS 32
536 #define PAGE_NOACCESS 0x0001
537 #define PAGE_READONLY 0x0002
538 #define PAGE_READWRITE 0x0004
539 #define PAGE_WRITECOPY 0x0008
540 #define PAGE_EXECUTE 0x0010
541 #define PAGE_EXECUTE_READ 0x0020
542 #define PAGE_EXECUTE_READWRITE 0x0040
543 #define PAGE_EXECUTE_WRITECOPY 0x0080
544 #define PAGE_GUARD 0x0100
545 #define PAGE_NOCACHE 0x0200
546 #define PAGE_WRITECOMBINE 0x0400
547 #define MEM_COMMIT 0x1000
548 #define MEM_RESERVE 0x2000
549 #define MEM_DECOMMIT 0x4000
550 #define MEM_RELEASE 0x8000
551 #define MEM_FREE 0x10000
552 #define MEM_PRIVATE 0x20000
553 #define MEM_MAPPED 0x40000
554 #define MEM_RESET 0x80000
555 #define MEM_TOP_DOWN 0x100000
556 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
557 #define MEM_PHYSICAL 0x400000
558 #define MEM_4MB_PAGES 0x80000000
559 #define MEM_IMAGE SEC_IMAGE
560 #define SEC_NO_CHANGE 0x00400000
561 #define SEC_FILE 0x00800000
562 #define SEC_IMAGE 0x01000000
563 #define SEC_VLM 0x02000000
564 #define SEC_RESERVE 0x04000000
565 #define SEC_COMMIT 0x08000000
566 #define SEC_NOCACHE 0x10000000
567 #define SEC_WRITECOMBINE 0x40000000
568 #define SEC_LARGE_PAGES 0x80000000
569 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
570 #define SECTION_EXTEND_SIZE 16
571 #define SECTION_MAP_READ 4
572 #define SECTION_MAP_WRITE 2
573 #define SECTION_QUERY 1
574 #define SECTION_MAP_EXECUTE 8
575 #define SECTION_ALL_ACCESS 0xf001f
576 #define WRITE_WATCH_FLAG_RESET 0x01
577 #define MESSAGE_RESOURCE_UNICODE 1
578 #define RTL_CRITSECT_TYPE 0
579 #define RTL_RESOURCE_TYPE 1
580
581 #define IMAGE_SIZEOF_FILE_HEADER 20
582 #define IMAGE_FILE_RELOCS_STRIPPED 1
583 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
584 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
585 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
586 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
587 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
588 #define IMAGE_FILE_BYTES_REVERSED_LO 128
589 #define IMAGE_FILE_32BIT_MACHINE 256
590 #define IMAGE_FILE_DEBUG_STRIPPED 512
591 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
592 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
593 #define IMAGE_FILE_SYSTEM 4096
594 #define IMAGE_FILE_DLL 8192
595 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
596 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
597 #define IMAGE_FILE_MACHINE_UNKNOWN 0
598
599 #define IMAGE_FILE_MACHINE_AM33 0x1d3
600 #define IMAGE_FILE_MACHINE_AMD64 0x8664
601 #define IMAGE_FILE_MACHINE_ARM 0x1c0
602 #define IMAGE_FILE_MACHINE_ARMNT 0x1c4
603 #define IMAGE_FILE_MACHINE_EBC 0xebc
604 #define IMAGE_FILE_MACHINE_I386 0x14c
605 #define IMAGE_FILE_MACHINE_IA64 0x200
606 #define IMAGE_FILE_MACHINE_M32R 0x9041
607 #define IMAGE_FILE_MACHINE_MIPS16 0x266
608 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366
609 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466
610 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0
611 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1
612 #define IMAGE_FILE_MACHINE_R4000 0x166
613 #define IMAGE_FILE_MACHINE_SH3 0x1a2
614 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
615 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3
616 #define IMAGE_FILE_MACHINE_SH4 0x1a6
617 #define IMAGE_FILE_MACHINE_SH5 0x1a8
618 #define IMAGE_FILE_MACHINE_THUMB 0x1c2
619 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169
620 #define IMAGE_FILE_MACHINE_R3000 0x162
621 #define IMAGE_FILE_MACHINE_R10000 0x168
622 #define IMAGE_FILE_MACHINE_ALPHA 0x184
623 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
624 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
625 #define IMAGE_FILE_MACHINE_CEE 0xC0EE
626 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
627 #define IMAGE_FILE_MACHINE_CEF 0x0CEF
628
629 /* Wine extension */
630 #define IMAGE_FILE_MACHINE_ARM64 0x1c5
631
632 #define IMAGE_FILE_EXPORT_DIRECTORY 0
633 #define IMAGE_FILE_IMPORT_DIRECTORY 1
634 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
635 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
636 #define IMAGE_FILE_SECURITY_DIRECTORY 4
637 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
638 #define IMAGE_FILE_DEBUG_DIRECTORY 6
639 #define IMAGE_FILE_DESCRIPTION_STRING 7
640 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
641 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
642 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
643
644 #define IMAGE_DOS_SIGNATURE 0x5A4D
645 #define IMAGE_OS2_SIGNATURE 0x454E
646 #define IMAGE_OS2_SIGNATURE_LE 0x454C
647 #define IMAGE_VXD_SIGNATURE 0x454C
648 #define IMAGE_NT_SIGNATURE 0x00004550
649 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
650 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
651 #ifdef _WIN64
652 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
653 #else
654 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
655 #endif
656 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
657 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
658 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
659 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
660 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
661 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
662 #define IMAGE_SIZEOF_SHORT_NAME 8
663 #define IMAGE_SIZEOF_SECTION_HEADER 40
664 #define IMAGE_SIZEOF_SYMBOL 18
665 #define IMAGE_SIZEOF_AUX_SYMBOL 18
666 #define IMAGE_SIZEOF_RELOCATION 10
667 #define IMAGE_SIZEOF_BASE_RELOCATION 8
668 #define IMAGE_SIZEOF_LINENUMBER 6
669 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
670 #define SIZEOF_RFPO_DATA 16
671
672 #define IMAGE_SUBSYSTEM_UNKNOWN 0
673 #define IMAGE_SUBSYSTEM_NATIVE 1
674 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
675 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
676 #define IMAGE_SUBSYSTEM_OS2_CUI 5
677 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
678 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8
679 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9
680 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
681 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
682 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
683 #define IMAGE_SUBSYSTEM_EFI_ROM 13
684 #define IMAGE_SUBSYSTEM_XBOX 14
685
686 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
687 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
688 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
689 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
690 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
691 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
692 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
693 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
694 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
695 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
696 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
697 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
698 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
699 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
700 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
701 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
702 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
703 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
704 #define IMAGE_DIRECTORY_ENTRY_TLS 9
705 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
706 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
707 #define IMAGE_DIRECTORY_ENTRY_IAT 12
708 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
709 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
710 #define IMAGE_SCN_TYPE_REG 0
711 #define IMAGE_SCN_TYPE_DSECT 1
712 //#define IMAGE_SCN_TYPE_NOLOAD 2
713 #define IMAGE_SCN_TYPE_GROUP 4
714 #define IMAGE_SCN_TYPE_NO_PAD 8
715 #define IMAGE_SCN_CNT_CODE 32
716 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
717 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
718 #define IMAGE_SCN_LNK_OTHER 256
719 #define IMAGE_SCN_LNK_INFO 512
720 #define IMAGE_SCN_LNK_REMOVE 2048
721 #define IMAGE_SCN_LNK_COMDAT 4096
722 #define IMAGE_SCN_MEM_FARDATA 0x8000
723 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
724 #define IMAGE_SCN_MEM_16BIT 0x20000
725 #define IMAGE_SCN_MEM_LOCKED 0x40000
726 #define IMAGE_SCN_MEM_PRELOAD 0x80000
727 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
728 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
729 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
730 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
731 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
732 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
733 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
734 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
735 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
736 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
737 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
738 #define IMAGE_SCN_MEM_SHARED 0x10000000
739 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
740 #define IMAGE_SCN_MEM_READ 0x40000000
741 #define IMAGE_SCN_MEM_WRITE 0x80000000
742 #define IMAGE_SYM_UNDEFINED 0
743 #define IMAGE_SYM_ABSOLUTE (-1)
744 #define IMAGE_SYM_DEBUG (-2)
745 #define IMAGE_SYM_TYPE_NULL 0
746 #define IMAGE_SYM_TYPE_VOID 1
747 #define IMAGE_SYM_TYPE_CHAR 2
748 #define IMAGE_SYM_TYPE_SHORT 3
749 #define IMAGE_SYM_TYPE_INT 4
750 #define IMAGE_SYM_TYPE_LONG 5
751 #define IMAGE_SYM_TYPE_FLOAT 6
752 #define IMAGE_SYM_TYPE_DOUBLE 7
753 #define IMAGE_SYM_TYPE_STRUCT 8
754 #define IMAGE_SYM_TYPE_UNION 9
755 #define IMAGE_SYM_TYPE_ENUM 10
756 #define IMAGE_SYM_TYPE_MOE 11
757 #define IMAGE_SYM_TYPE_BYTE 12
758 #define IMAGE_SYM_TYPE_WORD 13
759 #define IMAGE_SYM_TYPE_UINT 14
760 #define IMAGE_SYM_TYPE_DWORD 15
761 #define IMAGE_SYM_TYPE_PCODE 32768
762 #define IMAGE_SYM_DTYPE_NULL 0
763 #define IMAGE_SYM_DTYPE_POINTER 1
764 #define IMAGE_SYM_DTYPE_FUNCTION 2
765 #define IMAGE_SYM_DTYPE_ARRAY 3
766 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
767 #define IMAGE_SYM_CLASS_NULL 0
768 #define IMAGE_SYM_CLASS_AUTOMATIC 1
769 #define IMAGE_SYM_CLASS_EXTERNAL 2
770 #define IMAGE_SYM_CLASS_STATIC 3
771 #define IMAGE_SYM_CLASS_REGISTER 4
772 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
773 #define IMAGE_SYM_CLASS_LABEL 6
774 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
775 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
776 #define IMAGE_SYM_CLASS_ARGUMENT 9
777 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
778 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
779 #define IMAGE_SYM_CLASS_UNION_TAG 12
780 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
781 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
782 #define IMAGE_SYM_CLASS_ENUM_TAG 15
783 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
784 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
785 #define IMAGE_SYM_CLASS_BIT_FIELD 18
786 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
787 #define IMAGE_SYM_CLASS_BLOCK 100
788 #define IMAGE_SYM_CLASS_FUNCTION 101
789 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
790 #define IMAGE_SYM_CLASS_FILE 103
791 #define IMAGE_SYM_CLASS_SECTION 104
792 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
793 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
794 #define IMAGE_COMDAT_SELECT_ANY 2
795 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
796 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
797 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
798 #define IMAGE_COMDAT_SELECT_LARGEST 6
799 #define IMAGE_COMDAT_SELECT_NEWEST 7
800 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
801 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
802 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
803 #define IMAGE_REL_I386_ABSOLUTE 0
804 #define IMAGE_REL_I386_DIR16 1
805 #define IMAGE_REL_I386_REL16 2
806 #define IMAGE_REL_I386_DIR32 6
807 #define IMAGE_REL_I386_DIR32NB 7
808 #define IMAGE_REL_I386_SEG12 9
809 #define IMAGE_REL_I386_SECTION 10
810 #define IMAGE_REL_I386_SECREL 11
811 #define IMAGE_REL_I386_REL32 20
812 #define IMAGE_REL_MIPS_ABSOLUTE 0
813 #define IMAGE_REL_MIPS_REFHALF 1
814 #define IMAGE_REL_MIPS_REFWORD 2
815 #define IMAGE_REL_MIPS_JMPADDR 3
816 #define IMAGE_REL_MIPS_REFHI 4
817 #define IMAGE_REL_MIPS_REFLO 5
818 #define IMAGE_REL_MIPS_GPREL 6
819 #define IMAGE_REL_MIPS_LITERAL 7
820 #define IMAGE_REL_MIPS_SECTION 10
821 #define IMAGE_REL_MIPS_SECREL 11
822 #define IMAGE_REL_MIPS_SECRELLO 12
823 #define IMAGE_REL_MIPS_SECRELHI 13
824 #define IMAGE_REL_MIPS_REFWORDNB 34
825 #define IMAGE_REL_MIPS_PAIR 35
826 #define IMAGE_REL_ALPHA_ABSOLUTE 0
827 #define IMAGE_REL_ALPHA_REFLONG 1
828 #define IMAGE_REL_ALPHA_REFQUAD 2
829 #define IMAGE_REL_ALPHA_GPREL32 3
830 #define IMAGE_REL_ALPHA_LITERAL 4
831 #define IMAGE_REL_ALPHA_LITUSE 5
832 #define IMAGE_REL_ALPHA_GPDISP 6
833 #define IMAGE_REL_ALPHA_BRADDR 7
834 #define IMAGE_REL_ALPHA_HINT 8
835 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
836 #define IMAGE_REL_ALPHA_REFHI 10
837 #define IMAGE_REL_ALPHA_REFLO 11
838 #define IMAGE_REL_ALPHA_PAIR 12
839 #define IMAGE_REL_ALPHA_MATCH 13
840 #define IMAGE_REL_ALPHA_SECTION 14
841 #define IMAGE_REL_ALPHA_SECREL 15
842 #define IMAGE_REL_ALPHA_REFLONGNB 16
843 #define IMAGE_REL_ALPHA_SECRELLO 17
844 #define IMAGE_REL_ALPHA_SECRELHI 18
845 #define IMAGE_REL_PPC_ABSOLUTE 0
846 #define IMAGE_REL_PPC_ADDR64 1
847 #define IMAGE_REL_PPC_ADDR32 2
848 #define IMAGE_REL_PPC_ADDR24 3
849 #define IMAGE_REL_PPC_ADDR16 4
850 #define IMAGE_REL_PPC_ADDR14 5
851 #define IMAGE_REL_PPC_REL24 6
852 #define IMAGE_REL_PPC_REL14 7
853 #define IMAGE_REL_PPC_TOCREL16 8
854 #define IMAGE_REL_PPC_TOCREL14 9
855 #define IMAGE_REL_PPC_ADDR32NB 10
856 #define IMAGE_REL_PPC_SECREL 11
857 #define IMAGE_REL_PPC_SECTION 12
858 #define IMAGE_REL_PPC_IFGLUE 13
859 #define IMAGE_REL_PPC_IMGLUE 14
860 #define IMAGE_REL_PPC_SECREL16 15
861 #define IMAGE_REL_PPC_REFHI 16
862 #define IMAGE_REL_PPC_REFLO 17
863 #define IMAGE_REL_PPC_PAIR 18
864 #define IMAGE_REL_PPC_TYPEMASK 255
865 #define IMAGE_REL_PPC_NEG 256
866 #define IMAGE_REL_PPC_BRTAKEN 512
867 #define IMAGE_REL_PPC_BRNTAKEN 1024
868 #define IMAGE_REL_PPC_TOCDEFN 2048
869 #define IMAGE_REL_BASED_ABSOLUTE 0
870 #define IMAGE_REL_BASED_HIGH 1
871 #define IMAGE_REL_BASED_LOW 2
872 #define IMAGE_REL_BASED_HIGHLOW 3
873 #define IMAGE_REL_BASED_HIGHADJ 4
874 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
875 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
876 #define IMAGE_REL_BASED_IA64_IMM64 9
877 #define IMAGE_REL_BASED_DIR64 10
878 #define IMAGE_ARCHIVE_START_SIZE 8
879 #define IMAGE_ARCHIVE_START "!<arch>\n"
880 #define IMAGE_ARCHIVE_END "`\n"
881 #define IMAGE_ARCHIVE_PAD "\n"
882 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
883 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
884 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
885 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
886 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
887 #define IMAGE_DEBUG_TYPE_COFF 1
888 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
889 #define IMAGE_DEBUG_TYPE_FPO 3
890 #define IMAGE_DEBUG_TYPE_MISC 4
891 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
892 #define IMAGE_DEBUG_TYPE_FIXUP 6
893 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
894 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
895 #define FRAME_FPO 0
896 #define FRAME_TRAP 1
897 #define FRAME_TSS 2
898 #define FRAME_NONFPO 3
899 #define IMAGE_DEBUG_MISC_EXENAME 1
900 #define N_BTMASK 0x000F
901 #define N_TMASK 0x0030
902 #define N_TMASK1 0x00C0
903 #define N_TMASK2 0x00F0
904 #define N_BTSHFT 4
905 #define N_TSHIFT 2
906 #define IS_TEXT_UNICODE_ASCII16 1
907 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
908 #define IS_TEXT_UNICODE_STATISTICS 2
909 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
910 #define IS_TEXT_UNICODE_CONTROLS 4
911 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
912 #define IS_TEXT_UNICODE_SIGNATURE 8
913 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
914 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
915 #define IS_TEXT_UNICODE_ODD_LENGTH 512
916 #define IS_TEXT_UNICODE_NULL_BYTES 4096
917 #define IS_TEXT_UNICODE_UNICODE_MASK 15
918 #define IS_TEXT_UNICODE_REVERSE_MASK 240
919 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
920 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
921 #define SERVICE_KERNEL_DRIVER 1
922 #define SERVICE_FILE_SYSTEM_DRIVER 2
923 #define SERVICE_ADAPTER 4
924 #define SERVICE_RECOGNIZER_DRIVER 8
925 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
926 #define SERVICE_WIN32_OWN_PROCESS 16
927 #define SERVICE_WIN32_SHARE_PROCESS 32
928 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
929 #define SERVICE_INTERACTIVE_PROCESS 256
930 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
931 #define SERVICE_BOOT_START 0
932 #define SERVICE_SYSTEM_START 1
933 #define SERVICE_AUTO_START 2
934 #define SERVICE_DEMAND_START 3
935 #define SERVICE_DISABLED 4
936 #define SERVICE_ERROR_IGNORE 0
937 #define SERVICE_ERROR_NORMAL 1
938 #define SERVICE_ERROR_SEVERE 2
939 #define SERVICE_ERROR_CRITICAL 3
940
941 #define DLL_PROCESS_DETACH 0
942 #define DLL_PROCESS_ATTACH 1
943 #define DLL_THREAD_ATTACH 2
944 #define DLL_THREAD_DETACH 3
945 #ifdef __WINESRC__
946 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */
947 #endif
948 #define TAPE_ABSOLUTE_POSITION 0
949 #define TAPE_LOGICAL_POSITION 1
950 #define TAPE_PSEUDO_LOGICAL_POSITION 2
951 #define TAPE_REWIND 0
952 #define TAPE_ABSOLUTE_BLOCK 1
953 #define TAPE_LOGICAL_BLOCK 2
954 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
955 #define TAPE_SPACE_END_OF_DATA 4
956 #define TAPE_SPACE_RELATIVE_BLOCKS 5
957 #define TAPE_SPACE_FILEMARKS 6
958 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
959 #define TAPE_SPACE_SETMARKS 8
960 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
961 #define TAPE_DRIVE_FIXED 1
962 #define TAPE_DRIVE_SELECT 2
963 #define TAPE_DRIVE_INITIATOR 4
964 #define TAPE_DRIVE_ERASE_SHORT 16
965 #define TAPE_DRIVE_ERASE_LONG 32
966 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
967 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
968 #define TAPE_DRIVE_TAPE_CAPACITY 256
969 #define TAPE_DRIVE_TAPE_REMAINING 512
970 #define TAPE_DRIVE_FIXED_BLOCK 1024
971 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
972 #define TAPE_DRIVE_WRITE_PROTECT 4096
973 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
974 #define TAPE_DRIVE_ECC 0x10000
975 #define TAPE_DRIVE_COMPRESSION 0x20000
976 #define TAPE_DRIVE_PADDING 0x40000
977 #define TAPE_DRIVE_REPORT_SMKS 0x80000
978 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
979 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
980 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
981 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
982 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
983 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
984 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
985 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
986 #define TAPE_DRIVE_TENSION 0x80000002
987 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
988 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
989 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
990 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
991 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
992 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
993 #define TAPE_DRIVE_SET_ECC 0x80000100
994 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
995 #define TAPE_DRIVE_SET_PADDING 0x80000400
996 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
997 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
998 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
999 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1000 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1001 #define TAPE_DRIVE_END_OF_DATA 0x80010000
1002 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1003 #define TAPE_DRIVE_FILEMARKS 0x80040000
1004 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1005 #define TAPE_DRIVE_SETMARKS 0x80100000
1006 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1007 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1008 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1009 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1010 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1011 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1012 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1013 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1014 #define TAPE_DRIVE_FORMAT 0xA0000000
1015 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1016 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1017 #define TAPE_FIXED_PARTITIONS 0
1018 #define TAPE_INITIATOR_PARTITIONS 2
1019 #define TAPE_SELECT_PARTITIONS 1
1020 #define TAPE_FILEMARKS 1
1021 #define TAPE_LONG_FILEMARKS 3
1022 #define TAPE_SETMARKS 0
1023 #define TAPE_SHORT_FILEMARKS 2
1024 #define TAPE_ERASE_LONG 1
1025 #define TAPE_ERASE_SHORT 0
1026 #define TAPE_LOAD 0
1027 #define TAPE_UNLOAD 1
1028 #define TAPE_TENSION 2
1029 #define TAPE_LOCK 3
1030 #define TAPE_UNLOCK 4
1031 #define TAPE_FORMAT 5
1032 #if (_WIN32_WINNT >= 0x0500)
1033 #define VER_MINORVERSION 0x0000001
1034 #define VER_MAJORVERSION 0x0000002
1035 #define VER_BUILDNUMBER 0x0000004
1036 #define VER_PLATFORMID 0x0000008
1037 #define VER_SERVICEPACKMINOR 0x0000010
1038 #define VER_SERVICEPACKMAJOR 0x0000020
1039 #define VER_SUITENAME 0x0000040
1040 #define VER_PRODUCT_TYPE 0x0000080
1041 #define VER_EQUAL 1
1042 #define VER_GREATER 2
1043 #define VER_GREATER_EQUAL 3
1044 #define VER_LESS 4
1045 #define VER_LESS_EQUAL 5
1046 #define VER_AND 6
1047 #define VER_OR 7
1048 #endif
1049
1050 #define VER_PLATFORM_WIN32s 0
1051 #define VER_PLATFORM_WIN32_WINDOWS 1
1052 #define VER_PLATFORM_WIN32_NT 2
1053 #define VER_NT_WORKSTATION 1
1054 #define VER_NT_DOMAIN_CONTROLLER 2
1055 #define VER_NT_SERVER 3
1056
1057 #define WT_EXECUTEDEFAULT 0x00000000
1058 #define WT_EXECUTEINIOTHREAD 0x00000001
1059 #define WT_EXECUTEINUITHREAD 0x00000002
1060 #define WT_EXECUTEINWAITTHREAD 0x00000004
1061 #define WT_EXECUTEONLYONCE 0x00000008
1062 #define WT_EXECUTELONGFUNCTION 0x00000010
1063 #define WT_EXECUTEINTIMERTHREAD 0x00000020
1064 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040
1065 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1066 #define WT_TRANSFER_IMPERSONATION 0x00000100
1067 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16)
1068 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID);
1069 #if (_WIN32_WINNT >= 0x0501)
1070 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1071 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1072 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1073 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1074 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1075 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1076 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1077 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1078 #endif /* (_WIN32_WINNT >= 0x0501) */
1079 #define BTYPE(x) ((x)&N_BTMASK)
1080 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1081 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1082 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1083 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1084 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1085 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1086 #define TLS_MINIMUM_AVAILABLE 64
1087 #define FLS_MAXIMUM_AVAILABLE 128
1088 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1089 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1090 #define IO_REPARSE_TAG_RESERVED_ZERO 0
1091 #define IO_REPARSE_TAG_RESERVED_ONE 1
1092 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1093 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1094 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
1095 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1096 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1097 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1098 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1099 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1100 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
1101 #ifndef RC_INVOKED
1102
1103 #ifdef _GUID_DEFINED
1104 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1105 #endif
1106
1107 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1108 #define GUID_DEFINED
1109 typedef struct _GUID {
1110 unsigned long Data1;
1111 unsigned short Data2;
1112 unsigned short Data3;
1113 unsigned char Data4[8];
1114 } GUID, *REFGUID, *LPGUID;
1115 #endif /* GUID_DEFINED */
1116
1117 typedef enum _ACL_INFORMATION_CLASS {
1118 AclRevisionInformation = 1,
1119 AclSizeInformation
1120 } ACL_INFORMATION_CLASS;
1121
1122 typedef struct _ACL_REVISION_INFORMATION {
1123 DWORD AclRevision;
1124 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
1125
1126 typedef struct _ACL_SIZE_INFORMATION {
1127 DWORD AceCount;
1128 DWORD AclBytesInUse;
1129 DWORD AclBytesFree;
1130 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
1131
1132 #ifndef _LDT_ENTRY_DEFINED
1133 #define _LDT_ENTRY_DEFINED
1134
1135 typedef struct _LDT_ENTRY {
1136 WORD LimitLow;
1137 WORD BaseLow;
1138 union {
1139 struct {
1140 BYTE BaseMid;
1141 BYTE Flags1;
1142 BYTE Flags2;
1143 BYTE BaseHi;
1144 } Bytes;
1145 struct {
1146 DWORD BaseMid:8;
1147 DWORD Type:5;
1148 DWORD Dpl:2;
1149 DWORD Pres:1;
1150 DWORD LimitHi:4;
1151 DWORD Sys:1;
1152 DWORD Reserved_0:1;
1153 DWORD Default_Big:1;
1154 DWORD Granularity:1;
1155 DWORD BaseHi:8;
1156 } Bits;
1157 } HighWord;
1158 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY;
1159
1160 #endif /* _LDT_ENTRY_DEFINED */
1161
1162 /* FIXME: add more machines */
1163 #if defined(_X86_)
1164 #define SIZE_OF_80387_REGISTERS 80
1165 #define CONTEXT_i386 0x10000
1166 #define CONTEXT_i486 0x10000
1167 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
1168 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
1169 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
1170 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
1171 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
1172 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
1173 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
1174 #define MAXIMUM_SUPPORTED_EXTENSION 512
1175
1176 #define EXCEPTION_READ_FAULT 0
1177 #define EXCEPTION_WRITE_FAULT 1
1178 #define EXCEPTION_EXECUTE_FAULT 8
1179
1180 typedef struct _FLOATING_SAVE_AREA {
1181 DWORD ControlWord;
1182 DWORD StatusWord;
1183 DWORD TagWord;
1184 DWORD ErrorOffset;
1185 DWORD ErrorSelector;
1186 DWORD DataOffset;
1187 DWORD DataSelector;
1188 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
1189 DWORD Cr0NpxState;
1190 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
1191
1192 typedef struct _CONTEXT {
1193 DWORD ContextFlags;
1194 DWORD Dr0;
1195 DWORD Dr1;
1196 DWORD Dr2;
1197 DWORD Dr3;
1198 DWORD Dr6;
1199 DWORD Dr7;
1200 FLOATING_SAVE_AREA FloatSave;
1201 DWORD SegGs;
1202 DWORD SegFs;
1203 DWORD SegEs;
1204 DWORD SegDs;
1205 DWORD Edi;
1206 DWORD Esi;
1207 DWORD Ebx;
1208 DWORD Edx;
1209 DWORD Ecx;
1210 DWORD Eax;
1211 DWORD Ebp;
1212 DWORD Eip;
1213 DWORD SegCs;
1214 DWORD EFlags;
1215 DWORD Esp;
1216 DWORD SegSs;
1217 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
1218 } CONTEXT;
1219 #elif defined(_AMD64_)
1220
1221 #define CONTEXT_AMD64 0x100000
1222
1223 #if !defined(RC_INVOKED)
1224 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L)
1225 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L)
1226 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L)
1227 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L)
1228 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L)
1229
1230 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1231 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
1232
1233 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1234 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1235 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1236 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1237 #endif
1238
1239 #define INITIAL_MXCSR 0x1f80
1240 #define INITIAL_FPCSR 0x027f
1241 #define EXCEPTION_READ_FAULT 0
1242 #define EXCEPTION_WRITE_FAULT 1
1243 #define EXCEPTION_EXECUTE_FAULT 8
1244
1245 typedef struct DECLSPEC_ALIGN(16) _M128A {
1246 ULONGLONG Low;
1247 LONGLONG High;
1248 } M128A, *PM128A;
1249
1250 typedef struct _XMM_SAVE_AREA32 {
1251 WORD ControlWord;
1252 WORD StatusWord;
1253 BYTE TagWord;
1254 BYTE Reserved1;
1255 WORD ErrorOpcode;
1256 DWORD ErrorOffset;
1257 WORD ErrorSelector;
1258 WORD Reserved2;
1259 DWORD DataOffset;
1260 WORD DataSelector;
1261 WORD Reserved3;
1262 DWORD MxCsr;
1263 DWORD MxCsr_Mask;
1264 M128A FloatRegisters[8];
1265 M128A XmmRegisters[16];
1266 BYTE Reserved4[96];
1267 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
1268
1269 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
1270 DWORD64 P1Home;
1271 DWORD64 P2Home;
1272 DWORD64 P3Home;
1273 DWORD64 P4Home;
1274 DWORD64 P5Home;
1275 DWORD64 P6Home;
1276
1277 /* Control flags */
1278 DWORD ContextFlags;
1279 DWORD MxCsr;
1280
1281 /* Segment */
1282 WORD SegCs;
1283 WORD SegDs;
1284 WORD SegEs;
1285 WORD SegFs;
1286 WORD SegGs;
1287 WORD SegSs;
1288 DWORD EFlags;
1289
1290 /* Debug */
1291 DWORD64 Dr0;
1292 DWORD64 Dr1;
1293 DWORD64 Dr2;
1294 DWORD64 Dr3;
1295 DWORD64 Dr6;
1296 DWORD64 Dr7;
1297
1298 /* Integer */
1299 DWORD64 Rax;
1300 DWORD64 Rcx;
1301 DWORD64 Rdx;
1302 DWORD64 Rbx;
1303 DWORD64 Rsp;
1304 DWORD64 Rbp;
1305 DWORD64 Rsi;
1306 DWORD64 Rdi;
1307 DWORD64 R8;
1308 DWORD64 R9;
1309 DWORD64 R10;
1310 DWORD64 R11;
1311 DWORD64 R12;
1312 DWORD64 R13;
1313 DWORD64 R14;
1314 DWORD64 R15;
1315
1316 /* Counter */
1317 DWORD64 Rip;
1318
1319 /* Floating point */
1320 union {
1321 XMM_SAVE_AREA32 FltSave;
1322 struct {
1323 M128A Header[2];
1324 M128A Legacy[8];
1325 M128A Xmm0;
1326 M128A Xmm1;
1327 M128A Xmm2;
1328 M128A Xmm3;
1329 M128A Xmm4;
1330 M128A Xmm5;
1331 M128A Xmm6;
1332 M128A Xmm7;
1333 M128A Xmm8;
1334 M128A Xmm9;
1335 M128A Xmm10;
1336 M128A Xmm11;
1337 M128A Xmm12;
1338 M128A Xmm13;
1339 M128A Xmm14;
1340 M128A Xmm15;
1341 } DUMMYSTRUCTNAME;
1342 } DUMMYUNIONNAME;
1343
1344 /* Vector */
1345 M128A VectorRegister[26];
1346 DWORD64 VectorControl;
1347
1348 /* Debug control */
1349 DWORD64 DebugControl;
1350 DWORD64 LastBranchToRip;
1351 DWORD64 LastBranchFromRip;
1352 DWORD64 LastExceptionToRip;
1353 DWORD64 LastExceptionFromRip;
1354 } CONTEXT;
1355
1356
1357 typedef struct _KNONVOLATILE_CONTEXT_POINTERS {
1358 union {
1359 PM128A FloatingContext[16];
1360 struct {
1361 PM128A Xmm0;
1362 PM128A Xmm1;
1363 PM128A Xmm2;
1364 PM128A Xmm3;
1365 PM128A Xmm4;
1366 PM128A Xmm5;
1367 PM128A Xmm6;
1368 PM128A Xmm7;
1369 PM128A Xmm8;
1370 PM128A Xmm9;
1371 PM128A Xmm10;
1372 PM128A Xmm11;
1373 PM128A Xmm12;
1374 PM128A Xmm13;
1375 PM128A Xmm14;
1376 PM128A Xmm15;
1377 } DUMMYSTRUCTNAME;
1378 } DUMMYUNIONNAME;
1379
1380 union {
1381 PULONG64 IntegerContext[16];
1382 struct {
1383 PULONG64 Rax;
1384 PULONG64 Rcx;
1385 PULONG64 Rdx;
1386 PULONG64 Rbx;
1387 PULONG64 Rsp;
1388 PULONG64 Rbp;
1389 PULONG64 Rsi;
1390 PULONG64 Rdi;
1391 PULONG64 R8;
1392 PULONG64 R9;
1393 PULONG64 R10;
1394 PULONG64 R11;
1395 PULONG64 R12;
1396 PULONG64 R13;
1397 PULONG64 R14;
1398 PULONG64 R15;
1399 } DUMMYSTRUCTNAME;
1400 } DUMMYUNIONNAME2;
1401 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1402
1403 #define RUNTIME_FUNCTION_INDIRECT 0x1
1404
1405 typedef struct _RUNTIME_FUNCTION {
1406 DWORD BeginAddress;
1407 DWORD EndAddress;
1408 DWORD UnwindData;
1409 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION;
1410
1411 #define UNWIND_HISTORY_TABLE_SIZE 12
1412
1413 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1414 {
1415 DWORD64 ImageBase;
1416 PRUNTIME_FUNCTION FunctionEntry;
1417 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1418
1419 typedef struct _UNWIND_HISTORY_TABLE
1420 {
1421 DWORD Count;
1422 UCHAR Search;
1423 ULONG64 LowAddress;
1424 ULONG64 HighAddress;
1425 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1426 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1427
1428 typedef
1429 _Function_class_(GET_RUNTIME_FUNCTION_CALLBACK)
1430 PRUNTIME_FUNCTION
1431 (*PGET_RUNTIME_FUNCTION_CALLBACK)(
1432 _In_ DWORD64 ControlPc,
1433 _In_opt_ PVOID Context);
1434
1435 typedef
1436 _Function_class_(OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)
1437 _Must_inspect_result_
1438 DWORD
1439 (*POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK)(
1440 _In_ HANDLE Process,
1441 _In_ PVOID TableAddress,
1442 _Out_ PDWORD Entries,
1443 _Out_ PRUNTIME_FUNCTION *Functions);
1444
1445 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback"
1446
1447 NTSYSAPI
1448 VOID
1449 __cdecl
1450 RtlRestoreContext(struct _CONTEXT *ContextRecord,
1451 struct _EXCEPTION_RECORD *ExceptionRecord);
1452
1453 NTSYSAPI
1454 BOOLEAN
1455 __cdecl
1456 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable,
1457 DWORD EntryCount,
1458 DWORD64 BaseAddress);
1459
1460 NTSYSAPI
1461 BOOLEAN
1462 __cdecl
1463 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier,
1464 DWORD64 BaseAddress,
1465 DWORD Length,
1466 PGET_RUNTIME_FUNCTION_CALLBACK Callback,
1467 PVOID Context,
1468 PCWSTR OutOfProcessCallbackDll);
1469
1470 NTSYSAPI
1471 BOOLEAN
1472 __cdecl
1473 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable);
1474
1475 NTSYSAPI
1476 PRUNTIME_FUNCTION
1477 NTAPI
1478 RtlLookupFunctionEntry(
1479 _In_ DWORD64 ControlPc,
1480 _Out_ PDWORD64 ImageBase,
1481 _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable);
1482
1483 NTSYSAPI
1484 PEXCEPTION_ROUTINE
1485 NTAPI
1486 RtlVirtualUnwind(
1487 _In_ DWORD HandlerType,
1488 _In_ DWORD64 ImageBase,
1489 _In_ DWORD64 ControlPc,
1490 _In_ PRUNTIME_FUNCTION FunctionEntry,
1491 _Inout_ struct _CONTEXT *ContextRecord,
1492 _Out_ PVOID *HandlerData,
1493 _Out_ PDWORD64 EstablisherFrame,
1494 _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers);
1495
1496 #elif defined(_PPC_)
1497 #define CONTEXT_CONTROL 1L
1498 #define CONTEXT_FLOATING_POINT 2L
1499 #define CONTEXT_INTEGER 4L
1500 #define CONTEXT_DEBUG_REGISTERS 8L
1501 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1502 typedef struct _FLOATING_SAVE_AREA
1503 {
1504 double Fpr0;
1505 double Fpr1;
1506 double Fpr2;
1507 double Fpr3;
1508 double Fpr4;
1509 double Fpr5;
1510 double Fpr6;
1511 double Fpr7;
1512 double Fpr8;
1513 double Fpr9;
1514 double Fpr10;
1515 double Fpr11;
1516 double Fpr12;
1517 double Fpr13;
1518 double Fpr14;
1519 double Fpr15;
1520 double Fpr16;
1521 double Fpr17;
1522 double Fpr18;
1523 double Fpr19;
1524 double Fpr20;
1525 double Fpr21;
1526 double Fpr22;
1527 double Fpr23;
1528 double Fpr24;
1529 double Fpr25;
1530 double Fpr26;
1531 double Fpr27;
1532 double Fpr28;
1533 double Fpr29;
1534 double Fpr30;
1535 double Fpr31;
1536 double Fpscr;
1537 } FLOATING_SAVE_AREA;
1538
1539 typedef struct _CONTEXT {
1540 FLOATING_SAVE_AREA FloatSave;
1541 DWORD Gpr0;
1542 DWORD Gpr1;
1543 DWORD Gpr2;
1544 DWORD Gpr3;
1545 DWORD Gpr4;
1546 DWORD Gpr5;
1547 DWORD Gpr6;
1548 DWORD Gpr7;
1549 DWORD Gpr8;
1550 DWORD Gpr9;
1551 DWORD Gpr10;
1552 DWORD Gpr11;
1553 DWORD Gpr12;
1554 DWORD Gpr13;
1555 DWORD Gpr14;
1556 DWORD Gpr15;
1557 DWORD Gpr16;
1558 DWORD Gpr17;
1559 DWORD Gpr18;
1560 DWORD Gpr19;
1561 DWORD Gpr20;
1562 DWORD Gpr21;
1563 DWORD Gpr22;
1564 DWORD Gpr23;
1565 DWORD Gpr24;
1566 DWORD Gpr25;
1567 DWORD Gpr26;
1568 DWORD Gpr27;
1569 DWORD Gpr28;
1570 DWORD Gpr29;
1571 DWORD Gpr30;
1572 DWORD Gpr31;
1573 DWORD Cr;
1574 DWORD Xer;
1575 DWORD Msr;
1576 DWORD Iar;
1577 DWORD Lr;
1578 DWORD Ctr;
1579 DWORD ContextFlags;
1580 DWORD Fill[3];
1581 DWORD Dr0;
1582 DWORD Dr1;
1583 DWORD Dr2;
1584 DWORD Dr3;
1585 DWORD Dr4;
1586 DWORD Dr5;
1587 DWORD Dr6;
1588 DWORD Dr7;
1589 } CONTEXT;
1590 #elif defined(_ALPHA_)
1591 #define CONTEXT_ALPHA 0x20000
1592 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1593 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1594 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1595 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1596 typedef struct _CONTEXT {
1597 ULONGLONG FltF0;
1598 ULONGLONG FltF1;
1599 ULONGLONG FltF2;
1600 ULONGLONG FltF3;
1601 ULONGLONG FltF4;
1602 ULONGLONG FltF5;
1603 ULONGLONG FltF6;
1604 ULONGLONG FltF7;
1605 ULONGLONG FltF8;
1606 ULONGLONG FltF9;
1607 ULONGLONG FltF10;
1608 ULONGLONG FltF11;
1609 ULONGLONG FltF12;
1610 ULONGLONG FltF13;
1611 ULONGLONG FltF14;
1612 ULONGLONG FltF15;
1613 ULONGLONG FltF16;
1614 ULONGLONG FltF17;
1615 ULONGLONG FltF18;
1616 ULONGLONG FltF19;
1617 ULONGLONG FltF20;
1618 ULONGLONG FltF21;
1619 ULONGLONG FltF22;
1620 ULONGLONG FltF23;
1621 ULONGLONG FltF24;
1622 ULONGLONG FltF25;
1623 ULONGLONG FltF26;
1624 ULONGLONG FltF27;
1625 ULONGLONG FltF28;
1626 ULONGLONG FltF29;
1627 ULONGLONG FltF30;
1628 ULONGLONG FltF31;
1629 ULONGLONG IntV0;
1630 ULONGLONG IntT0;
1631 ULONGLONG IntT1;
1632 ULONGLONG IntT2;
1633 ULONGLONG IntT3;
1634 ULONGLONG IntT4;
1635 ULONGLONG IntT5;
1636 ULONGLONG IntT6;
1637 ULONGLONG IntT7;
1638 ULONGLONG IntS0;
1639 ULONGLONG IntS1;
1640 ULONGLONG IntS2;
1641 ULONGLONG IntS3;
1642 ULONGLONG IntS4;
1643 ULONGLONG IntS5;
1644 ULONGLONG IntFp;
1645 ULONGLONG IntA0;
1646 ULONGLONG IntA1;
1647 ULONGLONG IntA2;
1648 ULONGLONG IntA3;
1649 ULONGLONG IntA4;
1650 ULONGLONG IntA5;
1651 ULONGLONG IntT8;
1652 ULONGLONG IntT9;
1653 ULONGLONG IntT10;
1654 ULONGLONG IntT11;
1655 ULONGLONG IntRa;
1656 ULONGLONG IntT12;
1657 ULONGLONG IntAt;
1658 ULONGLONG IntGp;
1659 ULONGLONG IntSp;
1660 ULONGLONG IntZero;
1661 ULONGLONG Fpcr;
1662 ULONGLONG SoftFpcr;
1663 ULONGLONG Fir;
1664 DWORD Psr;
1665 DWORD ContextFlags;
1666 DWORD Fill[4];
1667 } CONTEXT;
1668 #elif defined(_SH_)
1669
1670 /* These are the debug or break registers on the SH3 */
1671 typedef struct _DEBUG_REGISTERS {
1672 DWORD BarA;
1673 UCHAR BasrA;
1674 UCHAR BamrA;
1675 USHORT BbrA;
1676 DWORD BarB;
1677 UCHAR BasrB;
1678 UCHAR BamrB;
1679 USHORT BbrB;
1680 DWORD BdrB;
1681 DWORD BdmrB;
1682 USHORT Brcr;
1683 USHORT Align;
1684 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
1685
1686 /* The following flags control the contents of the CONTEXT structure. */
1687
1688 #define CONTEXT_SH3 0x00000040
1689 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
1690
1691 #ifdef SH3
1692 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
1693 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
1694 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
1695 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
1696 #else /* SH4 */
1697 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
1698 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
1699 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
1700 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
1701 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
1702 #endif
1703
1704 /* Context Frame */
1705
1706 /* This frame is used to store a limited processor context into the */
1707 /* Thread structure for CPUs which have no floating point support. */
1708
1709 typedef struct _CONTEXT {
1710 /* The flags values within this flag control the contents of */
1711 /* a CONTEXT record. */
1712
1713 /* If the context record is used as an input parameter, then */
1714 /* for each portion of the context record controlled by a flag */
1715 /* whose value is set, it is assumed that that portion of the */
1716 /* context record contains valid context. If the context record */
1717 /* is being used to modify a thread's context, then only that */
1718 /* portion of the threads context will be modified. */
1719
1720 /* If the context record is used as an IN OUT parameter to capture */
1721 /* the context of a thread, then only those portions of the thread's */
1722 /* context corresponding to set flags will be returned. */
1723
1724 /* The context record is never used as an OUT only parameter. */
1725
1726
1727 DWORD ContextFlags;
1728
1729 /* This section is specified/returned if the ContextFlags word contains */
1730 /* the flag CONTEXT_INTEGER. */
1731
1732 /* N.B. The registers RA and R15 are defined in this section, but are */
1733 /* considered part of the control context rather than part of the integer */
1734 /* context. */
1735
1736 DWORD PR;
1737 DWORD MACH;
1738 DWORD MACL;
1739 DWORD GBR;
1740 DWORD R0;
1741 DWORD R1;
1742 DWORD R2;
1743 DWORD R3;
1744 DWORD R4;
1745 DWORD R5;
1746 DWORD R6;
1747 DWORD R7;
1748 DWORD R8;
1749 DWORD R9;
1750 DWORD R10;
1751 DWORD R11;
1752 DWORD R12;
1753 DWORD R13;
1754 DWORD R14;
1755 DWORD R15;
1756
1757 /* This section is specified/returned if the ContextFlags word contains */
1758 /* the flag CONTEXT_CONTROL. */
1759
1760 /* N.B. The registers r15 and ra are defined in the integer section, */
1761 /* but are considered part of the control context rather than part of */
1762 /* the integer context. */
1763
1764 DWORD Fir;
1765 DWORD Psr;
1766
1767 #if !defined(SH3e) && !defined(SH4)
1768 DWORD OldStuff[2];
1769 DEBUG_REGISTERS DebugRegisters;
1770 #else
1771 DWORD Fpscr;
1772 DWORD Fpul;
1773 DWORD FRegs[16];
1774 #if defined(SH4)
1775 DWORD xFRegs[16];
1776 #endif
1777 #endif
1778 } CONTEXT;
1779
1780 #elif defined(_MIPS_)
1781
1782 /* The following flags control the contents of the CONTEXT structure. */
1783
1784 #define CONTEXT_R4000 0x00010000 /* r4000 context */
1785
1786 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
1787 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
1788 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
1789
1790 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1791
1792 /* Context Frame */
1793
1794 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
1795
1796 /* This frame has a several purposes: 1) it is used as an argument to */
1797 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
1798 /* 3) it is used to construct a call frame for exception dispatching */
1799 /* in user mode, and 4) it is used in the user level thread creation */
1800 /* routines. */
1801
1802 /* The layout of the record conforms to a standard call frame. */
1803
1804
1805 typedef struct _CONTEXT {
1806
1807 /* This section is always present and is used as an argument build */
1808 /* area. */
1809
1810 DWORD Argument[4];
1811
1812 /* This section is specified/returned if the ContextFlags word contains */
1813 /* the flag CONTEXT_FLOATING_POINT. */
1814
1815 DWORD FltF0;
1816 DWORD FltF1;
1817 DWORD FltF2;
1818 DWORD FltF3;
1819 DWORD FltF4;
1820 DWORD FltF5;
1821 DWORD FltF6;
1822 DWORD FltF7;
1823 DWORD FltF8;
1824 DWORD FltF9;
1825 DWORD FltF10;
1826 DWORD FltF11;
1827 DWORD FltF12;
1828 DWORD FltF13;
1829 DWORD FltF14;
1830 DWORD FltF15;
1831 DWORD FltF16;
1832 DWORD FltF17;
1833 DWORD FltF18;
1834 DWORD FltF19;
1835 DWORD FltF20;
1836 DWORD FltF21;
1837 DWORD FltF22;
1838 DWORD FltF23;
1839 DWORD FltF24;
1840 DWORD FltF25;
1841 DWORD FltF26;
1842 DWORD FltF27;
1843 DWORD FltF28;
1844 DWORD FltF29;
1845 DWORD FltF30;
1846 DWORD FltF31;
1847
1848 /* This section is specified/returned if the ContextFlags word contains */
1849 /* the flag CONTEXT_INTEGER. */
1850
1851 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
1852 /* considered part of the control context rather than part of the integer */
1853 /* context. */
1854
1855 /* N.B. Register zero is not stored in the frame. */
1856
1857 DWORD IntZero;
1858 DWORD IntAt;
1859 DWORD IntV0;
1860 DWORD IntV1;
1861 DWORD IntA0;
1862 DWORD IntA1;
1863 DWORD IntA2;
1864 DWORD IntA3;
1865 DWORD IntT0;
1866 DWORD IntT1;
1867 DWORD IntT2;
1868 DWORD IntT3;
1869 DWORD IntT4;
1870 DWORD IntT5;
1871 DWORD IntT6;
1872 DWORD IntT7;
1873 DWORD IntS0;
1874 DWORD IntS1;
1875 DWORD IntS2;
1876 DWORD IntS3;
1877 DWORD IntS4;
1878 DWORD IntS5;
1879 DWORD IntS6;
1880 DWORD IntS7;
1881 DWORD IntT8;
1882 DWORD IntT9;
1883 DWORD IntK0;
1884 DWORD IntK1;
1885 DWORD IntGp;
1886 DWORD IntSp;
1887 DWORD IntS8;
1888 DWORD IntRa;
1889 DWORD IntLo;
1890 DWORD IntHi;
1891
1892 /* This section is specified/returned if the ContextFlags word contains */
1893 /* the flag CONTEXT_FLOATING_POINT. */
1894
1895 DWORD Fsr;
1896
1897 /* This section is specified/returned if the ContextFlags word contains */
1898 /* the flag CONTEXT_CONTROL. */
1899
1900 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
1901 /* but are considered part of the control context rather than part of */
1902 /* the integer context. */
1903
1904 DWORD Fir;
1905 DWORD Psr;
1906
1907 /* The flags values within this flag control the contents of */
1908 /* a CONTEXT record. */
1909
1910 /* If the context record is used as an input parameter, then */
1911 /* for each portion of the context record controlled by a flag */
1912 /* whose value is set, it is assumed that that portion of the */
1913 /* context record contains valid context. If the context record */
1914 /* is being used to modify a thread's context, then only that */
1915 /* portion of the threads context will be modified. */
1916
1917 /* If the context record is used as an IN OUT parameter to capture */
1918 /* the context of a thread, then only those portions of the thread's */
1919 /* context corresponding to set flags will be returned. */
1920
1921 /* The context record is never used as an OUT only parameter. */
1922
1923 DWORD ContextFlags;
1924
1925 DWORD Fill[2];
1926
1927 } CONTEXT;
1928 #elif defined(_ARM_)
1929
1930 #ifndef PAGE_SIZE
1931 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere
1932 #endif
1933
1934 /* The following flags control the contents of the CONTEXT structure. */
1935
1936 #define CONTEXT_ARM 0x200000L
1937 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1938 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1939 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L)
1940 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L)
1941 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
1942
1943 #define EXCEPTION_READ_FAULT 0
1944 #define EXCEPTION_WRITE_FAULT 1
1945 #define EXCEPTION_EXECUTE_FAULT 8
1946
1947 typedef struct _NEON128
1948 {
1949 ULONGLONG Low;
1950 LONGLONG High;
1951 } NEON128, *PNEON128;
1952
1953 #define ARM_MAX_BREAKPOINTS 8
1954 #define ARM_MAX_WATCHPOINTS 1
1955
1956 typedef struct _CONTEXT
1957 {
1958 /* The flags values within this flag control the contents of
1959 a CONTEXT record.
1960
1961 If the context record is used as an input parameter, then
1962 for each portion of the context record controlled by a flag
1963 whose value is set, it is assumed that that portion of the
1964 context record contains valid context. If the context record
1965 is being used to modify a thread's context, then only that
1966 portion of the threads context will be modified.
1967
1968 If the context record is used as an IN OUT parameter to capture
1969 the context of a thread, then only those portions of the thread's
1970 context corresponding to set flags will be returned.
1971
1972 The context record is never used as an OUT only parameter. */
1973 DWORD ContextFlags;
1974
1975 /* This section is specified/returned if the ContextFlags word contains
1976 the flag CONTEXT_INTEGER. */
1977 DWORD R0;
1978 DWORD R1;
1979 DWORD R2;
1980 DWORD R3;
1981 DWORD R4;
1982 DWORD R5;
1983 DWORD R6;
1984 DWORD R7;
1985 DWORD R8;
1986 DWORD R9;
1987 DWORD R10;
1988 DWORD R11;
1989 DWORD R12;
1990
1991 DWORD Sp;
1992 DWORD Lr;
1993 DWORD Pc;
1994 DWORD Cpsr;
1995
1996 /* Floating Point/NEON Registers */
1997 DWORD Fpscr;
1998 DWORD Padding;
1999 union
2000 {
2001 NEON128 Q[16];
2002 ULONGLONG D[32];
2003 DWORD S[32];
2004 } DUMMYUNIONNAME;
2005
2006 /* Debug registers */
2007 DWORD Bvr[ARM_MAX_BREAKPOINTS];
2008 DWORD Bcr[ARM_MAX_BREAKPOINTS];
2009 DWORD Wvr[ARM_MAX_WATCHPOINTS];
2010 DWORD Wcr[ARM_MAX_WATCHPOINTS];
2011
2012 DWORD Padding2[2];
2013 } CONTEXT;
2014
2015 #else
2016 #error "undefined processor type"
2017 #endif
2018 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
2019
2020 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2021 #define EXCEPTION_NONCONTINUABLE 0x01
2022 #define EXCEPTION_UNWINDING 0x02
2023 #define EXCEPTION_EXIT_UNWIND 0x04
2024 #define EXCEPTION_STACK_INVALID 0x08
2025 #define EXCEPTION_NESTED_CALL 0x10
2026 #define EXCEPTION_TARGET_UNWIND 0x20
2027 #define EXCEPTION_COLLIDED_UNWIND 0x40
2028 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \
2029 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND)
2030
2031 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0)
2032 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0)
2033 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND)
2034
2035 typedef struct _EXCEPTION_RECORD {
2036 DWORD ExceptionCode;
2037 DWORD ExceptionFlags;
2038 struct _EXCEPTION_RECORD *ExceptionRecord;
2039 PVOID ExceptionAddress;
2040 DWORD NumberParameters;
2041 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2042 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2043
2044 typedef struct _EXCEPTION_RECORD32 {
2045 DWORD ExceptionCode;
2046 DWORD ExceptionFlags;
2047 DWORD ExceptionRecord;
2048 DWORD ExceptionAddress;
2049 DWORD NumberParameters;
2050 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2051 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32;
2052
2053 typedef struct _EXCEPTION_RECORD64 {
2054 DWORD ExceptionCode;
2055 DWORD ExceptionFlags;
2056 DWORD64 ExceptionRecord;
2057 DWORD64 ExceptionAddress;
2058 DWORD NumberParameters;
2059 DWORD __unusedAlignment;
2060 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2061 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64;
2062
2063 typedef struct _EXCEPTION_POINTERS {
2064 PEXCEPTION_RECORD ExceptionRecord;
2065 PCONTEXT ContextRecord;
2066 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
2067
2068 typedef struct _SECURITY_ATTRIBUTES {
2069 DWORD nLength;
2070 LPVOID lpSecurityDescriptor;
2071 BOOL bInheritHandle;
2072 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
2073
2074 #define SECURITY_MIN_SID_SIZE (sizeof(SID))
2075
2076 $include(setypes.h)
2077
2078 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
2079 ACE_HEADER Header;
2080 ACCESS_MASK Mask;
2081 DWORD Flags;
2082 GUID ObjectType;
2083 GUID InheritedObjectType;
2084 DWORD SidStart;
2085 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
2086
2087 typedef struct _ACCESS_DENIED_OBJECT_ACE {
2088 ACE_HEADER Header;
2089 ACCESS_MASK Mask;
2090 DWORD Flags;
2091 GUID ObjectType;
2092 GUID InheritedObjectType;
2093 DWORD SidStart;
2094 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
2095
2096 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
2097 ACE_HEADER Header;
2098 ACCESS_MASK Mask;
2099 DWORD Flags;
2100 GUID ObjectType;
2101 GUID InheritedObjectType;
2102 DWORD SidStart;
2103 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
2104
2105 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
2106 ACE_HEADER Header;
2107 ACCESS_MASK Mask;
2108 DWORD Flags;
2109 GUID ObjectType;
2110 GUID InheritedObjectType;
2111 DWORD SidStart;
2112 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
2113
2114 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE {
2115 ACE_HEADER Header;
2116 ACCESS_MASK Mask;
2117 DWORD SidStart;
2118 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE;
2119
2120 typedef struct _ACCESS_DENIED_CALLBACK_ACE {
2121 ACE_HEADER Header;
2122 ACCESS_MASK Mask;
2123 DWORD SidStart;
2124 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE;
2125
2126 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE {
2127 ACE_HEADER Header;
2128 ACCESS_MASK Mask;
2129 DWORD SidStart;
2130 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE;
2131
2132 typedef struct _SYSTEM_ALARM_CALLBACK_ACE {
2133 ACE_HEADER Header;
2134 ACCESS_MASK Mask;
2135 DWORD SidStart;
2136 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE;
2137
2138 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE {
2139 ACE_HEADER Header;
2140 ACCESS_MASK Mask;
2141 DWORD Flags;
2142 GUID ObjectType;
2143 GUID InheritedObjectType;
2144 DWORD SidStart;
2145 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE;
2146
2147 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE {
2148 ACE_HEADER Header;
2149 ACCESS_MASK Mask;
2150 DWORD Flags;
2151 GUID ObjectType;
2152 GUID InheritedObjectType;
2153 DWORD SidStart;
2154 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE;
2155
2156 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE {
2157 ACE_HEADER Header;
2158 ACCESS_MASK Mask;
2159 DWORD Flags;
2160 GUID ObjectType;
2161 GUID InheritedObjectType;
2162 DWORD SidStart;
2163 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE;
2164
2165 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE {
2166 ACE_HEADER Header;
2167 ACCESS_MASK Mask;
2168 DWORD Flags;
2169 GUID ObjectType;
2170 GUID InheritedObjectType;
2171 DWORD SidStart;
2172 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE;
2173
2174 typedef enum _TOKEN_ELEVATION_TYPE {
2175 TokenElevationTypeDefault = 1,
2176 TokenElevationTypeFull,
2177 TokenElevationTypeLimited,
2178 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
2179
2180 typedef struct _QUOTA_LIMITS {
2181 SIZE_T PagedPoolLimit;
2182 SIZE_T NonPagedPoolLimit;
2183 SIZE_T MinimumWorkingSetSize;
2184 SIZE_T MaximumWorkingSetSize;
2185 SIZE_T PagefileLimit;
2186 LARGE_INTEGER TimeLimit;
2187 } QUOTA_LIMITS,*PQUOTA_LIMITS;
2188
2189 typedef union _RATE_QUOTA_LIMIT {
2190 DWORD RateData;
2191 struct {
2192 DWORD RatePercent : 7;
2193 DWORD Reserved0 : 25;
2194 } DUMMYSTRUCTNAME;
2195 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT;
2196
2197 typedef struct _QUOTA_LIMITS_EX {
2198 SIZE_T PagedPoolLimit;
2199 SIZE_T NonPagedPoolLimit;
2200 SIZE_T MinimumWorkingSetSize;
2201 SIZE_T MaximumWorkingSetSize;
2202 SIZE_T PagefileLimit;
2203 LARGE_INTEGER TimeLimit;
2204 SIZE_T Reserved1;
2205 SIZE_T Reserved2;
2206 SIZE_T Reserved3;
2207 SIZE_T Reserved4;
2208 DWORD Flags;
2209 RATE_QUOTA_LIMIT CpuRateLimit;
2210 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
2211
2212 typedef struct _IO_COUNTERS {
2213 ULONGLONG ReadOperationCount;
2214 ULONGLONG WriteOperationCount;
2215 ULONGLONG OtherOperationCount;
2216 ULONGLONG ReadTransferCount;
2217 ULONGLONG WriteTransferCount;
2218 ULONGLONG OtherTransferCount;
2219 } IO_COUNTERS, *PIO_COUNTERS;
2220
2221 typedef struct _FILE_NOTIFY_INFORMATION {
2222 DWORD NextEntryOffset;
2223 DWORD Action;
2224 DWORD FileNameLength;
2225 WCHAR FileName[1];
2226 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
2227
2228 typedef struct _TAPE_ERASE {
2229 DWORD Type;
2230 BOOLEAN Immediate;
2231 } TAPE_ERASE, *PTAPE_ERASE;
2232
2233 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
2234 BOOLEAN ECC;
2235 BOOLEAN Compression;
2236 BOOLEAN DataPadding;
2237 BOOLEAN ReportSetmarks;
2238 DWORD DefaultBlockSize;
2239 DWORD MaximumBlockSize;
2240 DWORD MinimumBlockSize;
2241 DWORD MaximumPartitionCount;
2242 DWORD FeaturesLow;
2243 DWORD FeaturesHigh;
2244 DWORD EOTWarningZoneSize;
2245 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
2246
2247 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
2248 LARGE_INTEGER Capacity;
2249 LARGE_INTEGER Remaining;
2250 DWORD BlockSize;
2251 DWORD PartitionCount;
2252 BOOLEAN WriteProtected;
2253 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
2254
2255 typedef struct _TAPE_GET_POSITION {
2256 DWORD Type;
2257 DWORD Partition;
2258 LARGE_INTEGER Offset;
2259 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
2260
2261 typedef struct _TAPE_PREPARE {
2262 DWORD Operation;
2263 BOOLEAN Immediate;
2264 } TAPE_PREPARE, *PTAPE_PREPARE;
2265
2266 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
2267 BOOLEAN ECC;
2268 BOOLEAN Compression;
2269 BOOLEAN DataPadding;
2270 BOOLEAN ReportSetmarks;
2271 DWORD EOTWarningZoneSize;
2272 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
2273
2274 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
2275 DWORD BlockSize;
2276 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
2277
2278 typedef struct _TAPE_SET_POSITION {
2279 DWORD Method;
2280 DWORD Partition;
2281 LARGE_INTEGER Offset;
2282 BOOLEAN Immediate;
2283 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
2284
2285 typedef struct _TAPE_WRITE_MARKS {
2286 DWORD Type;
2287 DWORD Count;
2288 BOOLEAN Immediate;
2289 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
2290
2291 typedef struct _TAPE_CREATE_PARTITION {
2292 DWORD Method;
2293 DWORD Count;
2294 DWORD Size;
2295 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
2296
2297 typedef struct _MEMORY_BASIC_INFORMATION {
2298 PVOID BaseAddress;
2299 PVOID AllocationBase;
2300 DWORD AllocationProtect;
2301 SIZE_T RegionSize;
2302 DWORD State;
2303 DWORD Protect;
2304 DWORD Type;
2305 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
2306
2307 typedef struct _MESSAGE_RESOURCE_ENTRY {
2308 WORD Length;
2309 WORD Flags;
2310 BYTE Text[1];
2311 } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY;
2312
2313 typedef struct _MESSAGE_RESOURCE_BLOCK {
2314 DWORD LowId;
2315 DWORD HighId;
2316 DWORD OffsetToEntries;
2317 } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK;
2318
2319 typedef struct _MESSAGE_RESOURCE_DATA {
2320 DWORD NumberOfBlocks;
2321 MESSAGE_RESOURCE_BLOCK Blocks[1];
2322 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2323
2324 //
2325 // Slist Header
2326 //
2327 #ifndef _SLIST_HEADER_
2328 #define _SLIST_HEADER_
2329
2330 #if defined(_WIN64)
2331
2332 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
2333 struct _SLIST_ENTRY *Next;
2334 } SLIST_ENTRY, *PSLIST_ENTRY;
2335
2336 typedef struct _SLIST_ENTRY32 {
2337 DWORD Next;
2338 } SLIST_ENTRY32, *PSLIST_ENTRY32;
2339
2340 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
2341 _ANONYMOUS_STRUCT struct {
2342 ULONGLONG Alignment;
2343 ULONGLONG Region;
2344 } DUMMYSTRUCTNAME;
2345 struct {
2346 ULONGLONG Depth:16;
2347 ULONGLONG Sequence:9;
2348 ULONGLONG NextEntry:39;
2349 ULONGLONG HeaderType:1;
2350 ULONGLONG Init:1;
2351 ULONGLONG Reserved:59;
2352 ULONGLONG Region:3;
2353 } Header8;
2354 struct {
2355 ULONGLONG Depth:16;
2356 ULONGLONG Sequence:48;
2357 ULONGLONG HeaderType:1;
2358 ULONGLONG Init:1;
2359 ULONGLONG Reserved:2;
2360 ULONGLONG NextEntry:60;
2361 } Header16;
2362 struct {
2363 ULONGLONG Depth:16;
2364 ULONGLONG Sequence:48;
2365 ULONGLONG HeaderType:1;
2366 ULONGLONG Reserved:3;
2367 ULONGLONG NextEntry:60;
2368 } HeaderX64;
2369 } SLIST_HEADER, *PSLIST_HEADER;
2370
2371 typedef union _SLIST_HEADER32{
2372 ULONGLONG Alignment;
2373 _ANONYMOUS_STRUCT struct {
2374 SLIST_ENTRY32 Next;
2375 WORD Depth;
2376 WORD Sequence;
2377 } DUMMYSTRUCTNAME;
2378 } SLIST_HEADER32, *PSLIST_HEADER32;
2379
2380 #else
2381
2382 #define SLIST_ENTRY SINGLE_LIST_ENTRY
2383 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2384 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2385
2386 typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32;
2387
2388 typedef union _SLIST_HEADER {
2389 ULONGLONG Alignment;
2390 _ANONYMOUS_STRUCT struct {
2391 SLIST_ENTRY Next;
2392 WORD Depth;
2393 WORD Sequence;
2394 } DUMMYSTRUCTNAME;
2395 } SLIST_HEADER, *PSLIST_HEADER;
2396
2397 typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32;
2398
2399 #endif /* defined(_WIN64) */
2400
2401 #endif /* _SLIST_HEADER_ */
2402
2403 NTSYSAPI
2404 VOID
2405 NTAPI
2406 RtlInitializeSListHead(
2407 _Out_ PSLIST_HEADER ListHead);
2408
2409 _Must_inspect_result_
2410 NTSYSAPI
2411 PSLIST_ENTRY
2412 NTAPI
2413 RtlFirstEntrySList(
2414 _In_ const SLIST_HEADER *ListHead);
2415
2416 NTSYSAPI
2417 PSLIST_ENTRY
2418 NTAPI
2419 RtlInterlockedPopEntrySList(
2420 _Inout_ PSLIST_HEADER ListHead);
2421
2422 NTSYSAPI
2423 PSLIST_ENTRY
2424 NTAPI
2425 RtlInterlockedPushEntrySList(
2426 _Inout_ PSLIST_HEADER ListHead,
2427 _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry);
2428
2429 NTSYSAPI
2430 PSLIST_ENTRY
2431 NTAPI
2432 RtlInterlockedFlushSList(
2433 _Inout_ PSLIST_HEADER ListHead);
2434
2435 NTSYSAPI
2436 WORD
2437 NTAPI
2438 RtlQueryDepthSList(
2439 _In_ PSLIST_HEADER ListHead);
2440
2441 #ifndef _RTL_RUN_ONCE_DEF
2442 #define _RTL_RUN_ONCE_DEF
2443
2444 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL
2445 #define RTL_RUN_ONCE_ASYNC 0x00000002UL
2446 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL
2447
2448 #define RTL_RUN_ONCE_INIT {0}
2449
2450 typedef union _RTL_RUN_ONCE {
2451 PVOID Ptr;
2452 } RTL_RUN_ONCE, *PRTL_RUN_ONCE;
2453
2454 typedef DWORD WINAPI RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE, PVOID, PVOID*);
2455 typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN;
2456
2457 NTSYSAPI
2458 DWORD
2459 WINAPI
2460 RtlRunOnceComplete(
2461 PRTL_RUN_ONCE,
2462 DWORD,
2463 PVOID);
2464
2465 #endif
2466
2467 #define RTL_CONDITION_VARIABLE_INIT {0}
2468 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1
2469
2470 typedef struct _RTL_CONDITION_VARIABLE {
2471 PVOID Ptr;
2472 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE;
2473
2474 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
2475 WORD Type;
2476 WORD CreatorBackTraceIndex;
2477 struct _RTL_CRITICAL_SECTION *CriticalSection;
2478 LIST_ENTRY ProcessLocksList;
2479 DWORD EntryCount;
2480 DWORD ContentionCount;
2481 DWORD Flags;
2482 WORD CreatorBackTraceIndexHigh;
2483 WORD SpareWORD;
2484 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
2485
2486 #include "pshpack8.h"
2487 typedef struct _RTL_CRITICAL_SECTION {
2488 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
2489 LONG LockCount;
2490 LONG RecursionCount;
2491 HANDLE OwningThread;
2492 HANDLE LockSemaphore;
2493 ULONG_PTR SpinCount;
2494 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
2495 #include "poppack.h"
2496
2497 NTSYSAPI
2498 WORD
2499 NTAPI
2500 RtlCaptureStackBackTrace(
2501 IN DWORD FramesToSkip,
2502 IN DWORD FramesToCapture,
2503 OUT PVOID *BackTrace,
2504 OUT PDWORD BackTraceHash OPTIONAL
2505 );
2506
2507 NTSYSAPI
2508 VOID
2509 NTAPI
2510 RtlCaptureContext(
2511 _Out_ PCONTEXT ContextRecord
2512 );
2513
2514 NTSYSAPI
2515 PVOID
2516 NTAPI
2517 RtlPcToFileHeader(
2518 _In_ PVOID PcValue,
2519 _Out_ PVOID* BaseOfImage);
2520
2521 NTSYSAPI
2522 VOID
2523 NTAPI
2524 RtlUnwind(
2525 _In_opt_ PVOID TargetFrame,
2526 _In_opt_ PVOID TargetIp,
2527 _In_opt_ PEXCEPTION_RECORD ExceptionRecord,
2528 _In_ PVOID ReturnValue);
2529
2530 #define RTL_SRWLOCK_INIT {0}
2531
2532 typedef struct _RTL_SRWLOCK {
2533 PVOID Ptr;
2534 } RTL_SRWLOCK, *PRTL_SRWLOCK;
2535
2536 typedef LONG
2537 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
2538 struct _EXCEPTION_POINTERS *ExceptionInfo
2539 );
2540
2541 typedef struct _EVENTLOGRECORD {
2542 DWORD Length;
2543 DWORD Reserved;
2544 DWORD RecordNumber;
2545 DWORD TimeGenerated;
2546 DWORD TimeWritten;
2547 DWORD EventID;
2548 WORD EventType;
2549 WORD NumStrings;
2550 WORD EventCategory;
2551 WORD ReservedFlags;
2552 DWORD ClosingRecordNumber;
2553 DWORD StringOffset;
2554 DWORD UserSidLength;
2555 DWORD UserSidOffset;
2556 DWORD DataLength;
2557 DWORD DataOffset;
2558 } EVENTLOGRECORD, *PEVENTLOGRECORD;
2559
2560 typedef struct _OSVERSIONINFOA {
2561 DWORD dwOSVersionInfoSize;
2562 DWORD dwMajorVersion;
2563 DWORD dwMinorVersion;
2564 DWORD dwBuildNumber;
2565 DWORD dwPlatformId;
2566 CHAR szCSDVersion[128];
2567 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
2568
2569 typedef struct _OSVERSIONINFOW {
2570 DWORD dwOSVersionInfoSize;
2571 DWORD dwMajorVersion;
2572 DWORD dwMinorVersion;
2573 DWORD dwBuildNumber;
2574 DWORD dwPlatformId;
2575 WCHAR szCSDVersion[128];
2576 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
2577
2578 typedef struct _OSVERSIONINFOEXA {
2579 DWORD dwOSVersionInfoSize;
2580 DWORD dwMajorVersion;
2581 DWORD dwMinorVersion;
2582 DWORD dwBuildNumber;
2583 DWORD dwPlatformId;
2584 CHAR szCSDVersion[128];
2585 WORD wServicePackMajor;
2586 WORD wServicePackMinor;
2587 WORD wSuiteMask;
2588 BYTE wProductType;
2589 BYTE wReserved;
2590 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2591
2592 typedef struct _OSVERSIONINFOEXW {
2593 DWORD dwOSVersionInfoSize;
2594 DWORD dwMajorVersion;
2595 DWORD dwMinorVersion;
2596 DWORD dwBuildNumber;
2597 DWORD dwPlatformId;
2598 WCHAR szCSDVersion[128];
2599 WORD wServicePackMajor;
2600 WORD wServicePackMinor;
2601 WORD wSuiteMask;
2602 BYTE wProductType;
2603 BYTE wReserved;
2604 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
2605
2606 #include <pshpack2.h>
2607
2608 typedef struct _IMAGE_VXD_HEADER {
2609 WORD e32_magic;
2610 BYTE e32_border;
2611 BYTE e32_worder;
2612 DWORD e32_level;
2613 WORD e32_cpu;
2614 WORD e32_os;
2615 DWORD e32_ver;
2616 DWORD e32_mflags;
2617 DWORD e32_mpages;
2618 DWORD e32_startobj;
2619 DWORD e32_eip;
2620 DWORD e32_stackobj;
2621 DWORD e32_esp;
2622 DWORD e32_pagesize;
2623 DWORD e32_lastpagesize;
2624 DWORD e32_fixupsize;
2625 DWORD e32_fixupsum;
2626 DWORD e32_ldrsize;
2627 DWORD e32_ldrsum;
2628 DWORD e32_objtab;
2629 DWORD e32_objcnt;
2630 DWORD e32_objmap;
2631 DWORD e32_itermap;
2632 DWORD e32_rsrctab;
2633 DWORD e32_rsrccnt;
2634 DWORD e32_restab;
2635 DWORD e32_enttab;
2636 DWORD e32_dirtab;
2637 DWORD e32_dircnt;
2638 DWORD e32_fpagetab;
2639 DWORD e32_frectab;
2640 DWORD e32_impmod;
2641 DWORD e32_impmodcnt;
2642 DWORD e32_impproc;
2643 DWORD e32_pagesum;
2644 DWORD e32_datapage;
2645 DWORD e32_preload;
2646 DWORD e32_nrestab;
2647 DWORD e32_cbnrestab;
2648 DWORD e32_nressum;
2649 DWORD e32_autodata;
2650 DWORD e32_debuginfo;
2651 DWORD e32_debuglen;
2652 DWORD e32_instpreload;
2653 DWORD e32_instdemand;
2654 DWORD e32_heapsize;
2655 BYTE e32_res3[12];
2656 DWORD e32_winresoff;
2657 DWORD e32_winreslen;
2658 WORD e32_devid;
2659 WORD e32_ddkver;
2660 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2661
2662 typedef struct _IMAGE_DOS_HEADER {
2663 WORD e_magic;
2664 WORD e_cblp;
2665 WORD e_cp;
2666 WORD e_crlc;
2667 WORD e_cparhdr;
2668 WORD e_minalloc;
2669 WORD e_maxalloc;
2670 WORD e_ss;
2671 WORD e_sp;
2672 WORD e_csum;
2673 WORD e_ip;
2674 WORD e_cs;
2675 WORD e_lfarlc;
2676 WORD e_ovno;
2677 WORD e_res[4];
2678 WORD e_oemid;
2679 WORD e_oeminfo;
2680 WORD e_res2[10];
2681 LONG e_lfanew;
2682 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2683
2684 typedef struct _IMAGE_OS2_HEADER {
2685 WORD ne_magic;
2686 CHAR ne_ver;
2687 CHAR ne_rev;
2688 WORD ne_enttab;
2689 WORD ne_cbenttab;
2690 LONG ne_crc;
2691 WORD ne_flags;
2692 WORD ne_autodata;
2693 WORD ne_heap;
2694 WORD ne_stack;
2695 LONG ne_csip;
2696 LONG ne_sssp;
2697 WORD ne_cseg;
2698 WORD ne_cmod;
2699 WORD ne_cbnrestab;
2700 WORD ne_segtab;
2701 WORD ne_rsrctab;
2702 WORD ne_restab;
2703 WORD ne_modtab;
2704 WORD ne_imptab;
2705 LONG ne_nrestab;
2706 WORD ne_cmovent;
2707 WORD ne_align;
2708 WORD ne_cres;
2709 BYTE ne_exetyp;
2710 BYTE ne_flagsothers;
2711 WORD ne_pretthunks;
2712 WORD ne_psegrefbytes;
2713 WORD ne_swaparea;
2714 WORD ne_expver;
2715 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2716
2717 #include <poppack.h>
2718
2719 typedef struct _IMAGE_FILE_HEADER {
2720 WORD Machine;
2721 WORD NumberOfSections;
2722 DWORD TimeDateStamp;
2723 DWORD PointerToSymbolTable;
2724 DWORD NumberOfSymbols;
2725 WORD SizeOfOptionalHeader;
2726 WORD Characteristics;
2727 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2728
2729 typedef struct _IMAGE_DATA_DIRECTORY {
2730 DWORD VirtualAddress;
2731 DWORD Size;
2732 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2733
2734 typedef struct _IMAGE_OPTIONAL_HEADER32 {
2735 WORD Magic;
2736 BYTE MajorLinkerVersion;
2737 BYTE MinorLinkerVersion;
2738 DWORD SizeOfCode;
2739 DWORD SizeOfInitializedData;
2740 DWORD SizeOfUninitializedData;
2741 DWORD AddressOfEntryPoint;
2742 DWORD BaseOfCode;
2743 DWORD BaseOfData;
2744 DWORD ImageBase;
2745 DWORD SectionAlignment;
2746 DWORD FileAlignment;
2747 WORD MajorOperatingSystemVersion;
2748 WORD MinorOperatingSystemVersion;
2749 WORD MajorImageVersion;
2750 WORD MinorImageVersion;
2751 WORD MajorSubsystemVersion;
2752 WORD MinorSubsystemVersion;
2753 DWORD Win32VersionValue;
2754 DWORD SizeOfImage;
2755 DWORD SizeOfHeaders;
2756 DWORD CheckSum;
2757 WORD Subsystem;
2758 WORD DllCharacteristics;
2759 DWORD SizeOfStackReserve;
2760 DWORD SizeOfStackCommit;
2761 DWORD SizeOfHeapReserve;
2762 DWORD SizeOfHeapCommit;
2763 DWORD LoaderFlags;
2764 DWORD NumberOfRvaAndSizes;
2765 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2766 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2767
2768 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2769 WORD Magic;
2770 BYTE MajorLinkerVersion;
2771 BYTE MinorLinkerVersion;
2772 DWORD SizeOfCode;
2773 DWORD SizeOfInitializedData;
2774 DWORD SizeOfUninitializedData;
2775 DWORD AddressOfEntryPoint;
2776 DWORD BaseOfCode;
2777 ULONGLONG ImageBase;
2778 DWORD SectionAlignment;
2779 DWORD FileAlignment;
2780 WORD MajorOperatingSystemVersion;
2781 WORD MinorOperatingSystemVersion;
2782 WORD MajorImageVersion;
2783 WORD MinorImageVersion;
2784 WORD MajorSubsystemVersion;
2785 WORD MinorSubsystemVersion;
2786 DWORD Win32VersionValue;
2787 DWORD SizeOfImage;
2788 DWORD SizeOfHeaders;
2789 DWORD CheckSum;
2790 WORD Subsystem;
2791 WORD DllCharacteristics;
2792 ULONGLONG SizeOfStackReserve;
2793 ULONGLONG SizeOfStackCommit;
2794 ULONGLONG SizeOfHeapReserve;
2795 ULONGLONG SizeOfHeapCommit;
2796 DWORD LoaderFlags;
2797 DWORD NumberOfRvaAndSizes;
2798 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2799 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2800
2801 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
2802 WORD Magic;
2803 BYTE MajorLinkerVersion;
2804 BYTE MinorLinkerVersion;
2805 DWORD SizeOfCode;
2806 DWORD SizeOfInitializedData;
2807 DWORD SizeOfUninitializedData;
2808 DWORD AddressOfEntryPoint;
2809 DWORD BaseOfCode;
2810 DWORD BaseOfData;
2811 DWORD BaseOfBss;
2812 DWORD GprMask;
2813 DWORD CprMask[4];
2814 DWORD GpValue;
2815 } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER;
2816
2817 typedef struct _IMAGE_NT_HEADERS32 {
2818 DWORD Signature;
2819 IMAGE_FILE_HEADER FileHeader;
2820 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
2821 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2822
2823 typedef struct _IMAGE_NT_HEADERS64 {
2824 DWORD Signature;
2825 IMAGE_FILE_HEADER FileHeader;
2826 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2827 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2828
2829 #ifdef _WIN64
2830 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2831 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2832 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2833 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2834 #else
2835 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2836 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2837 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2838 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2839 #endif
2840
2841 typedef struct _IMAGE_ROM_HEADERS {
2842 IMAGE_FILE_HEADER FileHeader;
2843 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
2844 } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS;
2845
2846 typedef struct _IMAGE_SECTION_HEADER {
2847 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2848 union {
2849 DWORD PhysicalAddress;
2850 DWORD VirtualSize;
2851 } Misc;
2852 DWORD VirtualAddress;
2853 DWORD SizeOfRawData;
2854 DWORD PointerToRawData;
2855 DWORD PointerToRelocations;
2856 DWORD PointerToLinenumbers;
2857 WORD NumberOfRelocations;
2858 WORD NumberOfLinenumbers;
2859 DWORD Characteristics;
2860 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2861
2862 #include <pshpack2.h>
2863
2864 typedef struct _IMAGE_SYMBOL {
2865 union {
2866 BYTE ShortName[8];
2867 struct {
2868 DWORD Short;
2869 DWORD Long;
2870 } Name;
2871 PBYTE LongName[2];
2872 } N;
2873 DWORD Value;
2874 SHORT SectionNumber;
2875 WORD Type;
2876 BYTE StorageClass;
2877 BYTE NumberOfAuxSymbols;
2878 } IMAGE_SYMBOL, *PIMAGE_SYMBOL;
2879
2880 typedef struct _IMAGE_LINENUMBER {
2881 union {
2882 DWORD SymbolTableIndex;
2883 DWORD VirtualAddress;
2884 } Type;
2885 WORD Linenumber;
2886 } IMAGE_LINENUMBER, UNALIGNED *PIMAGE_LINENUMBER;
2887
2888 typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF {
2889 BYTE bAuxType;
2890 BYTE bReserved;
2891 DWORD SymbolTableIndex;
2892 BYTE rgbReserved[12];
2893 } IMAGE_AUX_SYMBOL_TOKEN_DEF, UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF;
2894
2895 typedef union _IMAGE_AUX_SYMBOL {
2896 struct {
2897 DWORD TagIndex;
2898 union {
2899 struct {
2900 WORD Linenumber;
2901 WORD Size;
2902 } LnSz;
2903 DWORD TotalSize;
2904 } Misc;
2905 union {
2906 struct {
2907 DWORD PointerToLinenumber;
2908 DWORD PointerToNextFunction;
2909 } Function;
2910 struct {
2911 WORD Dimension[4];
2912 } Array;
2913 } FcnAry;
2914 WORD TvIndex;
2915 } Sym;
2916 struct {
2917 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2918 } File;
2919 struct {
2920 DWORD Length;
2921 WORD NumberOfRelocations;
2922 WORD NumberOfLinenumbers;
2923 DWORD CheckSum;
2924 SHORT Number;
2925 BYTE Selection;
2926 BYTE bReserved;
2927 SHORT HighNumber;
2928 } Section;
2929 IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef;
2930 struct {
2931 DWORD crc;
2932 BYTE rgbReserved[14];
2933 } CRC;
2934 } IMAGE_AUX_SYMBOL, *PIMAGE_AUX_SYMBOL;
2935
2936 typedef struct _IMAGE_RELOCATION {
2937 _ANONYMOUS_UNION union {
2938 DWORD VirtualAddress;
2939 DWORD RelocCount;
2940 } DUMMYUNIONNAME;
2941 DWORD SymbolTableIndex;
2942 WORD Type;
2943 } IMAGE_RELOCATION, UNALIGNED *PIMAGE_RELOCATION;
2944
2945 #include <poppack.h>
2946
2947 #ifndef __IMAGE_COR20_HEADER_DEFINED__
2948 #define __IMAGE_COR20_HEADER_DEFINED__
2949
2950 typedef enum ReplacesCorHdrNumericDefines {
2951 COMIMAGE_FLAGS_ILONLY = 0x00000001,
2952 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
2953 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
2954 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
2955 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010,
2956 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
2957 COR_VERSION_MAJOR_V2 = 2,
2958 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
2959 COR_VERSION_MINOR = 0,
2960 COR_DELETED_NAME_LENGTH = 8,
2961 COR_VTABLEGAP_NAME_LENGTH = 8,
2962 NATIVE_TYPE_MAX_CB = 1,
2963 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xFF,
2964 IMAGE_COR_MIH_METHODRVA = 0x01,
2965 IMAGE_COR_MIH_EHRVA = 0x02,
2966 IMAGE_COR_MIH_BASICBLOCK = 0x08,
2967 COR_VTABLE_32BIT = 0x01,
2968 COR_VTABLE_64BIT = 0x02,
2969 COR_VTABLE_FROM_UNMANAGED = 0x04,
2970 COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = 0x08,
2971 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
2972 IMAGE_COR_EATJ_THUNK_SIZE = 32,
2973 MAX_CLASS_NAME = 1024,
2974 MAX_PACKAGE_NAME = 1024
2975 } ReplacesCorHdrNumericDefines;
2976
2977 typedef struct IMAGE_COR20_HEADER {
2978 DWORD cb;
2979 WORD MajorRuntimeVersion;
2980 WORD MinorRuntimeVersion;
2981 IMAGE_DATA_DIRECTORY MetaData;
2982 DWORD Flags;
2983 _ANONYMOUS_UNION union {
2984 DWORD EntryPointToken;
2985 DWORD EntryPointRVA;
2986 } DUMMYUNIONNAME;
2987 IMAGE_DATA_DIRECTORY Resources;
2988 IMAGE_DATA_DIRECTORY StrongNameSignature;
2989 IMAGE_DATA_DIRECTORY CodeManagerTable;
2990 IMAGE_DATA_DIRECTORY VTableFixups;
2991 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
2992 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
2993 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
2994
2995 #endif /* __IMAGE_COR20_HEADER_DEFINED__ */
2996
2997 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2998 DWORD NumberOfSymbols;
2999 DWORD LvaToFirstSymbol;
3000 DWORD NumberOfLinenumbers;
3001 DWORD LvaToFirstLinenumber;
3002 DWORD RvaToFirstByteOfCode;
3003 DWORD RvaToLastByteOfCode;
3004 DWORD RvaToFirstByteOfData;
3005 DWORD RvaToLastByteOfData;
3006 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3007
3008 typedef struct _IMAGE_BASE_RELOCATION {
3009 DWORD VirtualAddress;
3010 DWORD SizeOfBlock;
3011 } IMAGE_BASE_RELOCATION, UNALIGNED *PIMAGE_BASE_RELOCATION;
3012
3013 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
3014 BYTE Name[16];
3015 BYTE Date[12];
3016 BYTE UserID[6];
3017 BYTE GroupID[6];
3018 BYTE Mode[8];
3019 BYTE Size[10];
3020 BYTE EndHeader[2];
3021 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3022
3023 typedef struct _IMAGE_EXPORT_DIRECTORY {
3024 DWORD Characteristics;
3025 DWORD TimeDateStamp;
3026 WORD MajorVersion;
3027 WORD MinorVersion;
3028 DWORD Name;
3029 DWORD Base;
3030 DWORD NumberOfFunctions;
3031 DWORD NumberOfNames;
3032 DWORD AddressOfFunctions;
3033 DWORD AddressOfNames;
3034 DWORD AddressOfNameOrdinals;
3035 } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY;
3036
3037 typedef struct _IMAGE_IMPORT_BY_NAME {
3038 WORD Hint;
3039 BYTE Name[1];
3040 } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME;
3041
3042 #include <pshpack8.h>
3043 typedef struct _IMAGE_THUNK_DATA64 {
3044 union {
3045 ULONGLONG ForwarderString;
3046 ULONGLONG Function;
3047 ULONGLONG Ordinal;
3048 ULONGLONG AddressOfData;
3049 } u1;
3050 } IMAGE_THUNK_DATA64, *PIMAGE_THUNK_DATA64;
3051 #include <poppack.h>
3052
3053 typedef struct _IMAGE_THUNK_DATA32 {
3054 union {
3055 DWORD ForwarderString;
3056 DWORD Function;
3057 DWORD Ordinal;
3058 DWORD AddressOfData;
3059 } u1;
3060 } IMAGE_THUNK_DATA32, *PIMAGE_THUNK_DATA32;
3061
3062 #define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL
3063 #define IMAGE_ORDINAL_FLAG32 0x80000000
3064 #define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffff)
3065 #define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff)
3066 #define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0)
3067 #define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0)
3068
3069 typedef VOID
3070 (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved);
3071
3072 typedef struct _IMAGE_TLS_DIRECTORY64 {
3073 ULONGLONG StartAddressOfRawData;
3074 ULONGLONG EndAddressOfRawData;
3075 ULONGLONG AddressOfIndex;
3076 ULONGLONG AddressOfCallBacks;
3077 DWORD SizeOfZeroFill;
3078 DWORD Characteristics;
3079 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3080
3081 typedef struct _IMAGE_TLS_DIRECTORY32 {
3082 DWORD StartAddressOfRawData;
3083 DWORD EndAddressOfRawData;
3084 DWORD AddressOfIndex;
3085 DWORD AddressOfCallBacks;
3086 DWORD SizeOfZeroFill;
3087 DWORD Characteristics;
3088 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3089
3090 #ifdef _WIN64
3091 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3092 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3093 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3094 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3095 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3096 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3097 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3098 #else
3099 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3100 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3101 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3102 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3103 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3104 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3105 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3106 #endif
3107
3108 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3109 _ANONYMOUS_UNION union {
3110 DWORD Characteristics;
3111 DWORD OriginalFirstThunk;
3112 } DUMMYUNIONNAME;
3113 DWORD TimeDateStamp;
3114 DWORD ForwarderChain;
3115 DWORD Name;
3116 DWORD FirstThunk;
3117 } IMAGE_IMPORT_DESCRIPTOR, UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR;
3118
3119 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR {
3120 DWORD TimeDateStamp;
3121 WORD OffsetModuleName;
3122 WORD NumberOfModuleForwarderRefs;
3123 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3124
3125 typedef struct _IMAGE_BOUND_FORWARDER_REF {
3126 DWORD TimeDateStamp;
3127 WORD OffsetModuleName;
3128 WORD Reserved;
3129 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3130
3131 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR {
3132 union {
3133 DWORD AllAttributes;
3134 struct {
3135 DWORD RvaBased:1;
3136 DWORD ReservedAttributes:31;
3137 };
3138 } Attributes;
3139 DWORD DllNameRVA;
3140 DWORD ModuleHandleRVA;
3141 DWORD ImportAddressTableRVA;
3142 DWORD ImportNameTableRVA;
3143 DWORD BoundImportAddressTableRVA;
3144 DWORD UnloadInformationTableRVA;
3145 DWORD TimeDateStamp;
3146 } IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR;
3147
3148 typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR;
3149
3150 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3151 DWORD Characteristics;
3152 DWORD TimeDateStamp;
3153 WORD MajorVersion;
3154 WORD MinorVersion;
3155 WORD NumberOfNamedEntries;
3156 WORD NumberOfIdEntries;
3157 } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY;
3158
3159 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3160 _ANONYMOUS_UNION union {
3161 _ANONYMOUS_STRUCT struct {
3162 DWORD NameOffset:31;
3163 DWORD NameIsString:1;
3164 } DUMMYSTRUCTNAME;
3165 DWORD Name;
3166 WORD Id;
3167 } DUMMYUNIONNAME;
3168 _ANONYMOUS_UNION union {
3169 DWORD OffsetToData;
3170 _ANONYMOUS_STRUCT struct {
3171 DWORD OffsetToDirectory:31;
3172 DWORD DataIsDirectory:1;
3173 } DUMMYSTRUCTNAME2;
3174 } DUMMYUNIONNAME2;
3175 } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3176
3177 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3178 WORD Length;
3179 CHAR NameString[1];
3180 } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING;
3181
3182 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3183 WORD Length;
3184 WCHAR NameString[1];
3185 } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U;
3186
3187 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3188 DWORD OffsetToData;
3189 DWORD Size;
3190 DWORD CodePage;
3191 DWORD Reserved;
3192 } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY;
3193
3194 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 {
3195 DWORD Size;
3196 DWORD TimeDateStamp;
3197 WORD MajorVersion;
3198 WORD MinorVersion;
3199 DWORD GlobalFlagsClear;
3200 DWORD GlobalFlagsSet;
3201 DWORD CriticalSectionDefaultTimeout;
3202 DWORD DeCommitFreeBlockThreshold;
3203 DWORD DeCommitTotalFreeThreshold;
3204 DWORD LockPrefixTable;
3205 DWORD MaximumAllocationSize;
3206 DWORD VirtualMemoryThreshold;
3207 DWORD ProcessHeapFlags;
3208 DWORD ProcessAffinityMask;
3209 WORD CSDVersion;
3210 WORD Reserved1;
3211 DWORD EditList;
3212 DWORD SecurityCookie;
3213 DWORD SEHandlerTable;
3214 DWORD SEHandlerCount;
3215 } IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32;
3216
3217 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 {
3218 DWORD Size;
3219 DWORD TimeDateStamp;
3220 WORD MajorVersion;
3221 WORD MinorVersion;
3222 DWORD GlobalFlagsClear;
3223 DWORD GlobalFlagsSet;
3224 DWORD CriticalSectionDefaultTimeout;
3225 ULONGLONG DeCommitFreeBlockThreshold;
3226 ULONGLONG DeCommitTotalFreeThreshold;
3227 ULONGLONG LockPrefixTable;
3228 ULONGLONG MaximumAllocationSize;
3229 ULONGLONG VirtualMemoryThreshold;
3230 ULONGLONG ProcessAffinityMask;
3231 DWORD ProcessHeapFlags;
3232 WORD CSDVersion;
3233 WORD Reserved1;
3234 ULONGLONG EditList;
3235 ULONGLONG SecurityCookie;
3236 ULONGLONG SEHandlerTable;
3237 ULONGLONG SEHandlerCount;
3238 } IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64;
3239
3240 #ifdef _WIN64
3241 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY;
3242 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY;
3243 #else
3244 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY;
3245 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY;
3246 #endif
3247
3248 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
3249 DWORD BeginAddress;
3250 DWORD EndAddress;
3251 DWORD UnwindInfoAddress;
3252 } IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY;
3253
3254 typedef struct _IMAGE_DEBUG_DIRECTORY {
3255 DWORD Characteristics;
3256 DWORD TimeDateStamp;
3257 WORD MajorVersion;
3258 WORD MinorVersion;
3259 DWORD Type;
3260 DWORD SizeOfData;
3261 DWORD AddressOfRawData;
3262 DWORD PointerToRawData;
3263 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3264
3265 typedef struct _FPO_DATA {
3266 DWORD ulOffStart;
3267 DWORD cbProcSize;
3268 DWORD cdwLocals;
3269 WORD cdwParams;
3270 WORD cbProlog:8;
3271 WORD cbRegs:3;
3272 WORD fHasSEH:1;
3273 WORD fUseBP:1;
3274 WORD reserved:1;
3275 WORD cbFrame:2;
3276 } FPO_DATA, *PFPO_DATA;
3277
3278 typedef struct _IMAGE_DEBUG_MISC {
3279 DWORD DataType;
3280 DWORD Length;
3281 BOOLEAN Unicode;
3282 BYTE Reserved[3];
3283 BYTE Data[1];
3284 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3285
3286 typedef struct _IMAGE_FUNCTION_ENTRY {
3287 DWORD StartingAddress;
3288 DWORD EndingAddress;
3289 DWORD EndOfPrologue;
3290 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3291
3292 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3293 WORD Signature;
3294 WORD Flags;
3295 WORD Machine;
3296 WORD Characteristics;
3297 DWORD TimeDateStamp;
3298 DWORD CheckSum;
3299 DWORD ImageBase;
3300 DWORD SizeOfImage;
3301 DWORD NumberOfSections;
3302 DWORD ExportedNamesSize;
3303 DWORD DebugDirectorySize;
3304 DWORD SectionAlignment;
3305 DWORD Reserved[2];
3306 } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER;
3307
3308 typedef enum _CM_SERVICE_NODE_TYPE {
3309 DriverType = SERVICE_KERNEL_DRIVER,
3310 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3311 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3312 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3313 AdapterType = SERVICE_ADAPTER,
3314 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3315 } SERVICE_NODE_TYPE;
3316
3317 typedef enum _CM_SERVICE_LOAD_TYPE {
3318 BootLoad = SERVICE_BOOT_START,
3319 SystemLoad = SERVICE_SYSTEM_START,
3320 AutoLoad = SERVICE_AUTO_START,
3321 DemandLoad = SERVICE_DEMAND_START,
3322 DisableLoad = SERVICE_DISABLED
3323 } SERVICE_LOAD_TYPE;
3324
3325 typedef enum _CM_ERROR_CONTROL_TYPE {
3326 IgnoreError = SERVICE_ERROR_IGNORE,
3327 NormalError = SERVICE_ERROR_NORMAL,
3328 SevereError = SERVICE_ERROR_SEVERE,
3329 CriticalError = SERVICE_ERROR_CRITICAL
3330 } SERVICE_ERROR_TYPE;
3331
3332 typedef struct _NT_TIB {
3333 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
3334 PVOID StackBase;
3335 PVOID StackLimit;
3336 PVOID SubSystemTib;
3337 _ANONYMOUS_UNION union {
3338 PVOID FiberData;
3339 DWORD Version;
3340 } DUMMYUNIONNAME;
3341 PVOID ArbitraryUserPointer;
3342 struct _NT_TIB *Self;
3343 } NT_TIB,*PNT_TIB;
3344
3345 typedef struct _NT_TIB32 {
3346 DWORD ExceptionList;
3347 DWORD StackBase;
3348 DWORD StackLimit;
3349 DWORD SubSystemTib;
3350 _ANONYMOUS_UNION union {
3351 DWORD FiberData;
3352 DWORD Version;
3353 } DUMMYUNIONNAME;
3354 DWORD ArbitraryUserPointer;
3355 DWORD Self;
3356 } NT_TIB32,*PNT_TIB32;
3357
3358 typedef struct _NT_TIB64 {
3359 DWORD64 ExceptionList;
3360 DWORD64 StackBase;
3361 DWORD64 StackLimit;
3362 DWORD64 SubSystemTib;
3363 _ANONYMOUS_UNION union {
3364 DWORD64 FiberData;
3365 DWORD Version;
3366 } DUMMYUNIONNAME;
3367 DWORD64 ArbitraryUserPointer;
3368 DWORD64 Self;
3369 } NT_TIB64,*PNT_TIB64;
3370
3371 typedef struct _REPARSE_GUID_DATA_BUFFER {
3372 DWORD ReparseTag;
3373 WORD ReparseDataLength;
3374 WORD Reserved;
3375 GUID ReparseGuid;
3376 struct {
3377 BYTE DataBuffer[1];
3378 } GenericReparseBuffer;
3379 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;
3380
3381 typedef struct _REPARSE_POINT_INFORMATION {
3382 WORD ReparseDataLength;
3383 WORD UnparsedNameLength;
3384 } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
3385
3386 typedef union _FILE_SEGMENT_ELEMENT {
3387 PVOID64 Buffer;
3388 ULONGLONG Alignment;
3389 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3390
3391 /* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
3392 #define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
3393 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
3394 #define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
3395 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
3396 #define JOB_OBJECT_LIMIT_AFFINITY 0x0010
3397 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
3398 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
3399 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
3400 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
3401 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
3402 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
3403 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x0800
3404 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x1000
3405 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x2000
3406
3407 /* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
3408 #define JOB_OBJECT_UILIMIT_HANDLES 0x0001
3409 #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
3410 #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
3411 #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
3412 #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
3413 #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
3414 #define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
3415 #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
3416
3417 /* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
3418 #define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
3419 #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
3420 #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
3421 #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
3422
3423 /* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
3424 #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
3425 #define JOB_OBJECT_POST_AT_END_OF_JOB 1
3426
3427 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
3428 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
3429 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
3430 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
3431 #define JOB_OBJECT_MSG_NEW_PROCESS 6
3432 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
3433 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
3434 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
3435 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
3436
3437 #define JOB_OBJECT_ASSIGN_PROCESS 1
3438 #define JOB_OBJECT_SET_ATTRIBUTES 2
3439 #define JOB_OBJECT_QUERY 4
3440 #define JOB_OBJECT_TERMINATE 8
3441 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 16
3442 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
3443
3444 typedef enum _JOBOBJECTINFOCLASS {
3445 JobObjectBasicAccountingInformation = 1,
3446 JobObjectBasicLimitInformation,
3447 JobObjectBasicProcessIdList,
3448 JobObjectBasicUIRestrictions,
3449 JobObjectSecurityLimitInformation,
3450 JobObjectEndOfJobTimeInformation,
3451 JobObjectAssociateCompletionPortInformation,
3452 JobObjectBasicAndIoAccountingInformation,
3453 JobObjectExtendedLimitInformation,
3454 JobObjectJobSetInformation,
3455 JobObjectGroupInformation,
3456 MaxJobObjectInfoClass
3457 } JOBOBJECTINFOCLASS;
3458
3459 typedef struct _JOB_SET_ARRAY {
3460 HANDLE JobHandle;
3461 DWORD MemberLevel;
3462 DWORD Flags;
3463 } JOB_SET_ARRAY, *PJOB_SET_ARRAY;
3464
3465 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
3466 LARGE_INTEGER TotalUserTime;
3467 LARGE_INTEGER TotalKernelTime;
3468 LARGE_INTEGER ThisPeriodTotalUserTime;
3469 LARGE_INTEGER ThisPeriodTotalKernelTime;
3470 DWORD TotalPageFaultCount;
3471 DWORD TotalProcesses;
3472 DWORD ActiveProcesses;
3473 DWORD TotalTerminatedProcesses;
3474 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3475
3476 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
3477 LARGE_INTEGER PerProcessUserTimeLimit;
3478 LARGE_INTEGER PerJobUserTimeLimit;
3479 DWORD LimitFlags;
3480 SIZE_T MinimumWorkingSetSize;
3481 SIZE_T MaximumWorkingSetSize;
3482 DWORD ActiveProcessLimit;
3483 ULONG_PTR Affinity;
3484 DWORD PriorityClass;
3485 DWORD SchedulingClass;
3486 } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION;
3487
3488 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
3489 DWORD NumberOfAssignedProcesses;
3490 DWORD NumberOfProcessIdsInList;
3491 ULONG_PTR ProcessIdList[1];
3492 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
3493
3494 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
3495 DWORD UIRestrictionsClass;
3496 } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
3497
3498 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
3499 DWORD SecurityLimitFlags;
3500 HANDLE JobToken;
3501 PTOKEN_GROUPS SidsToDisable;
3502 PTOKEN_PRIVILEGES PrivilegesToDelete;
3503 PTOKEN_GROUPS RestrictedSids;
3504 } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
3505
3506 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
3507 DWORD EndOfJobTimeAction;
3508 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3509
3510 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
3511 PVOID CompletionKey;
3512 HANDLE CompletionPort;
3513 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3514
3515 typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
3516 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
3517 IO_COUNTERS IoInfo;
3518 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3519
3520 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
3521 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
3522 IO_COUNTERS IoInfo;
3523 SIZE_T ProcessMemoryLimit;
3524 SIZE_T JobMemoryLimit;
3525 SIZE_T PeakProcessMemoryUsed;
3526 SIZE_T PeakJobMemoryUsed;
3527 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3528
3529 typedef struct _JOBOBJECT_JOBSET_INFORMATION {
3530 DWORD MemberLevel;
3531 } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION;
3532
3533 /* Fixme: Making these defines conditional on WINVER will break ddk includes */
3534 #if 1 /* (WINVER >= 0x0500) */
3535
3536 #define ES_SYSTEM_REQUIRED 0x00000001
3537 #define ES_DISPLAY_REQUIRED 0x00000002
3538 #define ES_USER_PRESENT 0x00000004
3539 #define ES_CONTINUOUS 0x80000000
3540
3541 typedef enum _LATENCY_TIME {
3542 LT_DONT_CARE,
3543 LT_LOWEST_LATENCY
3544 } LATENCY_TIME, *PLATENCY_TIME;
3545
3546 typedef enum _SYSTEM_POWER_STATE {
3547 PowerSystemUnspecified = 0,
3548 PowerSystemWorking,
3549 PowerSystemSleeping1,
3550 PowerSystemSleeping2,
3551 PowerSystemSleeping3,
3552 PowerSystemHibernate,
3553 PowerSystemShutdown,
3554 PowerSystemMaximum
3555 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
3556
3557 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
3558
3559 typedef enum {
3560 PowerActionNone = 0,
3561 PowerActionReserved,
3562 PowerActionSleep,
3563 PowerActionHibernate,
3564 PowerActionShutdown,
3565 PowerActionShutdownReset,
3566 PowerActionShutdownOff,
3567 PowerActionWarmEject
3568 } POWER_ACTION, *PPOWER_ACTION;
3569
3570 typedef enum _DEVICE_POWER_STATE {
3571 PowerDeviceUnspecified = 0,
3572 PowerDeviceD0,
3573 PowerDeviceD1,
3574 PowerDeviceD2,
3575 PowerDeviceD3,
3576 PowerDeviceMaximum
3577 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3578
3579 #if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_)
3580 typedef struct {
3581 DWORD Granularity;
3582 DWORD Capacity;
3583 } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
3584 #endif
3585
3586 typedef struct _POWER_ACTION_POLICY {
3587 POWER_ACTION Action;
3588 DWORD Flags;
3589 DWORD EventCode;
3590 } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
3591
3592 /* POWER_ACTION_POLICY.Flags constants */
3593 #define POWER_ACTION_QUERY_ALLOWED 0x00000001
3594 #define POWER_ACTION_UI_ALLOWED 0x00000002
3595 #define POWER_ACTION_OVERRIDE_APPS 0x00000004
3596 #define POWER_ACTION_LIGHTEST_FIRST 0x10000000
3597 #define POWER_ACTION_LOCK_CONSOLE 0x20000000
3598 #define POWER_ACTION_DISABLE_WAKES 0x40000000
3599 #define POWER_ACTION_CRITICAL 0x80000000
3600
3601 /* POWER_ACTION_POLICY.EventCode constants */
3602 #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
3603 #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
3604 #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
3605 #define POWER_USER_NOTIFY_BUTTON 0x00000008
3606 #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
3607 #define POWER_FORCE_TRIGGER_RESET 0x80000000
3608
3609 #define DISCHARGE_POLICY_CRITICAL 0
3610 #define DISCHARGE_POLICY_LOW 1
3611 #define NUM_DISCHARGE_POLICIES 4
3612
3613 #define PO_THROTTLE_NONE 0
3614 #define PO_THROTTLE_CONSTANT 1
3615 #define PO_THROTTLE_DEGRADE 2
3616 #define PO_THROTTLE_ADAPTIVE 3
3617 #define PO_THROTTLE_MAXIMUM 4
3618
3619 typedef struct _SYSTEM_POWER_LEVEL {
3620 BOOLEAN Enable;
3621 BYTE Spare[3];
3622 DWORD BatteryLevel;
3623 POWER_ACTION_POLICY PowerPolicy;
3624 SYSTEM_POWER_STATE MinSystemState;
3625 } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
3626
3627 typedef struct _SYSTEM_POWER_POLICY {
3628 DWORD Revision;
3629 POWER_ACTION_POLICY PowerButton;
3630 POWER_ACTION_POLICY SleepButton;
3631 POWER_ACTION_POLICY LidClose;
3632 SYSTEM_POWER_STATE LidOpenWake;
3633 DWORD Reserved;
3634 POWER_ACTION_POLICY Idle;
3635 DWORD IdleTimeout;
3636 BYTE IdleSensitivity;
3637 BYTE DynamicThrottle;
3638 BYTE Spare2[2];
3639 SYSTEM_POWER_STATE MinSleep;
3640 SYSTEM_POWER_STATE MaxSleep;
3641 SYSTEM_POWER_STATE ReducedLatencySleep;
3642 DWORD WinLogonFlags;
3643 DWORD Spare3;
3644 DWORD DozeS4Timeout;
3645 DWORD BroadcastCapacityResolution;
3646 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
3647 DWORD VideoTimeout;
3648 BOOLEAN VideoDimDisplay;
3649 DWORD VideoReserved[3];
3650 DWORD SpindownTimeout;
3651 BOOLEAN OptimizeForPower;
3652 BYTE FanThrottleTolerance;
3653 BYTE ForcedThrottle;
3654 BYTE MinThrottle;
3655 POWER_ACTION_POLICY OverThrottled;
3656 } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
3657
3658 typedef struct _SYSTEM_POWER_CAPABILITIES {
3659 BOOLEAN PowerButtonPresent;
3660 BOOLEAN SleepButtonPresent;
3661 BOOLEAN LidPresent;
3662 BOOLEAN SystemS1;
3663 BOOLEAN SystemS2;
3664 BOOLEAN SystemS3;
3665 BOOLEAN SystemS4;
3666 BOOLEAN SystemS5;
3667 BOOLEAN HiberFilePresent;
3668 BOOLEAN FullWake;
3669 BOOLEAN VideoDimPresent;
3670 BOOLEAN ApmPresent;
3671 BOOLEAN UpsPresent;
3672 BOOLEAN ThermalControl;
3673 BOOLEAN ProcessorThrottle;
3674 BYTE ProcessorMinThrottle;
3675 #if (NTDDI_VERSION < NTDDI_WINXP)
3676 BYTE ProcessorThrottleScale;
3677 BYTE spare2[4];
3678 #else
3679 BYTE ProcessorMaxThrottle;
3680 BOOLEAN FastSystemS4;
3681 BYTE spare2[3];
3682 #endif /* (NTDDI_VERSION < NTDDI_WINXP) */
3683 BOOLEAN DiskSpinDown;
3684 BYTE spare3[8];
3685 BOOLEAN SystemBatteriesPresent;
3686 BOOLEAN BatteriesAreShortTerm;
3687 BATTERY_REPORTING_SCALE BatteryScale[3];
3688 SYSTEM_POWER_STATE AcOnLineWake;
3689 SYSTEM_POWER_STATE SoftLidWake;
3690 SYSTEM_POWER_STATE RtcWake;
3691 SYSTEM_POWER_STATE MinDeviceWakeState;
3692 SYSTEM_POWER_STATE DefaultLowLatencyWake;
3693 } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
3694
3695 typedef struct _SYSTEM_BATTERY_STATE {
3696 BOOLEAN AcOnLine;
3697 BOOLEAN BatteryPresent;
3698 BOOLEAN Charging;
3699 BOOLEAN Discharging;
3700 BOOLEAN Spare1[4];
3701 DWORD MaxCapacity;
3702 DWORD RemainingCapacity;
3703 DWORD Rate;
3704 DWORD EstimatedTime;
3705 DWORD DefaultAlert1;
3706 DWORD DefaultAlert2;
3707 } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
3708
3709 // FIXME: This should not be here!
3710 typedef struct _PROCESSOR_POWER_INFORMATION {
3711 ULONG Number;
3712 ULONG MaxMhz;
3713 ULONG CurrentMhz;
3714 ULONG MhzLimit;
3715 ULONG MaxIdleState;
3716 ULONG CurrentIdleState;
3717 } PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION;
3718
3719 typedef DWORD EXECUTION_STATE, *PEXECUTION_STATE;
3720
3721 typedef enum _POWER_INFORMATION_LEVEL {
3722 SystemPowerPolicyAc,
3723 SystemPowerPolicyDc,
3724 VerifySystemPolicyAc,
3725 VerifySystemPolicyDc,
3726 SystemPowerCapabilities,
3727 SystemBatteryState,
3728 SystemPowerStateHandler,
3729 ProcessorStateHandler,
3730 SystemPowerPolicyCurrent,
3731 AdministratorPowerPolicy,
3732 SystemReserveHiberFile,
3733 ProcessorInformation,
3734 SystemPowerInformation,
3735 ProcessorStateHandler2,
3736 LastWakeTime,
3737 LastSleepTime,
3738 SystemExecutionState,
3739 SystemPowerStateNotifyHandler,
3740 ProcessorPowerPolicyAc,
3741 ProcessorPowerPolicyDc,
3742 VerifyProcessorPowerPolicyAc,
3743 VerifyProcessorPowerPolicyDc,
3744 ProcessorPowerPolicyCurrent,
3745 SystemPowerStateLogging,
3746 SystemPowerLoggingEntry,
3747 SetPowerSettingValue,
3748 NotifyUserPowerSetting,
3749 PowerInformationLevelUnused0,
3750 PowerInformationLevelUnused1,
3751 SystemVideoState,
3752 TraceApplicationPowerMessage,
3753 TraceApplicationPowerMessageEnd,
3754 ProcessorPerfStates,
3755 ProcessorIdleStates,
3756 ProcessorCap,
3757 SystemWakeSource,
3758 SystemHiberFileInformation,
3759 TraceServicePowerMessage,
3760 ProcessorLoad,
3761 PowerShutdownNotification,
3762 MonitorCapabilities,
3763 SessionPowerInit,
3764 SessionDisplayState,
3765 PowerRequestCreate,
3766 PowerRequestAction,
3767 GetPowerRequestList,
3768 ProcessorInformationEx,
3769 NotifyUserModeLegacyPowerEvent,
3770 GroupPark,
3771 ProcessorIdleDomains,
3772 WakeTimerList,
3773 SystemHiberFileSize,
3774 PowerInformationLevelMaximum
3775 } POWER_INFORMATION_LEVEL;
3776
3777 #if 1 /* (WIN32_WINNT >= 0x0500) */
3778 typedef struct _SYSTEM_POWER_INFORMATION {
3779 ULONG MaxIdlenessAllowed;
3780 ULONG Idleness;
3781 ULONG TimeRemaining;
3782 UCHAR CoolingMode;
3783 } SYSTEM_POWER_INFORMATION,*PSYSTEM_POWER_INFORMATION;
3784 #endif
3785
3786 #if (_WIN32_WINNT >= 0x0501)
3787
3788 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
3789 ActivationContextBasicInformation = 1,
3790 ActivationContextDetailedInformation = 2,
3791 AssemblyDetailedInformationInActivationContext = 3,
3792 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
3793 RunlevelInformationInActivationContext = 5,
3794 CompatibilityInformationInActivationContext = 6,
3795 ActivationContextManifestResourceName = 7,
3796 MaxActivationContextInfoClass,
3797 /* For compatibility with the old names */
3798 AssemblyDetailedInformationInActivationContxt = 3,
3799 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
3800 } ACTIVATION_CONTEXT_INFO_CLASS;
3801
3802 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
3803 DWORD ulFlags;
3804 DWORD ulEncodedAssemblyIdentityLength;
3805 DWORD ulManifestPathType;
3806 DWORD ulManifestPathLength;
3807 LARGE_INTEGER liManifestLastWriteTime;
3808 DWORD ulPolicyPathType;
3809 DWORD ulPolicyPathLength;
3810 LARGE_INTEGER liPolicyLastWriteTime;
3811 DWORD ulMetadataSatelliteRosterIndex;
3812 DWORD ulManifestVersionMajor;
3813 DWORD ulManifestVersionMinor;
3814 DWORD ulPolicyVersionMajor;
3815 DWORD ulPolicyVersionMinor;
3816 DWORD ulAssemblyDirectoryNameLength;
3817 PCWSTR lpAssemblyEncodedAssemblyIdentity;
3818 PCWSTR lpAssemblyManifestPath;
3819 PCWSTR lpAssemblyPolicyPath;
3820 PCWSTR lpAssemblyDirectoryName;
3821 DWORD ulFileCount;
3822 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3823 typedef const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3824
3825 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
3826 DWORD dwFlags;
3827 DWORD ulFormatVersion;
3828 DWORD ulAssemblyCount;
3829 DWORD ulRootManifestPathType;
3830 DWORD ulRootManifestPathChars;
3831 DWORD ulRootConfigurationPathType;
3832 DWORD ulRootConfigurationPathChars;
3833 DWORD ulAppDirPathType;
3834 DWORD ulAppDirPathChars;
3835 PCWSTR lpRootManifestPath;
3836 PCWSTR lpRootConfigurationPath;
3837 PCWSTR lpAppDirPath;
3838 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
3839 typedef const ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION;
3840
3841 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
3842 DWORD ulAssemblyIndex;
3843 DWORD ulFileIndexInAssembly;
3844 } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX;
3845 typedef const ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
3846
3847 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
3848 DWORD ulFlags;
3849 DWORD ulFilenameLength;
3850 DWORD ulPathLength;
3851 PCWSTR lpFileName;
3852 PCWSTR lpFilePath;
3853 } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION;
3854 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
3855
3856 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
3857 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
3858 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
3859 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
3860
3861 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
3862 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
3863 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
3864 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
3865 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
3866 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
3867 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
3868 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
3869 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
3870
3871 #endif /* (WIN32_WINNT >= 0x0501) */
3872
3873 typedef struct _PROCESSOR_POWER_POLICY_INFO {
3874 DWORD TimeCheck;
3875 DWORD DemoteLimit;
3876 DWORD PromoteLimit;
3877 BYTE DemotePercent;
3878 BYTE PromotePercent;
3879 BYTE Spare[2];
3880 DWORD AllowDemotion:1;
3881 DWORD AllowPromotion:1;
3882 DWORD Reserved:30;
3883 } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
3884
3885 typedef struct _PROCESSOR_POWER_POLICY {
3886 DWORD Revision;
3887 BYTE DynamicThrottle;
3888 BYTE Spare[3];
3889 DWORD DisableCStates:1;
3890 DWORD Reserved:31;
3891 DWORD PolicyCount;
3892 PROCESSOR_POWER_POLICY_INFO Policy[3];
3893 } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
3894
3895 typedef struct _ADMINISTRATOR_POWER_POLICY {
3896 SYSTEM_POWER_STATE MinSleep;
3897 SYSTEM_POWER_STATE MaxSleep;
3898 DWORD MinVideoTimeout;
3899 DWORD MaxVideoTimeout;
3900 DWORD MinSpindownTimeout;
3901 DWORD MaxSpindownTimeout;
3902 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
3903
3904 #endif /* WINVER >= 0x0500 */
3905
3906 typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN);
3907
3908 #ifdef UNICODE
3909 typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3910 typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3911 #else
3912 typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3913 typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3914 #endif
3915
3916 #define VER_SET_CONDITION(lc,t,c) ((lc) = VerSetConditionMask((lc),(t),(c)))
3917
3918 #if (_WIN32_WINNT >= 0x0500)
3919 ULONGLONG WINAPI VerSetConditionMask(_In_ ULONGLONG, _In_ DWORD, _In_ BYTE);
3920 #endif
3921
3922 typedef enum _HEAP_INFORMATION_CLASS {
3923 HeapCompatibilityInformation,
3924 HeapEnableTerminationOnCorruption
3925 } HEAP_INFORMATION_CLASS;
3926
3927 typedef enum _PROCESSOR_CACHE_TYPE {
3928 CacheUnified,
3929 CacheInstruction,
3930 CacheData,
3931 CacheTrace
3932 } PROCESSOR_CACHE_TYPE;
3933
3934 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP {
3935 RelationProcessorCore,
3936 RelationNumaNode,
3937 RelationCache,
3938 RelationProcessorPackage,
3939 RelationGroup,
3940 RelationAll = 0xffff
3941 } LOGICAL_PROCESSOR_RELATIONSHIP;
3942
3943 #define CACHE_FULLY_ASSOCIATIVE 0xFF
3944
3945 typedef struct _CACHE_DESCRIPTOR {
3946 BYTE Level;
3947 BYTE Associativity;
3948 WORD LineSize;
3949 DWORD Size;
3950 PROCESSOR_CACHE_TYPE Type;
3951 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
3952
3953 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
3954 ULONG_PTR ProcessorMask;
3955 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
3956 _ANONYMOUS_UNION union {
3957 struct {
3958 BYTE Flags;
3959 } ProcessorCore;
3960 struct {
3961 DWORD NodeNumber;
3962 } NumaNode;
3963 CACHE_DESCRIPTOR Cache;
3964 ULONGLONG Reserved[2];
3965 } DUMMYUNIONNAME;
3966 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
3967
3968 _Check_return_
3969 NTSYSAPI
3970 SIZE_T
3971 NTAPI
3972 RtlCompareMemory (
3973 _In_ const VOID *Source1,
3974 _In_ const VOID *Source2,
3975 _In_ SIZE_T Length);
3976
3977 #define RtlMoveMemory(Dest,Source,Length) memmove((Dest),(Source),(Length))
3978 #define RtlCopyMemory(Dest,Source,Length) memcpy((Dest),(Source),(Length))
3979 #define RtlFillMemory(Dest,Length,Fill) memset((Dest),(Fill),(Length))
3980 #define RtlZeroMemory(Dest,Length) RtlFillMemory((Dest),(Length),0)
3981 #define RtlEqualMemory(Dest,Source,Length) (!memcmp((Dest),(Source),(Length)))
3982
3983 FORCEINLINE
3984 PVOID
3985 RtlSecureZeroMemory(_Out_writes_bytes_all_(Length) PVOID Buffer,
3986 _In_ SIZE_T Length)
3987 {
3988 volatile char *VolatilePointer;
3989
3990 /* Get a volatile pointer to prevent any compiler optimizations */
3991 VolatilePointer = (volatile char *)Buffer;
3992
3993 /* Loop the whole buffer */
3994 while (Length)
3995 {
3996 /* Zero the current byte and move on */
3997 *VolatilePointer++ = 0;
3998 Length--;
3999 }
4000
4001 /* Return the pointer to ensure the compiler won't optimize this away */
4002 return Buffer;
4003 }
4004
4005 #if defined(_M_IX86)
4006 FORCEINLINE struct _TEB * NtCurrentTeb(void)
4007 {
4008 return (struct _TEB *)__readfsdword(0x18);
4009 }
4010 FORCEINLINE PVOID GetCurrentFiber(VOID)
4011 {
4012 return (PVOID)(ULONG_PTR)__readfsdword(0x10);
4013 }
4014 #elif defined (_M_AMD64)
4015 FORCEINLINE struct _TEB * NtCurrentTeb(void)
4016 {
4017 return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self));
4018 }
4019 FORCEINLINE PVOID GetCurrentFiber(VOID)
4020 {
4021 #ifdef NONAMELESSUNION
4022 return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, DUMMYUNIONNAME.FiberData));
4023 #else
4024 return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData));
4025 #endif
4026 }
4027 #elif defined (_M_ARM)
4028 #define CP15_PMSELR 15, 0, 9, 12, 5
4029 #define CP15_PMXEVCNTR 15, 0, 9, 13, 2
4030 #define CP15_TPIDRURW 15, 0, 13, 0, 2
4031 #define CP15_TPIDRURO 15, 0, 13, 0, 3
4032 #define CP15_TPIDRPRW 15, 0, 13, 0, 4
4033 FORCEINLINE struct _TEB * NtCurrentTeb(void)
4034 {
4035 return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW);
4036 }
4037 FORCEINLINE PVOID GetCurrentFiber(VOID)
4038 {
4039 #ifdef NONAMELESSUNION
4040 return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->DUMMYUNIONNAME.FiberData;
4041 #else
4042 return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData;
4043 #endif
4044 }
4045 #elif defined(_M_PPC)
4046 FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset)
4047 {
4048 unsigned long result;
4049 __asm__("\tadd 7,13,%1\n"
4050 "\tlwz %0,0(7)\n"
4051 : "=r" (result)
4052 : "r" (Offset)
4053 : "r7");
4054 return result;
4055 }
4056 FORCEINLINE struct _TEB * NtCurrentTeb(void)
4057 {
4058 return (struct _TEB *)_read_teb_dword(0x18);
4059 }
4060 FORCEINLINE PVOID GetCurrentFiber(void)
4061 {
4062 return _read_teb_dword(0x10);
4063 }
4064 #else
4065 #error Unknown architecture
4066 #endif
4067
4068 FORCEINLINE PVOID GetFiberData(void)
4069 {
4070 return *((PVOID *)GetCurrentFiber());
4071 }
4072
4073 /* TODO: Other architectures than X86 */
4074 #if defined(_M_IX86)
4075 #define PF_TEMPORAL_LEVEL_1
4076 #define PF_NON_TEMPORAL_LEVEL_ALL
4077 #define PreFetchCacheLine(l, a)
4078 #elif defined (_M_AMD64)
4079 #define PreFetchCacheLine(l, a)
4080 #elif defined(_M_PPC)
4081 #define PreFetchCacheLine(l, a)
4082 #elif defined(_M_ARM)
4083 #define PreFetchCacheLine(l, a)
4084 #else
4085 #error Unknown architecture
4086 #endif
4087
4088 /* TODO: Other architectures than X86 */
4089 #if defined(_M_IX86)
4090 #if defined(_MSC_VER)
4091 FORCEINLINE
4092 VOID
4093 MemoryBarrier (VOID)
4094 {
4095 LONG Barrier;
4096 __asm { xchg Barrier, eax }
4097 }
4098 #else
4099 FORCEINLINE
4100 VOID
4101 MemoryBarrier(VOID)
4102 {
4103 LONG Barrier, *Dummy = &Barrier;
4104 UNREFERENCED_LOCAL_VARIABLE(Dummy);
4105 __asm__ __volatile__("xchgl %%eax, %[Barrier]" : : [Barrier] "m" (Barrier) : "memory");
4106 }
4107 #endif
4108 #elif defined (_M_AMD64)
4109 #define MemoryBarrier __faststorefence
4110 #elif defined(_M_PPC)
4111 #define MemoryBarrier()
4112 #elif defined(_M_ARM)
4113 #define MemoryBarrier()
4114 #else
4115 #error Unknown architecture
4116 #endif
4117
4118 #if defined(_M_IX86) || defined(_M_AMD64)
4119
4120 #define YieldProcessor _mm_pause
4121
4122 __analysis_noreturn
4123 FORCEINLINE
4124 VOID
4125 DbgRaiseAssertionFailure(VOID)
4126 {
4127 __int2c();
4128 }
4129
4130 #elif defined(_M_PPC)
4131 #define YieldProcessor() __asm__ __volatile__("nop");
4132 #elif defined(_M_MIPS)
4133 #define YieldProcessor() __asm__ __volatile__("nop");
4134 #elif defined(_M_ARM)
4135 #define YieldProcessor __yield
4136 #else
4137 #error Unknown architecture
4138 #endif
4139
4140 typedef struct _TP_POOL TP_POOL, *PTP_POOL;
4141 typedef struct _TP_WORK TP_WORK, *PTP_WORK;
4142 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE;
4143
4144 typedef DWORD TP_VERSION, *PTP_VERSION;
4145
4146 typedef enum _TP_CALLBACK_PRIORITY {
4147 TP_CALLBACK_PRIORITY_HIGH,
4148 TP_CALLBACK_PRIORITY_NORMAL,
4149 TP_CALLBACK_PRIORITY_LOW,
4150 TP_CALLBACK_PRIORITY_INVALID,
4151 TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID
4152 } TP_CALLBACK_PRIORITY;
4153
4154 typedef VOID
4155 (NTAPI *PTP_WORK_CALLBACK)(
4156 _Inout_ PTP_CALLBACK_INSTANCE Instance,
4157 _Inout_opt_ PVOID Context,
4158 _Inout_ PTP_WORK Work);
4159
4160 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP;
4161
4162 typedef VOID
4163 (NTAPI *PTP_SIMPLE_CALLBACK)(
4164 _Inout_ PTP_CALLBACK_INSTANCE Instance,
4165 _Inout_opt_ PVOID Context);
4166
4167 typedef VOID
4168 (NTAPI *PTP_CLEANUP_GROUP_CANCEL_CALLBACK)(
4169 _Inout_opt_ PVOID ObjectContext,
4170 _Inout_opt_ PVOID CleanupContext);
4171
4172 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7)
4173 typedef struct _TP_CALLBACK_ENVIRON_V3 {
4174 TP_VERSION Version;
4175 PTP_POOL Pool;
4176 PTP_CLEANUP_GROUP CleanupGroup;
4177 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback;
4178 PVOID RaceDll;
4179 struct _ACTIVATION_CONTEXT *ActivationContext;
4180 PTP_SIMPLE_CALLBACK FinalizationCallback;
4181 union {
4182 DWORD Flags;
4183 struct {
4184 DWORD LongFunction:1;
4185 DWORD Persistent:1;
4186 DWORD Private:30;
4187 } s;
4188 } u;
4189 TP_CALLBACK_PRIORITY CallbackPriority;
4190 DWORD Size;
4191 } TP_CALLBACK_ENVIRON_V3, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON;
4192 #else
4193 typedef struct _TP_CALLBACK_ENVIRON_V1 {
4194 TP_VERSION Version;
4195 PTP_POOL Pool;
4196 PTP_CLEANUP_GROUP CleanupGroup;
4197 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback;
4198 PVOID RaceDll;
4199 struct _ACTIVATION_CONTEXT *ActivationContext;
4200 PTP_SIMPLE_CALLBACK FinalizationCallback;
4201 union {
4202 DWORD Flags;
4203 struct {
4204 DWORD LongFunction:1;
4205 DWORD Persistent:1;
4206 DWORD Private:30;
4207 } s;
4208 } u;
4209 } TP_CALLBACK_ENVIRON_V1, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON;
4210 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN7) */
4211
4212 #ifdef _MSC_VER
4213 #pragma warning(pop)
4214 #endif
4215
4216 #endif /* RC_INVOKED */