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