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