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