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
41 #define NTSYSAPI DECLSPEC_IMPORT
44 #define NTAPI __stdcall
47 # if defined(_MSC_VER)
48 # define DECLSPEC_IMPORT __declspec(dllimport)
49 # elif defined(__MINGW32__) || defined(__CYGWIN__)
50 # define DECLSPEC_IMPORT __attribute__((dllimport))
52 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
55 # define DECLSPEC_IMPORT
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))
64 # define DECLSPEC_NORETURN
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)))
74 # define DECLSPEC_ALIGN(x)
78 #ifndef DECLSPEC_CACHEALIGN
79 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
83 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
84 # define DECLSPEC_UUID(x) __declspec(uuid(x))
86 # define DECLSPEC_UUID(x)
90 #ifndef DECLSPEC_NOVTABLE
91 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
92 # define DECLSPEC_NOVTABLE __declspec(novtable)
94 # define DECLSPEC_NOVTABLE
98 #ifndef DECLSPEC_SELECTANY
99 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
100 #define DECLSPEC_SELECTANY __declspec(selectany)
102 #define DECLSPEC_SELECTANY
107 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
108 # define NOP_FUNCTION __noop
110 # define NOP_FUNCTION (void)0
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)
118 # define DECLSPEC_ADDRSAFE
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))
128 # define FORCEINLINE inline
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
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
145 /* a couple of useful Wine extensions */
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")))
154 # define DECLSPEC_EXPORT
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")))
162 # define DECLSPEC_HIDDEN
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
168 #define __WINE_ALLOC_SIZE(x)
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
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
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
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
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
193 #endif /* NONAMELESSUNION */
195 #undef DUMMYSTRUCTNAME
196 #undef DUMMYSTRUCTNAME1
197 #undef DUMMYSTRUCTNAME2
198 #undef DUMMYSTRUCTNAME3
199 #undef DUMMYSTRUCTNAME4
200 #undef DUMMYSTRUCTNAME5
201 #ifndef NONAMELESSSTRUCT
202 #define DUMMYSTRUCTNAME
203 #define DUMMYSTRUCTNAME1
204 #define DUMMYSTRUCTNAME2
205 #define DUMMYSTRUCTNAME3
206 #define DUMMYSTRUCTNAME4
207 #define DUMMYSTRUCTNAME5
208 #else /* !defined(NONAMELESSSTRUCT) */
209 #define DUMMYSTRUCTNAME s
210 #define DUMMYSTRUCTNAME1 s1
211 #define DUMMYSTRUCTNAME2 s2
212 #define DUMMYSTRUCTNAME3 s3
213 #define DUMMYSTRUCTNAME4 s4
214 #define DUMMYSTRUCTNAME5 s5
215 #endif /* !defined(NONAMELESSSTRUCT) */
217 #undef DUMMYUNIONNAME
218 #undef DUMMYUNIONNAME1
219 #undef DUMMYUNIONNAME2
220 #undef DUMMYUNIONNAME3
221 #undef DUMMYUNIONNAME4
222 #undef DUMMYUNIONNAME5
223 #undef DUMMYUNIONNAME6
224 #undef DUMMYUNIONNAME7
225 #undef DUMMYUNIONNAME8
226 #ifndef NONAMELESSUNION
227 #define DUMMYUNIONNAME
228 #define DUMMYUNIONNAME1
229 #define DUMMYUNIONNAME2
230 #define DUMMYUNIONNAME3
231 #define DUMMYUNIONNAME4
232 #define DUMMYUNIONNAME5
233 #define DUMMYUNIONNAME6
234 #define DUMMYUNIONNAME7
235 #define DUMMYUNIONNAME8
236 #else /* !defined(NONAMELESSUNION) */
237 #define DUMMYUNIONNAME u
238 #define DUMMYUNIONNAME1 u1
239 #define DUMMYUNIONNAME2 u2
240 #define DUMMYUNIONNAME3 u3
241 #define DUMMYUNIONNAME4 u4
242 #define DUMMYUNIONNAME5 u5
243 #define DUMMYUNIONNAME6 u6
244 #define DUMMYUNIONNAME7 u7
245 #define DUMMYUNIONNAME8 u8
246 #endif /* !defined(NONAMELESSUNION) */
248 #ifndef __C89_NAMELESS
249 # if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
251 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
252 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
253 # define __C89_NAMELESS __extension__
255 # elif defined(_MSC_VER)
256 # define __C89_NAMELESS
261 #ifdef __C89_NAMELESS
262 # define __C89_NAMELESSSTRUCTNAME
263 # define __C89_NAMELESSUNIONNAME
265 # define __C89_NAMELESS
266 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
267 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
270 /* C99 restrict support */
272 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
273 # if defined(_MSC_VER) && defined(_M_MRX000)
274 # define RESTRICTED_POINTER __restrict
275 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
276 # define RESTRICTED_POINTER __restrict
278 # define RESTRICTED_POINTER
281 # define RESTRICTED_POINTER
284 /* C99 unaligned support */
287 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
288 # define UNALIGNED __unaligned
290 # define UNALIGNED64 __unaligned
300 /* Alignment macros */
302 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
303 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
304 #define MEMORY_ALLOCATION_ALIGNMENT 16
306 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
307 #define MEMORY_ALLOCATION_ALIGNMENT 8
310 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
311 # define TYPE_ALIGNMENT(t) __alignof(t)
312 #elif defined(__GNUC__)
313 # define TYPE_ALIGNMENT(t) __alignof__(t)
315 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
319 # define PROBE_ALIGNMENT(_s) \
320 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
321 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
322 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
324 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
327 /* Compile time assertion */
329 #if defined(_MSC_VER)
330 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
332 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
335 /* Eliminate Microsoft C/C++ compiler warning 4715 */
336 #if defined(_MSC_VER) && (_MSC_VER > 1200)
337 # define DEFAULT_UNREACHABLE default: __assume(0)
339 # define DEFAULT_UNREACHABLE
343 #define APPLICATION_ERROR_MASK 0x20000000
344 #define ERROR_SEVERITY_SUCCESS 0x00000000
345 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
346 #define ERROR_SEVERITY_WARNING 0x80000000
347 #define ERROR_SEVERITY_ERROR 0xC0000000
350 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
352 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
353 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
354 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
355 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
356 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
357 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
358 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
361 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
364 /* Microsoft's macros for declaring functions */
367 # define EXTERN_C extern "C"
369 # define EXTERN_C extern
372 #define STDMETHODCALLTYPE __stdcall
373 #define STDMETHODVCALLTYPE __cdecl
374 #define STDAPICALLTYPE __stdcall
375 #define STDAPIVCALLTYPE __cdecl
377 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
378 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
379 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
380 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
381 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
382 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
383 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
384 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
386 /* Define the basic types */
391 typedef VOID
*PVOID64
;
392 typedef BYTE BOOLEAN
, *PBOOLEAN
;
393 typedef char CHAR
, *PCHAR
;
394 typedef short SHORT
, *PSHORT
;
396 typedef long LONG
, *PLONG
;
398 typedef int LONG
, *PLONG
;
401 /* Some systems might have wchar_t, but we really need 16 bit characters */
402 #ifdef WINE_UNICODE_NATIVE
403 typedef wchar_t WCHAR
, *PWCHAR
;
405 typedef unsigned short WCHAR
, *PWCHAR
;
408 /* 'Extended/Wide' numerical types */
412 typedef signed __int64 LONGLONG
, *PLONGLONG
;
413 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
415 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
416 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
423 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
425 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
429 /* ANSI string types */
430 typedef CHAR
*PCH
, *LPCH
;
431 typedef const CHAR
*PCCH
, *LPCCH
;
432 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
433 typedef const CHAR
*PCSTR
, *LPCSTR
;
435 /* Unicode string types */
436 typedef WCHAR
*PWCH
, *LPWCH
;
437 typedef const WCHAR
*PCWCH
, *LPCWCH
;
438 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
439 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
440 typedef WCHAR
*PZZWSTR
;
441 typedef const WCHAR
*PCZZWSTR
;
443 /* Neutral character and string types */
444 /* These are only defined for Winelib, i.e. _not_ defined for
445 * the emulator. The reason is they depend on the UNICODE
446 * macro which only exists in the user's code.
448 #ifndef WINE_NO_UNICODE_MACROS
450 # ifndef _TCHAR_DEFINED
451 typedef WCHAR TCHAR
, *PTCHAR
;
452 # define _TCHAR_DEFINED
454 typedef LPWSTR PTSTR
, LPTSTR
;
455 typedef LPCWSTR PCTSTR
, LPCTSTR
;
456 # define __TEXT(string) L##string
458 # ifndef _TCHAR_DEFINED
459 typedef CHAR TCHAR
, *PTCHAR
;
460 # define _TCHAR_DEFINED
462 typedef LPSTR PTSTR
, LPTSTR
;
463 typedef LPCSTR PCTSTR
, LPCTSTR
;
464 # define __TEXT(string) string
465 # endif /* UNICODE */
466 # define TEXT(quote) __TEXT(quote)
467 #endif /* WINE_NO_UNICODE_MACROS */
469 /* Misc common WIN32 types */
471 typedef DWORD LCID
, *PLCID
;
473 typedef DWORD EXECUTION_STATE
;
474 #ifndef _HRESULT_DEFINED
475 #define _HRESULT_DEFINED
476 typedef LONG HRESULT
;
481 typedef void *HANDLE
;
482 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
485 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
487 #define DECLARE_HANDLE(a) typedef HANDLE a
496 #ifndef WIN32_NO_STATUS
498 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
499 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
500 #define STATUS_USER_APC ((DWORD) 0x000000C0)
501 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
502 #define STATUS_PENDING ((DWORD) 0x00000103)
503 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
504 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
505 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
506 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
507 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
508 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
509 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
510 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
511 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
512 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
513 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
514 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
515 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
516 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
517 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
518 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
519 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
520 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
521 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
522 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
523 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
524 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
525 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
526 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
527 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
528 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
529 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
530 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
531 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
532 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
534 /* status values for ContinueDebugEvent */
535 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
536 #define DBG_CONTINUE ((DWORD) 0x00010002)
537 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
538 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
539 #define DBG_CONTROL_C ((DWORD) 0x40010005)
540 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
541 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
542 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
544 #endif /* WIN32_NO_STATUS */
546 /* Argument 1 passed to the DllEntryProc. */
547 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
548 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
549 #define DLL_THREAD_ATTACH 2 /* attach new thread */
550 #define DLL_THREAD_DETACH 3 /* detach thread */
552 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
555 /* u.x.wProcessorArchitecture (NT) */
556 #define PROCESSOR_ARCHITECTURE_INTEL 0
557 #define PROCESSOR_ARCHITECTURE_MIPS 1
558 #define PROCESSOR_ARCHITECTURE_ALPHA 2
559 #define PROCESSOR_ARCHITECTURE_PPC 3
560 #define PROCESSOR_ARCHITECTURE_SHX 4
561 #define PROCESSOR_ARCHITECTURE_ARM 5
562 #define PROCESSOR_ARCHITECTURE_IA64 6
563 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
564 #define PROCESSOR_ARCHITECTURE_MSIL 8
565 #define PROCESSOR_ARCHITECTURE_AMD64 9
566 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
567 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
570 #define PROCESSOR_ARCHITECTURE_SPARC 20
572 /* dwProcessorType */
573 #define PROCESSOR_INTEL_386 386
574 #define PROCESSOR_INTEL_486 486
575 #define PROCESSOR_INTEL_PENTIUM 586
576 #define PROCESSOR_INTEL_860 860
577 #define PROCESSOR_INTEL_IA64 2200
578 #define PROCESSOR_AMD_X8664 8664
579 #define PROCESSOR_MIPS_R2000 2000
580 #define PROCESSOR_MIPS_R3000 3000
581 #define PROCESSOR_MIPS_R4000 4000
582 #define PROCESSOR_ALPHA_21064 21064
583 #define PROCESSOR_PPC_601 601
584 #define PROCESSOR_PPC_603 603
585 #define PROCESSOR_PPC_604 604
586 #define PROCESSOR_PPC_620 620
587 #define PROCESSOR_HITACHI_SH3 10003
588 #define PROCESSOR_HITACHI_SH3E 10004
589 #define PROCESSOR_HITACHI_SH4 10005
590 #define PROCESSOR_MOTOROLA_821 821
591 #define PROCESSOR_SHx_SH3 103
592 #define PROCESSOR_SHx_SH4 104
593 #define PROCESSOR_STRONGARM 2577
594 #define PROCESSOR_ARM720 1824 /* 0x720 */
595 #define PROCESSOR_ARM820 2080 /* 0x820 */
596 #define PROCESSOR_ARM920 2336 /* 0x920 */
597 #define PROCESSOR_ARM_7TDMI 70001
598 #define PROCESSOR_OPTIL 18767
601 #define MAXIMUM_PROCESSORS 64
603 #define MAXIMUM_PROCESSORS 32
606 typedef struct _MEMORY_BASIC_INFORMATION
609 LPVOID AllocationBase
;
610 DWORD AllocationProtect
;
615 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
617 #define PAGE_NOACCESS 0x01
618 #define PAGE_READONLY 0x02
619 #define PAGE_READWRITE 0x04
620 #define PAGE_WRITECOPY 0x08
621 #define PAGE_EXECUTE 0x10
622 #define PAGE_EXECUTE_READ 0x20
623 #define PAGE_EXECUTE_READWRITE 0x40
624 #define PAGE_EXECUTE_WRITECOPY 0x80
625 #define PAGE_GUARD 0x100
626 #define PAGE_NOCACHE 0x200
627 #define PAGE_WRITECOMBINE 0x400
629 #define MEM_COMMIT 0x00001000
630 #define MEM_RESERVE 0x00002000
631 #define MEM_DECOMMIT 0x00004000
632 #define MEM_RELEASE 0x00008000
633 #define MEM_FREE 0x00010000
634 #define MEM_PRIVATE 0x00020000
635 #define MEM_MAPPED 0x00040000
636 #define MEM_RESET 0x00080000
637 #define MEM_TOP_DOWN 0x00100000
638 #define MEM_WRITE_WATCH 0x00200000
639 #define MEM_PHYSICAL 0x00400000
640 #define MEM_LARGE_PAGES 0x20000000
641 #define MEM_4MB_PAGES 0x80000000
643 #define SEC_FILE 0x00800000
644 #define SEC_IMAGE 0x01000000
645 #define SEC_RESERVE 0x04000000
646 #define SEC_COMMIT 0x08000000
647 #define SEC_NOCACHE 0x10000000
648 #define SEC_LARGE_PAGES 0x80000000
649 #define MEM_IMAGE SEC_IMAGE
651 #define WRITE_WATCH_FLAG_RESET 0x00000001
656 #define MINSHORT 0x8000
657 #define MAXSHORT 0x7fff
658 #define MINLONG 0x80000000
659 #define MAXLONG 0x7fffffff
661 #define MAXWORD 0xffff
662 #define MAXDWORD 0xffffffff
664 #define UNICODE_STRING_MAX_CHARS 32767
666 #define FIELD_OFFSET(type, field) \
667 ((LONG)(INT_PTR)&(((type *)0)->field))
669 #define CONTAINING_RECORD(address, type, field) \
670 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
674 typedef struct _LIST_ENTRY
{
675 struct _LIST_ENTRY
*Flink
;
676 struct _LIST_ENTRY
*Blink
;
677 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
679 typedef struct _SINGLE_LIST_ENTRY
{
680 struct _SINGLE_LIST_ENTRY
*Next
;
681 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
685 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
*PSLIST_ENTRY
;
686 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
690 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
697 ULONGLONG Sequence
:9;
698 ULONGLONG NextEntry
:39;
699 ULONGLONG HeaderType
:1;
701 ULONGLONG Reserved
:59;
706 ULONGLONG Sequence
:48;
707 ULONGLONG HeaderType
:1;
709 ULONGLONG Reserved
:2;
710 ULONGLONG NextEntry
:60;
712 } SLIST_HEADER
, *PSLIST_HEADER
;
716 #undef SLIST_ENTRY /* for Mac OS */
717 #define SLIST_ENTRY SINGLE_LIST_ENTRY
718 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
719 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
721 typedef union _SLIST_HEADER
{
728 } SLIST_HEADER
, *PSLIST_HEADER
;
732 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
733 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
734 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
735 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
736 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
737 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
742 #define HEAP_NO_SERIALIZE 0x00000001
743 #define HEAP_GROWABLE 0x00000002
744 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
745 #define HEAP_ZERO_MEMORY 0x00000008
746 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
747 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
748 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
749 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
750 #define HEAP_CREATE_ALIGN_16 0x00010000
751 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
752 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
754 /* This flag allows it to create heaps shared by all processes under win95,
755 FIXME: correct name */
756 #define HEAP_SHARED 0x04000000
758 typedef enum _HEAP_INFORMATION_CLASS
{
759 HeapCompatibilityInformation
,
760 } HEAP_INFORMATION_CLASS
;
762 /* Processor feature flags. */
763 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
764 #define PF_FLOATING_POINT_EMULATED 1
765 #define PF_COMPARE_EXCHANGE_DOUBLE 2
766 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
767 #define PF_PPC_MOVEMEM_64BIT_OK 4
768 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
769 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
770 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
771 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
772 #define PF_PAE_ENABLED 9
773 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
774 #define PF_SSE_DAZ_MODE_AVAILABLE 11
775 #define PF_NX_ENABLED 12
776 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
777 #define PF_COMPARE_EXCHANGE128 14
778 #define PF_COMPARE64_EXCHANGE128 15
779 #define PF_CHANNELS_ENABLED 16
780 #define PF_XSAVE_ENABLED 17
783 /* Execution state flags */
784 #define ES_SYSTEM_REQUIRED 0x00000001
785 #define ES_DISPLAY_REQUIRED 0x00000002
786 #define ES_USER_PRESENT 0x00000004
787 #define ES_CONTINUOUS 0x80000000
789 /* The Win32 register context */
791 /* i386 context definitions */
794 #define SIZE_OF_80387_REGISTERS 80
796 typedef struct _FLOATING_SAVE_AREA
805 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
807 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
809 #define MAXIMUM_SUPPORTED_EXTENSION 512
811 typedef struct _CONTEXT
815 /* These are selected by CONTEXT_DEBUG_REGISTERS */
823 /* These are selected by CONTEXT_FLOATING_POINT */
824 FLOATING_SAVE_AREA FloatSave
;
826 /* These are selected by CONTEXT_SEGMENTS */
832 /* These are selected by CONTEXT_INTEGER */
840 /* These are selected by CONTEXT_CONTROL */
848 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
851 #define CONTEXT_X86 0x00010000
852 #define CONTEXT_i386 CONTEXT_X86
853 #define CONTEXT_i486 CONTEXT_X86
855 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
856 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
857 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
858 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
859 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
860 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020L)
861 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
862 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
863 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
865 #define EXCEPTION_READ_FAULT 0
866 #define EXCEPTION_WRITE_FAULT 1
867 #define EXCEPTION_EXECUTE_FAULT 8
869 #endif /* __i386__ */
871 typedef struct _LDT_ENTRY
{
886 unsigned LimitHi
: 4;
888 unsigned Reserved_0
: 1;
889 unsigned Default_Big
: 1;
890 unsigned Granularity
: 1;
894 } LDT_ENTRY
, *PLDT_ENTRY
;
896 /* x86-64 context definitions */
897 #if defined(__x86_64__)
899 #define CONTEXT_AMD64 0x00100000
901 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
902 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
903 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
904 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
905 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
906 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
907 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
909 #define EXCEPTION_READ_FAULT 0
910 #define EXCEPTION_WRITE_FAULT 1
911 #define EXCEPTION_EXECUTE_FAULT 8
913 typedef struct DECLSPEC_ALIGN(16) _M128A
{
918 typedef struct _XMM_SAVE_AREA32
{
919 WORD ControlWord
; /* 000 */
920 WORD StatusWord
; /* 002 */
921 BYTE TagWord
; /* 004 */
922 BYTE Reserved1
; /* 005 */
923 WORD ErrorOpcode
; /* 006 */
924 DWORD ErrorOffset
; /* 008 */
925 WORD ErrorSelector
; /* 00c */
926 WORD Reserved2
; /* 00e */
927 DWORD DataOffset
; /* 010 */
928 WORD DataSelector
; /* 014 */
929 WORD Reserved3
; /* 016 */
930 DWORD MxCsr
; /* 018 */
931 DWORD MxCsr_Mask
; /* 01c */
932 M128A FloatRegisters
[8]; /* 020 */
933 M128A XmmRegisters
[16]; /* 0a0 */
934 BYTE Reserved4
[96]; /* 1a0 */
935 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
937 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
938 DWORD64 P1Home
; /* 000 */
939 DWORD64 P2Home
; /* 008 */
940 DWORD64 P3Home
; /* 010 */
941 DWORD64 P4Home
; /* 018 */
942 DWORD64 P5Home
; /* 020 */
943 DWORD64 P6Home
; /* 028 */
946 DWORD ContextFlags
; /* 030 */
947 DWORD MxCsr
; /* 034 */
950 WORD SegCs
; /* 038 */
951 WORD SegDs
; /* 03a */
952 WORD SegEs
; /* 03c */
953 WORD SegFs
; /* 03e */
954 WORD SegGs
; /* 040 */
955 WORD SegSs
; /* 042 */
956 DWORD EFlags
; /* 044 */
959 DWORD64 Dr0
; /* 048 */
960 DWORD64 Dr1
; /* 050 */
961 DWORD64 Dr2
; /* 058 */
962 DWORD64 Dr3
; /* 060 */
963 DWORD64 Dr6
; /* 068 */
964 DWORD64 Dr7
; /* 070 */
967 DWORD64 Rax
; /* 078 */
968 DWORD64 Rcx
; /* 080 */
969 DWORD64 Rdx
; /* 088 */
970 DWORD64 Rbx
; /* 090 */
971 DWORD64 Rsp
; /* 098 */
972 DWORD64 Rbp
; /* 0a0 */
973 DWORD64 Rsi
; /* 0a8 */
974 DWORD64 Rdi
; /* 0b0 */
975 DWORD64 R8
; /* 0b8 */
976 DWORD64 R9
; /* 0c0 */
977 DWORD64 R10
; /* 0c8 */
978 DWORD64 R11
; /* 0d0 */
979 DWORD64 R12
; /* 0d8 */
980 DWORD64 R13
; /* 0e0 */
981 DWORD64 R14
; /* 0e8 */
982 DWORD64 R15
; /* 0f0 */
985 DWORD64 Rip
; /* 0f8 */
989 XMM_SAVE_AREA32 FltSave
; /* 100 */
991 M128A Header
[2]; /* 100 */
992 M128A Legacy
[8]; /* 120 */
993 M128A Xmm0
; /* 1a0 */
994 M128A Xmm1
; /* 1b0 */
995 M128A Xmm2
; /* 1c0 */
996 M128A Xmm3
; /* 1d0 */
997 M128A Xmm4
; /* 1e0 */
998 M128A Xmm5
; /* 1f0 */
999 M128A Xmm6
; /* 200 */
1000 M128A Xmm7
; /* 210 */
1001 M128A Xmm8
; /* 220 */
1002 M128A Xmm9
; /* 230 */
1003 M128A Xmm10
; /* 240 */
1004 M128A Xmm11
; /* 250 */
1005 M128A Xmm12
; /* 260 */
1006 M128A Xmm13
; /* 270 */
1007 M128A Xmm14
; /* 280 */
1008 M128A Xmm15
; /* 290 */
1013 M128A VectorRegister
[26]; /* 300 */
1014 DWORD64 VectorControl
; /* 4a0 */
1017 DWORD64 DebugControl
; /* 4a8 */
1018 DWORD64 LastBranchToRip
; /* 4b0 */
1019 DWORD64 LastBranchFromRip
; /* 4b8 */
1020 DWORD64 LastExceptionToRip
; /* 4c0 */
1021 DWORD64 LastExceptionFromRip
; /* 4c8 */
1024 typedef struct _RUNTIME_FUNCTION
1029 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1031 #define UNWIND_HISTORY_TABLE_SIZE 12
1033 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1036 PRUNTIME_FUNCTION FunctionEntry
;
1037 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1039 #define UNWIND_HISTORY_TABLE_NONE 0
1040 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1041 #define UNWIND_HISTORY_TABLE_LOCAL 2
1043 typedef struct _UNWIND_HISTORY_TABLE
1048 ULONG64 HighAddress
;
1049 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1050 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1052 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1056 PM128A FloatingContext
[16];
1080 PULONG64 IntegerContext
[16];
1101 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1103 BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD64
);
1104 BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
1105 PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD64
,DWORD64
*,UNWIND_HISTORY_TABLE
*);
1106 PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1108 #define UNW_FLAG_NHANDLER 0
1109 #define UNW_FLAG_EHANDLER 1
1110 #define UNW_FLAG_UHANDLER 2
1111 #define UNW_FLAG_CHAININFO 4
1113 #endif /* __x86_64__ */
1115 /* IA64 context definitions */
1118 #define CONTEXT_IA64 0x00080000
1119 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1120 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1121 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1122 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1123 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1124 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1125 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1126 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1127 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1129 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1130 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1131 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1132 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1134 typedef struct _CONTEXT
1329 ULONGLONG RsBSPSTORE
;
1343 ULONGLONG UNUSEDPACK
;
1344 } CONTEXT
, *PCONTEXT
;
1346 typedef struct _RUNTIME_FUNCTION
1350 ULONG UnwindInfoAddress
;
1351 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1353 typedef struct _FRAME_POINTERS
{
1354 ULONGLONG MemoryStackFp
;
1355 ULONGLONG BackingStoreFp
;
1356 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1358 #define UNWIND_HISTORY_TABLE_SIZE 12
1360 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1363 PRUNTIME_FUNCTION FunctionEntry
;
1364 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1366 typedef struct _UNWIND_HISTORY_TABLE
{
1370 ULONG64 HighAddress
;
1371 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1372 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1374 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1380 PFLOAT128 HighFloatingContext
[10];
1402 PULONGLONG IntS0Nat
;
1403 PULONGLONG IntS1Nat
;
1404 PULONGLONG IntS2Nat
;
1405 PULONGLONG IntS3Nat
;
1406 PULONGLONG IntSpNat
;
1422 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1424 ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1426 #endif /* __ia64__ */
1428 /* Alpha context definitions */
1429 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1431 #define CONTEXT_ALPHA 0x00020000
1433 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
1434 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
1435 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
1436 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1438 #define EXCEPTION_READ_FAULT 0
1439 #define EXCEPTION_WRITE_FAULT 1
1440 #define EXCEPTION_EXECUTE_FAULT 8
1442 typedef struct _CONTEXT
1444 /* selected by CONTEXT_FLOATING_POINT */
1478 /* selected by CONTEXT_INTEGER */
1512 /* selected by CONTEXT_FLOATING_POINT */
1516 /* selected by CONTEXT_CONTROL */
1523 #define _QUAD_PSR_OFFSET HighSoftFpcr
1524 #define _QUAD_FLAGS_OFFSET HighFir
1526 #endif /* _ALPHA_ */
1530 /* The following flags control the contents of the CONTEXT structure. */
1532 #define CONTEXT_ARM 0x0000040
1533 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1534 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1536 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1538 #define EXCEPTION_READ_FAULT 0
1539 #define EXCEPTION_WRITE_FAULT 1
1540 #define EXCEPTION_EXECUTE_FAULT 8
1542 typedef struct _CONTEXT
{
1543 /* The flags values within this flag control the contents of
1546 If the context record is used as an input parameter, then
1547 for each portion of the context record controlled by a flag
1548 whose value is set, it is assumed that that portion of the
1549 context record contains valid context. If the context record
1550 is being used to modify a thread's context, then only that
1551 portion of the threads context will be modified.
1553 If the context record is used as an IN OUT parameter to capture
1554 the context of a thread, then only those portions of the thread's
1555 context corresponding to set flags will be returned.
1557 The context record is never used as an OUT only parameter. */
1561 /* This section is specified/returned if the ContextFlags word contains
1562 the flag CONTEXT_INTEGER. */
1577 /* These are selected by CONTEXT_CONTROL */
1584 #endif /* __arm__ */
1587 /* Mips context definitions */
1588 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1590 #define CONTEXT_R4000 0x00010000
1592 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1593 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1594 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1596 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1598 #define EXCEPTION_READ_FAULT 0
1599 #define EXCEPTION_WRITE_FAULT 1
1600 #define EXCEPTION_EXECUTE_FAULT 8
1602 typedef struct _CONTEXT
1605 /* These are selected by CONTEXT_FLOATING_POINT */
1639 /* These are selected by CONTEXT_INTEGER */
1675 /* These are selected by CONTEXT_FLOATING_POINT */
1678 /* These are selected by CONTEXT_CONTROL */
1688 /* PowerPC context definitions */
1691 #define CONTEXT_CONTROL 0x0001
1692 #define CONTEXT_FLOATING_POINT 0x0002
1693 #define CONTEXT_INTEGER 0x0004
1694 #define CONTEXT_DEBUG_REGISTERS 0x0008
1695 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1697 #define EXCEPTION_READ_FAULT 0
1698 #define EXCEPTION_WRITE_FAULT 1
1699 #define EXCEPTION_EXECUTE_FAULT 8
1703 /* These are selected by CONTEXT_FLOATING_POINT */
1738 /* These are selected by CONTEXT_INTEGER */
1775 /* These are selected by CONTEXT_CONTROL */
1777 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1783 DWORD Dar
; /* Fault registers for coredump */
1785 DWORD Trap
; /* number of powerpc exception taken */
1787 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1798 typedef struct _STACK_FRAME_HEADER
1815 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1817 #endif /* __powerpc__ */
1824 * There is no official CONTEXT structure defined for the SPARC
1825 * architecture, so I just made one up.
1827 * This structure is valid only for 32-bit SPARC architectures,
1828 * not for 64-bit SPARC.
1830 * Note that this structure contains only the 'top-level' registers;
1831 * the rest of the register window chain is not visible.
1833 * The layout follows the Solaris 'prgregset_t' structure.
1837 #define CONTEXT_SPARC 0x10000000
1839 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1840 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1841 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1843 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1845 #define EXCEPTION_READ_FAULT 0
1846 #define EXCEPTION_WRITE_FAULT 1
1847 #define EXCEPTION_EXECUTE_FAULT 8
1849 typedef struct _CONTEXT
1853 /* These are selected by CONTEXT_INTEGER */
1887 /* These are selected by CONTEXT_CONTROL */
1895 /* FIXME: floating point registers missing */
1899 #endif /* __sparc__ */
1901 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1902 #error You need to define a CONTEXT for your CPU
1905 typedef CONTEXT
*PCONTEXT
;
1907 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1912 #define PRODUCT_UNLICENSED 0xABCDABCD
1913 #define PRODUCT_BUSINESS 0x00000006
1914 #define PRODUCT_BUSINESS_N 0x00000010
1915 #define PRODUCT_CLUSTER_SERVER 0x00000012
1916 #define PRODUCT_DATACENTER_SERVER 0x00000008
1917 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1918 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1919 #define PRODUCT_SERVER_V 0x00000025
1920 #define PRODUCT_ENTERPRISE 0x00000004
1921 #define PRODUCT_ENTERPRISE_N 0x0000001B
1922 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1923 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1924 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1925 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1926 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1927 #define PRODUCT_HOME_BASIC 0x00000002
1928 #define PRODUCT_HOME_BASIC_N 0x00000005
1929 #define PRODUCT_HOME_PREMIUM 0x00000003
1930 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1931 #define PRODUCT_HYPERV 0x0000002A
1932 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1933 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1934 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1935 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1936 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1937 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1938 #define PRODUCT_STANDARD_SERVER 0x00000007
1939 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1940 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1941 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1942 #define PRODUCT_STARTER 0x0000000B
1943 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1944 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1945 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1946 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1947 #define PRODUCT_UNDEFINED 0x00000000
1948 #define PRODUCT_ULTIMATE 0x00000001
1949 #define PRODUCT_ULTIMATE_N 0x0000001C
1950 #define PRODUCT_WEB_SERVER 0x00000011
1951 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1958 #define MAKELCID(l, s) (MAKELONG(l, s))
1960 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1961 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1962 #define SUBLANGID(l) ((WORD)(l) >> 10)
1964 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1965 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1967 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1968 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1969 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1970 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1971 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1972 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1973 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
1974 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
1975 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
1978 #define UNREFERENCED_PARAMETER(u) (void)(u)
1979 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1980 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1982 #define LANG_NEUTRAL 0x00
1983 #define LANG_INVARIANT 0x7f
1985 #define LANG_AFRIKAANS 0x36
1986 #define LANG_ALBANIAN 0x1c
1987 #define LANG_ALSATIAN 0x84
1988 #define LANG_AMHARIC 0x5e
1989 #define LANG_ARABIC 0x01
1990 #define LANG_ARMENIAN 0x2b
1991 #define LANG_ASSAMESE 0x4d
1992 #define LANG_AZERI 0x2c
1993 #define LANG_BASHKIR 0x6d
1994 #define LANG_BASQUE 0x2d
1995 #define LANG_BELARUSIAN 0x23
1996 #define LANG_BENGALI 0x45
1997 #define LANG_BOSNIAN 0x1a
1998 #define LANG_BOSNIAN_NEUTRAL 0x781a
1999 #define LANG_BRETON 0x7e
2000 #define LANG_BULGARIAN 0x02
2001 #define LANG_CATALAN 0x03
2002 #define LANG_CHINESE 0x04
2003 #define LANG_CHINESE_SIMPLIFIED 0x0004
2004 #define LANG_CHINESE_TRADITIONAL 0x7c04
2005 #define LANG_CORSICAN 0x83
2006 #define LANG_CROATIAN 0x1a
2007 #define LANG_CZECH 0x05
2008 #define LANG_DANISH 0x06
2009 #define LANG_DARI 0x8c
2010 #define LANG_DIVEHI 0x65
2011 #define LANG_DUTCH 0x13
2012 #define LANG_ENGLISH 0x09
2013 #define LANG_ESTONIAN 0x25
2014 #define LANG_FAEROESE 0x38
2015 #define LANG_FARSI LANG_PERSIAN
2016 #define LANG_FILIPINO 0x64
2017 #define LANG_FINNISH 0x0b
2018 #define LANG_FRENCH 0x0c
2019 #define LANG_FRISIAN 0x62
2020 #define LANG_GALICIAN 0x56
2021 #define LANG_GEORGIAN 0x37
2022 #define LANG_GERMAN 0x07
2023 #define LANG_GREEK 0x08
2024 #define LANG_GREENLANDIC 0x6f
2025 #define LANG_GUJARATI 0x47
2026 #define LANG_HAUSA 0x68
2027 #define LANG_HEBREW 0x0d
2028 #define LANG_HINDI 0x39
2029 #define LANG_HUNGARIAN 0x0e
2030 #define LANG_ICELANDIC 0x0f
2031 #define LANG_IGBO 0x70
2032 #define LANG_INDONESIAN 0x21
2033 #define LANG_INUKTITUT 0x5d
2034 #define LANG_IRISH 0x3c
2035 #define LANG_ITALIAN 0x10
2036 #define LANG_JAPANESE 0x11
2037 #define LANG_KANNADA 0x4b
2038 #define LANG_KASHMIRI 0x60
2039 #define LANG_KAZAK 0x3f
2040 #define LANG_KHMER 0x53
2041 #define LANG_KICHE 0x86
2042 #define LANG_KINYARWANDA 0x87
2043 #define LANG_KONKANI 0x57
2044 #define LANG_KOREAN 0x12
2045 #define LANG_KYRGYZ 0x40
2046 #define LANG_LAO 0x54
2047 #define LANG_LATVIAN 0x26
2048 #define LANG_LITHUANIAN 0x27
2049 #define LANG_LOWER_SORBIAN 0x2e
2050 #define LANG_LUXEMBOURGISH 0x6e
2051 #define LANG_MACEDONIAN 0x2f
2052 #define LANG_MALAY 0x3e
2053 #define LANG_MALAYALAM 0x4c
2054 #define LANG_MALTESE 0x3a
2055 #define LANG_MANIPURI 0x58
2056 #define LANG_MAORI 0x81
2057 #define LANG_MAPUDUNGUN 0x7a
2058 #define LANG_MARATHI 0x4e
2059 #define LANG_MOHAWK 0x7c
2060 #define LANG_MONGOLIAN 0x50
2061 #define LANG_NEPALI 0x61
2062 #define LANG_NORWEGIAN 0x14
2063 #define LANG_OCCITAN 0x82
2064 #define LANG_ORIYA 0x48
2065 #define LANG_PASHTO 0x63
2066 #define LANG_PERSIAN 0x29
2067 #define LANG_POLISH 0x15
2068 #define LANG_PORTUGUESE 0x16
2069 #define LANG_PUNJABI 0x46
2070 #define LANG_QUECHUA 0x6b
2071 #define LANG_ROMANIAN 0x18
2072 #define LANG_ROMANSH 0x17
2073 #define LANG_RUSSIAN 0x19
2074 #define LANG_SAMI 0x3b
2075 #define LANG_SANSKRIT 0x4f
2076 #define LANG_SERBIAN 0x1a
2077 #define LANG_SERBIAN_NEUTRAL 0x7c1a
2078 #define LANG_SINDHI 0x59
2079 #define LANG_SINHALESE 0x5b
2080 #define LANG_SLOVAK 0x1b
2081 #define LANG_SLOVENIAN 0x24
2082 #define LANG_SOTHO 0x6c
2083 #define LANG_SPANISH 0x0a
2084 #define LANG_SWAHILI 0x41
2085 #define LANG_SWEDISH 0x1d
2086 #define LANG_SYRIAC 0x5a
2087 #define LANG_TAJIK 0x28
2088 #define LANG_TAMAZIGHT 0x5f
2089 #define LANG_TAMIL 0x49
2090 #define LANG_TATAR 0x44
2091 #define LANG_TELUGU 0x4a
2092 #define LANG_THAI 0x1e
2093 #define LANG_TIBETAN 0x51
2094 #define LANG_TIGRIGNA 0x73
2095 #define LANG_TSWANA 0x32
2096 #define LANG_TURKISH 0x1f
2097 #define LANG_TURKMEN 0x42
2098 #define LANG_UIGHUR 0x80
2099 #define LANG_UKRAINIAN 0x22
2100 #define LANG_UPPER_SORBIAN 0x2e
2101 #define LANG_URDU 0x20
2102 #define LANG_UZBEK 0x43
2103 #define LANG_VIETNAMESE 0x2a
2104 #define LANG_WELSH 0x52
2105 #define LANG_WOLOF 0x88
2106 #define LANG_XHOSA 0x34
2107 #define LANG_YAKUT 0x85
2108 #define LANG_YI 0x78
2109 #define LANG_YORUBA 0x6a
2110 #define LANG_ZULU 0x35
2112 /* These are documented by the MSDN but are missing from the Windows header */
2113 #define LANG_MALAGASY 0x8d
2115 /* FIXME: these are not defined anywhere */
2116 #define LANG_SUTU 0x30
2117 #define LANG_TSONGA 0x31
2118 #define LANG_VENDA 0x33
2120 /* non standard; keep the number high enough (but < 0xff) */
2121 #define LANG_ESPERANTO 0x8f
2122 #define LANG_WALON 0x90
2123 #define LANG_CORNISH 0x91
2124 #define LANG_GAELIC 0x94
2126 /* Sublanguage definitions */
2127 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
2128 #define SUBLANG_DEFAULT 0x01 /* user default */
2129 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
2130 #define SUBLANG_CUSTOM_DEFAULT 0x03
2131 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
2132 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
2134 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
2135 #define SUBLANG_ALBANIAN_ALBANIA 0x01
2136 #define SUBLANG_ALSATIAN_FRANCE 0x01
2137 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
2138 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
2139 #define SUBLANG_ARABIC_IRAQ 0x02
2140 #define SUBLANG_ARABIC_EGYPT 0x03
2141 #define SUBLANG_ARABIC_LIBYA 0x04
2142 #define SUBLANG_ARABIC_ALGERIA 0x05
2143 #define SUBLANG_ARABIC_MOROCCO 0x06
2144 #define SUBLANG_ARABIC_TUNISIA 0x07
2145 #define SUBLANG_ARABIC_OMAN 0x08
2146 #define SUBLANG_ARABIC_YEMEN 0x09
2147 #define SUBLANG_ARABIC_SYRIA 0x0a
2148 #define SUBLANG_ARABIC_JORDAN 0x0b
2149 #define SUBLANG_ARABIC_LEBANON 0x0c
2150 #define SUBLANG_ARABIC_KUWAIT 0x0d
2151 #define SUBLANG_ARABIC_UAE 0x0e
2152 #define SUBLANG_ARABIC_BAHRAIN 0x0f
2153 #define SUBLANG_ARABIC_QATAR 0x10
2154 #define SUBLANG_ARMENIAN_ARMENIA 0x01
2155 #define SUBLANG_ASSAMESE_INDIA 0x01
2156 #define SUBLANG_AZERI_LATIN 0x01
2157 #define SUBLANG_AZERI_CYRILLIC 0x02
2158 #define SUBLANG_BASHKIR_RUSSIA 0x01
2159 #define SUBLANG_BASQUE_BASQUE 0x01
2160 #define SUBLANG_BELARUSIAN_BELARUS 0x01
2161 #define SUBLANG_BENGALI_INDIA 0x01
2162 #define SUBLANG_BENGALI_BANGLADESH 0x02
2163 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
2164 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
2165 #define SUBLANG_BRETON_FRANCE 0x01
2166 #define SUBLANG_BULGARIAN_BULGARIA 0x01
2167 #define SUBLANG_CATALAN_CATALAN 0x01
2168 #define SUBLANG_CHINESE_TRADITIONAL 0x01
2169 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
2170 #define SUBLANG_CHINESE_HONGKONG 0x03
2171 #define SUBLANG_CHINESE_SINGAPORE 0x04
2172 #define SUBLANG_CHINESE_MACAU 0x05
2173 #define SUBLANG_CORSICAN_FRANCE 0x01
2174 #define SUBLANG_CROATIAN_CROATIA 0x01
2175 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
2176 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
2177 #define SUBLANG_DANISH_DENMARK 0x01
2178 #define SUBLANG_DARI_AFGHANISTAN 0x01
2179 #define SUBLANG_DIVEHI_MALDIVES 0x01
2180 #define SUBLANG_DUTCH 0x01
2181 #define SUBLANG_DUTCH_BELGIAN 0x02
2182 #define SUBLANG_ENGLISH_US 0x01
2183 #define SUBLANG_ENGLISH_UK 0x02
2184 #define SUBLANG_ENGLISH_AUS 0x03
2185 #define SUBLANG_ENGLISH_CAN 0x04
2186 #define SUBLANG_ENGLISH_NZ 0x05
2187 #define SUBLANG_ENGLISH_EIRE 0x06
2188 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
2189 #define SUBLANG_ENGLISH_JAMAICA 0x08
2190 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
2191 #define SUBLANG_ENGLISH_BELIZE 0x0a
2192 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
2193 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
2194 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
2195 #define SUBLANG_ENGLISH_INDIA 0x10
2196 #define SUBLANG_ENGLISH_MALAYSIA 0x11
2197 #define SUBLANG_ENGLISH_SINGAPORE 0x12
2198 #define SUBLANG_ESTONIAN_ESTONIA 0x01
2199 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
2200 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
2201 #define SUBLANG_FINNISH_FINLAND 0x01
2202 #define SUBLANG_FRENCH 0x01
2203 #define SUBLANG_FRENCH_BELGIAN 0x02
2204 #define SUBLANG_FRENCH_CANADIAN 0x03
2205 #define SUBLANG_FRENCH_SWISS 0x04
2206 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
2207 #define SUBLANG_FRENCH_MONACO 0x06
2208 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
2209 #define SUBLANG_GALICIAN_GALICIAN 0x01
2210 #define SUBLANG_GEORGIAN_GEORGIA 0x01
2211 #define SUBLANG_GERMAN 0x01
2212 #define SUBLANG_GERMAN_SWISS 0x02
2213 #define SUBLANG_GERMAN_AUSTRIAN 0x03
2214 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
2215 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
2216 #define SUBLANG_GREEK_GREECE 0x01
2217 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
2218 #define SUBLANG_GUJARATI_INDIA 0x01
2219 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
2220 #define SUBLANG_HEBREW_ISRAEL 0x01
2221 #define SUBLANG_HINDI_INDIA 0x01
2222 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
2223 #define SUBLANG_ICELANDIC_ICELAND 0x01
2224 #define SUBLANG_IGBO_NIGERIA 0x01
2225 #define SUBLANG_INDONESIAN_INDONESIA 0x01
2226 #define SUBLANG_INUKTITUT_CANADA 0x01
2227 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
2228 #define SUBLANG_IRISH_IRELAND 0x02
2229 #define SUBLANG_ITALIAN 0x01
2230 #define SUBLANG_ITALIAN_SWISS 0x02
2231 #define SUBLANG_JAPANESE_JAPAN 0x01
2232 #define SUBLANG_KANNADA_INDIA 0x01
2233 #define SUBLANG_KASHMIRI_SASIA 0x02
2234 #define SUBLANG_KASHMIRI_INDIA 0x02
2235 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
2236 #define SUBLANG_KHMER_CAMBODIA 0x01
2237 #define SUBLANG_KICHE_GUATEMALA 0x01
2238 #define SUBLANG_KINYARWANDA_RWANDA 0X01
2239 #define SUBLANG_KONKANI_INDIA 0x01
2240 #define SUBLANG_KOREAN 0x01
2241 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
2242 #define SUBLANG_LAO_LAO 0x01
2243 #define SUBLANG_LATVIAN_LATVIA 0x01
2244 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
2245 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
2246 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
2247 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
2248 #define SUBLANG_MALAY_MALAYSIA 0x01
2249 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
2250 #define SUBLANG_MALAYALAM_INDIA 0x01
2251 #define SUBLANG_MALTESE_MALTA 0x01
2252 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
2253 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
2254 #define SUBLANG_MARATHI_INDIA 0x01
2255 #define SUBLANG_MOHAWK_MOHAWK 0x01
2256 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
2257 #define SUBLANG_MONGOLIAN_PRC 0x02
2258 #define SUBLANG_NEPALI_INDIA 0x02
2259 #define SUBLANG_NEPALI_NEPAL 0x01
2260 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
2261 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
2262 #define SUBLANG_OCCITAN_FRANCE 0x01
2263 #define SUBLANG_ORIYA_INDIA 0x01
2264 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
2265 #define SUBLANG_PERSIAN_IRAN 0x01
2266 #define SUBLANG_POLISH_POLAND 0x01
2267 #define SUBLANG_PORTUGUESE 0x02
2268 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
2269 #define SUBLANG_PUNJABI_INDIA 0x01
2270 #define SUBLANG_QUECHUA_BOLIVIA 0x01
2271 #define SUBLANG_QUECHUA_ECUADOR 0x02
2272 #define SUBLANG_QUECHUA_PERU 0x03
2273 #define SUBLANG_ROMANIAN_ROMANIA 0x01
2274 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
2275 #define SUBLANG_RUSSIAN_RUSSIA 0x01
2276 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
2277 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
2278 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
2279 #define SUBLANG_SAMI_LULE_NORWAY 0x04
2280 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
2281 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
2282 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
2283 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
2284 #define SUBLANG_SAMI_INARI_FINLAND 0x09
2285 #define SUBLANG_SANSKRIT_INDIA 0x01
2286 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
2287 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
2288 #define SUBLANG_SERBIAN_CROATIA 0x01
2289 #define SUBLANG_SERBIAN_LATIN 0x02
2290 #define SUBLANG_SERBIAN_CYRILLIC 0x03
2291 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
2292 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
2293 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
2294 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
2295 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
2296 #define SUBLANG_SPANISH 0x01
2297 #define SUBLANG_SPANISH_MEXICAN 0x02
2298 #define SUBLANG_SPANISH_MODERN 0x03
2299 #define SUBLANG_SPANISH_GUATEMALA 0x04
2300 #define SUBLANG_SPANISH_COSTA_RICA 0x05
2301 #define SUBLANG_SPANISH_PANAMA 0x06
2302 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
2303 #define SUBLANG_SPANISH_VENEZUELA 0x08
2304 #define SUBLANG_SPANISH_COLOMBIA 0x09
2305 #define SUBLANG_SPANISH_PERU 0x0a
2306 #define SUBLANG_SPANISH_ARGENTINA 0x0b
2307 #define SUBLANG_SPANISH_ECUADOR 0x0c
2308 #define SUBLANG_SPANISH_CHILE 0x0d
2309 #define SUBLANG_SPANISH_URUGUAY 0x0e
2310 #define SUBLANG_SPANISH_PARAGUAY 0x0f
2311 #define SUBLANG_SPANISH_BOLIVIA 0x10
2312 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
2313 #define SUBLANG_SPANISH_HONDURAS 0x12
2314 #define SUBLANG_SPANISH_NICARAGUA 0x13
2315 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
2316 #define SUBLANG_SPANISH_US 0x15
2317 #define SUBLANG_SWAHILI_KENYA 0x01
2318 #define SUBLANG_SWEDISH 0x01
2319 #define SUBLANG_SWEDISH_FINLAND 0x02
2320 #define SUBLANG_SYRIAC_SYRIA 0x01
2321 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
2322 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
2323 #define SUBLANG_TAMIL_INDIA 0x01
2324 #define SUBLANG_TATAR_RUSSIA 0x01
2325 #define SUBLANG_TELUGU_INDIA 0x01
2326 #define SUBLANG_THAI_THAILAND 0x01
2327 #define SUBLANG_TIBETAN_PRC 0x01
2328 #define SUBLANG_TIBETAN_BHUTAN 0x02
2329 #define SUBLANG_TIGRIGNA_ERITREA 0x02
2330 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
2331 #define SUBLANG_TURKISH_TURKEY 0x01
2332 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
2333 #define SUBLANG_UIGHUR_PRC 0x01
2334 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
2335 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
2336 #define SUBLANG_URDU_PAKISTAN 0x01
2337 #define SUBLANG_URDU_INDIA 0x02
2338 #define SUBLANG_UZBEK_LATIN 0x01
2339 #define SUBLANG_UZBEK_CYRILLIC 0x02
2340 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
2341 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
2342 #define SUBLANG_WOLOF_SENEGAL 0x01
2343 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
2344 #define SUBLANG_YAKUT_RUSSIA 0x01
2345 #define SUBLANG_YI_PRC 0x01
2346 #define SUBLANG_YORUBA_NIGERIA 0x01
2347 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
2349 /* These are documented by the MSDN but are missing from the Windows header */
2350 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
2351 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
2352 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
2353 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
2354 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
2355 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
2356 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
2357 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
2359 /* FIXME: these are not defined anywhere */
2360 #define SUBLANG_DUTCH_SURINAM 0x03
2361 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
2362 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
2363 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
2364 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
2365 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
2366 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
2367 #define SUBLANG_GAELIC 0x01
2368 #define SUBLANG_GAELIC_SCOTTISH 0x02
2369 #define SUBLANG_GAELIC_MANX 0x03
2376 #define SORT_DEFAULT 0x0
2377 #define SORT_JAPANESE_XJIS 0x0
2378 #define SORT_JAPANESE_UNICODE 0x1
2379 #define SORT_CHINESE_BIG5 0x0
2380 #define SORT_CHINESE_UNICODE 0x1
2381 #define SORT_KOREAN_KSC 0x0
2382 #define SORT_KOREAN_UNICODE 0x1
2387 * Definitions for IsTextUnicode()
2390 #define IS_TEXT_UNICODE_ASCII16 0x0001
2391 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2392 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2393 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2394 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2395 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2396 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2397 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2398 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2399 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2400 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2401 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2402 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2403 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2404 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2405 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2407 #define MAXIMUM_WAIT_OBJECTS 64
2408 #define MAXIMUM_SUSPEND_COUNT 127
2410 #define WT_EXECUTEDEFAULT 0x00
2411 #define WT_EXECUTEINIOTHREAD 0x01
2412 #define WT_EXECUTEINUITHREAD 0x02
2413 #define WT_EXECUTEINWAITTHREAD 0x04
2414 #define WT_EXECUTEONLYONCE 0x08
2415 #define WT_EXECUTELONGFUNCTION 0x10
2416 #define WT_EXECUTEINTIMERTHREAD 0x20
2417 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2418 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2419 #define WT_EXECUTEINLONGTHREAD 0x10
2420 #define WT_EXECUTEDELETEWAIT 0x08
2421 #define WT_TRANSFER_IMPERSONATION 0x0100
2424 #define EXCEPTION_CONTINUABLE 0
2425 #define EXCEPTION_NONCONTINUABLE 0x01
2428 * The exception record used by Win32 to give additional information
2429 * about exception to exception handlers.
2432 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2434 typedef struct _EXCEPTION_RECORD
2436 DWORD ExceptionCode
;
2437 DWORD ExceptionFlags
;
2438 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2440 PVOID ExceptionAddress
;
2441 DWORD NumberParameters
;
2442 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2443 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2446 * The exception pointers structure passed to exception filters
2447 * in except() and the UnhandledExceptionFilter().
2450 typedef struct _EXCEPTION_POINTERS
2452 PEXCEPTION_RECORD ExceptionRecord
;
2453 PCONTEXT ContextRecord
;
2454 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2458 * The exception frame, used for registering exception handlers
2459 * Win32 cares only about this, but compilers generally emit
2460 * larger exception frames for their own use.
2463 struct _EXCEPTION_REGISTRATION_RECORD
;
2465 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2466 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2468 typedef struct _EXCEPTION_REGISTRATION_RECORD
2470 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2471 PEXCEPTION_HANDLER Handler
;
2472 } EXCEPTION_REGISTRATION_RECORD
;
2475 * function pointer to an exception filter
2478 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2480 typedef struct _NT_TIB
2482 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2490 PVOID ArbitraryUserPointer
;
2491 struct _NT_TIB
*Self
;
2496 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2497 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2500 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2503 #elif defined(__i386__) && defined(_MSC_VER)
2504 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2507 __asm mov eax
, fs
:[0x18];
2511 #elif defined(__x86_64__) && defined(__GNUC__)
2512 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2515 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2518 #elif defined(__x86_64__) && defined (_MSC_VER)
2519 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2522 __asm mov rax
, gs
:[0x30];
2527 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2530 #ifdef NONAMELESSUNION
2531 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2533 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2535 #define GetFiberData() (*(void **)GetCurrentFiber())
2537 #define TLS_MINIMUM_AVAILABLE 64
2540 * File formats definitions
2543 #include <pshpack2.h>
2544 typedef struct _IMAGE_DOS_HEADER
{
2545 WORD e_magic
; /* 00: MZ Header signature */
2546 WORD e_cblp
; /* 02: Bytes on last page of file */
2547 WORD e_cp
; /* 04: Pages in file */
2548 WORD e_crlc
; /* 06: Relocations */
2549 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2550 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2551 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2552 WORD e_ss
; /* 0e: Initial (relative) SS value */
2553 WORD e_sp
; /* 10: Initial SP value */
2554 WORD e_csum
; /* 12: Checksum */
2555 WORD e_ip
; /* 14: Initial IP value */
2556 WORD e_cs
; /* 16: Initial (relative) CS value */
2557 WORD e_lfarlc
; /* 18: File address of relocation table */
2558 WORD e_ovno
; /* 1a: Overlay number */
2559 WORD e_res
[4]; /* 1c: Reserved words */
2560 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2561 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2562 WORD e_res2
[10]; /* 28: Reserved words */
2563 DWORD e_lfanew
; /* 3c: Offset to extended header */
2564 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2565 #include <poppack.h>
2567 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2568 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2569 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2570 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2571 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2572 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2575 * This is the Windows executable (NE) header.
2576 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2578 #include <pshpack2.h>
2581 WORD ne_magic
; /* 00 NE signature 'NE' */
2582 BYTE ne_ver
; /* 02 Linker version number */
2583 BYTE ne_rev
; /* 03 Linker revision number */
2584 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2585 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2586 LONG ne_crc
; /* 08 Checksum */
2587 WORD ne_flags
; /* 0c Flags about segments in this file */
2588 WORD ne_autodata
; /* 0e Automatic data segment number */
2589 WORD ne_heap
; /* 10 Initial size of local heap */
2590 WORD ne_stack
; /* 12 Initial size of stack */
2591 DWORD ne_csip
; /* 14 Initial CS:IP */
2592 DWORD ne_sssp
; /* 18 Initial SS:SP */
2593 WORD ne_cseg
; /* 1c # of entries in segment table */
2594 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2595 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2596 WORD ne_segtab
; /* 22 Offset to segment table */
2597 WORD ne_rsrctab
; /* 24 Offset to resource table */
2598 WORD ne_restab
; /* 26 Offset to resident-name table */
2599 WORD ne_modtab
; /* 28 Offset to module reference table */
2600 WORD ne_imptab
; /* 2a Offset to imported name table */
2601 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2602 WORD ne_cmovent
; /* 30 # of movable entry points */
2603 WORD ne_align
; /* 32 Logical sector alignment shift count */
2604 WORD ne_cres
; /* 34 # of resource segments */
2605 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2606 BYTE ne_flagsothers
; /* 37 Additional information flags */
2607 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2608 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2609 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2610 WORD ne_expver
; /* 3e Expected Windows version number */
2611 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2612 #include <poppack.h>
2614 #include <pshpack2.h>
2615 typedef struct _IMAGE_VXD_HEADER
{
2630 DWORD e32_lastpagesize
;
2631 DWORD e32_fixupsize
;
2648 DWORD e32_impmodcnt
;
2654 DWORD e32_cbnrestab
;
2657 DWORD e32_debuginfo
;
2659 DWORD e32_instpreload
;
2660 DWORD e32_instdemand
;
2663 DWORD e32_winresoff
;
2664 DWORD e32_winreslen
;
2667 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2668 #include <poppack.h>
2670 /* These defines describe the meanings of the bits in the Characteristics
2673 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2674 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2675 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2676 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2677 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2678 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2679 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2680 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2681 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2682 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2683 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2684 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2685 #define IMAGE_FILE_SYSTEM 0x1000
2686 #define IMAGE_FILE_DLL 0x2000
2687 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2688 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2690 /* These are the settings of the Machine field. */
2691 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2692 #define IMAGE_FILE_MACHINE_I860 0x014d
2693 #define IMAGE_FILE_MACHINE_I386 0x014c
2694 #define IMAGE_FILE_MACHINE_R3000 0x0162
2695 #define IMAGE_FILE_MACHINE_R4000 0x0166
2696 #define IMAGE_FILE_MACHINE_R10000 0x0168
2697 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2698 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2699 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2700 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2701 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2702 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2703 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2704 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2705 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2706 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2707 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2708 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2709 #define IMAGE_FILE_MACHINE_IA64 0x0200
2710 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2711 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2712 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2713 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2714 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2715 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2716 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2717 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2718 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2719 #define IMAGE_FILE_MACHINE_M32R 0x9041
2720 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2722 /* Wine extension */
2723 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2725 #define IMAGE_SIZEOF_FILE_HEADER 20
2726 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2727 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2728 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2729 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2730 #define IMAGE_SIZEOF_SHORT_NAME 8
2731 #define IMAGE_SIZEOF_SECTION_HEADER 40
2732 #define IMAGE_SIZEOF_SYMBOL 18
2733 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2734 #define IMAGE_SIZEOF_RELOCATION 10
2735 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2736 #define IMAGE_SIZEOF_LINENUMBER 6
2737 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2739 /* Possible Magic values */
2740 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2741 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2742 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2745 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2746 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2748 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2749 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2752 /* These are indexes into the DataDirectory array */
2753 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2754 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2755 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2756 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2757 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2758 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2759 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2760 #define IMAGE_FILE_DESCRIPTION_STRING 7
2761 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2762 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2763 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2765 /* Directory Entries, indices into the DataDirectory array */
2767 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2768 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2769 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2770 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2771 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2772 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2773 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2774 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2775 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2776 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2777 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2778 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2779 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2780 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2781 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2783 /* Subsystem Values */
2785 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2786 #define IMAGE_SUBSYSTEM_NATIVE 1
2787 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2788 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2789 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2790 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2791 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2792 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2793 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2794 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2795 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2796 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2797 #define IMAGE_SUBSYSTEM_XBOX 14
2798 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2800 /* DLL Characteristics */
2801 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2802 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2803 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2804 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2805 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2806 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2807 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2808 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2810 typedef struct _IMAGE_FILE_HEADER
{
2812 WORD NumberOfSections
;
2813 DWORD TimeDateStamp
;
2814 DWORD PointerToSymbolTable
;
2815 DWORD NumberOfSymbols
;
2816 WORD SizeOfOptionalHeader
;
2817 WORD Characteristics
;
2818 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2820 typedef struct _IMAGE_DATA_DIRECTORY
{
2821 DWORD VirtualAddress
;
2823 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2825 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2827 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2828 WORD Magic
; /* 0x20b */
2829 BYTE MajorLinkerVersion
;
2830 BYTE MinorLinkerVersion
;
2832 DWORD SizeOfInitializedData
;
2833 DWORD SizeOfUninitializedData
;
2834 DWORD AddressOfEntryPoint
;
2836 ULONGLONG ImageBase
;
2837 DWORD SectionAlignment
;
2838 DWORD FileAlignment
;
2839 WORD MajorOperatingSystemVersion
;
2840 WORD MinorOperatingSystemVersion
;
2841 WORD MajorImageVersion
;
2842 WORD MinorImageVersion
;
2843 WORD MajorSubsystemVersion
;
2844 WORD MinorSubsystemVersion
;
2845 DWORD Win32VersionValue
;
2847 DWORD SizeOfHeaders
;
2850 WORD DllCharacteristics
;
2851 ULONGLONG SizeOfStackReserve
;
2852 ULONGLONG SizeOfStackCommit
;
2853 ULONGLONG SizeOfHeapReserve
;
2854 ULONGLONG SizeOfHeapCommit
;
2856 DWORD NumberOfRvaAndSizes
;
2857 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2858 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2860 typedef struct _IMAGE_NT_HEADERS64
{
2862 IMAGE_FILE_HEADER FileHeader
;
2863 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2864 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2866 typedef struct _IMAGE_OPTIONAL_HEADER
{
2868 /* Standard fields */
2870 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2871 BYTE MajorLinkerVersion
;
2872 BYTE MinorLinkerVersion
;
2874 DWORD SizeOfInitializedData
;
2875 DWORD SizeOfUninitializedData
;
2876 DWORD AddressOfEntryPoint
; /* 0x10 */
2880 /* NT additional fields */
2883 DWORD SectionAlignment
; /* 0x20 */
2884 DWORD FileAlignment
;
2885 WORD MajorOperatingSystemVersion
;
2886 WORD MinorOperatingSystemVersion
;
2887 WORD MajorImageVersion
;
2888 WORD MinorImageVersion
;
2889 WORD MajorSubsystemVersion
; /* 0x30 */
2890 WORD MinorSubsystemVersion
;
2891 DWORD Win32VersionValue
;
2893 DWORD SizeOfHeaders
;
2894 DWORD CheckSum
; /* 0x40 */
2896 WORD DllCharacteristics
;
2897 DWORD SizeOfStackReserve
;
2898 DWORD SizeOfStackCommit
;
2899 DWORD SizeOfHeapReserve
; /* 0x50 */
2900 DWORD SizeOfHeapCommit
;
2902 DWORD NumberOfRvaAndSizes
;
2903 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2905 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2907 typedef struct _IMAGE_NT_HEADERS
{
2908 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2909 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2910 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2911 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2914 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2915 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2916 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2917 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2919 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2920 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2921 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2922 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2925 #define IMAGE_SIZEOF_SHORT_NAME 8
2927 typedef struct _IMAGE_SECTION_HEADER
{
2928 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2930 DWORD PhysicalAddress
;
2933 DWORD VirtualAddress
;
2934 DWORD SizeOfRawData
;
2935 DWORD PointerToRawData
;
2936 DWORD PointerToRelocations
;
2937 DWORD PointerToLinenumbers
;
2938 WORD NumberOfRelocations
;
2939 WORD NumberOfLinenumbers
;
2940 DWORD Characteristics
;
2941 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2943 #define IMAGE_SIZEOF_SECTION_HEADER 40
2945 #define IMAGE_FIRST_SECTION(ntheader) \
2946 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2947 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2949 /* These defines are for the Characteristics bitfield. */
2950 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2951 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2952 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2953 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2954 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2955 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2957 #define IMAGE_SCN_CNT_CODE 0x00000020
2958 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2959 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2961 #define IMAGE_SCN_LNK_OTHER 0x00000100
2962 #define IMAGE_SCN_LNK_INFO 0x00000200
2963 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2964 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2965 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2967 /* 0x00002000 - Reserved */
2968 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2969 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2971 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2972 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2973 #define IMAGE_SCN_MEM_16BIT 0x00020000
2974 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2975 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2977 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2978 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2979 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2980 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2981 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2982 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2983 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2984 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2985 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2986 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2987 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2988 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2989 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2990 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2991 /* 0x00F00000 - Unused */
2992 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2994 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2997 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2998 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2999 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3000 #define IMAGE_SCN_MEM_SHARED 0x10000000
3001 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3002 #define IMAGE_SCN_MEM_READ 0x40000000
3003 #define IMAGE_SCN_MEM_WRITE 0x80000000
3005 #include <pshpack2.h>
3007 typedef struct _IMAGE_SYMBOL
{
3017 SHORT SectionNumber
;
3020 BYTE NumberOfAuxSymbols
;
3022 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
3024 #define IMAGE_SIZEOF_SYMBOL 18
3026 typedef struct _IMAGE_LINENUMBER
{
3028 DWORD SymbolTableIndex
;
3029 DWORD VirtualAddress
;
3033 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
3035 #define IMAGE_SIZEOF_LINENUMBER 6
3037 typedef union _IMAGE_AUX_SYMBOL
{
3049 DWORD PointerToLinenumber
;
3050 DWORD PointerToNextFunction
;
3059 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
3063 WORD NumberOfRelocations
;
3064 WORD NumberOfLinenumbers
;
3070 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
3072 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3074 #include <poppack.h>
3076 #define IMAGE_SYM_UNDEFINED (SHORT)0
3077 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3078 #define IMAGE_SYM_DEBUG (SHORT)-2
3080 #define IMAGE_SYM_TYPE_NULL 0x0000
3081 #define IMAGE_SYM_TYPE_VOID 0x0001
3082 #define IMAGE_SYM_TYPE_CHAR 0x0002
3083 #define IMAGE_SYM_TYPE_SHORT 0x0003
3084 #define IMAGE_SYM_TYPE_INT 0x0004
3085 #define IMAGE_SYM_TYPE_LONG 0x0005
3086 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3087 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3088 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3089 #define IMAGE_SYM_TYPE_UNION 0x0009
3090 #define IMAGE_SYM_TYPE_ENUM 0x000A
3091 #define IMAGE_SYM_TYPE_MOE 0x000B
3092 #define IMAGE_SYM_TYPE_BYTE 0x000C
3093 #define IMAGE_SYM_TYPE_WORD 0x000D
3094 #define IMAGE_SYM_TYPE_UINT 0x000E
3095 #define IMAGE_SYM_TYPE_DWORD 0x000F
3096 #define IMAGE_SYM_TYPE_PCODE 0x8000
3098 #define IMAGE_SYM_DTYPE_NULL 0
3099 #define IMAGE_SYM_DTYPE_POINTER 1
3100 #define IMAGE_SYM_DTYPE_FUNCTION 2
3101 #define IMAGE_SYM_DTYPE_ARRAY 3
3103 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3104 #define IMAGE_SYM_CLASS_NULL 0x0000
3105 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3106 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3107 #define IMAGE_SYM_CLASS_STATIC 0x0003
3108 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3109 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3110 #define IMAGE_SYM_CLASS_LABEL 0x0006
3111 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3112 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3113 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3114 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3115 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3116 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3117 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3118 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3119 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3120 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3121 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3122 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3124 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3125 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3126 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3127 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3128 #define IMAGE_SYM_CLASS_FILE 0x0067
3129 #define IMAGE_SYM_CLASS_SECTION 0x0068
3130 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3132 #define N_BTMASK 0x000F
3133 #define N_TMASK 0x0030
3134 #define N_TMASK1 0x00C0
3135 #define N_TMASK2 0x00F0
3139 #define BTYPE(x) ((x) & N_BTMASK)
3142 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3146 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3150 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3154 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3158 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3161 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3164 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3165 #define IMAGE_COMDAT_SELECT_ANY 2
3166 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3167 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3168 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3169 #define IMAGE_COMDAT_SELECT_LARGEST 6
3170 #define IMAGE_COMDAT_SELECT_NEWEST 7
3172 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3173 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3174 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3176 /* Export module directory */
3178 typedef struct _IMAGE_EXPORT_DIRECTORY
{
3179 DWORD Characteristics
;
3180 DWORD TimeDateStamp
;
3185 DWORD NumberOfFunctions
;
3186 DWORD NumberOfNames
;
3187 DWORD AddressOfFunctions
;
3188 DWORD AddressOfNames
;
3189 DWORD AddressOfNameOrdinals
;
3190 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3192 /* Import name entry */
3193 typedef struct _IMAGE_IMPORT_BY_NAME
{
3196 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3198 #include <pshpack8.h>
3200 typedef struct _IMAGE_THUNK_DATA64
{
3202 ULONGLONG ForwarderString
;
3205 ULONGLONG AddressOfData
;
3207 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3208 #include <poppack.h>
3210 typedef struct _IMAGE_THUNK_DATA32
{
3212 DWORD ForwarderString
;
3215 DWORD AddressOfData
;
3217 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3219 /* Import module directory */
3221 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3223 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3224 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3226 DWORD TimeDateStamp
; /* 0 if not bound,
3227 * -1 if bound, and real date\time stamp
3228 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3230 * otherwise date/time stamp of DLL bound to
3233 DWORD ForwarderChain
; /* -1 if no forwarders */
3235 /* RVA to IAT (if bound this IAT has actual addresses) */
3237 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3239 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3240 #define IMAGE_ORDINAL_FLAG32 0x80000000
3241 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3242 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3243 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3244 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3247 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3248 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3249 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3250 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3251 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3253 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3254 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3255 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3256 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3257 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3260 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3262 DWORD TimeDateStamp
;
3263 WORD OffsetModuleName
;
3264 WORD NumberOfModuleForwarderRefs
;
3265 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3266 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3268 typedef struct _IMAGE_BOUND_FORWARDER_REF
3270 DWORD TimeDateStamp
;
3271 WORD OffsetModuleName
;
3273 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3275 typedef struct _IMAGE_BASE_RELOCATION
3277 DWORD VirtualAddress
;
3279 /* WORD TypeOffset[1]; */
3280 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3282 #include <pshpack2.h>
3284 typedef struct _IMAGE_RELOCATION
3287 DWORD VirtualAddress
;
3290 DWORD SymbolTableIndex
;
3292 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3294 #include <poppack.h>
3296 #define IMAGE_SIZEOF_RELOCATION 10
3298 /* generic relocation types */
3299 #define IMAGE_REL_BASED_ABSOLUTE 0
3300 #define IMAGE_REL_BASED_HIGH 1
3301 #define IMAGE_REL_BASED_LOW 2
3302 #define IMAGE_REL_BASED_HIGHLOW 3
3303 #define IMAGE_REL_BASED_HIGHADJ 4
3304 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3305 #define IMAGE_REL_BASED_SECTION 6
3306 #define IMAGE_REL_BASED_REL 7
3307 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3308 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3309 #define IMAGE_REL_BASED_DIR64 10
3310 #define IMAGE_REL_BASED_HIGH3ADJ 11
3312 /* I386 relocation types */
3313 #define IMAGE_REL_I386_ABSOLUTE 0
3314 #define IMAGE_REL_I386_DIR16 1
3315 #define IMAGE_REL_I386_REL16 2
3316 #define IMAGE_REL_I386_DIR32 6
3317 #define IMAGE_REL_I386_DIR32NB 7
3318 #define IMAGE_REL_I386_SEG12 9
3319 #define IMAGE_REL_I386_SECTION 10
3320 #define IMAGE_REL_I386_SECREL 11
3321 #define IMAGE_REL_I386_TOKEN 12
3322 #define IMAGE_REL_I386_SECREL7 13
3323 #define IMAGE_REL_I386_REL32 20
3325 /* MIPS relocation types */
3326 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3327 #define IMAGE_REL_MIPS_REFHALF 0x0001
3328 #define IMAGE_REL_MIPS_REFWORD 0x0002
3329 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3330 #define IMAGE_REL_MIPS_REFHI 0x0004
3331 #define IMAGE_REL_MIPS_REFLO 0x0005
3332 #define IMAGE_REL_MIPS_GPREL 0x0006
3333 #define IMAGE_REL_MIPS_LITERAL 0x0007
3334 #define IMAGE_REL_MIPS_SECTION 0x000A
3335 #define IMAGE_REL_MIPS_SECREL 0x000B
3336 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3337 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3338 #define IMAGE_REL_MIPS_TOKEN 0x000E
3339 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3340 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3341 #define IMAGE_REL_MIPS_PAIR 0x0025
3343 /* ALPHA relocation types */
3344 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3345 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3346 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3347 #define IMAGE_REL_ALPHA_GPREL 0x0003
3348 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3349 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3350 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3351 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3352 #define IMAGE_REL_ALPHA_HINT 0x0008
3353 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3354 #define IMAGE_REL_ALPHA_REFHI 0x000A
3355 #define IMAGE_REL_ALPHA_REFLO 0x000B
3356 #define IMAGE_REL_ALPHA_PAIR 0x000C
3357 #define IMAGE_REL_ALPHA_MATCH 0x000D
3358 #define IMAGE_REL_ALPHA_SECTION 0x000E
3359 #define IMAGE_REL_ALPHA_SECREL 0x000F
3360 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3361 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3362 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3363 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3364 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3365 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3366 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3367 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3369 /* PowerPC relocation types */
3370 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3371 #define IMAGE_REL_PPC_ADDR64 0x0001
3372 #define IMAGE_REL_PPC_ADDR 0x0002
3373 #define IMAGE_REL_PPC_ADDR24 0x0003
3374 #define IMAGE_REL_PPC_ADDR16 0x0004
3375 #define IMAGE_REL_PPC_ADDR14 0x0005
3376 #define IMAGE_REL_PPC_REL24 0x0006
3377 #define IMAGE_REL_PPC_REL14 0x0007
3378 #define IMAGE_REL_PPC_TOCREL16 0x0008
3379 #define IMAGE_REL_PPC_TOCREL14 0x0009
3380 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3381 #define IMAGE_REL_PPC_SECREL 0x000B
3382 #define IMAGE_REL_PPC_SECTION 0x000C
3383 #define IMAGE_REL_PPC_IFGLUE 0x000D
3384 #define IMAGE_REL_PPC_IMGLUE 0x000E
3385 #define IMAGE_REL_PPC_SECREL16 0x000F
3386 #define IMAGE_REL_PPC_REFHI 0x0010
3387 #define IMAGE_REL_PPC_REFLO 0x0011
3388 #define IMAGE_REL_PPC_PAIR 0x0012
3389 #define IMAGE_REL_PPC_SECRELLO 0x0013
3390 #define IMAGE_REL_PPC_SECRELHI 0x0014
3391 #define IMAGE_REL_PPC_GPREL 0x0015
3392 #define IMAGE_REL_PPC_TOKEN 0x0016
3393 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3395 #define IMAGE_REL_PPC_NEG 0x0100
3396 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3397 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3398 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3400 /* SH3 ? relocation type */
3401 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3402 #define IMAGE_REL_SH3_DIRECT16 0x0001
3403 #define IMAGE_REL_SH3_DIRECT 0x0002
3404 #define IMAGE_REL_SH3_DIRECT8 0x0003
3405 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3406 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3407 #define IMAGE_REL_SH3_DIRECT4 0x0006
3408 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3409 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3410 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3411 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3412 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3413 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3414 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3415 #define IMAGE_REL_SH3_SECTION 0x000E
3416 #define IMAGE_REL_SH3_SECREL 0x000F
3417 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3418 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3419 #define IMAGE_REL_SH3_TOKEN 0x0012
3421 /* ARM (Archimedes?) relocation types */
3422 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3423 #define IMAGE_REL_ARM_ADDR 0x0001
3424 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3425 #define IMAGE_REL_ARM_BRANCH24 0x0003
3426 #define IMAGE_REL_ARM_BRANCH11 0x0004
3427 #define IMAGE_REL_ARM_TOKEN 0x0005
3428 #define IMAGE_REL_ARM_GPREL12 0x0006
3429 #define IMAGE_REL_ARM_GPREL7 0x0007
3430 #define IMAGE_REL_ARM_BLX24 0x0008
3431 #define IMAGE_REL_ARM_BLX11 0x0009
3432 #define IMAGE_REL_ARM_SECTION 0x000E
3433 #define IMAGE_REL_ARM_SECREL 0x000F
3435 /* IA64 relocation types */
3436 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3437 #define IMAGE_REL_IA64_IMM14 0x0001
3438 #define IMAGE_REL_IA64_IMM22 0x0002
3439 #define IMAGE_REL_IA64_IMM64 0x0003
3440 #define IMAGE_REL_IA64_DIR 0x0004
3441 #define IMAGE_REL_IA64_DIR64 0x0005
3442 #define IMAGE_REL_IA64_PCREL21B 0x0006
3443 #define IMAGE_REL_IA64_PCREL21M 0x0007
3444 #define IMAGE_REL_IA64_PCREL21F 0x0008
3445 #define IMAGE_REL_IA64_GPREL22 0x0009
3446 #define IMAGE_REL_IA64_LTOFF22 0x000A
3447 #define IMAGE_REL_IA64_SECTION 0x000B
3448 #define IMAGE_REL_IA64_SECREL22 0x000C
3449 #define IMAGE_REL_IA64_SECREL64I 0x000D
3450 #define IMAGE_REL_IA64_SECREL 0x000E
3451 #define IMAGE_REL_IA64_LTOFF64 0x000F
3452 #define IMAGE_REL_IA64_DIR32NB 0x0010
3453 #define IMAGE_REL_IA64_SREL14 0x0011
3454 #define IMAGE_REL_IA64_SREL22 0x0012
3455 #define IMAGE_REL_IA64_SREL32 0x0013
3456 #define IMAGE_REL_IA64_UREL32 0x0014
3457 #define IMAGE_REL_IA64_PCREL60X 0x0015
3458 #define IMAGE_REL_IA64_PCREL60B 0x0016
3459 #define IMAGE_REL_IA64_PCREL60F 0x0017
3460 #define IMAGE_REL_IA64_PCREL60I 0x0018
3461 #define IMAGE_REL_IA64_PCREL60M 0x0019
3462 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3463 #define IMAGE_REL_IA64_TOKEN 0x001B
3464 #define IMAGE_REL_IA64_GPREL32 0x001C
3465 #define IMAGE_REL_IA64_ADDEND 0x001F
3467 /* AMD64 relocation types */
3468 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3469 #define IMAGE_REL_AMD64_ADDR64 0x0001
3470 #define IMAGE_REL_AMD64_ADDR32 0x0002
3471 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3472 #define IMAGE_REL_AMD64_REL32 0x0004
3473 #define IMAGE_REL_AMD64_REL32_1 0x0005
3474 #define IMAGE_REL_AMD64_REL32_2 0x0006
3475 #define IMAGE_REL_AMD64_REL32_3 0x0007
3476 #define IMAGE_REL_AMD64_REL32_4 0x0008
3477 #define IMAGE_REL_AMD64_REL32_5 0x0009
3478 #define IMAGE_REL_AMD64_SECTION 0x000A
3479 #define IMAGE_REL_AMD64_SECREL 0x000B
3480 #define IMAGE_REL_AMD64_SECREL7 0x000C
3481 #define IMAGE_REL_AMD64_TOKEN 0x000D
3482 #define IMAGE_REL_AMD64_SREL32 0x000E
3483 #define IMAGE_REL_AMD64_PAIR 0x000F
3484 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3486 /* archive format */
3488 #define IMAGE_ARCHIVE_START_SIZE 8
3489 #define IMAGE_ARCHIVE_START "!<arch>\n"
3490 #define IMAGE_ARCHIVE_END "`\n"
3491 #define IMAGE_ARCHIVE_PAD "\n"
3492 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3493 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3495 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3504 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3506 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3508 typedef struct _IMPORT_OBJECT_HEADER
3514 DWORD TimeDateStamp
;
3524 } IMPORT_OBJECT_HEADER
;
3526 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3528 typedef enum IMPORT_OBJECT_TYPE
3530 IMPORT_OBJECT_CODE
= 0,
3531 IMPORT_OBJECT_DATA
= 1,
3532 IMPORT_OBJECT_CONST
= 2
3533 } IMPORT_OBJECT_TYPE
;
3535 typedef enum IMPORT_OBJECT_NAME_TYPE
3537 IMPORT_OBJECT_ORDINAL
= 0,
3538 IMPORT_OBJECT_NAME
= 1,
3539 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3540 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3541 } IMPORT_OBJECT_NAME_TYPE
;
3543 typedef struct _ANON_OBJECT_HEADER
3549 DWORD TimeDateStamp
;
3552 } ANON_OBJECT_HEADER
;
3555 * Resource directory stuff
3557 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3558 DWORD Characteristics
;
3559 DWORD TimeDateStamp
;
3562 WORD NumberOfNamedEntries
;
3563 WORD NumberOfIdEntries
;
3564 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3565 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3567 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3568 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3570 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3573 #ifdef BITFIELDS_BIGENDIAN
3574 unsigned NameIsString
:1;
3575 unsigned NameOffset
:31;
3577 unsigned NameOffset
:31;
3578 unsigned NameIsString
:1;
3583 #ifdef WORDS_BIGENDIAN
3595 #ifdef BITFIELDS_BIGENDIAN
3596 unsigned DataIsDirectory
:1;
3597 unsigned OffsetToDirectory
:31;
3599 unsigned OffsetToDirectory
:31;
3600 unsigned DataIsDirectory
:1;
3604 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3607 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3609 CHAR NameString
[ 1 ];
3610 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3612 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3614 WCHAR NameString
[ 1 ];
3615 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3617 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3622 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3625 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3626 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3629 typedef struct _IMAGE_TLS_DIRECTORY64
{
3630 ULONGLONG StartAddressOfRawData
;
3631 ULONGLONG EndAddressOfRawData
;
3632 ULONGLONG AddressOfIndex
;
3633 ULONGLONG AddressOfCallBacks
;
3634 DWORD SizeOfZeroFill
;
3635 DWORD Characteristics
;
3636 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3638 typedef struct _IMAGE_TLS_DIRECTORY32
{
3639 DWORD StartAddressOfRawData
;
3640 DWORD EndAddressOfRawData
;
3641 DWORD AddressOfIndex
;
3642 DWORD AddressOfCallBacks
;
3643 DWORD SizeOfZeroFill
;
3644 DWORD Characteristics
;
3645 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3648 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3649 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3651 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3652 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3655 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3656 DWORD Characteristics
;
3657 DWORD TimeDateStamp
;
3662 DWORD AddressOfRawData
;
3663 DWORD PointerToRawData
;
3664 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3666 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3667 #define IMAGE_DEBUG_TYPE_COFF 1
3668 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3669 #define IMAGE_DEBUG_TYPE_FPO 3
3670 #define IMAGE_DEBUG_TYPE_MISC 4
3671 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3672 #define IMAGE_DEBUG_TYPE_FIXUP 6
3673 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3674 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3675 #define IMAGE_DEBUG_TYPE_BORLAND 9
3676 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3678 typedef enum ReplacesCorHdrNumericDefines
3680 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3681 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3682 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3683 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3684 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3686 COR_VERSION_MAJOR_V2
= 2,
3687 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3688 COR_VERSION_MINOR
= 0,
3689 COR_DELETED_NAME_LENGTH
= 8,
3690 COR_VTABLEGAP_NAME_LENGTH
= 8,
3692 NATIVE_TYPE_MAX_CB
= 1,
3693 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3695 IMAGE_COR_MIH_METHODRVA
= 0x01,
3696 IMAGE_COR_MIH_EHRVA
= 0x02,
3697 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3699 COR_VTABLE_32BIT
= 0x01,
3700 COR_VTABLE_64BIT
= 0x02,
3701 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3702 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3704 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3706 MAX_CLASS_NAME
= 1024,
3707 MAX_PACKAGE_NAME
= 1024,
3708 } ReplacesCorHdrNumericDefines
;
3710 typedef struct IMAGE_COR20_HEADER
3713 WORD MajorRuntimeVersion
;
3714 WORD MinorRuntimeVersion
;
3716 IMAGE_DATA_DIRECTORY MetaData
;
3718 DWORD EntryPointToken
;
3720 IMAGE_DATA_DIRECTORY Resources
;
3721 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3722 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3723 IMAGE_DATA_DIRECTORY VTableFixups
;
3724 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3725 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3727 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3729 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3730 DWORD NumberOfSymbols
;
3731 DWORD LvaToFirstSymbol
;
3732 DWORD NumberOfLinenumbers
;
3733 DWORD LvaToFirstLinenumber
;
3734 DWORD RvaToFirstByteOfCode
;
3735 DWORD RvaToLastByteOfCode
;
3736 DWORD RvaToFirstByteOfData
;
3737 DWORD RvaToLastByteOfData
;
3738 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3741 #define FRAME_TRAP 1
3743 #define FRAME_NONFPO 3
3745 typedef struct _FPO_DATA
{
3756 } FPO_DATA
, *PFPO_DATA
;
3758 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
3760 DWORD TimeDateStamp
;
3763 DWORD GlobalFlagsClear
;
3764 DWORD GlobalFlagsSet
;
3765 DWORD CriticalSectionDefaultTimeout
;
3766 DWORD DeCommitFreeBlockThreshold
;
3767 DWORD DeCommitTotalFreeThreshold
;
3768 PVOID LockPrefixTable
;
3769 DWORD MaximumAllocationSize
;
3770 DWORD VirtualMemoryThreshold
;
3771 DWORD ProcessHeapFlags
;
3772 DWORD ProcessAffinityMask
;
3776 DWORD SecurityCookie
;
3777 DWORD SEHandlerTable
;
3778 DWORD SEHandlerCount
;
3779 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
3781 typedef struct _IMAGE_FUNCTION_ENTRY
{
3782 DWORD StartingAddress
;
3783 DWORD EndingAddress
;
3784 DWORD EndOfPrologue
;
3785 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3787 #define IMAGE_DEBUG_MISC_EXENAME 1
3789 typedef struct _IMAGE_DEBUG_MISC
{
3795 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3797 /* This is the structure that appears at the very start of a .DBG file. */
3799 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3803 WORD Characteristics
;
3804 DWORD TimeDateStamp
;
3808 DWORD NumberOfSections
;
3809 DWORD ExportedNamesSize
;
3810 DWORD DebugDirectorySize
;
3811 DWORD SectionAlignment
;
3812 DWORD Reserved
[ 2 ];
3813 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3815 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3818 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3822 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3823 #define MESSAGE_RESOURCE_UNICODE 0x0001
3825 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3828 DWORD OffsetToEntries
;
3829 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3831 typedef struct tagMESSAGE_RESOURCE_DATA
{
3832 DWORD NumberOfBlocks
;
3833 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3834 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3837 * Here follows typedefs for security and tokens.
3841 * First a constant for the following typedefs.
3844 #define ANYSIZE_ARRAY 1
3846 /* FIXME: Orphan. What does it point to? */
3847 typedef PVOID PACCESS_TOKEN
;
3848 typedef PVOID PSECURITY_DESCRIPTOR
;
3851 typedef enum _TOKEN_ELEVATION_TYPE
{
3852 TokenElevationTypeDefault
= 1,
3853 TokenElevationTypeFull
,
3854 TokenElevationTypeLimited
3855 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
3858 * TOKEN_INFORMATION_CLASS
3861 typedef enum _TOKEN_INFORMATION_CLASS
{
3870 TokenImpersonationLevel
,
3872 TokenRestrictedSids
,
3874 TokenGroupsAndPrivileges
,
3875 TokenSessionReference
,
3882 TokenHasRestrictions
,
3883 TokenAccessInformation
,
3884 TokenVirtualizationAllowed
,
3885 TokenVirtualizationEnabled
,
3886 TokenIntegrityLevel
,
3888 TokenMandatoryPolicy
,
3891 } TOKEN_INFORMATION_CLASS
;
3893 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3894 #define TOKEN_ADJUST_GROUPS 0x0040
3895 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3896 #define TOKEN_ADJUST_SESSIONID 0x0100
3897 #define TOKEN_ASSIGN_PRIMARY 0x0001
3898 #define TOKEN_DUPLICATE 0x0002
3899 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3900 #define TOKEN_IMPERSONATE 0x0004
3901 #define TOKEN_QUERY 0x0008
3902 #define TOKEN_QUERY_SOURCE 0x0010
3903 #define TOKEN_ADJUST_DEFAULT 0x0080
3904 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3905 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3906 TOKEN_ADJUST_PRIVILEGES | \
3907 TOKEN_ADJUST_GROUPS | \
3908 TOKEN_ADJUST_DEFAULT )
3909 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3910 TOKEN_ASSIGN_PRIMARY | \
3912 TOKEN_IMPERSONATE | \
3914 TOKEN_QUERY_SOURCE | \
3915 TOKEN_ADJUST_PRIVILEGES | \
3916 TOKEN_ADJUST_GROUPS | \
3917 TOKEN_ADJUST_SESSIONID | \
3918 TOKEN_ADJUST_DEFAULT )
3920 #ifndef _SECURITY_DEFINED
3921 #define _SECURITY_DEFINED
3924 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3926 typedef struct _GENERIC_MAPPING
{
3927 ACCESS_MASK GenericRead
;
3928 ACCESS_MASK GenericWrite
;
3929 ACCESS_MASK GenericExecute
;
3930 ACCESS_MASK GenericAll
;
3931 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3933 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3934 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3937 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3938 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3942 typedef struct _SID
{
3944 BYTE SubAuthorityCount
;
3945 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3946 DWORD SubAuthority
[1];
3948 #endif /* !defined(SID_DEFINED) */
3950 #define SID_REVISION (1) /* Current revision */
3951 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3952 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3954 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3960 #define ACL_REVISION1 1
3961 #define ACL_REVISION2 2
3962 #define ACL_REVISION3 3
3963 #define ACL_REVISION4 4
3965 #define MIN_ACL_REVISION ACL_REVISION2
3966 #define MAX_ACL_REVISION ACL_REVISION4
3968 #define ACL_REVISION 2
3970 typedef struct _ACL
{
3978 typedef enum _ACL_INFORMATION_CLASS
3980 AclRevisionInformation
= 1,
3982 } ACL_INFORMATION_CLASS
;
3984 typedef struct _ACL_REVISION_INFORMATION
3987 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
3989 typedef struct _ACL_SIZE_INFORMATION
3992 DWORD AclBytesInUse
;
3994 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
3996 /* SECURITY_DESCRIPTOR */
3997 #define SECURITY_DESCRIPTOR_REVISION 1
3998 #define SECURITY_DESCRIPTOR_REVISION1 1
4004 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
4005 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
4006 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
4007 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
4008 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
4009 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
4010 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
4011 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
4012 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
4013 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
4014 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
4015 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
4016 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
4017 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
4018 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
4019 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
4020 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
4021 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
4022 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
4023 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
4024 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
4025 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
4026 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
4027 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
4028 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
4029 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
4030 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
4031 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
4032 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
4034 #define SE_GROUP_MANDATORY 0x00000001
4035 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4036 #define SE_GROUP_ENABLED 0x00000004
4037 #define SE_GROUP_OWNER 0x00000008
4038 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4039 #define SE_GROUP_LOGON_ID 0xC0000000
4040 #define SE_GROUP_RESOURCE 0x20000000
4042 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4043 #define SE_PRIVILEGE_ENABLED 0x00000002
4044 #define SE_PRIVILEGE_REMOVE 0x00000004
4045 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4047 #define PRIVILEGE_SET_ALL_NECESSARY 1
4049 #define SE_OWNER_DEFAULTED 0x00000001
4050 #define SE_GROUP_DEFAULTED 0x00000002
4051 #define SE_DACL_PRESENT 0x00000004
4052 #define SE_DACL_DEFAULTED 0x00000008
4053 #define SE_SACL_PRESENT 0x00000010
4054 #define SE_SACL_DEFAULTED 0x00000020
4055 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4056 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4057 #define SE_DACL_AUTO_INHERITED 0x00000400
4058 #define SE_SACL_AUTO_INHERITED 0x00000800
4059 #define SE_DACL_PROTECTED 0x00001000
4060 #define SE_SACL_PROTECTED 0x00002000
4061 #define SE_RM_CONTROL_VALID 0x00004000
4062 #define SE_SELF_RELATIVE 0x00008000
4064 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4065 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4067 /* The security descriptor structure */
4071 SECURITY_DESCRIPTOR_CONTROL Control
;
4076 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4081 SECURITY_DESCRIPTOR_CONTROL Control
;
4086 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4088 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4090 #endif /* _SECURITY_DEFINED */
4093 * SID_AND_ATTRIBUTES
4096 typedef struct _SID_AND_ATTRIBUTES
{
4099 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4101 /* security entities */
4102 #define SECURITY_NULL_RID (0x00000000L)
4103 #define SECURITY_WORLD_RID (0x00000000L)
4104 #define SECURITY_LOCAL_RID (0X00000000L)
4106 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4109 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4112 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4115 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4116 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
4117 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
4118 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
4119 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
4122 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4125 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4126 #define SECURITY_DIALUP_RID 0x00000001L
4127 #define SECURITY_NETWORK_RID 0x00000002L
4128 #define SECURITY_BATCH_RID 0x00000003L
4129 #define SECURITY_INTERACTIVE_RID 0x00000004L
4130 #define SECURITY_LOGON_IDS_RID 0x00000005L
4131 #define SECURITY_SERVICE_RID 0x00000006L
4132 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
4133 #define SECURITY_PROXY_RID 0x00000008L
4134 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
4135 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4136 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
4137 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
4138 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
4139 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
4140 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
4141 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
4142 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
4143 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
4144 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
4145 #define SECURITY_NT_NON_UNIQUE 0x00000015L
4146 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
4148 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
4149 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
4150 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
4151 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
4152 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
4153 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
4154 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
4156 #define FOREST_USER_RID_MAX 0x000001F3L
4157 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
4158 #define DOMAIN_USER_RID_GUEST 0x000001F5L
4159 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
4160 #define DOMAIN_USER_RID_MAX 0x000003E7L
4162 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
4163 #define DOMAIN_GROUP_RID_USERS 0x00000201L
4164 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
4165 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
4166 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
4167 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
4168 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
4169 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
4170 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
4172 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4173 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
4174 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
4175 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
4176 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
4177 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
4178 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
4180 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
4181 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
4182 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
4183 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
4185 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
4186 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
4187 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
4188 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
4190 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
4191 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
4192 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
4193 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
4194 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
4195 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
4197 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
4198 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
4199 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
4200 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
4201 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
4203 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4205 #define SECURITY_PACKAGE_RID_COUNT 2L
4206 #define SECURITY_LOGON_IDS_RID_COUNT 3L
4212 WinCreatorOwnerSid
= 3,
4213 WinCreatorGroupSid
= 4,
4214 WinCreatorOwnerServerSid
= 5,
4215 WinCreatorGroupServerSid
= 6,
4216 WinNtAuthoritySid
= 7,
4220 WinInteractiveSid
= 11,
4222 WinAnonymousSid
= 13,
4224 WinEnterpriseControllersSid
= 15,
4226 WinAuthenticatedUserSid
= 17,
4227 WinRestrictedCodeSid
= 18,
4228 WinTerminalServerSid
= 19,
4229 WinRemoteLogonIdSid
= 20,
4230 WinLogonIdsSid
= 21,
4231 WinLocalSystemSid
= 22,
4232 WinLocalServiceSid
= 23,
4233 WinNetworkServiceSid
= 24,
4234 WinBuiltinDomainSid
= 25,
4235 WinBuiltinAdministratorsSid
= 26,
4236 WinBuiltinUsersSid
= 27,
4237 WinBuiltinGuestsSid
= 28,
4238 WinBuiltinPowerUsersSid
= 29,
4239 WinBuiltinAccountOperatorsSid
= 30,
4240 WinBuiltinSystemOperatorsSid
= 31,
4241 WinBuiltinPrintOperatorsSid
= 32,
4242 WinBuiltinBackupOperatorsSid
= 33,
4243 WinBuiltinReplicatorSid
= 34,
4244 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4245 WinBuiltinRemoteDesktopUsersSid
= 36,
4246 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4247 WinAccountAdministratorSid
= 38,
4248 WinAccountGuestSid
= 39,
4249 WinAccountKrbtgtSid
= 40,
4250 WinAccountDomainAdminsSid
= 41,
4251 WinAccountDomainUsersSid
= 42,
4252 WinAccountDomainGuestsSid
= 43,
4253 WinAccountComputersSid
= 44,
4254 WinAccountControllersSid
= 45,
4255 WinAccountCertAdminsSid
= 46,
4256 WinAccountSchemaAdminsSid
= 47,
4257 WinAccountEnterpriseAdminsSid
= 48,
4258 WinAccountPolicyAdminsSid
= 49,
4259 WinAccountRasAndIasServersSid
= 50,
4260 WinNTLMAuthenticationSid
= 51,
4261 WinDigestAuthenticationSid
= 52,
4262 WinSChannelAuthenticationSid
= 53,
4263 WinThisOrganizationSid
= 54,
4264 WinOtherOrganizationSid
= 55,
4265 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4266 WinBuiltinPerfMonitoringUsersSid
= 57,
4267 WinBuiltinPerfLoggingUsersSid
= 58,
4268 WinBuiltinAuthorizationAccessSid
= 59,
4269 WinBuiltinTerminalServerLicenseServersSid
= 60,
4270 WinBuiltinDCOMUsersSid
= 61,
4271 WinBuiltinIUsersSid
= 62,
4273 WinBuiltinCryptoOperatorsSid
= 64,
4274 WinUntrustedLabelSid
= 65,
4275 WinLowLabelSid
= 66,
4276 WinMediumLabelSid
= 67,
4277 WinHighLabelSid
= 68,
4278 WinSystemLabelSid
= 69,
4279 WinWriteRestrictedCodeSid
= 70,
4280 WinCreatorOwnerRightsSid
= 71,
4281 WinCacheablePrincipalsGroupSid
= 72,
4282 WinNonCacheablePrincipalsGroupSid
= 73,
4283 WinEnterpriseReadonlyControllersSid
= 74,
4284 WinAccountReadonlyControllersSid
= 75,
4285 WinBuiltinEventLogReadersGroup
= 76,
4286 WinNewEnterpriseReadonlyControllersSid
= 77,
4287 WinBuiltinCertSvcDComAccessGroup
= 78,
4288 WinMediumPlusLabelSid
= 79,
4289 WinLocalLogonSid
= 80,
4290 WinConsoleLogonSid
= 81,
4291 WinThisOrganizationCertificateSid
= 82,
4292 } WELL_KNOWN_SID_TYPE
;
4298 typedef struct _TOKEN_USER
{
4299 SID_AND_ATTRIBUTES User
;
4300 } TOKEN_USER
, *PTOKEN_USER
;
4306 typedef struct _TOKEN_GROUPS
{
4308 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4309 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4312 * LUID_AND_ATTRIBUTES
4315 typedef union _LARGE_INTEGER
{
4317 #ifdef WORDS_BIGENDIAN
4325 #ifndef NONAMELESSSTRUCT
4327 #ifdef WORDS_BIGENDIAN
4337 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4339 typedef union _ULARGE_INTEGER
{
4341 #ifdef WORDS_BIGENDIAN
4349 #ifndef NONAMELESSSTRUCT
4351 #ifdef WORDS_BIGENDIAN
4361 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4364 * Locally Unique Identifier
4367 typedef struct _LUID
{
4372 #include <pshpack4.h>
4373 typedef struct _LUID_AND_ATTRIBUTES
{
4376 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4377 #include <poppack.h>
4383 typedef struct _PRIVILEGE_SET
{
4384 DWORD PrivilegeCount
;
4386 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4387 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4393 typedef struct _TOKEN_PRIVILEGES
{
4394 DWORD PrivilegeCount
;
4395 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4396 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4402 typedef struct _TOKEN_OWNER
{
4404 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4407 * TOKEN_PRIMARY_GROUP
4410 typedef struct _TOKEN_PRIMARY_GROUP
{
4412 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4416 * TOKEN_DEFAULT_DACL
4419 typedef struct _TOKEN_DEFAULT_DACL
{
4421 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4427 #define TOKEN_SOURCE_LENGTH 8
4429 typedef struct _TOKEN_SOURCE
{
4430 char SourceName
[TOKEN_SOURCE_LENGTH
];
4431 LUID SourceIdentifier
;
4432 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4438 typedef enum tagTOKEN_TYPE
{
4444 * SECURITY_IMPERSONATION_LEVEL
4447 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4449 SecurityIdentification
,
4450 SecurityImpersonation
,
4452 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4454 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4455 #define SECURITY_STATIC_TRACKING (FALSE)
4457 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4458 * PSECURITY_CONTEXT_TRACKING_MODE
;
4460 * Quality of Service
4463 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4465 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4466 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4467 BOOLEAN EffectiveOnly
;
4468 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4474 #include <pshpack4.h>
4475 typedef struct _TOKEN_STATISTICS
{
4477 LUID AuthenticationId
;
4478 LARGE_INTEGER ExpirationTime
;
4479 TOKEN_TYPE TokenType
;
4480 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4481 DWORD DynamicCharged
;
4482 DWORD DynamicAvailable
;
4484 DWORD PrivilegeCount
;
4487 #include <poppack.h>
4489 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4492 PSID_AND_ATTRIBUTES Sids
;
4493 DWORD RestrictedSidCount
;
4494 DWORD RestrictedSidLength
;
4495 PSID_AND_ATTRIBUTES RestrictedSids
;
4496 DWORD PrivilegeCount
;
4497 DWORD PrivilegeLength
;
4498 PLUID_AND_ATTRIBUTES Privileges
;
4499 LUID AuthenticationId
;
4500 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4502 typedef struct _TOKEN_ORIGIN
{
4503 LUID OriginatingLogonSession
;
4504 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4506 typedef struct _TOKEN_LINKED_TOKEN
{
4508 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4510 typedef struct _TOKEN_ELEVATION
{
4511 DWORD TokenIsElevated
;
4512 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4519 /* ACEs, directly starting after an ACL */
4520 typedef struct _ACE_HEADER
{
4524 } ACE_HEADER
,*PACE_HEADER
;
4527 #define ACCESS_ALLOWED_ACE_TYPE 0
4528 #define ACCESS_DENIED_ACE_TYPE 1
4529 #define SYSTEM_AUDIT_ACE_TYPE 2
4530 #define SYSTEM_ALARM_ACE_TYPE 3
4532 /* inherit AceFlags */
4533 #define OBJECT_INHERIT_ACE 0x01
4534 #define CONTAINER_INHERIT_ACE 0x02
4535 #define NO_PROPAGATE_INHERIT_ACE 0x04
4536 #define INHERIT_ONLY_ACE 0x08
4537 #define INHERITED_ACE 0x10
4538 #define VALID_INHERIT_FLAGS 0x1F
4540 /* AceFlags mask for what events we (should) audit */
4541 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4542 #define FAILED_ACCESS_ACE_FLAG 0x80
4544 /* different ACEs depending on AceType
4545 * SidStart marks the begin of a SID
4546 * so the thing finally looks like this:
4551 typedef struct _ACCESS_ALLOWED_ACE
{
4555 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4557 typedef struct _ACCESS_DENIED_ACE
{
4561 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4563 typedef struct _SYSTEM_AUDIT_ACE
{
4567 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4569 typedef struct _SYSTEM_ALARM_ACE
{
4573 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4575 typedef enum tagSID_NAME_USE
{
4580 SidTypeWellKnownGroup
,
4581 SidTypeDeletedAccount
,
4584 } SID_NAME_USE
,*PSID_NAME_USE
;
4586 #define ACE_OBJECT_TYPE_PRESENT 0x1
4587 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4591 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4593 #define DELETE 0x00010000
4594 #define READ_CONTROL 0x00020000
4595 #define WRITE_DAC 0x00040000
4596 #define WRITE_OWNER 0x00080000
4597 #define SYNCHRONIZE 0x00100000
4598 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4600 #define STANDARD_RIGHTS_READ READ_CONTROL
4601 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4602 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4604 #define STANDARD_RIGHTS_ALL 0x001f0000
4606 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4608 #define GENERIC_READ 0x80000000
4609 #define GENERIC_WRITE 0x40000000
4610 #define GENERIC_EXECUTE 0x20000000
4611 #define GENERIC_ALL 0x10000000
4613 #define MAXIMUM_ALLOWED 0x02000000
4614 #define ACCESS_SYSTEM_SECURITY 0x01000000
4616 #define EVENT_QUERY_STATE 0x0001
4617 #define EVENT_MODIFY_STATE 0x0002
4618 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4620 #define SEMAPHORE_MODIFY_STATE 0x0002
4621 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4623 #define MUTEX_MODIFY_STATE 0x0001
4624 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4626 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4627 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4628 #define JOB_OBJECT_QUERY 0x0004
4629 #define JOB_OBJECT_TERMINATE 0x0008
4630 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4631 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4633 #define TIMER_QUERY_STATE 0x0001
4634 #define TIMER_MODIFY_STATE 0x0002
4635 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4637 #define PROCESS_TERMINATE 0x0001
4638 #define PROCESS_CREATE_THREAD 0x0002
4639 #define PROCESS_VM_OPERATION 0x0008
4640 #define PROCESS_VM_READ 0x0010
4641 #define PROCESS_VM_WRITE 0x0020
4642 #define PROCESS_DUP_HANDLE 0x0040
4643 #define PROCESS_CREATE_PROCESS 0x0080
4644 #define PROCESS_SET_QUOTA 0x0100
4645 #define PROCESS_SET_INFORMATION 0x0200
4646 #define PROCESS_QUERY_INFORMATION 0x0400
4647 #define PROCESS_SUSPEND_RESUME 0x0800
4648 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4649 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4651 #define THREAD_TERMINATE 0x0001
4652 #define THREAD_SUSPEND_RESUME 0x0002
4653 #define THREAD_GET_CONTEXT 0x0008
4654 #define THREAD_SET_CONTEXT 0x0010
4655 #define THREAD_SET_INFORMATION 0x0020
4656 #define THREAD_QUERY_INFORMATION 0x0040
4657 #define THREAD_SET_THREAD_TOKEN 0x0080
4658 #define THREAD_IMPERSONATE 0x0100
4659 #define THREAD_DIRECT_IMPERSONATION 0x0200
4660 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4662 #define THREAD_BASE_PRIORITY_LOWRT 15
4663 #define THREAD_BASE_PRIORITY_MAX 2
4664 #define THREAD_BASE_PRIORITY_MIN -2
4665 #define THREAD_BASE_PRIORITY_IDLE -15
4667 typedef struct _QUOTA_LIMITS
{
4668 SIZE_T PagedPoolLimit
;
4669 SIZE_T NonPagedPoolLimit
;
4670 SIZE_T MinimumWorkingSetSize
;
4671 SIZE_T MaximumWorkingSetSize
;
4672 SIZE_T PagefileLimit
;
4673 LARGE_INTEGER TimeLimit
;
4674 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
4676 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4677 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4678 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4679 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4681 typedef struct _QUOTA_LIMITS_EX
{
4682 SIZE_T PagedPoolLimit
;
4683 SIZE_T NonPagedPoolLimit
;
4684 SIZE_T MinimumWorkingSetSize
;
4685 SIZE_T MaximumWorkingSetSize
;
4686 SIZE_T PagefileLimit
;
4687 LARGE_INTEGER TimeLimit
;
4694 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
4696 #define SECTION_QUERY 0x0001
4697 #define SECTION_MAP_WRITE 0x0002
4698 #define SECTION_MAP_READ 0x0004
4699 #define SECTION_MAP_EXECUTE 0x0008
4700 #define SECTION_EXTEND_SIZE 0x0010
4701 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4702 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4704 #define FILE_READ_DATA 0x0001 /* file & pipe */
4705 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4706 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4707 #define FILE_ADD_FILE 0x0002 /* directory */
4708 #define FILE_APPEND_DATA 0x0004 /* file */
4709 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4710 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4711 #define FILE_READ_EA 0x0008 /* file & directory */
4712 #define FILE_READ_PROPERTIES FILE_READ_EA
4713 #define FILE_WRITE_EA 0x0010 /* file & directory */
4714 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4715 #define FILE_EXECUTE 0x0020 /* file */
4716 #define FILE_TRAVERSE 0x0020 /* directory */
4717 #define FILE_DELETE_CHILD 0x0040 /* directory */
4718 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4719 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4720 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4722 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4723 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4725 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4726 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4727 FILE_APPEND_DATA | SYNCHRONIZE)
4728 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4729 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4731 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4732 #define DUPLICATE_SAME_ACCESS 0x00000002
4734 /* File attribute flags */
4735 #define FILE_SHARE_READ 0x00000001L
4736 #define FILE_SHARE_WRITE 0x00000002L
4737 #define FILE_SHARE_DELETE 0x00000004L
4739 #define FILE_ATTRIBUTE_READONLY 0x00000001
4740 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4741 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4742 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4743 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4744 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4745 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4746 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4747 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4748 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4749 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4750 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4751 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4752 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4754 /* File notification flags */
4755 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4756 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4757 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4758 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4759 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4760 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4761 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4762 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4763 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4764 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4765 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4766 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4768 #define FILE_ACTION_ADDED 0x00000001
4769 #define FILE_ACTION_REMOVED 0x00000002
4770 #define FILE_ACTION_MODIFIED 0x00000003
4771 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4772 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4773 #define FILE_ACTION_ADDED_STREAM 0x00000006
4774 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4775 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4777 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4778 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4779 #define FILE_UNICODE_ON_DISK 0x00000004
4780 #define FILE_PERSISTENT_ACLS 0x00000008
4781 #define FILE_FILE_COMPRESSION 0x00000010
4782 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4783 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4784 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4785 #define FILE_NAMED_STREAMS 0x00040000
4786 #define FILE_READ_ONLY_VOLUME 0x00080000
4788 /* File alignments (NT) */
4789 #define FILE_BYTE_ALIGNMENT 0x00000000
4790 #define FILE_WORD_ALIGNMENT 0x00000001
4791 #define FILE_LONG_ALIGNMENT 0x00000003
4792 #define FILE_QUAD_ALIGNMENT 0x00000007
4793 #define FILE_OCTA_ALIGNMENT 0x0000000f
4794 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4795 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4796 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4797 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4798 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4800 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4801 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4803 #define REG_NONE 0 /* no type */
4804 #define REG_SZ 1 /* string type (ASCII) */
4805 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4806 #define REG_BINARY 3 /* binary format, callerspecific */
4807 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4808 #define REG_DWORD 4 /* DWORD in little endian format */
4809 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4810 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4811 #define REG_LINK 6 /* symbolic link (UNICODE) */
4812 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4813 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4814 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4815 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4816 #define REG_QWORD 11 /* QWORD in little endian format */
4817 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4819 /* ----------------------------- begin power management --------------------- */
4821 typedef enum _LATENCY_TIME
{
4824 } LATENCY_TIME
, *PLATENCY_TIME
;
4826 #define DISCHARGE_POLICY_CRITICAL 0
4827 #define DISCHARGE_POLICY_LOW 1
4828 #define NUM_DISCHARGE_POLICIES 4
4830 #define PO_THROTTLE_NONE 0
4831 #define PO_THROTTLE_CONSTANT 1
4832 #define PO_THROTTLE_DEGRADE 2
4833 #define PO_THROTTLE_ADAPTIVE 3
4835 typedef enum _POWER_ACTION
{
4836 PowerActionNone
= 0,
4837 PowerActionReserved
,
4839 PowerActionHibernate
,
4840 PowerActionShutdown
,
4841 PowerActionShutdownReset
,
4842 PowerActionShutdownOff
,
4843 PowerActionWarmEject
4847 typedef enum _SYSTEM_POWER_STATE
{
4848 PowerSystemUnspecified
= 0,
4849 PowerSystemWorking
= 1,
4850 PowerSystemSleeping1
= 2,
4851 PowerSystemSleeping2
= 3,
4852 PowerSystemSleeping3
= 4,
4853 PowerSystemHibernate
= 5,
4854 PowerSystemShutdown
= 6,
4855 PowerSystemMaximum
= 7
4856 } SYSTEM_POWER_STATE
,
4857 *PSYSTEM_POWER_STATE
;
4859 typedef enum _DEVICE_POWER_STATE
{
4860 PowerDeviceUnspecified
,
4866 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
4868 typedef enum _POWER_INFORMATION_LEVEL
{
4869 SystemPowerPolicyAc
,
4870 SystemPowerPolicyDc
,
4871 VerifySystemPolicyAc
,
4872 VerifySystemPolicyDc
,
4873 SystemPowerCapabilities
,
4875 SystemPowerStateHandler
,
4876 ProcessorStateHandler
,
4877 SystemPowerPolicyCurrent
,
4878 AdministratorPowerPolicy
,
4879 SystemReserveHiberFile
,
4880 ProcessorInformation
,
4881 SystemPowerInformation
,
4882 ProcessorStateHandler2
,
4885 SystemExecutionState
,
4886 SystemPowerStateNotifyHandler
,
4887 ProcessorPowerPolicyAc
,
4888 ProcessorPowerPolicyDc
,
4889 VerifyProcessorPowerPolicyAc
,
4890 VerifyProcessorPowerPolicyDc
,
4891 ProcessorPowerPolicyCurrent
4892 } POWER_INFORMATION_LEVEL
;
4894 typedef struct _ADMINISTRATOR_POWER_POLICY
{
4895 SYSTEM_POWER_STATE MinSleep
;
4896 SYSTEM_POWER_STATE MaxSleep
;
4897 ULONG MinVideoTimeout
;
4898 ULONG MaxVideoTimeout
;
4899 ULONG MinSpindownTimeout
;
4900 ULONG MaxSpindownTimeout
;
4901 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
4906 } BATTERY_REPORTING_SCALE
,
4907 *PBATTERY_REPORTING_SCALE
;
4910 POWER_ACTION Action
;
4913 } POWER_ACTION_POLICY
,
4914 *PPOWER_ACTION_POLICY
;
4916 typedef struct _PROCESSOR_POWER_INFORMATION
{
4922 ULONG CurrentIdleState
;
4923 } PROCESSOR_POWER_INFORMATION
,
4924 *PPROCESSOR_POWER_INFORMATION
;
4926 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
4930 UCHAR DemotePercent
;
4931 UCHAR PromotePercent
;
4933 ULONG AllowDemotion
:1;
4934 ULONG AllowPromotion
:1;
4936 } PROCESSOR_POWER_POLICY_INFO
,
4937 *PPROCESSOR_POWER_POLICY_INFO
;
4939 typedef struct _PROCESSOR_POWER_POLICY
{
4941 BYTE DynamicThrottle
;
4943 DWORD DisableCStates
:1;
4946 PROCESSOR_POWER_POLICY_INFO Policy
[3];
4947 } PROCESSOR_POWER_POLICY
,
4948 *PPROCESSOR_POWER_POLICY
;
4952 BOOLEAN BatteryPresent
;
4954 BOOLEAN Discharging
;
4957 ULONG RemainingCapacity
;
4959 ULONG EstimatedTime
;
4960 ULONG DefaultAlert1
;
4961 ULONG DefaultAlert2
;
4962 } SYSTEM_BATTERY_STATE
,
4963 *PSYSTEM_BATTERY_STATE
;
4966 BOOLEAN PowerButtonPresent
;
4967 BOOLEAN SleepButtonPresent
;
4974 BOOLEAN HiberFilePresent
;
4976 BOOLEAN VideoDimPresent
;
4979 BOOLEAN ThermalControl
;
4980 BOOLEAN ProcessorThrottle
;
4981 UCHAR ProcessorMinThrottle
;
4982 UCHAR ProcessorMaxThrottle
;
4984 BOOLEAN DiskSpinDown
;
4986 BOOLEAN SystemBatteriesPresent
;
4987 BOOLEAN BatteriesAreShortTerm
;
4988 BATTERY_REPORTING_SCALE BatteryScale
[3];
4989 SYSTEM_POWER_STATE AcOnLineWake
;
4990 SYSTEM_POWER_STATE SoftLidWake
;
4991 SYSTEM_POWER_STATE RtcWake
;
4992 SYSTEM_POWER_STATE MinDeviceWakeState
;
4993 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
4994 } SYSTEM_POWER_CAPABILITIES
,
4995 *PSYSTEM_POWER_CAPABILITIES
;
4997 typedef struct _SYSTEM_POWER_INFORMATION
{
4998 ULONG MaxIdlenessAllowed
;
5000 ULONG TimeRemaining
;
5002 } SYSTEM_POWER_INFORMATION
,
5003 *PSYSTEM_POWER_INFORMATION
;
5005 typedef struct _SYSTEM_POWER_LEVEL
{
5009 POWER_ACTION_POLICY PowerPolicy
;
5010 SYSTEM_POWER_STATE MinSystemState
;
5011 } SYSTEM_POWER_LEVEL
,
5012 *PSYSTEM_POWER_LEVEL
;
5014 typedef struct _SYSTEM_POWER_POLICY
{
5016 POWER_ACTION_POLICY PowerButton
;
5017 POWER_ACTION_POLICY SleepButton
;
5018 POWER_ACTION_POLICY LidClose
;
5019 SYSTEM_POWER_STATE LidOpenWake
;
5021 POWER_ACTION_POLICY Idle
;
5023 UCHAR IdleSensitivity
;
5024 UCHAR DynamicThrottle
;
5026 SYSTEM_POWER_STATE MinSleep
;
5027 SYSTEM_POWER_STATE MaxSleep
;
5028 SYSTEM_POWER_STATE ReducedLatencySleep
;
5029 ULONG WinLogonFlags
;
5031 ULONG DozeS4Timeout
;
5032 ULONG BroadcastCapacityResolution
;
5033 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
5035 BOOLEAN VideoDimDisplay
;
5036 ULONG VideoReserved
[3];
5037 ULONG SpindownTimeout
;
5038 BOOLEAN OptimizeForPower
;
5039 UCHAR FanThrottleTolerance
;
5040 UCHAR ForcedThrottle
;
5042 POWER_ACTION_POLICY OverThrottled
;
5043 } SYSTEM_POWER_POLICY
,
5044 *PSYSTEM_POWER_POLICY
;
5046 typedef union _FILE_SEGMENT_ELEMENT
{
5048 ULONGLONG Alignment
;
5049 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
5051 typedef struct _FILE_NOTIFY_INFORMATION
{
5052 DWORD NextEntryOffset
;
5054 DWORD FileNameLength
;
5056 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
5058 /* ----------------------------- begin tape storage --------------------- */
5060 #define TAPE_FIXED_PARTITIONS 0
5061 #define TAPE_SELECT_PARTITIONS 1
5062 #define TAPE_INITIATOR_PARTITIONS 2
5063 #define TAPE_ERASE_SHORT 0
5064 #define TAPE_ERASE_LONG 1
5066 #define TAPE_UNLOAD 1
5067 #define TAPE_TENSION 2
5069 #define TAPE_UNLOCK 4
5070 #define TAPE_FORMAT 5
5071 #define TAPE_SETMARKS 0
5072 #define TAPE_FILEMARKS 1
5073 #define TAPE_SHORT_FILEMARKS 2
5074 #define TAPE_LONG_FILEMARKS 3
5075 #define TAPE_REWIND 0
5076 #define TAPE_ABSOLUTE_BLOCK 1
5077 #define TAPE_LOGICAL_BLOCK 2
5078 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5079 #define TAPE_SPACE_END_OF_DATA 4
5080 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5081 #define TAPE_SPACE_FILEMARKS 6
5082 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5083 #define TAPE_SPACE_SETMARKS 8
5084 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5086 typedef struct _TAPE_CREATE_PARTITION
{
5090 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5092 typedef struct _TAPE_ERASE
{
5095 } TAPE_ERASE
, *PTAPE_ERASE
;
5097 typedef struct _TAPE_PREPARE
{
5100 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5102 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5104 BOOLEAN Compression
;
5105 BOOLEAN DataPadding
;
5106 BOOLEAN ReportSetmarks
;
5107 ULONG EOTWarningZoneSize
;
5108 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5110 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5112 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5114 typedef struct _TAPE_WRITE_MARKS
{
5118 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5120 typedef struct _TAPE_GET_POSITION
{
5125 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5127 typedef struct _TAPE_SET_POSITION
{
5130 LARGE_INTEGER Offset
;
5132 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5134 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5136 BOOLEAN Compression
;
5137 BOOLEAN DataPadding
;
5138 BOOLEAN ReportSetmarks
;
5139 DWORD DefaultBlockSize
;
5140 DWORD MaximumBlockSize
;
5141 DWORD MinimumBlockSize
;
5142 DWORD MaximumPartitionCount
;
5145 DWORD EOTWarningZoneSize
;
5146 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5148 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5149 LARGE_INTEGER Capacity
;
5150 LARGE_INTEGER Remaining
;
5152 DWORD PartitionCount
;
5153 BOOLEAN WriteProtected
;
5154 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5156 /* ----------------------------- begin registry ----------------------------- */
5158 /* Registry security values */
5159 #define OWNER_SECURITY_INFORMATION 0x00000001
5160 #define GROUP_SECURITY_INFORMATION 0x00000002
5161 #define DACL_SECURITY_INFORMATION 0x00000004
5162 #define SACL_SECURITY_INFORMATION 0x00000008
5164 #define REG_OPTION_RESERVED 0x00000000
5165 #define REG_OPTION_NON_VOLATILE 0x00000000
5166 #define REG_OPTION_VOLATILE 0x00000001
5167 #define REG_OPTION_CREATE_LINK 0x00000002
5168 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5169 #define REG_OPTION_OPEN_LINK 0x00000008
5170 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
5171 REG_OPTION_NON_VOLATILE| \
5172 REG_OPTION_VOLATILE| \
5173 REG_OPTION_CREATE_LINK| \
5174 REG_OPTION_BACKUP_RESTORE| \
5175 REG_OPTION_OPEN_LINK)
5178 #define REG_CREATED_NEW_KEY 0x00000001
5179 #define REG_OPENED_EXISTING_KEY 0x00000002
5181 /* For RegNotifyChangeKeyValue */
5182 #define REG_NOTIFY_CHANGE_NAME 0x01
5183 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5184 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5185 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5187 #define KEY_QUERY_VALUE 0x00000001
5188 #define KEY_SET_VALUE 0x00000002
5189 #define KEY_CREATE_SUB_KEY 0x00000004
5190 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5191 #define KEY_NOTIFY 0x00000010
5192 #define KEY_CREATE_LINK 0x00000020
5193 #define KEY_WOW64_64KEY 0x00000100
5194 #define KEY_WOW64_32KEY 0x00000200
5195 #define KEY_WOW64_RES 0x00000300
5197 /* for RegKeyRestore flags */
5198 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5199 #define REG_REFRESH_HIVE 0x00000002
5200 #define REG_NO_LAZY_FLUSH 0x00000004
5201 #define REG_FORCE_RESTORE 0x00000008
5203 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5205 KEY_ENUMERATE_SUB_KEYS| \
5209 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5211 KEY_CREATE_SUB_KEY) \
5214 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5215 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5218 KEY_CREATE_SUB_KEY| \
5219 KEY_ENUMERATE_SUB_KEYS| \
5224 /* ------------------------------ end registry ------------------------------ */
5227 #define EVENTLOG_SUCCESS 0x0000
5228 #define EVENTLOG_ERROR_TYPE 0x0001
5229 #define EVENTLOG_WARNING_TYPE 0x0002
5230 #define EVENTLOG_INFORMATION_TYPE 0x0004
5231 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5232 #define EVENTLOG_AUDIT_FAILURE 0x0010
5234 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5235 #define EVENTLOG_SEEK_READ 0x0002
5236 #define EVENTLOG_FORWARDS_READ 0x0004
5237 #define EVENTLOG_BACKWARDS_READ 0x0008
5239 typedef struct _EVENTLOGRECORD
{
5243 DWORD TimeGenerated
;
5250 DWORD ClosingRecordNumber
;
5252 DWORD UserSidLength
;
5253 DWORD UserSidOffset
;
5256 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5258 #define SERVICE_BOOT_START 0x00000000
5259 #define SERVICE_SYSTEM_START 0x00000001
5260 #define SERVICE_AUTO_START 0x00000002
5261 #define SERVICE_DEMAND_START 0x00000003
5262 #define SERVICE_DISABLED 0x00000004
5264 #define SERVICE_ERROR_IGNORE 0x00000000
5265 #define SERVICE_ERROR_NORMAL 0x00000001
5266 #define SERVICE_ERROR_SEVERE 0x00000002
5267 #define SERVICE_ERROR_CRITICAL 0x00000003
5270 #define SERVICE_KERNEL_DRIVER 0x00000001
5271 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5272 #define SERVICE_ADAPTER 0x00000004
5273 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5275 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5276 SERVICE_RECOGNIZER_DRIVER )
5278 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5279 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5280 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5282 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5284 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5285 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5288 typedef enum _CM_SERVICE_NODE_TYPE
5290 DriverType
= SERVICE_KERNEL_DRIVER
,
5291 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5292 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5293 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5294 AdapterType
= SERVICE_ADAPTER
,
5295 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5296 } SERVICE_NODE_TYPE
;
5298 typedef enum _CM_SERVICE_LOAD_TYPE
5300 BootLoad
= SERVICE_BOOT_START
,
5301 SystemLoad
= SERVICE_SYSTEM_START
,
5302 AutoLoad
= SERVICE_AUTO_START
,
5303 DemandLoad
= SERVICE_DEMAND_START
,
5304 DisableLoad
= SERVICE_DISABLED
5305 } SERVICE_LOAD_TYPE
;
5307 typedef enum _CM_ERROR_CONTROL_TYPE
5309 IgnoreError
= SERVICE_ERROR_IGNORE
,
5310 NormalError
= SERVICE_ERROR_NORMAL
,
5311 SevereError
= SERVICE_ERROR_SEVERE
,
5312 CriticalError
= SERVICE_ERROR_CRITICAL
5313 } SERVICE_ERROR_TYPE
;
5317 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5318 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5319 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5320 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5321 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5323 #include <guiddef.h>
5325 typedef struct _OBJECT_TYPE_LIST
{
5329 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
5331 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5334 WORD CreatorBackTraceIndex
;
5335 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
5336 LIST_ENTRY ProcessLocksList
;
5338 DWORD ContentionCount
;
5339 #ifdef __WINESRC__ /* in Wine we store the name here */
5340 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
5344 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
5346 typedef struct _RTL_CRITICAL_SECTION
{
5347 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
5349 LONG RecursionCount
;
5350 HANDLE OwningThread
;
5351 HANDLE LockSemaphore
;
5352 ULONG_PTR SpinCount
;
5353 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
5355 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5356 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5357 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5358 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5359 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5361 typedef struct _RTL_SRWLOCK
{
5363 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
5365 #define RTL_SRWLOCK_INIT {0}
5367 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
5368 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5370 #include <pshpack8.h>
5371 typedef struct _IO_COUNTERS
{
5372 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5373 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5374 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5375 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5376 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5377 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5378 } IO_COUNTERS
, *PIO_COUNTERS
;
5379 #include <poppack.h>
5382 DWORD dwOSVersionInfoSize
;
5383 DWORD dwMajorVersion
;
5384 DWORD dwMinorVersion
;
5385 DWORD dwBuildNumber
;
5387 CHAR szCSDVersion
[128];
5388 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5391 DWORD dwOSVersionInfoSize
;
5392 DWORD dwMajorVersion
;
5393 DWORD dwMinorVersion
;
5394 DWORD dwBuildNumber
;
5396 WCHAR szCSDVersion
[128];
5397 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5399 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5400 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5401 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5404 DWORD dwOSVersionInfoSize
;
5405 DWORD dwMajorVersion
;
5406 DWORD dwMinorVersion
;
5407 DWORD dwBuildNumber
;
5409 CHAR szCSDVersion
[128];
5410 WORD wServicePackMajor
;
5411 WORD wServicePackMinor
;
5415 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5418 DWORD dwOSVersionInfoSize
;
5419 DWORD dwMajorVersion
;
5420 DWORD dwMinorVersion
;
5421 DWORD dwBuildNumber
;
5423 WCHAR szCSDVersion
[128];
5424 WORD wServicePackMajor
;
5425 WORD wServicePackMinor
;
5429 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5431 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5432 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5433 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5435 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5437 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5439 #define VER_PLATFORM_WIN32s 0
5440 #define VER_PLATFORM_WIN32_WINDOWS 1
5441 #define VER_PLATFORM_WIN32_NT 2
5443 #define VER_MINORVERSION 0x00000001
5444 #define VER_MAJORVERSION 0x00000002
5445 #define VER_BUILDNUMBER 0x00000004
5446 #define VER_PLATFORMID 0x00000008
5447 #define VER_SERVICEPACKMINOR 0x00000010
5448 #define VER_SERVICEPACKMAJOR 0x00000020
5449 #define VER_SUITENAME 0x00000040
5450 #define VER_PRODUCT_TYPE 0x00000080
5452 #define VER_NT_WORKSTATION 1
5453 #define VER_NT_DOMAIN_CONTROLLER 2
5454 #define VER_NT_SERVER 3
5456 #define VER_SUITE_SMALLBUSINESS 0x00000001
5457 #define VER_SUITE_ENTERPRISE 0x00000002
5458 #define VER_SUITE_BACKOFFICE 0x00000004
5459 #define VER_SUITE_COMMUNICATIONS 0x00000008
5460 #define VER_SUITE_TERMINAL 0x00000010
5461 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5462 #define VER_SUITE_EMBEDDEDNT 0x00000040
5463 #define VER_SUITE_DATACENTER 0x00000080
5464 #define VER_SUITE_SINGLEUSERTS 0x00000100
5465 #define VER_SUITE_PERSONAL 0x00000200
5466 #define VER_SUITE_BLADE 0x00000400
5467 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5468 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5469 #define VER_SUITE_STORAGE_SERVER 0x00002000
5470 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5471 #define VER_SUITE_WH_SERVER 0x00008000
5474 #define VER_GREATER 2
5475 #define VER_GREATER_EQUAL 3
5477 #define VER_LESS_EQUAL 5
5481 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5483 DWORD ulFormatVersion
;
5484 DWORD ulAssemblyCount
;
5485 DWORD ulRootManifestPathType
;
5486 DWORD ulRootManifestPathChars
;
5487 DWORD ulRootConfigurationPathType
;
5488 DWORD ulRootConfigurationPathChars
;
5489 DWORD ulAppDirPathType
;
5490 DWORD ulAppDirPathChars
;
5491 PCWSTR lpRootManifestPath
;
5492 PCWSTR lpRootConfigurationPath
;
5493 PCWSTR lpAppDirPath
;
5494 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5496 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5498 DWORD ulEncodedAssemblyIdentityLength
;
5499 DWORD ulManifestPathType
;
5500 DWORD ulManifestPathLength
;
5501 LARGE_INTEGER liManifestLastWriteTime
;
5502 DWORD ulPolicyPathType
;
5503 DWORD ulPolicyPathLength
;
5504 LARGE_INTEGER liPolicyLastWriteTime
;
5505 DWORD ulMetadataSatelliteRosterIndex
;
5506 DWORD ulManifestVersionMajor
;
5507 DWORD ulManifestVersionMinor
;
5508 DWORD ulPolicyVersionMajor
;
5509 DWORD ulPolicyVersionMinor
;
5510 DWORD ulAssemblyDirectoryNameLength
;
5511 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
5512 PCWSTR lpAssemblyManifestPath
;
5513 PCWSTR lpAssemblyPolicyPath
;
5514 PCWSTR lpAssemblyDirectoryName
;
5516 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
5518 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
5519 DWORD ulAssemblyIndex
;
5520 DWORD ulFileIndexInAssembly
;
5521 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
5523 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
5525 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
5527 DWORD ulFilenameLength
;
5531 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
5533 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
5535 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
5536 ActivationContextBasicInformation
= 1,
5537 ActivationContextDetailedInformation
= 2,
5538 AssemblyDetailedInformationInActivationContext
= 3,
5539 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
5540 MaxActivationContextInfoClass
,
5542 AssemblyDetailedInformationInActivationContxt
= 3,
5543 FileInformationInAssemblyOfAssemblyInActivationContxt
= 4
5544 } ACTIVATION_CONTEXT_INFO_CLASS
;
5546 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5547 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5548 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5549 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5551 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5552 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5553 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5554 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5555 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5556 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5557 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5558 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5559 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5561 typedef enum _JOBOBJECTINFOCLASS
5563 JobObjectBasicAccountingInformation
= 1,
5564 JobObjectBasicLimitInformation
,
5565 JobObjectBasicProcessIdList
,
5566 JobObjectBasicUIRestrictions
,
5567 JobObjectSecurityLimitInformation
,
5568 JobObjectEndOfJobTimeInformation
,
5569 JobObjectAssociateCompletionPortInformation
,
5570 JobObjectBasicAndIoAccountingInformation
,
5571 JobObjectExtendedLimitInformation
,
5572 JobObjectJobSetInformation
,
5573 MaxJobObjectInfoClass
5574 } JOBOBJECTINFOCLASS
;
5576 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5578 RelationProcessorCore
= 0,
5579 RelationNumaNode
= 1,
5581 RelationProcessorPackage
= 3,
5583 RelationAll
= 0xffff
5584 } LOGICAL_PROCESSOR_RELATIONSHIP
;
5586 typedef enum _PROCESSOR_CACHE_TYPE
5592 } PROCESSOR_CACHE_TYPE
;
5594 typedef struct _PROCESSOR_GROUP_INFO
5596 BYTE MaximumProcessorCount
;
5597 BYTE ActiveProcessorCount
;
5599 KAFFINITY ActiveProcessorMask
;
5600 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
5602 typedef struct _CACHE_DESCRIPTOR
5608 PROCESSOR_CACHE_TYPE Type
;
5609 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
5611 typedef struct _GROUP_AFFINITY
5616 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
5618 typedef struct _PROCESSOR_RELATIONSHIP
5623 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
5624 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
5627 typedef struct _NUMA_NODE_RELATIONSHIP
5631 GROUP_AFFINITY GroupMask
;
5632 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
5634 typedef struct _CACHE_RELATIONSHIP
5639 PROCESSOR_CACHE_TYPE Type
;
5641 GROUP_AFFINITY GroupMask
;
5642 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
5644 typedef struct _GROUP_RELATIONSHIP
5646 WORD MaximumGroupCount
;
5647 WORD ActiveGroupCount
;
5649 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
5650 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
5652 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5654 ULONG_PTR ProcessorMask
;
5655 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5666 CACHE_DESCRIPTOR Cache
;
5667 ULONGLONG Reserved
[2];
5669 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
5671 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5673 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5677 PROCESSOR_RELATIONSHIP Processor
;
5678 NUMA_NODE_RELATIONSHIP NumaNode
;
5679 CACHE_RELATIONSHIP Cache
;
5680 GROUP_RELATIONSHIP Group
;
5682 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
5684 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
5690 #endif /* _WINNT_ */