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