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