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