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