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