fb511421d2840c3609d8e34c000517278278f202
[reactos.git] / reactos / w32api / include / winnt.h
1 #ifndef _WINNT_H
2 #define _WINNT_H
3 #if __GNUC__ >= 3
4 #pragma GCC system_header
5 #endif
6
7 /* translate GCC target defines to MS equivalents. Keep this synchronized
8 with windows.h. */
9 #if defined(__i686__) && !defined(_M_IX86)
10 #define _M_IX86 600
11 #elif defined(__i586__) && !defined(_M_IX86)
12 #define _M_IX86 500
13 #elif defined(__i486__) && !defined(_M_IX86)
14 #define _M_IX86 400
15 #elif defined(__i386__) && !defined(_M_IX86)
16 #define _M_IX86 300
17 #endif
18 #if defined(_M_IX86) && !defined(_X86_)
19 #define _X86_
20 #elif defined(_M_ALPHA) && !defined(_ALPHA_)
21 #define _ALPHA_
22
23 #elif defined(_M_ARM) && !defined(ARM)
24 #define ARM
25 #elif defined(_M_PPC) && !defined(_PPC_)
26 #define _PPC_
27 #elif defined(_M_MRX000) && !defined(_MIPS_)
28 #define _MIPS_
29 #elif defined(_M_M68K) && !defined(_68K_)
30 #define _68K_
31 #endif
32
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36
37 #include <ctype.h>
38 #include <winerror.h>
39
40 #ifndef RC_INVOKED
41 #include <string.h>
42
43 /* FIXME: add more architectures. Is there a way to specify this in GCC? */
44 #ifdef _X86_
45 #define UNALIGNED
46 #else
47 #define UNALIGNED
48 #endif
49
50 #ifndef DECLSPEC_ADDRSAFE
51 #if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
52 #define DECLSPEC_ADDRSAFE __declspec(address_safe)
53 #else
54 #define DECLSPEC_ADDRSAFE
55 #endif
56 #endif
57
58 #ifndef FORCEINLINE
59 #if (_MSC_VER >= 1200)
60 #define FORCEINLINE __forceinline
61 #elif (_MSC_VER)
62 #define FORCEINLINE __inline
63 #else
64 #define FORCEINLINE static __inline
65 #endif
66 #endif
67
68 #if !defined(_NTSYSTEM_)
69 #define NTSYSAPI DECLSPEC_IMPORT
70 #define NTSYSCALLAPI DECLSPEC_IMPORT
71 #else
72 #define NTSYSAPI
73 #if defined(_NTDLLBUILD_)
74 #define NTSYSCALLAPI
75 #else
76 #define NTSYSCALLAPI DECLSPEC_ADDRSAFE
77 #endif
78 #endif
79
80 #ifndef VOID
81 #define VOID void
82 #endif
83 typedef char CHAR;
84 typedef short SHORT;
85 #ifndef LONG_DEFINED
86 #define LONG_DEFINED
87 typedef long LONG;
88 typedef unsigned long ULONG,*PULONG;
89 #endif//LONG_DEFINED
90 typedef char CCHAR, *PCCHAR;
91 typedef unsigned char UCHAR,*PUCHAR;
92 typedef unsigned short USHORT,*PUSHORT;
93 typedef char *PSZ;
94
95 typedef void *PVOID,*LPVOID;
96
97 /* FIXME for __WIN64 */
98 #ifndef __ptr64
99 #define __ptr64
100 #endif
101 typedef void* __ptr64 PVOID64;
102
103 #ifndef _WCHAR_T_DEFINED
104 #define _WCHAR_T_DEFINED
105 #ifndef _WCHAR_T_
106 #define _WCHAR_T_
107 #undef __need_wchar_t
108 #ifndef __cplusplus
109 typedef unsigned short wchar_t;
110 #endif
111 #endif
112 #endif
113
114 typedef wchar_t WCHAR;
115 typedef WCHAR *PWCHAR,*LPWCH,*PWCH,*NWPSTR,*LPWSTR,*PWSTR;
116 typedef CONST WCHAR *LPCWCH,*PCWCH,*LPCWSTR,*PCWSTR;
117 typedef CHAR *PCHAR,*LPCH,*PCH,*NPSTR,*LPSTR,*PSTR;
118 typedef CONST CHAR *LPCCH,*PCSTR,*LPCSTR;
119 #ifndef _TCHAR_DEFINED
120 #define _TCHAR_DEFINED
121 #ifdef UNICODE
122 /*
123 * NOTE: This tests UNICODE, which is different from the _UNICODE define
124 * used to differentiate standard C runtime calls.
125 */
126 typedef WCHAR TCHAR;
127 typedef WCHAR _TCHAR;
128 #else
129 typedef CHAR TCHAR;
130 typedef CHAR _TCHAR;
131 #endif
132 #endif
133 typedef TCHAR TBYTE,*PTCH,*PTBYTE;
134 typedef TCHAR *LPTCH,*PTSTR,*LPTSTR,*LP,*PTCHAR;
135 typedef const TCHAR *LPCTSTR;
136 #ifdef UNICODE
137 /*
138 * __TEXT is a private macro whose specific use is to force the expansion of a
139 * macro passed as an argument to the macro TEXT. DO NOT use this
140 * macro within your programs. It's name and function could change without
141 * notice.
142 */
143 #define __TEXT(q) L##q
144 #else
145 #define __TEXT(q) q
146 #endif
147 /*
148 * UNICODE a constant string when UNICODE is defined, else returns the string
149 * unmodified.
150 * The corresponding macros _TEXT() and _T() for mapping _UNICODE strings
151 * passed to C runtime functions are defined in mingw/tchar.h
152 */
153 #define TEXT(q) __TEXT(q)
154 typedef SHORT *PSHORT;
155 typedef LONG *PLONG;
156 #ifdef STRICT
157 typedef void *HANDLE;
158 #define DECLARE_HANDLE(n) typedef struct n##__{int i;}*n
159 #else
160 typedef PVOID HANDLE;
161 #define DECLARE_HANDLE(n) typedef HANDLE n
162 #endif
163 typedef HANDLE *PHANDLE,*LPHANDLE;
164 typedef DWORD LCID;
165 typedef PDWORD PLCID;
166 typedef WORD LANGID;
167 #ifdef __GNUC__
168 #define _HAVE_INT64
169 #define _INTEGRAL_MAX_BITS 64
170 #undef __int64
171 #define __int64 long long
172 #elif defined(__WATCOMC__) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 )
173 #define _HAVE_INT64
174 #endif /* __GNUC__/__WATCOMC */
175 #if defined(_HAVE_INT64) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64)
176 typedef __int64 LONGLONG;
177 typedef unsigned __int64 DWORDLONG;
178 #else
179 typedef double LONGLONG,DWORDLONG;
180 #endif
181 typedef LONGLONG *PLONGLONG;
182 typedef DWORDLONG *PDWORDLONG;
183 typedef DWORDLONG ULONGLONG,*PULONGLONG;
184 typedef LONGLONG USN;
185 #ifdef _HAVE_INT64
186 #define Int32x32To64(a,b) ((LONGLONG)(a)*(LONGLONG)(b))
187 #define UInt32x32To64(a,b) ((DWORDLONG)(a)*(DWORDLONG)(b))
188 #define Int64ShllMod32(a,b) ((DWORDLONG)(a)<<(b))
189 #define Int64ShraMod32(a,b) ((LONGLONG)(a)>>(b))
190 #define Int64ShrlMod32(a,b) ((DWORDLONG)(a)>>(b))
191 #endif
192 #define ANSI_NULL ((CHAR)0)
193 #define UNICODE_NULL ((WCHAR)0)
194 typedef BYTE BOOLEAN,*PBOOLEAN;
195 #endif
196 typedef BYTE FCHAR;
197 typedef WORD FSHORT;
198 typedef DWORD FLONG;
199
200 #define NTAPI __stdcall
201 #include <basetsd.h>
202 #define ACE_OBJECT_TYPE_PRESENT 0x00000001
203 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002
204 #define APPLICATION_ERROR_MASK 0x20000000
205 #define ERROR_SEVERITY_SUCCESS 0x00000000
206 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
207 #define ERROR_SEVERITY_WARNING 0x80000000
208 #define ERROR_SEVERITY_ERROR 0xC0000000
209 /* also in ddk/ntifs.h */
210 #define COMPRESSION_FORMAT_NONE (0x0000)
211 #define COMPRESSION_FORMAT_DEFAULT (0x0001)
212 #define COMPRESSION_FORMAT_LZNT1 (0x0002)
213 #define COMPRESSION_ENGINE_STANDARD (0x0000)
214 #define COMPRESSION_ENGINE_MAXIMUM (0x0100)
215 #define COMPRESSION_ENGINE_HIBER (0x0200)
216 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
217 #define ACCESS_DENIED_ACE_TYPE (0x1)
218 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
219 #define SYSTEM_ALARM_ACE_TYPE (0x3)
220 /*end ntifs.h */
221 #define ANYSIZE_ARRAY 1
222 #define OBJECT_INHERIT_ACE 1
223 #define CONTAINER_INHERIT_ACE 2
224 #define NO_PROPAGATE_INHERIT_ACE 4
225 #define INHERIT_ONLY_ACE 8
226 #define INHERITED_ACE 10
227 #define VALID_INHERIT_FLAGS 16
228 #define SUCCESSFUL_ACCESS_ACE_FLAG 64
229 #define FAILED_ACCESS_ACE_FLAG 128
230 #define DELETE 0x00010000L
231 #define READ_CONTROL 0x20000L
232 #define WRITE_DAC 0x40000L
233 #define WRITE_OWNER 0x80000L
234 #define SYNCHRONIZE 0x100000L
235 #define STANDARD_RIGHTS_REQUIRED 0xF0000
236 #define STANDARD_RIGHTS_READ 0x20000
237 #define STANDARD_RIGHTS_WRITE 0x20000
238 #define STANDARD_RIGHTS_EXECUTE 0x20000
239 #define STANDARD_RIGHTS_ALL 0x1F0000
240 #define SPECIFIC_RIGHTS_ALL 0xFFFF
241 #define ACCESS_SYSTEM_SECURITY 0x1000000
242
243 #ifndef WIN32_NO_STATUS
244
245 #define STATUS_WAIT_0 ((DWORD)0x00000000)
246 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080)
247 #define STATUS_USER_APC ((DWORD)0x000000C0)
248 #define STATUS_TIMEOUT ((DWORD)0x00000102)
249 #define STATUS_PENDING ((DWORD)0x00000103)
250 #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005)
251 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001)
252 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002)
253 #define STATUS_BREAKPOINT ((DWORD)0x80000003)
254 #define STATUS_SINGLE_STEP ((DWORD)0x80000004)
255 #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005)
256 #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006)
257 #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008)
258 #define STATUS_NO_MEMORY ((DWORD)0xC0000017)
259 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D)
260 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025)
261 #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026)
262 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C)
263 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D)
264 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E)
265 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F)
266 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090)
267 #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091)
268 #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092)
269 #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093)
270 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094)
271 #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095)
272 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096)
273 #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD)
274 #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A)
275 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4)
276 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5)
277 #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9)
278 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F)
279 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010)
280
281 #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001)
282 #define DBG_CONTINUE ((DWORD)0x00010002)
283 #define DBG_TERMINATE_THREAD ((DWORD)0x40010003)
284 #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004)
285 #define DBG_CONTROL_C ((DWORD)0x40010005)
286 #define DBG_CONTROL_BREAK ((DWORD)0x40010008)
287 #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009)
288 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001)
289
290 #endif /* WIN32_NO_STATUS */
291
292 #define MAXIMUM_ALLOWED 0x2000000
293 #define GENERIC_READ 0x80000000
294 #define GENERIC_WRITE 0x40000000
295 #define GENERIC_EXECUTE 0x20000000
296 #define GENERIC_ALL 0x10000000
297
298 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1)
299
300 /* Also in ddk/winddk.h */
301 #define FILE_LIST_DIRECTORY 0x00000001
302 #define FILE_READ_DATA 0x00000001
303 #define FILE_ADD_FILE 0x00000002
304 #define FILE_WRITE_DATA 0x00000002
305 #define FILE_ADD_SUBDIRECTORY 0x00000004
306 #define FILE_APPEND_DATA 0x00000004
307 #define FILE_CREATE_PIPE_INSTANCE 0x00000004
308 #define FILE_READ_EA 0x00000008
309 #define FILE_READ_PROPERTIES 0x00000008
310 #define FILE_WRITE_EA 0x00000010
311 #define FILE_WRITE_PROPERTIES 0x00000010
312 #define FILE_EXECUTE 0x00000020
313 #define FILE_TRAVERSE 0x00000020
314 #define FILE_DELETE_CHILD 0x00000040
315 #define FILE_READ_ATTRIBUTES 0x00000080
316 #define FILE_WRITE_ATTRIBUTES 0x00000100
317
318 #define FILE_SHARE_READ 0x00000001
319 #define FILE_SHARE_WRITE 0x00000002
320 #define FILE_SHARE_DELETE 0x00000004
321 #define FILE_SHARE_VALID_FLAGS 0x00000007
322
323 #define FILE_ATTRIBUTE_READONLY 0x00000001
324 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
325 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
326 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
327 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
328 #define FILE_ATTRIBUTE_DEVICE 0x00000040
329 #define FILE_ATTRIBUTE_NORMAL 0x00000080
330 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
331 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
332 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
333 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
334 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
335 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
336 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
337 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7
338 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7
339
340 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041
341 #define FILE_STRUCTURED_STORAGE 0x00000441
342
343 #define FILE_VALID_OPTION_FLAGS 0x00ffffff
344 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032
345 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032
346 #define FILE_VALID_SET_FLAGS 0x00000036
347
348 #define FILE_DIRECTORY_FILE 0x00000001
349 #define FILE_WRITE_THROUGH 0x00000002
350 #define FILE_SEQUENTIAL_ONLY 0x00000004
351 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008
352 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010
353 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020
354 #define FILE_NON_DIRECTORY_FILE 0x00000040
355 #define FILE_CREATE_TREE_CONNECTION 0x00000080
356 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100
357 #define FILE_NO_EA_KNOWLEDGE 0x00000200
358 #define FILE_OPEN_FOR_RECOVERY 0x00000400
359 #define FILE_RANDOM_ACCESS 0x00000800
360 #define FILE_DELETE_ON_CLOSE 0x00001000
361 #define FILE_OPEN_BY_FILE_ID 0x00002000
362 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000
363 #define FILE_NO_COMPRESSION 0x00008000
364 #define FILE_RESERVE_OPFILTER 0x00100000
365 #define FILE_OPEN_REPARSE_POINT 0x00200000
366 #define FILE_OPEN_NO_RECALL 0x00400000
367 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000
368
369 #define FILE_ALL_ACCESS \
370 (STANDARD_RIGHTS_REQUIRED | \
371 SYNCHRONIZE | \
372 0x1FF)
373
374 #define FILE_GENERIC_EXECUTE \
375 (STANDARD_RIGHTS_EXECUTE | \
376 FILE_READ_ATTRIBUTES | \
377 FILE_EXECUTE | \
378 SYNCHRONIZE)
379
380 #define FILE_GENERIC_READ \
381 (STANDARD_RIGHTS_READ | \
382 FILE_READ_DATA | \
383 FILE_READ_ATTRIBUTES | \
384 FILE_READ_EA | \
385 SYNCHRONIZE)
386
387 #define FILE_GENERIC_WRITE \
388 (STANDARD_RIGHTS_WRITE | \
389 FILE_WRITE_DATA | \
390 FILE_WRITE_ATTRIBUTES | \
391 FILE_WRITE_EA | \
392 FILE_APPEND_DATA | \
393 SYNCHRONIZE)
394 /* end winddk.h */
395 /* also in ddk/ntifs.h */
396 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
397 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
398 #define FILE_NOTIFY_CHANGE_NAME 0x00000003
399 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
400 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
401 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
402 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
403 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
404 #define FILE_NOTIFY_CHANGE_EA 0x00000080
405 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
406 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
407 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
408 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
409 #define FILE_NOTIFY_VALID_MASK 0x00000fff
410
411 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
412 #define FILE_CASE_PRESERVED_NAMES 0x00000002
413 #define FILE_UNICODE_ON_DISK 0x00000004
414 #define FILE_PERSISTENT_ACLS 0x00000008
415 #define FILE_FILE_COMPRESSION 0x00000010
416 #define FILE_VOLUME_QUOTAS 0x00000020
417 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
418 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
419 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100
420 #define FS_LFN_APIS 0x00004000
421 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
422 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
423 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
424 #define FILE_NAMED_STREAMS 0x00040000
425
426 #define IO_COMPLETION_QUERY_STATE 0x0001
427 #define IO_COMPLETION_MODIFY_STATE 0x0002
428 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
429 /* end ntifs.h */
430
431 /* also in ddk/winddk.h */
432 #define DUPLICATE_CLOSE_SOURCE 0x00000001
433 #define DUPLICATE_SAME_ACCESS 0x00000002
434 /* end winddk.k */
435
436 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
437 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
438 #define PROCESS_TERMINATE 1
439 #define PROCESS_CREATE_THREAD 2
440 #define PROCESS_SET_SESSIONID 4
441 #define PROCESS_VM_OPERATION 8
442 #define PROCESS_VM_READ 16
443 #define PROCESS_VM_WRITE 32
444 #define PROCESS_DUP_HANDLE 64
445 #define PROCESS_CREATE_PROCESS 128
446 #define PROCESS_SET_QUOTA 256
447 #define PROCESS_SET_INFORMATION 512
448 #define PROCESS_QUERY_INFORMATION 1024
449 #define PROCESS_SUSPEND_RESUME 2048
450 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF)
451 #define THREAD_TERMINATE 1
452 #define THREAD_SUSPEND_RESUME 2
453 #define THREAD_GET_CONTEXT 8
454 #define THREAD_SET_CONTEXT 16
455 #define THREAD_SET_INFORMATION 32
456 #define THREAD_QUERY_INFORMATION 64
457 #define THREAD_SET_THREAD_TOKEN 128
458 #define THREAD_IMPERSONATE 256
459 #define THREAD_DIRECT_IMPERSONATION 0x200
460 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF)
461 #define THREAD_BASE_PRIORITY_LOWRT 15
462 #define THREAD_BASE_PRIORITY_MAX 2
463 #define THREAD_BASE_PRIORITY_MIN (-2)
464 #define THREAD_BASE_PRIORITY_IDLE (-15)
465 #define EXCEPTION_NONCONTINUABLE 1
466 #define EXCEPTION_MAXIMUM_PARAMETERS 15
467 #define MUTANT_QUERY_STATE 0x0001
468 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
469 #define TIMER_QUERY_STATE 0x0001
470 #define TIMER_MODIFY_STATE 0x0002
471 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE)
472 /*
473 * To prevent gcc compiler warnings, bracket these defines when initialising
474 * a SID_IDENTIFIER_AUTHORITY, eg.
475 * SID_IDENTIFIER_AUTHORITY aNullSidAuthority = {SECURITY_NULL_SID_AUTHORITY};
476 */
477 #define SID_MAX_SUB_AUTHORITIES 15
478 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
479 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
480 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
481 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
482 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
483 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
484 #define SECURITY_NULL_RID 0
485 #define SECURITY_WORLD_RID (0x00000000L)
486 #define SECURITY_LOCAL_RID 0
487 #define SECURITY_CREATOR_OWNER_RID 0
488 #define SECURITY_CREATOR_GROUP_RID 1
489 #define SECURITY_DIALUP_RID 1
490 #define SECURITY_NETWORK_RID 2
491 #define SECURITY_BATCH_RID 3
492 #define SECURITY_INTERACTIVE_RID 4
493 #define SECURITY_LOGON_IDS_RID 5
494 #define SECURITY_SERVICE_RID 6
495 #define SECURITY_LOCAL_SYSTEM_RID 18
496 #define SECURITY_BUILTIN_DOMAIN_RID 32
497 #define SECURITY_PRINCIPAL_SELF_RID 10
498 #define SECURITY_CREATOR_OWNER_SERVER_RID 0x2
499 #define SECURITY_CREATOR_GROUP_SERVER_RID 0x3
500 #define SECURITY_LOGON_IDS_RID_COUNT 0x3
501 #define SECURITY_ANONYMOUS_LOGON_RID 0x7
502 #define SECURITY_PROXY_RID 0x8
503 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x9
504 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
505 #define SECURITY_AUTHENTICATED_USER_RID 0xB
506 #define SECURITY_RESTRICTED_CODE_RID 0xC
507 #define SECURITY_NT_NON_UNIQUE_RID 0x15
508 #define SID_REVISION 1
509 #define DOMAIN_USER_RID_ADMIN 0x1F4L
510 #define DOMAIN_USER_RID_GUEST 0x1F5L
511 #define DOMAIN_GROUP_RID_ADMINS 0x200L
512 #define DOMAIN_GROUP_RID_USERS 0x201L
513 #define DOMAIN_ALIAS_RID_ADMINS 0x220L
514 #define DOMAIN_ALIAS_RID_USERS 0x221L
515 #define DOMAIN_ALIAS_RID_GUESTS 0x222L
516 #define DOMAIN_ALIAS_RID_POWER_USERS 0x223L
517 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x224L
518 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x225L
519 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x226L
520 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x227L
521 #define DOMAIN_ALIAS_RID_REPLICATOR 0x228L
522
523 typedef enum
524 {
525 WinNullSid = 0,
526 WinWorldSid,
527 WinLocalSid,
528 WinCreatorOwnerSid,
529 WinCreatorGroupSid,
530 WinCreatorOwnerServerSid,
531 WinCreatorGroupServerSid,
532 WinNtAuthoritySid,
533 WinDialupSid,
534 WinNetworkSid,
535 WinBatchSid,
536 WinInteractiveSid,
537 WinServiceSid,
538 WinAnonymousSid,
539 WinProxySid,
540 WinEnterpriseControllersSid,
541 WinSelfSid,
542 WinAuthenticatedUserSid,
543 WinRestrictedCodeSid,
544 WinTerminalServerSid,
545 WinRemoteLogonIdSid,
546 WinLogonIdsSid,
547 WinLocalSystemSid,
548 WinLocalServiceSid,
549 WinNetworkServiceSid,
550 WinBuiltinDomainSid,
551 WinBuiltinAdministratorsSid,
552 WinBuiltinUsersSid,
553 WinBuiltinGuestsSid,
554 WinBuiltinPowerUsersSid,
555 WinBuiltinAccountOperatorsSid,
556 WinBuiltinSystemOperatorsSid,
557 WinBuiltinPrintOperatorsSid,
558 WinBuiltinBackupOperatorsSid,
559 WinBuiltinReplicatorSid,
560 WinBuiltinPreWindows2000CompatibleAccessSid,
561 WinBuiltinRemoteDesktopUsersSid,
562 WinBuiltinNetworkConfigurationOperatorsSid,
563 WinAccountAdministratorSid,
564 WinAccountGuestSid,
565 WinAccountKrbtgtSid,
566 WinAccountDomainAdminsSid,
567 WinAccountDomainUsersSid,
568 WinAccountDomainGuestsSid,
569 WinAccountComputersSid,
570 WinAccountControllersSid,
571 WinAccountCertAdminsSid,
572 WinAccountSchemaAdminsSid,
573 WinAccountEnterpriseAdminsSid,
574 WinAccountPolicyAdminsSid,
575 WinAccountRasAndIasServersSid,
576 WinNTLMAuthenticationSid,
577 WinDigestAuthenticationSid,
578 WinSChannelAuthenticationSid,
579 WinThisOrganizationSid,
580 WinOtherOrganizationSid,
581 WinBuiltinIncomingForestTrustBuildersSid,
582 WinBuiltinPerfMonitoringUsersSid,
583 WinBuiltinPerfLoggingUsersSid,
584 WinBuiltinAuthorizationAccessSid,
585 WinBuiltinTerminalServerLicenseServersSid,
586 WinBuiltinDCOMUsersSid
587 } WELL_KNOWN_SID_TYPE;
588
589 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
590 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
591 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
592 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
593 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
594 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
595 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
596 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
597 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
598 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
599 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
600 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
601 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
602 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
603 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
604 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
605 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
606 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
607 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
608 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
609 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
610 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
611 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
612 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
613 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
614 #define SE_GROUP_MANDATORY 1
615 #define SE_GROUP_ENABLED_BY_DEFAULT 2
616 #define SE_GROUP_ENABLED 4
617 #define SE_GROUP_OWNER 8
618 #define SE_GROUP_USE_FOR_DENY_ONLY 16
619 #define SE_GROUP_LOGON_ID 3221225472U
620 #define SE_GROUP_RESOURCE 536870912
621 #define LANG_NEUTRAL 0x00
622 #define LANG_ARABIC 0x01
623 #define LANG_BULGARIAN 0x02
624 #define LANG_CATALAN 0x03
625 #define LANG_CHINESE 0x04
626 #define LANG_CZECH 0x05
627 #define LANG_DANISH 0x06
628 #define LANG_GERMAN 0x07
629 #define LANG_GREEK 0x08
630 #define LANG_ENGLISH 0x09
631 #define LANG_SPANISH 0x0a
632 #define LANG_FINNISH 0x0b
633 #define LANG_FRENCH 0x0c
634 #define LANG_HEBREW 0x0d
635 #define LANG_HUNGARIAN 0x0e
636 #define LANG_ICELANDIC 0x0f
637 #define LANG_ITALIAN 0x10
638 #define LANG_JAPANESE 0x11
639 #define LANG_KOREAN 0x12
640 #define LANG_DUTCH 0x13
641 #define LANG_NORWEGIAN 0x14
642 #define LANG_POLISH 0x15
643 #define LANG_PORTUGUESE 0x16
644 #define LANG_ROMANIAN 0x18
645 #define LANG_RUSSIAN 0x19
646 #define LANG_CROATIAN 0x1a
647 #define LANG_SERBIAN 0x1a
648 #define LANG_SLOVAK 0x1b
649 #define LANG_ALBANIAN 0x1c
650 #define LANG_SWEDISH 0x1d
651 #define LANG_THAI 0x1e
652 #define LANG_TURKISH 0x1f
653 #define LANG_URDU 0x20
654 #define LANG_INDONESIAN 0x21
655 #define LANG_UKRAINIAN 0x22
656 #define LANG_BELARUSIAN 0x23
657 #define LANG_SLOVENIAN 0x24
658 #define LANG_ESTONIAN 0x25
659 #define LANG_LATVIAN 0x26
660 #define LANG_LITHUANIAN 0x27
661 #define LANG_FARSI 0x29
662 #define LANG_VIETNAMESE 0x2a
663 #define LANG_ARMENIAN 0x2b
664 #define LANG_AZERI 0x2c
665 #define LANG_BASQUE 0x2d
666 #define LANG_MACEDONIAN 0x2f
667 #define LANG_AFRIKAANS 0x36
668 #define LANG_GEORGIAN 0x37
669 #define LANG_FAEROESE 0x38
670 #define LANG_HINDI 0x39
671 #define LANG_MALAY 0x3e
672 #define LANG_KAZAK 0x3f
673 #define LANG_KYRGYZ 0x40
674 #define LANG_SWAHILI 0x41
675 #define LANG_UZBEK 0x43
676 #define LANG_TATAR 0x44
677 #define LANG_BENGALI 0x45
678 #define LANG_PUNJABI 0x46
679 #define LANG_GUJARATI 0x47
680 #define LANG_ORIYA 0x48
681 #define LANG_TAMIL 0x49
682 #define LANG_TELUGU 0x4a
683 #define LANG_KANNADA 0x4b
684 #define LANG_MALAYALAM 0x4c
685 #define LANG_ASSAMESE 0x4d
686 #define LANG_MARATHI 0x4e
687 #define LANG_SANSKRIT 0x4f
688 #define LANG_MONGOLIAN 0x50
689 #define LANG_GALICIAN 0x56
690 #define LANG_KONKANI 0x57
691 #define LANG_MANIPURI 0x58
692 #define LANG_SINDHI 0x59
693 #define LANG_SYRIAC 0x5a
694 #define LANG_KASHMIRI 0x60
695 #define LANG_NEPALI 0x61
696 #define LANG_DIVEHI 0x65
697 #define LANG_INVARIANT 0x7f
698 #define SUBLANG_NEUTRAL 0x00
699 #define SUBLANG_DEFAULT 0x01
700 #define SUBLANG_SYS_DEFAULT 0x02
701 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
702 #define SUBLANG_ARABIC_IRAQ 0x02
703 #define SUBLANG_ARABIC_EGYPT 0x03
704 #define SUBLANG_ARABIC_LIBYA 0x04
705 #define SUBLANG_ARABIC_ALGERIA 0x05
706 #define SUBLANG_ARABIC_MOROCCO 0x06
707 #define SUBLANG_ARABIC_TUNISIA 0x07
708 #define SUBLANG_ARABIC_OMAN 0x08
709 #define SUBLANG_ARABIC_YEMEN 0x09
710 #define SUBLANG_ARABIC_SYRIA 0x0a
711 #define SUBLANG_ARABIC_JORDAN 0x0b
712 #define SUBLANG_ARABIC_LEBANON 0x0c
713 #define SUBLANG_ARABIC_KUWAIT 0x0d
714 #define SUBLANG_ARABIC_UAE 0x0e
715 #define SUBLANG_ARABIC_BAHRAIN 0x0f
716 #define SUBLANG_ARABIC_QATAR 0x10
717 #define SUBLANG_AZERI_LATIN 0x01
718 #define SUBLANG_AZERI_CYRILLIC 0x02
719 #define SUBLANG_CHINESE_TRADITIONAL 0x01
720 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
721 #define SUBLANG_CHINESE_HONGKONG 0x03
722 #define SUBLANG_CHINESE_SINGAPORE 0x04
723 #define SUBLANG_CHINESE_MACAU 0x05
724 #define SUBLANG_DUTCH 0x01
725 #define SUBLANG_DUTCH_BELGIAN 0x02
726 #define SUBLANG_ENGLISH_US 0x01
727 #define SUBLANG_ENGLISH_UK 0x02
728 #define SUBLANG_ENGLISH_AUS 0x03
729 #define SUBLANG_ENGLISH_CAN 0x04
730 #define SUBLANG_ENGLISH_NZ 0x05
731 #define SUBLANG_ENGLISH_EIRE 0x06
732 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
733 #define SUBLANG_ENGLISH_JAMAICA 0x08
734 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
735 #define SUBLANG_ENGLISH_BELIZE 0x0a
736 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
737 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
738 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
739 #define SUBLANG_FRENCH 0x01
740 #define SUBLANG_FRENCH_BELGIAN 0x02
741 #define SUBLANG_FRENCH_CANADIAN 0x03
742 #define SUBLANG_FRENCH_SWISS 0x04
743 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
744 #define SUBLANG_FRENCH_MONACO 0x06
745 #define SUBLANG_GERMAN 0x01
746 #define SUBLANG_GERMAN_SWISS 0x02
747 #define SUBLANG_GERMAN_AUSTRIAN 0x03
748 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
749 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
750 #define SUBLANG_ITALIAN 0x01
751 #define SUBLANG_ITALIAN_SWISS 0x02
752 #define SUBLANG_KASHMIRI_INDIA 0x02
753 #define SUBLANG_KASHMIRI_SASIA 0x02
754 #define SUBLANG_KOREAN 0x01
755 #define SUBLANG_LITHUANIAN 0x01
756 #define SUBLANG_MALAY_MALAYSIA 0x01
757 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
758 #define SUBLANG_NEPALI_INDIA 0x02
759 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
760 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
761 #define SUBLANG_PORTUGUESE 0x01
762 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x02
763 #define SUBLANG_SERBIAN_LATIN 0x02
764 #define SUBLANG_SERBIAN_CYRILLIC 0x03
765 #define SUBLANG_SPANISH 0x01
766 #define SUBLANG_SPANISH_MEXICAN 0x02
767 #define SUBLANG_SPANISH_MODERN 0x03
768 #define SUBLANG_SPANISH_GUATEMALA 0x04
769 #define SUBLANG_SPANISH_COSTA_RICA 0x05
770 #define SUBLANG_SPANISH_PANAMA 0x06
771 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
772 #define SUBLANG_SPANISH_VENEZUELA 0x08
773 #define SUBLANG_SPANISH_COLOMBIA 0x09
774 #define SUBLANG_SPANISH_PERU 0x0a
775 #define SUBLANG_SPANISH_ARGENTINA 0x0b
776 #define SUBLANG_SPANISH_ECUADOR 0x0c
777 #define SUBLANG_SPANISH_CHILE 0x0d
778 #define SUBLANG_SPANISH_URUGUAY 0x0e
779 #define SUBLANG_SPANISH_PARAGUAY 0x0f
780 #define SUBLANG_SPANISH_BOLIVIA 0x10
781 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
782 #define SUBLANG_SPANISH_HONDURAS 0x12
783 #define SUBLANG_SPANISH_NICARAGUA 0x13
784 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
785 #define SUBLANG_SWEDISH 0x01
786 #define SUBLANG_SWEDISH_FINLAND 0x02
787 #define SUBLANG_URDU_PAKISTAN 0x01
788 #define SUBLANG_URDU_INDIA 0x02
789 #define SUBLANG_UZBEK_LATIN 0x01
790 #define SUBLANG_UZBEK_CYRILLIC 0x02
791 #define NLS_VALID_LOCALE_MASK 1048575
792 #define SORT_DEFAULT 0
793 #define SORT_JAPANESE_XJIS 0
794 #define SORT_JAPANESE_UNICODE 1
795 #define SORT_CHINESE_BIG5 0
796 #define SORT_CHINESE_PRCP 0
797 #define SORT_CHINESE_UNICODE 1
798 #define SORT_CHINESE_PRC 2
799 #define SORT_CHINESE_BOPOMOFO 3
800 #define SORT_KOREAN_KSC 0
801 #define SORT_KOREAN_UNICODE 1
802 #define SORT_GERMAN_PHONE_BOOK 1
803 #define SORT_HUNGARIAN_DEFAULT 0
804 #define SORT_HUNGARIAN_TECHNICAL 1
805 #define SORT_GEORGIAN_TRADITIONAL 0
806 #define SORT_GEORGIAN_MODERN 1
807 #define MAKELANGID(p,s) ((((WORD)(s))<<10)|(WORD)(p))
808 #define MAKELCID(l,s) ((DWORD)((((DWORD)((WORD)(s)))<<16)|((DWORD)((WORD)(l)))))
809 #define PRIMARYLANGID(l) ((WORD)(l)&0x3ff)
810 #define SORTIDFROMLCID(l) ((WORD)((((DWORD)(l))&NLS_VALID_LOCALE_MASK)>>16))
811 #define SORTVERSIONFROMLCID(l) ((WORD)((((DWORD)(l))>>20)&0xf))
812 #define SUBLANGID(l) ((WORD)(l)>>10)
813 #define LANGIDFROMLCID(l) ((WORD)(l))
814 #define LANG_SYSTEM_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_SYS_DEFAULT)
815 #define LANG_USER_DEFAULT MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT)
816 #define LOCALE_NEUTRAL MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT)
817 #define ACL_REVISION 2
818 #define ACL_REVISION_DS 4
819 #define ACL_REVISION1 1
820 #define ACL_REVISION2 2
821 #define ACL_REVISION3 3
822 #define ACL_REVISION4 4
823 #define MIN_ACL_REVISION 2
824 #define MAX_ACL_REVISION 4
825 #define MINCHAR 0x80
826 #define MAXCHAR 0x7f
827 #define MINSHORT 0x8000
828 #define MAXSHORT 0x7fff
829 #define MINLONG 0x80000000
830 #define MAXLONG 0x7fffffff
831 #define MAXBYTE 0xff
832 #define MAXWORD 0xffff
833 #define MAXDWORD 0xffffffff
834 #define PROCESSOR_INTEL_386 386
835 #define PROCESSOR_INTEL_486 486
836 #define PROCESSOR_INTEL_PENTIUM 586
837 #define PROCESSOR_MIPS_R4000 4000
838 #define PROCESSOR_ALPHA_21064 21064
839 #define PROCESSOR_INTEL_IA64 2200
840 #define PROCESSOR_PPC_601 601
841 #define PROCESSOR_PPC_603 603
842 #define PROCESSOR_PPC_604 604
843 #define PROCESSOR_PPC_620 620
844 #define PROCESSOR_ARCHITECTURE_INTEL 0
845 #define PROCESSOR_ARCHITECTURE_MIPS 1
846 #define PROCESSOR_ARCHITECTURE_ALPHA 2
847 #define PROCESSOR_ARCHITECTURE_PPC 3
848 #define PROCESSOR_ARCHITECTURE_SHX 4
849 #define PROCESSOR_ARCHITECTURE_ARM 5
850 #define PROCESSOR_ARCHITECTURE_IA64 6
851 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
852 #define PROCESSOR_ARCHITECTURE_MSIL 8
853 #define PROCESSOR_ARCHITECTURE_AMD64 9
854 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
855 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
856 #define PF_FLOATING_POINT_EMULATED 1
857 #define PF_COMPARE_EXCHANGE_DOUBLE 2
858 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
859 #define PF_PPC_MOVEMEM_64BIT_OK 4
860 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
861 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
862 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
863 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
864 #define PF_PAE_ENABLED 9
865 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
866 /* also in ddk/ntifs.h */
867 #define FILE_ACTION_ADDED 0x00000001
868 #define FILE_ACTION_REMOVED 0x00000002
869 #define FILE_ACTION_MODIFIED 0x00000003
870 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
871 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
872 #define FILE_ACTION_ADDED_STREAM 0x00000006
873 #define FILE_ACTION_REMOVED_STREAM 0x00000007
874 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
875 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009
876 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A
877 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B
878 /* end ntifs.h */
879 #define HEAP_NO_SERIALIZE 1
880 #define HEAP_GROWABLE 2
881 #define HEAP_GENERATE_EXCEPTIONS 4
882 #define HEAP_ZERO_MEMORY 8
883 #define HEAP_REALLOC_IN_PLACE_ONLY 16
884 #define HEAP_TAIL_CHECKING_ENABLED 32
885 #define HEAP_FREE_CHECKING_ENABLED 64
886 #define HEAP_DISABLE_COALESCE_ON_FREE 128
887 #define HEAP_CREATE_ALIGN_16 0x0000
888 #define HEAP_CREATE_ENABLE_TRACING 0x20000
889 #define HEAP_MAXIMUM_TAG 0xFFF
890 #define HEAP_PSEUDO_TAG_FLAG 0x8000
891 #define HEAP_TAG_SHIFT 16
892 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16)))
893 #define KEY_QUERY_VALUE 1
894 #define KEY_SET_VALUE 2
895 #define KEY_CREATE_SUB_KEY 4
896 #define KEY_ENUMERATE_SUB_KEYS 8
897 #define KEY_NOTIFY 16
898 #define KEY_CREATE_LINK 32
899 #define KEY_WRITE 0x20006
900 #define KEY_EXECUTE 0x20019
901 #define KEY_READ 0x20019
902 #define KEY_ALL_ACCESS 0xf003f
903 #define REG_WHOLE_HIVE_VOLATILE 1
904 #define REG_REFRESH_HIVE 2
905 #define REG_NO_LAZY_FLUSH 4
906 #define REG_OPTION_RESERVED 0
907 #define REG_OPTION_NON_VOLATILE 0
908 #define REG_OPTION_VOLATILE 1
909 #define REG_OPTION_CREATE_LINK 2
910 #define REG_OPTION_BACKUP_RESTORE 4
911 #define REG_OPTION_OPEN_LINK 8
912 #define REG_LEGAL_OPTION 15
913 #define OWNER_SECURITY_INFORMATION 1
914 #define GROUP_SECURITY_INFORMATION 2
915 #define DACL_SECURITY_INFORMATION 4
916 #define SACL_SECURITY_INFORMATION 8
917 #define PROTECTED_DACL_SECURITY_INFORMATION 0x80000000
918 #define PROTECTED_SACL_SECURITY_INFORMATION 0x40000000
919 #define UNPROTECTED_DACL_SECURITY_INFORMATION 0x20000000
920 #define UNPROTECTED_SACL_SECURITY_INFORMATION 0x10000000
921 #define MAXIMUM_PROCESSORS 32
922 #define PAGE_NOACCESS 0x0001
923 #define PAGE_READONLY 0x0002
924 #define PAGE_READWRITE 0x0004
925 #define PAGE_WRITECOPY 0x0008
926 #define PAGE_EXECUTE 0x0010
927 #define PAGE_EXECUTE_READ 0x0020
928 #define PAGE_EXECUTE_READWRITE 0x0040
929 #define PAGE_EXECUTE_WRITECOPY 0x0080
930 #define PAGE_GUARD 0x0100
931 #define PAGE_NOCACHE 0x0200
932 #define PAGE_WRITECOMBINE 0x0400
933 #define MEM_COMMIT 0x1000
934 #define MEM_RESERVE 0x2000
935 #define MEM_DECOMMIT 0x4000
936 #define MEM_RELEASE 0x8000
937 #define MEM_FREE 0x10000
938 #define MEM_PRIVATE 0x20000
939 #define MEM_MAPPED 0x40000
940 #define MEM_RESET 0x80000
941 #define MEM_TOP_DOWN 0x100000
942 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */
943 #define MEM_PHYSICAL 0x400000
944 #define MEM_4MB_PAGES 0x80000000
945 /* also in ddk/ntifs.h */
946 #define MEM_IMAGE SEC_IMAGE
947 #define SEC_BASED 0x00200000
948 #define SEC_NO_CHANGE 0x00400000
949 #define SEC_FILE 0x00800000
950 #define SEC_IMAGE 0x01000000
951 #define SEC_VLM 0x02000000
952 #define SEC_RESERVE 0x04000000
953 #define SEC_COMMIT 0x08000000
954 #define SEC_NOCACHE 0x10000000
955 /* end ntifs.h */
956 #define SECTION_EXTEND_SIZE 16
957 #define SECTION_MAP_READ 4
958 #define SECTION_MAP_WRITE 2
959 #define SECTION_QUERY 1
960 #define SECTION_MAP_EXECUTE 8
961 #define SECTION_ALL_ACCESS 0xf001f
962 #define MESSAGE_RESOURCE_UNICODE 1
963 #define RTL_CRITSECT_TYPE 0
964 #define RTL_RESOURCE_TYPE 1
965 /* Also in winddk.h */
966 #define FIELD_OFFSET(t,f) ((LONG)&(((t*)0)->f))
967 #ifndef CONTAINING_RECORD
968 #define CONTAINING_RECORD(address, type, field) \
969 ((type *)(((ULONG_PTR)address) - (ULONG_PTR)(&(((type *)0)->field))))
970 #endif
971 /* end winddk.h */
972 #define IMAGE_SIZEOF_FILE_HEADER 20
973 #define IMAGE_FILE_RELOCS_STRIPPED 1
974 #define IMAGE_FILE_EXECUTABLE_IMAGE 2
975 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4
976 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8
977 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16
978 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32
979 #define IMAGE_FILE_BYTES_REVERSED_LO 128
980 #define IMAGE_FILE_32BIT_MACHINE 256
981 #define IMAGE_FILE_DEBUG_STRIPPED 512
982 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024
983 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048
984 #define IMAGE_FILE_SYSTEM 4096
985 #define IMAGE_FILE_DLL 8192
986 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384
987 #define IMAGE_FILE_BYTES_REVERSED_HI 32768
988 #define IMAGE_FILE_MACHINE_UNKNOWN 0
989 #define IMAGE_FILE_MACHINE_I386 332
990 #define IMAGE_FILE_MACHINE_R3000 354
991 #define IMAGE_FILE_MACHINE_R4000 358
992 #define IMAGE_FILE_MACHINE_R10000 360
993 #define IMAGE_FILE_MACHINE_ALPHA 388
994 #define IMAGE_FILE_MACHINE_POWERPC 496
995 #define IMAGE_FILE_MACHINE_IA64 512
996 #define IMAGE_FILE_MACHINE_AMD64 0x8664
997 #define IMAGE_DOS_SIGNATURE 0x5A4D
998 #define IMAGE_OS2_SIGNATURE 0x454E
999 #define IMAGE_OS2_SIGNATURE_LE 0x454C
1000 #define IMAGE_VXD_SIGNATURE 0x454C
1001 #define IMAGE_NT_SIGNATURE 0x00004550
1002 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
1003 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
1004 #ifdef _WIN64
1005 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
1006 #else
1007 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
1008 #endif
1009 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1010 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
1011 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1012 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1013 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1014 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1015 #define IMAGE_SIZEOF_SHORT_NAME 8
1016 #define IMAGE_SIZEOF_SECTION_HEADER 40
1017 #define IMAGE_SIZEOF_SYMBOL 18
1018 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1019 #define IMAGE_SIZEOF_RELOCATION 10
1020 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1021 #define IMAGE_SIZEOF_LINENUMBER 6
1022 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1023 #define SIZEOF_RFPO_DATA 16
1024 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1025 #define IMAGE_SUBSYSTEM_NATIVE 1
1026 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2
1027 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3
1028 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1029 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1030 #define IMAGE_SUBSYSTEM_XBOX 14
1031 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
1032 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
1033 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
1034 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
1035 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
1036 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((DWORD)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader))
1037 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1038 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1039 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1040 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1041 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1042 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1043 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1044 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1045 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8
1046 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1047 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1048 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1049 #define IMAGE_DIRECTORY_ENTRY_IAT 12
1050 #define IMAGE_SCN_TYPE_REG 0
1051 #define IMAGE_SCN_TYPE_DSECT 1
1052 #define IMAGE_SCN_TYPE_NOLOAD 2
1053 #define IMAGE_SCN_TYPE_GROUP 4
1054 #define IMAGE_SCN_TYPE_NO_PAD 8
1055 #define IMAGE_SCN_CNT_CODE 32
1056 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64
1057 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128
1058 #define IMAGE_SCN_LNK_OTHER 256
1059 #define IMAGE_SCN_LNK_INFO 512
1060 #define IMAGE_SCN_LNK_REMOVE 2048
1061 #define IMAGE_SCN_LNK_COMDAT 4096
1062 #define IMAGE_SCN_MEM_FARDATA 0x8000
1063 #define IMAGE_SCN_MEM_PURGEABLE 0x20000
1064 #define IMAGE_SCN_MEM_16BIT 0x20000
1065 #define IMAGE_SCN_MEM_LOCKED 0x40000
1066 #define IMAGE_SCN_MEM_PRELOAD 0x80000
1067 #define IMAGE_SCN_ALIGN_1BYTES 0x100000
1068 #define IMAGE_SCN_ALIGN_2BYTES 0x200000
1069 #define IMAGE_SCN_ALIGN_4BYTES 0x300000
1070 #define IMAGE_SCN_ALIGN_8BYTES 0x400000
1071 #define IMAGE_SCN_ALIGN_16BYTES 0x500000
1072 #define IMAGE_SCN_ALIGN_32BYTES 0x600000
1073 #define IMAGE_SCN_ALIGN_64BYTES 0x700000
1074 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000
1075 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000
1076 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000
1077 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000
1078 #define IMAGE_SCN_MEM_SHARED 0x10000000
1079 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1080 #define IMAGE_SCN_MEM_READ 0x40000000
1081 #define IMAGE_SCN_MEM_WRITE 0x80000000
1082 #define IMAGE_SYM_UNDEFINED 0
1083 #define IMAGE_SYM_ABSOLUTE (-1)
1084 #define IMAGE_SYM_DEBUG (-2)
1085 #define IMAGE_SYM_TYPE_NULL 0
1086 #define IMAGE_SYM_TYPE_VOID 1
1087 #define IMAGE_SYM_TYPE_CHAR 2
1088 #define IMAGE_SYM_TYPE_SHORT 3
1089 #define IMAGE_SYM_TYPE_INT 4
1090 #define IMAGE_SYM_TYPE_LONG 5
1091 #define IMAGE_SYM_TYPE_FLOAT 6
1092 #define IMAGE_SYM_TYPE_DOUBLE 7
1093 #define IMAGE_SYM_TYPE_STRUCT 8
1094 #define IMAGE_SYM_TYPE_UNION 9
1095 #define IMAGE_SYM_TYPE_ENUM 10
1096 #define IMAGE_SYM_TYPE_MOE 11
1097 #define IMAGE_SYM_TYPE_BYTE 12
1098 #define IMAGE_SYM_TYPE_WORD 13
1099 #define IMAGE_SYM_TYPE_UINT 14
1100 #define IMAGE_SYM_TYPE_DWORD 15
1101 #define IMAGE_SYM_TYPE_PCODE 32768
1102 #define IMAGE_SYM_DTYPE_NULL 0
1103 #define IMAGE_SYM_DTYPE_POINTER 1
1104 #define IMAGE_SYM_DTYPE_FUNCTION 2
1105 #define IMAGE_SYM_DTYPE_ARRAY 3
1106 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1)
1107 #define IMAGE_SYM_CLASS_NULL 0
1108 #define IMAGE_SYM_CLASS_AUTOMATIC 1
1109 #define IMAGE_SYM_CLASS_EXTERNAL 2
1110 #define IMAGE_SYM_CLASS_STATIC 3
1111 #define IMAGE_SYM_CLASS_REGISTER 4
1112 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5
1113 #define IMAGE_SYM_CLASS_LABEL 6
1114 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7
1115 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8
1116 #define IMAGE_SYM_CLASS_ARGUMENT 9
1117 #define IMAGE_SYM_CLASS_STRUCT_TAG 10
1118 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11
1119 #define IMAGE_SYM_CLASS_UNION_TAG 12
1120 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13
1121 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14
1122 #define IMAGE_SYM_CLASS_ENUM_TAG 15
1123 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16
1124 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17
1125 #define IMAGE_SYM_CLASS_BIT_FIELD 18
1126 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68
1127 #define IMAGE_SYM_CLASS_BLOCK 100
1128 #define IMAGE_SYM_CLASS_FUNCTION 101
1129 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102
1130 #define IMAGE_SYM_CLASS_FILE 103
1131 #define IMAGE_SYM_CLASS_SECTION 104
1132 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105
1133 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1134 #define IMAGE_COMDAT_SELECT_ANY 2
1135 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1136 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1137 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1138 #define IMAGE_COMDAT_SELECT_LARGEST 6
1139 #define IMAGE_COMDAT_SELECT_NEWEST 7
1140 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1141 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1142 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1143 #define IMAGE_REL_I386_ABSOLUTE 0
1144 #define IMAGE_REL_I386_DIR16 1
1145 #define IMAGE_REL_I386_REL16 2
1146 #define IMAGE_REL_I386_DIR32 6
1147 #define IMAGE_REL_I386_DIR32NB 7
1148 #define IMAGE_REL_I386_SEG12 9
1149 #define IMAGE_REL_I386_SECTION 10
1150 #define IMAGE_REL_I386_SECREL 11
1151 #define IMAGE_REL_I386_REL32 20
1152 #define IMAGE_REL_MIPS_ABSOLUTE 0
1153 #define IMAGE_REL_MIPS_REFHALF 1
1154 #define IMAGE_REL_MIPS_REFWORD 2
1155 #define IMAGE_REL_MIPS_JMPADDR 3
1156 #define IMAGE_REL_MIPS_REFHI 4
1157 #define IMAGE_REL_MIPS_REFLO 5
1158 #define IMAGE_REL_MIPS_GPREL 6
1159 #define IMAGE_REL_MIPS_LITERAL 7
1160 #define IMAGE_REL_MIPS_SECTION 10
1161 #define IMAGE_REL_MIPS_SECREL 11
1162 #define IMAGE_REL_MIPS_SECRELLO 12
1163 #define IMAGE_REL_MIPS_SECRELHI 13
1164 #define IMAGE_REL_MIPS_REFWORDNB 34
1165 #define IMAGE_REL_MIPS_PAIR 35
1166 #define IMAGE_REL_ALPHA_ABSOLUTE 0
1167 #define IMAGE_REL_ALPHA_REFLONG 1
1168 #define IMAGE_REL_ALPHA_REFQUAD 2
1169 #define IMAGE_REL_ALPHA_GPREL32 3
1170 #define IMAGE_REL_ALPHA_LITERAL 4
1171 #define IMAGE_REL_ALPHA_LITUSE 5
1172 #define IMAGE_REL_ALPHA_GPDISP 6
1173 #define IMAGE_REL_ALPHA_BRADDR 7
1174 #define IMAGE_REL_ALPHA_HINT 8
1175 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9
1176 #define IMAGE_REL_ALPHA_REFHI 10
1177 #define IMAGE_REL_ALPHA_REFLO 11
1178 #define IMAGE_REL_ALPHA_PAIR 12
1179 #define IMAGE_REL_ALPHA_MATCH 13
1180 #define IMAGE_REL_ALPHA_SECTION 14
1181 #define IMAGE_REL_ALPHA_SECREL 15
1182 #define IMAGE_REL_ALPHA_REFLONGNB 16
1183 #define IMAGE_REL_ALPHA_SECRELLO 17
1184 #define IMAGE_REL_ALPHA_SECRELHI 18
1185 #define IMAGE_REL_PPC_ABSOLUTE 0
1186 #define IMAGE_REL_PPC_ADDR64 1
1187 #define IMAGE_REL_PPC_ADDR32 2
1188 #define IMAGE_REL_PPC_ADDR24 3
1189 #define IMAGE_REL_PPC_ADDR16 4
1190 #define IMAGE_REL_PPC_ADDR14 5
1191 #define IMAGE_REL_PPC_REL24 6
1192 #define IMAGE_REL_PPC_REL14 7
1193 #define IMAGE_REL_PPC_TOCREL16 8
1194 #define IMAGE_REL_PPC_TOCREL14 9
1195 #define IMAGE_REL_PPC_ADDR32NB 10
1196 #define IMAGE_REL_PPC_SECREL 11
1197 #define IMAGE_REL_PPC_SECTION 12
1198 #define IMAGE_REL_PPC_IFGLUE 13
1199 #define IMAGE_REL_PPC_IMGLUE 14
1200 #define IMAGE_REL_PPC_SECREL16 15
1201 #define IMAGE_REL_PPC_REFHI 16
1202 #define IMAGE_REL_PPC_REFLO 17
1203 #define IMAGE_REL_PPC_PAIR 18
1204 #define IMAGE_REL_PPC_TYPEMASK 255
1205 #define IMAGE_REL_PPC_NEG 256
1206 #define IMAGE_REL_PPC_BRTAKEN 512
1207 #define IMAGE_REL_PPC_BRNTAKEN 1024
1208 #define IMAGE_REL_PPC_TOCDEFN 2048
1209 #define IMAGE_REL_BASED_ABSOLUTE 0
1210 #define IMAGE_REL_BASED_HIGH 1
1211 #define IMAGE_REL_BASED_LOW 2
1212 #define IMAGE_REL_BASED_HIGHLOW 3
1213 #define IMAGE_REL_BASED_HIGHADJ 4
1214 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1215 #define IMAGE_ARCHIVE_START_SIZE 8
1216 #define IMAGE_ARCHIVE_START "!<arch>\n"
1217 #define IMAGE_ARCHIVE_END "`\n"
1218 #define IMAGE_ARCHIVE_PAD "\n"
1219 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1220 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1221 #define IMAGE_ORDINAL_FLAG 0x80000000
1222 #define IMAGE_SNAP_BY_ORDINAL(o) ((o&IMAGE_ORDINAL_FLAG)!=0)
1223 #define IMAGE_ORDINAL(o) (o&0xffff)
1224 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1225 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1226 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
1227 #define IMAGE_DEBUG_TYPE_COFF 1
1228 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
1229 #define IMAGE_DEBUG_TYPE_FPO 3
1230 #define IMAGE_DEBUG_TYPE_MISC 4
1231 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
1232 #define IMAGE_DEBUG_TYPE_FIXUP 6
1233 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
1234 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
1235 #define FRAME_FPO 0
1236 #define FRAME_TRAP 1
1237 #define FRAME_TSS 2
1238 #define FRAME_NONFPO 3
1239 #define IMAGE_DEBUG_MISC_EXENAME 1
1240 #define N_BTMASK 0x000F
1241 #define N_TMASK 0x0030
1242 #define N_TMASK1 0x00C0
1243 #define N_TMASK2 0x00F0
1244 #define N_BTSHFT 4
1245 #define N_TSHIFT 2
1246 #define IS_TEXT_UNICODE_ASCII16 1
1247 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16
1248 #define IS_TEXT_UNICODE_STATISTICS 2
1249 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32
1250 #define IS_TEXT_UNICODE_CONTROLS 4
1251 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64
1252 #define IS_TEXT_UNICODE_SIGNATURE 8
1253 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128
1254 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256
1255 #define IS_TEXT_UNICODE_ODD_LENGTH 512
1256 #define IS_TEXT_UNICODE_NULL_BYTES 4096
1257 #define IS_TEXT_UNICODE_UNICODE_MASK 15
1258 #define IS_TEXT_UNICODE_REVERSE_MASK 240
1259 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840
1260 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440
1261 #define SERVICE_KERNEL_DRIVER 1
1262 #define SERVICE_FILE_SYSTEM_DRIVER 2
1263 #define SERVICE_ADAPTER 4
1264 #define SERVICE_RECOGNIZER_DRIVER 8
1265 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER)
1266 #define SERVICE_WIN32_OWN_PROCESS 16
1267 #define SERVICE_WIN32_SHARE_PROCESS 32
1268 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS)
1269 #define SERVICE_INTERACTIVE_PROCESS 256
1270 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS)
1271 #define SERVICE_BOOT_START 0
1272 #define SERVICE_SYSTEM_START 1
1273 #define SERVICE_AUTO_START 2
1274 #define SERVICE_DEMAND_START 3
1275 #define SERVICE_DISABLED 4
1276 #define SERVICE_ERROR_IGNORE 0
1277 #define SERVICE_ERROR_NORMAL 1
1278 #define SERVICE_ERROR_SEVERE 2
1279 #define SERVICE_ERROR_CRITICAL 3
1280 #define SE_OWNER_DEFAULTED 1
1281 #define SE_GROUP_DEFAULTED 2
1282 #define SE_DACL_PRESENT 4
1283 #define SE_DACL_DEFAULTED 8
1284 #define SE_SACL_PRESENT 16
1285 #define SE_SACL_DEFAULTED 32
1286 #define SE_DACL_AUTO_INHERIT_REQ 256
1287 #define SE_SACL_AUTO_INHERIT_REQ 512
1288 #define SE_DACL_AUTO_INHERITED 1024
1289 #define SE_SACL_AUTO_INHERITED 2048
1290 #define SE_DACL_PROTECTED 4096
1291 #define SE_SACL_PROTECTED 8192
1292 #define SE_RM_CONTROL_VALID 0x4000
1293 #define SE_SELF_RELATIVE 0x8000
1294 #define SECURITY_DESCRIPTOR_MIN_LENGTH 20
1295 #define SECURITY_DESCRIPTOR_REVISION 1
1296 #define SECURITY_DESCRIPTOR_REVISION1 1
1297 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 1
1298 #define SE_PRIVILEGE_ENABLED 2
1299 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
1300 #define PRIVILEGE_SET_ALL_NECESSARY 1
1301 #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation
1302 #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation
1303 #define SECURITY_DYNAMIC_TRACKING TRUE
1304 #define SECURITY_STATIC_TRACKING FALSE
1305 /* also in ddk/ntifs.h */
1306 #define TOKEN_ASSIGN_PRIMARY (0x0001)
1307 #define TOKEN_DUPLICATE (0x0002)
1308 #define TOKEN_IMPERSONATE (0x0004)
1309 #define TOKEN_QUERY (0x0008)
1310 #define TOKEN_QUERY_SOURCE (0x0010)
1311 #define TOKEN_ADJUST_PRIVILEGES (0x0020)
1312 #define TOKEN_ADJUST_GROUPS (0x0040)
1313 #define TOKEN_ADJUST_DEFAULT (0x0080)
1314 #define TOKEN_ADJUST_SESSIONID (0x0100)
1315 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\
1316 TOKEN_ASSIGN_PRIMARY |\
1317 TOKEN_DUPLICATE |\
1318 TOKEN_IMPERSONATE |\
1319 TOKEN_QUERY |\
1320 TOKEN_QUERY_SOURCE |\
1321 TOKEN_ADJUST_PRIVILEGES |\
1322 TOKEN_ADJUST_GROUPS |\
1323 TOKEN_ADJUST_DEFAULT |\
1324 TOKEN_ADJUST_SESSIONID)
1325 #define TOKEN_READ (STANDARD_RIGHTS_READ |\
1326 TOKEN_QUERY)
1327 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\
1328 TOKEN_ADJUST_PRIVILEGES |\
1329 TOKEN_ADJUST_GROUPS |\
1330 TOKEN_ADJUST_DEFAULT)
1331
1332 #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE)
1333 #define TOKEN_SOURCE_LENGTH 8
1334 /* end ddk/ntifs.h */
1335 #define DLL_PROCESS_DETACH 0
1336 #define DLL_PROCESS_ATTACH 1
1337 #define DLL_THREAD_ATTACH 2
1338 #define DLL_THREAD_DETACH 3
1339 #define TAPE_ABSOLUTE_POSITION 0
1340 #define TAPE_LOGICAL_POSITION 1
1341 #define TAPE_PSEUDO_LOGICAL_POSITION 2
1342 #define TAPE_REWIND 0
1343 #define TAPE_ABSOLUTE_BLOCK 1
1344 #define TAPE_LOGICAL_BLOCK 2
1345 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
1346 #define TAPE_SPACE_END_OF_DATA 4
1347 #define TAPE_SPACE_RELATIVE_BLOCKS 5
1348 #define TAPE_SPACE_FILEMARKS 6
1349 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
1350 #define TAPE_SPACE_SETMARKS 8
1351 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
1352 #define TAPE_DRIVE_FIXED 1
1353 #define TAPE_DRIVE_SELECT 2
1354 #define TAPE_DRIVE_INITIATOR 4
1355 #define TAPE_DRIVE_ERASE_SHORT 16
1356 #define TAPE_DRIVE_ERASE_LONG 32
1357 #define TAPE_DRIVE_ERASE_BOP_ONLY 64
1358 #define TAPE_DRIVE_ERASE_IMMEDIATE 128
1359 #define TAPE_DRIVE_TAPE_CAPACITY 256
1360 #define TAPE_DRIVE_TAPE_REMAINING 512
1361 #define TAPE_DRIVE_FIXED_BLOCK 1024
1362 #define TAPE_DRIVE_VARIABLE_BLOCK 2048
1363 #define TAPE_DRIVE_WRITE_PROTECT 4096
1364 #define TAPE_DRIVE_EOT_WZ_SIZE 8192
1365 #define TAPE_DRIVE_ECC 0x10000
1366 #define TAPE_DRIVE_COMPRESSION 0x20000
1367 #define TAPE_DRIVE_PADDING 0x40000
1368 #define TAPE_DRIVE_REPORT_SMKS 0x80000
1369 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000
1370 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000
1371 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000
1372 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000
1373 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000
1374 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000
1375 #define TAPE_DRIVE_RESERVED_BIT 0x80000000
1376 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001
1377 #define TAPE_DRIVE_TENSION 0x80000002
1378 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004
1379 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008
1380 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010
1381 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020
1382 #define TAPE_DRIVE_TENSION_IMMED 0x80000040
1383 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080
1384 #define TAPE_DRIVE_SET_ECC 0x80000100
1385 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200
1386 #define TAPE_DRIVE_SET_PADDING 0x80000400
1387 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800
1388 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000
1389 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000
1390 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000
1391 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000
1392 #define TAPE_DRIVE_END_OF_DATA 0x80010000
1393 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000
1394 #define TAPE_DRIVE_FILEMARKS 0x80040000
1395 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000
1396 #define TAPE_DRIVE_SETMARKS 0x80100000
1397 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000
1398 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000
1399 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000
1400 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000
1401 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000
1402 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000
1403 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000
1404 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000
1405 #define TAPE_DRIVE_FORMAT 0xA0000000
1406 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000
1407 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000
1408 #define TAPE_FIXED_PARTITIONS 0
1409 #define TAPE_INITIATOR_PARTITIONS 2
1410 #define TAPE_SELECT_PARTITIONS 1
1411 #define TAPE_FILEMARKS 1
1412 #define TAPE_LONG_FILEMARKS 3
1413 #define TAPE_SETMARKS 0
1414 #define TAPE_SHORT_FILEMARKS 2
1415 #define TAPE_ERASE_LONG 1
1416 #define TAPE_ERASE_SHORT 0
1417 #define TAPE_LOAD 0
1418 #define TAPE_UNLOAD 1
1419 #define TAPE_TENSION 2
1420 #define TAPE_LOCK 3
1421 #define TAPE_UNLOCK 4
1422 #define TAPE_FORMAT 5
1423 #if (_WIN32_WINNT >= 0x0500)
1424 #define VER_MINORVERSION 0x0000001
1425 #define VER_MAJORVERSION 0x0000002
1426 #define VER_BUILDNUMBER 0x0000004
1427 #define VER_PLATFORMID 0x0000008
1428 #define VER_SERVICEPACKMINOR 0x0000010
1429 #define VER_SERVICEPACKMAJOR 0x0000020
1430 #define VER_SUITENAME 0x0000040
1431 #define VER_PRODUCT_TYPE 0x0000080
1432 #define VER_EQUAL 1
1433 #define VER_GREATER 2
1434 #define VER_GREATER_EQUAL 3
1435 #define VER_LESS 4
1436 #define VER_LESS_EQUAL 5
1437 #define VER_AND 6
1438 #define VER_OR 7
1439 #endif
1440 #define VER_PLATFORM_WIN32s 0
1441 #define VER_PLATFORM_WIN32_WINDOWS 1
1442 #define VER_PLATFORM_WIN32_NT 2
1443 #define VER_NT_WORKSTATION 1
1444 #define VER_NT_DOMAIN_CONTROLLER 2
1445 #define VER_NT_SERVER 3
1446 #define VER_SUITE_SMALLBUSINESS 1
1447 #define VER_SUITE_ENTERPRISE 2
1448 #define VER_SUITE_BACKOFFICE 4
1449 #define VER_SUITE_TERMINAL 16
1450 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 32
1451 #define VER_SUITE_EMBEDDEDNT 64
1452 #define VER_SUITE_DATACENTER 128
1453 #define VER_SUITE_SINGLEUSERTS 256
1454 #define VER_SUITE_PERSONAL 512
1455 #define VER_SUITE_BLADE 1024
1456 #define WT_EXECUTEDEFAULT 0x00000000
1457 #define WT_EXECUTEINIOTHREAD 0x00000001
1458 #define WT_EXECUTEINWAITTHREAD 0x00000004
1459 #define WT_EXECUTEONLYONCE 0x00000008
1460 #define WT_EXECUTELONGFUNCTION 0x00000010
1461 #define WT_EXECUTEINTIMERTHREAD 0x00000020
1462 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080
1463 #define WT_TRANSFER_IMPERSONATION 0x00000100
1464 #if (_WIN32_WINNT >= 0x0501)
1465 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
1466 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
1467 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
1468 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
1469 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
1470 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
1471 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
1472 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
1473 #endif /* (_WIN32_WINNT >= 0x0501) */
1474 #define BTYPE(x) ((x)&N_BTMASK)
1475 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT))
1476 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT))
1477 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT))
1478 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG)
1479 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1480 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1481 #define TLS_MINIMUM_AVAILABLE 64
1482 #define REPARSE_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer)
1483 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer)
1484 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384
1485 #define IO_REPARSE_TAG_RESERVED_ZERO 0
1486 #define IO_REPARSE_TAG_RESERVED_ONE 1
1487 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE
1488 #define IsReparseTagMicrosoft(x) ((x)&0x80000000)
1489 #define IsReparseTagHighLatency(x) ((x)&0x40000000)
1490 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000)
1491 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF
1492 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE))
1493 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO
1494 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003
1495 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL
1496 #ifndef RC_INVOKED
1497 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
1498
1499 #ifdef _GUID_DEFINED
1500 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead
1501 #endif
1502
1503 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */
1504 #define GUID_DEFINED
1505 typedef struct _GUID {
1506 unsigned long Data1;
1507 unsigned short Data2;
1508 unsigned short Data3;
1509 unsigned char Data4[8];
1510 } GUID, *REFGUID, *LPGUID;
1511 #define SYSTEM_LUID { 0x3E7, 0x0 }
1512 #endif /* GUID_DEFINED */
1513
1514 /* ACE Access Types, also in ntifs.h */
1515 #define ACCESS_MIN_MS_ACE_TYPE (0x0)
1516 #define ACCESS_ALLOWED_ACE_TYPE (0x0)
1517 #define ACCESS_DENIED_ACE_TYPE (0x1)
1518 #define SYSTEM_AUDIT_ACE_TYPE (0x2)
1519 #define SYSTEM_ALARM_ACE_TYPE (0x3)
1520 #define ACCESS_MAX_MS_V2_ACE_TYPE (0x3)
1521 #define ACCESS_ALLOWED_COMPOUND_ACE_TYPE (0x4)
1522 #define ACCESS_MAX_MS_V3_ACE_TYPE (0x4)
1523 #define ACCESS_MIN_MS_OBJECT_ACE_TYPE (0x5)
1524 #define ACCESS_ALLOWED_OBJECT_ACE_TYPE (0x5)
1525 #define ACCESS_DENIED_OBJECT_ACE_TYPE (0x6)
1526 #define SYSTEM_AUDIT_OBJECT_ACE_TYPE (0x7)
1527 #define SYSTEM_ALARM_OBJECT_ACE_TYPE (0x8)
1528 #define ACCESS_MAX_MS_OBJECT_ACE_TYPE (0x8)
1529 #define ACCESS_MAX_MS_V4_ACE_TYPE (0x8)
1530 #define ACCESS_MAX_MS_ACE_TYPE (0x8)
1531 #define ACCESS_ALLOWED_CALLBACK_ACE_TYPE (0x9)
1532 #define ACCESS_DENIED_CALLBACK_ACE_TYPE (0xA)
1533 #define ACCESS_ALLOWED_CALLBACK_OBJECT_ACE_TYPE (0xB)
1534 #define ACCESS_DENIED_CALLBACK_OBJECT_ACE_TYPE (0xC)
1535 #define SYSTEM_AUDIT_CALLBACK_ACE_TYPE (0xD)
1536 #define SYSTEM_ALARM_CALLBACK_ACE_TYPE (0xE)
1537 #define SYSTEM_AUDIT_CALLBACK_OBJECT_ACE_TYPE (0xF)
1538 #define SYSTEM_ALARM_CALLBACK_OBJECT_ACE_TYPE (0x10)
1539 #define ACCESS_MAX_MS_V5_ACE_TYPE (0x10)
1540 /* end ntifs.h */
1541 typedef struct _GENERIC_MAPPING {
1542 ACCESS_MASK GenericRead;
1543 ACCESS_MASK GenericWrite;
1544 ACCESS_MASK GenericExecute;
1545 ACCESS_MASK GenericAll;
1546 } GENERIC_MAPPING, *PGENERIC_MAPPING;
1547 /* Sigh..when will they learn... */
1548 #ifndef __NTDDK_H
1549 typedef struct _ACE_HEADER {
1550 BYTE AceType;
1551 BYTE AceFlags;
1552 WORD AceSize;
1553 } ACE_HEADER, *PACE_HEADER;
1554
1555 typedef struct _ACCESS_ALLOWED_ACE {
1556 ACE_HEADER Header;
1557 ACCESS_MASK Mask;
1558 DWORD SidStart;
1559 } ACCESS_ALLOWED_ACE, *PACCESS_ALLOWED_ACE;
1560 typedef struct _ACCESS_DENIED_ACE {
1561 ACE_HEADER Header;
1562 ACCESS_MASK Mask;
1563 DWORD SidStart;
1564 } ACCESS_DENIED_ACE, *PACCESS_DENIED_ACE;
1565 typedef struct _SYSTEM_AUDIT_ACE {
1566 ACE_HEADER Header;
1567 ACCESS_MASK Mask;
1568 DWORD SidStart;
1569 } SYSTEM_AUDIT_ACE;
1570 typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE;
1571 typedef struct _SYSTEM_ALARM_ACE {
1572 ACE_HEADER Header;
1573 ACCESS_MASK Mask;
1574 DWORD SidStart;
1575 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
1576 typedef struct _ACCESS_ALLOWED_OBJECT_ACE {
1577 ACE_HEADER Header;
1578 ACCESS_MASK Mask;
1579 DWORD Flags;
1580 GUID ObjectType;
1581 GUID InheritedObjectType;
1582 DWORD SidStart;
1583 } ACCESS_ALLOWED_OBJECT_ACE,*PACCESS_ALLOWED_OBJECT_ACE;
1584 typedef struct _ACCESS_DENIED_OBJECT_ACE {
1585 ACE_HEADER Header;
1586 ACCESS_MASK Mask;
1587 DWORD Flags;
1588 GUID ObjectType;
1589 GUID InheritedObjectType;
1590 DWORD SidStart;
1591 } ACCESS_DENIED_OBJECT_ACE,*PACCESS_DENIED_OBJECT_ACE;
1592 typedef struct _SYSTEM_AUDIT_OBJECT_ACE {
1593 ACE_HEADER Header;
1594 ACCESS_MASK Mask;
1595 DWORD Flags;
1596 GUID ObjectType;
1597 GUID InheritedObjectType;
1598 DWORD SidStart;
1599 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE;
1600 typedef struct _SYSTEM_ALARM_OBJECT_ACE {
1601 ACE_HEADER Header;
1602 ACCESS_MASK Mask;
1603 DWORD Flags;
1604 GUID ObjectType;
1605 GUID InheritedObjectType;
1606 DWORD SidStart;
1607 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE;
1608 #endif
1609 typedef struct _ACL {
1610 BYTE AclRevision;
1611 BYTE Sbz1;
1612 WORD AclSize;
1613 WORD AceCount;
1614 WORD Sbz2;
1615 } ACL,*PACL;
1616 typedef struct _ACL_REVISION_INFORMATION {
1617 DWORD AclRevision;
1618 } ACL_REVISION_INFORMATION;
1619 typedef struct _ACL_SIZE_INFORMATION {
1620 DWORD AceCount;
1621 DWORD AclBytesInUse;
1622 DWORD AclBytesFree;
1623 } ACL_SIZE_INFORMATION;
1624
1625 /* FIXME: add more machines */
1626 #if defined(_X86_) || defined(linux)
1627 #define SIZE_OF_80387_REGISTERS 80
1628 #define CONTEXT_i386 0x10000
1629 #define CONTEXT_i486 0x10000
1630 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L)
1631 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L)
1632 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L)
1633 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L)
1634 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L)
1635 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L)
1636 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS)
1637 #define MAXIMUM_SUPPORTED_EXTENSION 512
1638 typedef struct _FLOATING_SAVE_AREA {
1639 DWORD ControlWord;
1640 DWORD StatusWord;
1641 DWORD TagWord;
1642 DWORD ErrorOffset;
1643 DWORD ErrorSelector;
1644 DWORD DataOffset;
1645 DWORD DataSelector;
1646 BYTE RegisterArea[80];
1647 DWORD Cr0NpxState;
1648 } FLOATING_SAVE_AREA;
1649 typedef struct _CONTEXT {
1650 DWORD ContextFlags;
1651 DWORD Dr0;
1652 DWORD Dr1;
1653 DWORD Dr2;
1654 DWORD Dr3;
1655 DWORD Dr6;
1656 DWORD Dr7;
1657 FLOATING_SAVE_AREA FloatSave;
1658 DWORD SegGs;
1659 DWORD SegFs;
1660 DWORD SegEs;
1661 DWORD SegDs;
1662 DWORD Edi;
1663 DWORD Esi;
1664 DWORD Ebx;
1665 DWORD Edx;
1666 DWORD Ecx;
1667 DWORD Eax;
1668 DWORD Ebp;
1669 DWORD Eip;
1670 DWORD SegCs;
1671 DWORD EFlags;
1672 DWORD Esp;
1673 DWORD SegSs;
1674 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
1675 } CONTEXT;
1676 #elif defined(_PPC_)
1677 #define CONTEXT_CONTROL 1L
1678 #define CONTEXT_FLOATING_POINT 2L
1679 #define CONTEXT_INTEGER 4L
1680 #define CONTEXT_DEBUG_REGISTERS 8L
1681 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1682 typedef struct _CONTEXT {
1683 double Fpr0;
1684 double Fpr1;
1685 double Fpr2;
1686 double Fpr3;
1687 double Fpr4;
1688 double Fpr5;
1689 double Fpr6;
1690 double Fpr7;
1691 double Fpr8;
1692 double Fpr9;
1693 double Fpr10;
1694 double Fpr11;
1695 double Fpr12;
1696 double Fpr13;
1697 double Fpr14;
1698 double Fpr15;
1699 double Fpr16;
1700 double Fpr17;
1701 double Fpr18;
1702 double Fpr19;
1703 double Fpr20;
1704 double Fpr21;
1705 double Fpr22;
1706 double Fpr23;
1707 double Fpr24;
1708 double Fpr25;
1709 double Fpr26;
1710 double Fpr27;
1711 double Fpr28;
1712 double Fpr29;
1713 double Fpr30;
1714 double Fpr31;
1715 double Fpscr;
1716 DWORD Gpr0;
1717 DWORD Gpr1;
1718 DWORD Gpr2;
1719 DWORD Gpr3;
1720 DWORD Gpr4;
1721 DWORD Gpr5;
1722 DWORD Gpr6;
1723 DWORD Gpr7;
1724 DWORD Gpr8;
1725 DWORD Gpr9;
1726 DWORD Gpr10;
1727 DWORD Gpr11;
1728 DWORD Gpr12;
1729 DWORD Gpr13;
1730 DWORD Gpr14;
1731 DWORD Gpr15;
1732 DWORD Gpr16;
1733 DWORD Gpr17;
1734 DWORD Gpr18;
1735 DWORD Gpr19;
1736 DWORD Gpr20;
1737 DWORD Gpr21;
1738 DWORD Gpr22;
1739 DWORD Gpr23;
1740 DWORD Gpr24;
1741 DWORD Gpr25;
1742 DWORD Gpr26;
1743 DWORD Gpr27;
1744 DWORD Gpr28;
1745 DWORD Gpr29;
1746 DWORD Gpr30;
1747 DWORD Gpr31;
1748 DWORD Cr;
1749 DWORD Xer;
1750 DWORD Msr;
1751 DWORD Iar;
1752 DWORD Lr;
1753 DWORD Ctr;
1754 DWORD ContextFlags;
1755 DWORD Fill[3];
1756 DWORD Dr0;
1757 DWORD Dr1;
1758 DWORD Dr2;
1759 DWORD Dr3;
1760 DWORD Dr4;
1761 DWORD Dr5;
1762 DWORD Dr6;
1763 DWORD Dr7;
1764 } CONTEXT;
1765 #elif defined(_ALPHA_)
1766 #define CONTEXT_ALPHA 0x20000
1767 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1768 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1769 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1770 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1771 typedef struct _CONTEXT {
1772 ULONGLONG FltF0;
1773 ULONGLONG FltF1;
1774 ULONGLONG FltF2;
1775 ULONGLONG FltF3;
1776 ULONGLONG FltF4;
1777 ULONGLONG FltF5;
1778 ULONGLONG FltF6;
1779 ULONGLONG FltF7;
1780 ULONGLONG FltF8;
1781 ULONGLONG FltF9;
1782 ULONGLONG FltF10;
1783 ULONGLONG FltF11;
1784 ULONGLONG FltF12;
1785 ULONGLONG FltF13;
1786 ULONGLONG FltF14;
1787 ULONGLONG FltF15;
1788 ULONGLONG FltF16;
1789 ULONGLONG FltF17;
1790 ULONGLONG FltF18;
1791 ULONGLONG FltF19;
1792 ULONGLONG FltF20;
1793 ULONGLONG FltF21;
1794 ULONGLONG FltF22;
1795 ULONGLONG FltF23;
1796 ULONGLONG FltF24;
1797 ULONGLONG FltF25;
1798 ULONGLONG FltF26;
1799 ULONGLONG FltF27;
1800 ULONGLONG FltF28;
1801 ULONGLONG FltF29;
1802 ULONGLONG FltF30;
1803 ULONGLONG FltF31;
1804 ULONGLONG IntV0;
1805 ULONGLONG IntT0;
1806 ULONGLONG IntT1;
1807 ULONGLONG IntT2;
1808 ULONGLONG IntT3;
1809 ULONGLONG IntT4;
1810 ULONGLONG IntT5;
1811 ULONGLONG IntT6;
1812 ULONGLONG IntT7;
1813 ULONGLONG IntS0;
1814 ULONGLONG IntS1;
1815 ULONGLONG IntS2;
1816 ULONGLONG IntS3;
1817 ULONGLONG IntS4;
1818 ULONGLONG IntS5;
1819 ULONGLONG IntFp;
1820 ULONGLONG IntA0;
1821 ULONGLONG IntA1;
1822 ULONGLONG IntA2;
1823 ULONGLONG IntA3;
1824 ULONGLONG IntA4;
1825 ULONGLONG IntA5;
1826 ULONGLONG IntT8;
1827 ULONGLONG IntT9;
1828 ULONGLONG IntT10;
1829 ULONGLONG IntT11;
1830 ULONGLONG IntRa;
1831 ULONGLONG IntT12;
1832 ULONGLONG IntAt;
1833 ULONGLONG IntGp;
1834 ULONGLONG IntSp;
1835 ULONGLONG IntZero;
1836 ULONGLONG Fpcr;
1837 ULONGLONG SoftFpcr;
1838 ULONGLONG Fir;
1839 DWORD Psr;
1840 DWORD ContextFlags;
1841 DWORD Fill[4];
1842 } CONTEXT;
1843 #elif defined(SHx)
1844
1845 /* These are the debug or break registers on the SH3 */
1846 typedef struct _DEBUG_REGISTERS {
1847 ULONG BarA;
1848 UCHAR BasrA;
1849 UCHAR BamrA;
1850 USHORT BbrA;
1851 ULONG BarB;
1852 UCHAR BasrB;
1853 UCHAR BamrB;
1854 USHORT BbrB;
1855 ULONG BdrB;
1856 ULONG BdmrB;
1857 USHORT Brcr;
1858 USHORT Align;
1859 } DEBUG_REGISTERS, *PDEBUG_REGISTERS;
1860
1861 /* The following flags control the contents of the CONTEXT structure. */
1862
1863 #define CONTEXT_SH3 0x00000040
1864 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */
1865
1866 #ifdef SH3
1867 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L)
1868 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L)
1869 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L)
1870 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS)
1871 #else /* SH4 */
1872 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L)
1873 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L)
1874 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L)
1875 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L)
1876 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT)
1877 #endif
1878
1879 /* Context Frame */
1880
1881 /* This frame is used to store a limited processor context into the */
1882 /* Thread structure for CPUs which have no floating point support. */
1883
1884 typedef struct _CONTEXT {
1885 /* The flags values within this flag control the contents of */
1886 /* a CONTEXT record. */
1887
1888 /* If the context record is used as an input parameter, then */
1889 /* for each portion of the context record controlled by a flag */
1890 /* whose value is set, it is assumed that that portion of the */
1891 /* context record contains valid context. If the context record */
1892 /* is being used to modify a thread's context, then only that */
1893 /* portion of the threads context will be modified. */
1894
1895 /* If the context record is used as an IN OUT parameter to capture */
1896 /* the context of a thread, then only those portions of the thread's */
1897 /* context corresponding to set flags will be returned. */
1898
1899 /* The context record is never used as an OUT only parameter. */
1900
1901
1902 ULONG ContextFlags;
1903
1904 /* This section is specified/returned if the ContextFlags word contains */
1905 /* the flag CONTEXT_INTEGER. */
1906
1907 /* N.B. The registers RA and R15 are defined in this section, but are */
1908 /* considered part of the control context rather than part of the integer */
1909 /* context. */
1910
1911 ULONG PR;
1912 ULONG MACH;
1913 ULONG MACL;
1914 ULONG GBR;
1915 ULONG R0;
1916 ULONG R1;
1917 ULONG R2;
1918 ULONG R3;
1919 ULONG R4;
1920 ULONG R5;
1921 ULONG R6;
1922 ULONG R7;
1923 ULONG R8;
1924 ULONG R9;
1925 ULONG R10;
1926 ULONG R11;
1927 ULONG R12;
1928 ULONG R13;
1929 ULONG R14;
1930 ULONG R15;
1931
1932 /* This section is specified/returned if the ContextFlags word contains */
1933 /* the flag CONTEXT_CONTROL. */
1934
1935 /* N.B. The registers r15 and ra are defined in the integer section, */
1936 /* but are considered part of the control context rather than part of */
1937 /* the integer context. */
1938
1939 ULONG Fir;
1940 ULONG Psr;
1941
1942 #if !defined(SH3e) && !defined(SH4)
1943 ULONG OldStuff[2];
1944 DEBUG_REGISTERS DebugRegisters;
1945 #else
1946 ULONG Fpscr;
1947 ULONG Fpul;
1948 ULONG FRegs[16];
1949 #if defined(SH4)
1950 ULONG xFRegs[16];
1951 #endif
1952 #endif
1953 } CONTEXT;
1954
1955 #elif defined(MIPS)
1956
1957 /* The following flags control the contents of the CONTEXT structure. */
1958
1959 #define CONTEXT_R4000 0x00010000 /* r4000 context */
1960
1961 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L)
1962 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L)
1963 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L)
1964
1965 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1966
1967 /* Context Frame */
1968
1969 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */
1970
1971 /* This frame has a several purposes: 1) it is used as an argument to */
1972 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */
1973 /* 3) it is used to construct a call frame for exception dispatching */
1974 /* in user mode, and 4) it is used in the user level thread creation */
1975 /* routines. */
1976
1977 /* The layout of the record conforms to a standard call frame. */
1978
1979
1980 typedef struct _CONTEXT {
1981
1982 /* This section is always present and is used as an argument build */
1983 /* area. */
1984
1985 DWORD Argument[4];
1986
1987 /* This section is specified/returned if the ContextFlags word contains */
1988 /* the flag CONTEXT_FLOATING_POINT. */
1989
1990 DWORD FltF0;
1991 DWORD FltF1;
1992 DWORD FltF2;
1993 DWORD FltF3;
1994 DWORD FltF4;
1995 DWORD FltF5;
1996 DWORD FltF6;
1997 DWORD FltF7;
1998 DWORD FltF8;
1999 DWORD FltF9;
2000 DWORD FltF10;
2001 DWORD FltF11;
2002 DWORD FltF12;
2003 DWORD FltF13;
2004 DWORD FltF14;
2005 DWORD FltF15;
2006 DWORD FltF16;
2007 DWORD FltF17;
2008 DWORD FltF18;
2009 DWORD FltF19;
2010 DWORD FltF20;
2011 DWORD FltF21;
2012 DWORD FltF22;
2013 DWORD FltF23;
2014 DWORD FltF24;
2015 DWORD FltF25;
2016 DWORD FltF26;
2017 DWORD FltF27;
2018 DWORD FltF28;
2019 DWORD FltF29;
2020 DWORD FltF30;
2021 DWORD FltF31;
2022
2023 /* This section is specified/returned if the ContextFlags word contains */
2024 /* the flag CONTEXT_INTEGER. */
2025
2026 /* N.B. The registers gp, sp, and ra are defined in this section, but are */
2027 /* considered part of the control context rather than part of the integer */
2028 /* context. */
2029
2030 /* N.B. Register zero is not stored in the frame. */
2031
2032 DWORD IntZero;
2033 DWORD IntAt;
2034 DWORD IntV0;
2035 DWORD IntV1;
2036 DWORD IntA0;
2037 DWORD IntA1;
2038 DWORD IntA2;
2039 DWORD IntA3;
2040 DWORD IntT0;
2041 DWORD IntT1;
2042 DWORD IntT2;
2043 DWORD IntT3;
2044 DWORD IntT4;
2045 DWORD IntT5;
2046 DWORD IntT6;
2047 DWORD IntT7;
2048 DWORD IntS0;
2049 DWORD IntS1;
2050 DWORD IntS2;
2051 DWORD IntS3;
2052 DWORD IntS4;
2053 DWORD IntS5;
2054 DWORD IntS6;
2055 DWORD IntS7;
2056 DWORD IntT8;
2057 DWORD IntT9;
2058 DWORD IntK0;
2059 DWORD IntK1;
2060 DWORD IntGp;
2061 DWORD IntSp;
2062 DWORD IntS8;
2063 DWORD IntRa;
2064 DWORD IntLo;
2065 DWORD IntHi;
2066
2067 /* This section is specified/returned if the ContextFlags word contains */
2068 /* the flag CONTEXT_FLOATING_POINT. */
2069
2070 DWORD Fsr;
2071
2072 /* This section is specified/returned if the ContextFlags word contains */
2073 /* the flag CONTEXT_CONTROL. */
2074
2075 /* N.B. The registers gp, sp, and ra are defined in the integer section, */
2076 /* but are considered part of the control context rather than part of */
2077 /* the integer context. */
2078
2079 DWORD Fir;
2080 DWORD Psr;
2081
2082 /* The flags values within this flag control the contents of */
2083 /* a CONTEXT record. */
2084
2085 /* If the context record is used as an input parameter, then */
2086 /* for each portion of the context record controlled by a flag */
2087 /* whose value is set, it is assumed that that portion of the */
2088 /* context record contains valid context. If the context record */
2089 /* is being used to modify a thread's context, then only that */
2090 /* portion of the threads context will be modified. */
2091
2092 /* If the context record is used as an IN OUT parameter to capture */
2093 /* the context of a thread, then only those portions of the thread's */
2094 /* context corresponding to set flags will be returned. */
2095
2096 /* The context record is never used as an OUT only parameter. */
2097
2098 DWORD ContextFlags;
2099
2100 DWORD Fill[2];
2101
2102 } CONTEXT;
2103 #elif defined(ARM)
2104
2105 /* The following flags control the contents of the CONTEXT structure. */
2106
2107 #define CONTEXT_ARM 0x0000040
2108 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
2109 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
2110
2111 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
2112
2113 typedef struct _CONTEXT {
2114 /* The flags values within this flag control the contents of
2115 a CONTEXT record.
2116
2117 If the context record is used as an input parameter, then
2118 for each portion of the context record controlled by a flag
2119 whose value is set, it is assumed that that portion of the
2120 context record contains valid context. If the context record
2121 is being used to modify a thread's context, then only that
2122 portion of the threads context will be modified.
2123
2124 If the context record is used as an IN OUT parameter to capture
2125 the context of a thread, then only those portions of the thread's
2126 context corresponding to set flags will be returned.
2127
2128 The context record is never used as an OUT only parameter. */
2129
2130 ULONG ContextFlags;
2131
2132 /* This section is specified/returned if the ContextFlags word contains
2133 the flag CONTEXT_INTEGER. */
2134 ULONG R0;
2135 ULONG R1;
2136 ULONG R2;
2137 ULONG R3;
2138 ULONG R4;
2139 ULONG R5;
2140 ULONG R6;
2141 ULONG R7;
2142 ULONG R8;
2143 ULONG R9;
2144 ULONG R10;
2145 ULONG R11;
2146 ULONG R12;
2147
2148 ULONG Sp;
2149 ULONG Lr;
2150 ULONG Pc;
2151 ULONG Psr;
2152 } CONTEXT;
2153
2154 #else
2155 #error "undefined processor type"
2156 #endif
2157 typedef CONTEXT *PCONTEXT,*LPCONTEXT;
2158 typedef struct _EXCEPTION_RECORD {
2159 DWORD ExceptionCode;
2160 DWORD ExceptionFlags;
2161 struct _EXCEPTION_RECORD *ExceptionRecord;
2162 PVOID ExceptionAddress;
2163 DWORD NumberParameters;
2164 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2165 } EXCEPTION_RECORD,*PEXCEPTION_RECORD,*LPEXCEPTION_RECORD;
2166 typedef struct _EXCEPTION_POINTERS {
2167 PEXCEPTION_RECORD ExceptionRecord;
2168 PCONTEXT ContextRecord;
2169 } EXCEPTION_POINTERS,*PEXCEPTION_POINTERS,*LPEXCEPTION_POINTERS;
2170 typedef union _LARGE_INTEGER {
2171 struct {
2172 DWORD LowPart;
2173 LONG HighPart;
2174 } u;
2175 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2176 _ANONYMOUS_STRUCT struct {
2177 DWORD LowPart;
2178 LONG HighPart;
2179 };
2180 #endif /* NONAMELESSUNION */
2181 LONGLONG QuadPart;
2182 } LARGE_INTEGER, *PLARGE_INTEGER;
2183 typedef union _ULARGE_INTEGER {
2184 struct {
2185 DWORD LowPart;
2186 DWORD HighPart;
2187 } u;
2188 #if ! defined(NONAMELESSUNION) || defined(__cplusplus)
2189 _ANONYMOUS_STRUCT struct {
2190 DWORD LowPart;
2191 DWORD HighPart;
2192 };
2193 #endif /* NONAMELESSUNION */
2194 ULONGLONG QuadPart;
2195 } ULARGE_INTEGER, *PULARGE_INTEGER;
2196 typedef struct _LUID {
2197 DWORD LowPart;
2198 LONG HighPart;
2199 } LUID, *PLUID;
2200 #pragma pack(push,4)
2201 typedef struct _LUID_AND_ATTRIBUTES {
2202 LUID Luid;
2203 DWORD Attributes;
2204 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2205 #pragma pack(pop)
2206 typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2207 typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY;
2208 typedef struct _PRIVILEGE_SET {
2209 DWORD PrivilegeCount;
2210 DWORD Control;
2211 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2212 } PRIVILEGE_SET,*PPRIVILEGE_SET;
2213 typedef struct _SECURITY_ATTRIBUTES {
2214 DWORD nLength;
2215 LPVOID lpSecurityDescriptor;
2216 BOOL bInheritHandle;
2217 } SECURITY_ATTRIBUTES,*PSECURITY_ATTRIBUTES,*LPSECURITY_ATTRIBUTES;
2218 typedef enum _SECURITY_IMPERSONATION_LEVEL {
2219 SecurityAnonymous,
2220 SecurityIdentification,
2221 SecurityImpersonation,
2222 SecurityDelegation
2223 } SECURITY_IMPERSONATION_LEVEL,*PSECURITY_IMPERSONATION_LEVEL;
2224 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,*PSECURITY_CONTEXT_TRACKING_MODE;
2225 typedef struct _SECURITY_QUALITY_OF_SERVICE {
2226 DWORD Length;
2227 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2228 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2229 BOOLEAN EffectiveOnly;
2230 } SECURITY_QUALITY_OF_SERVICE,*PSECURITY_QUALITY_OF_SERVICE;
2231 typedef PVOID PACCESS_TOKEN;
2232 typedef struct _SE_IMPERSONATION_STATE {
2233 PACCESS_TOKEN Token;
2234 BOOLEAN CopyOnOpen;
2235 BOOLEAN EffectiveOnly;
2236 SECURITY_IMPERSONATION_LEVEL Level;
2237 } SE_IMPERSONATION_STATE,*PSE_IMPERSONATION_STATE;
2238 /* Steven you are my hero when you fix the w32api ddk! */
2239 #if !defined(__NTDDK_H)
2240 typedef struct _SID_IDENTIFIER_AUTHORITY {
2241 BYTE Value[6];
2242 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
2243 typedef PVOID PSID;
2244 typedef struct _SID {
2245 BYTE Revision;
2246 BYTE SubAuthorityCount;
2247 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2248 DWORD SubAuthority[ANYSIZE_ARRAY];
2249 } SID, *PISID;
2250 typedef struct _SID_AND_ATTRIBUTES {
2251 PSID Sid;
2252 DWORD Attributes;
2253 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
2254 typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY];
2255 typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY;
2256 typedef struct _TOKEN_SOURCE {
2257 CHAR SourceName[TOKEN_SOURCE_LENGTH];
2258 LUID SourceIdentifier;
2259 } TOKEN_SOURCE,*PTOKEN_SOURCE;
2260 typedef struct _TOKEN_CONTROL {
2261 LUID TokenId;
2262 LUID AuthenticationId;
2263 LUID ModifiedId;
2264 TOKEN_SOURCE TokenSource;
2265 } TOKEN_CONTROL,*PTOKEN_CONTROL;
2266 typedef struct _TOKEN_DEFAULT_DACL {
2267 PACL DefaultDacl;
2268 } TOKEN_DEFAULT_DACL,*PTOKEN_DEFAULT_DACL;
2269 typedef struct _TOKEN_GROUPS {
2270 DWORD GroupCount;
2271 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2272 } TOKEN_GROUPS,*PTOKEN_GROUPS,*LPTOKEN_GROUPS;
2273 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
2274 ULONG SidCount;
2275 ULONG SidLength;
2276 PSID_AND_ATTRIBUTES Sids;
2277 ULONG RestrictedSidCount;
2278 ULONG RestrictedSidLength;
2279 PSID_AND_ATTRIBUTES RestrictedSids;
2280 ULONG PrivilegeCount;
2281 ULONG PrivilegeLength;
2282 PLUID_AND_ATTRIBUTES Privileges;
2283 LUID AuthenticationId;
2284 } TOKEN_GROUPS_AND_PRIVILEGES, *PTOKEN_GROUPS_AND_PRIVILEGES;
2285 typedef struct _TOKEN_ORIGIN {
2286 LUID OriginatingLogonSession;
2287 } TOKEN_ORIGIN, *PTOKEN_ORIGIN;
2288 typedef struct _TOKEN_OWNER {
2289 PSID Owner;
2290 } TOKEN_OWNER,*PTOKEN_OWNER;
2291 typedef struct _TOKEN_PRIMARY_GROUP {
2292 PSID PrimaryGroup;
2293 } TOKEN_PRIMARY_GROUP,*PTOKEN_PRIMARY_GROUP;
2294 typedef struct _TOKEN_PRIVILEGES {
2295 DWORD PrivilegeCount;
2296 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
2297 } TOKEN_PRIVILEGES,*PTOKEN_PRIVILEGES,*LPTOKEN_PRIVILEGES;
2298 typedef enum tagTOKEN_TYPE {
2299 TokenPrimary = 1,
2300 TokenImpersonation
2301 } TOKEN_TYPE,*PTOKEN_TYPE;
2302 typedef struct _TOKEN_STATISTICS {
2303 LUID TokenId;
2304 LUID AuthenticationId;
2305 LARGE_INTEGER ExpirationTime;
2306 TOKEN_TYPE TokenType;
2307 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2308 DWORD DynamicCharged;
2309 DWORD DynamicAvailable;
2310 DWORD GroupCount;
2311 DWORD PrivilegeCount;
2312 LUID ModifiedId;
2313 } TOKEN_STATISTICS, *PTOKEN_STATISTICS;
2314 typedef struct _TOKEN_USER {
2315 SID_AND_ATTRIBUTES User;
2316 } TOKEN_USER, *PTOKEN_USER;
2317 typedef DWORD SECURITY_INFORMATION,*PSECURITY_INFORMATION;
2318 typedef WORD SECURITY_DESCRIPTOR_CONTROL,*PSECURITY_DESCRIPTOR_CONTROL;
2319 typedef struct _SECURITY_DESCRIPTOR {
2320 BYTE Revision;
2321 BYTE Sbz1;
2322 SECURITY_DESCRIPTOR_CONTROL Control;
2323 PSID Owner;
2324 PSID Group;
2325 PACL Sacl;
2326 PACL Dacl;
2327 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
2328 typedef struct _SECURITY_DESCRIPTOR_RELATIVE {
2329 BYTE Revision;
2330 BYTE Sbz1;
2331 SECURITY_DESCRIPTOR_CONTROL Control;
2332 DWORD Owner;
2333 DWORD Group;
2334 DWORD Sacl;
2335 DWORD Dacl;
2336 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2337 typedef enum _TOKEN_INFORMATION_CLASS {
2338 TokenUser=1,TokenGroups,TokenPrivileges,TokenOwner,
2339 TokenPrimaryGroup,TokenDefaultDacl,TokenSource,TokenType,
2340 TokenImpersonationLevel,TokenStatistics,TokenRestrictedSids,
2341 TokenSessionId,TokenGroupsAndPrivileges,TokenSessionReference,
2342 TokenSandBoxInert,TokenAuditPolicy,TokenOrigin,
2343 } TOKEN_INFORMATION_CLASS;
2344 #endif
2345 typedef enum _SID_NAME_USE {
2346 SidTypeUser=1,SidTypeGroup,SidTypeDomain,SidTypeAlias,
2347 SidTypeWellKnownGroup,SidTypeDeletedAccount,SidTypeInvalid,
2348 SidTypeUnknown
2349 } SID_NAME_USE,*PSID_NAME_USE;
2350 typedef struct _QUOTA_LIMITS {
2351 SIZE_T PagedPoolLimit;
2352 SIZE_T NonPagedPoolLimit;
2353 SIZE_T MinimumWorkingSetSize;
2354 SIZE_T MaximumWorkingSetSize;
2355 SIZE_T PagefileLimit;
2356 LARGE_INTEGER TimeLimit;
2357 } QUOTA_LIMITS,*PQUOTA_LIMITS;
2358 typedef struct _IO_COUNTERS {
2359 ULONGLONG ReadOperationCount;
2360 ULONGLONG WriteOperationCount;
2361 ULONGLONG OtherOperationCount;
2362 ULONGLONG ReadTransferCount;
2363 ULONGLONG WriteTransferCount;
2364 ULONGLONG OtherTransferCount;
2365 } IO_COUNTERS, *PIO_COUNTERS;
2366 typedef struct _FILE_NOTIFY_INFORMATION {
2367 DWORD NextEntryOffset;
2368 DWORD Action;
2369 DWORD FileNameLength;
2370 WCHAR FileName[1];
2371 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION;
2372 typedef struct _TAPE_ERASE {
2373 DWORD Type;
2374 BOOLEAN Immediate;
2375 } TAPE_ERASE,*PTAPE_ERASE;
2376 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
2377 BOOLEAN ECC;
2378 BOOLEAN Compression;
2379 BOOLEAN DataPadding;
2380 BOOLEAN ReportSetmarks;
2381 DWORD DefaultBlockSize;
2382 DWORD MaximumBlockSize;
2383 DWORD MinimumBlockSize;
2384 DWORD MaximumPartitionCount;
2385 DWORD FeaturesLow;
2386 DWORD FeaturesHigh;
2387 DWORD EOTWarningZoneSize;
2388 } TAPE_GET_DRIVE_PARAMETERS,*PTAPE_GET_DRIVE_PARAMETERS;
2389 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
2390 LARGE_INTEGER Capacity;
2391 LARGE_INTEGER Remaining;
2392 DWORD BlockSize;
2393 DWORD PartitionCount;
2394 BOOLEAN WriteProtected;
2395 } TAPE_GET_MEDIA_PARAMETERS,*PTAPE_GET_MEDIA_PARAMETERS;
2396 typedef struct _TAPE_GET_POSITION {
2397 ULONG Type;
2398 ULONG Partition;
2399 LARGE_INTEGER Offset;
2400 } TAPE_GET_POSITION,*PTAPE_GET_POSITION;
2401 typedef struct _TAPE_PREPARE {
2402 DWORD Operation;
2403 BOOLEAN Immediate;
2404 } TAPE_PREPARE,*PTAPE_PREPARE;
2405 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
2406 BOOLEAN ECC;
2407 BOOLEAN Compression;
2408 BOOLEAN DataPadding;
2409 BOOLEAN ReportSetmarks;
2410 ULONG EOTWarningZoneSize;
2411 } TAPE_SET_DRIVE_PARAMETERS,*PTAPE_SET_DRIVE_PARAMETERS;
2412 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
2413 ULONG BlockSize;
2414 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS;
2415 typedef struct _TAPE_SET_POSITION {
2416 DWORD Method;
2417 DWORD Partition;
2418 LARGE_INTEGER Offset;
2419 BOOLEAN Immediate;
2420 } TAPE_SET_POSITION,*PTAPE_SET_POSITION;
2421 typedef struct _TAPE_WRITE_MARKS {
2422 DWORD Type;
2423 DWORD Count;
2424 BOOLEAN Immediate;
2425 } TAPE_WRITE_MARKS,*PTAPE_WRITE_MARKS;
2426 typedef struct _TAPE_CREATE_PARTITION {
2427 DWORD Method;
2428 DWORD Count;
2429 DWORD Size;
2430 } TAPE_CREATE_PARTITION,*PTAPE_CREATE_PARTITION;
2431 typedef struct _MEMORY_BASIC_INFORMATION {
2432 PVOID BaseAddress;
2433 PVOID AllocationBase;
2434 DWORD AllocationProtect;
2435 DWORD RegionSize;
2436 DWORD State;
2437 DWORD Protect;
2438 DWORD Type;
2439 } MEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
2440 typedef struct _MESSAGE_RESOURCE_ENTRY {
2441 WORD Length;
2442 WORD Flags;
2443 BYTE Text[1];
2444 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2445 typedef struct _MESSAGE_RESOURCE_BLOCK {
2446 DWORD LowId;
2447 DWORD HighId;
2448 DWORD OffsetToEntries;
2449 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2450 typedef struct _MESSAGE_RESOURCE_DATA {
2451 DWORD NumberOfBlocks;
2452 MESSAGE_RESOURCE_BLOCK Blocks[1];
2453 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2454 typedef struct _LIST_ENTRY {
2455 struct _LIST_ENTRY *Flink;
2456 struct _LIST_ENTRY *Blink;
2457 } LIST_ENTRY,*PLIST_ENTRY;
2458 typedef struct _SINGLE_LIST_ENTRY {
2459 struct _SINGLE_LIST_ENTRY *Next;
2460 } SINGLE_LIST_ENTRY,*PSINGLE_LIST_ENTRY;
2461
2462 #ifndef _SLIST_HEADER_
2463 #define _SLIST_HEADER_
2464 #define SLIST_ENTRY SINGLE_LIST_ENTRY
2465 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
2466 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
2467 typedef union _SLIST_HEADER {
2468 ULONGLONG Alignment;
2469 _ANONYMOUS_STRUCT struct {
2470 SLIST_ENTRY Next;
2471 WORD Depth;
2472 WORD Sequence;
2473 } DUMMYSTRUCTNAME;
2474 } SLIST_HEADER,*PSLIST_HEADER;
2475 #endif /* !_SLIST_HEADER_ */
2476
2477 /* FIXME: Please oh please stop including winnt.h from the DDK... */
2478 #ifndef __NTDDK_H
2479 typedef struct _RTL_CRITICAL_SECTION_DEBUG {
2480 WORD Type;
2481 WORD CreatorBackTraceIndex;
2482 struct _RTL_CRITICAL_SECTION *CriticalSection;
2483 LIST_ENTRY ProcessLocksList;
2484 DWORD EntryCount;
2485 DWORD ContentionCount;
2486 DWORD Spare[2];
2487 } RTL_CRITICAL_SECTION_DEBUG,*PRTL_CRITICAL_SECTION_DEBUG;
2488 typedef struct _RTL_CRITICAL_SECTION {
2489 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
2490 LONG LockCount;
2491 LONG RecursionCount;
2492 HANDLE OwningThread;
2493 HANDLE LockSemaphore;
2494 ULONG_PTR SpinCount;
2495 } RTL_CRITICAL_SECTION,*PRTL_CRITICAL_SECTION;
2496 #endif
2497
2498 typedef LONG
2499 (NTAPI *PVECTORED_EXCEPTION_HANDLER)(
2500 struct _EXCEPTION_POINTERS *ExceptionInfo
2501 );
2502
2503 typedef struct _EVENTLOGRECORD {
2504 DWORD Length;
2505 DWORD Reserved;
2506 DWORD RecordNumber;
2507 DWORD TimeGenerated;
2508 DWORD TimeWritten;
2509 DWORD EventID;
2510 WORD EventType;
2511 WORD NumStrings;
2512 WORD EventCategory;
2513 WORD ReservedFlags;
2514 DWORD ClosingRecordNumber;
2515 DWORD StringOffset;
2516 DWORD UserSidLength;
2517 DWORD UserSidOffset;
2518 DWORD DataLength;
2519 DWORD DataOffset;
2520 } EVENTLOGRECORD,*PEVENTLOGRECORD;
2521 typedef struct _OSVERSIONINFOA {
2522 DWORD dwOSVersionInfoSize;
2523 DWORD dwMajorVersion;
2524 DWORD dwMinorVersion;
2525 DWORD dwBuildNumber;
2526 DWORD dwPlatformId;
2527 CHAR szCSDVersion[128];
2528 } OSVERSIONINFOA,*POSVERSIONINFOA,*LPOSVERSIONINFOA;
2529 typedef struct _OSVERSIONINFOW {
2530 DWORD dwOSVersionInfoSize;
2531 DWORD dwMajorVersion;
2532 DWORD dwMinorVersion;
2533 DWORD dwBuildNumber;
2534 DWORD dwPlatformId;
2535 WCHAR szCSDVersion[128];
2536 } OSVERSIONINFOW,*POSVERSIONINFOW,*LPOSVERSIONINFOW;
2537 typedef struct _OSVERSIONINFOEXA {
2538 DWORD dwOSVersionInfoSize;
2539 DWORD dwMajorVersion;
2540 DWORD dwMinorVersion;
2541 DWORD dwBuildNumber;
2542 DWORD dwPlatformId;
2543 CHAR szCSDVersion[128];
2544 WORD wServicePackMajor;
2545 WORD wServicePackMinor;
2546 WORD wSuiteMask;
2547 BYTE wProductType;
2548 BYTE wReserved;
2549 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
2550 typedef struct _OSVERSIONINFOEXW {
2551 DWORD dwOSVersionInfoSize;
2552 DWORD dwMajorVersion;
2553 DWORD dwMinorVersion;
2554 DWORD dwBuildNumber;
2555 DWORD dwPlatformId;
2556 WCHAR szCSDVersion[128];
2557 WORD wServicePackMajor;
2558 WORD wServicePackMinor;
2559 WORD wSuiteMask;
2560 BYTE wProductType;
2561 BYTE wReserved;
2562 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW;
2563 #pragma pack(push,2)
2564 typedef struct _IMAGE_VXD_HEADER {
2565 WORD e32_magic;
2566 BYTE e32_border;
2567 BYTE e32_worder;
2568 DWORD e32_level;
2569 WORD e32_cpu;
2570 WORD e32_os;
2571 DWORD e32_ver;
2572 DWORD e32_mflags;
2573 DWORD e32_mpages;
2574 DWORD e32_startobj;
2575 DWORD e32_eip;
2576 DWORD e32_stackobj;
2577 DWORD e32_esp;
2578 DWORD e32_pagesize;
2579 DWORD e32_lastpagesize;
2580 DWORD e32_fixupsize;
2581 DWORD e32_fixupsum;
2582 DWORD e32_ldrsize;
2583 DWORD e32_ldrsum;
2584 DWORD e32_objtab;
2585 DWORD e32_objcnt;
2586 DWORD e32_objmap;
2587 DWORD e32_itermap;
2588 DWORD e32_rsrctab;
2589 DWORD e32_rsrccnt;
2590 DWORD e32_restab;
2591 DWORD e32_enttab;
2592 DWORD e32_dirtab;
2593 DWORD e32_dircnt;
2594 DWORD e32_fpagetab;
2595 DWORD e32_frectab;
2596 DWORD e32_impmod;
2597 DWORD e32_impmodcnt;
2598 DWORD e32_impproc;
2599 DWORD e32_pagesum;
2600 DWORD e32_datapage;
2601 DWORD e32_preload;
2602 DWORD e32_nrestab;
2603 DWORD e32_cbnrestab;
2604 DWORD e32_nressum;
2605 DWORD e32_autodata;
2606 DWORD e32_debuginfo;
2607 DWORD e32_debuglen;
2608 DWORD e32_instpreload;
2609 DWORD e32_instdemand;
2610 DWORD e32_heapsize;
2611 BYTE e32_res3[12];
2612 DWORD e32_winresoff;
2613 DWORD e32_winreslen;
2614 WORD e32_devid;
2615 WORD e32_ddkver;
2616 } IMAGE_VXD_HEADER,*PIMAGE_VXD_HEADER;
2617 #pragma pack(pop)
2618 #pragma pack(push,4)
2619 typedef struct _IMAGE_FILE_HEADER {
2620 WORD Machine;
2621 WORD NumberOfSections;
2622 DWORD TimeDateStamp;
2623 DWORD PointerToSymbolTable;
2624 DWORD NumberOfSymbols;
2625 WORD SizeOfOptionalHeader;
2626 WORD Characteristics;
2627 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2628 typedef struct _IMAGE_DATA_DIRECTORY {
2629 DWORD VirtualAddress;
2630 DWORD Size;
2631 } IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
2632 typedef struct _IMAGE_OPTIONAL_HEADER32 {
2633 WORD Magic;
2634 BYTE MajorLinkerVersion;
2635 BYTE MinorLinkerVersion;
2636 DWORD SizeOfCode;
2637 DWORD SizeOfInitializedData;
2638 DWORD SizeOfUninitializedData;
2639 DWORD AddressOfEntryPoint;
2640 DWORD BaseOfCode;
2641 DWORD BaseOfData;
2642 DWORD ImageBase;
2643 DWORD SectionAlignment;
2644 DWORD FileAlignment;
2645 WORD MajorOperatingSystemVersion;
2646 WORD MinorOperatingSystemVersion;
2647 WORD MajorImageVersion;
2648 WORD MinorImageVersion;
2649 WORD MajorSubsystemVersion;
2650 WORD MinorSubsystemVersion;
2651 DWORD Win32VersionValue;
2652 DWORD SizeOfImage;
2653 DWORD SizeOfHeaders;
2654 DWORD CheckSum;
2655 WORD Subsystem;
2656 WORD DllCharacteristics;
2657 DWORD SizeOfStackReserve;
2658 DWORD SizeOfStackCommit;
2659 DWORD SizeOfHeapReserve;
2660 DWORD SizeOfHeapCommit;
2661 DWORD LoaderFlags;
2662 DWORD NumberOfRvaAndSizes;
2663 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2664 } IMAGE_OPTIONAL_HEADER32,*PIMAGE_OPTIONAL_HEADER32;
2665 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2666 WORD Magic;
2667 BYTE MajorLinkerVersion;
2668 BYTE MinorLinkerVersion;
2669 DWORD SizeOfCode;
2670 DWORD SizeOfInitializedData;
2671 DWORD SizeOfUninitializedData;
2672 DWORD AddressOfEntryPoint;
2673 DWORD BaseOfCode;
2674 ULONGLONG ImageBase;
2675 DWORD SectionAlignment;
2676 DWORD FileAlignment;
2677 WORD MajorOperatingSystemVersion;
2678 WORD MinorOperatingSystemVersion;
2679 WORD MajorImageVersion;
2680 WORD MinorImageVersion;
2681 WORD MajorSubsystemVersion;
2682 WORD MinorSubsystemVersion;
2683 DWORD Reserved1;
2684 DWORD SizeOfImage;
2685 DWORD SizeOfHeaders;
2686 DWORD CheckSum;
2687 WORD Subsystem;
2688 WORD DllCharacteristics;
2689 ULONGLONG SizeOfStackReserve;
2690 ULONGLONG SizeOfStackCommit;
2691 ULONGLONG SizeOfHeapReserve;
2692 ULONGLONG SizeOfHeapCommit;
2693 DWORD LoaderFlags;
2694 DWORD NumberOfRvaAndSizes;
2695 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2696 } IMAGE_OPTIONAL_HEADER64,*PIMAGE_OPTIONAL_HEADER64;
2697 typedef struct _IMAGE_ROM_OPTIONAL_HEADER {
2698 WORD Magic;
2699 BYTE MajorLinkerVersion;
2700 BYTE MinorLinkerVersion;
2701 DWORD SizeOfCode;
2702 DWORD SizeOfInitializedData;
2703 DWORD SizeOfUninitializedData;
2704 DWORD AddressOfEntryPoint;
2705 DWORD BaseOfCode;
2706 DWORD BaseOfData;
2707 DWORD BaseOfBss;
2708 DWORD GprMask;
2709 DWORD CprMask[4];
2710 DWORD GpValue;
2711 } IMAGE_ROM_OPTIONAL_HEADER,*PIMAGE_ROM_OPTIONAL_HEADER;
2712 #pragma pack(pop)
2713 #pragma pack(push,2)
2714 typedef struct _IMAGE_DOS_HEADER {
2715 WORD e_magic;
2716 WORD e_cblp;
2717 WORD e_cp;
2718 WORD e_crlc;
2719 WORD e_cparhdr;
2720 WORD e_minalloc;
2721 WORD e_maxalloc;
2722 WORD e_ss;
2723 WORD e_sp;
2724 WORD e_csum;
2725 WORD e_ip;
2726 WORD e_cs;
2727 WORD e_lfarlc;
2728 WORD e_ovno;
2729 WORD e_res[4];
2730 WORD e_oemid;
2731 WORD e_oeminfo;
2732 WORD e_res2[10];
2733 LONG e_lfanew;
2734 } IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
2735 typedef struct _IMAGE_OS2_HEADER {
2736 WORD ne_magic;
2737 CHAR ne_ver;
2738 CHAR ne_rev;
2739 WORD ne_enttab;
2740 WORD ne_cbenttab;
2741 LONG ne_crc;
2742 WORD ne_flags;
2743 WORD ne_autodata;
2744 WORD ne_heap;
2745 WORD ne_stack;
2746 LONG ne_csip;
2747 LONG ne_sssp;
2748 WORD ne_cseg;
2749 WORD ne_cmod;
2750 WORD ne_cbnrestab;
2751 WORD ne_segtab;
2752 WORD ne_rsrctab;
2753 WORD ne_restab;
2754 WORD ne_modtab;
2755 WORD ne_imptab;
2756 LONG ne_nrestab;
2757 WORD ne_cmovent;
2758 WORD ne_align;
2759 WORD ne_cres;
2760 BYTE ne_exetyp;
2761 BYTE ne_flagsothers;
2762 WORD ne_pretthunks;
2763 WORD ne_psegrefbytes;
2764 WORD ne_swaparea;
2765 WORD ne_expver;
2766 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
2767 #pragma pack(pop)
2768 #pragma pack(push,4)
2769 typedef struct _IMAGE_NT_HEADERS32 {
2770 DWORD Signature;
2771 IMAGE_FILE_HEADER FileHeader;
2772 IMAGE_OPTIONAL_HEADER32 OptionalHeader;
2773 } IMAGE_NT_HEADERS32,*PIMAGE_NT_HEADERS32;
2774 typedef struct _IMAGE_NT_HEADERS64 {
2775 DWORD Signature;
2776 IMAGE_FILE_HEADER FileHeader;
2777 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2778 } IMAGE_NT_HEADERS64,*PIMAGE_NT_HEADERS64;
2779 #ifdef _WIN64
2780 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2781 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2782 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2783 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2784 #else
2785 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2786 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2787 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2788 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2789 #endif
2790 typedef struct _IMAGE_ROM_HEADERS {
2791 IMAGE_FILE_HEADER FileHeader;
2792 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader;
2793 } IMAGE_ROM_HEADERS,*PIMAGE_ROM_HEADERS;
2794 typedef struct _IMAGE_SECTION_HEADER {
2795 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2796 union {
2797 DWORD PhysicalAddress;
2798 DWORD VirtualSize;
2799 } Misc;
2800 DWORD VirtualAddress;
2801 DWORD SizeOfRawData;
2802 DWORD PointerToRawData;
2803 DWORD PointerToRelocations;
2804 DWORD PointerToLinenumbers;
2805 WORD NumberOfRelocations;
2806 WORD NumberOfLinenumbers;
2807 DWORD Characteristics;
2808 } IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
2809 #pragma pack(pop)
2810 #pragma pack(push,2)
2811 typedef struct _IMAGE_SYMBOL {
2812 union {
2813 BYTE ShortName[8];
2814 struct {
2815 DWORD Short;
2816 DWORD Long;
2817 } Name;
2818 PBYTE LongName[2];
2819 } N;
2820 DWORD Value;
2821 SHORT SectionNumber;
2822 WORD Type;
2823 BYTE StorageClass;
2824 BYTE NumberOfAuxSymbols;
2825 } IMAGE_SYMBOL,*PIMAGE_SYMBOL;
2826 typedef union _IMAGE_AUX_SYMBOL {
2827 struct {
2828 DWORD TagIndex;
2829 union {
2830 struct {
2831 WORD Linenumber;
2832 WORD Size;
2833 } LnSz;
2834 DWORD TotalSize;
2835 } Misc;
2836 union {
2837 struct {
2838 DWORD PointerToLinenumber;
2839 DWORD PointerToNextFunction;
2840 } Function;
2841 struct {
2842 WORD Dimension[4];
2843 } Array;
2844 } FcnAry;
2845 WORD TvIndex;
2846 } Sym;
2847 struct {
2848 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2849 } File;
2850 struct {
2851 DWORD Length;
2852 WORD NumberOfRelocations;
2853 WORD NumberOfLinenumbers;
2854 DWORD CheckSum;
2855 SHORT Number;
2856 BYTE Selection;
2857 } Section;
2858 } IMAGE_AUX_SYMBOL,*PIMAGE_AUX_SYMBOL;
2859 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2860 DWORD NumberOfSymbols;
2861 DWORD LvaToFirstSymbol;
2862 DWORD NumberOfLinenumbers;
2863 DWORD LvaToFirstLinenumber;
2864 DWORD RvaToFirstByteOfCode;
2865 DWORD RvaToLastByteOfCode;
2866 DWORD RvaToFirstByteOfData;
2867 DWORD RvaToLastByteOfData;
2868 } IMAGE_COFF_SYMBOLS_HEADER,*PIMAGE_COFF_SYMBOLS_HEADER;
2869 typedef struct _IMAGE_RELOCATION {
2870 _ANONYMOUS_UNION union {
2871 DWORD VirtualAddress;
2872 DWORD RelocCount;
2873 } DUMMYUNIONNAME;
2874 DWORD SymbolTableIndex;
2875 WORD Type;
2876 } IMAGE_RELOCATION,*PIMAGE_RELOCATION;
2877 #pragma pack(pop)
2878 #pragma pack(push,4)
2879 typedef struct _IMAGE_BASE_RELOCATION {
2880 DWORD VirtualAddress;
2881 DWORD SizeOfBlock;
2882 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2883 #pragma pack(pop)
2884 #pragma pack(push,2)
2885 typedef struct _IMAGE_LINENUMBER {
2886 union {
2887 DWORD SymbolTableIndex;
2888 DWORD VirtualAddress;
2889 } Type;
2890 WORD Linenumber;
2891 } IMAGE_LINENUMBER,*PIMAGE_LINENUMBER;
2892 #pragma pack(pop)
2893 #pragma pack(push,4)
2894 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER {
2895 BYTE Name[16];
2896 BYTE Date[12];
2897 BYTE UserID[6];
2898 BYTE GroupID[6];
2899 BYTE Mode[8];
2900 BYTE Size[10];
2901 BYTE EndHeader[2];
2902 } IMAGE_ARCHIVE_MEMBER_HEADER,*PIMAGE_ARCHIVE_MEMBER_HEADER;
2903 typedef struct _IMAGE_EXPORT_DIRECTORY {
2904 DWORD Characteristics;
2905 DWORD TimeDateStamp;
2906 WORD MajorVersion;
2907 WORD MinorVersion;
2908 DWORD Name;
2909 DWORD Base;
2910 DWORD NumberOfFunctions;
2911 DWORD NumberOfNames;
2912 DWORD AddressOfFunctions;
2913 DWORD AddressOfNames;
2914 DWORD AddressOfNameOrdinals;
2915 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2916 typedef struct _IMAGE_IMPORT_BY_NAME {
2917 WORD Hint;
2918 BYTE Name[1];
2919 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2920 typedef struct _IMAGE_THUNK_DATA {
2921 union {
2922 PBYTE ForwarderString;
2923 PDWORD Function;
2924 DWORD Ordinal;
2925 PIMAGE_IMPORT_BY_NAME AddressOfData;
2926 } u1;
2927 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
2928 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2929 _ANONYMOUS_UNION union {
2930 DWORD Characteristics;
2931 PIMAGE_THUNK_DATA OriginalFirstThunk;
2932 } DUMMYUNIONNAME;
2933 DWORD TimeDateStamp;
2934 DWORD ForwarderChain;
2935 DWORD Name;
2936 PIMAGE_THUNK_DATA FirstThunk;
2937 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2938 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR {
2939 DWORD TimeDateStamp;
2940 WORD OffsetModuleName;
2941 WORD NumberOfModuleForwarderRefs;
2942 } IMAGE_BOUND_IMPORT_DESCRIPTOR,*PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2943 typedef struct _IMAGE_BOUND_FORWARDER_REF {
2944 DWORD TimeDateStamp;
2945 WORD OffsetModuleName;
2946 WORD Reserved;
2947 } IMAGE_BOUND_FORWARDER_REF,*PIMAGE_BOUND_FORWARDER_REF;
2948 typedef void(NTAPI *PIMAGE_TLS_CALLBACK)(PVOID,DWORD,PVOID);
2949 typedef struct _IMAGE_TLS_DIRECTORY {
2950 DWORD StartAddressOfRawData;
2951 DWORD EndAddressOfRawData;
2952 PDWORD AddressOfIndex;
2953 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2954 DWORD SizeOfZeroFill;
2955 DWORD Characteristics;
2956 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2957 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2958 DWORD Characteristics;
2959 DWORD TimeDateStamp;
2960 WORD MajorVersion;
2961 WORD MinorVersion;
2962 WORD NumberOfNamedEntries;
2963 WORD NumberOfIdEntries;
2964 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2965 _ANONYMOUS_STRUCT typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2966 _ANONYMOUS_UNION union {
2967 _ANONYMOUS_STRUCT struct {
2968 DWORD NameOffset:31;
2969 DWORD NameIsString:1;
2970 }DUMMYSTRUCTNAME;
2971 DWORD Name;
2972 WORD Id;
2973 } DUMMYUNIONNAME;
2974 _ANONYMOUS_UNION union {
2975 DWORD OffsetToData;
2976 _ANONYMOUS_STRUCT struct {
2977 DWORD OffsetToDirectory:31;
2978 DWORD DataIsDirectory:1;
2979 } DUMMYSTRUCTNAME2;
2980 } DUMMYUNIONNAME2;
2981 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2982 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2983 WORD Length;
2984 CHAR NameString[1];
2985 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2986 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2987 WORD Length;
2988 WCHAR NameString[1];
2989 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2990 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2991 DWORD OffsetToData;
2992 DWORD Size;
2993 DWORD CodePage;
2994 DWORD Reserved;
2995 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2996 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2997 DWORD Size;
2998 DWORD TimeDateStamp;
2999 WORD MajorVersion;
3000 WORD MinorVersion;
3001 DWORD GlobalFlagsClear;
3002 DWORD GlobalFlagsSet;
3003 DWORD CriticalSectionDefaultTimeout;
3004 DWORD DeCommitFreeBlockThreshold;
3005 DWORD DeCommitTotalFreeThreshold;
3006 DWORD LockPrefixTable;
3007 DWORD MaximumAllocationSize;
3008 DWORD VirtualMemoryThreshold;
3009 DWORD ProcessHeapFlags;
3010 DWORD ProcessAffinityMask;
3011 WORD CSDVersion;
3012 WORD Reserved1;
3013 DWORD EditList;
3014 DWORD SecurityCookie;
3015 DWORD SEHandlerTable;
3016 DWORD SEHandlerCount;
3017 } IMAGE_LOAD_CONFIG_DIRECTORY,*PIMAGE_LOAD_CONFIG_DIRECTORY;
3018 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY {
3019 DWORD BeginAddress;
3020 DWORD EndAddress;
3021 PVOID ExceptionHandler;
3022 PVOID HandlerData;
3023 DWORD PrologEndAddress;
3024 } IMAGE_RUNTIME_FUNCTION_ENTRY,*PIMAGE_RUNTIME_FUNCTION_ENTRY;
3025 typedef struct _IMAGE_DEBUG_DIRECTORY {
3026 DWORD Characteristics;
3027 DWORD TimeDateStamp;
3028 WORD MajorVersion;
3029 WORD MinorVersion;
3030 DWORD Type;
3031 DWORD SizeOfData;
3032 DWORD AddressOfRawData;
3033 DWORD PointerToRawData;
3034 } IMAGE_DEBUG_DIRECTORY,*PIMAGE_DEBUG_DIRECTORY;
3035 typedef struct _FPO_DATA {
3036 DWORD ulOffStart;
3037 DWORD cbProcSize;
3038 DWORD cdwLocals;
3039 WORD cdwParams;
3040 WORD cbProlog:8;
3041 WORD cbRegs:3;
3042 WORD fHasSEH:1;
3043 WORD fUseBP:1;
3044 WORD reserved:1;
3045 WORD cbFrame:2;
3046 } FPO_DATA,*PFPO_DATA;
3047 typedef struct _IMAGE_DEBUG_MISC {
3048 DWORD DataType;
3049 DWORD Length;
3050 BOOLEAN Unicode;
3051 BYTE Reserved[3];
3052 BYTE Data[1];
3053 } IMAGE_DEBUG_MISC,*PIMAGE_DEBUG_MISC;
3054 typedef struct _IMAGE_FUNCTION_ENTRY {
3055 DWORD StartingAddress;
3056 DWORD EndingAddress;
3057 DWORD EndOfPrologue;
3058 } IMAGE_FUNCTION_ENTRY,*PIMAGE_FUNCTION_ENTRY;
3059 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3060 WORD Signature;
3061 WORD Flags;
3062 WORD Machine;
3063 WORD Characteristics;
3064 DWORD TimeDateStamp;
3065 DWORD CheckSum;
3066 DWORD ImageBase;
3067 DWORD SizeOfImage;
3068 DWORD NumberOfSections;
3069 DWORD ExportedNamesSize;
3070 DWORD DebugDirectorySize;
3071 DWORD SectionAlignment;
3072 DWORD Reserved[2];
3073 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3074 #pragma pack(pop)
3075 typedef enum _CM_SERVICE_NODE_TYPE {
3076 DriverType=SERVICE_KERNEL_DRIVER,
3077 FileSystemType=SERVICE_FILE_SYSTEM_DRIVER,
3078 Win32ServiceOwnProcess=SERVICE_WIN32_OWN_PROCESS,
3079 Win32ServiceShareProcess=SERVICE_WIN32_SHARE_PROCESS,
3080 AdapterType=SERVICE_ADAPTER,
3081 RecognizerType=SERVICE_RECOGNIZER_DRIVER
3082 } SERVICE_NODE_TYPE;
3083 typedef enum _CM_SERVICE_LOAD_TYPE {
3084 BootLoad=SERVICE_BOOT_START,
3085 SystemLoad=SERVICE_SYSTEM_START,
3086 AutoLoad=SERVICE_AUTO_START,
3087 DemandLoad=SERVICE_DEMAND_START,
3088 DisableLoad=SERVICE_DISABLED
3089 } SERVICE_LOAD_TYPE;
3090 typedef enum _CM_ERROR_CONTROL_TYPE {
3091 IgnoreError=SERVICE_ERROR_IGNORE,
3092 NormalError=SERVICE_ERROR_NORMAL,
3093 SevereError=SERVICE_ERROR_SEVERE,
3094 CriticalError=SERVICE_ERROR_CRITICAL
3095 } SERVICE_ERROR_TYPE;
3096 typedef struct _NT_TIB {
3097 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
3098 PVOID StackBase;
3099 PVOID StackLimit;
3100 PVOID SubSystemTib;
3101 _ANONYMOUS_UNION union {
3102 PVOID FiberData;
3103 DWORD Version;
3104 } DUMMYUNIONNAME;
3105 PVOID ArbitraryUserPointer;
3106 struct _NT_TIB *Self;
3107 } NT_TIB,*PNT_TIB;
3108 typedef struct _REPARSE_DATA_BUFFER {
3109 DWORD ReparseTag;
3110 WORD ReparseDataLength;
3111 WORD Reserved;
3112 _ANONYMOUS_UNION union {
3113 struct {
3114 WORD SubstituteNameOffset;
3115 WORD SubstituteNameLength;
3116 WORD PrintNameOffset;
3117 WORD PrintNameLength;
3118 ULONG Flags;
3119 WCHAR PathBuffer[1];
3120 } SymbolicLinkReparseBuffer;
3121 struct {
3122 WORD SubstituteNameOffset;
3123 WORD SubstituteNameLength;
3124 WORD PrintNameOffset;
3125 WORD PrintNameLength;
3126 WCHAR PathBuffer[1];
3127 } MountPointReparseBuffer;
3128 struct {
3129 BYTE DataBuffer[1];
3130 } GenericReparseBuffer;
3131 } DUMMYUNIONNAME;
3132 } REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER;
3133 typedef struct _REPARSE_GUID_DATA_BUFFER {
3134 DWORD ReparseTag;
3135 WORD ReparseDataLength;
3136 WORD Reserved;
3137 GUID ReparseGuid;
3138 struct {
3139 BYTE DataBuffer[1];
3140 } GenericReparseBuffer;
3141 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER;
3142 typedef struct _REPARSE_POINT_INFORMATION {
3143 WORD ReparseDataLength;
3144 WORD UnparsedNameLength;
3145 } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION;
3146
3147 typedef union _FILE_SEGMENT_ELEMENT {
3148 PVOID64 Buffer;
3149 ULONGLONG Alignment;
3150 }FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
3151
3152 /* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */
3153 #define JOB_OBJECT_LIMIT_WORKINGSET 0x0001
3154 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002
3155 #define JOB_OBJECT_LIMIT_JOB_TIME 0x0004
3156 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008
3157 #define JOB_OBJECT_LIMIT_AFFINITY 0x0010
3158 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020
3159 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040
3160 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080
3161 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100
3162 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200
3163 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400
3164 #define JOB_OBJECT_BREAKAWAY_OK 0x0800
3165 #define JOB_OBJECT_SILENT_BREAKAWAY 0x1000
3166
3167 /* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */
3168 #define JOB_OBJECT_UILIMIT_HANDLES 0x0001
3169 #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002
3170 #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004
3171 #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008
3172 #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010
3173 #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020
3174 #define JOB_OBJECT_UILIMIT_DESKTOP 0x0040
3175 #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080
3176
3177 /* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */
3178 #define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001
3179 #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002
3180 #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004
3181 #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008
3182
3183 /* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */
3184 #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0
3185 #define JOB_OBJECT_POST_AT_END_OF_JOB 1
3186
3187 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1
3188 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2
3189 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3
3190 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4
3191 #define JOB_OBJECT_MSG_NEW_PROCESS 6
3192 #define JOB_OBJECT_MSG_EXIT_PROCESS 7
3193 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8
3194 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9
3195 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10
3196
3197 #define JOB_OBJECT_ASSIGN_PROCESS 1
3198 #define JOB_OBJECT_SET_ATTRIBUTES 2
3199 #define JOB_OBJECT_QUERY 4
3200 #define JOB_OBJECT_TERMINATE 8
3201 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 16
3202 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31)
3203
3204 /* FIXME: Oh how I wish, I wish the w32api DDK wouldn't include winnt.h... */
3205 #ifndef __NTDDK_H
3206 typedef enum _JOBOBJECTINFOCLASS {
3207 JobObjectBasicAccountingInformation = 1,
3208 JobObjectBasicLimitInformation,
3209 JobObjectBasicProcessIdList,
3210 JobObjectBasicUIRestrictions,
3211 JobObjectSecurityLimitInformation,
3212 JobObjectEndOfJobTimeInformation,
3213 JobObjectAssociateCompletionPortInformation,
3214 JobObjectBasicAndIoAccountingInformation,
3215 JobObjectExtendedLimitInformation,
3216 JobObjectJobSetInformation,
3217 MaxJobObjectInfoClass
3218 } JOBOBJECTINFOCLASS;
3219 #endif
3220
3221 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION {
3222 LARGE_INTEGER TotalUserTime;
3223 LARGE_INTEGER TotalKernelTime;
3224 LARGE_INTEGER ThisPeriodTotalUserTime;
3225 LARGE_INTEGER ThisPeriodTotalKernelTime;
3226 DWORD TotalPageFaultCount;
3227 DWORD TotalProcesses;
3228 DWORD ActiveProcesses;
3229 DWORD TotalTerminatedProcesses;
3230 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION;
3231 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION {
3232 LARGE_INTEGER PerProcessUserTimeLimit;
3233 LARGE_INTEGER PerJobUserTimeLimit;
3234 DWORD LimitFlags;
3235 SIZE_T MinimumWorkingSetSize;
3236 SIZE_T MaximumWorkingSetSize;
3237 DWORD ActiveProcessLimit;
3238 ULONG_PTR Affinity;
3239 DWORD PriorityClass;
3240 DWORD SchedulingClass;
3241 } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION;
3242 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST {
3243 DWORD NumberOfAssignedProcesses;
3244 DWORD NumberOfProcessIdsInList;
3245 ULONG_PTR ProcessIdList[1];
3246 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST;
3247 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS {
3248 DWORD UIRestrictionsClass;
3249 } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS;
3250 /* Steven you are my hero when you fix the w32api ddk! */
3251 #ifndef __NTDDK_H
3252 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION {
3253 DWORD SecurityLimitFlags;
3254 HANDLE JobToken;
3255 PTOKEN_GROUPS SidsToDisable;
3256 PTOKEN_PRIVILEGES PrivilegesToDelete;
3257 PTOKEN_GROUPS RestrictedSids;
3258 } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION;
3259 #endif
3260 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION {
3261 DWORD EndOfJobTimeAction;
3262 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION;
3263 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT {
3264 PVOID CompletionKey;
3265 HANDLE CompletionPort;
3266 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT;
3267 typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION {
3268 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo;
3269 IO_COUNTERS IoInfo;
3270 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION;
3271 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION {
3272 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
3273 IO_COUNTERS IoInfo;
3274 SIZE_T ProcessMemoryLimit;
3275 SIZE_T JobMemoryLimit;
3276 SIZE_T PeakProcessMemoryUsed;
3277 SIZE_T PeakJobMemoryUsed;
3278 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION;
3279 typedef struct _JOBOBJECT_JOBSET_INFORMATION {
3280 DWORD MemberLevel;
3281 } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION;
3282
3283 /* Fixme: Making these defines conditional on WINVER will break ddk includes */
3284 #if 1 /* (WINVER >= 0x0500) */
3285
3286 #define ES_SYSTEM_REQUIRED 0x00000001
3287 #define ES_DISPLAY_REQUIRED 0x00000002
3288 #define ES_USER_PRESENT 0x00000004
3289 #define ES_CONTINUOUS 0x80000000
3290
3291 typedef enum _LATENCY_TIME {
3292 LT_DONT_CARE,
3293 LT_LOWEST_LATENCY
3294 } LATENCY_TIME, *PLATENCY_TIME;
3295
3296 typedef enum _SYSTEM_POWER_STATE {
3297 PowerSystemUnspecified,
3298 PowerSystemWorking,
3299 PowerSystemSleeping1,
3300 PowerSystemSleeping2,
3301 PowerSystemSleeping3,
3302 PowerSystemHibernate,
3303 PowerSystemShutdown,
3304 PowerSystemMaximum
3305 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE;
3306 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum
3307
3308 typedef enum {
3309 PowerActionNone,
3310 PowerActionReserved,
3311 PowerActionSleep,
3312 PowerActionHibernate,
3313 PowerActionShutdown,
3314 PowerActionShutdownReset,
3315 PowerActionShutdownOff,
3316 PowerActionWarmEject
3317 } POWER_ACTION, *PPOWER_ACTION;
3318
3319 typedef enum _DEVICE_POWER_STATE {
3320 PowerDeviceUnspecified,
3321 PowerDeviceD0,
3322 PowerDeviceD1,
3323 PowerDeviceD2,
3324 PowerDeviceD3,
3325 PowerDeviceMaximum
3326 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3327
3328 typedef struct {
3329 DWORD Granularity;
3330 DWORD Capacity;
3331 } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE;
3332
3333 typedef struct _POWER_ACTION_POLICY {
3334 POWER_ACTION Action;
3335 ULONG Flags;
3336 ULONG EventCode;
3337 } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY;
3338
3339 /* POWER_ACTION_POLICY.Flags constants */
3340 #define POWER_ACTION_QUERY_ALLOWED 0x00000001
3341 #define POWER_ACTION_UI_ALLOWED 0x00000002
3342 #define POWER_ACTION_OVERRIDE_APPS 0x00000004
3343 #define POWER_ACTION_LIGHTEST_FIRST 0x10000000
3344 #define POWER_ACTION_LOCK_CONSOLE 0x20000000
3345 #define POWER_ACTION_DISABLE_WAKES 0x40000000
3346 #define POWER_ACTION_CRITICAL 0x80000000
3347
3348 /* POWER_ACTION_POLICY.EventCode constants */
3349 #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001
3350 #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002
3351 #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004
3352 #define POWER_USER_NOTIFY_BUTTON 0x00000008
3353 #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010
3354 #define POWER_FORCE_TRIGGER_RESET 0x80000000
3355
3356 #define DISCHARGE_POLICY_CRITICAL 0
3357 #define DISCHARGE_POLICY_LOW 1
3358 #define NUM_DISCHARGE_POLICIES 4
3359
3360 #define PO_THROTTLE_NONE 0
3361 #define PO_THROTTLE_CONSTANT 1
3362 #define PO_THROTTLE_DEGRADE 2
3363 #define PO_THROTTLE_ADAPTIVE 3
3364 #define PO_THROTTLE_MAXIMUM 4
3365
3366 typedef struct _SYSTEM_POWER_LEVEL {
3367 BOOLEAN Enable;
3368 UCHAR Spare[3];
3369 ULONG BatteryLevel;
3370 POWER_ACTION_POLICY PowerPolicy;
3371 SYSTEM_POWER_STATE MinSystemState;
3372 } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL;
3373
3374 typedef struct _SYSTEM_POWER_POLICY {
3375 ULONG Revision;
3376 POWER_ACTION_POLICY PowerButton;
3377 POWER_ACTION_POLICY SleepButton;
3378 POWER_ACTION_POLICY LidClose;
3379 SYSTEM_POWER_STATE LidOpenWake;
3380 ULONG Reserved;
3381 POWER_ACTION_POLICY Idle;
3382 ULONG IdleTimeout;
3383 UCHAR IdleSensitivity;
3384 UCHAR DynamicThrottle;
3385 UCHAR Spare2[2];
3386 SYSTEM_POWER_STATE MinSleep;
3387 SYSTEM_POWER_STATE MaxSleep;
3388 SYSTEM_POWER_STATE ReducedLatencySleep;
3389 ULONG WinLogonFlags;
3390 ULONG Spare3;
3391 ULONG DozeS4Timeout;
3392 ULONG BroadcastCapacityResolution;
3393 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
3394 ULONG VideoTimeout;
3395 BOOLEAN VideoDimDisplay;
3396 ULONG VideoReserved[3];
3397 ULONG SpindownTimeout;
3398 BOOLEAN OptimizeForPower;
3399 UCHAR FanThrottleTolerance;
3400 UCHAR ForcedThrottle;
3401 UCHAR MinThrottle;
3402 POWER_ACTION_POLICY OverThrottled;
3403 } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY;
3404
3405 typedef struct _SYSTEM_POWER_CAPABILITIES {
3406 BOOLEAN PowerButtonPresent;
3407 BOOLEAN SleepButtonPresent;
3408 BOOLEAN LidPresent;
3409 BOOLEAN SystemS1;
3410 BOOLEAN SystemS2;
3411 BOOLEAN SystemS3;
3412 BOOLEAN SystemS4;
3413 BOOLEAN SystemS5;
3414 BOOLEAN HiberFilePresent;
3415 BOOLEAN FullWake;
3416 BOOLEAN VideoDimPresent;
3417 BOOLEAN ApmPresent;
3418 BOOLEAN UpsPresent;
3419 BOOLEAN ThermalControl;
3420 BOOLEAN ProcessorThrottle;
3421 UCHAR ProcessorMinThrottle;
3422 UCHAR ProcessorMaxThrottle;
3423 UCHAR spare2[4];
3424 BOOLEAN DiskSpinDown;
3425 UCHAR spare3[8];
3426 BOOLEAN SystemBatteriesPresent;
3427 BOOLEAN BatteriesAreShortTerm;
3428 BATTERY_REPORTING_SCALE BatteryScale[3];
3429 SYSTEM_POWER_STATE AcOnLineWake;
3430 SYSTEM_POWER_STATE SoftLidWake;
3431 SYSTEM_POWER_STATE RtcWake;
3432 SYSTEM_POWER_STATE MinDeviceWakeState;
3433 SYSTEM_POWER_STATE DefaultLowLatencyWake;
3434 } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES;
3435
3436 typedef struct _SYSTEM_BATTERY_STATE {
3437 BOOLEAN AcOnLine;
3438 BOOLEAN BatteryPresent;
3439 BOOLEAN Charging;
3440 BOOLEAN Discharging;
3441 BOOLEAN Spare1[4];
3442 ULONG MaxCapacity;
3443 ULONG RemainingCapacity;
3444 ULONG Rate;
3445 ULONG EstimatedTime;
3446 ULONG DefaultAlert1;
3447 ULONG DefaultAlert2;
3448 } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE;
3449
3450 typedef DWORD EXECUTION_STATE;
3451 typedef enum _POWER_INFORMATION_LEVEL {
3452 SystemPowerPolicyAc,
3453 SystemPowerPolicyDc,
3454 VerifySystemPolicyAc,
3455 VerifySystemPolicyDc,
3456 SystemPowerCapabilities,
3457 SystemBatteryState,
3458 SystemPowerStateHandler,
3459 ProcessorStateHandler,
3460 SystemPowerPolicyCurrent,
3461 AdministratorPowerPolicy,
3462 SystemReserveHiberFile,
3463 ProcessorInformation,
3464 SystemPowerInformation,
3465 ProcessorStateHandler2,
3466 LastWakeTime,
3467 LastSleepTime,
3468 SystemExecutionState,
3469 SystemPowerStateNotifyHandler,
3470 ProcessorPowerPolicyAc,
3471 ProcessorPowerPolicyDc,
3472 VerifyProcessorPowerPolicyAc,
3473 VerifyProcessorPowerPolicyDc,
3474 ProcessorPowerPolicyCurrent
3475 } POWER_INFORMATION_LEVEL;
3476
3477 #if (_WIN32_WINNT >= 0x0500)
3478 typedef LONG (WINAPI *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS);
3479 #endif
3480 #if 1 /* (WIN32_WINNT >= 0x0500) */
3481 typedef struct _SYSTEM_POWER_INFORMATION {
3482 ULONG MaxIdlenessAllowed;
3483 ULONG Idleness;
3484 ULONG TimeRemaining;
3485 UCHAR CoolingMode;
3486 } SYSTEM_POWER_INFORMATION,*PSYSTEM_POWER_INFORMATION;
3487 #endif
3488
3489 #if (_WIN32_WINNT >= 0x0500)
3490 typedef enum _AUDIT_EVENT_TYPE {
3491 AuditEventObjectAccess,
3492 AuditEventDirectoryServiceAccess
3493 } AUDIT_EVENT_TYPE, *PAUDIT_EVENT_TYPE;
3494 #endif
3495
3496 #if (_WIN32_WINNT >= 0x0501)
3497 typedef enum _HEAP_INFORMATION_CLASS {
3498 HeapCompatibilityInformation
3499 } HEAP_INFORMATION_CLASS;
3500 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
3501 ActivationContextBasicInformation = 1,
3502 ActivationContextDetailedInformation,
3503 AssemblyDetailedInformationInActivationContext,
3504 FileInformationInAssemblyOfAssemblyInActivationContext
3505 } ACTIVATION_CONTEXT_INFO_CLASS;
3506 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
3507 DWORD ulFlags;
3508 DWORD ulEncodedAssemblyIdentityLength;
3509 DWORD ulManifestPathType;
3510 DWORD ulManifestPathLength;
3511 LARGE_INTEGER liManifestLastWriteTime;
3512 DWORD ulPolicyPathType;
3513 DWORD ulPolicyPathLength;
3514 LARGE_INTEGER liPolicyLastWriteTime;
3515 DWORD ulMetadataSatelliteRosterIndex;
3516 DWORD ulManifestVersionMajor;
3517 DWORD ulManifestVersionMinor;
3518 DWORD ulPolicyVersionMajor;
3519 DWORD ulPolicyVersionMinor;
3520 DWORD ulAssemblyDirectoryNameLength;
3521 PCWSTR lpAssemblyEncodedAssemblyIdentity;
3522 PCWSTR lpAssemblyManifestPath;
3523 PCWSTR lpAssemblyPolicyPath;
3524 PCWSTR lpAssemblyDirectoryName;
3525 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3526 typedef const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
3527 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
3528 DWORD dwFlags;
3529 DWORD ulFormatVersion;
3530 DWORD ulAssemblyCount;
3531 DWORD ulRootManifestPathType;
3532 DWORD ulRootManifestPathChars;
3533 DWORD ulRootConfigurationPathType;
3534 DWORD ulRootConfigurationPathChars;
3535 DWORD ulAppDirPathType;
3536 DWORD ulAppDirPathChars;
3537 PCWSTR lpRootManifestPath;
3538 PCWSTR lpRootConfigurationPath;
3539 PCWSTR lpAppDirPath;
3540 } ACTIVATION_CONTEXT_DETAILED_INFORMATION,*PACTIVATION_CONTEXT_DETAILED_INFORMATION;
3541 typedef const ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION;
3542 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
3543 ULONG ulAssemblyIndex;
3544 ULONG ulFileIndexInAssembly;
3545 } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX;
3546 typedef const ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
3547 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
3548 DWORD ulFlags;
3549 DWORD ulFilenameLength;
3550 DWORD ulPathLength;
3551 PCWSTR lpFileName;
3552 PCWSTR lpFilePath;
3553 } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION;
3554 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
3555 #endif /* (WIN32_WINNT >= 0x0501) */
3556
3557 typedef struct _PROCESSOR_POWER_POLICY_INFO {
3558 ULONG TimeCheck;
3559 ULONG DemoteLimit;
3560 ULONG PromoteLimit;
3561 UCHAR DemotePercent;
3562 UCHAR PromotePercent;
3563 UCHAR Spare[2];
3564 ULONG AllowDemotion : 1;
3565 ULONG AllowPromotion : 1;
3566 ULONG Reserved : 30;
3567 } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO;
3568 typedef struct _PROCESSOR_POWER_POLICY {
3569 ULONG Revision;
3570 UCHAR DynamicThrottle;
3571 UCHAR Spare[3];
3572 ULONG Reserved;
3573 ULONG PolicyCount;
3574 PROCESSOR_POWER_POLICY_INFO Policy[3];
3575 } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY;
3576 typedef struct _ADMINISTRATOR_POWER_POLICY {
3577 SYSTEM_POWER_STATE MinSleep;
3578 SYSTEM_POWER_STATE MaxSleep;
3579 ULONG MinVideoTimeout;
3580 ULONG MaxVideoTimeout;
3581 ULONG MinSpindownTimeout;
3582 ULONG MaxSpindownTimeout;
3583 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
3584 #endif /* WINVER >= 0x0500 */
3585
3586 typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN);
3587
3588 #ifdef UNICODE
3589 typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3590 typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3591 #else
3592 typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO;
3593 typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX;
3594 #endif
3595
3596 #if (WIN32_WINNT >= 0x0500)
3597 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
3598 #endif
3599
3600 SIZE_T
3601 STDCALL
3602 RtlCompareMemory (
3603 const VOID *Source1,
3604 const VOID *Source2,
3605 SIZE_T Length
3606 );
3607
3608 #define RtlMoveMemory memmove
3609 #define RtlCopyMemory memcpy
3610 #define RtlFillMemory(d,l,f) memset((d), (f), (l))
3611 #define RtlZeroMemory(d,l) RtlFillMemory((d),(l),0)
3612
3613 typedef struct _OBJECT_TYPE_LIST {
3614 WORD Level;
3615 WORD Sbz;
3616 GUID *ObjectType;
3617 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
3618
3619 #if defined(__GNUC__)
3620
3621 static __inline__ PVOID GetCurrentFiber(void)
3622 {
3623 void* ret;
3624 __asm__ __volatile__ (
3625 "movl %%fs:0x10,%0"
3626 : "=r" (ret) /* allow use of reg eax,ebx,ecx,edx,esi,edi */
3627 );
3628 return ret;
3629 }
3630
3631 static __inline__ struct _TEB * NtCurrentTeb(void)
3632 {
3633 struct _TEB *ret;
3634
3635 __asm__ __volatile__ (
3636 "movl %%fs:0x18, %0\n"
3637 : "=r" (ret)
3638 : /* no inputs */
3639 );
3640
3641 return ret;
3642 }
3643
3644 #elif defined(__WATCOMC__)
3645
3646 extern PVOID GetCurrentFiber(void);
3647 #pragma aux GetCurrentFiber = \
3648 "mov eax, dword ptr fs:0x10" \
3649 value [eax] \
3650 modify [eax];
3651
3652 extern struct _TEB * NtCurrentTeb(void);
3653 #pragma aux NtCurrentTeb = \
3654 "mov eax, dword ptr fs:0x18" \
3655 value [eax] \
3656 modify [eax];
3657
3658 #elif defined(_MSC_VER)
3659
3660 #if (_MSC_FULL_VER >= 13012035)
3661
3662 DWORD __readfsdword(DWORD);
3663 #pragma intrinsic(__readfsdword)
3664
3665 __inline PVOID GetCurrentFiber(void) { return (PVOID)(ULONG_PTR)__readfsdword(0x10); }
3666 __inline struct _TEB * NtCurrentTeb(void) { return (PVOID)(ULONG_PTR)__readfsdword(0x18); }
3667
3668 #else
3669
3670 static __inline PVOID GetCurrentFiber(void)
3671 {
3672 PVOID p;
3673 __asm mov eax, fs:[10h]
3674 __asm mov [p], eax
3675 return p;
3676 }
3677
3678 static __inline struct _TEB * NtCurrentTeb(void)
3679 {
3680 struct _TEB *p;
3681 __asm mov eax, fs:[18h]
3682 __asm mov [p], eax
3683 return p;
3684 }
3685
3686 #endif /* _MSC_FULL_VER */
3687
3688 #endif /* __GNUC__/__WATCOMC__/_MSC_VER */
3689
3690 static __inline PVOID GetFiberData(void)
3691 {
3692 return *((PVOID *)GetCurrentFiber());
3693 }
3694
3695 #if defined(__GNUC__)
3696
3697 static __inline__ BOOLEAN
3698 InterlockedBitTestAndSet(IN LONG *Base,
3699 IN LONG Bit)
3700 {
3701 LONG OldBit;
3702
3703 __asm__ __volatile__("lock"
3704 "btsl %2,%1\n\t"
3705 "sbbl %0,%0\n\t"
3706 :"=r" (OldBit),"=m" (*Base)
3707 :"Ir" (Bit)
3708 : "memory");
3709 return OldBit;
3710 }
3711
3712 static __inline__ BOOLEAN
3713 InterlockedBitTestAndReset(IN LONG *Base,
3714 IN LONG Bit)
3715 {
3716 LONG OldBit;
3717
3718 __asm__ __volatile__("lock"
3719 "btrl %2,%1\n\t"
3720 "sbbl %0,%0\n\t"
3721 :"=r" (OldBit),"=m" (*Base)
3722 :"Ir" (Bit)
3723 : "memory");
3724 return OldBit;
3725 }
3726
3727 #endif
3728
3729 #if defined(_AMD64_)
3730 #if defined(_M_AMD64)
3731
3732 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd64((LONG64 *)a, b)
3733
3734 #endif
3735
3736 #else
3737
3738 #define InterlockedExchangeAddSizeT(a, b) InterlockedExchangeAdd((LONG *)a, b)
3739
3740 #endif
3741
3742 #endif /* RC_INVOKED */
3743
3744 #ifdef __cplusplus
3745 }
3746 #endif
3747 #endif