d3dx9: Implement ID3DXBaseEffect::GetAnnotationByName().
[wine.git] / include / winnt.h
blob62d5f80fa2812fff010a9321cf209ca97433b47a
1 /*
2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _WINNT_
22 #define _WINNT_
24 #include <basetsd.h>
25 #include <guiddef.h>
27 #ifndef RC_INVOKED
28 #include <ctype.h>
29 #include <stddef.h>
30 #include <string.h>
31 #endif
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #ifdef _NTSYSTEM_
39 #define NTSYSAPI
40 #else
41 #define NTSYSAPI DECLSPEC_IMPORT
42 #endif
44 #define NTAPI __stdcall
46 #ifndef MIDL_PASS
47 # if defined(_MSC_VER)
48 # define DECLSPEC_IMPORT __declspec(dllimport)
49 # elif defined(__MINGW32__) || defined(__CYGWIN__)
50 # define DECLSPEC_IMPORT __attribute__((dllimport))
51 # else
52 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
53 # endif
54 #else
55 # define DECLSPEC_IMPORT
56 #endif
58 #ifndef DECLSPEC_NORETURN
59 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
60 # define DECLSPEC_NORETURN __declspec(noreturn)
61 # elif defined(__GNUC__)
62 # define DECLSPEC_NORETURN __attribute__((noreturn))
63 # else
64 # define DECLSPEC_NORETURN
65 # endif
66 #endif
68 #ifndef DECLSPEC_ALIGN
69 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
70 # define DECLSPEC_ALIGN(x) __declspec(align(x))
71 # elif defined(__GNUC__)
72 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
73 # else
74 # define DECLSPEC_ALIGN(x)
75 # endif
76 #endif
78 #ifndef DECLSPEC_CACHEALIGN
79 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
80 #endif
82 #ifndef DECLSPEC_UUID
83 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
84 # define DECLSPEC_UUID(x) __declspec(uuid(x))
85 # else
86 # define DECLSPEC_UUID(x)
87 # endif
88 #endif
90 #ifndef DECLSPEC_NOVTABLE
91 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
92 # define DECLSPEC_NOVTABLE __declspec(novtable)
93 # else
94 # define DECLSPEC_NOVTABLE
95 # endif
96 #endif
98 #ifndef DECLSPEC_SELECTANY
99 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
100 #define DECLSPEC_SELECTANY __declspec(selectany)
101 #else
102 #define DECLSPEC_SELECTANY
103 #endif
104 #endif
106 #ifndef NOP_FUNCTION
107 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
108 # define NOP_FUNCTION __noop
109 # else
110 # define NOP_FUNCTION (void)0
111 # endif
112 #endif
114 #ifndef DECLSPEC_ADDRSAFE
115 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
116 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
117 # else
118 # define DECLSPEC_ADDRSAFE
119 # endif
120 #endif
122 #ifndef FORCEINLINE
123 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
124 # define FORCEINLINE __forceinline
125 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
126 # define FORCEINLINE inline __attribute__((always_inline))
127 # else
128 # define FORCEINLINE inline
129 # endif
130 #endif
132 #ifndef DECLSPEC_DEPRECATED
133 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
134 # define DECLSPEC_DEPRECATED __declspec(deprecated)
135 # define DEPRECATE_SUPPORTED
136 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
137 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
138 # define DEPRECATE_SUPPORTED
139 # else
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
142 # endif
143 #endif
145 /* a couple of useful Wine extensions */
147 #ifdef _MSC_VER
148 # define DECLSPEC_EXPORT __declspec(dllexport)
149 #elif defined(__MINGW32__)
150 # define DECLSPEC_EXPORT __attribute__((dllexport))
151 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
152 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
153 #else
154 # define DECLSPEC_EXPORT
155 #endif
157 #if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
158 # define DECLSPEC_HIDDEN
159 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
160 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
161 #else
162 # define DECLSPEC_HIDDEN
163 #endif
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
167 #else
168 #define __WINE_ALLOC_SIZE(x)
169 #endif
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
174 # ifdef __GNUC__
175 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
176 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
177 # define NONAMELESSSTRUCT
178 # endif
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
181 # endif
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
185 # ifdef __GNUC__
186 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
187 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
188 # define NONAMELESSUNION
189 # endif
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
192 # endif
193 #endif /* NONAMELESSUNION */
195 #ifndef NONAMELESSSTRUCT
196 #define DUMMYSTRUCTNAME
197 #define DUMMYSTRUCTNAME1
198 #define DUMMYSTRUCTNAME2
199 #define DUMMYSTRUCTNAME3
200 #define DUMMYSTRUCTNAME4
201 #define DUMMYSTRUCTNAME5
202 #else /* !defined(NONAMELESSSTRUCT) */
203 #define DUMMYSTRUCTNAME s
204 #define DUMMYSTRUCTNAME1 s1
205 #define DUMMYSTRUCTNAME2 s2
206 #define DUMMYSTRUCTNAME3 s3
207 #define DUMMYSTRUCTNAME4 s4
208 #define DUMMYSTRUCTNAME5 s5
209 #endif /* !defined(NONAMELESSSTRUCT) */
211 #ifndef NONAMELESSUNION
212 #define DUMMYUNIONNAME
213 #define DUMMYUNIONNAME1
214 #define DUMMYUNIONNAME2
215 #define DUMMYUNIONNAME3
216 #define DUMMYUNIONNAME4
217 #define DUMMYUNIONNAME5
218 #define DUMMYUNIONNAME6
219 #define DUMMYUNIONNAME7
220 #define DUMMYUNIONNAME8
221 #else /* !defined(NONAMELESSUNION) */
222 #define DUMMYUNIONNAME u
223 #define DUMMYUNIONNAME1 u1
224 #define DUMMYUNIONNAME2 u2
225 #define DUMMYUNIONNAME3 u3
226 #define DUMMYUNIONNAME4 u4
227 #define DUMMYUNIONNAME5 u5
228 #define DUMMYUNIONNAME6 u6
229 #define DUMMYUNIONNAME7 u7
230 #define DUMMYUNIONNAME8 u8
231 #endif /* !defined(NONAMELESSUNION) */
233 #ifndef __C89_NAMELESS
234 # if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
235 # ifdef __GNUC__
236 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
237 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
238 # define __C89_NAMELESS __extension__
239 # endif
240 # elif defined(_MSC_VER)
241 # define __C89_NAMELESS
242 # endif
243 # endif
244 #endif
246 #ifdef __C89_NAMELESS
247 # define __C89_NAMELESSSTRUCTNAME
248 # define __C89_NAMELESSUNIONNAME
249 #else
250 # define __C89_NAMELESS
251 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
252 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
253 #endif
255 /* C99 restrict support */
257 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
258 # if defined(_MSC_VER) && defined(_M_MRX000)
259 # define RESTRICTED_POINTER __restrict
260 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
261 # define RESTRICTED_POINTER __restrict
262 # else
263 # define RESTRICTED_POINTER
264 # endif
265 #else
266 # define RESTRICTED_POINTER
267 #endif
269 /* C99 unaligned support */
271 #ifndef UNALIGNED
272 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
273 # define UNALIGNED __unaligned
274 # ifdef _WIN64
275 # define UNALIGNED64 __unaligned
276 # else
277 # define UNALIGNED64
278 # endif
279 #else
280 # define UNALIGNED
281 # define UNALIGNED64
282 #endif
283 #endif
285 /* Alignment macros */
287 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
288 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
289 #define MEMORY_ALLOCATION_ALIGNMENT 16
290 #else
291 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
292 #define MEMORY_ALLOCATION_ALIGNMENT 8
293 #endif
295 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
296 # define TYPE_ALIGNMENT(t) __alignof(t)
297 #elif defined(__GNUC__)
298 # define TYPE_ALIGNMENT(t) __alignof__(t)
299 #else
300 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
301 #endif
303 #ifdef _WIN64
304 # define PROBE_ALIGNMENT(_s) \
305 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
306 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
307 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
308 #else
309 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
310 #endif
312 /* Compile time assertion */
314 #if defined(_MSC_VER)
315 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
316 #else
317 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
318 #endif
320 /* Eliminate Microsoft C/C++ compiler warning 4715 */
321 #if defined(_MSC_VER) && (_MSC_VER > 1200)
322 # define DEFAULT_UNREACHABLE default: __assume(0)
323 #else
324 # define DEFAULT_UNREACHABLE
325 #endif
327 /* Error Masks */
328 #define APPLICATION_ERROR_MASK 0x20000000
329 #define ERROR_SEVERITY_SUCCESS 0x00000000
330 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
331 #define ERROR_SEVERITY_WARNING 0x80000000
332 #define ERROR_SEVERITY_ERROR 0xC0000000
334 #ifdef __cplusplus
335 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
336 extern "C++" { \
337 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
338 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
339 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
340 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
341 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
342 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
343 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
345 #else
346 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
347 #endif
349 /* Microsoft's macros for declaring functions */
351 #ifdef __cplusplus
352 # define EXTERN_C extern "C"
353 #else
354 # define EXTERN_C extern
355 #endif
357 #define STDMETHODCALLTYPE __stdcall
358 #define STDMETHODVCALLTYPE __cdecl
359 #define STDAPICALLTYPE __stdcall
360 #define STDAPIVCALLTYPE __cdecl
362 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
363 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
364 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
365 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
366 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
367 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
368 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
369 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
371 /* Define the basic types */
372 #ifndef VOID
373 #define VOID void
374 #endif
375 typedef VOID *PVOID;
376 typedef VOID *PVOID64;
377 typedef BYTE BOOLEAN, *PBOOLEAN;
378 typedef char CHAR, *PCHAR;
379 typedef short SHORT, *PSHORT;
380 #ifdef _MSC_VER
381 typedef long LONG, *PLONG;
382 #else
383 typedef int LONG, *PLONG;
384 #endif
386 /* Some systems might have wchar_t, but we really need 16 bit characters */
387 #ifdef WINE_UNICODE_NATIVE
388 typedef wchar_t WCHAR, *PWCHAR;
389 #else
390 typedef unsigned short WCHAR, *PWCHAR;
391 #endif
393 /* 'Extended/Wide' numerical types */
394 #ifndef _ULONGLONG_
395 # define _ULONGLONG_
396 # ifdef _MSC_VER
397 typedef signed __int64 LONGLONG, *PLONGLONG;
398 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
399 # else
400 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
401 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
402 # endif
403 #endif
405 #ifndef _DWORDLONG_
406 # define _DWORDLONG_
407 # ifdef _MSC_VER
408 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
409 # else
410 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
411 # endif
412 #endif
414 /* ANSI string types */
415 typedef CHAR *PCH, *LPCH;
416 typedef const CHAR *PCCH, *LPCCH;
417 typedef CHAR *PSTR, *LPSTR, *NPSTR;
418 typedef const CHAR *PCSTR, *LPCSTR;
420 /* Unicode string types */
421 typedef WCHAR *PWCH, *LPWCH;
422 typedef const WCHAR *PCWCH, *LPCWCH;
423 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
424 typedef const WCHAR *PCWSTR, *LPCWSTR;
425 typedef WCHAR *PZZWSTR;
426 typedef const WCHAR *PCZZWSTR;
428 /* Neutral character and string types */
429 /* These are only defined for Winelib, i.e. _not_ defined for
430 * the emulator. The reason is they depend on the UNICODE
431 * macro which only exists in the user's code.
433 #ifndef WINE_NO_UNICODE_MACROS
434 # ifdef UNICODE
435 # ifndef _TCHAR_DEFINED
436 typedef WCHAR TCHAR, *PTCHAR;
437 # define _TCHAR_DEFINED
438 #endif
439 typedef LPWSTR PTSTR, LPTSTR;
440 typedef LPCWSTR PCTSTR, LPCTSTR;
441 # define __TEXT(string) L##string
442 # else /* UNICODE */
443 # ifndef _TCHAR_DEFINED
444 typedef CHAR TCHAR, *PTCHAR;
445 # define _TCHAR_DEFINED
446 # endif
447 typedef LPSTR PTSTR, LPTSTR;
448 typedef LPCSTR PCTSTR, LPCTSTR;
449 # define __TEXT(string) string
450 # endif /* UNICODE */
451 # define TEXT(quote) __TEXT(quote)
452 #endif /* WINE_NO_UNICODE_MACROS */
454 /* Misc common WIN32 types */
455 typedef char CCHAR;
456 typedef DWORD LCID, *PLCID;
457 typedef WORD LANGID;
458 typedef DWORD EXECUTION_STATE;
459 #ifndef _HRESULT_DEFINED
460 #define _HRESULT_DEFINED
461 typedef LONG HRESULT;
462 #endif
464 /* Handle type */
466 typedef void *HANDLE;
467 typedef HANDLE *PHANDLE, *LPHANDLE;
469 #ifdef STRICT
470 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
471 #else /*STRICT*/
472 #define DECLARE_HANDLE(a) typedef HANDLE a
473 #endif /*STRICT*/
475 typedef BYTE FCHAR;
476 typedef WORD FSHORT;
477 typedef DWORD FLONG;
479 /* Defines */
481 #ifndef WIN32_NO_STATUS
483 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
484 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
485 #define STATUS_USER_APC ((DWORD) 0x000000C0)
486 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
487 #define STATUS_PENDING ((DWORD) 0x00000103)
488 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
489 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
490 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
491 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
492 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
493 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
494 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
495 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
496 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
497 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
498 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
499 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
500 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
501 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
502 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
503 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
504 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
505 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
506 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
507 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
508 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
509 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
510 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
511 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
512 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
513 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
514 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
515 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
516 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
517 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
519 /* status values for ContinueDebugEvent */
520 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
521 #define DBG_CONTINUE ((DWORD) 0x00010002)
522 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
523 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
524 #define DBG_CONTROL_C ((DWORD) 0x40010005)
525 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
526 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
527 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
529 #endif /* WIN32_NO_STATUS */
531 /* Argument 1 passed to the DllEntryProc. */
532 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
533 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
534 #define DLL_THREAD_ATTACH 2 /* attach new thread */
535 #define DLL_THREAD_DETACH 3 /* detach thread */
536 #ifdef __WINESRC__
537 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
538 #endif
540 /* u.x.wProcessorArchitecture (NT) */
541 #define PROCESSOR_ARCHITECTURE_INTEL 0
542 #define PROCESSOR_ARCHITECTURE_MIPS 1
543 #define PROCESSOR_ARCHITECTURE_ALPHA 2
544 #define PROCESSOR_ARCHITECTURE_PPC 3
545 #define PROCESSOR_ARCHITECTURE_SHX 4
546 #define PROCESSOR_ARCHITECTURE_ARM 5
547 #define PROCESSOR_ARCHITECTURE_IA64 6
548 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
549 #define PROCESSOR_ARCHITECTURE_MSIL 8
550 #define PROCESSOR_ARCHITECTURE_AMD64 9
551 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
552 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
554 /* Wine extension */
555 #define PROCESSOR_ARCHITECTURE_SPARC 20
557 /* dwProcessorType */
558 #define PROCESSOR_INTEL_386 386
559 #define PROCESSOR_INTEL_486 486
560 #define PROCESSOR_INTEL_PENTIUM 586
561 #define PROCESSOR_INTEL_860 860
562 #define PROCESSOR_INTEL_IA64 2200
563 #define PROCESSOR_AMD_X8664 8664
564 #define PROCESSOR_MIPS_R2000 2000
565 #define PROCESSOR_MIPS_R3000 3000
566 #define PROCESSOR_MIPS_R4000 4000
567 #define PROCESSOR_ALPHA_21064 21064
568 #define PROCESSOR_PPC_601 601
569 #define PROCESSOR_PPC_603 603
570 #define PROCESSOR_PPC_604 604
571 #define PROCESSOR_PPC_620 620
572 #define PROCESSOR_HITACHI_SH3 10003
573 #define PROCESSOR_HITACHI_SH3E 10004
574 #define PROCESSOR_HITACHI_SH4 10005
575 #define PROCESSOR_MOTOROLA_821 821
576 #define PROCESSOR_SHx_SH3 103
577 #define PROCESSOR_SHx_SH4 104
578 #define PROCESSOR_STRONGARM 2577
579 #define PROCESSOR_ARM720 1824 /* 0x720 */
580 #define PROCESSOR_ARM820 2080 /* 0x820 */
581 #define PROCESSOR_ARM920 2336 /* 0x920 */
582 #define PROCESSOR_ARM_7TDMI 70001
583 #define PROCESSOR_OPTIL 18767
585 #ifdef _WIN64
586 #define MAXIMUM_PROCESSORS 64
587 #else
588 #define MAXIMUM_PROCESSORS 32
589 #endif
591 typedef struct _MEMORY_BASIC_INFORMATION
593 LPVOID BaseAddress;
594 LPVOID AllocationBase;
595 DWORD AllocationProtect;
596 SIZE_T RegionSize;
597 DWORD State;
598 DWORD Protect;
599 DWORD Type;
600 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
602 #define PAGE_NOACCESS 0x01
603 #define PAGE_READONLY 0x02
604 #define PAGE_READWRITE 0x04
605 #define PAGE_WRITECOPY 0x08
606 #define PAGE_EXECUTE 0x10
607 #define PAGE_EXECUTE_READ 0x20
608 #define PAGE_EXECUTE_READWRITE 0x40
609 #define PAGE_EXECUTE_WRITECOPY 0x80
610 #define PAGE_GUARD 0x100
611 #define PAGE_NOCACHE 0x200
612 #define PAGE_WRITECOMBINE 0x400
614 #define MEM_COMMIT 0x00001000
615 #define MEM_RESERVE 0x00002000
616 #define MEM_DECOMMIT 0x00004000
617 #define MEM_RELEASE 0x00008000
618 #define MEM_FREE 0x00010000
619 #define MEM_PRIVATE 0x00020000
620 #define MEM_MAPPED 0x00040000
621 #define MEM_RESET 0x00080000
622 #define MEM_TOP_DOWN 0x00100000
623 #define MEM_WRITE_WATCH 0x00200000
624 #define MEM_PHYSICAL 0x00400000
625 #define MEM_LARGE_PAGES 0x20000000
626 #define MEM_4MB_PAGES 0x80000000
628 #define SEC_FILE 0x00800000
629 #define SEC_IMAGE 0x01000000
630 #define SEC_RESERVE 0x04000000
631 #define SEC_COMMIT 0x08000000
632 #define SEC_NOCACHE 0x10000000
633 #define SEC_LARGE_PAGES 0x80000000
634 #define MEM_IMAGE SEC_IMAGE
636 #define WRITE_WATCH_FLAG_RESET 0x00000001
639 #define MINCHAR 0x80
640 #define MAXCHAR 0x7f
641 #define MINSHORT 0x8000
642 #define MAXSHORT 0x7fff
643 #define MINLONG 0x80000000
644 #define MAXLONG 0x7fffffff
645 #define MAXBYTE 0xff
646 #define MAXWORD 0xffff
647 #define MAXDWORD 0xffffffff
649 #define UNICODE_STRING_MAX_CHARS 32767
651 #define FIELD_OFFSET(type, field) \
652 ((LONG)(INT_PTR)&(((type *)0)->field))
654 #define CONTAINING_RECORD(address, type, field) \
655 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
657 /* Types */
659 typedef struct _LIST_ENTRY {
660 struct _LIST_ENTRY *Flink;
661 struct _LIST_ENTRY *Blink;
662 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
664 typedef struct _SINGLE_LIST_ENTRY {
665 struct _SINGLE_LIST_ENTRY *Next;
666 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
668 #ifdef _WIN64
670 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY;
671 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
672 PSLIST_ENTRY Next;
673 } SLIST_ENTRY;
675 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
676 struct {
677 ULONGLONG Alignment;
678 ULONGLONG Region;
679 } DUMMYSTRUCTNAME;
680 struct {
681 ULONGLONG Depth:16;
682 ULONGLONG Sequence:9;
683 ULONGLONG NextEntry:39;
684 ULONGLONG HeaderType:1;
685 ULONGLONG Init:1;
686 ULONGLONG Reserved:59;
687 ULONGLONG Region:3;
688 } Header8;
689 struct {
690 ULONGLONG Depth:16;
691 ULONGLONG Sequence:48;
692 ULONGLONG HeaderType:1;
693 ULONGLONG Init:1;
694 ULONGLONG Reserved:2;
695 ULONGLONG NextEntry:60;
696 } Header16;
697 } SLIST_HEADER, *PSLIST_HEADER;
699 #else
701 #undef SLIST_ENTRY /* for Mac OS */
702 #define SLIST_ENTRY SINGLE_LIST_ENTRY
703 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
704 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
706 typedef union _SLIST_HEADER {
707 ULONGLONG Alignment;
708 struct {
709 SLIST_ENTRY Next;
710 WORD Depth;
711 WORD Sequence;
712 } DUMMYSTRUCTNAME;
713 } SLIST_HEADER, *PSLIST_HEADER;
715 #endif
717 NTSYSAPI PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER*);
718 NTSYSAPI VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER);
719 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER);
720 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER);
721 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
722 NTSYSAPI WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
725 /* Heap flags */
727 #define HEAP_NO_SERIALIZE 0x00000001
728 #define HEAP_GROWABLE 0x00000002
729 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
730 #define HEAP_ZERO_MEMORY 0x00000008
731 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
732 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
733 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
734 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
735 #define HEAP_CREATE_ALIGN_16 0x00010000
736 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
737 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
739 /* This flag allows it to create heaps shared by all processes under win95,
740 FIXME: correct name */
741 #define HEAP_SHARED 0x04000000
743 typedef enum _HEAP_INFORMATION_CLASS {
744 HeapCompatibilityInformation,
745 } HEAP_INFORMATION_CLASS;
747 /* Processor feature flags. */
748 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
749 #define PF_FLOATING_POINT_EMULATED 1
750 #define PF_COMPARE_EXCHANGE_DOUBLE 2
751 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
752 #define PF_PPC_MOVEMEM_64BIT_OK 4
753 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
754 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
755 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
756 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
757 #define PF_PAE_ENABLED 9
758 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
759 #define PF_SSE_DAZ_MODE_AVAILABLE 11
760 #define PF_NX_ENABLED 12
761 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
762 #define PF_COMPARE_EXCHANGE128 14
763 #define PF_COMPARE64_EXCHANGE128 15
764 #define PF_CHANNELS_ENABLED 16
767 /* Execution state flags */
768 #define ES_SYSTEM_REQUIRED 0x00000001
769 #define ES_DISPLAY_REQUIRED 0x00000002
770 #define ES_USER_PRESENT 0x00000004
771 #define ES_CONTINUOUS 0x80000000
773 /* The Win32 register context */
775 /* i386 context definitions */
776 #ifdef __i386__
778 #define SIZE_OF_80387_REGISTERS 80
780 typedef struct _FLOATING_SAVE_AREA
782 DWORD ControlWord;
783 DWORD StatusWord;
784 DWORD TagWord;
785 DWORD ErrorOffset;
786 DWORD ErrorSelector;
787 DWORD DataOffset;
788 DWORD DataSelector;
789 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
790 DWORD Cr0NpxState;
791 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
793 #define MAXIMUM_SUPPORTED_EXTENSION 512
795 typedef struct _CONTEXT
797 DWORD ContextFlags;
799 /* These are selected by CONTEXT_DEBUG_REGISTERS */
800 DWORD Dr0;
801 DWORD Dr1;
802 DWORD Dr2;
803 DWORD Dr3;
804 DWORD Dr6;
805 DWORD Dr7;
807 /* These are selected by CONTEXT_FLOATING_POINT */
808 FLOATING_SAVE_AREA FloatSave;
810 /* These are selected by CONTEXT_SEGMENTS */
811 DWORD SegGs;
812 DWORD SegFs;
813 DWORD SegEs;
814 DWORD SegDs;
816 /* These are selected by CONTEXT_INTEGER */
817 DWORD Edi;
818 DWORD Esi;
819 DWORD Ebx;
820 DWORD Edx;
821 DWORD Ecx;
822 DWORD Eax;
824 /* These are selected by CONTEXT_CONTROL */
825 DWORD Ebp;
826 DWORD Eip;
827 DWORD SegCs;
828 DWORD EFlags;
829 DWORD Esp;
830 DWORD SegSs;
832 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
833 } CONTEXT;
835 #define CONTEXT_X86 0x00010000
836 #define CONTEXT_i386 CONTEXT_X86
837 #define CONTEXT_i486 CONTEXT_X86
839 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
840 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
841 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
842 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
843 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
844 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020L)
845 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
846 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
847 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
849 #define EXCEPTION_READ_FAULT 0
850 #define EXCEPTION_WRITE_FAULT 1
851 #define EXCEPTION_EXECUTE_FAULT 8
853 #endif /* __i386__ */
855 typedef struct _LDT_ENTRY {
856 WORD LimitLow;
857 WORD BaseLow;
858 union {
859 struct {
860 BYTE BaseMid;
861 BYTE Flags1;
862 BYTE Flags2;
863 BYTE BaseHi;
864 } Bytes;
865 struct {
866 unsigned BaseMid: 8;
867 unsigned Type : 5;
868 unsigned Dpl : 2;
869 unsigned Pres : 1;
870 unsigned LimitHi : 4;
871 unsigned Sys : 1;
872 unsigned Reserved_0 : 1;
873 unsigned Default_Big : 1;
874 unsigned Granularity : 1;
875 unsigned BaseHi : 8;
876 } Bits;
877 } HighWord;
878 } LDT_ENTRY, *PLDT_ENTRY;
880 /* x86-64 context definitions */
881 #if defined(__x86_64__)
883 #define CONTEXT_AMD64 0x00100000
885 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
886 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
887 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
888 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
889 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
890 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
891 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
893 #define EXCEPTION_READ_FAULT 0
894 #define EXCEPTION_WRITE_FAULT 1
895 #define EXCEPTION_EXECUTE_FAULT 8
897 typedef struct DECLSPEC_ALIGN(16) _M128A {
898 ULONGLONG Low;
899 LONGLONG High;
900 } M128A, *PM128A;
902 typedef struct _XMM_SAVE_AREA32 {
903 WORD ControlWord; /* 000 */
904 WORD StatusWord; /* 002 */
905 BYTE TagWord; /* 004 */
906 BYTE Reserved1; /* 005 */
907 WORD ErrorOpcode; /* 006 */
908 DWORD ErrorOffset; /* 008 */
909 WORD ErrorSelector; /* 00c */
910 WORD Reserved2; /* 00e */
911 DWORD DataOffset; /* 010 */
912 WORD DataSelector; /* 014 */
913 WORD Reserved3; /* 016 */
914 DWORD MxCsr; /* 018 */
915 DWORD MxCsr_Mask; /* 01c */
916 M128A FloatRegisters[8]; /* 020 */
917 M128A XmmRegisters[16]; /* 0a0 */
918 BYTE Reserved4[96]; /* 1a0 */
919 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
921 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
922 DWORD64 P1Home; /* 000 */
923 DWORD64 P2Home; /* 008 */
924 DWORD64 P3Home; /* 010 */
925 DWORD64 P4Home; /* 018 */
926 DWORD64 P5Home; /* 020 */
927 DWORD64 P6Home; /* 028 */
929 /* Control flags */
930 DWORD ContextFlags; /* 030 */
931 DWORD MxCsr; /* 034 */
933 /* Segment */
934 WORD SegCs; /* 038 */
935 WORD SegDs; /* 03a */
936 WORD SegEs; /* 03c */
937 WORD SegFs; /* 03e */
938 WORD SegGs; /* 040 */
939 WORD SegSs; /* 042 */
940 DWORD EFlags; /* 044 */
942 /* Debug */
943 DWORD64 Dr0; /* 048 */
944 DWORD64 Dr1; /* 050 */
945 DWORD64 Dr2; /* 058 */
946 DWORD64 Dr3; /* 060 */
947 DWORD64 Dr6; /* 068 */
948 DWORD64 Dr7; /* 070 */
950 /* Integer */
951 DWORD64 Rax; /* 078 */
952 DWORD64 Rcx; /* 080 */
953 DWORD64 Rdx; /* 088 */
954 DWORD64 Rbx; /* 090 */
955 DWORD64 Rsp; /* 098 */
956 DWORD64 Rbp; /* 0a0 */
957 DWORD64 Rsi; /* 0a8 */
958 DWORD64 Rdi; /* 0b0 */
959 DWORD64 R8; /* 0b8 */
960 DWORD64 R9; /* 0c0 */
961 DWORD64 R10; /* 0c8 */
962 DWORD64 R11; /* 0d0 */
963 DWORD64 R12; /* 0d8 */
964 DWORD64 R13; /* 0e0 */
965 DWORD64 R14; /* 0e8 */
966 DWORD64 R15; /* 0f0 */
968 /* Counter */
969 DWORD64 Rip; /* 0f8 */
971 /* Floating point */
972 union {
973 XMM_SAVE_AREA32 FltSave; /* 100 */
974 struct {
975 M128A Header[2]; /* 100 */
976 M128A Legacy[8]; /* 120 */
977 M128A Xmm0; /* 1a0 */
978 M128A Xmm1; /* 1b0 */
979 M128A Xmm2; /* 1c0 */
980 M128A Xmm3; /* 1d0 */
981 M128A Xmm4; /* 1e0 */
982 M128A Xmm5; /* 1f0 */
983 M128A Xmm6; /* 200 */
984 M128A Xmm7; /* 210 */
985 M128A Xmm8; /* 220 */
986 M128A Xmm9; /* 230 */
987 M128A Xmm10; /* 240 */
988 M128A Xmm11; /* 250 */
989 M128A Xmm12; /* 260 */
990 M128A Xmm13; /* 270 */
991 M128A Xmm14; /* 280 */
992 M128A Xmm15; /* 290 */
993 } DUMMYSTRUCTNAME;
994 } DUMMYUNIONNAME;
996 /* Vector */
997 M128A VectorRegister[26]; /* 300 */
998 DWORD64 VectorControl; /* 4a0 */
1000 /* Debug control */
1001 DWORD64 DebugControl; /* 4a8 */
1002 DWORD64 LastBranchToRip; /* 4b0 */
1003 DWORD64 LastBranchFromRip; /* 4b8 */
1004 DWORD64 LastExceptionToRip; /* 4c0 */
1005 DWORD64 LastExceptionFromRip; /* 4c8 */
1006 } CONTEXT;
1008 typedef struct _RUNTIME_FUNCTION
1010 DWORD BeginAddress;
1011 DWORD EndAddress;
1012 DWORD UnwindData;
1013 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1015 #define UNWIND_HISTORY_TABLE_SIZE 12
1017 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1019 ULONG64 ImageBase;
1020 PRUNTIME_FUNCTION FunctionEntry;
1021 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1023 #define UNWIND_HISTORY_TABLE_NONE 0
1024 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1025 #define UNWIND_HISTORY_TABLE_LOCAL 2
1027 typedef struct _UNWIND_HISTORY_TABLE
1029 ULONG Count;
1030 UCHAR Search;
1031 ULONG64 LowAddress;
1032 ULONG64 HighAddress;
1033 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1034 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1036 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1038 union
1040 PM128A FloatingContext[16];
1041 struct
1043 PM128A Xmm0;
1044 PM128A Xmm1;
1045 PM128A Xmm2;
1046 PM128A Xmm3;
1047 PM128A Xmm4;
1048 PM128A Xmm5;
1049 PM128A Xmm6;
1050 PM128A Xmm7;
1051 PM128A Xmm8;
1052 PM128A Xmm9;
1053 PM128A Xmm10;
1054 PM128A Xmm11;
1055 PM128A Xmm12;
1056 PM128A Xmm13;
1057 PM128A Xmm14;
1058 PM128A Xmm15;
1059 } DUMMYSTRUCTNAME1;
1060 } DUMMYUNIONNAME1;
1062 union
1064 PULONG64 IntegerContext[16];
1065 struct
1067 PULONG64 Rax;
1068 PULONG64 Rcx;
1069 PULONG64 Rdx;
1070 PULONG64 Rbx;
1071 PULONG64 Rsp;
1072 PULONG64 Rbp;
1073 PULONG64 Rsi;
1074 PULONG64 Rdi;
1075 PULONG64 R8;
1076 PULONG64 R9;
1077 PULONG64 R10;
1078 PULONG64 R11;
1079 PULONG64 R12;
1080 PULONG64 R13;
1081 PULONG64 R14;
1082 PULONG64 R15;
1083 } DUMMYSTRUCTNAME2;
1084 } DUMMYUNIONNAME2;
1085 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1087 BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64);
1088 BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
1089 PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD64,DWORD64*,UNWIND_HISTORY_TABLE*);
1090 PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
1092 #define UNW_FLAG_NHANDLER 0
1093 #define UNW_FLAG_EHANDLER 1
1094 #define UNW_FLAG_UHANDLER 2
1095 #define UNW_FLAG_CHAININFO 4
1097 #endif /* __x86_64__ */
1099 /* IA64 context definitions */
1100 #ifdef __ia64__
1102 #define CONTEXT_IA64 0x00080000
1103 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1104 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1105 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1106 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1107 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1108 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1109 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1110 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1111 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1113 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1114 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1115 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1116 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1118 typedef struct _CONTEXT
1120 DWORD ContextFlags;
1121 DWORD Fill1[3];
1122 ULONGLONG DbI0;
1123 ULONGLONG DbI1;
1124 ULONGLONG DbI2;
1125 ULONGLONG DbI3;
1126 ULONGLONG DbI4;
1127 ULONGLONG DbI5;
1128 ULONGLONG DbI6;
1129 ULONGLONG DbI7;
1130 ULONGLONG DbD0;
1131 ULONGLONG DbD1;
1132 ULONGLONG DbD2;
1133 ULONGLONG DbD3;
1134 ULONGLONG DbD4;
1135 ULONGLONG DbD5;
1136 ULONGLONG DbD6;
1137 ULONGLONG DbD7;
1138 FLOAT128 FltS0;
1139 FLOAT128 FltS1;
1140 FLOAT128 FltS2;
1141 FLOAT128 FltS3;
1142 FLOAT128 FltT0;
1143 FLOAT128 FltT1;
1144 FLOAT128 FltT2;
1145 FLOAT128 FltT3;
1146 FLOAT128 FltT4;
1147 FLOAT128 FltT5;
1148 FLOAT128 FltT6;
1149 FLOAT128 FltT7;
1150 FLOAT128 FltT8;
1151 FLOAT128 FltT9;
1152 FLOAT128 FltS4;
1153 FLOAT128 FltS5;
1154 FLOAT128 FltS6;
1155 FLOAT128 FltS7;
1156 FLOAT128 FltS8;
1157 FLOAT128 FltS9;
1158 FLOAT128 FltS10;
1159 FLOAT128 FltS11;
1160 FLOAT128 FltS12;
1161 FLOAT128 FltS13;
1162 FLOAT128 FltS14;
1163 FLOAT128 FltS15;
1164 FLOAT128 FltS16;
1165 FLOAT128 FltS17;
1166 FLOAT128 FltS18;
1167 FLOAT128 FltS19;
1168 FLOAT128 FltF32;
1169 FLOAT128 FltF33;
1170 FLOAT128 FltF34;
1171 FLOAT128 FltF35;
1172 FLOAT128 FltF36;
1173 FLOAT128 FltF37;
1174 FLOAT128 FltF38;
1175 FLOAT128 FltF39;
1176 FLOAT128 FltF40;
1177 FLOAT128 FltF41;
1178 FLOAT128 FltF42;
1179 FLOAT128 FltF43;
1180 FLOAT128 FltF44;
1181 FLOAT128 FltF45;
1182 FLOAT128 FltF46;
1183 FLOAT128 FltF47;
1184 FLOAT128 FltF48;
1185 FLOAT128 FltF49;
1186 FLOAT128 FltF50;
1187 FLOAT128 FltF51;
1188 FLOAT128 FltF52;
1189 FLOAT128 FltF53;
1190 FLOAT128 FltF54;
1191 FLOAT128 FltF55;
1192 FLOAT128 FltF56;
1193 FLOAT128 FltF57;
1194 FLOAT128 FltF58;
1195 FLOAT128 FltF59;
1196 FLOAT128 FltF60;
1197 FLOAT128 FltF61;
1198 FLOAT128 FltF62;
1199 FLOAT128 FltF63;
1200 FLOAT128 FltF64;
1201 FLOAT128 FltF65;
1202 FLOAT128 FltF66;
1203 FLOAT128 FltF67;
1204 FLOAT128 FltF68;
1205 FLOAT128 FltF69;
1206 FLOAT128 FltF70;
1207 FLOAT128 FltF71;
1208 FLOAT128 FltF72;
1209 FLOAT128 FltF73;
1210 FLOAT128 FltF74;
1211 FLOAT128 FltF75;
1212 FLOAT128 FltF76;
1213 FLOAT128 FltF77;
1214 FLOAT128 FltF78;
1215 FLOAT128 FltF79;
1216 FLOAT128 FltF80;
1217 FLOAT128 FltF81;
1218 FLOAT128 FltF82;
1219 FLOAT128 FltF83;
1220 FLOAT128 FltF84;
1221 FLOAT128 FltF85;
1222 FLOAT128 FltF86;
1223 FLOAT128 FltF87;
1224 FLOAT128 FltF88;
1225 FLOAT128 FltF89;
1226 FLOAT128 FltF90;
1227 FLOAT128 FltF91;
1228 FLOAT128 FltF92;
1229 FLOAT128 FltF93;
1230 FLOAT128 FltF94;
1231 FLOAT128 FltF95;
1232 FLOAT128 FltF96;
1233 FLOAT128 FltF97;
1234 FLOAT128 FltF98;
1235 FLOAT128 FltF99;
1236 FLOAT128 FltF100;
1237 FLOAT128 FltF101;
1238 FLOAT128 FltF102;
1239 FLOAT128 FltF103;
1240 FLOAT128 FltF104;
1241 FLOAT128 FltF105;
1242 FLOAT128 FltF106;
1243 FLOAT128 FltF107;
1244 FLOAT128 FltF108;
1245 FLOAT128 FltF109;
1246 FLOAT128 FltF110;
1247 FLOAT128 FltF111;
1248 FLOAT128 FltF112;
1249 FLOAT128 FltF113;
1250 FLOAT128 FltF114;
1251 FLOAT128 FltF115;
1252 FLOAT128 FltF116;
1253 FLOAT128 FltF117;
1254 FLOAT128 FltF118;
1255 FLOAT128 FltF119;
1256 FLOAT128 FltF120;
1257 FLOAT128 FltF121;
1258 FLOAT128 FltF122;
1259 FLOAT128 FltF123;
1260 FLOAT128 FltF124;
1261 FLOAT128 FltF125;
1262 FLOAT128 FltF126;
1263 FLOAT128 FltF127;
1264 ULONGLONG StFPSR;
1265 ULONGLONG IntGp;
1266 ULONGLONG IntT0;
1267 ULONGLONG IntT1;
1268 ULONGLONG IntS0;
1269 ULONGLONG IntS1;
1270 ULONGLONG IntS2;
1271 ULONGLONG IntS3;
1272 ULONGLONG IntV0;
1273 ULONGLONG IntT2;
1274 ULONGLONG IntT3;
1275 ULONGLONG IntT4;
1276 ULONGLONG IntSp;
1277 ULONGLONG IntTeb;
1278 ULONGLONG IntT5;
1279 ULONGLONG IntT6;
1280 ULONGLONG IntT7;
1281 ULONGLONG IntT8;
1282 ULONGLONG IntT9;
1283 ULONGLONG IntT10;
1284 ULONGLONG IntT11;
1285 ULONGLONG IntT12;
1286 ULONGLONG IntT13;
1287 ULONGLONG IntT14;
1288 ULONGLONG IntT15;
1289 ULONGLONG IntT16;
1290 ULONGLONG IntT17;
1291 ULONGLONG IntT18;
1292 ULONGLONG IntT19;
1293 ULONGLONG IntT20;
1294 ULONGLONG IntT21;
1295 ULONGLONG IntT22;
1296 ULONGLONG IntNats;
1297 ULONGLONG Preds;
1298 ULONGLONG BrRp;
1299 ULONGLONG BrS0;
1300 ULONGLONG BrS1;
1301 ULONGLONG BrS2;
1302 ULONGLONG BrS3;
1303 ULONGLONG BrS4;
1304 ULONGLONG BrT0;
1305 ULONGLONG BrT1;
1306 ULONGLONG ApUNAT;
1307 ULONGLONG ApLC;
1308 ULONGLONG ApEC;
1309 ULONGLONG ApCCV;
1310 ULONGLONG ApDCR;
1311 ULONGLONG RsPFS;
1312 ULONGLONG RsBSP;
1313 ULONGLONG RsBSPSTORE;
1314 ULONGLONG RsRSC;
1315 ULONGLONG RsRNAT;
1316 ULONGLONG StIPSR;
1317 ULONGLONG StIIP;
1318 ULONGLONG StIFS;
1319 ULONGLONG StFCR;
1320 ULONGLONG Eflag;
1321 ULONGLONG SegCSD;
1322 ULONGLONG SegSSD;
1323 ULONGLONG Cflag;
1324 ULONGLONG StFSR;
1325 ULONGLONG StFIR;
1326 ULONGLONG StFDR;
1327 ULONGLONG UNUSEDPACK;
1328 } CONTEXT, *PCONTEXT;
1330 typedef struct _RUNTIME_FUNCTION
1332 ULONG BeginAddress;
1333 ULONG EndAddress;
1334 ULONG UnwindInfoAddress;
1335 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1337 typedef struct _FRAME_POINTERS {
1338 ULONGLONG MemoryStackFp;
1339 ULONGLONG BackingStoreFp;
1340 } FRAME_POINTERS, *PFRAME_POINTERS;
1342 #define UNWIND_HISTORY_TABLE_SIZE 12
1344 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
1345 ULONG64 ImageBase;
1346 ULONG64 Gp;
1347 PRUNTIME_FUNCTION FunctionEntry;
1348 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1350 typedef struct _UNWIND_HISTORY_TABLE {
1351 ULONG Count;
1352 UCHAR Search;
1353 ULONG64 LowAddress;
1354 ULONG64 HighAddress;
1355 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1356 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1358 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1360 PFLOAT128 FltS0;
1361 PFLOAT128 FltS1;
1362 PFLOAT128 FltS2;
1363 PFLOAT128 FltS3;
1364 PFLOAT128 HighFloatingContext[10];
1365 PFLOAT128 FltS4;
1366 PFLOAT128 FltS5;
1367 PFLOAT128 FltS6;
1368 PFLOAT128 FltS7;
1369 PFLOAT128 FltS8;
1370 PFLOAT128 FltS9;
1371 PFLOAT128 FltS10;
1372 PFLOAT128 FltS11;
1373 PFLOAT128 FltS12;
1374 PFLOAT128 FltS13;
1375 PFLOAT128 FltS14;
1376 PFLOAT128 FltS15;
1377 PFLOAT128 FltS16;
1378 PFLOAT128 FltS17;
1379 PFLOAT128 FltS18;
1380 PFLOAT128 FltS19;
1381 PULONGLONG IntS0;
1382 PULONGLONG IntS1;
1383 PULONGLONG IntS2;
1384 PULONGLONG IntS3;
1385 PULONGLONG IntSp;
1386 PULONGLONG IntS0Nat;
1387 PULONGLONG IntS1Nat;
1388 PULONGLONG IntS2Nat;
1389 PULONGLONG IntS3Nat;
1390 PULONGLONG IntSpNat;
1391 PULONGLONG Preds;
1392 PULONGLONG BrRp;
1393 PULONGLONG BrS0;
1394 PULONGLONG BrS1;
1395 PULONGLONG BrS2;
1396 PULONGLONG BrS3;
1397 PULONGLONG BrS4;
1398 PULONGLONG ApUNAT;
1399 PULONGLONG ApLC;
1400 PULONGLONG ApEC;
1401 PULONGLONG RsPFS;
1402 PULONGLONG StFSR;
1403 PULONGLONG StFIR;
1404 PULONGLONG StFDR;
1405 PULONGLONG Cflag;
1406 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1408 ULONGLONG WINAPI RtlVirtualUnwind(ULONGLONG,ULONGLONG,RUNTIME_FUNCTION*,CONTEXT*,BOOLEAN*,FRAME_POINTERS*,KNONVOLATILE_CONTEXT_POINTERS*);
1410 #endif /* __ia64__ */
1412 /* Alpha context definitions */
1413 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1415 #define CONTEXT_ALPHA 0x00020000
1417 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
1418 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
1419 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
1420 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1422 #define EXCEPTION_READ_FAULT 0
1423 #define EXCEPTION_WRITE_FAULT 1
1424 #define EXCEPTION_EXECUTE_FAULT 8
1426 typedef struct _CONTEXT
1428 /* selected by CONTEXT_FLOATING_POINT */
1429 ULONGLONG FltF0;
1430 ULONGLONG FltF1;
1431 ULONGLONG FltF2;
1432 ULONGLONG FltF3;
1433 ULONGLONG FltF4;
1434 ULONGLONG FltF5;
1435 ULONGLONG FltF6;
1436 ULONGLONG FltF7;
1437 ULONGLONG FltF8;
1438 ULONGLONG FltF9;
1439 ULONGLONG FltF10;
1440 ULONGLONG FltF11;
1441 ULONGLONG FltF12;
1442 ULONGLONG FltF13;
1443 ULONGLONG FltF14;
1444 ULONGLONG FltF15;
1445 ULONGLONG FltF16;
1446 ULONGLONG FltF17;
1447 ULONGLONG FltF18;
1448 ULONGLONG FltF19;
1449 ULONGLONG FltF20;
1450 ULONGLONG FltF21;
1451 ULONGLONG FltF22;
1452 ULONGLONG FltF23;
1453 ULONGLONG FltF24;
1454 ULONGLONG FltF25;
1455 ULONGLONG FltF26;
1456 ULONGLONG FltF27;
1457 ULONGLONG FltF28;
1458 ULONGLONG FltF29;
1459 ULONGLONG FltF30;
1460 ULONGLONG FltF31;
1462 /* selected by CONTEXT_INTEGER */
1463 ULONGLONG IntV0;
1464 ULONGLONG IntT0;
1465 ULONGLONG IntT1;
1466 ULONGLONG IntT2;
1467 ULONGLONG IntT3;
1468 ULONGLONG IntT4;
1469 ULONGLONG IntT5;
1470 ULONGLONG IntT6;
1471 ULONGLONG IntT7;
1472 ULONGLONG IntS0;
1473 ULONGLONG IntS1;
1474 ULONGLONG IntS2;
1475 ULONGLONG IntS3;
1476 ULONGLONG IntS4;
1477 ULONGLONG IntS5;
1478 ULONGLONG IntFp;
1479 ULONGLONG IntA0;
1480 ULONGLONG IntA1;
1481 ULONGLONG IntA2;
1482 ULONGLONG IntA3;
1483 ULONGLONG IntA4;
1484 ULONGLONG IntA5;
1485 ULONGLONG IntT8;
1486 ULONGLONG IntT9;
1487 ULONGLONG IntT10;
1488 ULONGLONG IntT11;
1489 ULONGLONG IntRa;
1490 ULONGLONG IntT12;
1491 ULONGLONG IntAt;
1492 ULONGLONG IntGp;
1493 ULONGLONG IntSp;
1494 ULONGLONG IntZero;
1496 /* selected by CONTEXT_FLOATING_POINT */
1497 ULONGLONG Fpcr;
1498 ULONGLONG SoftFpcr;
1500 /* selected by CONTEXT_CONTROL */
1501 ULONGLONG Fir;
1502 DWORD Psr;
1503 DWORD ContextFlags;
1504 DWORD Fill[4];
1505 } CONTEXT;
1507 #define _QUAD_PSR_OFFSET HighSoftFpcr
1508 #define _QUAD_FLAGS_OFFSET HighFir
1510 #endif /* _ALPHA_ */
1512 #ifdef __arm__
1514 /* The following flags control the contents of the CONTEXT structure. */
1516 #define CONTEXT_ARM 0x0000040
1517 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1518 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1520 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1522 #define EXCEPTION_READ_FAULT 0
1523 #define EXCEPTION_WRITE_FAULT 1
1524 #define EXCEPTION_EXECUTE_FAULT 8
1526 typedef struct _CONTEXT {
1527 /* The flags values within this flag control the contents of
1528 a CONTEXT record.
1530 If the context record is used as an input parameter, then
1531 for each portion of the context record controlled by a flag
1532 whose value is set, it is assumed that that portion of the
1533 context record contains valid context. If the context record
1534 is being used to modify a thread's context, then only that
1535 portion of the threads context will be modified.
1537 If the context record is used as an IN OUT parameter to capture
1538 the context of a thread, then only those portions of the thread's
1539 context corresponding to set flags will be returned.
1541 The context record is never used as an OUT only parameter. */
1543 ULONG ContextFlags;
1545 /* This section is specified/returned if the ContextFlags word contains
1546 the flag CONTEXT_INTEGER. */
1547 ULONG R0;
1548 ULONG R1;
1549 ULONG R2;
1550 ULONG R3;
1551 ULONG R4;
1552 ULONG R5;
1553 ULONG R6;
1554 ULONG R7;
1555 ULONG R8;
1556 ULONG R9;
1557 ULONG R10;
1558 ULONG Fp;
1559 ULONG Ip;
1561 /* These are selected by CONTEXT_CONTROL */
1562 ULONG Sp;
1563 ULONG Lr;
1564 ULONG Pc;
1565 ULONG Cpsr;
1566 } CONTEXT;
1568 #endif /* __arm__ */
1571 /* Mips context definitions */
1572 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1574 #define CONTEXT_R4000 0x00010000
1576 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1577 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1578 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1580 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1582 #define EXCEPTION_READ_FAULT 0
1583 #define EXCEPTION_WRITE_FAULT 1
1584 #define EXCEPTION_EXECUTE_FAULT 8
1586 typedef struct _CONTEXT
1588 DWORD Argument[4];
1589 /* These are selected by CONTEXT_FLOATING_POINT */
1590 DWORD FltF0;
1591 DWORD FltF1;
1592 DWORD FltF2;
1593 DWORD FltF3;
1594 DWORD FltF4;
1595 DWORD FltF5;
1596 DWORD FltF6;
1597 DWORD FltF7;
1598 DWORD FltF8;
1599 DWORD FltF9;
1600 DWORD FltF10;
1601 DWORD FltF11;
1602 DWORD FltF12;
1603 DWORD FltF13;
1604 DWORD FltF14;
1605 DWORD FltF15;
1606 DWORD FltF16;
1607 DWORD FltF17;
1608 DWORD FltF18;
1609 DWORD FltF19;
1610 DWORD FltF20;
1611 DWORD FltF21;
1612 DWORD FltF22;
1613 DWORD FltF23;
1614 DWORD FltF24;
1615 DWORD FltF25;
1616 DWORD FltF26;
1617 DWORD FltF27;
1618 DWORD FltF28;
1619 DWORD FltF29;
1620 DWORD FltF30;
1621 DWORD FltF31;
1623 /* These are selected by CONTEXT_INTEGER */
1624 DWORD IntZero;
1625 DWORD IntAt;
1626 DWORD IntV0;
1627 DWORD IntV1;
1628 DWORD IntA0;
1629 DWORD IntA1;
1630 DWORD IntA2;
1631 DWORD IntA3;
1632 DWORD IntT0;
1633 DWORD IntT1;
1634 DWORD IntT2;
1635 DWORD IntT3;
1636 DWORD IntT4;
1637 DWORD IntT5;
1638 DWORD IntT6;
1639 DWORD IntT7;
1640 DWORD IntS0;
1641 DWORD IntS1;
1642 DWORD IntS2;
1643 DWORD IntS3;
1644 DWORD IntS4;
1645 DWORD IntS5;
1646 DWORD IntS6;
1647 DWORD IntS7;
1648 DWORD IntT8;
1649 DWORD IntT9;
1650 DWORD IntK0;
1651 DWORD IntK1;
1652 DWORD IntGp;
1653 DWORD IntSp;
1654 DWORD IntS8;
1655 DWORD IntRa;
1656 DWORD IntLo;
1657 DWORD IntHi;
1659 /* These are selected by CONTEXT_FLOATING_POINT */
1660 DWORD Fsr;
1662 /* These are selected by CONTEXT_CONTROL */
1663 DWORD Fir;
1664 DWORD Psr;
1666 DWORD ContextFlags;
1667 DWORD Fill[2];
1668 } CONTEXT;
1670 #endif /* _MIPS_ */
1672 /* PowerPC context definitions */
1673 #ifdef __powerpc__
1675 #define CONTEXT_CONTROL 0x0001
1676 #define CONTEXT_FLOATING_POINT 0x0002
1677 #define CONTEXT_INTEGER 0x0004
1678 #define CONTEXT_DEBUG_REGISTERS 0x0008
1679 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1681 #define EXCEPTION_READ_FAULT 0
1682 #define EXCEPTION_WRITE_FAULT 1
1683 #define EXCEPTION_EXECUTE_FAULT 8
1685 typedef struct
1687 /* These are selected by CONTEXT_FLOATING_POINT */
1688 double Fpr0;
1689 double Fpr1;
1690 double Fpr2;
1691 double Fpr3;
1692 double Fpr4;
1693 double Fpr5;
1694 double Fpr6;
1695 double Fpr7;
1696 double Fpr8;
1697 double Fpr9;
1698 double Fpr10;
1699 double Fpr11;
1700 double Fpr12;
1701 double Fpr13;
1702 double Fpr14;
1703 double Fpr15;
1704 double Fpr16;
1705 double Fpr17;
1706 double Fpr18;
1707 double Fpr19;
1708 double Fpr20;
1709 double Fpr21;
1710 double Fpr22;
1711 double Fpr23;
1712 double Fpr24;
1713 double Fpr25;
1714 double Fpr26;
1715 double Fpr27;
1716 double Fpr28;
1717 double Fpr29;
1718 double Fpr30;
1719 double Fpr31;
1720 double Fpscr;
1722 /* These are selected by CONTEXT_INTEGER */
1723 DWORD Gpr0;
1724 DWORD Gpr1;
1725 DWORD Gpr2;
1726 DWORD Gpr3;
1727 DWORD Gpr4;
1728 DWORD Gpr5;
1729 DWORD Gpr6;
1730 DWORD Gpr7;
1731 DWORD Gpr8;
1732 DWORD Gpr9;
1733 DWORD Gpr10;
1734 DWORD Gpr11;
1735 DWORD Gpr12;
1736 DWORD Gpr13;
1737 DWORD Gpr14;
1738 DWORD Gpr15;
1739 DWORD Gpr16;
1740 DWORD Gpr17;
1741 DWORD Gpr18;
1742 DWORD Gpr19;
1743 DWORD Gpr20;
1744 DWORD Gpr21;
1745 DWORD Gpr22;
1746 DWORD Gpr23;
1747 DWORD Gpr24;
1748 DWORD Gpr25;
1749 DWORD Gpr26;
1750 DWORD Gpr27;
1751 DWORD Gpr28;
1752 DWORD Gpr29;
1753 DWORD Gpr30;
1754 DWORD Gpr31;
1756 DWORD Cr;
1757 DWORD Xer;
1759 /* These are selected by CONTEXT_CONTROL */
1760 DWORD Msr;
1761 DWORD Iar; /* Instruction Address Register , aka PC ... */
1762 DWORD Lr;
1763 DWORD Ctr;
1765 DWORD ContextFlags;
1767 DWORD Dar; /* Fault registers for coredump */
1768 DWORD Dsisr;
1769 DWORD Trap; /* number of powerpc exception taken */
1771 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1772 DWORD Dr0;
1773 DWORD Dr1;
1774 DWORD Dr2;
1775 DWORD Dr3;
1776 DWORD Dr4;
1777 DWORD Dr5;
1778 DWORD Dr6;
1779 DWORD Dr7;
1780 } CONTEXT;
1782 typedef struct _STACK_FRAME_HEADER
1784 DWORD BackChain;
1785 DWORD GlueSaved1;
1786 DWORD GlueSaved2;
1787 DWORD Reserved1;
1788 DWORD Spare1;
1789 DWORD Spare2;
1791 DWORD Parameter0;
1792 DWORD Parameter1;
1793 DWORD Parameter2;
1794 DWORD Parameter3;
1795 DWORD Parameter4;
1796 DWORD Parameter5;
1797 DWORD Parameter6;
1798 DWORD Parameter7;
1799 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1801 #endif /* __powerpc__ */
1803 #ifdef __sparc__
1806 * FIXME:
1808 * There is no official CONTEXT structure defined for the SPARC
1809 * architecture, so I just made one up.
1811 * This structure is valid only for 32-bit SPARC architectures,
1812 * not for 64-bit SPARC.
1814 * Note that this structure contains only the 'top-level' registers;
1815 * the rest of the register window chain is not visible.
1817 * The layout follows the Solaris 'prgregset_t' structure.
1821 #define CONTEXT_SPARC 0x10000000
1823 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1824 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1825 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1827 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1829 #define EXCEPTION_READ_FAULT 0
1830 #define EXCEPTION_WRITE_FAULT 1
1831 #define EXCEPTION_EXECUTE_FAULT 8
1833 typedef struct _CONTEXT
1835 DWORD ContextFlags;
1837 /* These are selected by CONTEXT_INTEGER */
1838 DWORD g0;
1839 DWORD g1;
1840 DWORD g2;
1841 DWORD g3;
1842 DWORD g4;
1843 DWORD g5;
1844 DWORD g6;
1845 DWORD g7;
1846 DWORD o0;
1847 DWORD o1;
1848 DWORD o2;
1849 DWORD o3;
1850 DWORD o4;
1851 DWORD o5;
1852 DWORD o6;
1853 DWORD o7;
1854 DWORD l0;
1855 DWORD l1;
1856 DWORD l2;
1857 DWORD l3;
1858 DWORD l4;
1859 DWORD l5;
1860 DWORD l6;
1861 DWORD l7;
1862 DWORD i0;
1863 DWORD i1;
1864 DWORD i2;
1865 DWORD i3;
1866 DWORD i4;
1867 DWORD i5;
1868 DWORD i6;
1869 DWORD i7;
1871 /* These are selected by CONTEXT_CONTROL */
1872 DWORD psr;
1873 DWORD pc;
1874 DWORD npc;
1875 DWORD y;
1876 DWORD wim;
1877 DWORD tbr;
1879 /* FIXME: floating point registers missing */
1881 } CONTEXT;
1883 #endif /* __sparc__ */
1885 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1886 #error You need to define a CONTEXT for your CPU
1887 #endif
1889 typedef CONTEXT *PCONTEXT;
1891 NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
1894 * Product types
1896 #define PRODUCT_UNLICENSED 0xABCDABCD
1897 #define PRODUCT_BUSINESS 0x00000006
1898 #define PRODUCT_BUSINESS_N 0x00000010
1899 #define PRODUCT_CLUSTER_SERVER 0x00000012
1900 #define PRODUCT_DATACENTER_SERVER 0x00000008
1901 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1902 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1903 #define PRODUCT_SERVER_V 0x00000025
1904 #define PRODUCT_ENTERPRISE 0x00000004
1905 #define PRODUCT_ENTERPRISE_N 0x0000001B
1906 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1907 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1908 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1909 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1910 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1911 #define PRODUCT_HOME_BASIC 0x00000002
1912 #define PRODUCT_HOME_BASIC_N 0x00000005
1913 #define PRODUCT_HOME_PREMIUM 0x00000003
1914 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1915 #define PRODUCT_HYPERV 0x0000002A
1916 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1917 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1918 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1919 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1920 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1921 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1922 #define PRODUCT_STANDARD_SERVER 0x00000007
1923 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1924 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1925 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1926 #define PRODUCT_STARTER 0x0000000B
1927 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1928 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1929 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1930 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1931 #define PRODUCT_UNDEFINED 0x00000000
1932 #define PRODUCT_ULTIMATE 0x00000001
1933 #define PRODUCT_ULTIMATE_N 0x0000001C
1934 #define PRODUCT_WEB_SERVER 0x00000011
1935 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1939 * Language IDs
1942 #define MAKELCID(l, s) (MAKELONG(l, s))
1944 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1945 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1946 #define SUBLANGID(l) ((WORD)(l) >> 10)
1948 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1949 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1951 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1952 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1953 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1954 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1955 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1956 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1958 #define UNREFERENCED_PARAMETER(u) (void)(u)
1959 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1960 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1962 #define LANG_NEUTRAL 0x00
1963 #define LANG_INVARIANT 0x7f
1965 #define LANG_AFRIKAANS 0x36
1966 #define LANG_ALBANIAN 0x1c
1967 #define LANG_ALSATIAN 0x84
1968 #define LANG_AMHARIC 0x5e
1969 #define LANG_ARABIC 0x01
1970 #define LANG_ARMENIAN 0x2b
1971 #define LANG_ASSAMESE 0x4d
1972 #define LANG_AZERI 0x2c
1973 #define LANG_BASHKIR 0x6d
1974 #define LANG_BASQUE 0x2d
1975 #define LANG_BELARUSIAN 0x23
1976 #define LANG_BENGALI 0x45
1977 #define LANG_BOSNIAN 0x1a
1978 #define LANG_BOSNIAN_NEUTRAL 0x781a
1979 #define LANG_BRETON 0x7e
1980 #define LANG_BULGARIAN 0x02
1981 #define LANG_CATALAN 0x03
1982 #define LANG_CHINESE 0x04
1983 #define LANG_CHINESE_SIMPLIFIED 0x0004
1984 #define LANG_CHINESE_TRADITIONAL 0x7c04
1985 #define LANG_CORSICAN 0x83
1986 #define LANG_CROATIAN 0x1a
1987 #define LANG_CZECH 0x05
1988 #define LANG_DANISH 0x06
1989 #define LANG_DARI 0x8c
1990 #define LANG_DIVEHI 0x65
1991 #define LANG_DUTCH 0x13
1992 #define LANG_ENGLISH 0x09
1993 #define LANG_ESTONIAN 0x25
1994 #define LANG_FAEROESE 0x38
1995 #define LANG_FARSI LANG_PERSIAN
1996 #define LANG_FILIPINO 0x64
1997 #define LANG_FINNISH 0x0b
1998 #define LANG_FRENCH 0x0c
1999 #define LANG_FRISIAN 0x62
2000 #define LANG_GALICIAN 0x56
2001 #define LANG_GEORGIAN 0x37
2002 #define LANG_GERMAN 0x07
2003 #define LANG_GREEK 0x08
2004 #define LANG_GREENLANDIC 0x6f
2005 #define LANG_GUJARATI 0x47
2006 #define LANG_HAUSA 0x68
2007 #define LANG_HEBREW 0x0d
2008 #define LANG_HINDI 0x39
2009 #define LANG_HUNGARIAN 0x0e
2010 #define LANG_ICELANDIC 0x0f
2011 #define LANG_IGBO 0x70
2012 #define LANG_INDONESIAN 0x21
2013 #define LANG_INUKTITUT 0x5d
2014 #define LANG_IRISH 0x3c
2015 #define LANG_ITALIAN 0x10
2016 #define LANG_JAPANESE 0x11
2017 #define LANG_KANNADA 0x4b
2018 #define LANG_KASHMIRI 0x60
2019 #define LANG_KAZAK 0x3f
2020 #define LANG_KHMER 0x53
2021 #define LANG_KICHE 0x86
2022 #define LANG_KINYARWANDA 0x87
2023 #define LANG_KONKANI 0x57
2024 #define LANG_KOREAN 0x12
2025 #define LANG_KYRGYZ 0x40
2026 #define LANG_LAO 0x54
2027 #define LANG_LATVIAN 0x26
2028 #define LANG_LITHUANIAN 0x27
2029 #define LANG_LOWER_SORBIAN 0x2e
2030 #define LANG_LUXEMBOURGISH 0x6e
2031 #define LANG_MACEDONIAN 0x2f
2032 #define LANG_MALAY 0x3e
2033 #define LANG_MALAYALAM 0x4c
2034 #define LANG_MALTESE 0x3a
2035 #define LANG_MANIPURI 0x58
2036 #define LANG_MAORI 0x81
2037 #define LANG_MAPUDUNGUN 0x7a
2038 #define LANG_MARATHI 0x4e
2039 #define LANG_MOHAWK 0x7c
2040 #define LANG_MONGOLIAN 0x50
2041 #define LANG_NEPALI 0x61
2042 #define LANG_NORWEGIAN 0x14
2043 #define LANG_OCCITAN 0x82
2044 #define LANG_ORIYA 0x48
2045 #define LANG_PASHTO 0x63
2046 #define LANG_PERSIAN 0x29
2047 #define LANG_POLISH 0x15
2048 #define LANG_PORTUGUESE 0x16
2049 #define LANG_PUNJABI 0x46
2050 #define LANG_QUECHUA 0x6b
2051 #define LANG_ROMANIAN 0x18
2052 #define LANG_ROMANSH 0x17
2053 #define LANG_RUSSIAN 0x19
2054 #define LANG_SAMI 0x3b
2055 #define LANG_SANSKRIT 0x4f
2056 #define LANG_SERBIAN 0x1a
2057 #define LANG_SERBIAN_NEUTRAL 0x7c1a
2058 #define LANG_SINDHI 0x59
2059 #define LANG_SINHALESE 0x5b
2060 #define LANG_SLOVAK 0x1b
2061 #define LANG_SLOVENIAN 0x24
2062 #define LANG_SOTHO 0x6c
2063 #define LANG_SPANISH 0x0a
2064 #define LANG_SWAHILI 0x41
2065 #define LANG_SWEDISH 0x1d
2066 #define LANG_SYRIAC 0x5a
2067 #define LANG_TAJIK 0x28
2068 #define LANG_TAMAZIGHT 0x5f
2069 #define LANG_TAMIL 0x49
2070 #define LANG_TATAR 0x44
2071 #define LANG_TELUGU 0x4a
2072 #define LANG_THAI 0x1e
2073 #define LANG_TIBETAN 0x51
2074 #define LANG_TIGRIGNA 0x73
2075 #define LANG_TSWANA 0x32
2076 #define LANG_TURKISH 0x1f
2077 #define LANG_TURKMEN 0x42
2078 #define LANG_UIGHUR 0x80
2079 #define LANG_UKRAINIAN 0x22
2080 #define LANG_UPPER_SORBIAN 0x2e
2081 #define LANG_URDU 0x20
2082 #define LANG_UZBEK 0x43
2083 #define LANG_VIETNAMESE 0x2a
2084 #define LANG_WELSH 0x52
2085 #define LANG_WOLOF 0x88
2086 #define LANG_XHOSA 0x34
2087 #define LANG_YAKUT 0x85
2088 #define LANG_YI 0x78
2089 #define LANG_YORUBA 0x6a
2090 #define LANG_ZULU 0x35
2092 /* These are documented by the MSDN but are missing from the Windows header */
2093 #define LANG_MALAGASY 0x8d
2095 /* FIXME: these are not defined anywhere */
2096 #define LANG_SUTU 0x30
2097 #define LANG_TSONGA 0x31
2098 #define LANG_VENDA 0x33
2100 /* non standard; keep the number high enough (but < 0xff) */
2101 #define LANG_ESPERANTO 0x8f
2102 #define LANG_WALON 0x90
2103 #define LANG_CORNISH 0x91
2104 #define LANG_GAELIC 0x94
2106 /* Sublanguage definitions */
2107 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
2108 #define SUBLANG_DEFAULT 0x01 /* user default */
2109 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
2110 #define SUBLANG_CUSTOM_DEFAULT 0x03
2111 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
2112 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
2114 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
2115 #define SUBLANG_ALBANIAN_ALBANIA 0x01
2116 #define SUBLANG_ALSATIAN_FRANCE 0x01
2117 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
2118 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
2119 #define SUBLANG_ARABIC_IRAQ 0x02
2120 #define SUBLANG_ARABIC_EGYPT 0x03
2121 #define SUBLANG_ARABIC_LIBYA 0x04
2122 #define SUBLANG_ARABIC_ALGERIA 0x05
2123 #define SUBLANG_ARABIC_MOROCCO 0x06
2124 #define SUBLANG_ARABIC_TUNISIA 0x07
2125 #define SUBLANG_ARABIC_OMAN 0x08
2126 #define SUBLANG_ARABIC_YEMEN 0x09
2127 #define SUBLANG_ARABIC_SYRIA 0x0a
2128 #define SUBLANG_ARABIC_JORDAN 0x0b
2129 #define SUBLANG_ARABIC_LEBANON 0x0c
2130 #define SUBLANG_ARABIC_KUWAIT 0x0d
2131 #define SUBLANG_ARABIC_UAE 0x0e
2132 #define SUBLANG_ARABIC_BAHRAIN 0x0f
2133 #define SUBLANG_ARABIC_QATAR 0x10
2134 #define SUBLANG_ARMENIAN_ARMENIA 0x01
2135 #define SUBLANG_ASSAMESE_INDIA 0x01
2136 #define SUBLANG_AZERI_LATIN 0x01
2137 #define SUBLANG_AZERI_CYRILLIC 0x02
2138 #define SUBLANG_BASHKIR_RUSSIA 0x01
2139 #define SUBLANG_BASQUE_BASQUE 0x01
2140 #define SUBLANG_BELARUSIAN_BELARUS 0x01
2141 #define SUBLANG_BENGALI_INDIA 0x01
2142 #define SUBLANG_BENGALI_BANGLADESH 0x02
2143 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
2144 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
2145 #define SUBLANG_BRETON_FRANCE 0x01
2146 #define SUBLANG_BULGARIAN_BULGARIA 0x01
2147 #define SUBLANG_CATALAN_CATALAN 0x01
2148 #define SUBLANG_CHINESE_TRADITIONAL 0x01
2149 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
2150 #define SUBLANG_CHINESE_HONGKONG 0x03
2151 #define SUBLANG_CHINESE_SINGAPORE 0x04
2152 #define SUBLANG_CHINESE_MACAU 0x05
2153 #define SUBLANG_CORSICAN_FRANCE 0x01
2154 #define SUBLANG_CROATIAN_CROATIA 0x01
2155 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
2156 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
2157 #define SUBLANG_DANISH_DENMARK 0x01
2158 #define SUBLANG_DARI_AFGHANISTAN 0x01
2159 #define SUBLANG_DIVEHI_MALDIVES 0x01
2160 #define SUBLANG_DUTCH 0x01
2161 #define SUBLANG_DUTCH_BELGIAN 0x02
2162 #define SUBLANG_ENGLISH_US 0x01
2163 #define SUBLANG_ENGLISH_UK 0x02
2164 #define SUBLANG_ENGLISH_AUS 0x03
2165 #define SUBLANG_ENGLISH_CAN 0x04
2166 #define SUBLANG_ENGLISH_NZ 0x05
2167 #define SUBLANG_ENGLISH_EIRE 0x06
2168 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
2169 #define SUBLANG_ENGLISH_JAMAICA 0x08
2170 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
2171 #define SUBLANG_ENGLISH_BELIZE 0x0a
2172 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
2173 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
2174 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
2175 #define SUBLANG_ENGLISH_INDIA 0x10
2176 #define SUBLANG_ENGLISH_MALAYSIA 0x11
2177 #define SUBLANG_ENGLISH_SINGAPORE 0x12
2178 #define SUBLANG_ESTONIAN_ESTONIA 0x01
2179 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
2180 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
2181 #define SUBLANG_FINNISH_FINLAND 0x01
2182 #define SUBLANG_FRENCH 0x01
2183 #define SUBLANG_FRENCH_BELGIAN 0x02
2184 #define SUBLANG_FRENCH_CANADIAN 0x03
2185 #define SUBLANG_FRENCH_SWISS 0x04
2186 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
2187 #define SUBLANG_FRENCH_MONACO 0x06
2188 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
2189 #define SUBLANG_GALICIAN_GALICIAN 0x01
2190 #define SUBLANG_GEORGIAN_GEORGIA 0x01
2191 #define SUBLANG_GERMAN 0x01
2192 #define SUBLANG_GERMAN_SWISS 0x02
2193 #define SUBLANG_GERMAN_AUSTRIAN 0x03
2194 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
2195 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
2196 #define SUBLANG_GREEK_GREECE 0x01
2197 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
2198 #define SUBLANG_GUJARATI_INDIA 0x01
2199 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
2200 #define SUBLANG_HEBREW_ISRAEL 0x01
2201 #define SUBLANG_HINDI_INDIA 0x01
2202 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
2203 #define SUBLANG_ICELANDIC_ICELAND 0x01
2204 #define SUBLANG_IGBO_NIGERIA 0x01
2205 #define SUBLANG_INDONESIAN_INDONESIA 0x01
2206 #define SUBLANG_INUKTITUT_CANADA 0x01
2207 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
2208 #define SUBLANG_IRISH_IRELAND 0x02
2209 #define SUBLANG_ITALIAN 0x01
2210 #define SUBLANG_ITALIAN_SWISS 0x02
2211 #define SUBLANG_JAPANESE_JAPAN 0x01
2212 #define SUBLANG_KANNADA_INDIA 0x01
2213 #define SUBLANG_KASHMIRI_SASIA 0x02
2214 #define SUBLANG_KASHMIRI_INDIA 0x02
2215 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
2216 #define SUBLANG_KHMER_CAMBODIA 0x01
2217 #define SUBLANG_KICHE_GUATEMALA 0x01
2218 #define SUBLANG_KINYARWANDA_RWANDA 0X01
2219 #define SUBLANG_KONKANI_INDIA 0x01
2220 #define SUBLANG_KOREAN 0x01
2221 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
2222 #define SUBLANG_LAO_LAO 0x01
2223 #define SUBLANG_LATVIAN_LATVIA 0x01
2224 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
2225 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
2226 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
2227 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
2228 #define SUBLANG_MALAY_MALAYSIA 0x01
2229 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
2230 #define SUBLANG_MALAYALAM_INDIA 0x01
2231 #define SUBLANG_MALTESE_MALTA 0x01
2232 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
2233 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
2234 #define SUBLANG_MARATHI_INDIA 0x01
2235 #define SUBLANG_MOHAWK_MOHAWK 0x01
2236 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
2237 #define SUBLANG_MONGOLIAN_PRC 0x02
2238 #define SUBLANG_NEPALI_INDIA 0x02
2239 #define SUBLANG_NEPALI_NEPAL 0x01
2240 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
2241 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
2242 #define SUBLANG_OCCITAN_FRANCE 0x01
2243 #define SUBLANG_ORIYA_INDIA 0x01
2244 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
2245 #define SUBLANG_PERSIAN_IRAN 0x01
2246 #define SUBLANG_POLISH_POLAND 0x01
2247 #define SUBLANG_PORTUGUESE 0x02
2248 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
2249 #define SUBLANG_PUNJABI_INDIA 0x01
2250 #define SUBLANG_QUECHUA_BOLIVIA 0x01
2251 #define SUBLANG_QUECHUA_ECUADOR 0x02
2252 #define SUBLANG_QUECHUA_PERU 0x03
2253 #define SUBLANG_ROMANIAN_ROMANIA 0x01
2254 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
2255 #define SUBLANG_RUSSIAN_RUSSIA 0x01
2256 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
2257 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
2258 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
2259 #define SUBLANG_SAMI_LULE_NORWAY 0x04
2260 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
2261 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
2262 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
2263 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
2264 #define SUBLANG_SAMI_INARI_FINLAND 0x09
2265 #define SUBLANG_SANSKRIT_INDIA 0x01
2266 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
2267 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
2268 #define SUBLANG_SERBIAN_CROATIA 0x01
2269 #define SUBLANG_SERBIAN_LATIN 0x02
2270 #define SUBLANG_SERBIAN_CYRILLIC 0x03
2271 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
2272 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
2273 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
2274 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
2275 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
2276 #define SUBLANG_SPANISH 0x01
2277 #define SUBLANG_SPANISH_MEXICAN 0x02
2278 #define SUBLANG_SPANISH_MODERN 0x03
2279 #define SUBLANG_SPANISH_GUATEMALA 0x04
2280 #define SUBLANG_SPANISH_COSTA_RICA 0x05
2281 #define SUBLANG_SPANISH_PANAMA 0x06
2282 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
2283 #define SUBLANG_SPANISH_VENEZUELA 0x08
2284 #define SUBLANG_SPANISH_COLOMBIA 0x09
2285 #define SUBLANG_SPANISH_PERU 0x0a
2286 #define SUBLANG_SPANISH_ARGENTINA 0x0b
2287 #define SUBLANG_SPANISH_ECUADOR 0x0c
2288 #define SUBLANG_SPANISH_CHILE 0x0d
2289 #define SUBLANG_SPANISH_URUGUAY 0x0e
2290 #define SUBLANG_SPANISH_PARAGUAY 0x0f
2291 #define SUBLANG_SPANISH_BOLIVIA 0x10
2292 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
2293 #define SUBLANG_SPANISH_HONDURAS 0x12
2294 #define SUBLANG_SPANISH_NICARAGUA 0x13
2295 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
2296 #define SUBLANG_SPANISH_US 0x15
2297 #define SUBLANG_SWAHILI_KENYA 0x01
2298 #define SUBLANG_SWEDISH 0x01
2299 #define SUBLANG_SWEDISH_FINLAND 0x02
2300 #define SUBLANG_SYRIAC_SYRIA 0x01
2301 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
2302 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
2303 #define SUBLANG_TAMIL_INDIA 0x01
2304 #define SUBLANG_TATAR_RUSSIA 0x01
2305 #define SUBLANG_TELUGU_INDIA 0x01
2306 #define SUBLANG_THAI_THAILAND 0x01
2307 #define SUBLANG_TIBETAN_PRC 0x01
2308 #define SUBLANG_TIBETAN_BHUTAN 0x02
2309 #define SUBLANG_TIGRIGNA_ERITREA 0x02
2310 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
2311 #define SUBLANG_TURKISH_TURKEY 0x01
2312 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
2313 #define SUBLANG_UIGHUR_PRC 0x01
2314 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
2315 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
2316 #define SUBLANG_URDU_PAKISTAN 0x01
2317 #define SUBLANG_URDU_INDIA 0x02
2318 #define SUBLANG_UZBEK_LATIN 0x01
2319 #define SUBLANG_UZBEK_CYRILLIC 0x02
2320 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
2321 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
2322 #define SUBLANG_WOLOF_SENEGAL 0x01
2323 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
2324 #define SUBLANG_YAKUT_RUSSIA 0x01
2325 #define SUBLANG_YI_PRC 0x01
2326 #define SUBLANG_YORUBA_NIGERIA 0x01
2327 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
2329 /* These are documented by the MSDN but are missing from the Windows header */
2330 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
2331 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
2332 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
2333 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
2334 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
2335 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
2336 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
2337 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
2339 /* FIXME: these are not defined anywhere */
2340 #define SUBLANG_DUTCH_SURINAM 0x03
2341 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
2342 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
2343 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
2344 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
2345 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
2346 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
2347 #define SUBLANG_GAELIC 0x01
2348 #define SUBLANG_GAELIC_SCOTTISH 0x02
2349 #define SUBLANG_GAELIC_MANX 0x03
2353 * Sort definitions
2356 #define SORT_DEFAULT 0x0
2357 #define SORT_JAPANESE_XJIS 0x0
2358 #define SORT_JAPANESE_UNICODE 0x1
2359 #define SORT_CHINESE_BIG5 0x0
2360 #define SORT_CHINESE_UNICODE 0x1
2361 #define SORT_KOREAN_KSC 0x0
2362 #define SORT_KOREAN_UNICODE 0x1
2367 * Definitions for IsTextUnicode()
2370 #define IS_TEXT_UNICODE_ASCII16 0x0001
2371 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2372 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2373 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2374 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2375 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2376 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2377 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2378 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2379 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2380 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2381 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2382 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2383 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2384 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2385 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2387 #define MAXIMUM_WAIT_OBJECTS 64
2388 #define MAXIMUM_SUSPEND_COUNT 127
2390 #define WT_EXECUTEDEFAULT 0x00
2391 #define WT_EXECUTEINIOTHREAD 0x01
2392 #define WT_EXECUTEINUITHREAD 0x02
2393 #define WT_EXECUTEINWAITTHREAD 0x04
2394 #define WT_EXECUTEONLYONCE 0x08
2395 #define WT_EXECUTELONGFUNCTION 0x10
2396 #define WT_EXECUTEINTIMERTHREAD 0x20
2397 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2398 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2399 #define WT_EXECUTEINLONGTHREAD 0x10
2400 #define WT_EXECUTEDELETEWAIT 0x08
2401 #define WT_TRANSFER_IMPERSONATION 0x0100
2404 #define EXCEPTION_CONTINUABLE 0
2405 #define EXCEPTION_NONCONTINUABLE 0x01
2408 * The exception record used by Win32 to give additional information
2409 * about exception to exception handlers.
2412 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2414 typedef struct _EXCEPTION_RECORD
2416 DWORD ExceptionCode;
2417 DWORD ExceptionFlags;
2418 struct _EXCEPTION_RECORD *ExceptionRecord;
2420 PVOID ExceptionAddress;
2421 DWORD NumberParameters;
2422 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2423 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2426 * The exception pointers structure passed to exception filters
2427 * in except() and the UnhandledExceptionFilter().
2430 typedef struct _EXCEPTION_POINTERS
2432 PEXCEPTION_RECORD ExceptionRecord;
2433 PCONTEXT ContextRecord;
2434 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
2438 * The exception frame, used for registering exception handlers
2439 * Win32 cares only about this, but compilers generally emit
2440 * larger exception frames for their own use.
2443 struct _EXCEPTION_REGISTRATION_RECORD;
2445 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
2446 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
2448 typedef struct _EXCEPTION_REGISTRATION_RECORD
2450 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
2451 PEXCEPTION_HANDLER Handler;
2452 } EXCEPTION_REGISTRATION_RECORD;
2455 * function pointer to an exception filter
2458 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
2460 typedef struct _NT_TIB
2462 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2463 PVOID StackBase;
2464 PVOID StackLimit;
2465 PVOID SubSystemTib;
2466 union {
2467 PVOID FiberData;
2468 DWORD Version;
2469 } DUMMYUNIONNAME;
2470 PVOID ArbitraryUserPointer;
2471 struct _NT_TIB *Self;
2472 } NT_TIB, *PNT_TIB;
2474 struct _TEB;
2476 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2477 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2479 struct _TEB *teb;
2480 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2481 return teb;
2483 #elif defined(__i386__) && defined(_MSC_VER)
2484 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2486 struct _TEB *teb;
2487 __asm mov eax, fs:[0x18];
2488 __asm mov teb, eax;
2489 return teb;
2491 #elif defined(__x86_64__) && defined(__GNUC__)
2492 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2494 struct _TEB *teb;
2495 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
2496 return teb;
2498 #elif defined(__x86_64__) && defined (_MSC_VER)
2499 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2501 struct _TEB *teb;
2502 __asm mov rax, gs:[0x30];
2503 __asm mov teb, rax;
2504 return teb;
2506 #else
2507 extern struct _TEB * WINAPI NtCurrentTeb(void);
2508 #endif
2510 #ifdef NONAMELESSUNION
2511 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2512 #else
2513 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2514 #endif
2515 #define GetFiberData() (*(void **)GetCurrentFiber())
2517 #define TLS_MINIMUM_AVAILABLE 64
2520 * File formats definitions
2523 #include <pshpack2.h>
2524 typedef struct _IMAGE_DOS_HEADER {
2525 WORD e_magic; /* 00: MZ Header signature */
2526 WORD e_cblp; /* 02: Bytes on last page of file */
2527 WORD e_cp; /* 04: Pages in file */
2528 WORD e_crlc; /* 06: Relocations */
2529 WORD e_cparhdr; /* 08: Size of header in paragraphs */
2530 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2531 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2532 WORD e_ss; /* 0e: Initial (relative) SS value */
2533 WORD e_sp; /* 10: Initial SP value */
2534 WORD e_csum; /* 12: Checksum */
2535 WORD e_ip; /* 14: Initial IP value */
2536 WORD e_cs; /* 16: Initial (relative) CS value */
2537 WORD e_lfarlc; /* 18: File address of relocation table */
2538 WORD e_ovno; /* 1a: Overlay number */
2539 WORD e_res[4]; /* 1c: Reserved words */
2540 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2541 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2542 WORD e_res2[10]; /* 28: Reserved words */
2543 DWORD e_lfanew; /* 3c: Offset to extended header */
2544 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2545 #include <poppack.h>
2547 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2548 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2549 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2550 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2551 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2552 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2555 * This is the Windows executable (NE) header.
2556 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2558 #include <pshpack2.h>
2559 typedef struct
2561 WORD ne_magic; /* 00 NE signature 'NE' */
2562 BYTE ne_ver; /* 02 Linker version number */
2563 BYTE ne_rev; /* 03 Linker revision number */
2564 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2565 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2566 LONG ne_crc; /* 08 Checksum */
2567 WORD ne_flags; /* 0c Flags about segments in this file */
2568 WORD ne_autodata; /* 0e Automatic data segment number */
2569 WORD ne_heap; /* 10 Initial size of local heap */
2570 WORD ne_stack; /* 12 Initial size of stack */
2571 DWORD ne_csip; /* 14 Initial CS:IP */
2572 DWORD ne_sssp; /* 18 Initial SS:SP */
2573 WORD ne_cseg; /* 1c # of entries in segment table */
2574 WORD ne_cmod; /* 1e # of entries in module reference tab. */
2575 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2576 WORD ne_segtab; /* 22 Offset to segment table */
2577 WORD ne_rsrctab; /* 24 Offset to resource table */
2578 WORD ne_restab; /* 26 Offset to resident-name table */
2579 WORD ne_modtab; /* 28 Offset to module reference table */
2580 WORD ne_imptab; /* 2a Offset to imported name table */
2581 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2582 WORD ne_cmovent; /* 30 # of movable entry points */
2583 WORD ne_align; /* 32 Logical sector alignment shift count */
2584 WORD ne_cres; /* 34 # of resource segments */
2585 BYTE ne_exetyp; /* 36 Flags indicating target OS */
2586 BYTE ne_flagsothers; /* 37 Additional information flags */
2587 WORD ne_pretthunks; /* 38 Offset to return thunks */
2588 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2589 WORD ne_swaparea; /* 3c Reserved by Microsoft */
2590 WORD ne_expver; /* 3e Expected Windows version number */
2591 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2592 #include <poppack.h>
2594 #include <pshpack2.h>
2595 typedef struct _IMAGE_VXD_HEADER {
2596 WORD e32_magic;
2597 BYTE e32_border;
2598 BYTE e32_worder;
2599 DWORD e32_level;
2600 WORD e32_cpu;
2601 WORD e32_os;
2602 DWORD e32_ver;
2603 DWORD e32_mflags;
2604 DWORD e32_mpages;
2605 DWORD e32_startobj;
2606 DWORD e32_eip;
2607 DWORD e32_stackobj;
2608 DWORD e32_esp;
2609 DWORD e32_pagesize;
2610 DWORD e32_lastpagesize;
2611 DWORD e32_fixupsize;
2612 DWORD e32_fixupsum;
2613 DWORD e32_ldrsize;
2614 DWORD e32_ldrsum;
2615 DWORD e32_objtab;
2616 DWORD e32_objcnt;
2617 DWORD e32_objmap;
2618 DWORD e32_itermap;
2619 DWORD e32_rsrctab;
2620 DWORD e32_rsrccnt;
2621 DWORD e32_restab;
2622 DWORD e32_enttab;
2623 DWORD e32_dirtab;
2624 DWORD e32_dircnt;
2625 DWORD e32_fpagetab;
2626 DWORD e32_frectab;
2627 DWORD e32_impmod;
2628 DWORD e32_impmodcnt;
2629 DWORD e32_impproc;
2630 DWORD e32_pagesum;
2631 DWORD e32_datapage;
2632 DWORD e32_preload;
2633 DWORD e32_nrestab;
2634 DWORD e32_cbnrestab;
2635 DWORD e32_nressum;
2636 DWORD e32_autodata;
2637 DWORD e32_debuginfo;
2638 DWORD e32_debuglen;
2639 DWORD e32_instpreload;
2640 DWORD e32_instdemand;
2641 DWORD e32_heapsize;
2642 BYTE e32_res3[12];
2643 DWORD e32_winresoff;
2644 DWORD e32_winreslen;
2645 WORD e32_devid;
2646 WORD e32_ddkver;
2647 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2648 #include <poppack.h>
2650 /* These defines describe the meanings of the bits in the Characteristics
2651 field */
2653 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2654 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2655 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2656 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2657 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2658 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2659 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2660 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2661 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2662 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2663 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2664 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2665 #define IMAGE_FILE_SYSTEM 0x1000
2666 #define IMAGE_FILE_DLL 0x2000
2667 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2668 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2670 /* These are the settings of the Machine field. */
2671 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2672 #define IMAGE_FILE_MACHINE_I860 0x014d
2673 #define IMAGE_FILE_MACHINE_I386 0x014c
2674 #define IMAGE_FILE_MACHINE_R3000 0x0162
2675 #define IMAGE_FILE_MACHINE_R4000 0x0166
2676 #define IMAGE_FILE_MACHINE_R10000 0x0168
2677 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2678 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2679 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2680 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2681 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2682 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2683 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2684 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2685 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2686 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2687 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2688 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2689 #define IMAGE_FILE_MACHINE_IA64 0x0200
2690 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2691 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2692 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2693 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2694 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2695 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2696 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2697 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2698 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2699 #define IMAGE_FILE_MACHINE_M32R 0x9041
2700 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2702 /* Wine extension */
2703 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2705 #define IMAGE_SIZEOF_FILE_HEADER 20
2706 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2707 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2708 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2709 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2710 #define IMAGE_SIZEOF_SHORT_NAME 8
2711 #define IMAGE_SIZEOF_SECTION_HEADER 40
2712 #define IMAGE_SIZEOF_SYMBOL 18
2713 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2714 #define IMAGE_SIZEOF_RELOCATION 10
2715 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2716 #define IMAGE_SIZEOF_LINENUMBER 6
2717 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2719 /* Possible Magic values */
2720 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2721 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2722 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2724 #ifdef _WIN64
2725 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2726 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2727 #else
2728 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2729 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2730 #endif
2732 /* These are indexes into the DataDirectory array */
2733 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2734 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2735 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2736 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2737 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2738 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2739 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2740 #define IMAGE_FILE_DESCRIPTION_STRING 7
2741 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2742 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2743 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2745 /* Directory Entries, indices into the DataDirectory array */
2747 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2748 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2749 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2750 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2751 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2752 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2753 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2754 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2755 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2756 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2757 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2758 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2759 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2760 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2761 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2763 /* Subsystem Values */
2765 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2766 #define IMAGE_SUBSYSTEM_NATIVE 1
2767 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2768 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2769 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2770 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2771 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2772 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2773 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2774 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2775 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2776 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2777 #define IMAGE_SUBSYSTEM_XBOX 14
2778 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2780 /* DLL Characteristics */
2781 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2782 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2783 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2784 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2785 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2786 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2787 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2788 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2790 typedef struct _IMAGE_FILE_HEADER {
2791 WORD Machine;
2792 WORD NumberOfSections;
2793 DWORD TimeDateStamp;
2794 DWORD PointerToSymbolTable;
2795 DWORD NumberOfSymbols;
2796 WORD SizeOfOptionalHeader;
2797 WORD Characteristics;
2798 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2800 typedef struct _IMAGE_DATA_DIRECTORY {
2801 DWORD VirtualAddress;
2802 DWORD Size;
2803 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2805 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2807 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2808 WORD Magic; /* 0x20b */
2809 BYTE MajorLinkerVersion;
2810 BYTE MinorLinkerVersion;
2811 DWORD SizeOfCode;
2812 DWORD SizeOfInitializedData;
2813 DWORD SizeOfUninitializedData;
2814 DWORD AddressOfEntryPoint;
2815 DWORD BaseOfCode;
2816 ULONGLONG ImageBase;
2817 DWORD SectionAlignment;
2818 DWORD FileAlignment;
2819 WORD MajorOperatingSystemVersion;
2820 WORD MinorOperatingSystemVersion;
2821 WORD MajorImageVersion;
2822 WORD MinorImageVersion;
2823 WORD MajorSubsystemVersion;
2824 WORD MinorSubsystemVersion;
2825 DWORD Win32VersionValue;
2826 DWORD SizeOfImage;
2827 DWORD SizeOfHeaders;
2828 DWORD CheckSum;
2829 WORD Subsystem;
2830 WORD DllCharacteristics;
2831 ULONGLONG SizeOfStackReserve;
2832 ULONGLONG SizeOfStackCommit;
2833 ULONGLONG SizeOfHeapReserve;
2834 ULONGLONG SizeOfHeapCommit;
2835 DWORD LoaderFlags;
2836 DWORD NumberOfRvaAndSizes;
2837 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2838 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2840 typedef struct _IMAGE_NT_HEADERS64 {
2841 DWORD Signature;
2842 IMAGE_FILE_HEADER FileHeader;
2843 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2844 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2846 typedef struct _IMAGE_OPTIONAL_HEADER {
2848 /* Standard fields */
2850 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
2851 BYTE MajorLinkerVersion;
2852 BYTE MinorLinkerVersion;
2853 DWORD SizeOfCode;
2854 DWORD SizeOfInitializedData;
2855 DWORD SizeOfUninitializedData;
2856 DWORD AddressOfEntryPoint; /* 0x10 */
2857 DWORD BaseOfCode;
2858 DWORD BaseOfData;
2860 /* NT additional fields */
2862 DWORD ImageBase;
2863 DWORD SectionAlignment; /* 0x20 */
2864 DWORD FileAlignment;
2865 WORD MajorOperatingSystemVersion;
2866 WORD MinorOperatingSystemVersion;
2867 WORD MajorImageVersion;
2868 WORD MinorImageVersion;
2869 WORD MajorSubsystemVersion; /* 0x30 */
2870 WORD MinorSubsystemVersion;
2871 DWORD Win32VersionValue;
2872 DWORD SizeOfImage;
2873 DWORD SizeOfHeaders;
2874 DWORD CheckSum; /* 0x40 */
2875 WORD Subsystem;
2876 WORD DllCharacteristics;
2877 DWORD SizeOfStackReserve;
2878 DWORD SizeOfStackCommit;
2879 DWORD SizeOfHeapReserve; /* 0x50 */
2880 DWORD SizeOfHeapCommit;
2881 DWORD LoaderFlags;
2882 DWORD NumberOfRvaAndSizes;
2883 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2884 /* 0xE0 */
2885 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2887 typedef struct _IMAGE_NT_HEADERS {
2888 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2889 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2890 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
2891 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2893 #ifdef _WIN64
2894 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2895 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2896 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2897 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2898 #else
2899 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2900 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2901 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2902 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2903 #endif
2905 #define IMAGE_SIZEOF_SHORT_NAME 8
2907 typedef struct _IMAGE_SECTION_HEADER {
2908 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2909 union {
2910 DWORD PhysicalAddress;
2911 DWORD VirtualSize;
2912 } Misc;
2913 DWORD VirtualAddress;
2914 DWORD SizeOfRawData;
2915 DWORD PointerToRawData;
2916 DWORD PointerToRelocations;
2917 DWORD PointerToLinenumbers;
2918 WORD NumberOfRelocations;
2919 WORD NumberOfLinenumbers;
2920 DWORD Characteristics;
2921 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2923 #define IMAGE_SIZEOF_SECTION_HEADER 40
2925 #define IMAGE_FIRST_SECTION(ntheader) \
2926 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2927 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2929 /* These defines are for the Characteristics bitfield. */
2930 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2931 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2932 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2933 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2934 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2935 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2937 #define IMAGE_SCN_CNT_CODE 0x00000020
2938 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2939 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2941 #define IMAGE_SCN_LNK_OTHER 0x00000100
2942 #define IMAGE_SCN_LNK_INFO 0x00000200
2943 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2944 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2945 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2947 /* 0x00002000 - Reserved */
2948 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2949 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2951 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2952 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2953 #define IMAGE_SCN_MEM_16BIT 0x00020000
2954 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2955 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2957 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2958 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2959 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2960 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2961 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2962 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2963 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2964 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2965 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2966 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2967 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2968 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2969 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2970 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2971 /* 0x00F00000 - Unused */
2972 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2974 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2977 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2978 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2979 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2980 #define IMAGE_SCN_MEM_SHARED 0x10000000
2981 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2982 #define IMAGE_SCN_MEM_READ 0x40000000
2983 #define IMAGE_SCN_MEM_WRITE 0x80000000
2985 #include <pshpack2.h>
2987 typedef struct _IMAGE_SYMBOL {
2988 union {
2989 BYTE ShortName[8];
2990 struct {
2991 DWORD Short;
2992 DWORD Long;
2993 } Name;
2994 DWORD LongName[2];
2995 } N;
2996 DWORD Value;
2997 SHORT SectionNumber;
2998 WORD Type;
2999 BYTE StorageClass;
3000 BYTE NumberOfAuxSymbols;
3001 } IMAGE_SYMBOL;
3002 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
3004 #define IMAGE_SIZEOF_SYMBOL 18
3006 typedef struct _IMAGE_LINENUMBER {
3007 union {
3008 DWORD SymbolTableIndex;
3009 DWORD VirtualAddress;
3010 } Type;
3011 WORD Linenumber;
3012 } IMAGE_LINENUMBER;
3013 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
3015 #define IMAGE_SIZEOF_LINENUMBER 6
3017 typedef union _IMAGE_AUX_SYMBOL {
3018 struct {
3019 DWORD TagIndex;
3020 union {
3021 struct {
3022 WORD Linenumber;
3023 WORD Size;
3024 } LnSz;
3025 DWORD TotalSize;
3026 } Misc;
3027 union {
3028 struct {
3029 DWORD PointerToLinenumber;
3030 DWORD PointerToNextFunction;
3031 } Function;
3032 struct {
3033 WORD Dimension[4];
3034 } Array;
3035 } FcnAry;
3036 WORD TvIndex;
3037 } Sym;
3038 struct {
3039 BYTE Name[IMAGE_SIZEOF_SYMBOL];
3040 } File;
3041 struct {
3042 DWORD Length;
3043 WORD NumberOfRelocations;
3044 WORD NumberOfLinenumbers;
3045 DWORD CheckSum;
3046 SHORT Number;
3047 BYTE Selection;
3048 } Section;
3049 } IMAGE_AUX_SYMBOL;
3050 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
3052 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3054 #include <poppack.h>
3056 #define IMAGE_SYM_UNDEFINED (SHORT)0
3057 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3058 #define IMAGE_SYM_DEBUG (SHORT)-2
3060 #define IMAGE_SYM_TYPE_NULL 0x0000
3061 #define IMAGE_SYM_TYPE_VOID 0x0001
3062 #define IMAGE_SYM_TYPE_CHAR 0x0002
3063 #define IMAGE_SYM_TYPE_SHORT 0x0003
3064 #define IMAGE_SYM_TYPE_INT 0x0004
3065 #define IMAGE_SYM_TYPE_LONG 0x0005
3066 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3067 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3068 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3069 #define IMAGE_SYM_TYPE_UNION 0x0009
3070 #define IMAGE_SYM_TYPE_ENUM 0x000A
3071 #define IMAGE_SYM_TYPE_MOE 0x000B
3072 #define IMAGE_SYM_TYPE_BYTE 0x000C
3073 #define IMAGE_SYM_TYPE_WORD 0x000D
3074 #define IMAGE_SYM_TYPE_UINT 0x000E
3075 #define IMAGE_SYM_TYPE_DWORD 0x000F
3076 #define IMAGE_SYM_TYPE_PCODE 0x8000
3078 #define IMAGE_SYM_DTYPE_NULL 0
3079 #define IMAGE_SYM_DTYPE_POINTER 1
3080 #define IMAGE_SYM_DTYPE_FUNCTION 2
3081 #define IMAGE_SYM_DTYPE_ARRAY 3
3083 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3084 #define IMAGE_SYM_CLASS_NULL 0x0000
3085 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3086 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3087 #define IMAGE_SYM_CLASS_STATIC 0x0003
3088 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3089 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3090 #define IMAGE_SYM_CLASS_LABEL 0x0006
3091 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3092 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3093 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3094 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3095 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3096 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3097 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3098 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3099 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3100 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3101 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3102 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3104 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3105 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3106 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3107 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3108 #define IMAGE_SYM_CLASS_FILE 0x0067
3109 #define IMAGE_SYM_CLASS_SECTION 0x0068
3110 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3112 #define N_BTMASK 0x000F
3113 #define N_TMASK 0x0030
3114 #define N_TMASK1 0x00C0
3115 #define N_TMASK2 0x00F0
3116 #define N_BTSHFT 4
3117 #define N_TSHIFT 2
3119 #define BTYPE(x) ((x) & N_BTMASK)
3121 #ifndef ISPTR
3122 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3123 #endif
3125 #ifndef ISFCN
3126 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3127 #endif
3129 #ifndef ISARY
3130 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3131 #endif
3133 #ifndef ISTAG
3134 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3135 #endif
3137 #ifndef INCREF
3138 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3139 #endif
3140 #ifndef DECREF
3141 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3142 #endif
3144 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3145 #define IMAGE_COMDAT_SELECT_ANY 2
3146 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3147 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3148 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3149 #define IMAGE_COMDAT_SELECT_LARGEST 6
3150 #define IMAGE_COMDAT_SELECT_NEWEST 7
3152 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3153 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3154 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3156 /* Export module directory */
3158 typedef struct _IMAGE_EXPORT_DIRECTORY {
3159 DWORD Characteristics;
3160 DWORD TimeDateStamp;
3161 WORD MajorVersion;
3162 WORD MinorVersion;
3163 DWORD Name;
3164 DWORD Base;
3165 DWORD NumberOfFunctions;
3166 DWORD NumberOfNames;
3167 DWORD AddressOfFunctions;
3168 DWORD AddressOfNames;
3169 DWORD AddressOfNameOrdinals;
3170 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
3172 /* Import name entry */
3173 typedef struct _IMAGE_IMPORT_BY_NAME {
3174 WORD Hint;
3175 BYTE Name[1];
3176 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
3178 #include <pshpack8.h>
3179 /* Import thunk */
3180 typedef struct _IMAGE_THUNK_DATA64 {
3181 union {
3182 ULONGLONG ForwarderString;
3183 ULONGLONG Function;
3184 ULONGLONG Ordinal;
3185 ULONGLONG AddressOfData;
3186 } u1;
3187 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
3188 #include <poppack.h>
3190 typedef struct _IMAGE_THUNK_DATA32 {
3191 union {
3192 DWORD ForwarderString;
3193 DWORD Function;
3194 DWORD Ordinal;
3195 DWORD AddressOfData;
3196 } u1;
3197 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
3199 /* Import module directory */
3201 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3202 union {
3203 DWORD Characteristics; /* 0 for terminating null import descriptor */
3204 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
3205 } DUMMYUNIONNAME;
3206 DWORD TimeDateStamp; /* 0 if not bound,
3207 * -1 if bound, and real date\time stamp
3208 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3209 * (new BIND)
3210 * otherwise date/time stamp of DLL bound to
3211 * (Old BIND)
3213 DWORD ForwarderChain; /* -1 if no forwarders */
3214 DWORD Name;
3215 /* RVA to IAT (if bound this IAT has actual addresses) */
3216 DWORD FirstThunk;
3217 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
3219 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3220 #define IMAGE_ORDINAL_FLAG32 0x80000000
3221 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3222 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3223 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3224 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3226 #ifdef _WIN64
3227 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3228 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3229 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3230 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3231 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3232 #else
3233 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3234 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3235 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3236 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3237 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3238 #endif
3240 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3242 DWORD TimeDateStamp;
3243 WORD OffsetModuleName;
3244 WORD NumberOfModuleForwarderRefs;
3245 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3246 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3248 typedef struct _IMAGE_BOUND_FORWARDER_REF
3250 DWORD TimeDateStamp;
3251 WORD OffsetModuleName;
3252 WORD Reserved;
3253 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3255 typedef struct _IMAGE_BASE_RELOCATION
3257 DWORD VirtualAddress;
3258 DWORD SizeOfBlock;
3259 /* WORD TypeOffset[1]; */
3260 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
3262 #include <pshpack2.h>
3264 typedef struct _IMAGE_RELOCATION
3266 union {
3267 DWORD VirtualAddress;
3268 DWORD RelocCount;
3269 } DUMMYUNIONNAME;
3270 DWORD SymbolTableIndex;
3271 WORD Type;
3272 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
3274 #include <poppack.h>
3276 #define IMAGE_SIZEOF_RELOCATION 10
3278 /* generic relocation types */
3279 #define IMAGE_REL_BASED_ABSOLUTE 0
3280 #define IMAGE_REL_BASED_HIGH 1
3281 #define IMAGE_REL_BASED_LOW 2
3282 #define IMAGE_REL_BASED_HIGHLOW 3
3283 #define IMAGE_REL_BASED_HIGHADJ 4
3284 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3285 #define IMAGE_REL_BASED_SECTION 6
3286 #define IMAGE_REL_BASED_REL 7
3287 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3288 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3289 #define IMAGE_REL_BASED_DIR64 10
3290 #define IMAGE_REL_BASED_HIGH3ADJ 11
3292 /* I386 relocation types */
3293 #define IMAGE_REL_I386_ABSOLUTE 0
3294 #define IMAGE_REL_I386_DIR16 1
3295 #define IMAGE_REL_I386_REL16 2
3296 #define IMAGE_REL_I386_DIR32 6
3297 #define IMAGE_REL_I386_DIR32NB 7
3298 #define IMAGE_REL_I386_SEG12 9
3299 #define IMAGE_REL_I386_SECTION 10
3300 #define IMAGE_REL_I386_SECREL 11
3301 #define IMAGE_REL_I386_TOKEN 12
3302 #define IMAGE_REL_I386_SECREL7 13
3303 #define IMAGE_REL_I386_REL32 20
3305 /* MIPS relocation types */
3306 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3307 #define IMAGE_REL_MIPS_REFHALF 0x0001
3308 #define IMAGE_REL_MIPS_REFWORD 0x0002
3309 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3310 #define IMAGE_REL_MIPS_REFHI 0x0004
3311 #define IMAGE_REL_MIPS_REFLO 0x0005
3312 #define IMAGE_REL_MIPS_GPREL 0x0006
3313 #define IMAGE_REL_MIPS_LITERAL 0x0007
3314 #define IMAGE_REL_MIPS_SECTION 0x000A
3315 #define IMAGE_REL_MIPS_SECREL 0x000B
3316 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3317 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3318 #define IMAGE_REL_MIPS_TOKEN 0x000E
3319 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3320 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3321 #define IMAGE_REL_MIPS_PAIR 0x0025
3323 /* ALPHA relocation types */
3324 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3325 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3326 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3327 #define IMAGE_REL_ALPHA_GPREL 0x0003
3328 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3329 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3330 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3331 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3332 #define IMAGE_REL_ALPHA_HINT 0x0008
3333 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3334 #define IMAGE_REL_ALPHA_REFHI 0x000A
3335 #define IMAGE_REL_ALPHA_REFLO 0x000B
3336 #define IMAGE_REL_ALPHA_PAIR 0x000C
3337 #define IMAGE_REL_ALPHA_MATCH 0x000D
3338 #define IMAGE_REL_ALPHA_SECTION 0x000E
3339 #define IMAGE_REL_ALPHA_SECREL 0x000F
3340 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3341 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3342 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3343 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3344 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3345 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3346 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3347 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3349 /* PowerPC relocation types */
3350 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3351 #define IMAGE_REL_PPC_ADDR64 0x0001
3352 #define IMAGE_REL_PPC_ADDR 0x0002
3353 #define IMAGE_REL_PPC_ADDR24 0x0003
3354 #define IMAGE_REL_PPC_ADDR16 0x0004
3355 #define IMAGE_REL_PPC_ADDR14 0x0005
3356 #define IMAGE_REL_PPC_REL24 0x0006
3357 #define IMAGE_REL_PPC_REL14 0x0007
3358 #define IMAGE_REL_PPC_TOCREL16 0x0008
3359 #define IMAGE_REL_PPC_TOCREL14 0x0009
3360 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3361 #define IMAGE_REL_PPC_SECREL 0x000B
3362 #define IMAGE_REL_PPC_SECTION 0x000C
3363 #define IMAGE_REL_PPC_IFGLUE 0x000D
3364 #define IMAGE_REL_PPC_IMGLUE 0x000E
3365 #define IMAGE_REL_PPC_SECREL16 0x000F
3366 #define IMAGE_REL_PPC_REFHI 0x0010
3367 #define IMAGE_REL_PPC_REFLO 0x0011
3368 #define IMAGE_REL_PPC_PAIR 0x0012
3369 #define IMAGE_REL_PPC_SECRELLO 0x0013
3370 #define IMAGE_REL_PPC_SECRELHI 0x0014
3371 #define IMAGE_REL_PPC_GPREL 0x0015
3372 #define IMAGE_REL_PPC_TOKEN 0x0016
3373 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3374 /* modifier bits */
3375 #define IMAGE_REL_PPC_NEG 0x0100
3376 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3377 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3378 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3380 /* SH3 ? relocation type */
3381 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3382 #define IMAGE_REL_SH3_DIRECT16 0x0001
3383 #define IMAGE_REL_SH3_DIRECT 0x0002
3384 #define IMAGE_REL_SH3_DIRECT8 0x0003
3385 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3386 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3387 #define IMAGE_REL_SH3_DIRECT4 0x0006
3388 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3389 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3390 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3391 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3392 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3393 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3394 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3395 #define IMAGE_REL_SH3_SECTION 0x000E
3396 #define IMAGE_REL_SH3_SECREL 0x000F
3397 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3398 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3399 #define IMAGE_REL_SH3_TOKEN 0x0012
3401 /* ARM (Archimedes?) relocation types */
3402 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3403 #define IMAGE_REL_ARM_ADDR 0x0001
3404 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3405 #define IMAGE_REL_ARM_BRANCH24 0x0003
3406 #define IMAGE_REL_ARM_BRANCH11 0x0004
3407 #define IMAGE_REL_ARM_TOKEN 0x0005
3408 #define IMAGE_REL_ARM_GPREL12 0x0006
3409 #define IMAGE_REL_ARM_GPREL7 0x0007
3410 #define IMAGE_REL_ARM_BLX24 0x0008
3411 #define IMAGE_REL_ARM_BLX11 0x0009
3412 #define IMAGE_REL_ARM_SECTION 0x000E
3413 #define IMAGE_REL_ARM_SECREL 0x000F
3415 /* IA64 relocation types */
3416 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3417 #define IMAGE_REL_IA64_IMM14 0x0001
3418 #define IMAGE_REL_IA64_IMM22 0x0002
3419 #define IMAGE_REL_IA64_IMM64 0x0003
3420 #define IMAGE_REL_IA64_DIR 0x0004
3421 #define IMAGE_REL_IA64_DIR64 0x0005
3422 #define IMAGE_REL_IA64_PCREL21B 0x0006
3423 #define IMAGE_REL_IA64_PCREL21M 0x0007
3424 #define IMAGE_REL_IA64_PCREL21F 0x0008
3425 #define IMAGE_REL_IA64_GPREL22 0x0009
3426 #define IMAGE_REL_IA64_LTOFF22 0x000A
3427 #define IMAGE_REL_IA64_SECTION 0x000B
3428 #define IMAGE_REL_IA64_SECREL22 0x000C
3429 #define IMAGE_REL_IA64_SECREL64I 0x000D
3430 #define IMAGE_REL_IA64_SECREL 0x000E
3431 #define IMAGE_REL_IA64_LTOFF64 0x000F
3432 #define IMAGE_REL_IA64_DIR32NB 0x0010
3433 #define IMAGE_REL_IA64_SREL14 0x0011
3434 #define IMAGE_REL_IA64_SREL22 0x0012
3435 #define IMAGE_REL_IA64_SREL32 0x0013
3436 #define IMAGE_REL_IA64_UREL32 0x0014
3437 #define IMAGE_REL_IA64_PCREL60X 0x0015
3438 #define IMAGE_REL_IA64_PCREL60B 0x0016
3439 #define IMAGE_REL_IA64_PCREL60F 0x0017
3440 #define IMAGE_REL_IA64_PCREL60I 0x0018
3441 #define IMAGE_REL_IA64_PCREL60M 0x0019
3442 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3443 #define IMAGE_REL_IA64_TOKEN 0x001B
3444 #define IMAGE_REL_IA64_GPREL32 0x001C
3445 #define IMAGE_REL_IA64_ADDEND 0x001F
3447 /* AMD64 relocation types */
3448 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3449 #define IMAGE_REL_AMD64_ADDR64 0x0001
3450 #define IMAGE_REL_AMD64_ADDR32 0x0002
3451 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3452 #define IMAGE_REL_AMD64_REL32 0x0004
3453 #define IMAGE_REL_AMD64_REL32_1 0x0005
3454 #define IMAGE_REL_AMD64_REL32_2 0x0006
3455 #define IMAGE_REL_AMD64_REL32_3 0x0007
3456 #define IMAGE_REL_AMD64_REL32_4 0x0008
3457 #define IMAGE_REL_AMD64_REL32_5 0x0009
3458 #define IMAGE_REL_AMD64_SECTION 0x000A
3459 #define IMAGE_REL_AMD64_SECREL 0x000B
3460 #define IMAGE_REL_AMD64_SECREL7 0x000C
3461 #define IMAGE_REL_AMD64_TOKEN 0x000D
3462 #define IMAGE_REL_AMD64_SREL32 0x000E
3463 #define IMAGE_REL_AMD64_PAIR 0x000F
3464 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3466 /* archive format */
3468 #define IMAGE_ARCHIVE_START_SIZE 8
3469 #define IMAGE_ARCHIVE_START "!<arch>\n"
3470 #define IMAGE_ARCHIVE_END "`\n"
3471 #define IMAGE_ARCHIVE_PAD "\n"
3472 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3473 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3475 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3477 BYTE Name[16];
3478 BYTE Date[12];
3479 BYTE UserID[6];
3480 BYTE GroupID[6];
3481 BYTE Mode[8];
3482 BYTE Size[10];
3483 BYTE EndHeader[2];
3484 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3486 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3488 typedef struct _IMPORT_OBJECT_HEADER
3490 WORD Sig1;
3491 WORD Sig2;
3492 WORD Version;
3493 WORD Machine;
3494 DWORD TimeDateStamp;
3495 DWORD SizeOfData;
3496 union
3498 WORD Ordinal;
3499 WORD Hint;
3500 } DUMMYUNIONNAME;
3501 WORD Type : 2;
3502 WORD NameType : 3;
3503 WORD Reserved : 11;
3504 } IMPORT_OBJECT_HEADER;
3506 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3508 typedef enum IMPORT_OBJECT_TYPE
3510 IMPORT_OBJECT_CODE = 0,
3511 IMPORT_OBJECT_DATA = 1,
3512 IMPORT_OBJECT_CONST = 2
3513 } IMPORT_OBJECT_TYPE;
3515 typedef enum IMPORT_OBJECT_NAME_TYPE
3517 IMPORT_OBJECT_ORDINAL = 0,
3518 IMPORT_OBJECT_NAME = 1,
3519 IMPORT_OBJECT_NAME_NO_PREFIX = 2,
3520 IMPORT_OBJECT_NAME_UNDECORATE = 3
3521 } IMPORT_OBJECT_NAME_TYPE;
3523 typedef struct _ANON_OBJECT_HEADER
3525 WORD Sig1;
3526 WORD Sig2;
3527 WORD Version;
3528 WORD Machine;
3529 DWORD TimeDateStamp;
3530 CLSID ClassID;
3531 DWORD SizeOfData;
3532 } ANON_OBJECT_HEADER;
3535 * Resource directory stuff
3537 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3538 DWORD Characteristics;
3539 DWORD TimeDateStamp;
3540 WORD MajorVersion;
3541 WORD MinorVersion;
3542 WORD NumberOfNamedEntries;
3543 WORD NumberOfIdEntries;
3544 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3545 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3547 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3548 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3550 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3551 union {
3552 struct {
3553 #ifdef BITFIELDS_BIGENDIAN
3554 unsigned NameIsString:1;
3555 unsigned NameOffset:31;
3556 #else
3557 unsigned NameOffset:31;
3558 unsigned NameIsString:1;
3559 #endif
3560 } DUMMYSTRUCTNAME1;
3561 DWORD Name;
3562 struct {
3563 #ifdef WORDS_BIGENDIAN
3564 WORD __pad;
3565 WORD Id;
3566 #else
3567 WORD Id;
3568 WORD __pad;
3569 #endif
3570 } DUMMYSTRUCTNAME2;
3571 } DUMMYUNIONNAME1;
3572 union {
3573 DWORD OffsetToData;
3574 struct {
3575 #ifdef BITFIELDS_BIGENDIAN
3576 unsigned DataIsDirectory:1;
3577 unsigned OffsetToDirectory:31;
3578 #else
3579 unsigned OffsetToDirectory:31;
3580 unsigned DataIsDirectory:1;
3581 #endif
3582 } DUMMYSTRUCTNAME3;
3583 } DUMMYUNIONNAME2;
3584 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3587 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3588 WORD Length;
3589 CHAR NameString[ 1 ];
3590 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3592 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3593 WORD Length;
3594 WCHAR NameString[ 1 ];
3595 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3597 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3598 DWORD OffsetToData;
3599 DWORD Size;
3600 DWORD CodePage;
3601 DWORD Reserved;
3602 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3605 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
3606 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3609 typedef struct _IMAGE_TLS_DIRECTORY64 {
3610 ULONGLONG StartAddressOfRawData;
3611 ULONGLONG EndAddressOfRawData;
3612 ULONGLONG AddressOfIndex;
3613 ULONGLONG AddressOfCallBacks;
3614 DWORD SizeOfZeroFill;
3615 DWORD Characteristics;
3616 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3618 typedef struct _IMAGE_TLS_DIRECTORY32 {
3619 DWORD StartAddressOfRawData;
3620 DWORD EndAddressOfRawData;
3621 DWORD AddressOfIndex;
3622 DWORD AddressOfCallBacks;
3623 DWORD SizeOfZeroFill;
3624 DWORD Characteristics;
3625 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3627 #ifdef _WIN64
3628 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3629 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3630 #else
3631 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3632 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3633 #endif
3635 typedef struct _IMAGE_DEBUG_DIRECTORY {
3636 DWORD Characteristics;
3637 DWORD TimeDateStamp;
3638 WORD MajorVersion;
3639 WORD MinorVersion;
3640 DWORD Type;
3641 DWORD SizeOfData;
3642 DWORD AddressOfRawData;
3643 DWORD PointerToRawData;
3644 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3646 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3647 #define IMAGE_DEBUG_TYPE_COFF 1
3648 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3649 #define IMAGE_DEBUG_TYPE_FPO 3
3650 #define IMAGE_DEBUG_TYPE_MISC 4
3651 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3652 #define IMAGE_DEBUG_TYPE_FIXUP 6
3653 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3654 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3655 #define IMAGE_DEBUG_TYPE_BORLAND 9
3656 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3658 typedef enum ReplacesCorHdrNumericDefines
3660 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3661 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3662 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3663 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3664 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3666 COR_VERSION_MAJOR_V2 = 2,
3667 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3668 COR_VERSION_MINOR = 0,
3669 COR_DELETED_NAME_LENGTH = 8,
3670 COR_VTABLEGAP_NAME_LENGTH = 8,
3672 NATIVE_TYPE_MAX_CB = 1,
3673 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xff,
3675 IMAGE_COR_MIH_METHODRVA = 0x01,
3676 IMAGE_COR_MIH_EHRVA = 0x02,
3677 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3679 COR_VTABLE_32BIT = 0x01,
3680 COR_VTABLE_64BIT = 0x02,
3681 COR_VTABLE_FROM_UNMANAGED = 0x04,
3682 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3684 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3686 MAX_CLASS_NAME = 1024,
3687 MAX_PACKAGE_NAME = 1024,
3688 } ReplacesCorHdrNumericDefines;
3690 typedef struct IMAGE_COR20_HEADER
3692 DWORD cb;
3693 WORD MajorRuntimeVersion;
3694 WORD MinorRuntimeVersion;
3696 IMAGE_DATA_DIRECTORY MetaData;
3697 DWORD Flags;
3698 DWORD EntryPointToken;
3700 IMAGE_DATA_DIRECTORY Resources;
3701 IMAGE_DATA_DIRECTORY StrongNameSignature;
3702 IMAGE_DATA_DIRECTORY CodeManagerTable;
3703 IMAGE_DATA_DIRECTORY VTableFixups;
3704 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3705 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3707 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3709 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3710 DWORD NumberOfSymbols;
3711 DWORD LvaToFirstSymbol;
3712 DWORD NumberOfLinenumbers;
3713 DWORD LvaToFirstLinenumber;
3714 DWORD RvaToFirstByteOfCode;
3715 DWORD RvaToLastByteOfCode;
3716 DWORD RvaToFirstByteOfData;
3717 DWORD RvaToLastByteOfData;
3718 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3720 #define FRAME_FPO 0
3721 #define FRAME_TRAP 1
3722 #define FRAME_TSS 2
3723 #define FRAME_NONFPO 3
3725 typedef struct _FPO_DATA {
3726 DWORD ulOffStart;
3727 DWORD cbProcSize;
3728 DWORD cdwLocals;
3729 WORD cdwParams;
3730 WORD cbProlog : 8;
3731 WORD cbRegs : 3;
3732 WORD fHasSEH : 1;
3733 WORD fUseBP : 1;
3734 WORD reserved : 1;
3735 WORD cbFrame : 2;
3736 } FPO_DATA, *PFPO_DATA;
3738 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
3739 DWORD Size;
3740 DWORD TimeDateStamp;
3741 WORD MajorVersion;
3742 WORD MinorVersion;
3743 DWORD GlobalFlagsClear;
3744 DWORD GlobalFlagsSet;
3745 DWORD CriticalSectionDefaultTimeout;
3746 DWORD DeCommitFreeBlockThreshold;
3747 DWORD DeCommitTotalFreeThreshold;
3748 PVOID LockPrefixTable;
3749 DWORD MaximumAllocationSize;
3750 DWORD VirtualMemoryThreshold;
3751 DWORD ProcessHeapFlags;
3752 DWORD ProcessAffinityMask;
3753 WORD CSDVersion;
3754 WORD Reserved1;
3755 PVOID EditList;
3756 DWORD SecurityCookie;
3757 DWORD SEHandlerTable;
3758 DWORD SEHandlerCount;
3759 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3761 typedef struct _IMAGE_FUNCTION_ENTRY {
3762 DWORD StartingAddress;
3763 DWORD EndingAddress;
3764 DWORD EndOfPrologue;
3765 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3767 #define IMAGE_DEBUG_MISC_EXENAME 1
3769 typedef struct _IMAGE_DEBUG_MISC {
3770 DWORD DataType;
3771 DWORD Length;
3772 BYTE Unicode;
3773 BYTE Reserved[ 3 ];
3774 BYTE Data[ 1 ];
3775 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3777 /* This is the structure that appears at the very start of a .DBG file. */
3779 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3780 WORD Signature;
3781 WORD Flags;
3782 WORD Machine;
3783 WORD Characteristics;
3784 DWORD TimeDateStamp;
3785 DWORD CheckSum;
3786 DWORD ImageBase;
3787 DWORD SizeOfImage;
3788 DWORD NumberOfSections;
3789 DWORD ExportedNamesSize;
3790 DWORD DebugDirectorySize;
3791 DWORD SectionAlignment;
3792 DWORD Reserved[ 2 ];
3793 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3795 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3798 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3799 WORD Length;
3800 WORD Flags;
3801 BYTE Text[1];
3802 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3803 #define MESSAGE_RESOURCE_UNICODE 0x0001
3805 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3806 DWORD LowId;
3807 DWORD HighId;
3808 DWORD OffsetToEntries;
3809 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3811 typedef struct tagMESSAGE_RESOURCE_DATA {
3812 DWORD NumberOfBlocks;
3813 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3814 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3817 * Here follows typedefs for security and tokens.
3821 * First a constant for the following typedefs.
3824 #define ANYSIZE_ARRAY 1
3826 /* FIXME: Orphan. What does it point to? */
3827 typedef PVOID PACCESS_TOKEN;
3828 typedef PVOID PSECURITY_DESCRIPTOR;
3829 typedef PVOID PSID;
3831 typedef enum _TOKEN_ELEVATION_TYPE {
3832 TokenElevationTypeDefault = 1,
3833 TokenElevationTypeFull,
3834 TokenElevationTypeLimited
3835 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
3838 * TOKEN_INFORMATION_CLASS
3841 typedef enum _TOKEN_INFORMATION_CLASS {
3842 TokenUser = 1,
3843 TokenGroups,
3844 TokenPrivileges,
3845 TokenOwner,
3846 TokenPrimaryGroup,
3847 TokenDefaultDacl,
3848 TokenSource,
3849 TokenType,
3850 TokenImpersonationLevel,
3851 TokenStatistics,
3852 TokenRestrictedSids,
3853 TokenSessionId,
3854 TokenGroupsAndPrivileges,
3855 TokenSessionReference,
3856 TokenSandBoxInert,
3857 TokenAuditPolicy,
3858 TokenOrigin,
3859 TokenElevationType,
3860 TokenLinkedToken,
3861 TokenElevation,
3862 TokenHasRestrictions,
3863 TokenAccessInformation,
3864 TokenVirtualizationAllowed,
3865 TokenVirtualizationEnabled,
3866 TokenIntegrityLevel,
3867 TokenUIAccess,
3868 TokenMandatoryPolicy,
3869 TokenLogonSid,
3870 MaxTokenInfoClass
3871 } TOKEN_INFORMATION_CLASS;
3873 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3874 #define TOKEN_ADJUST_GROUPS 0x0040
3875 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3876 #define TOKEN_ADJUST_SESSIONID 0x0100
3877 #define TOKEN_ASSIGN_PRIMARY 0x0001
3878 #define TOKEN_DUPLICATE 0x0002
3879 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3880 #define TOKEN_IMPERSONATE 0x0004
3881 #define TOKEN_QUERY 0x0008
3882 #define TOKEN_QUERY_SOURCE 0x0010
3883 #define TOKEN_ADJUST_DEFAULT 0x0080
3884 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3885 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3886 TOKEN_ADJUST_PRIVILEGES | \
3887 TOKEN_ADJUST_GROUPS | \
3888 TOKEN_ADJUST_DEFAULT )
3889 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3890 TOKEN_ASSIGN_PRIMARY | \
3891 TOKEN_DUPLICATE | \
3892 TOKEN_IMPERSONATE | \
3893 TOKEN_QUERY | \
3894 TOKEN_QUERY_SOURCE | \
3895 TOKEN_ADJUST_PRIVILEGES | \
3896 TOKEN_ADJUST_GROUPS | \
3897 TOKEN_ADJUST_SESSIONID | \
3898 TOKEN_ADJUST_DEFAULT )
3900 #ifndef _SECURITY_DEFINED
3901 #define _SECURITY_DEFINED
3904 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3906 typedef struct _GENERIC_MAPPING {
3907 ACCESS_MASK GenericRead;
3908 ACCESS_MASK GenericWrite;
3909 ACCESS_MASK GenericExecute;
3910 ACCESS_MASK GenericAll;
3911 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3913 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3914 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3915 typedef struct {
3916 BYTE Value[6];
3917 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
3918 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3920 #ifndef SID_DEFINED
3921 #define SID_DEFINED
3922 typedef struct _SID {
3923 BYTE Revision;
3924 BYTE SubAuthorityCount;
3925 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3926 DWORD SubAuthority[1];
3927 } SID,*PISID;
3928 #endif /* !defined(SID_DEFINED) */
3930 #define SID_REVISION (1) /* Current revision */
3931 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3932 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3934 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3937 * ACL
3940 #define ACL_REVISION1 1
3941 #define ACL_REVISION2 2
3942 #define ACL_REVISION3 3
3943 #define ACL_REVISION4 4
3945 #define MIN_ACL_REVISION ACL_REVISION2
3946 #define MAX_ACL_REVISION ACL_REVISION4
3948 #define ACL_REVISION 2
3950 typedef struct _ACL {
3951 BYTE AclRevision;
3952 BYTE Sbz1;
3953 WORD AclSize;
3954 WORD AceCount;
3955 WORD Sbz2;
3956 } ACL, *PACL;
3958 typedef enum _ACL_INFORMATION_CLASS
3960 AclRevisionInformation = 1,
3961 AclSizeInformation
3962 } ACL_INFORMATION_CLASS;
3964 typedef struct _ACL_REVISION_INFORMATION
3966 DWORD AclRevision;
3967 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
3969 typedef struct _ACL_SIZE_INFORMATION
3971 DWORD AceCount;
3972 DWORD AclBytesInUse;
3973 DWORD AclBytesFree;
3974 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
3976 /* SECURITY_DESCRIPTOR */
3977 #define SECURITY_DESCRIPTOR_REVISION 1
3978 #define SECURITY_DESCRIPTOR_REVISION1 1
3982 * Privilege Names
3984 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3985 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3986 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3987 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3988 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3989 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3990 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3991 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3992 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3993 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3994 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3995 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3996 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3997 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3998 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3999 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
4000 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
4001 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
4002 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
4003 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
4004 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
4005 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
4006 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
4007 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
4008 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
4009 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
4010 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
4011 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
4012 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
4014 #define SE_GROUP_MANDATORY 0x00000001
4015 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4016 #define SE_GROUP_ENABLED 0x00000004
4017 #define SE_GROUP_OWNER 0x00000008
4018 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4019 #define SE_GROUP_LOGON_ID 0xC0000000
4020 #define SE_GROUP_RESOURCE 0x20000000
4022 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4023 #define SE_PRIVILEGE_ENABLED 0x00000002
4024 #define SE_PRIVILEGE_REMOVE 0x00000004
4025 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4027 #define PRIVILEGE_SET_ALL_NECESSARY 1
4029 #define SE_OWNER_DEFAULTED 0x00000001
4030 #define SE_GROUP_DEFAULTED 0x00000002
4031 #define SE_DACL_PRESENT 0x00000004
4032 #define SE_DACL_DEFAULTED 0x00000008
4033 #define SE_SACL_PRESENT 0x00000010
4034 #define SE_SACL_DEFAULTED 0x00000020
4035 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4036 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4037 #define SE_DACL_AUTO_INHERITED 0x00000400
4038 #define SE_SACL_AUTO_INHERITED 0x00000800
4039 #define SE_DACL_PROTECTED 0x00001000
4040 #define SE_SACL_PROTECTED 0x00002000
4041 #define SE_RM_CONTROL_VALID 0x00004000
4042 #define SE_SELF_RELATIVE 0x00008000
4044 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
4045 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
4047 /* The security descriptor structure */
4048 typedef struct {
4049 BYTE Revision;
4050 BYTE Sbz1;
4051 SECURITY_DESCRIPTOR_CONTROL Control;
4052 DWORD Owner;
4053 DWORD Group;
4054 DWORD Sacl;
4055 DWORD Dacl;
4056 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
4058 typedef struct {
4059 BYTE Revision;
4060 BYTE Sbz1;
4061 SECURITY_DESCRIPTOR_CONTROL Control;
4062 PSID Owner;
4063 PSID Group;
4064 PACL Sacl;
4065 PACL Dacl;
4066 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
4068 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4070 #endif /* _SECURITY_DEFINED */
4073 * SID_AND_ATTRIBUTES
4076 typedef struct _SID_AND_ATTRIBUTES {
4077 PSID Sid;
4078 DWORD Attributes;
4079 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
4081 /* security entities */
4082 #define SECURITY_NULL_RID (0x00000000L)
4083 #define SECURITY_WORLD_RID (0x00000000L)
4084 #define SECURITY_LOCAL_RID (0X00000000L)
4086 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4088 /* S-1-1 */
4089 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4091 /* S-1-2 */
4092 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4094 /* S-1-3 */
4095 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4096 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
4097 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
4098 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
4099 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
4101 /* S-1-4 */
4102 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4104 /* S-1-5 */
4105 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4106 #define SECURITY_DIALUP_RID 0x00000001L
4107 #define SECURITY_NETWORK_RID 0x00000002L
4108 #define SECURITY_BATCH_RID 0x00000003L
4109 #define SECURITY_INTERACTIVE_RID 0x00000004L
4110 #define SECURITY_LOGON_IDS_RID 0x00000005L
4111 #define SECURITY_SERVICE_RID 0x00000006L
4112 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
4113 #define SECURITY_PROXY_RID 0x00000008L
4114 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
4115 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4116 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
4117 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
4118 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
4119 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
4120 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
4121 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
4122 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
4123 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
4124 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
4125 #define SECURITY_NT_NON_UNIQUE 0x00000015L
4126 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
4128 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
4129 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
4130 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
4131 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
4132 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
4133 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
4134 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
4136 #define FOREST_USER_RID_MAX 0x000001F3L
4137 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
4138 #define DOMAIN_USER_RID_GUEST 0x000001F5L
4139 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
4140 #define DOMAIN_USER_RID_MAX 0x000003E7L
4142 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
4143 #define DOMAIN_GROUP_RID_USERS 0x00000201L
4144 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
4145 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
4146 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
4147 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
4148 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
4149 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
4150 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
4152 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4153 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
4154 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
4155 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
4156 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
4157 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
4158 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
4160 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
4161 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
4162 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
4163 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
4165 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
4166 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
4167 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
4168 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
4170 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
4171 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
4172 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
4173 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
4174 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
4175 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
4177 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
4178 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
4179 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
4180 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
4181 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
4183 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4185 #define SECURITY_PACKAGE_RID_COUNT 2L
4186 #define SECURITY_LOGON_IDS_RID_COUNT 3L
4188 typedef enum {
4189 WinNullSid = 0,
4190 WinWorldSid = 1,
4191 WinLocalSid = 2,
4192 WinCreatorOwnerSid = 3,
4193 WinCreatorGroupSid = 4,
4194 WinCreatorOwnerServerSid = 5,
4195 WinCreatorGroupServerSid = 6,
4196 WinNtAuthoritySid = 7,
4197 WinDialupSid = 8,
4198 WinNetworkSid = 9,
4199 WinBatchSid = 10,
4200 WinInteractiveSid = 11,
4201 WinServiceSid = 12,
4202 WinAnonymousSid = 13,
4203 WinProxySid = 14,
4204 WinEnterpriseControllersSid = 15,
4205 WinSelfSid = 16,
4206 WinAuthenticatedUserSid = 17,
4207 WinRestrictedCodeSid = 18,
4208 WinTerminalServerSid = 19,
4209 WinRemoteLogonIdSid = 20,
4210 WinLogonIdsSid = 21,
4211 WinLocalSystemSid = 22,
4212 WinLocalServiceSid = 23,
4213 WinNetworkServiceSid = 24,
4214 WinBuiltinDomainSid = 25,
4215 WinBuiltinAdministratorsSid = 26,
4216 WinBuiltinUsersSid = 27,
4217 WinBuiltinGuestsSid = 28,
4218 WinBuiltinPowerUsersSid = 29,
4219 WinBuiltinAccountOperatorsSid = 30,
4220 WinBuiltinSystemOperatorsSid = 31,
4221 WinBuiltinPrintOperatorsSid = 32,
4222 WinBuiltinBackupOperatorsSid = 33,
4223 WinBuiltinReplicatorSid = 34,
4224 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
4225 WinBuiltinRemoteDesktopUsersSid = 36,
4226 WinBuiltinNetworkConfigurationOperatorsSid = 37,
4227 WinAccountAdministratorSid = 38,
4228 WinAccountGuestSid = 39,
4229 WinAccountKrbtgtSid = 40,
4230 WinAccountDomainAdminsSid = 41,
4231 WinAccountDomainUsersSid = 42,
4232 WinAccountDomainGuestsSid = 43,
4233 WinAccountComputersSid = 44,
4234 WinAccountControllersSid = 45,
4235 WinAccountCertAdminsSid = 46,
4236 WinAccountSchemaAdminsSid = 47,
4237 WinAccountEnterpriseAdminsSid = 48,
4238 WinAccountPolicyAdminsSid = 49,
4239 WinAccountRasAndIasServersSid = 50,
4240 WinNTLMAuthenticationSid = 51,
4241 WinDigestAuthenticationSid = 52,
4242 WinSChannelAuthenticationSid = 53,
4243 WinThisOrganizationSid = 54,
4244 WinOtherOrganizationSid = 55,
4245 WinBuiltinIncomingForestTrustBuildersSid = 56,
4246 WinBuiltinPerfMonitoringUsersSid = 57,
4247 WinBuiltinPerfLoggingUsersSid = 58,
4248 WinBuiltinAuthorizationAccessSid = 59,
4249 WinBuiltinTerminalServerLicenseServersSid = 60,
4250 WinBuiltinDCOMUsersSid = 61,
4251 WinBuiltinIUsersSid = 62,
4252 WinIUserSid = 63,
4253 WinBuiltinCryptoOperatorsSid = 64,
4254 WinUntrustedLabelSid = 65,
4255 WinLowLabelSid = 66,
4256 WinMediumLabelSid = 67,
4257 WinHighLabelSid = 68,
4258 WinSystemLabelSid = 69,
4259 WinWriteRestrictedCodeSid = 70,
4260 WinCreatorOwnerRightsSid = 71,
4261 WinCacheablePrincipalsGroupSid = 72,
4262 WinNonCacheablePrincipalsGroupSid = 73,
4263 WinEnterpriseReadonlyControllersSid = 74,
4264 WinAccountReadonlyControllersSid = 75,
4265 WinBuiltinEventLogReadersGroup = 76,
4266 WinNewEnterpriseReadonlyControllersSid = 77,
4267 WinBuiltinCertSvcDComAccessGroup = 78,
4268 WinMediumPlusLabelSid = 79,
4269 WinLocalLogonSid = 80,
4270 WinConsoleLogonSid = 81,
4271 WinThisOrganizationCertificateSid = 82,
4272 } WELL_KNOWN_SID_TYPE;
4275 * TOKEN_USER
4278 typedef struct _TOKEN_USER {
4279 SID_AND_ATTRIBUTES User;
4280 } TOKEN_USER, *PTOKEN_USER;
4283 * TOKEN_GROUPS
4286 typedef struct _TOKEN_GROUPS {
4287 DWORD GroupCount;
4288 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
4289 } TOKEN_GROUPS, *PTOKEN_GROUPS;
4292 * LUID_AND_ATTRIBUTES
4295 typedef union _LARGE_INTEGER {
4296 struct {
4297 #ifdef WORDS_BIGENDIAN
4298 LONG HighPart;
4299 DWORD LowPart;
4300 #else
4301 DWORD LowPart;
4302 LONG HighPart;
4303 #endif
4304 } u;
4305 #ifndef NONAMELESSSTRUCT
4306 struct {
4307 #ifdef WORDS_BIGENDIAN
4308 LONG HighPart;
4309 DWORD LowPart;
4310 #else
4311 DWORD LowPart;
4312 LONG HighPart;
4313 #endif
4315 #endif
4316 LONGLONG QuadPart;
4317 } LARGE_INTEGER, *PLARGE_INTEGER;
4319 typedef union _ULARGE_INTEGER {
4320 struct {
4321 #ifdef WORDS_BIGENDIAN
4322 DWORD HighPart;
4323 DWORD LowPart;
4324 #else
4325 DWORD LowPart;
4326 DWORD HighPart;
4327 #endif
4328 } u;
4329 #ifndef NONAMELESSSTRUCT
4330 struct {
4331 #ifdef WORDS_BIGENDIAN
4332 DWORD HighPart;
4333 DWORD LowPart;
4334 #else
4335 DWORD LowPart;
4336 DWORD HighPart;
4337 #endif
4339 #endif
4340 ULONGLONG QuadPart;
4341 } ULARGE_INTEGER, *PULARGE_INTEGER;
4344 * Locally Unique Identifier
4347 typedef struct _LUID {
4348 DWORD LowPart;
4349 LONG HighPart;
4350 } LUID, *PLUID;
4352 #include <pshpack4.h>
4353 typedef struct _LUID_AND_ATTRIBUTES {
4354 LUID Luid;
4355 DWORD Attributes;
4356 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
4357 #include <poppack.h>
4360 * PRIVILEGE_SET
4363 typedef struct _PRIVILEGE_SET {
4364 DWORD PrivilegeCount;
4365 DWORD Control;
4366 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
4367 } PRIVILEGE_SET, *PPRIVILEGE_SET;
4370 * TOKEN_PRIVILEGES
4373 typedef struct _TOKEN_PRIVILEGES {
4374 DWORD PrivilegeCount;
4375 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
4376 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
4379 * TOKEN_OWNER
4382 typedef struct _TOKEN_OWNER {
4383 PSID Owner;
4384 } TOKEN_OWNER, *PTOKEN_OWNER;
4387 * TOKEN_PRIMARY_GROUP
4390 typedef struct _TOKEN_PRIMARY_GROUP {
4391 PSID PrimaryGroup;
4392 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
4396 * TOKEN_DEFAULT_DACL
4399 typedef struct _TOKEN_DEFAULT_DACL {
4400 PACL DefaultDacl;
4401 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
4404 * TOKEN_SOURCE
4407 #define TOKEN_SOURCE_LENGTH 8
4409 typedef struct _TOKEN_SOURCE {
4410 char SourceName[TOKEN_SOURCE_LENGTH];
4411 LUID SourceIdentifier;
4412 } TOKEN_SOURCE, *PTOKEN_SOURCE;
4415 * TOKEN_TYPE
4418 typedef enum tagTOKEN_TYPE {
4419 TokenPrimary = 1,
4420 TokenImpersonation
4421 } TOKEN_TYPE;
4424 * SECURITY_IMPERSONATION_LEVEL
4427 typedef enum _SECURITY_IMPERSONATION_LEVEL {
4428 SecurityAnonymous,
4429 SecurityIdentification,
4430 SecurityImpersonation,
4431 SecurityDelegation
4432 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
4434 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4435 #define SECURITY_STATIC_TRACKING (FALSE)
4437 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
4438 * PSECURITY_CONTEXT_TRACKING_MODE;
4440 * Quality of Service
4443 typedef struct _SECURITY_QUALITY_OF_SERVICE {
4444 DWORD Length;
4445 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4446 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
4447 BOOLEAN EffectiveOnly;
4448 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
4451 * TOKEN_STATISTICS
4454 #include <pshpack4.h>
4455 typedef struct _TOKEN_STATISTICS {
4456 LUID TokenId;
4457 LUID AuthenticationId;
4458 LARGE_INTEGER ExpirationTime;
4459 TOKEN_TYPE TokenType;
4460 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4461 DWORD DynamicCharged;
4462 DWORD DynamicAvailable;
4463 DWORD GroupCount;
4464 DWORD PrivilegeCount;
4465 LUID ModifiedId;
4466 } TOKEN_STATISTICS;
4467 #include <poppack.h>
4469 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
4470 DWORD SidCount;
4471 DWORD SidLength;
4472 PSID_AND_ATTRIBUTES Sids;
4473 DWORD RestrictedSidCount;
4474 DWORD RestrictedSidLength;
4475 PSID_AND_ATTRIBUTES RestrictedSids;
4476 DWORD PrivilegeCount;
4477 DWORD PrivilegeLength;
4478 PLUID_AND_ATTRIBUTES Privileges;
4479 LUID AuthenticationId;
4480 } TOKEN_GROUPS_AND_PRIVILEGES, * PTOKEN_GROUPS_AND_PRIVILEGES;
4482 typedef struct _TOKEN_ORIGIN {
4483 LUID OriginatingLogonSession;
4484 } TOKEN_ORIGIN, * PTOKEN_ORIGIN;
4486 typedef struct _TOKEN_LINKED_TOKEN {
4487 HANDLE LinkedToken;
4488 } TOKEN_LINKED_TOKEN, * PTOKEN_LINKED_TOKEN;
4490 typedef struct _TOKEN_ELEVATION {
4491 DWORD TokenIsElevated;
4492 } TOKEN_ELEVATION, * PTOKEN_ELEVATION;
4496 * ACLs of NT
4499 /* ACEs, directly starting after an ACL */
4500 typedef struct _ACE_HEADER {
4501 BYTE AceType;
4502 BYTE AceFlags;
4503 WORD AceSize;
4504 } ACE_HEADER,*PACE_HEADER;
4506 /* AceType */
4507 #define ACCESS_ALLOWED_ACE_TYPE 0
4508 #define ACCESS_DENIED_ACE_TYPE 1
4509 #define SYSTEM_AUDIT_ACE_TYPE 2
4510 #define SYSTEM_ALARM_ACE_TYPE 3
4512 /* inherit AceFlags */
4513 #define OBJECT_INHERIT_ACE 0x01
4514 #define CONTAINER_INHERIT_ACE 0x02
4515 #define NO_PROPAGATE_INHERIT_ACE 0x04
4516 #define INHERIT_ONLY_ACE 0x08
4517 #define INHERITED_ACE 0x10
4518 #define VALID_INHERIT_FLAGS 0x1F
4520 /* AceFlags mask for what events we (should) audit */
4521 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4522 #define FAILED_ACCESS_ACE_FLAG 0x80
4524 /* different ACEs depending on AceType
4525 * SidStart marks the begin of a SID
4526 * so the thing finally looks like this:
4527 * 0: ACE_HEADER
4528 * 4: ACCESS_MASK
4529 * 8... : SID
4531 typedef struct _ACCESS_ALLOWED_ACE {
4532 ACE_HEADER Header;
4533 DWORD Mask;
4534 DWORD SidStart;
4535 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
4537 typedef struct _ACCESS_DENIED_ACE {
4538 ACE_HEADER Header;
4539 DWORD Mask;
4540 DWORD SidStart;
4541 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
4543 typedef struct _SYSTEM_AUDIT_ACE {
4544 ACE_HEADER Header;
4545 DWORD Mask;
4546 DWORD SidStart;
4547 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
4549 typedef struct _SYSTEM_ALARM_ACE {
4550 ACE_HEADER Header;
4551 DWORD Mask;
4552 DWORD SidStart;
4553 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
4555 typedef enum tagSID_NAME_USE {
4556 SidTypeUser = 1,
4557 SidTypeGroup,
4558 SidTypeDomain,
4559 SidTypeAlias,
4560 SidTypeWellKnownGroup,
4561 SidTypeDeletedAccount,
4562 SidTypeInvalid,
4563 SidTypeUnknown
4564 } SID_NAME_USE,*PSID_NAME_USE;
4566 #define ACE_OBJECT_TYPE_PRESENT 0x1
4567 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4569 /* Access rights */
4571 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4572 #undef DELETE
4573 #define DELETE 0x00010000
4574 #define READ_CONTROL 0x00020000
4575 #define WRITE_DAC 0x00040000
4576 #define WRITE_OWNER 0x00080000
4577 #define SYNCHRONIZE 0x00100000
4578 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4580 #define STANDARD_RIGHTS_READ READ_CONTROL
4581 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4582 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4584 #define STANDARD_RIGHTS_ALL 0x001f0000
4586 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4588 #define GENERIC_READ 0x80000000
4589 #define GENERIC_WRITE 0x40000000
4590 #define GENERIC_EXECUTE 0x20000000
4591 #define GENERIC_ALL 0x10000000
4593 #define MAXIMUM_ALLOWED 0x02000000
4594 #define ACCESS_SYSTEM_SECURITY 0x01000000
4596 #define EVENT_QUERY_STATE 0x0001
4597 #define EVENT_MODIFY_STATE 0x0002
4598 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4600 #define SEMAPHORE_MODIFY_STATE 0x0002
4601 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4603 #define MUTEX_MODIFY_STATE 0x0001
4604 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4606 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4607 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4608 #define JOB_OBJECT_QUERY 0x0004
4609 #define JOB_OBJECT_TERMINATE 0x0008
4610 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4611 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4613 #define TIMER_QUERY_STATE 0x0001
4614 #define TIMER_MODIFY_STATE 0x0002
4615 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4617 #define PROCESS_TERMINATE 0x0001
4618 #define PROCESS_CREATE_THREAD 0x0002
4619 #define PROCESS_VM_OPERATION 0x0008
4620 #define PROCESS_VM_READ 0x0010
4621 #define PROCESS_VM_WRITE 0x0020
4622 #define PROCESS_DUP_HANDLE 0x0040
4623 #define PROCESS_CREATE_PROCESS 0x0080
4624 #define PROCESS_SET_QUOTA 0x0100
4625 #define PROCESS_SET_INFORMATION 0x0200
4626 #define PROCESS_QUERY_INFORMATION 0x0400
4627 #define PROCESS_SUSPEND_RESUME 0x0800
4628 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4629 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4631 #define THREAD_TERMINATE 0x0001
4632 #define THREAD_SUSPEND_RESUME 0x0002
4633 #define THREAD_GET_CONTEXT 0x0008
4634 #define THREAD_SET_CONTEXT 0x0010
4635 #define THREAD_SET_INFORMATION 0x0020
4636 #define THREAD_QUERY_INFORMATION 0x0040
4637 #define THREAD_SET_THREAD_TOKEN 0x0080
4638 #define THREAD_IMPERSONATE 0x0100
4639 #define THREAD_DIRECT_IMPERSONATION 0x0200
4640 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4642 #define THREAD_BASE_PRIORITY_LOWRT 15
4643 #define THREAD_BASE_PRIORITY_MAX 2
4644 #define THREAD_BASE_PRIORITY_MIN -2
4645 #define THREAD_BASE_PRIORITY_IDLE -15
4647 typedef struct _QUOTA_LIMITS {
4648 SIZE_T PagedPoolLimit;
4649 SIZE_T NonPagedPoolLimit;
4650 SIZE_T MinimumWorkingSetSize;
4651 SIZE_T MaximumWorkingSetSize;
4652 SIZE_T PagefileLimit;
4653 LARGE_INTEGER TimeLimit;
4654 } QUOTA_LIMITS, *PQUOTA_LIMITS;
4656 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4657 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4658 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4659 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4661 typedef struct _QUOTA_LIMITS_EX {
4662 SIZE_T PagedPoolLimit;
4663 SIZE_T NonPagedPoolLimit;
4664 SIZE_T MinimumWorkingSetSize;
4665 SIZE_T MaximumWorkingSetSize;
4666 SIZE_T PagefileLimit;
4667 LARGE_INTEGER TimeLimit;
4668 SIZE_T Reserved1;
4669 SIZE_T Reserved2;
4670 SIZE_T Reserved3;
4671 SIZE_T Reserved4;
4672 DWORD Flags;
4673 DWORD Reserved5;
4674 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
4676 #define SECTION_QUERY 0x0001
4677 #define SECTION_MAP_WRITE 0x0002
4678 #define SECTION_MAP_READ 0x0004
4679 #define SECTION_MAP_EXECUTE 0x0008
4680 #define SECTION_EXTEND_SIZE 0x0010
4681 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4682 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4684 #define FILE_READ_DATA 0x0001 /* file & pipe */
4685 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4686 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4687 #define FILE_ADD_FILE 0x0002 /* directory */
4688 #define FILE_APPEND_DATA 0x0004 /* file */
4689 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4690 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4691 #define FILE_READ_EA 0x0008 /* file & directory */
4692 #define FILE_READ_PROPERTIES FILE_READ_EA
4693 #define FILE_WRITE_EA 0x0010 /* file & directory */
4694 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4695 #define FILE_EXECUTE 0x0020 /* file */
4696 #define FILE_TRAVERSE 0x0020 /* directory */
4697 #define FILE_DELETE_CHILD 0x0040 /* directory */
4698 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4699 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4700 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4702 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4703 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4704 SYNCHRONIZE)
4705 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4706 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4707 FILE_APPEND_DATA | SYNCHRONIZE)
4708 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4709 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4711 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4712 #define DUPLICATE_SAME_ACCESS 0x00000002
4714 /* File attribute flags */
4715 #define FILE_SHARE_READ 0x00000001L
4716 #define FILE_SHARE_WRITE 0x00000002L
4717 #define FILE_SHARE_DELETE 0x00000004L
4719 #define FILE_ATTRIBUTE_READONLY 0x00000001
4720 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4721 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4722 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4723 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4724 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4725 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4726 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4727 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4728 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4729 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4730 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4731 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4732 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4734 /* File notification flags */
4735 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4736 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4737 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4738 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4739 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4740 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4741 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4742 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4743 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4744 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4745 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4746 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4748 #define FILE_ACTION_ADDED 0x00000001
4749 #define FILE_ACTION_REMOVED 0x00000002
4750 #define FILE_ACTION_MODIFIED 0x00000003
4751 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4752 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4753 #define FILE_ACTION_ADDED_STREAM 0x00000006
4754 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4755 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4757 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4758 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4759 #define FILE_UNICODE_ON_DISK 0x00000004
4760 #define FILE_PERSISTENT_ACLS 0x00000008
4761 #define FILE_FILE_COMPRESSION 0x00000010
4762 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4763 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4764 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4765 #define FILE_NAMED_STREAMS 0x00040000
4766 #define FILE_READ_ONLY_VOLUME 0x00080000
4768 /* File alignments (NT) */
4769 #define FILE_BYTE_ALIGNMENT 0x00000000
4770 #define FILE_WORD_ALIGNMENT 0x00000001
4771 #define FILE_LONG_ALIGNMENT 0x00000003
4772 #define FILE_QUAD_ALIGNMENT 0x00000007
4773 #define FILE_OCTA_ALIGNMENT 0x0000000f
4774 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4775 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4776 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4777 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4778 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4780 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4781 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4783 #define REG_NONE 0 /* no type */
4784 #define REG_SZ 1 /* string type (ASCII) */
4785 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4786 #define REG_BINARY 3 /* binary format, callerspecific */
4787 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4788 #define REG_DWORD 4 /* DWORD in little endian format */
4789 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4790 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4791 #define REG_LINK 6 /* symbolic link (UNICODE) */
4792 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4793 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4794 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4795 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4796 #define REG_QWORD 11 /* QWORD in little endian format */
4797 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4799 /* ----------------------------- begin power management --------------------- */
4801 typedef enum _LATENCY_TIME {
4802 LT_DONT_CARE,
4803 LT_LOWEST_LATENCY
4804 } LATENCY_TIME, *PLATENCY_TIME;
4806 #define DISCHARGE_POLICY_CRITICAL 0
4807 #define DISCHARGE_POLICY_LOW 1
4808 #define NUM_DISCHARGE_POLICIES 4
4810 #define PO_THROTTLE_NONE 0
4811 #define PO_THROTTLE_CONSTANT 1
4812 #define PO_THROTTLE_DEGRADE 2
4813 #define PO_THROTTLE_ADAPTIVE 3
4815 typedef enum _POWER_ACTION {
4816 PowerActionNone = 0,
4817 PowerActionReserved,
4818 PowerActionSleep,
4819 PowerActionHibernate,
4820 PowerActionShutdown,
4821 PowerActionShutdownReset,
4822 PowerActionShutdownOff,
4823 PowerActionWarmEject
4824 } POWER_ACTION,
4825 *PPOWER_ACTION;
4827 typedef enum _SYSTEM_POWER_STATE {
4828 PowerSystemUnspecified = 0,
4829 PowerSystemWorking = 1,
4830 PowerSystemSleeping1 = 2,
4831 PowerSystemSleeping2 = 3,
4832 PowerSystemSleeping3 = 4,
4833 PowerSystemHibernate = 5,
4834 PowerSystemShutdown = 6,
4835 PowerSystemMaximum = 7
4836 } SYSTEM_POWER_STATE,
4837 *PSYSTEM_POWER_STATE;
4839 typedef enum _DEVICE_POWER_STATE {
4840 PowerDeviceUnspecified,
4841 PowerDeviceD0,
4842 PowerDeviceD1,
4843 PowerDeviceD2,
4844 PowerDeviceD3,
4845 PowerDeviceMaximum
4846 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
4848 typedef enum _POWER_INFORMATION_LEVEL {
4849 SystemPowerPolicyAc,
4850 SystemPowerPolicyDc,
4851 VerifySystemPolicyAc,
4852 VerifySystemPolicyDc,
4853 SystemPowerCapabilities,
4854 SystemBatteryState,
4855 SystemPowerStateHandler,
4856 ProcessorStateHandler,
4857 SystemPowerPolicyCurrent,
4858 AdministratorPowerPolicy,
4859 SystemReserveHiberFile,
4860 ProcessorInformation,
4861 SystemPowerInformation,
4862 ProcessorStateHandler2,
4863 LastWakeTime,
4864 LastSleepTime,
4865 SystemExecutionState,
4866 SystemPowerStateNotifyHandler,
4867 ProcessorPowerPolicyAc,
4868 ProcessorPowerPolicyDc,
4869 VerifyProcessorPowerPolicyAc,
4870 VerifyProcessorPowerPolicyDc,
4871 ProcessorPowerPolicyCurrent
4872 } POWER_INFORMATION_LEVEL;
4874 typedef struct _ADMINISTRATOR_POWER_POLICY {
4875 SYSTEM_POWER_STATE MinSleep;
4876 SYSTEM_POWER_STATE MaxSleep;
4877 ULONG MinVideoTimeout;
4878 ULONG MaxVideoTimeout;
4879 ULONG MinSpindownTimeout;
4880 ULONG MaxSpindownTimeout;
4881 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
4883 typedef struct {
4884 ULONG Granularity;
4885 ULONG Capacity;
4886 } BATTERY_REPORTING_SCALE,
4887 *PBATTERY_REPORTING_SCALE;
4889 typedef struct {
4890 POWER_ACTION Action;
4891 ULONG Flags;
4892 ULONG EventCode;
4893 } POWER_ACTION_POLICY,
4894 *PPOWER_ACTION_POLICY;
4896 typedef struct _PROCESSOR_POWER_INFORMATION {
4897 ULONG Number;
4898 ULONG MaxMhz;
4899 ULONG CurrentMhz;
4900 ULONG MhzLimit;
4901 ULONG MaxIdleState;
4902 ULONG CurrentIdleState;
4903 } PROCESSOR_POWER_INFORMATION,
4904 *PPROCESSOR_POWER_INFORMATION;
4906 typedef struct _PROCESSOR_POWER_POLICY_INFO {
4907 ULONG TimeCheck;
4908 ULONG DemoteLimit;
4909 ULONG PromoteLimit;
4910 UCHAR DemotePercent;
4911 UCHAR PromotePercent;
4912 UCHAR Spare[2];
4913 ULONG AllowDemotion:1;
4914 ULONG AllowPromotion:1;
4915 ULONG Reserved:30;
4916 } PROCESSOR_POWER_POLICY_INFO,
4917 *PPROCESSOR_POWER_POLICY_INFO;
4919 typedef struct _PROCESSOR_POWER_POLICY {
4920 DWORD Revision;
4921 BYTE DynamicThrottle;
4922 BYTE Spare[3];
4923 DWORD DisableCStates:1;
4924 DWORD Reserved:31;
4925 DWORD PolicyCount;
4926 PROCESSOR_POWER_POLICY_INFO Policy[3];
4927 } PROCESSOR_POWER_POLICY,
4928 *PPROCESSOR_POWER_POLICY;
4930 typedef struct {
4931 BOOLEAN AcOnLine;
4932 BOOLEAN BatteryPresent;
4933 BOOLEAN Charging;
4934 BOOLEAN Discharging;
4935 BOOLEAN Spare1[4];
4936 ULONG MaxCapacity;
4937 ULONG RemainingCapacity;
4938 ULONG Rate;
4939 ULONG EstimatedTime;
4940 ULONG DefaultAlert1;
4941 ULONG DefaultAlert2;
4942 } SYSTEM_BATTERY_STATE,
4943 *PSYSTEM_BATTERY_STATE;
4945 typedef struct {
4946 BOOLEAN PowerButtonPresent;
4947 BOOLEAN SleepButtonPresent;
4948 BOOLEAN LidPresent;
4949 BOOLEAN SystemS1;
4950 BOOLEAN SystemS2;
4951 BOOLEAN SystemS3;
4952 BOOLEAN SystemS4;
4953 BOOLEAN SystemS5;
4954 BOOLEAN HiberFilePresent;
4955 BOOLEAN FullWake;
4956 BOOLEAN VideoDimPresent;
4957 BOOLEAN ApmPresent;
4958 BOOLEAN UpsPresent;
4959 BOOLEAN ThermalControl;
4960 BOOLEAN ProcessorThrottle;
4961 UCHAR ProcessorMinThrottle;
4962 UCHAR ProcessorMaxThrottle;
4963 UCHAR spare2[4];
4964 BOOLEAN DiskSpinDown;
4965 UCHAR spare3[8];
4966 BOOLEAN SystemBatteriesPresent;
4967 BOOLEAN BatteriesAreShortTerm;
4968 BATTERY_REPORTING_SCALE BatteryScale[3];
4969 SYSTEM_POWER_STATE AcOnLineWake;
4970 SYSTEM_POWER_STATE SoftLidWake;
4971 SYSTEM_POWER_STATE RtcWake;
4972 SYSTEM_POWER_STATE MinDeviceWakeState;
4973 SYSTEM_POWER_STATE DefaultLowLatencyWake;
4974 } SYSTEM_POWER_CAPABILITIES,
4975 *PSYSTEM_POWER_CAPABILITIES;
4977 typedef struct _SYSTEM_POWER_INFORMATION {
4978 ULONG MaxIdlenessAllowed;
4979 ULONG Idleness;
4980 ULONG TimeRemaining;
4981 UCHAR CoolingMode;
4982 } SYSTEM_POWER_INFORMATION,
4983 *PSYSTEM_POWER_INFORMATION;
4985 typedef struct _SYSTEM_POWER_LEVEL {
4986 BOOLEAN Enable;
4987 UCHAR Spare[3];
4988 ULONG BatteryLevel;
4989 POWER_ACTION_POLICY PowerPolicy;
4990 SYSTEM_POWER_STATE MinSystemState;
4991 } SYSTEM_POWER_LEVEL,
4992 *PSYSTEM_POWER_LEVEL;
4994 typedef struct _SYSTEM_POWER_POLICY {
4995 ULONG Revision;
4996 POWER_ACTION_POLICY PowerButton;
4997 POWER_ACTION_POLICY SleepButton;
4998 POWER_ACTION_POLICY LidClose;
4999 SYSTEM_POWER_STATE LidOpenWake;
5000 ULONG Reserved;
5001 POWER_ACTION_POLICY Idle;
5002 ULONG IdleTimeout;
5003 UCHAR IdleSensitivity;
5004 UCHAR DynamicThrottle;
5005 UCHAR Spare2[2];
5006 SYSTEM_POWER_STATE MinSleep;
5007 SYSTEM_POWER_STATE MaxSleep;
5008 SYSTEM_POWER_STATE ReducedLatencySleep;
5009 ULONG WinLogonFlags;
5010 ULONG Spare3;
5011 ULONG DozeS4Timeout;
5012 ULONG BroadcastCapacityResolution;
5013 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
5014 ULONG VideoTimeout;
5015 BOOLEAN VideoDimDisplay;
5016 ULONG VideoReserved[3];
5017 ULONG SpindownTimeout;
5018 BOOLEAN OptimizeForPower;
5019 UCHAR FanThrottleTolerance;
5020 UCHAR ForcedThrottle;
5021 UCHAR MinThrottle;
5022 POWER_ACTION_POLICY OverThrottled;
5023 } SYSTEM_POWER_POLICY,
5024 *PSYSTEM_POWER_POLICY;
5026 typedef union _FILE_SEGMENT_ELEMENT {
5027 PVOID64 Buffer;
5028 ULONGLONG Alignment;
5029 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
5031 typedef struct _FILE_NOTIFY_INFORMATION {
5032 DWORD NextEntryOffset;
5033 DWORD Action;
5034 DWORD FileNameLength;
5035 WCHAR FileName[1];
5036 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
5038 /* ----------------------------- begin tape storage --------------------- */
5040 #define TAPE_FIXED_PARTITIONS 0
5041 #define TAPE_SELECT_PARTITIONS 1
5042 #define TAPE_INITIATOR_PARTITIONS 2
5043 #define TAPE_ERASE_SHORT 0
5044 #define TAPE_ERASE_LONG 1
5045 #define TAPE_LOAD 0
5046 #define TAPE_UNLOAD 1
5047 #define TAPE_TENSION 2
5048 #define TAPE_LOCK 3
5049 #define TAPE_UNLOCK 4
5050 #define TAPE_FORMAT 5
5051 #define TAPE_SETMARKS 0
5052 #define TAPE_FILEMARKS 1
5053 #define TAPE_SHORT_FILEMARKS 2
5054 #define TAPE_LONG_FILEMARKS 3
5055 #define TAPE_REWIND 0
5056 #define TAPE_ABSOLUTE_BLOCK 1
5057 #define TAPE_LOGICAL_BLOCK 2
5058 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5059 #define TAPE_SPACE_END_OF_DATA 4
5060 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5061 #define TAPE_SPACE_FILEMARKS 6
5062 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5063 #define TAPE_SPACE_SETMARKS 8
5064 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5066 typedef struct _TAPE_CREATE_PARTITION {
5067 DWORD Method;
5068 DWORD Count;
5069 DWORD Size;
5070 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
5072 typedef struct _TAPE_ERASE {
5073 DWORD Type;
5074 BOOLEAN Immediate;
5075 } TAPE_ERASE, *PTAPE_ERASE;
5077 typedef struct _TAPE_PREPARE {
5078 DWORD Operation;
5079 BOOLEAN Immediate;
5080 } TAPE_PREPARE, *PTAPE_PREPARE;
5082 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
5083 BOOLEAN ECC;
5084 BOOLEAN Compression;
5085 BOOLEAN DataPadding;
5086 BOOLEAN ReportSetmarks;
5087 ULONG EOTWarningZoneSize;
5088 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
5090 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
5091 ULONG BlockSize;
5092 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
5094 typedef struct _TAPE_WRITE_MARKS {
5095 DWORD Type;
5096 DWORD Count;
5097 BOOLEAN Immediate;
5098 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
5100 typedef struct _TAPE_GET_POSITION {
5101 ULONG Type;
5102 ULONG Partition;
5103 ULONG OffsetLow;
5104 ULONG OffsetHigh;
5105 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
5107 typedef struct _TAPE_SET_POSITION {
5108 ULONG Method;
5109 ULONG Partition;
5110 LARGE_INTEGER Offset;
5111 BOOLEAN Immediate;
5112 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
5114 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
5115 BOOLEAN ECC;
5116 BOOLEAN Compression;
5117 BOOLEAN DataPadding;
5118 BOOLEAN ReportSetmarks;
5119 DWORD DefaultBlockSize;
5120 DWORD MaximumBlockSize;
5121 DWORD MinimumBlockSize;
5122 DWORD MaximumPartitionCount;
5123 DWORD FeaturesLow;
5124 DWORD FeaturesHigh;
5125 DWORD EOTWarningZoneSize;
5126 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
5128 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
5129 LARGE_INTEGER Capacity;
5130 LARGE_INTEGER Remaining;
5131 DWORD BlockSize;
5132 DWORD PartitionCount;
5133 BOOLEAN WriteProtected;
5134 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
5136 /* ----------------------------- begin registry ----------------------------- */
5138 /* Registry security values */
5139 #define OWNER_SECURITY_INFORMATION 0x00000001
5140 #define GROUP_SECURITY_INFORMATION 0x00000002
5141 #define DACL_SECURITY_INFORMATION 0x00000004
5142 #define SACL_SECURITY_INFORMATION 0x00000008
5144 #define REG_OPTION_RESERVED 0x00000000
5145 #define REG_OPTION_NON_VOLATILE 0x00000000
5146 #define REG_OPTION_VOLATILE 0x00000001
5147 #define REG_OPTION_CREATE_LINK 0x00000002
5148 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5149 #define REG_OPTION_OPEN_LINK 0x00000008
5150 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
5151 REG_OPTION_NON_VOLATILE| \
5152 REG_OPTION_VOLATILE| \
5153 REG_OPTION_CREATE_LINK| \
5154 REG_OPTION_BACKUP_RESTORE| \
5155 REG_OPTION_OPEN_LINK)
5158 #define REG_CREATED_NEW_KEY 0x00000001
5159 #define REG_OPENED_EXISTING_KEY 0x00000002
5161 /* For RegNotifyChangeKeyValue */
5162 #define REG_NOTIFY_CHANGE_NAME 0x01
5163 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5164 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5165 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5167 #define KEY_QUERY_VALUE 0x00000001
5168 #define KEY_SET_VALUE 0x00000002
5169 #define KEY_CREATE_SUB_KEY 0x00000004
5170 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5171 #define KEY_NOTIFY 0x00000010
5172 #define KEY_CREATE_LINK 0x00000020
5173 #define KEY_WOW64_64KEY 0x00000100
5174 #define KEY_WOW64_32KEY 0x00000200
5175 #define KEY_WOW64_RES 0x00000300
5177 /* for RegKeyRestore flags */
5178 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5179 #define REG_REFRESH_HIVE 0x00000002
5180 #define REG_NO_LAZY_FLUSH 0x00000004
5181 #define REG_FORCE_RESTORE 0x00000008
5183 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5184 KEY_QUERY_VALUE| \
5185 KEY_ENUMERATE_SUB_KEYS| \
5186 KEY_NOTIFY) \
5187 & (~SYNCHRONIZE) \
5189 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5190 KEY_SET_VALUE| \
5191 KEY_CREATE_SUB_KEY) \
5192 & (~SYNCHRONIZE) \
5194 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5195 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5196 KEY_QUERY_VALUE| \
5197 KEY_SET_VALUE| \
5198 KEY_CREATE_SUB_KEY| \
5199 KEY_ENUMERATE_SUB_KEYS| \
5200 KEY_NOTIFY| \
5201 KEY_CREATE_LINK) \
5202 & (~SYNCHRONIZE) \
5204 /* ------------------------------ end registry ------------------------------ */
5207 #define EVENTLOG_SUCCESS 0x0000
5208 #define EVENTLOG_ERROR_TYPE 0x0001
5209 #define EVENTLOG_WARNING_TYPE 0x0002
5210 #define EVENTLOG_INFORMATION_TYPE 0x0004
5211 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5212 #define EVENTLOG_AUDIT_FAILURE 0x0010
5214 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5215 #define EVENTLOG_SEEK_READ 0x0002
5216 #define EVENTLOG_FORWARDS_READ 0x0004
5217 #define EVENTLOG_BACKWARDS_READ 0x0008
5219 typedef struct _EVENTLOGRECORD {
5220 DWORD Length;
5221 DWORD Reserved;
5222 DWORD RecordNumber;
5223 DWORD TimeGenerated;
5224 DWORD TimeWritten;
5225 DWORD EventID;
5226 WORD EventType;
5227 WORD NumStrings;
5228 WORD EventCategory;
5229 WORD ReservedFlags;
5230 DWORD ClosingRecordNumber;
5231 DWORD StringOffset;
5232 DWORD UserSidLength;
5233 DWORD UserSidOffset;
5234 DWORD DataLength;
5235 DWORD DataOffset;
5236 } EVENTLOGRECORD, *PEVENTLOGRECORD;
5238 #define SERVICE_BOOT_START 0x00000000
5239 #define SERVICE_SYSTEM_START 0x00000001
5240 #define SERVICE_AUTO_START 0x00000002
5241 #define SERVICE_DEMAND_START 0x00000003
5242 #define SERVICE_DISABLED 0x00000004
5244 #define SERVICE_ERROR_IGNORE 0x00000000
5245 #define SERVICE_ERROR_NORMAL 0x00000001
5246 #define SERVICE_ERROR_SEVERE 0x00000002
5247 #define SERVICE_ERROR_CRITICAL 0x00000003
5249 /* Service types */
5250 #define SERVICE_KERNEL_DRIVER 0x00000001
5251 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5252 #define SERVICE_ADAPTER 0x00000004
5253 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5255 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5256 SERVICE_RECOGNIZER_DRIVER )
5258 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5259 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5260 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5262 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5264 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5265 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5268 typedef enum _CM_SERVICE_NODE_TYPE
5270 DriverType = SERVICE_KERNEL_DRIVER,
5271 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
5272 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
5273 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
5274 AdapterType = SERVICE_ADAPTER,
5275 RecognizerType = SERVICE_RECOGNIZER_DRIVER
5276 } SERVICE_NODE_TYPE;
5278 typedef enum _CM_SERVICE_LOAD_TYPE
5280 BootLoad = SERVICE_BOOT_START,
5281 SystemLoad = SERVICE_SYSTEM_START,
5282 AutoLoad = SERVICE_AUTO_START,
5283 DemandLoad = SERVICE_DEMAND_START,
5284 DisableLoad = SERVICE_DISABLED
5285 } SERVICE_LOAD_TYPE;
5287 typedef enum _CM_ERROR_CONTROL_TYPE
5289 IgnoreError = SERVICE_ERROR_IGNORE,
5290 NormalError = SERVICE_ERROR_NORMAL,
5291 SevereError = SERVICE_ERROR_SEVERE,
5292 CriticalError = SERVICE_ERROR_CRITICAL
5293 } SERVICE_ERROR_TYPE;
5297 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5298 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5299 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5300 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5301 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5303 #include <guiddef.h>
5305 typedef struct _OBJECT_TYPE_LIST {
5306 WORD Level;
5307 WORD Sbz;
5308 GUID *ObjectType;
5309 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
5311 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5313 WORD Type;
5314 WORD CreatorBackTraceIndex;
5315 struct _RTL_CRITICAL_SECTION *CriticalSection;
5316 LIST_ENTRY ProcessLocksList;
5317 DWORD EntryCount;
5318 DWORD ContentionCount;
5319 #ifdef __WINESRC__ /* in Wine we store the name here */
5320 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
5321 #else
5322 DWORD Spare[ 2 ];
5323 #endif
5324 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
5326 typedef struct _RTL_CRITICAL_SECTION {
5327 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
5328 LONG LockCount;
5329 LONG RecursionCount;
5330 HANDLE OwningThread;
5331 HANDLE LockSemaphore;
5332 ULONG_PTR SpinCount;
5333 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
5335 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5336 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5337 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5338 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5339 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5341 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
5342 typedef VOID (NTAPI * PFLS_CALLBACK_FUNCTION) ( PVOID );
5344 #include <pshpack8.h>
5345 typedef struct _IO_COUNTERS {
5346 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
5347 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
5348 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
5349 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
5350 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
5351 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
5352 } IO_COUNTERS, *PIO_COUNTERS;
5353 #include <poppack.h>
5355 typedef struct {
5356 DWORD dwOSVersionInfoSize;
5357 DWORD dwMajorVersion;
5358 DWORD dwMinorVersion;
5359 DWORD dwBuildNumber;
5360 DWORD dwPlatformId;
5361 CHAR szCSDVersion[128];
5362 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
5364 typedef struct {
5365 DWORD dwOSVersionInfoSize;
5366 DWORD dwMajorVersion;
5367 DWORD dwMinorVersion;
5368 DWORD dwBuildNumber;
5369 DWORD dwPlatformId;
5370 WCHAR szCSDVersion[128];
5371 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
5373 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
5374 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
5375 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
5377 typedef struct {
5378 DWORD dwOSVersionInfoSize;
5379 DWORD dwMajorVersion;
5380 DWORD dwMinorVersion;
5381 DWORD dwBuildNumber;
5382 DWORD dwPlatformId;
5383 CHAR szCSDVersion[128];
5384 WORD wServicePackMajor;
5385 WORD wServicePackMinor;
5386 WORD wSuiteMask;
5387 BYTE wProductType;
5388 BYTE wReserved;
5389 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
5391 typedef struct {
5392 DWORD dwOSVersionInfoSize;
5393 DWORD dwMajorVersion;
5394 DWORD dwMinorVersion;
5395 DWORD dwBuildNumber;
5396 DWORD dwPlatformId;
5397 WCHAR szCSDVersion[128];
5398 WORD wServicePackMajor;
5399 WORD wServicePackMinor;
5400 WORD wSuiteMask;
5401 BYTE wProductType;
5402 BYTE wReserved;
5403 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
5405 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
5406 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
5407 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
5409 NTSYSAPI ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
5411 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5413 #define VER_PLATFORM_WIN32s 0
5414 #define VER_PLATFORM_WIN32_WINDOWS 1
5415 #define VER_PLATFORM_WIN32_NT 2
5417 #define VER_MINORVERSION 0x00000001
5418 #define VER_MAJORVERSION 0x00000002
5419 #define VER_BUILDNUMBER 0x00000004
5420 #define VER_PLATFORMID 0x00000008
5421 #define VER_SERVICEPACKMINOR 0x00000010
5422 #define VER_SERVICEPACKMAJOR 0x00000020
5423 #define VER_SUITENAME 0x00000040
5424 #define VER_PRODUCT_TYPE 0x00000080
5426 #define VER_NT_WORKSTATION 1
5427 #define VER_NT_DOMAIN_CONTROLLER 2
5428 #define VER_NT_SERVER 3
5430 #define VER_SUITE_SMALLBUSINESS 0x00000001
5431 #define VER_SUITE_ENTERPRISE 0x00000002
5432 #define VER_SUITE_BACKOFFICE 0x00000004
5433 #define VER_SUITE_COMMUNICATIONS 0x00000008
5434 #define VER_SUITE_TERMINAL 0x00000010
5435 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5436 #define VER_SUITE_EMBEDDEDNT 0x00000040
5437 #define VER_SUITE_DATACENTER 0x00000080
5438 #define VER_SUITE_SINGLEUSERTS 0x00000100
5439 #define VER_SUITE_PERSONAL 0x00000200
5440 #define VER_SUITE_BLADE 0x00000400
5441 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5442 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5443 #define VER_SUITE_STORAGE_SERVER 0x00002000
5444 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5445 #define VER_SUITE_WH_SERVER 0x00008000
5447 #define VER_EQUAL 1
5448 #define VER_GREATER 2
5449 #define VER_GREATER_EQUAL 3
5450 #define VER_LESS 4
5451 #define VER_LESS_EQUAL 5
5452 #define VER_AND 6
5453 #define VER_OR 7
5455 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
5456 DWORD dwFlags;
5457 DWORD ulFormatVersion;
5458 DWORD ulAssemblyCount;
5459 DWORD ulRootManifestPathType;
5460 DWORD ulRootManifestPathChars;
5461 DWORD ulRootConfigurationPathType;
5462 DWORD ulRootConfigurationPathChars;
5463 DWORD ulAppDirPathType;
5464 DWORD ulAppDirPathChars;
5465 PCWSTR lpRootManifestPath;
5466 PCWSTR lpRootConfigurationPath;
5467 PCWSTR lpAppDirPath;
5468 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
5470 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
5471 DWORD ulFlags;
5472 DWORD ulEncodedAssemblyIdentityLength;
5473 DWORD ulManifestPathType;
5474 DWORD ulManifestPathLength;
5475 LARGE_INTEGER liManifestLastWriteTime;
5476 DWORD ulPolicyPathType;
5477 DWORD ulPolicyPathLength;
5478 LARGE_INTEGER liPolicyLastWriteTime;
5479 DWORD ulMetadataSatelliteRosterIndex;
5480 DWORD ulManifestVersionMajor;
5481 DWORD ulManifestVersionMinor;
5482 DWORD ulPolicyVersionMajor;
5483 DWORD ulPolicyVersionMinor;
5484 DWORD ulAssemblyDirectoryNameLength;
5485 PCWSTR lpAssemblyEncodedAssemblyIdentity;
5486 PCWSTR lpAssemblyManifestPath;
5487 PCWSTR lpAssemblyPolicyPath;
5488 PCWSTR lpAssemblyDirectoryName;
5489 DWORD ulFileCount;
5490 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
5492 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
5493 DWORD ulAssemblyIndex;
5494 DWORD ulFileIndexInAssembly;
5495 } ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
5497 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
5499 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
5500 DWORD ulFlags;
5501 DWORD ulFilenameLength;
5502 DWORD ulPathLength;
5503 PCWSTR lpFileName;
5504 PCWSTR lpFilePath;
5505 } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
5507 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
5509 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
5510 ActivationContextBasicInformation = 1,
5511 ActivationContextDetailedInformation = 2,
5512 AssemblyDetailedInformationInActivationContext = 3,
5513 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
5514 MaxActivationContextInfoClass,
5516 AssemblyDetailedInformationInActivationContxt = 3,
5517 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
5518 } ACTIVATION_CONTEXT_INFO_CLASS;
5520 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5521 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5522 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5523 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5525 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5526 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5527 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5528 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5529 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5530 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5531 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5532 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5533 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5535 typedef enum _JOBOBJECTINFOCLASS
5537 JobObjectBasicAccountingInformation = 1,
5538 JobObjectBasicLimitInformation,
5539 JobObjectBasicProcessIdList,
5540 JobObjectBasicUIRestrictions,
5541 JobObjectSecurityLimitInformation,
5542 JobObjectEndOfJobTimeInformation,
5543 JobObjectAssociateCompletionPortInformation,
5544 JobObjectBasicAndIoAccountingInformation,
5545 JobObjectExtendedLimitInformation,
5546 JobObjectJobSetInformation,
5547 MaxJobObjectInfoClass
5548 } JOBOBJECTINFOCLASS;
5550 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5552 RelationProcessorCore = 0,
5553 RelationNumaNode = 1,
5554 RelationCache = 2,
5555 RelationProcessorPackage = 3,
5556 RelationGroup = 4,
5557 RelationAll = 0xffff
5558 } LOGICAL_PROCESSOR_RELATIONSHIP;
5560 typedef enum _PROCESSOR_CACHE_TYPE
5562 CacheUnified,
5563 CacheInstruction,
5564 CacheData,
5565 CacheTrace
5566 } PROCESSOR_CACHE_TYPE;
5568 typedef struct _PROCESSOR_GROUP_INFO
5570 BYTE MaximumProcessorCount;
5571 BYTE ActiveProcessorCount;
5572 BYTE Reserved[38];
5573 KAFFINITY ActiveProcessorMask;
5574 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
5576 typedef struct _CACHE_DESCRIPTOR
5578 BYTE Level;
5579 BYTE Associativity;
5580 WORD LineSize;
5581 DWORD Size;
5582 PROCESSOR_CACHE_TYPE Type;
5583 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
5585 typedef struct _GROUP_AFFINITY
5587 KAFFINITY Mask;
5588 WORD Group;
5589 WORD Reserved[3];
5590 } GROUP_AFFINITY, *PGROUP_AFFINITY;
5592 typedef struct _PROCESSOR_RELATIONSHIP
5594 BYTE Flags;
5595 BYTE Reserved[21];
5596 WORD GroupCount;
5597 GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
5598 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
5601 typedef struct _NUMA_NODE_RELATIONSHIP
5603 DWORD NodeNumber;
5604 BYTE Reserved[20];
5605 GROUP_AFFINITY GroupMask;
5606 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
5608 typedef struct _CACHE_RELATIONSHIP
5610 BYTE Level;
5611 BYTE Associativity;
5612 WORD LineSize;
5613 PROCESSOR_CACHE_TYPE Type;
5614 BYTE Reserved[20];
5615 GROUP_AFFINITY GroupMask;
5616 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
5618 typedef struct _GROUP_RELATIONSHIP
5620 WORD MaximumGroupCount;
5621 WORD ActiveGroupCount;
5622 BYTE Reserved[20];
5623 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
5624 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
5626 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5628 ULONG_PTR ProcessorMask;
5629 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5630 union
5632 struct
5634 BYTE Flags;
5635 } ProcessorCore;
5636 struct
5638 DWORD NodeNumber;
5639 } NumaNode;
5640 CACHE_DESCRIPTOR Cache;
5641 ULONGLONG Reserved[2];
5642 } DUMMYUNIONNAME;
5643 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
5645 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5647 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5648 DWORD Size;
5649 union
5651 PROCESSOR_RELATIONSHIP Processor;
5652 NUMA_NODE_RELATIONSHIP NumaNode;
5653 CACHE_RELATIONSHIP Cache;
5654 GROUP_RELATIONSHIP Group;
5655 } DUMMYUNIONNAME;
5656 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
5658 NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
5660 #ifdef __cplusplus
5662 #endif
5664 #endif /* _WINNT_ */