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