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 #ifndef NONAMELESSSTRUCT
196 #define DUMMYSTRUCTNAME
197 #define DUMMYSTRUCTNAME1
198 #define DUMMYSTRUCTNAME2
199 #define DUMMYSTRUCTNAME3
200 #define DUMMYSTRUCTNAME4
201 #define DUMMYSTRUCTNAME5
202 #else /* !defined(NONAMELESSSTRUCT) */
203 #define DUMMYSTRUCTNAME s
204 #define DUMMYSTRUCTNAME1 s1
205 #define DUMMYSTRUCTNAME2 s2
206 #define DUMMYSTRUCTNAME3 s3
207 #define DUMMYSTRUCTNAME4 s4
208 #define DUMMYSTRUCTNAME5 s5
209 #endif /* !defined(NONAMELESSSTRUCT) */
211 #ifndef NONAMELESSUNION
212 #define DUMMYUNIONNAME
213 #define DUMMYUNIONNAME1
214 #define DUMMYUNIONNAME2
215 #define DUMMYUNIONNAME3
216 #define DUMMYUNIONNAME4
217 #define DUMMYUNIONNAME5
218 #define DUMMYUNIONNAME6
219 #define DUMMYUNIONNAME7
220 #define DUMMYUNIONNAME8
221 #else /* !defined(NONAMELESSUNION) */
222 #define DUMMYUNIONNAME u
223 #define DUMMYUNIONNAME1 u1
224 #define DUMMYUNIONNAME2 u2
225 #define DUMMYUNIONNAME3 u3
226 #define DUMMYUNIONNAME4 u4
227 #define DUMMYUNIONNAME5 u5
228 #define DUMMYUNIONNAME6 u6
229 #define DUMMYUNIONNAME7 u7
230 #define DUMMYUNIONNAME8 u8
231 #endif /* !defined(NONAMELESSUNION) */
233 /* C99 restrict support */
235 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
236 # if defined(_MSC_VER) && defined(_M_MRX000)
237 # define RESTRICTED_POINTER __restrict
238 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
239 # define RESTRICTED_POINTER __restrict
241 # define RESTRICTED_POINTER
244 # define RESTRICTED_POINTER
247 /* C99 unaligned support */
250 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
251 # define UNALIGNED __unaligned
253 # define UNALIGNED64 __unaligned
263 /* Alignment macros */
265 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
266 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
267 #define MEMORY_ALLOCATION_ALIGNMENT 16
269 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
270 #define MEMORY_ALLOCATION_ALIGNMENT 8
273 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
274 # define TYPE_ALIGNMENT(t) __alignof(t)
275 #elif defined(__GNUC__)
276 # define TYPE_ALIGNMENT(t) __alignof__(t)
278 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
282 # define PROBE_ALIGNMENT(_s) \
283 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
284 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
285 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
287 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
290 /* Compile time assertion */
292 #if defined(_MSC_VER)
293 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
295 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
298 /* Eliminate Microsoft C/C++ compiler warning 4715 */
299 #if defined(_MSC_VER) && (_MSC_VER > 1200)
300 # define DEFAULT_UNREACHABLE default: __assume(0)
302 # define DEFAULT_UNREACHABLE
306 #define APPLICATION_ERROR_MASK 0x20000000
307 #define ERROR_SEVERITY_SUCCESS 0x00000000
308 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
309 #define ERROR_SEVERITY_WARNING 0x80000000
310 #define ERROR_SEVERITY_ERROR 0xC0000000
313 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
315 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
316 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
317 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
318 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
319 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
320 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
321 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
324 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
327 /* Microsoft's macros for declaring functions */
330 # define EXTERN_C extern "C"
332 # define EXTERN_C extern
335 #define STDMETHODCALLTYPE __stdcall
336 #define STDMETHODVCALLTYPE __cdecl
337 #define STDAPICALLTYPE __stdcall
338 #define STDAPIVCALLTYPE __cdecl
340 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
341 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
342 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
343 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
344 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
345 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
346 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
347 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
349 /* Define the basic types */
354 typedef VOID
*PVOID64
;
355 typedef BYTE BOOLEAN
, *PBOOLEAN
;
356 typedef char CHAR
, *PCHAR
;
357 typedef short SHORT
, *PSHORT
;
359 typedef long LONG
, *PLONG
;
361 typedef int LONG
, *PLONG
;
364 /* Some systems might have wchar_t, but we really need 16 bit characters */
365 #ifdef WINE_UNICODE_NATIVE
366 typedef wchar_t WCHAR
, *PWCHAR
;
368 typedef unsigned short WCHAR
, *PWCHAR
;
371 /* 'Extended/Wide' numerical types */
375 typedef signed __int64 LONGLONG
, *PLONGLONG
;
376 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
378 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
379 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
386 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
388 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
392 /* ANSI string types */
393 typedef CHAR
*PCH
, *LPCH
;
394 typedef const CHAR
*PCCH
, *LPCCH
;
395 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
396 typedef const CHAR
*PCSTR
, *LPCSTR
;
398 /* Unicode string types */
399 typedef WCHAR
*PWCH
, *LPWCH
;
400 typedef const WCHAR
*PCWCH
, *LPCWCH
;
401 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
402 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
404 /* Neutral character and string types */
405 /* These are only defined for Winelib, i.e. _not_ defined for
406 * the emulator. The reason is they depend on the UNICODE
407 * macro which only exists in the user's code.
409 #ifndef WINE_NO_UNICODE_MACROS
411 # ifndef _TCHAR_DEFINED
412 typedef WCHAR TCHAR
, *PTCHAR
;
413 # define _TCHAR_DEFINED
415 typedef LPWSTR PTSTR
, LPTSTR
;
416 typedef LPCWSTR PCTSTR
, LPCTSTR
;
417 # define __TEXT(string) L##string
419 # ifndef _TCHAR_DEFINED
420 typedef CHAR TCHAR
, *PTCHAR
;
421 # define _TCHAR_DEFINED
423 typedef LPSTR PTSTR
, LPTSTR
;
424 typedef LPCSTR PCTSTR
, LPCTSTR
;
425 # define __TEXT(string) string
426 # endif /* UNICODE */
427 # define TEXT(quote) __TEXT(quote)
428 #endif /* WINE_NO_UNICODE_MACROS */
430 /* Misc common WIN32 types */
432 typedef DWORD LCID
, *PLCID
;
434 typedef DWORD EXECUTION_STATE
;
435 #ifndef _HRESULT_DEFINED
436 #define _HRESULT_DEFINED
437 typedef LONG HRESULT
;
442 typedef void *HANDLE
;
443 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
446 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
448 #define DECLARE_HANDLE(a) typedef HANDLE a
457 #ifndef WIN32_NO_STATUS
459 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
460 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
461 #define STATUS_USER_APC ((DWORD) 0x000000C0)
462 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
463 #define STATUS_PENDING ((DWORD) 0x00000103)
464 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
465 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
466 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
467 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
468 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
469 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
470 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
471 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
472 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
473 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
474 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
475 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
476 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
477 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
478 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
479 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
480 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
481 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
482 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
483 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
484 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
485 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
486 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
487 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
488 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
489 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
490 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
491 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
492 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
493 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
495 /* status values for ContinueDebugEvent */
496 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
497 #define DBG_CONTINUE ((DWORD) 0x00010002)
498 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
499 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
500 #define DBG_CONTROL_C ((DWORD) 0x40010005)
501 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
502 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
503 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
505 #endif /* WIN32_NO_STATUS */
507 /* Argument 1 passed to the DllEntryProc. */
508 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
509 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
510 #define DLL_THREAD_ATTACH 2 /* attach new thread */
511 #define DLL_THREAD_DETACH 3 /* detach thread */
513 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
516 /* u.x.wProcessorArchitecture (NT) */
517 #define PROCESSOR_ARCHITECTURE_INTEL 0
518 #define PROCESSOR_ARCHITECTURE_MIPS 1
519 #define PROCESSOR_ARCHITECTURE_ALPHA 2
520 #define PROCESSOR_ARCHITECTURE_PPC 3
521 #define PROCESSOR_ARCHITECTURE_SHX 4
522 #define PROCESSOR_ARCHITECTURE_ARM 5
523 #define PROCESSOR_ARCHITECTURE_IA64 6
524 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
525 #define PROCESSOR_ARCHITECTURE_MSIL 8
526 #define PROCESSOR_ARCHITECTURE_AMD64 9
527 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
528 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
531 #define PROCESSOR_ARCHITECTURE_SPARC 20
533 /* dwProcessorType */
534 #define PROCESSOR_INTEL_386 386
535 #define PROCESSOR_INTEL_486 486
536 #define PROCESSOR_INTEL_PENTIUM 586
537 #define PROCESSOR_INTEL_860 860
538 #define PROCESSOR_INTEL_IA64 2200
539 #define PROCESSOR_AMD_X8664 8664
540 #define PROCESSOR_MIPS_R2000 2000
541 #define PROCESSOR_MIPS_R3000 3000
542 #define PROCESSOR_MIPS_R4000 4000
543 #define PROCESSOR_ALPHA_21064 21064
544 #define PROCESSOR_PPC_601 601
545 #define PROCESSOR_PPC_603 603
546 #define PROCESSOR_PPC_604 604
547 #define PROCESSOR_PPC_620 620
548 #define PROCESSOR_HITACHI_SH3 10003
549 #define PROCESSOR_HITACHI_SH3E 10004
550 #define PROCESSOR_HITACHI_SH4 10005
551 #define PROCESSOR_MOTOROLA_821 821
552 #define PROCESSOR_SHx_SH3 103
553 #define PROCESSOR_SHx_SH4 104
554 #define PROCESSOR_STRONGARM 2577
555 #define PROCESSOR_ARM720 1824 /* 0x720 */
556 #define PROCESSOR_ARM820 2080 /* 0x820 */
557 #define PROCESSOR_ARM920 2336 /* 0x920 */
558 #define PROCESSOR_ARM_7TDMI 70001
561 #define MAXIMUM_PROCESSORS 64
563 #define MAXIMUM_PROCESSORS 32
566 typedef struct _MEMORY_BASIC_INFORMATION
569 LPVOID AllocationBase
;
570 DWORD AllocationProtect
;
575 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
577 #define PAGE_NOACCESS 0x01
578 #define PAGE_READONLY 0x02
579 #define PAGE_READWRITE 0x04
580 #define PAGE_WRITECOPY 0x08
581 #define PAGE_EXECUTE 0x10
582 #define PAGE_EXECUTE_READ 0x20
583 #define PAGE_EXECUTE_READWRITE 0x40
584 #define PAGE_EXECUTE_WRITECOPY 0x80
585 #define PAGE_GUARD 0x100
586 #define PAGE_NOCACHE 0x200
587 #define PAGE_WRITECOMBINE 0x400
589 #define MEM_COMMIT 0x00001000
590 #define MEM_RESERVE 0x00002000
591 #define MEM_DECOMMIT 0x00004000
592 #define MEM_RELEASE 0x00008000
593 #define MEM_FREE 0x00010000
594 #define MEM_PRIVATE 0x00020000
595 #define MEM_MAPPED 0x00040000
596 #define MEM_RESET 0x00080000
597 #define MEM_TOP_DOWN 0x00100000
598 #define MEM_WRITE_WATCH 0x00200000
599 #define MEM_PHYSICAL 0x00400000
600 #define MEM_LARGE_PAGES 0x20000000
601 #define MEM_4MB_PAGES 0x80000000
603 #define SEC_FILE 0x00800000
604 #define SEC_IMAGE 0x01000000
605 #define SEC_RESERVE 0x04000000
606 #define SEC_COMMIT 0x08000000
607 #define SEC_NOCACHE 0x10000000
608 #define SEC_LARGE_PAGES 0x80000000
609 #define MEM_IMAGE SEC_IMAGE
611 #define WRITE_WATCH_FLAG_RESET 0x00000001
616 #define MINSHORT 0x8000
617 #define MAXSHORT 0x7fff
618 #define MINLONG 0x80000000
619 #define MAXLONG 0x7fffffff
621 #define MAXWORD 0xffff
622 #define MAXDWORD 0xffffffff
624 #define UNICODE_STRING_MAX_CHARS 32767
626 #define FIELD_OFFSET(type, field) \
627 ((LONG)(INT_PTR)&(((type *)0)->field))
629 #define CONTAINING_RECORD(address, type, field) \
630 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
634 typedef struct _LIST_ENTRY
{
635 struct _LIST_ENTRY
*Flink
;
636 struct _LIST_ENTRY
*Blink
;
637 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
639 typedef struct _SINGLE_LIST_ENTRY
{
640 struct _SINGLE_LIST_ENTRY
*Next
;
641 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
645 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
*PSLIST_ENTRY
;
646 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
650 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
657 ULONGLONG Sequence
:9;
658 ULONGLONG NextEntry
:39;
659 ULONGLONG HeaderType
:1;
661 ULONGLONG Reserved
:59;
666 ULONGLONG Sequence
:48;
667 ULONGLONG HeaderType
:1;
669 ULONGLONG Reserved
:2;
670 ULONGLONG NextEntry
:60;
672 } SLIST_HEADER
, *PSLIST_HEADER
;
676 #undef SLIST_ENTRY /* for Mac OS */
677 #define SLIST_ENTRY SINGLE_LIST_ENTRY
678 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
679 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
681 typedef union _SLIST_HEADER
{
688 } SLIST_HEADER
, *PSLIST_HEADER
;
692 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
693 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
694 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
695 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
696 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
697 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
702 #define HEAP_NO_SERIALIZE 0x00000001
703 #define HEAP_GROWABLE 0x00000002
704 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
705 #define HEAP_ZERO_MEMORY 0x00000008
706 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
707 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
708 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
709 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
710 #define HEAP_CREATE_ALIGN_16 0x00010000
711 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
712 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
714 /* This flag allows it to create heaps shared by all processes under win95,
715 FIXME: correct name */
716 #define HEAP_SHARED 0x04000000
718 typedef enum _HEAP_INFORMATION_CLASS
{
719 HeapCompatibilityInformation
,
720 } HEAP_INFORMATION_CLASS
;
722 /* Processor feature flags. */
723 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
724 #define PF_FLOATING_POINT_EMULATED 1
725 #define PF_COMPARE_EXCHANGE_DOUBLE 2
726 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
727 #define PF_PPC_MOVEMEM_64BIT_OK 4
728 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
729 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
730 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
731 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
732 #define PF_PAE_ENABLED 9
733 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
734 #define PF_SSE_DAZ_MODE_AVAILABLE 11
735 #define PF_NX_ENABLED 12
736 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
737 #define PF_COMPARE_EXCHANGE128 14
738 #define PF_COMPARE64_EXCHANGE128 15
739 #define PF_CHANNELS_ENABLED 16
742 /* Execution state flags */
743 #define ES_SYSTEM_REQUIRED 0x00000001
744 #define ES_DISPLAY_REQUIRED 0x00000002
745 #define ES_USER_PRESENT 0x00000004
746 #define ES_CONTINUOUS 0x80000000
748 /* The Win32 register context */
750 /* i386 context definitions */
753 #define SIZE_OF_80387_REGISTERS 80
755 typedef struct _FLOATING_SAVE_AREA
764 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
766 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
768 #define MAXIMUM_SUPPORTED_EXTENSION 512
770 typedef struct _CONTEXT
774 /* These are selected by CONTEXT_DEBUG_REGISTERS */
782 /* These are selected by CONTEXT_FLOATING_POINT */
783 FLOATING_SAVE_AREA FloatSave
;
785 /* These are selected by CONTEXT_SEGMENTS */
791 /* These are selected by CONTEXT_INTEGER */
799 /* These are selected by CONTEXT_CONTROL */
807 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
810 #define CONTEXT_X86 0x00010000
811 #define CONTEXT_i386 CONTEXT_X86
812 #define CONTEXT_i486 CONTEXT_X86
814 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
815 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
816 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
817 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
818 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
819 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020L)
820 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
821 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
822 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
824 #define EXCEPTION_READ_FAULT 0
825 #define EXCEPTION_WRITE_FAULT 1
826 #define EXCEPTION_EXECUTE_FAULT 8
828 #endif /* __i386__ */
830 typedef struct _LDT_ENTRY
{
845 unsigned LimitHi
: 4;
847 unsigned Reserved_0
: 1;
848 unsigned Default_Big
: 1;
849 unsigned Granularity
: 1;
853 } LDT_ENTRY
, *PLDT_ENTRY
;
855 /* x86-64 context definitions */
856 #if defined(__x86_64__)
858 #define CONTEXT_AMD64 0x00100000
860 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
861 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
862 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
863 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
864 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
865 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
866 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
868 #define EXCEPTION_READ_FAULT 0
869 #define EXCEPTION_WRITE_FAULT 1
870 #define EXCEPTION_EXECUTE_FAULT 8
872 typedef struct DECLSPEC_ALIGN(16) _M128A
{
877 typedef struct _XMM_SAVE_AREA32
{
878 WORD ControlWord
; /* 000 */
879 WORD StatusWord
; /* 002 */
880 BYTE TagWord
; /* 004 */
881 BYTE Reserved1
; /* 005 */
882 WORD ErrorOpcode
; /* 006 */
883 DWORD ErrorOffset
; /* 008 */
884 WORD ErrorSelector
; /* 00c */
885 WORD Reserved2
; /* 00e */
886 DWORD DataOffset
; /* 010 */
887 WORD DataSelector
; /* 014 */
888 WORD Reserved3
; /* 016 */
889 DWORD MxCsr
; /* 018 */
890 DWORD MxCsr_Mask
; /* 01c */
891 M128A FloatRegisters
[8]; /* 020 */
892 M128A XmmRegisters
[16]; /* 0a0 */
893 BYTE Reserved4
[96]; /* 1a0 */
894 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
896 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
897 DWORD64 P1Home
; /* 000 */
898 DWORD64 P2Home
; /* 008 */
899 DWORD64 P3Home
; /* 010 */
900 DWORD64 P4Home
; /* 018 */
901 DWORD64 P5Home
; /* 020 */
902 DWORD64 P6Home
; /* 028 */
905 DWORD ContextFlags
; /* 030 */
906 DWORD MxCsr
; /* 034 */
909 WORD SegCs
; /* 038 */
910 WORD SegDs
; /* 03a */
911 WORD SegEs
; /* 03c */
912 WORD SegFs
; /* 03e */
913 WORD SegGs
; /* 040 */
914 WORD SegSs
; /* 042 */
915 DWORD EFlags
; /* 044 */
918 DWORD64 Dr0
; /* 048 */
919 DWORD64 Dr1
; /* 050 */
920 DWORD64 Dr2
; /* 058 */
921 DWORD64 Dr3
; /* 060 */
922 DWORD64 Dr6
; /* 068 */
923 DWORD64 Dr7
; /* 070 */
926 DWORD64 Rax
; /* 078 */
927 DWORD64 Rcx
; /* 080 */
928 DWORD64 Rdx
; /* 088 */
929 DWORD64 Rbx
; /* 090 */
930 DWORD64 Rsp
; /* 098 */
931 DWORD64 Rbp
; /* 0a0 */
932 DWORD64 Rsi
; /* 0a8 */
933 DWORD64 Rdi
; /* 0b0 */
934 DWORD64 R8
; /* 0b8 */
935 DWORD64 R9
; /* 0c0 */
936 DWORD64 R10
; /* 0c8 */
937 DWORD64 R11
; /* 0d0 */
938 DWORD64 R12
; /* 0d8 */
939 DWORD64 R13
; /* 0e0 */
940 DWORD64 R14
; /* 0e8 */
941 DWORD64 R15
; /* 0f0 */
944 DWORD64 Rip
; /* 0f8 */
948 XMM_SAVE_AREA32 FltSave
; /* 100 */
950 M128A Header
[2]; /* 100 */
951 M128A Legacy
[8]; /* 120 */
952 M128A Xmm0
; /* 1a0 */
953 M128A Xmm1
; /* 1b0 */
954 M128A Xmm2
; /* 1c0 */
955 M128A Xmm3
; /* 1d0 */
956 M128A Xmm4
; /* 1e0 */
957 M128A Xmm5
; /* 1f0 */
958 M128A Xmm6
; /* 200 */
959 M128A Xmm7
; /* 210 */
960 M128A Xmm8
; /* 220 */
961 M128A Xmm9
; /* 230 */
962 M128A Xmm10
; /* 240 */
963 M128A Xmm11
; /* 250 */
964 M128A Xmm12
; /* 260 */
965 M128A Xmm13
; /* 270 */
966 M128A Xmm14
; /* 280 */
967 M128A Xmm15
; /* 290 */
972 M128A VectorRegister
[26]; /* 300 */
973 DWORD64 VectorControl
; /* 4a0 */
976 DWORD64 DebugControl
; /* 4a8 */
977 DWORD64 LastBranchToRip
; /* 4b0 */
978 DWORD64 LastBranchFromRip
; /* 4b8 */
979 DWORD64 LastExceptionToRip
; /* 4c0 */
980 DWORD64 LastExceptionFromRip
; /* 4c8 */
983 typedef struct _RUNTIME_FUNCTION
988 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
990 #define UNWIND_HISTORY_TABLE_SIZE 12
992 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
995 PRUNTIME_FUNCTION FunctionEntry
;
996 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
998 #define UNWIND_HISTORY_TABLE_NONE 0
999 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1000 #define UNWIND_HISTORY_TABLE_LOCAL 2
1002 typedef struct _UNWIND_HISTORY_TABLE
1007 ULONG64 HighAddress
;
1008 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1009 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1011 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1015 PM128A FloatingContext
[16];
1039 PULONG64 IntegerContext
[16];
1060 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1062 BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD64
);
1063 BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
1064 PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD64
,DWORD64
*,UNWIND_HISTORY_TABLE
*);
1065 PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1067 #define UNW_FLAG_NHANDLER 0
1068 #define UNW_FLAG_EHANDLER 1
1069 #define UNW_FLAG_UHANDLER 2
1070 #define UNW_FLAG_CHAININFO 4
1072 #endif /* __x86_64__ */
1074 /* IA64 context definitions */
1077 typedef struct _FRAME_POINTERS
{
1078 ULONGLONG MemoryStackFp
;
1079 ULONGLONG BackingStoreFp
;
1080 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1082 #define UNWIND_HISTORY_TABLE_SIZE 12
1084 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1087 PRUNTIME_FUNCTION FunctionEntry
;
1088 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1090 typedef struct _UNWIND_HISTORY_TABLE
{
1094 ULONG64 HighAddress
;
1095 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1096 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1098 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1104 PFLOAT128 HighFloatingContext
[10];
1126 PULONGLONG IntS0Nat
;
1127 PULONGLONG IntS1Nat
;
1128 PULONGLONG IntS2Nat
;
1129 PULONGLONG IntS3Nat
;
1130 PULONGLONG IntSpNat
;
1146 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1148 ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1150 #endif /* __ia64__ */
1152 /* Alpha context definitions */
1153 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1155 #define CONTEXT_ALPHA 0x00020000
1157 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
1158 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
1159 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
1160 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1162 #define EXCEPTION_READ_FAULT 0
1163 #define EXCEPTION_WRITE_FAULT 1
1164 #define EXCEPTION_EXECUTE_FAULT 8
1166 typedef struct _CONTEXT
1168 /* selected by CONTEXT_FLOATING_POINT */
1202 /* selected by CONTEXT_INTEGER */
1236 /* selected by CONTEXT_FLOATING_POINT */
1240 /* selected by CONTEXT_CONTROL */
1247 #define _QUAD_PSR_OFFSET HighSoftFpcr
1248 #define _QUAD_FLAGS_OFFSET HighFir
1250 #endif /* _ALPHA_ */
1254 /* The following flags control the contents of the CONTEXT structure. */
1256 #define CONTEXT_ARM 0x0000040
1257 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1258 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1260 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1262 #define EXCEPTION_READ_FAULT 0
1263 #define EXCEPTION_WRITE_FAULT 1
1264 #define EXCEPTION_EXECUTE_FAULT 8
1266 typedef struct _CONTEXT
{
1267 /* The flags values within this flag control the contents of
1270 If the context record is used as an input parameter, then
1271 for each portion of the context record controlled by a flag
1272 whose value is set, it is assumed that that portion of the
1273 context record contains valid context. If the context record
1274 is being used to modify a thread's context, then only that
1275 portion of the threads context will be modified.
1277 If the context record is used as an IN OUT parameter to capture
1278 the context of a thread, then only those portions of the thread's
1279 context corresponding to set flags will be returned.
1281 The context record is never used as an OUT only parameter. */
1285 /* This section is specified/returned if the ContextFlags word contains
1286 the flag CONTEXT_INTEGER. */
1301 /* These are selected by CONTEXT_CONTROL */
1308 #endif /* __arm__ */
1311 /* Mips context definitions */
1314 #define CONTEXT_R4000 0x00010000
1316 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1317 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1318 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1320 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1322 #define EXCEPTION_READ_FAULT 0
1323 #define EXCEPTION_WRITE_FAULT 1
1324 #define EXCEPTION_EXECUTE_FAULT 8
1326 typedef struct _CONTEXT
1329 /* These are selected by CONTEXT_FLOATING_POINT */
1363 /* These are selected by CONTEXT_INTEGER */
1399 /* These are selected by CONTEXT_FLOATING_POINT */
1402 /* These are selected by CONTEXT_CONTROL */
1412 /* PowerPC context definitions */
1415 #define CONTEXT_CONTROL 0x0001
1416 #define CONTEXT_FLOATING_POINT 0x0002
1417 #define CONTEXT_INTEGER 0x0004
1418 #define CONTEXT_DEBUG_REGISTERS 0x0008
1419 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1421 #define EXCEPTION_READ_FAULT 0
1422 #define EXCEPTION_WRITE_FAULT 1
1423 #define EXCEPTION_EXECUTE_FAULT 8
1427 /* These are selected by CONTEXT_FLOATING_POINT */
1462 /* These are selected by CONTEXT_INTEGER */
1499 /* These are selected by CONTEXT_CONTROL */
1501 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1507 DWORD Dar
; /* Fault registers for coredump */
1509 DWORD Trap
; /* number of powerpc exception taken */
1511 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1522 typedef struct _STACK_FRAME_HEADER
1539 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1541 #endif /* __powerpc__ */
1548 * There is no official CONTEXT structure defined for the SPARC
1549 * architecture, so I just made one up.
1551 * This structure is valid only for 32-bit SPARC architectures,
1552 * not for 64-bit SPARC.
1554 * Note that this structure contains only the 'top-level' registers;
1555 * the rest of the register window chain is not visible.
1557 * The layout follows the Solaris 'prgregset_t' structure.
1561 #define CONTEXT_SPARC 0x10000000
1563 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1564 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1565 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1567 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1569 #define EXCEPTION_READ_FAULT 0
1570 #define EXCEPTION_WRITE_FAULT 1
1571 #define EXCEPTION_EXECUTE_FAULT 8
1573 typedef struct _CONTEXT
1577 /* These are selected by CONTEXT_INTEGER */
1611 /* These are selected by CONTEXT_CONTROL */
1619 /* FIXME: floating point registers missing */
1623 #endif /* __sparc__ */
1627 #define CONTEXT_IA64 0x00080000
1628 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1629 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1630 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1631 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1632 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1633 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1634 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1635 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1636 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1638 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1639 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1640 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1641 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1643 typedef struct _CONTEXT
1838 ULONGLONG RsBSPSTORE
;
1852 ULONGLONG UNUSEDPACK
;
1853 } CONTEXT
, *PCONTEXT
;
1855 typedef struct _RUNTIME_FUNCTION
1859 ULONG UnwindInfoAddress
;
1860 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1862 #endif /* __ia64__ */
1864 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1865 #error You need to define a CONTEXT for your CPU
1868 typedef CONTEXT
*PCONTEXT
;
1870 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1875 #define PRODUCT_UNLICENSED 0xABCDABCD
1876 #define PRODUCT_BUSINESS 0x00000006
1877 #define PRODUCT_BUSINESS_N 0x00000010
1878 #define PRODUCT_CLUSTER_SERVER 0x00000012
1879 #define PRODUCT_DATACENTER_SERVER 0x00000008
1880 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1881 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1882 #define PRODUCT_SERVER_V 0x00000025
1883 #define PRODUCT_ENTERPRISE 0x00000004
1884 #define PRODUCT_ENTERPRISE_N 0x0000001B
1885 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1886 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1887 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1888 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1889 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1890 #define PRODUCT_HOME_BASIC 0x00000002
1891 #define PRODUCT_HOME_BASIC_N 0x00000005
1892 #define PRODUCT_HOME_PREMIUM 0x00000003
1893 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1894 #define PRODUCT_HYPERV 0x0000002A
1895 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1896 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1897 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1898 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1899 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1900 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1901 #define PRODUCT_STANDARD_SERVER 0x00000007
1902 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1903 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1904 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1905 #define PRODUCT_STARTER 0x0000000B
1906 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1907 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1908 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1909 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1910 #define PRODUCT_UNDEFINED 0x00000000
1911 #define PRODUCT_ULTIMATE 0x00000001
1912 #define PRODUCT_ULTIMATE_N 0x0000001C
1913 #define PRODUCT_WEB_SERVER 0x00000011
1914 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1921 #define MAKELCID(l, s) (MAKELONG(l, s))
1923 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1924 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1925 #define SUBLANGID(l) ((WORD)(l) >> 10)
1927 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1928 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1930 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1931 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1932 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1933 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1934 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1935 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1937 #define UNREFERENCED_PARAMETER(u) (void)(u)
1938 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1939 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1941 #define LANG_NEUTRAL 0x00
1942 #define LANG_INVARIANT 0x7f
1944 #define LANG_AFRIKAANS 0x36
1945 #define LANG_ALBANIAN 0x1c
1946 #define LANG_ALSATIAN 0x84
1947 #define LANG_AMHARIC 0x5e
1948 #define LANG_ARABIC 0x01
1949 #define LANG_ARMENIAN 0x2b
1950 #define LANG_ASSAMESE 0x4d
1951 #define LANG_AZERI 0x2c
1952 #define LANG_BASHKIR 0x6d
1953 #define LANG_BASQUE 0x2d
1954 #define LANG_BELARUSIAN 0x23
1955 #define LANG_BENGALI 0x45
1956 #define LANG_BOSNIAN 0x1a
1957 #define LANG_BOSNIAN_NEUTRAL 0x781a
1958 #define LANG_BRETON 0x7e
1959 #define LANG_BULGARIAN 0x02
1960 #define LANG_CATALAN 0x03
1961 #define LANG_CHINESE 0x04
1962 #define LANG_CHINESE_SIMPLIFIED 0x0004
1963 #define LANG_CHINESE_TRADITIONAL 0x7c04
1964 #define LANG_CORSICAN 0x83
1965 #define LANG_CROATIAN 0x1a
1966 #define LANG_CZECH 0x05
1967 #define LANG_DANISH 0x06
1968 #define LANG_DARI 0x8c
1969 #define LANG_DIVEHI 0x65
1970 #define LANG_DUTCH 0x13
1971 #define LANG_ENGLISH 0x09
1972 #define LANG_ESTONIAN 0x25
1973 #define LANG_FAEROESE 0x38
1974 #define LANG_FARSI LANG_PERSIAN
1975 #define LANG_FILIPINO 0x64
1976 #define LANG_FINNISH 0x0b
1977 #define LANG_FRENCH 0x0c
1978 #define LANG_FRISIAN 0x62
1979 #define LANG_GALICIAN 0x56
1980 #define LANG_GEORGIAN 0x37
1981 #define LANG_GERMAN 0x07
1982 #define LANG_GREEK 0x08
1983 #define LANG_GREENLANDIC 0x6f
1984 #define LANG_GUJARATI 0x47
1985 #define LANG_HAUSA 0x68
1986 #define LANG_HEBREW 0x0d
1987 #define LANG_HINDI 0x39
1988 #define LANG_HUNGARIAN 0x0e
1989 #define LANG_ICELANDIC 0x0f
1990 #define LANG_IGBO 0x70
1991 #define LANG_INDONESIAN 0x21
1992 #define LANG_INUKTITUT 0x5d
1993 #define LANG_IRISH 0x3c
1994 #define LANG_ITALIAN 0x10
1995 #define LANG_JAPANESE 0x11
1996 #define LANG_KANNADA 0x4b
1997 #define LANG_KASHMIRI 0x60
1998 #define LANG_KAZAK 0x3f
1999 #define LANG_KHMER 0x53
2000 #define LANG_KICHE 0x86
2001 #define LANG_KINYARWANDA 0x87
2002 #define LANG_KONKANI 0x57
2003 #define LANG_KOREAN 0x12
2004 #define LANG_KYRGYZ 0x40
2005 #define LANG_LAO 0x54
2006 #define LANG_LATVIAN 0x26
2007 #define LANG_LITHUANIAN 0x27
2008 #define LANG_LOWER_SORBIAN 0x2e
2009 #define LANG_LUXEMBOURGISH 0x6e
2010 #define LANG_MACEDONIAN 0x2f
2011 #define LANG_MALAY 0x3e
2012 #define LANG_MALAYALAM 0x4c
2013 #define LANG_MALTESE 0x3a
2014 #define LANG_MANIPURI 0x58
2015 #define LANG_MAORI 0x81
2016 #define LANG_MAPUDUNGUN 0x7a
2017 #define LANG_MARATHI 0x4e
2018 #define LANG_MOHAWK 0x7c
2019 #define LANG_MONGOLIAN 0x50
2020 #define LANG_NEPALI 0x61
2021 #define LANG_NORWEGIAN 0x14
2022 #define LANG_OCCITAN 0x82
2023 #define LANG_ORIYA 0x48
2024 #define LANG_PASHTO 0x63
2025 #define LANG_PERSIAN 0x29
2026 #define LANG_POLISH 0x15
2027 #define LANG_PORTUGUESE 0x16
2028 #define LANG_PUNJABI 0x46
2029 #define LANG_QUECHUA 0x6b
2030 #define LANG_ROMANIAN 0x18
2031 #define LANG_ROMANSH 0x17
2032 #define LANG_RUSSIAN 0x19
2033 #define LANG_SAMI 0x3b
2034 #define LANG_SANSKRIT 0x4f
2035 #define LANG_SERBIAN 0x1a
2036 #define LANG_SERBIAN_NEUTRAL 0x7c1a
2037 #define LANG_SINDHI 0x59
2038 #define LANG_SINHALESE 0x5b
2039 #define LANG_SLOVAK 0x1b
2040 #define LANG_SLOVENIAN 0x24
2041 #define LANG_SOTHO 0x6c
2042 #define LANG_SPANISH 0x0a
2043 #define LANG_SWAHILI 0x41
2044 #define LANG_SWEDISH 0x1d
2045 #define LANG_SYRIAC 0x5a
2046 #define LANG_TAJIK 0x28
2047 #define LANG_TAMAZIGHT 0x5f
2048 #define LANG_TAMIL 0x49
2049 #define LANG_TATAR 0x44
2050 #define LANG_TELUGU 0x4a
2051 #define LANG_THAI 0x1e
2052 #define LANG_TIBETAN 0x51
2053 #define LANG_TIGRIGNA 0x73
2054 #define LANG_TSWANA 0x32
2055 #define LANG_TURKISH 0x1f
2056 #define LANG_TURKMEN 0x42
2057 #define LANG_UIGHUR 0x80
2058 #define LANG_UKRAINIAN 0x22
2059 #define LANG_UPPER_SORBIAN 0x2e
2060 #define LANG_URDU 0x20
2061 #define LANG_UZBEK 0x43
2062 #define LANG_VIETNAMESE 0x2a
2063 #define LANG_WELSH 0x52
2064 #define LANG_WOLOF 0x88
2065 #define LANG_XHOSA 0x34
2066 #define LANG_YAKUT 0x85
2067 #define LANG_YI 0x78
2068 #define LANG_YORUBA 0x6a
2069 #define LANG_ZULU 0x35
2071 /* These are documented by the MSDN but are missing from the Windows header */
2072 #define LANG_MALAGASY 0x8d
2074 /* FIXME: these are not defined anywhere */
2075 #define LANG_SUTU 0x30
2076 #define LANG_TSONGA 0x31
2077 #define LANG_VENDA 0x33
2079 /* non standard; keep the number high enough (but < 0xff) */
2080 #define LANG_ESPERANTO 0x8f
2081 #define LANG_WALON 0x90
2082 #define LANG_CORNISH 0x91
2083 #define LANG_GAELIC 0x94
2085 /* Sublanguage definitions */
2086 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
2087 #define SUBLANG_DEFAULT 0x01 /* user default */
2088 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
2089 #define SUBLANG_CUSTOM_DEFAULT 0x03
2090 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
2091 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
2093 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
2094 #define SUBLANG_ALBANIAN_ALBANIA 0x01
2095 #define SUBLANG_ALSATIAN_FRANCE 0x01
2096 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
2097 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
2098 #define SUBLANG_ARABIC_IRAQ 0x02
2099 #define SUBLANG_ARABIC_EGYPT 0x03
2100 #define SUBLANG_ARABIC_LIBYA 0x04
2101 #define SUBLANG_ARABIC_ALGERIA 0x05
2102 #define SUBLANG_ARABIC_MOROCCO 0x06
2103 #define SUBLANG_ARABIC_TUNISIA 0x07
2104 #define SUBLANG_ARABIC_OMAN 0x08
2105 #define SUBLANG_ARABIC_YEMEN 0x09
2106 #define SUBLANG_ARABIC_SYRIA 0x0a
2107 #define SUBLANG_ARABIC_JORDAN 0x0b
2108 #define SUBLANG_ARABIC_LEBANON 0x0c
2109 #define SUBLANG_ARABIC_KUWAIT 0x0d
2110 #define SUBLANG_ARABIC_UAE 0x0e
2111 #define SUBLANG_ARABIC_BAHRAIN 0x0f
2112 #define SUBLANG_ARABIC_QATAR 0x10
2113 #define SUBLANG_ARMENIAN_ARMENIA 0x01
2114 #define SUBLANG_ASSAMESE_INDIA 0x01
2115 #define SUBLANG_AZERI_LATIN 0x01
2116 #define SUBLANG_AZERI_CYRILLIC 0x02
2117 #define SUBLANG_BASHKIR_RUSSIA 0x01
2118 #define SUBLANG_BASQUE_BASQUE 0x01
2119 #define SUBLANG_BELARUSIAN_BELARUS 0x01
2120 #define SUBLANG_BENGALI_INDIA 0x01
2121 #define SUBLANG_BENGALI_BANGLADESH 0x02
2122 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
2123 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
2124 #define SUBLANG_BRETON_FRANCE 0x01
2125 #define SUBLANG_BULGARIAN_BULGARIA 0x01
2126 #define SUBLANG_CATALAN_CATALAN 0x01
2127 #define SUBLANG_CHINESE_TRADITIONAL 0x01
2128 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
2129 #define SUBLANG_CHINESE_HONGKONG 0x03
2130 #define SUBLANG_CHINESE_SINGAPORE 0x04
2131 #define SUBLANG_CHINESE_MACAU 0x05
2132 #define SUBLANG_CORSICAN_FRANCE 0x01
2133 #define SUBLANG_CROATIAN_CROATIA 0x01
2134 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
2135 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
2136 #define SUBLANG_DANISH_DENMARK 0x01
2137 #define SUBLANG_DARI_AFGHANISTAN 0x01
2138 #define SUBLANG_DIVEHI_MALDIVES 0x01
2139 #define SUBLANG_DUTCH 0x01
2140 #define SUBLANG_DUTCH_BELGIAN 0x02
2141 #define SUBLANG_ENGLISH_US 0x01
2142 #define SUBLANG_ENGLISH_UK 0x02
2143 #define SUBLANG_ENGLISH_AUS 0x03
2144 #define SUBLANG_ENGLISH_CAN 0x04
2145 #define SUBLANG_ENGLISH_NZ 0x05
2146 #define SUBLANG_ENGLISH_EIRE 0x06
2147 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
2148 #define SUBLANG_ENGLISH_JAMAICA 0x08
2149 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
2150 #define SUBLANG_ENGLISH_BELIZE 0x0a
2151 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
2152 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
2153 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
2154 #define SUBLANG_ENGLISH_INDIA 0x10
2155 #define SUBLANG_ENGLISH_MALAYSIA 0x11
2156 #define SUBLANG_ENGLISH_SINGAPORE 0x12
2157 #define SUBLANG_ESTONIAN_ESTONIA 0x01
2158 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
2159 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
2160 #define SUBLANG_FINNISH_FINLAND 0x01
2161 #define SUBLANG_FRENCH 0x01
2162 #define SUBLANG_FRENCH_BELGIAN 0x02
2163 #define SUBLANG_FRENCH_CANADIAN 0x03
2164 #define SUBLANG_FRENCH_SWISS 0x04
2165 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
2166 #define SUBLANG_FRENCH_MONACO 0x06
2167 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
2168 #define SUBLANG_GALICIAN_GALICIAN 0x01
2169 #define SUBLANG_GEORGIAN_GEORGIA 0x01
2170 #define SUBLANG_GERMAN 0x01
2171 #define SUBLANG_GERMAN_SWISS 0x02
2172 #define SUBLANG_GERMAN_AUSTRIAN 0x03
2173 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
2174 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
2175 #define SUBLANG_GREEK_GREECE 0x01
2176 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
2177 #define SUBLANG_GUJARATI_INDIA 0x01
2178 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
2179 #define SUBLANG_HEBREW_ISRAEL 0x01
2180 #define SUBLANG_HINDI_INDIA 0x01
2181 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
2182 #define SUBLANG_ICELANDIC_ICELAND 0x01
2183 #define SUBLANG_IGBO_NIGERIA 0x01
2184 #define SUBLANG_INDONESIAN_INDONESIA 0x01
2185 #define SUBLANG_INUKTITUT_CANADA 0x01
2186 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
2187 #define SUBLANG_IRISH_IRELAND 0x02
2188 #define SUBLANG_ITALIAN 0x01
2189 #define SUBLANG_ITALIAN_SWISS 0x02
2190 #define SUBLANG_JAPANESE_JAPAN 0x01
2191 #define SUBLANG_KANNADA_INDIA 0x01
2192 #define SUBLANG_KASHMIRI_SASIA 0x02
2193 #define SUBLANG_KASHMIRI_INDIA 0x02
2194 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
2195 #define SUBLANG_KHMER_CAMBODIA 0x01
2196 #define SUBLANG_KICHE_GUATEMALA 0x01
2197 #define SUBLANG_KINYARWANDA_RWANDA 0X01
2198 #define SUBLANG_KONKANI_INDIA 0x01
2199 #define SUBLANG_KOREAN 0x01
2200 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
2201 #define SUBLANG_LAO_LAO 0x01
2202 #define SUBLANG_LATVIAN_LATVIA 0x01
2203 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
2204 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
2205 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
2206 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
2207 #define SUBLANG_MALAY_MALAYSIA 0x01
2208 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
2209 #define SUBLANG_MALAYALAM_INDIA 0x01
2210 #define SUBLANG_MALTESE_MALTA 0x01
2211 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
2212 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
2213 #define SUBLANG_MARATHI_INDIA 0x01
2214 #define SUBLANG_MOHAWK_MOHAWK 0x01
2215 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
2216 #define SUBLANG_MONGOLIAN_PRC 0x02
2217 #define SUBLANG_NEPALI_INDIA 0x02
2218 #define SUBLANG_NEPALI_NEPAL 0x01
2219 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
2220 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
2221 #define SUBLANG_OCCITAN_FRANCE 0x01
2222 #define SUBLANG_ORIYA_INDIA 0x01
2223 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
2224 #define SUBLANG_PERSIAN_IRAN 0x01
2225 #define SUBLANG_POLISH_POLAND 0x01
2226 #define SUBLANG_PORTUGUESE 0x02
2227 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
2228 #define SUBLANG_PUNJABI_INDIA 0x01
2229 #define SUBLANG_QUECHUA_BOLIVIA 0x01
2230 #define SUBLANG_QUECHUA_ECUADOR 0x02
2231 #define SUBLANG_QUECHUA_PERU 0x03
2232 #define SUBLANG_ROMANIAN_ROMANIA 0x01
2233 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
2234 #define SUBLANG_RUSSIAN_RUSSIA 0x01
2235 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
2236 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
2237 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
2238 #define SUBLANG_SAMI_LULE_NORWAY 0x04
2239 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
2240 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
2241 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
2242 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
2243 #define SUBLANG_SAMI_INARI_FINLAND 0x09
2244 #define SUBLANG_SANSKRIT_INDIA 0x01
2245 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
2246 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
2247 #define SUBLANG_SERBIAN_CROATIA 0x01
2248 #define SUBLANG_SERBIAN_LATIN 0x02
2249 #define SUBLANG_SERBIAN_CYRILLIC 0x03
2250 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
2251 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
2252 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
2253 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
2254 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
2255 #define SUBLANG_SPANISH 0x01
2256 #define SUBLANG_SPANISH_MEXICAN 0x02
2257 #define SUBLANG_SPANISH_MODERN 0x03
2258 #define SUBLANG_SPANISH_GUATEMALA 0x04
2259 #define SUBLANG_SPANISH_COSTA_RICA 0x05
2260 #define SUBLANG_SPANISH_PANAMA 0x06
2261 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
2262 #define SUBLANG_SPANISH_VENEZUELA 0x08
2263 #define SUBLANG_SPANISH_COLOMBIA 0x09
2264 #define SUBLANG_SPANISH_PERU 0x0a
2265 #define SUBLANG_SPANISH_ARGENTINA 0x0b
2266 #define SUBLANG_SPANISH_ECUADOR 0x0c
2267 #define SUBLANG_SPANISH_CHILE 0x0d
2268 #define SUBLANG_SPANISH_URUGUAY 0x0e
2269 #define SUBLANG_SPANISH_PARAGUAY 0x0f
2270 #define SUBLANG_SPANISH_BOLIVIA 0x10
2271 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
2272 #define SUBLANG_SPANISH_HONDURAS 0x12
2273 #define SUBLANG_SPANISH_NICARAGUA 0x13
2274 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
2275 #define SUBLANG_SPANISH_US 0x15
2276 #define SUBLANG_SWAHILI_KENYA 0x01
2277 #define SUBLANG_SWEDISH 0x01
2278 #define SUBLANG_SWEDISH_FINLAND 0x02
2279 #define SUBLANG_SYRIAC_SYRIA 0x01
2280 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
2281 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
2282 #define SUBLANG_TAMIL_INDIA 0x01
2283 #define SUBLANG_TATAR_RUSSIA 0x01
2284 #define SUBLANG_TELUGU_INDIA 0x01
2285 #define SUBLANG_THAI_THAILAND 0x01
2286 #define SUBLANG_TIBETAN_PRC 0x01
2287 #define SUBLANG_TIBETAN_BHUTAN 0x02
2288 #define SUBLANG_TIGRIGNA_ERITREA 0x02
2289 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
2290 #define SUBLANG_TURKISH_TURKEY 0x01
2291 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
2292 #define SUBLANG_UIGHUR_PRC 0x01
2293 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
2294 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
2295 #define SUBLANG_URDU_PAKISTAN 0x01
2296 #define SUBLANG_URDU_INDIA 0x02
2297 #define SUBLANG_UZBEK_LATIN 0x01
2298 #define SUBLANG_UZBEK_CYRILLIC 0x02
2299 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
2300 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
2301 #define SUBLANG_WOLOF_SENEGAL 0x01
2302 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
2303 #define SUBLANG_YAKUT_RUSSIA 0x01
2304 #define SUBLANG_YI_PRC 0x01
2305 #define SUBLANG_YORUBA_NIGERIA 0x01
2306 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
2308 /* These are documented by the MSDN but are missing from the Windows header */
2309 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
2310 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
2311 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
2312 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
2313 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
2314 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
2315 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
2316 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
2318 /* FIXME: these are not defined anywhere */
2319 #define SUBLANG_DUTCH_SURINAM 0x03
2320 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
2321 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
2322 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
2323 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
2324 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
2325 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
2326 #define SUBLANG_GAELIC 0x01
2327 #define SUBLANG_GAELIC_SCOTTISH 0x02
2328 #define SUBLANG_GAELIC_MANX 0x03
2335 #define SORT_DEFAULT 0x0
2336 #define SORT_JAPANESE_XJIS 0x0
2337 #define SORT_JAPANESE_UNICODE 0x1
2338 #define SORT_CHINESE_BIG5 0x0
2339 #define SORT_CHINESE_UNICODE 0x1
2340 #define SORT_KOREAN_KSC 0x0
2341 #define SORT_KOREAN_UNICODE 0x1
2346 * Definitions for IsTextUnicode()
2349 #define IS_TEXT_UNICODE_ASCII16 0x0001
2350 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2351 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2352 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2353 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2354 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2355 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2356 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2357 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2358 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2359 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2360 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2361 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2362 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2363 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2364 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2366 #define MAXIMUM_WAIT_OBJECTS 64
2367 #define MAXIMUM_SUSPEND_COUNT 127
2369 #define WT_EXECUTEDEFAULT 0x00
2370 #define WT_EXECUTEINIOTHREAD 0x01
2371 #define WT_EXECUTEINUITHREAD 0x02
2372 #define WT_EXECUTEINWAITTHREAD 0x04
2373 #define WT_EXECUTEONLYONCE 0x08
2374 #define WT_EXECUTELONGFUNCTION 0x10
2375 #define WT_EXECUTEINTIMERTHREAD 0x20
2376 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2377 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2378 #define WT_EXECUTEINLONGTHREAD 0x10
2379 #define WT_EXECUTEDELETEWAIT 0x08
2380 #define WT_TRANSFER_IMPERSONATION 0x0100
2383 #define EXCEPTION_CONTINUABLE 0
2384 #define EXCEPTION_NONCONTINUABLE 0x01
2387 * The exception record used by Win32 to give additional information
2388 * about exception to exception handlers.
2391 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2393 typedef struct _EXCEPTION_RECORD
2395 DWORD ExceptionCode
;
2396 DWORD ExceptionFlags
;
2397 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2399 PVOID ExceptionAddress
;
2400 DWORD NumberParameters
;
2401 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2402 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2405 * The exception pointers structure passed to exception filters
2406 * in except() and the UnhandledExceptionFilter().
2409 typedef struct _EXCEPTION_POINTERS
2411 PEXCEPTION_RECORD ExceptionRecord
;
2412 PCONTEXT ContextRecord
;
2413 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2417 * The exception frame, used for registering exception handlers
2418 * Win32 cares only about this, but compilers generally emit
2419 * larger exception frames for their own use.
2422 struct _EXCEPTION_REGISTRATION_RECORD
;
2424 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2425 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2427 typedef struct _EXCEPTION_REGISTRATION_RECORD
2429 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2430 PEXCEPTION_HANDLER Handler
;
2431 } EXCEPTION_REGISTRATION_RECORD
;
2434 * function pointer to an exception filter
2437 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2439 typedef struct _NT_TIB
2441 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2449 PVOID ArbitraryUserPointer
;
2450 struct _NT_TIB
*Self
;
2455 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2456 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2459 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2462 #elif defined(__i386__) && defined(_MSC_VER)
2463 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2466 __asm mov eax
, fs
:[0x18];
2470 #elif defined(__x86_64__) && defined(__GNUC__)
2471 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2474 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2477 #elif defined(__x86_64__) && defined (_MSC_VER)
2478 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2481 __asm mov rax
, gs
:[0x30];
2486 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2489 #ifdef NONAMELESSUNION
2490 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2492 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2494 #define GetFiberData() (*(void **)GetCurrentFiber())
2496 #define TLS_MINIMUM_AVAILABLE 64
2499 * File formats definitions
2502 #include <pshpack2.h>
2503 typedef struct _IMAGE_DOS_HEADER
{
2504 WORD e_magic
; /* 00: MZ Header signature */
2505 WORD e_cblp
; /* 02: Bytes on last page of file */
2506 WORD e_cp
; /* 04: Pages in file */
2507 WORD e_crlc
; /* 06: Relocations */
2508 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2509 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2510 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2511 WORD e_ss
; /* 0e: Initial (relative) SS value */
2512 WORD e_sp
; /* 10: Initial SP value */
2513 WORD e_csum
; /* 12: Checksum */
2514 WORD e_ip
; /* 14: Initial IP value */
2515 WORD e_cs
; /* 16: Initial (relative) CS value */
2516 WORD e_lfarlc
; /* 18: File address of relocation table */
2517 WORD e_ovno
; /* 1a: Overlay number */
2518 WORD e_res
[4]; /* 1c: Reserved words */
2519 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2520 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2521 WORD e_res2
[10]; /* 28: Reserved words */
2522 DWORD e_lfanew
; /* 3c: Offset to extended header */
2523 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2524 #include <poppack.h>
2526 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2527 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2528 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2529 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2530 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2531 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2534 * This is the Windows executable (NE) header.
2535 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2537 #include <pshpack2.h>
2540 WORD ne_magic
; /* 00 NE signature 'NE' */
2541 BYTE ne_ver
; /* 02 Linker version number */
2542 BYTE ne_rev
; /* 03 Linker revision number */
2543 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2544 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2545 LONG ne_crc
; /* 08 Checksum */
2546 WORD ne_flags
; /* 0c Flags about segments in this file */
2547 WORD ne_autodata
; /* 0e Automatic data segment number */
2548 WORD ne_heap
; /* 10 Initial size of local heap */
2549 WORD ne_stack
; /* 12 Initial size of stack */
2550 DWORD ne_csip
; /* 14 Initial CS:IP */
2551 DWORD ne_sssp
; /* 18 Initial SS:SP */
2552 WORD ne_cseg
; /* 1c # of entries in segment table */
2553 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2554 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2555 WORD ne_segtab
; /* 22 Offset to segment table */
2556 WORD ne_rsrctab
; /* 24 Offset to resource table */
2557 WORD ne_restab
; /* 26 Offset to resident-name table */
2558 WORD ne_modtab
; /* 28 Offset to module reference table */
2559 WORD ne_imptab
; /* 2a Offset to imported name table */
2560 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2561 WORD ne_cmovent
; /* 30 # of movable entry points */
2562 WORD ne_align
; /* 32 Logical sector alignment shift count */
2563 WORD ne_cres
; /* 34 # of resource segments */
2564 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2565 BYTE ne_flagsothers
; /* 37 Additional information flags */
2566 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2567 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2568 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2569 WORD ne_expver
; /* 3e Expected Windows version number */
2570 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2571 #include <poppack.h>
2573 #include <pshpack2.h>
2574 typedef struct _IMAGE_VXD_HEADER
{
2589 DWORD e32_lastpagesize
;
2590 DWORD e32_fixupsize
;
2607 DWORD e32_impmodcnt
;
2613 DWORD e32_cbnrestab
;
2616 DWORD e32_debuginfo
;
2618 DWORD e32_instpreload
;
2619 DWORD e32_instdemand
;
2622 DWORD e32_winresoff
;
2623 DWORD e32_winreslen
;
2626 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2627 #include <poppack.h>
2629 /* These defines describe the meanings of the bits in the Characteristics
2632 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2633 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2634 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2635 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2636 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2637 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2638 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2639 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2640 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2641 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2642 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2643 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2644 #define IMAGE_FILE_SYSTEM 0x1000
2645 #define IMAGE_FILE_DLL 0x2000
2646 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2647 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2649 /* These are the settings of the Machine field. */
2650 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2651 #define IMAGE_FILE_MACHINE_I860 0x014d
2652 #define IMAGE_FILE_MACHINE_I386 0x014c
2653 #define IMAGE_FILE_MACHINE_R3000 0x0162
2654 #define IMAGE_FILE_MACHINE_R4000 0x0166
2655 #define IMAGE_FILE_MACHINE_R10000 0x0168
2656 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2657 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2658 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2659 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2660 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2661 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2662 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2663 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2664 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2665 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2666 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2667 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2668 #define IMAGE_FILE_MACHINE_IA64 0x0200
2669 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2670 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2671 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2672 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2673 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2674 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2675 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2676 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2677 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2678 #define IMAGE_FILE_MACHINE_M32R 0x9041
2679 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2681 /* Wine extension */
2682 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2684 #define IMAGE_SIZEOF_FILE_HEADER 20
2685 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2686 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2687 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2688 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2689 #define IMAGE_SIZEOF_SHORT_NAME 8
2690 #define IMAGE_SIZEOF_SECTION_HEADER 40
2691 #define IMAGE_SIZEOF_SYMBOL 18
2692 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2693 #define IMAGE_SIZEOF_RELOCATION 10
2694 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2695 #define IMAGE_SIZEOF_LINENUMBER 6
2696 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2698 /* Possible Magic values */
2699 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2700 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2701 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2704 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2705 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2707 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2708 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2711 /* These are indexes into the DataDirectory array */
2712 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2713 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2714 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2715 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2716 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2717 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2718 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2719 #define IMAGE_FILE_DESCRIPTION_STRING 7
2720 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2721 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2722 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2724 /* Directory Entries, indices into the DataDirectory array */
2726 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2727 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2728 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2729 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2730 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2731 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2732 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2733 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2734 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2735 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2736 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2737 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2738 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2739 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2740 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2742 /* Subsystem Values */
2744 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2745 #define IMAGE_SUBSYSTEM_NATIVE 1
2746 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2747 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2748 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2749 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2750 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2751 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2752 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2753 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2754 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2755 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2756 #define IMAGE_SUBSYSTEM_XBOX 14
2757 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2759 /* DLL Characteristics */
2760 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2761 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2762 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2763 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2764 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2765 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2766 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2767 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2769 typedef struct _IMAGE_FILE_HEADER
{
2771 WORD NumberOfSections
;
2772 DWORD TimeDateStamp
;
2773 DWORD PointerToSymbolTable
;
2774 DWORD NumberOfSymbols
;
2775 WORD SizeOfOptionalHeader
;
2776 WORD Characteristics
;
2777 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2779 typedef struct _IMAGE_DATA_DIRECTORY
{
2780 DWORD VirtualAddress
;
2782 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2784 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2786 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2787 WORD Magic
; /* 0x20b */
2788 BYTE MajorLinkerVersion
;
2789 BYTE MinorLinkerVersion
;
2791 DWORD SizeOfInitializedData
;
2792 DWORD SizeOfUninitializedData
;
2793 DWORD AddressOfEntryPoint
;
2795 ULONGLONG ImageBase
;
2796 DWORD SectionAlignment
;
2797 DWORD FileAlignment
;
2798 WORD MajorOperatingSystemVersion
;
2799 WORD MinorOperatingSystemVersion
;
2800 WORD MajorImageVersion
;
2801 WORD MinorImageVersion
;
2802 WORD MajorSubsystemVersion
;
2803 WORD MinorSubsystemVersion
;
2804 DWORD Win32VersionValue
;
2806 DWORD SizeOfHeaders
;
2809 WORD DllCharacteristics
;
2810 ULONGLONG SizeOfStackReserve
;
2811 ULONGLONG SizeOfStackCommit
;
2812 ULONGLONG SizeOfHeapReserve
;
2813 ULONGLONG SizeOfHeapCommit
;
2815 DWORD NumberOfRvaAndSizes
;
2816 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2817 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2819 typedef struct _IMAGE_NT_HEADERS64
{
2821 IMAGE_FILE_HEADER FileHeader
;
2822 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2823 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2825 typedef struct _IMAGE_OPTIONAL_HEADER
{
2827 /* Standard fields */
2829 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2830 BYTE MajorLinkerVersion
;
2831 BYTE MinorLinkerVersion
;
2833 DWORD SizeOfInitializedData
;
2834 DWORD SizeOfUninitializedData
;
2835 DWORD AddressOfEntryPoint
; /* 0x10 */
2839 /* NT additional fields */
2842 DWORD SectionAlignment
; /* 0x20 */
2843 DWORD FileAlignment
;
2844 WORD MajorOperatingSystemVersion
;
2845 WORD MinorOperatingSystemVersion
;
2846 WORD MajorImageVersion
;
2847 WORD MinorImageVersion
;
2848 WORD MajorSubsystemVersion
; /* 0x30 */
2849 WORD MinorSubsystemVersion
;
2850 DWORD Win32VersionValue
;
2852 DWORD SizeOfHeaders
;
2853 DWORD CheckSum
; /* 0x40 */
2855 WORD DllCharacteristics
;
2856 DWORD SizeOfStackReserve
;
2857 DWORD SizeOfStackCommit
;
2858 DWORD SizeOfHeapReserve
; /* 0x50 */
2859 DWORD SizeOfHeapCommit
;
2861 DWORD NumberOfRvaAndSizes
;
2862 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2864 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2866 typedef struct _IMAGE_NT_HEADERS
{
2867 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2868 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2869 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2870 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2873 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2874 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2875 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2876 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2878 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2879 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2880 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2881 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2884 #define IMAGE_SIZEOF_SHORT_NAME 8
2886 typedef struct _IMAGE_SECTION_HEADER
{
2887 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2889 DWORD PhysicalAddress
;
2892 DWORD VirtualAddress
;
2893 DWORD SizeOfRawData
;
2894 DWORD PointerToRawData
;
2895 DWORD PointerToRelocations
;
2896 DWORD PointerToLinenumbers
;
2897 WORD NumberOfRelocations
;
2898 WORD NumberOfLinenumbers
;
2899 DWORD Characteristics
;
2900 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2902 #define IMAGE_SIZEOF_SECTION_HEADER 40
2904 #define IMAGE_FIRST_SECTION(ntheader) \
2905 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2906 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2908 /* These defines are for the Characteristics bitfield. */
2909 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2910 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2911 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2912 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2913 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2914 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2916 #define IMAGE_SCN_CNT_CODE 0x00000020
2917 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2918 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2920 #define IMAGE_SCN_LNK_OTHER 0x00000100
2921 #define IMAGE_SCN_LNK_INFO 0x00000200
2922 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2923 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2924 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2926 /* 0x00002000 - Reserved */
2927 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2928 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2930 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2931 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2932 #define IMAGE_SCN_MEM_16BIT 0x00020000
2933 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2934 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2936 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2937 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2938 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2939 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2940 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2941 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2942 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2943 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2944 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2945 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2946 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2947 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2948 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2949 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2950 /* 0x00F00000 - Unused */
2951 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2953 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2956 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2957 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2958 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2959 #define IMAGE_SCN_MEM_SHARED 0x10000000
2960 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2961 #define IMAGE_SCN_MEM_READ 0x40000000
2962 #define IMAGE_SCN_MEM_WRITE 0x80000000
2964 #include <pshpack2.h>
2966 typedef struct _IMAGE_SYMBOL
{
2976 SHORT SectionNumber
;
2979 BYTE NumberOfAuxSymbols
;
2981 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2983 #define IMAGE_SIZEOF_SYMBOL 18
2985 typedef struct _IMAGE_LINENUMBER
{
2987 DWORD SymbolTableIndex
;
2988 DWORD VirtualAddress
;
2992 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2994 #define IMAGE_SIZEOF_LINENUMBER 6
2996 typedef union _IMAGE_AUX_SYMBOL
{
3008 DWORD PointerToLinenumber
;
3009 DWORD PointerToNextFunction
;
3018 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
3022 WORD NumberOfRelocations
;
3023 WORD NumberOfLinenumbers
;
3029 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
3031 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3033 #include <poppack.h>
3035 #define IMAGE_SYM_UNDEFINED (SHORT)0
3036 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3037 #define IMAGE_SYM_DEBUG (SHORT)-2
3039 #define IMAGE_SYM_TYPE_NULL 0x0000
3040 #define IMAGE_SYM_TYPE_VOID 0x0001
3041 #define IMAGE_SYM_TYPE_CHAR 0x0002
3042 #define IMAGE_SYM_TYPE_SHORT 0x0003
3043 #define IMAGE_SYM_TYPE_INT 0x0004
3044 #define IMAGE_SYM_TYPE_LONG 0x0005
3045 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3046 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3047 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3048 #define IMAGE_SYM_TYPE_UNION 0x0009
3049 #define IMAGE_SYM_TYPE_ENUM 0x000A
3050 #define IMAGE_SYM_TYPE_MOE 0x000B
3051 #define IMAGE_SYM_TYPE_BYTE 0x000C
3052 #define IMAGE_SYM_TYPE_WORD 0x000D
3053 #define IMAGE_SYM_TYPE_UINT 0x000E
3054 #define IMAGE_SYM_TYPE_DWORD 0x000F
3055 #define IMAGE_SYM_TYPE_PCODE 0x8000
3057 #define IMAGE_SYM_DTYPE_NULL 0
3058 #define IMAGE_SYM_DTYPE_POINTER 1
3059 #define IMAGE_SYM_DTYPE_FUNCTION 2
3060 #define IMAGE_SYM_DTYPE_ARRAY 3
3062 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3063 #define IMAGE_SYM_CLASS_NULL 0x0000
3064 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3065 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3066 #define IMAGE_SYM_CLASS_STATIC 0x0003
3067 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3068 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3069 #define IMAGE_SYM_CLASS_LABEL 0x0006
3070 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3071 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3072 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3073 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3074 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3075 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3076 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3077 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3078 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3079 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3080 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3081 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3083 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3084 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3085 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3086 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3087 #define IMAGE_SYM_CLASS_FILE 0x0067
3088 #define IMAGE_SYM_CLASS_SECTION 0x0068
3089 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3091 #define N_BTMASK 0x000F
3092 #define N_TMASK 0x0030
3093 #define N_TMASK1 0x00C0
3094 #define N_TMASK2 0x00F0
3098 #define BTYPE(x) ((x) & N_BTMASK)
3101 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3105 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3109 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3113 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3117 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3120 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3123 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3124 #define IMAGE_COMDAT_SELECT_ANY 2
3125 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3126 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3127 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3128 #define IMAGE_COMDAT_SELECT_LARGEST 6
3129 #define IMAGE_COMDAT_SELECT_NEWEST 7
3131 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3132 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3133 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3135 /* Export module directory */
3137 typedef struct _IMAGE_EXPORT_DIRECTORY
{
3138 DWORD Characteristics
;
3139 DWORD TimeDateStamp
;
3144 DWORD NumberOfFunctions
;
3145 DWORD NumberOfNames
;
3146 DWORD AddressOfFunctions
;
3147 DWORD AddressOfNames
;
3148 DWORD AddressOfNameOrdinals
;
3149 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
3151 /* Import name entry */
3152 typedef struct _IMAGE_IMPORT_BY_NAME
{
3155 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
3157 #include <pshpack8.h>
3159 typedef struct _IMAGE_THUNK_DATA64
{
3161 ULONGLONG ForwarderString
;
3164 ULONGLONG AddressOfData
;
3166 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3167 #include <poppack.h>
3169 typedef struct _IMAGE_THUNK_DATA32
{
3171 DWORD ForwarderString
;
3174 DWORD AddressOfData
;
3176 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3178 /* Import module directory */
3180 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3182 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3183 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3185 DWORD TimeDateStamp
; /* 0 if not bound,
3186 * -1 if bound, and real date\time stamp
3187 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3189 * otherwise date/time stamp of DLL bound to
3192 DWORD ForwarderChain
; /* -1 if no forwarders */
3194 /* RVA to IAT (if bound this IAT has actual addresses) */
3196 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3198 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3199 #define IMAGE_ORDINAL_FLAG32 0x80000000
3200 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3201 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3202 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3203 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3206 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3207 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3208 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3209 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3210 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3212 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3213 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3214 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3215 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3216 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3219 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3221 DWORD TimeDateStamp
;
3222 WORD OffsetModuleName
;
3223 WORD NumberOfModuleForwarderRefs
;
3224 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3225 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3227 typedef struct _IMAGE_BOUND_FORWARDER_REF
3229 DWORD TimeDateStamp
;
3230 WORD OffsetModuleName
;
3232 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3234 typedef struct _IMAGE_BASE_RELOCATION
3236 DWORD VirtualAddress
;
3238 /* WORD TypeOffset[1]; */
3239 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3241 #include <pshpack2.h>
3243 typedef struct _IMAGE_RELOCATION
3246 DWORD VirtualAddress
;
3249 DWORD SymbolTableIndex
;
3251 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3253 #include <poppack.h>
3255 #define IMAGE_SIZEOF_RELOCATION 10
3257 /* generic relocation types */
3258 #define IMAGE_REL_BASED_ABSOLUTE 0
3259 #define IMAGE_REL_BASED_HIGH 1
3260 #define IMAGE_REL_BASED_LOW 2
3261 #define IMAGE_REL_BASED_HIGHLOW 3
3262 #define IMAGE_REL_BASED_HIGHADJ 4
3263 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3264 #define IMAGE_REL_BASED_SECTION 6
3265 #define IMAGE_REL_BASED_REL 7
3266 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3267 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3268 #define IMAGE_REL_BASED_DIR64 10
3269 #define IMAGE_REL_BASED_HIGH3ADJ 11
3271 /* I386 relocation types */
3272 #define IMAGE_REL_I386_ABSOLUTE 0
3273 #define IMAGE_REL_I386_DIR16 1
3274 #define IMAGE_REL_I386_REL16 2
3275 #define IMAGE_REL_I386_DIR32 6
3276 #define IMAGE_REL_I386_DIR32NB 7
3277 #define IMAGE_REL_I386_SEG12 9
3278 #define IMAGE_REL_I386_SECTION 10
3279 #define IMAGE_REL_I386_SECREL 11
3280 #define IMAGE_REL_I386_REL32 20
3282 /* MIPS relocation types */
3283 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3284 #define IMAGE_REL_MIPS_REFHALF 0x0001
3285 #define IMAGE_REL_MIPS_REFWORD 0x0002
3286 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3287 #define IMAGE_REL_MIPS_REFHI 0x0004
3288 #define IMAGE_REL_MIPS_REFLO 0x0005
3289 #define IMAGE_REL_MIPS_GPREL 0x0006
3290 #define IMAGE_REL_MIPS_LITERAL 0x0007
3291 #define IMAGE_REL_MIPS_SECTION 0x000A
3292 #define IMAGE_REL_MIPS_SECREL 0x000B
3293 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3294 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3295 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3296 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3297 #define IMAGE_REL_MIPS_PAIR 0x0025
3299 /* ALPHA relocation types */
3300 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3301 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3302 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3303 #define IMAGE_REL_ALPHA_GPREL 0x0003
3304 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3305 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3306 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3307 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3308 #define IMAGE_REL_ALPHA_HINT 0x0008
3309 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3310 #define IMAGE_REL_ALPHA_REFHI 0x000A
3311 #define IMAGE_REL_ALPHA_REFLO 0x000B
3312 #define IMAGE_REL_ALPHA_PAIR 0x000C
3313 #define IMAGE_REL_ALPHA_MATCH 0x000D
3314 #define IMAGE_REL_ALPHA_SECTION 0x000E
3315 #define IMAGE_REL_ALPHA_SECREL 0x000F
3316 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3317 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3318 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3319 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3320 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3321 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3322 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3323 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3325 /* PowerPC relocation types */
3326 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3327 #define IMAGE_REL_PPC_ADDR64 0x0001
3328 #define IMAGE_REL_PPC_ADDR 0x0002
3329 #define IMAGE_REL_PPC_ADDR24 0x0003
3330 #define IMAGE_REL_PPC_ADDR16 0x0004
3331 #define IMAGE_REL_PPC_ADDR14 0x0005
3332 #define IMAGE_REL_PPC_REL24 0x0006
3333 #define IMAGE_REL_PPC_REL14 0x0007
3334 #define IMAGE_REL_PPC_TOCREL16 0x0008
3335 #define IMAGE_REL_PPC_TOCREL14 0x0009
3336 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3337 #define IMAGE_REL_PPC_SECREL 0x000B
3338 #define IMAGE_REL_PPC_SECTION 0x000C
3339 #define IMAGE_REL_PPC_IFGLUE 0x000D
3340 #define IMAGE_REL_PPC_IMGLUE 0x000E
3341 #define IMAGE_REL_PPC_SECREL16 0x000F
3342 #define IMAGE_REL_PPC_REFHI 0x0010
3343 #define IMAGE_REL_PPC_REFLO 0x0011
3344 #define IMAGE_REL_PPC_PAIR 0x0012
3345 #define IMAGE_REL_PPC_SECRELLO 0x0013
3346 #define IMAGE_REL_PPC_SECRELHI 0x0014
3347 #define IMAGE_REL_PPC_GPREL 0x0015
3348 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3350 #define IMAGE_REL_PPC_NEG 0x0100
3351 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3352 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3353 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3355 /* SH3 ? relocation type */
3356 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3357 #define IMAGE_REL_SH3_DIRECT16 0x0001
3358 #define IMAGE_REL_SH3_DIRECT 0x0002
3359 #define IMAGE_REL_SH3_DIRECT8 0x0003
3360 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3361 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3362 #define IMAGE_REL_SH3_DIRECT4 0x0006
3363 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3364 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3365 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3366 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3367 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3368 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3369 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3370 #define IMAGE_REL_SH3_SECTION 0x000E
3371 #define IMAGE_REL_SH3_SECREL 0x000F
3372 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3374 /* ARM (Archimedes?) relocation types */
3375 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3376 #define IMAGE_REL_ARM_ADDR 0x0001
3377 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3378 #define IMAGE_REL_ARM_BRANCH24 0x0003
3379 #define IMAGE_REL_ARM_BRANCH11 0x0004
3380 #define IMAGE_REL_ARM_SECTION 0x000E
3381 #define IMAGE_REL_ARM_SECREL 0x000F
3383 /* IA64 relocation types */
3384 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3385 #define IMAGE_REL_IA64_IMM14 0x0001
3386 #define IMAGE_REL_IA64_IMM22 0x0002
3387 #define IMAGE_REL_IA64_IMM64 0x0003
3388 #define IMAGE_REL_IA64_DIR 0x0004
3389 #define IMAGE_REL_IA64_DIR64 0x0005
3390 #define IMAGE_REL_IA64_PCREL21B 0x0006
3391 #define IMAGE_REL_IA64_PCREL21M 0x0007
3392 #define IMAGE_REL_IA64_PCREL21F 0x0008
3393 #define IMAGE_REL_IA64_GPREL22 0x0009
3394 #define IMAGE_REL_IA64_LTOFF22 0x000A
3395 #define IMAGE_REL_IA64_SECTION 0x000B
3396 #define IMAGE_REL_IA64_SECREL22 0x000C
3397 #define IMAGE_REL_IA64_SECREL64I 0x000D
3398 #define IMAGE_REL_IA64_SECREL 0x000E
3399 #define IMAGE_REL_IA64_LTOFF64 0x000F
3400 #define IMAGE_REL_IA64_DIR32NB 0x0010
3401 #define IMAGE_REL_IA64_RESERVED_11 0x0011
3402 #define IMAGE_REL_IA64_RESERVED_12 0x0012
3403 #define IMAGE_REL_IA64_RESERVED_13 0x0013
3404 #define IMAGE_REL_IA64_RESERVED_14 0x0014
3405 #define IMAGE_REL_IA64_RESERVED_15 0x0015
3406 #define IMAGE_REL_IA64_RESERVED_16 0x0016
3407 #define IMAGE_REL_IA64_ADDEND 0x001F
3409 /* AMD64 relocation types */
3410 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3411 #define IMAGE_REL_AMD64_ADDR64 0x0001
3412 #define IMAGE_REL_AMD64_ADDR32 0x0002
3413 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3414 #define IMAGE_REL_AMD64_REL32 0x0004
3415 #define IMAGE_REL_AMD64_REL32_1 0x0005
3416 #define IMAGE_REL_AMD64_REL32_2 0x0006
3417 #define IMAGE_REL_AMD64_REL32_3 0x0007
3418 #define IMAGE_REL_AMD64_REL32_4 0x0008
3419 #define IMAGE_REL_AMD64_REL32_5 0x0009
3420 #define IMAGE_REL_AMD64_SECTION 0x000A
3421 #define IMAGE_REL_AMD64_SECREL 0x000B
3422 #define IMAGE_REL_AMD64_SECREL7 0x000C
3423 #define IMAGE_REL_AMD64_TOKEN 0x000D
3424 #define IMAGE_REL_AMD64_SREL32 0x000E
3425 #define IMAGE_REL_AMD64_PAIR 0x000F
3426 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3428 /* archive format */
3430 #define IMAGE_ARCHIVE_START_SIZE 8
3431 #define IMAGE_ARCHIVE_START "!<arch>\n"
3432 #define IMAGE_ARCHIVE_END "`\n"
3433 #define IMAGE_ARCHIVE_PAD "\n"
3434 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3435 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3437 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3446 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3448 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3450 typedef struct _IMPORT_OBJECT_HEADER
3456 DWORD TimeDateStamp
;
3466 } IMPORT_OBJECT_HEADER
;
3468 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3470 typedef enum IMPORT_OBJECT_TYPE
3472 IMPORT_OBJECT_CODE
= 0,
3473 IMPORT_OBJECT_DATA
= 1,
3474 IMPORT_OBJECT_CONST
= 2
3475 } IMPORT_OBJECT_TYPE
;
3477 typedef enum IMPORT_OBJECT_NAME_TYPE
3479 IMPORT_OBJECT_ORDINAL
= 0,
3480 IMPORT_OBJECT_NAME
= 1,
3481 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3482 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3483 } IMPORT_OBJECT_NAME_TYPE
;
3485 typedef struct _ANON_OBJECT_HEADER
3491 DWORD TimeDateStamp
;
3494 } ANON_OBJECT_HEADER
;
3497 * Resource directory stuff
3499 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3500 DWORD Characteristics
;
3501 DWORD TimeDateStamp
;
3504 WORD NumberOfNamedEntries
;
3505 WORD NumberOfIdEntries
;
3506 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3507 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3509 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3510 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3512 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3515 #ifdef BITFIELDS_BIGENDIAN
3516 unsigned NameIsString
:1;
3517 unsigned NameOffset
:31;
3519 unsigned NameOffset
:31;
3520 unsigned NameIsString
:1;
3525 #ifdef WORDS_BIGENDIAN
3537 #ifdef BITFIELDS_BIGENDIAN
3538 unsigned DataIsDirectory
:1;
3539 unsigned OffsetToDirectory
:31;
3541 unsigned OffsetToDirectory
:31;
3542 unsigned DataIsDirectory
:1;
3546 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3549 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3551 CHAR NameString
[ 1 ];
3552 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3554 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3556 WCHAR NameString
[ 1 ];
3557 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3559 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3564 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3567 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3568 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3571 typedef struct _IMAGE_TLS_DIRECTORY64
{
3572 ULONGLONG StartAddressOfRawData
;
3573 ULONGLONG EndAddressOfRawData
;
3574 ULONGLONG AddressOfIndex
;
3575 ULONGLONG AddressOfCallBacks
;
3576 DWORD SizeOfZeroFill
;
3577 DWORD Characteristics
;
3578 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3580 typedef struct _IMAGE_TLS_DIRECTORY32
{
3581 DWORD StartAddressOfRawData
;
3582 DWORD EndAddressOfRawData
;
3583 DWORD AddressOfIndex
;
3584 DWORD AddressOfCallBacks
;
3585 DWORD SizeOfZeroFill
;
3586 DWORD Characteristics
;
3587 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3590 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3591 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3593 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3594 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3597 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3598 DWORD Characteristics
;
3599 DWORD TimeDateStamp
;
3604 DWORD AddressOfRawData
;
3605 DWORD PointerToRawData
;
3606 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3608 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3609 #define IMAGE_DEBUG_TYPE_COFF 1
3610 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3611 #define IMAGE_DEBUG_TYPE_FPO 3
3612 #define IMAGE_DEBUG_TYPE_MISC 4
3613 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3614 #define IMAGE_DEBUG_TYPE_FIXUP 6
3615 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3616 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3617 #define IMAGE_DEBUG_TYPE_BORLAND 9
3618 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3620 typedef enum ReplacesCorHdrNumericDefines
3622 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3623 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3624 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3625 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3626 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3628 COR_VERSION_MAJOR_V2
= 2,
3629 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3630 COR_VERSION_MINOR
= 0,
3631 COR_DELETED_NAME_LENGTH
= 8,
3632 COR_VTABLEGAP_NAME_LENGTH
= 8,
3634 NATIVE_TYPE_MAX_CB
= 1,
3635 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3637 IMAGE_COR_MIH_METHODRVA
= 0x01,
3638 IMAGE_COR_MIH_EHRVA
= 0x02,
3639 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3641 COR_VTABLE_32BIT
= 0x01,
3642 COR_VTABLE_64BIT
= 0x02,
3643 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3644 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3646 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3648 MAX_CLASS_NAME
= 1024,
3649 MAX_PACKAGE_NAME
= 1024,
3650 } ReplacesCorHdrNumericDefines
;
3652 typedef struct IMAGE_COR20_HEADER
3655 WORD MajorRuntimeVersion
;
3656 WORD MinorRuntimeVersion
;
3658 IMAGE_DATA_DIRECTORY MetaData
;
3660 DWORD EntryPointToken
;
3662 IMAGE_DATA_DIRECTORY Resources
;
3663 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3664 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3665 IMAGE_DATA_DIRECTORY VTableFixups
;
3666 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3667 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3669 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3671 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3672 DWORD NumberOfSymbols
;
3673 DWORD LvaToFirstSymbol
;
3674 DWORD NumberOfLinenumbers
;
3675 DWORD LvaToFirstLinenumber
;
3676 DWORD RvaToFirstByteOfCode
;
3677 DWORD RvaToLastByteOfCode
;
3678 DWORD RvaToFirstByteOfData
;
3679 DWORD RvaToLastByteOfData
;
3680 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3683 #define FRAME_TRAP 1
3685 #define FRAME_NONFPO 3
3687 typedef struct _FPO_DATA
{
3698 } FPO_DATA
, *PFPO_DATA
;
3700 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
3702 DWORD TimeDateStamp
;
3705 DWORD GlobalFlagsClear
;
3706 DWORD GlobalFlagsSet
;
3707 DWORD CriticalSectionDefaultTimeout
;
3708 DWORD DeCommitFreeBlockThreshold
;
3709 DWORD DeCommitTotalFreeThreshold
;
3710 PVOID LockPrefixTable
;
3711 DWORD MaximumAllocationSize
;
3712 DWORD VirtualMemoryThreshold
;
3713 DWORD ProcessHeapFlags
;
3714 DWORD ProcessAffinityMask
;
3718 DWORD SecurityCookie
;
3719 DWORD SEHandlerTable
;
3720 DWORD SEHandlerCount
;
3721 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
3723 typedef struct _IMAGE_FUNCTION_ENTRY
{
3724 DWORD StartingAddress
;
3725 DWORD EndingAddress
;
3726 DWORD EndOfPrologue
;
3727 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3729 #define IMAGE_DEBUG_MISC_EXENAME 1
3731 typedef struct _IMAGE_DEBUG_MISC
{
3737 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3739 /* This is the structure that appears at the very start of a .DBG file. */
3741 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3745 WORD Characteristics
;
3746 DWORD TimeDateStamp
;
3750 DWORD NumberOfSections
;
3751 DWORD ExportedNamesSize
;
3752 DWORD DebugDirectorySize
;
3753 DWORD SectionAlignment
;
3754 DWORD Reserved
[ 2 ];
3755 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3757 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3760 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3764 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3765 #define MESSAGE_RESOURCE_UNICODE 0x0001
3767 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3770 DWORD OffsetToEntries
;
3771 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3773 typedef struct tagMESSAGE_RESOURCE_DATA
{
3774 DWORD NumberOfBlocks
;
3775 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3776 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3779 * Here follows typedefs for security and tokens.
3783 * First a constant for the following typedefs.
3786 #define ANYSIZE_ARRAY 1
3788 /* FIXME: Orphan. What does it point to? */
3789 typedef PVOID PACCESS_TOKEN
;
3790 typedef PVOID PSECURITY_DESCRIPTOR
;
3793 typedef enum _TOKEN_ELEVATION_TYPE
{
3794 TokenElevationTypeDefault
= 1,
3795 TokenElevationTypeFull
,
3796 TokenElevationTypeLimited
3797 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
3800 * TOKEN_INFORMATION_CLASS
3803 typedef enum _TOKEN_INFORMATION_CLASS
{
3812 TokenImpersonationLevel
,
3814 TokenRestrictedSids
,
3816 TokenGroupsAndPrivileges
,
3817 TokenSessionReference
,
3824 TokenHasRestrictions
,
3825 TokenAccessInformation
,
3826 TokenVirtualizationAllowed
,
3827 TokenVirtualizationEnabled
,
3828 TokenIntegrityLevel
,
3830 TokenMandatoryPolicy
,
3833 } TOKEN_INFORMATION_CLASS
;
3835 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3836 #define TOKEN_ADJUST_GROUPS 0x0040
3837 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3838 #define TOKEN_ADJUST_SESSIONID 0x0100
3839 #define TOKEN_ASSIGN_PRIMARY 0x0001
3840 #define TOKEN_DUPLICATE 0x0002
3841 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3842 #define TOKEN_IMPERSONATE 0x0004
3843 #define TOKEN_QUERY 0x0008
3844 #define TOKEN_QUERY_SOURCE 0x0010
3845 #define TOKEN_ADJUST_DEFAULT 0x0080
3846 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3847 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3848 TOKEN_ADJUST_PRIVILEGES | \
3849 TOKEN_ADJUST_GROUPS | \
3850 TOKEN_ADJUST_DEFAULT )
3851 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3852 TOKEN_ASSIGN_PRIMARY | \
3854 TOKEN_IMPERSONATE | \
3856 TOKEN_QUERY_SOURCE | \
3857 TOKEN_ADJUST_PRIVILEGES | \
3858 TOKEN_ADJUST_GROUPS | \
3859 TOKEN_ADJUST_SESSIONID | \
3860 TOKEN_ADJUST_DEFAULT )
3862 #ifndef _SECURITY_DEFINED
3863 #define _SECURITY_DEFINED
3866 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3868 typedef struct _GENERIC_MAPPING
{
3869 ACCESS_MASK GenericRead
;
3870 ACCESS_MASK GenericWrite
;
3871 ACCESS_MASK GenericExecute
;
3872 ACCESS_MASK GenericAll
;
3873 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3875 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3876 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3879 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3880 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3884 typedef struct _SID
{
3886 BYTE SubAuthorityCount
;
3887 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3888 DWORD SubAuthority
[1];
3890 #endif /* !defined(SID_DEFINED) */
3892 #define SID_REVISION (1) /* Current revision */
3893 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3894 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3896 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3902 #define ACL_REVISION1 1
3903 #define ACL_REVISION2 2
3904 #define ACL_REVISION3 3
3905 #define ACL_REVISION4 4
3907 #define MIN_ACL_REVISION ACL_REVISION2
3908 #define MAX_ACL_REVISION ACL_REVISION4
3910 #define ACL_REVISION 2
3912 typedef struct _ACL
{
3920 typedef enum _ACL_INFORMATION_CLASS
3922 AclRevisionInformation
= 1,
3924 } ACL_INFORMATION_CLASS
;
3926 typedef struct _ACL_REVISION_INFORMATION
3929 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
3931 typedef struct _ACL_SIZE_INFORMATION
3934 DWORD AclBytesInUse
;
3936 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
3938 /* SECURITY_DESCRIPTOR */
3939 #define SECURITY_DESCRIPTOR_REVISION 1
3940 #define SECURITY_DESCRIPTOR_REVISION1 1
3946 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3947 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3948 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3949 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3950 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3951 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3952 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3953 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3954 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3955 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3956 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3957 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3958 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3959 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3960 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3961 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3962 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3963 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3964 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3965 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3966 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3967 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3968 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3969 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3970 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3971 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3972 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3973 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3974 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3976 #define SE_GROUP_MANDATORY 0x00000001
3977 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3978 #define SE_GROUP_ENABLED 0x00000004
3979 #define SE_GROUP_OWNER 0x00000008
3980 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3981 #define SE_GROUP_LOGON_ID 0xC0000000
3982 #define SE_GROUP_RESOURCE 0x20000000
3984 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3985 #define SE_PRIVILEGE_ENABLED 0x00000002
3986 #define SE_PRIVILEGE_REMOVE 0x00000004
3987 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3989 #define PRIVILEGE_SET_ALL_NECESSARY 1
3991 #define SE_OWNER_DEFAULTED 0x00000001
3992 #define SE_GROUP_DEFAULTED 0x00000002
3993 #define SE_DACL_PRESENT 0x00000004
3994 #define SE_DACL_DEFAULTED 0x00000008
3995 #define SE_SACL_PRESENT 0x00000010
3996 #define SE_SACL_DEFAULTED 0x00000020
3997 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3998 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3999 #define SE_DACL_AUTO_INHERITED 0x00000400
4000 #define SE_SACL_AUTO_INHERITED 0x00000800
4001 #define SE_DACL_PROTECTED 0x00001000
4002 #define SE_SACL_PROTECTED 0x00002000
4003 #define SE_RM_CONTROL_VALID 0x00004000
4004 #define SE_SELF_RELATIVE 0x00008000
4006 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
4007 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
4009 /* The security descriptor structure */
4013 SECURITY_DESCRIPTOR_CONTROL Control
;
4018 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
4023 SECURITY_DESCRIPTOR_CONTROL Control
;
4028 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
4030 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4032 #endif /* _SECURITY_DEFINED */
4035 * SID_AND_ATTRIBUTES
4038 typedef struct _SID_AND_ATTRIBUTES
{
4041 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
4043 /* security entities */
4044 #define SECURITY_NULL_RID (0x00000000L)
4045 #define SECURITY_WORLD_RID (0x00000000L)
4046 #define SECURITY_LOCAL_RID (0X00000000L)
4048 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4051 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4054 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4057 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4058 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
4059 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
4060 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
4061 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
4064 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4067 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4068 #define SECURITY_DIALUP_RID 0x00000001L
4069 #define SECURITY_NETWORK_RID 0x00000002L
4070 #define SECURITY_BATCH_RID 0x00000003L
4071 #define SECURITY_INTERACTIVE_RID 0x00000004L
4072 #define SECURITY_LOGON_IDS_RID 0x00000005L
4073 #define SECURITY_SERVICE_RID 0x00000006L
4074 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
4075 #define SECURITY_PROXY_RID 0x00000008L
4076 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
4077 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4078 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
4079 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
4080 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
4081 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
4082 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
4083 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
4084 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
4085 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
4086 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
4087 #define SECURITY_NT_NON_UNIQUE 0x00000015L
4088 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
4090 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
4091 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
4092 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
4093 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
4094 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
4095 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
4096 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
4098 #define FOREST_USER_RID_MAX 0x000001F3L
4099 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
4100 #define DOMAIN_USER_RID_GUEST 0x000001F5L
4101 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
4102 #define DOMAIN_USER_RID_MAX 0x000003E7L
4104 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
4105 #define DOMAIN_GROUP_RID_USERS 0x00000201L
4106 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
4107 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
4108 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
4109 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
4110 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
4111 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
4112 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
4114 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4115 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
4116 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
4117 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
4118 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
4119 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
4120 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
4122 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
4123 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
4124 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
4125 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
4127 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
4128 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
4129 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
4130 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
4132 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
4133 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
4134 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
4135 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
4136 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
4137 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
4139 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
4140 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
4141 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
4142 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
4143 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
4145 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4147 #define SECURITY_PACKAGE_RID_COUNT 2L
4148 #define SECURITY_LOGON_IDS_RID_COUNT 3L
4154 WinCreatorOwnerSid
= 3,
4155 WinCreatorGroupSid
= 4,
4156 WinCreatorOwnerServerSid
= 5,
4157 WinCreatorGroupServerSid
= 6,
4158 WinNtAuthoritySid
= 7,
4162 WinInteractiveSid
= 11,
4164 WinAnonymousSid
= 13,
4166 WinEnterpriseControllersSid
= 15,
4168 WinAuthenticatedUserSid
= 17,
4169 WinRestrictedCodeSid
= 18,
4170 WinTerminalServerSid
= 19,
4171 WinRemoteLogonIdSid
= 20,
4172 WinLogonIdsSid
= 21,
4173 WinLocalSystemSid
= 22,
4174 WinLocalServiceSid
= 23,
4175 WinNetworkServiceSid
= 24,
4176 WinBuiltinDomainSid
= 25,
4177 WinBuiltinAdministratorsSid
= 26,
4178 WinBuiltinUsersSid
= 27,
4179 WinBuiltinGuestsSid
= 28,
4180 WinBuiltinPowerUsersSid
= 29,
4181 WinBuiltinAccountOperatorsSid
= 30,
4182 WinBuiltinSystemOperatorsSid
= 31,
4183 WinBuiltinPrintOperatorsSid
= 32,
4184 WinBuiltinBackupOperatorsSid
= 33,
4185 WinBuiltinReplicatorSid
= 34,
4186 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4187 WinBuiltinRemoteDesktopUsersSid
= 36,
4188 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4189 WinAccountAdministratorSid
= 38,
4190 WinAccountGuestSid
= 39,
4191 WinAccountKrbtgtSid
= 40,
4192 WinAccountDomainAdminsSid
= 41,
4193 WinAccountDomainUsersSid
= 42,
4194 WinAccountDomainGuestsSid
= 43,
4195 WinAccountComputersSid
= 44,
4196 WinAccountControllersSid
= 45,
4197 WinAccountCertAdminsSid
= 46,
4198 WinAccountSchemaAdminsSid
= 47,
4199 WinAccountEnterpriseAdminsSid
= 48,
4200 WinAccountPolicyAdminsSid
= 49,
4201 WinAccountRasAndIasServersSid
= 50,
4202 WinNTLMAuthenticationSid
= 51,
4203 WinDigestAuthenticationSid
= 52,
4204 WinSChannelAuthenticationSid
= 53,
4205 WinThisOrganizationSid
= 54,
4206 WinOtherOrganizationSid
= 55,
4207 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4208 WinBuiltinPerfMonitoringUsersSid
= 57,
4209 WinBuiltinPerfLoggingUsersSid
= 58,
4210 WinBuiltinAuthorizationAccessSid
= 59,
4211 WinBuiltinTerminalServerLicenseServersSid
= 60,
4212 WinBuiltinDCOMUsersSid
= 61,
4213 WinBuiltinIUsersSid
= 62,
4215 WinBuiltinCryptoOperatorsSid
= 64,
4216 WinUntrustedLabelSid
= 65,
4217 WinLowLabelSid
= 66,
4218 WinMediumLabelSid
= 67,
4219 WinHighLabelSid
= 68,
4220 WinSystemLabelSid
= 69,
4221 WinWriteRestrictedCodeSid
= 70,
4222 WinCreatorOwnerRightsSid
= 71,
4223 WinCacheablePrincipalsGroupSid
= 72,
4224 WinNonCacheablePrincipalsGroupSid
= 73,
4225 WinEnterpriseReadonlyControllersSid
= 74,
4226 WinAccountReadonlyControllersSid
= 75,
4227 WinBuiltinEventLogReadersGroup
= 76,
4228 } WELL_KNOWN_SID_TYPE
;
4234 typedef struct _TOKEN_USER
{
4235 SID_AND_ATTRIBUTES User
;
4236 } TOKEN_USER
, *PTOKEN_USER
;
4242 typedef struct _TOKEN_GROUPS
{
4244 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4245 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4248 * LUID_AND_ATTRIBUTES
4251 typedef union _LARGE_INTEGER
{
4253 #ifdef WORDS_BIGENDIAN
4261 #ifndef NONAMELESSSTRUCT
4263 #ifdef WORDS_BIGENDIAN
4273 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4275 typedef union _ULARGE_INTEGER
{
4277 #ifdef WORDS_BIGENDIAN
4285 #ifndef NONAMELESSSTRUCT
4287 #ifdef WORDS_BIGENDIAN
4297 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4300 * Locally Unique Identifier
4303 typedef struct _LUID
{
4308 #include <pshpack4.h>
4309 typedef struct _LUID_AND_ATTRIBUTES
{
4312 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4313 #include <poppack.h>
4319 typedef struct _PRIVILEGE_SET
{
4320 DWORD PrivilegeCount
;
4322 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4323 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4329 typedef struct _TOKEN_PRIVILEGES
{
4330 DWORD PrivilegeCount
;
4331 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4332 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4338 typedef struct _TOKEN_OWNER
{
4340 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4343 * TOKEN_PRIMARY_GROUP
4346 typedef struct _TOKEN_PRIMARY_GROUP
{
4348 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4352 * TOKEN_DEFAULT_DACL
4355 typedef struct _TOKEN_DEFAULT_DACL
{
4357 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4363 #define TOKEN_SOURCE_LENGTH 8
4365 typedef struct _TOKEN_SOURCE
{
4366 char SourceName
[TOKEN_SOURCE_LENGTH
];
4367 LUID SourceIdentifier
;
4368 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4374 typedef enum tagTOKEN_TYPE
{
4380 * SECURITY_IMPERSONATION_LEVEL
4383 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4385 SecurityIdentification
,
4386 SecurityImpersonation
,
4388 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4390 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4391 #define SECURITY_STATIC_TRACKING (FALSE)
4393 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4394 * PSECURITY_CONTEXT_TRACKING_MODE
;
4396 * Quality of Service
4399 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4401 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4402 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4403 BOOLEAN EffectiveOnly
;
4404 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4410 #include <pshpack4.h>
4411 typedef struct _TOKEN_STATISTICS
{
4413 LUID AuthenticationId
;
4414 LARGE_INTEGER ExpirationTime
;
4415 TOKEN_TYPE TokenType
;
4416 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4417 DWORD DynamicCharged
;
4418 DWORD DynamicAvailable
;
4420 DWORD PrivilegeCount
;
4423 #include <poppack.h>
4425 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4428 PSID_AND_ATTRIBUTES Sids
;
4429 DWORD RestrictedSidCount
;
4430 DWORD RestrictedSidLength
;
4431 PSID_AND_ATTRIBUTES RestrictedSids
;
4432 DWORD PrivilegeCount
;
4433 DWORD PrivilegeLength
;
4434 PLUID_AND_ATTRIBUTES Privileges
;
4435 LUID AuthenticationId
;
4436 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4438 typedef struct _TOKEN_ORIGIN
{
4439 LUID OriginatingLogonSession
;
4440 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4442 typedef struct _TOKEN_LINKED_TOKEN
{
4444 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4446 typedef struct _TOKEN_ELEVATION
{
4447 DWORD TokenIsElevated
;
4448 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4455 /* ACEs, directly starting after an ACL */
4456 typedef struct _ACE_HEADER
{
4460 } ACE_HEADER
,*PACE_HEADER
;
4463 #define ACCESS_ALLOWED_ACE_TYPE 0
4464 #define ACCESS_DENIED_ACE_TYPE 1
4465 #define SYSTEM_AUDIT_ACE_TYPE 2
4466 #define SYSTEM_ALARM_ACE_TYPE 3
4468 /* inherit AceFlags */
4469 #define OBJECT_INHERIT_ACE 0x01
4470 #define CONTAINER_INHERIT_ACE 0x02
4471 #define NO_PROPAGATE_INHERIT_ACE 0x04
4472 #define INHERIT_ONLY_ACE 0x08
4473 #define INHERITED_ACE 0x10
4474 #define VALID_INHERIT_FLAGS 0x1F
4476 /* AceFlags mask for what events we (should) audit */
4477 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4478 #define FAILED_ACCESS_ACE_FLAG 0x80
4480 /* different ACEs depending on AceType
4481 * SidStart marks the begin of a SID
4482 * so the thing finally looks like this:
4487 typedef struct _ACCESS_ALLOWED_ACE
{
4491 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4493 typedef struct _ACCESS_DENIED_ACE
{
4497 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4499 typedef struct _SYSTEM_AUDIT_ACE
{
4503 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4505 typedef struct _SYSTEM_ALARM_ACE
{
4509 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4511 typedef enum tagSID_NAME_USE
{
4516 SidTypeWellKnownGroup
,
4517 SidTypeDeletedAccount
,
4520 } SID_NAME_USE
,*PSID_NAME_USE
;
4522 #define ACE_OBJECT_TYPE_PRESENT 0x1
4523 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4527 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4529 #define DELETE 0x00010000
4530 #define READ_CONTROL 0x00020000
4531 #define WRITE_DAC 0x00040000
4532 #define WRITE_OWNER 0x00080000
4533 #define SYNCHRONIZE 0x00100000
4534 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4536 #define STANDARD_RIGHTS_READ READ_CONTROL
4537 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4538 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4540 #define STANDARD_RIGHTS_ALL 0x001f0000
4542 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4544 #define GENERIC_READ 0x80000000
4545 #define GENERIC_WRITE 0x40000000
4546 #define GENERIC_EXECUTE 0x20000000
4547 #define GENERIC_ALL 0x10000000
4549 #define MAXIMUM_ALLOWED 0x02000000
4550 #define ACCESS_SYSTEM_SECURITY 0x01000000
4552 #define EVENT_QUERY_STATE 0x0001
4553 #define EVENT_MODIFY_STATE 0x0002
4554 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4556 #define SEMAPHORE_MODIFY_STATE 0x0002
4557 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4559 #define MUTEX_MODIFY_STATE 0x0001
4560 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4562 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4563 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4564 #define JOB_OBJECT_QUERY 0x0004
4565 #define JOB_OBJECT_TERMINATE 0x0008
4566 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4567 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4569 #define TIMER_QUERY_STATE 0x0001
4570 #define TIMER_MODIFY_STATE 0x0002
4571 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4573 #define PROCESS_TERMINATE 0x0001
4574 #define PROCESS_CREATE_THREAD 0x0002
4575 #define PROCESS_VM_OPERATION 0x0008
4576 #define PROCESS_VM_READ 0x0010
4577 #define PROCESS_VM_WRITE 0x0020
4578 #define PROCESS_DUP_HANDLE 0x0040
4579 #define PROCESS_CREATE_PROCESS 0x0080
4580 #define PROCESS_SET_QUOTA 0x0100
4581 #define PROCESS_SET_INFORMATION 0x0200
4582 #define PROCESS_QUERY_INFORMATION 0x0400
4583 #define PROCESS_SUSPEND_RESUME 0x0800
4584 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4585 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4587 #define THREAD_TERMINATE 0x0001
4588 #define THREAD_SUSPEND_RESUME 0x0002
4589 #define THREAD_GET_CONTEXT 0x0008
4590 #define THREAD_SET_CONTEXT 0x0010
4591 #define THREAD_SET_INFORMATION 0x0020
4592 #define THREAD_QUERY_INFORMATION 0x0040
4593 #define THREAD_SET_THREAD_TOKEN 0x0080
4594 #define THREAD_IMPERSONATE 0x0100
4595 #define THREAD_DIRECT_IMPERSONATION 0x0200
4596 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4598 #define THREAD_BASE_PRIORITY_LOWRT 15
4599 #define THREAD_BASE_PRIORITY_MAX 2
4600 #define THREAD_BASE_PRIORITY_MIN -2
4601 #define THREAD_BASE_PRIORITY_IDLE -15
4603 typedef struct _QUOTA_LIMITS
{
4604 SIZE_T PagedPoolLimit
;
4605 SIZE_T NonPagedPoolLimit
;
4606 SIZE_T MinimumWorkingSetSize
;
4607 SIZE_T MaximumWorkingSetSize
;
4608 SIZE_T PagefileLimit
;
4609 LARGE_INTEGER TimeLimit
;
4610 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
4612 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4613 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4614 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4615 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4617 typedef struct _QUOTA_LIMITS_EX
{
4618 SIZE_T PagedPoolLimit
;
4619 SIZE_T NonPagedPoolLimit
;
4620 SIZE_T MinimumWorkingSetSize
;
4621 SIZE_T MaximumWorkingSetSize
;
4622 SIZE_T PagefileLimit
;
4623 LARGE_INTEGER TimeLimit
;
4630 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
4632 #define SECTION_QUERY 0x0001
4633 #define SECTION_MAP_WRITE 0x0002
4634 #define SECTION_MAP_READ 0x0004
4635 #define SECTION_MAP_EXECUTE 0x0008
4636 #define SECTION_EXTEND_SIZE 0x0010
4637 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4638 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4640 #define FILE_READ_DATA 0x0001 /* file & pipe */
4641 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4642 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4643 #define FILE_ADD_FILE 0x0002 /* directory */
4644 #define FILE_APPEND_DATA 0x0004 /* file */
4645 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4646 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4647 #define FILE_READ_EA 0x0008 /* file & directory */
4648 #define FILE_READ_PROPERTIES FILE_READ_EA
4649 #define FILE_WRITE_EA 0x0010 /* file & directory */
4650 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4651 #define FILE_EXECUTE 0x0020 /* file */
4652 #define FILE_TRAVERSE 0x0020 /* directory */
4653 #define FILE_DELETE_CHILD 0x0040 /* directory */
4654 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4655 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4656 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4658 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4659 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4661 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4662 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4663 FILE_APPEND_DATA | SYNCHRONIZE)
4664 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4665 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4667 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4668 #define DUPLICATE_SAME_ACCESS 0x00000002
4670 /* File attribute flags */
4671 #define FILE_SHARE_READ 0x00000001L
4672 #define FILE_SHARE_WRITE 0x00000002L
4673 #define FILE_SHARE_DELETE 0x00000004L
4675 #define FILE_ATTRIBUTE_READONLY 0x00000001
4676 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4677 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4678 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4679 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4680 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4681 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4682 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4683 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4684 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4685 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4686 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4687 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4688 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4690 /* File notification flags */
4691 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4692 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4693 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4694 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4695 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4696 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4697 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4698 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4699 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4700 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4701 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4702 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4704 #define FILE_ACTION_ADDED 0x00000001
4705 #define FILE_ACTION_REMOVED 0x00000002
4706 #define FILE_ACTION_MODIFIED 0x00000003
4707 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4708 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4709 #define FILE_ACTION_ADDED_STREAM 0x00000006
4710 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4711 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4713 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4714 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4715 #define FILE_UNICODE_ON_DISK 0x00000004
4716 #define FILE_PERSISTENT_ACLS 0x00000008
4717 #define FILE_FILE_COMPRESSION 0x00000010
4718 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4719 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4720 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4721 #define FILE_NAMED_STREAMS 0x00040000
4722 #define FILE_READ_ONLY_VOLUME 0x00080000
4724 /* File alignments (NT) */
4725 #define FILE_BYTE_ALIGNMENT 0x00000000
4726 #define FILE_WORD_ALIGNMENT 0x00000001
4727 #define FILE_LONG_ALIGNMENT 0x00000003
4728 #define FILE_QUAD_ALIGNMENT 0x00000007
4729 #define FILE_OCTA_ALIGNMENT 0x0000000f
4730 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4731 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4732 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4733 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4734 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4736 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4737 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4739 #define REG_NONE 0 /* no type */
4740 #define REG_SZ 1 /* string type (ASCII) */
4741 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4742 #define REG_BINARY 3 /* binary format, callerspecific */
4743 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4744 #define REG_DWORD 4 /* DWORD in little endian format */
4745 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4746 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4747 #define REG_LINK 6 /* symbolic link (UNICODE) */
4748 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4749 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4750 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4751 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4752 #define REG_QWORD 11 /* QWORD in little endian format */
4753 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4755 /* ----------------------------- begin power management --------------------- */
4757 typedef enum _LATENCY_TIME
{
4760 } LATENCY_TIME
, *PLATENCY_TIME
;
4762 #define DISCHARGE_POLICY_CRITICAL 0
4763 #define DISCHARGE_POLICY_LOW 1
4764 #define NUM_DISCHARGE_POLICIES 4
4766 #define PO_THROTTLE_NONE 0
4767 #define PO_THROTTLE_CONSTANT 1
4768 #define PO_THROTTLE_DEGRADE 2
4769 #define PO_THROTTLE_ADAPTIVE 3
4771 typedef enum _POWER_ACTION
{
4772 PowerActionNone
= 0,
4773 PowerActionReserved
,
4775 PowerActionHibernate
,
4776 PowerActionShutdown
,
4777 PowerActionShutdownReset
,
4778 PowerActionShutdownOff
,
4779 PowerActionWarmEject
4783 typedef enum _SYSTEM_POWER_STATE
{
4784 PowerSystemUnspecified
= 0,
4785 PowerSystemWorking
= 1,
4786 PowerSystemSleeping1
= 2,
4787 PowerSystemSleeping2
= 3,
4788 PowerSystemSleeping3
= 4,
4789 PowerSystemHibernate
= 5,
4790 PowerSystemShutdown
= 6,
4791 PowerSystemMaximum
= 7
4792 } SYSTEM_POWER_STATE
,
4793 *PSYSTEM_POWER_STATE
;
4795 typedef enum _DEVICE_POWER_STATE
{
4796 PowerDeviceUnspecified
,
4802 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
4804 typedef enum _POWER_INFORMATION_LEVEL
{
4805 SystemPowerPolicyAc
,
4806 SystemPowerPolicyDc
,
4807 VerifySystemPolicyAc
,
4808 VerifySystemPolicyDc
,
4809 SystemPowerCapabilities
,
4811 SystemPowerStateHandler
,
4812 ProcessorStateHandler
,
4813 SystemPowerPolicyCurrent
,
4814 AdministratorPowerPolicy
,
4815 SystemReserveHiberFile
,
4816 ProcessorInformation
,
4817 SystemPowerInformation
,
4818 ProcessorStateHandler2
,
4821 SystemExecutionState
,
4822 SystemPowerStateNotifyHandler
,
4823 ProcessorPowerPolicyAc
,
4824 ProcessorPowerPolicyDc
,
4825 VerifyProcessorPowerPolicyAc
,
4826 VerifyProcessorPowerPolicyDc
,
4827 ProcessorPowerPolicyCurrent
4828 } POWER_INFORMATION_LEVEL
;
4830 typedef struct _ADMINISTRATOR_POWER_POLICY
{
4831 SYSTEM_POWER_STATE MinSleep
;
4832 SYSTEM_POWER_STATE MaxSleep
;
4833 ULONG MinVideoTimeout
;
4834 ULONG MaxVideoTimeout
;
4835 ULONG MinSpindownTimeout
;
4836 ULONG MaxSpindownTimeout
;
4837 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
4842 } BATTERY_REPORTING_SCALE
,
4843 *PBATTERY_REPORTING_SCALE
;
4846 POWER_ACTION Action
;
4849 } POWER_ACTION_POLICY
,
4850 *PPOWER_ACTION_POLICY
;
4852 typedef struct _PROCESSOR_POWER_INFORMATION
{
4858 ULONG CurrentIdleState
;
4859 } PROCESSOR_POWER_INFORMATION
,
4860 *PPROCESSOR_POWER_INFORMATION
;
4862 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
4866 UCHAR DemotePercent
;
4867 UCHAR PromotePercent
;
4869 ULONG AllowDemotion
:1;
4870 ULONG AllowPromotion
:1;
4872 } PROCESSOR_POWER_POLICY_INFO
,
4873 *PPROCESSOR_POWER_POLICY_INFO
;
4875 typedef struct _PROCESSOR_POWER_POLICY
{
4877 BYTE DynamicThrottle
;
4879 DWORD DisableCStates
:1;
4882 PROCESSOR_POWER_POLICY_INFO Policy
[3];
4883 } PROCESSOR_POWER_POLICY
,
4884 *PPROCESSOR_POWER_POLICY
;
4888 BOOLEAN BatteryPresent
;
4890 BOOLEAN Discharging
;
4893 ULONG RemainingCapacity
;
4895 ULONG EstimatedTime
;
4896 ULONG DefaultAlert1
;
4897 ULONG DefaultAlert2
;
4898 } SYSTEM_BATTERY_STATE
,
4899 *PSYSTEM_BATTERY_STATE
;
4902 BOOLEAN PowerButtonPresent
;
4903 BOOLEAN SleepButtonPresent
;
4910 BOOLEAN HiberFilePresent
;
4912 BOOLEAN VideoDimPresent
;
4915 BOOLEAN ThermalControl
;
4916 BOOLEAN ProcessorThrottle
;
4917 UCHAR ProcessorMinThrottle
;
4918 UCHAR ProcessorMaxThrottle
;
4920 BOOLEAN DiskSpinDown
;
4922 BOOLEAN SystemBatteriesPresent
;
4923 BOOLEAN BatteriesAreShortTerm
;
4924 BATTERY_REPORTING_SCALE BatteryScale
[3];
4925 SYSTEM_POWER_STATE AcOnLineWake
;
4926 SYSTEM_POWER_STATE SoftLidWake
;
4927 SYSTEM_POWER_STATE RtcWake
;
4928 SYSTEM_POWER_STATE MinDeviceWakeState
;
4929 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
4930 } SYSTEM_POWER_CAPABILITIES
,
4931 *PSYSTEM_POWER_CAPABILITIES
;
4933 typedef struct _SYSTEM_POWER_INFORMATION
{
4934 ULONG MaxIdlenessAllowed
;
4936 ULONG TimeRemaining
;
4938 } SYSTEM_POWER_INFORMATION
,
4939 *PSYSTEM_POWER_INFORMATION
;
4941 typedef struct _SYSTEM_POWER_LEVEL
{
4945 POWER_ACTION_POLICY PowerPolicy
;
4946 SYSTEM_POWER_STATE MinSystemState
;
4947 } SYSTEM_POWER_LEVEL
,
4948 *PSYSTEM_POWER_LEVEL
;
4950 typedef struct _SYSTEM_POWER_POLICY
{
4952 POWER_ACTION_POLICY PowerButton
;
4953 POWER_ACTION_POLICY SleepButton
;
4954 POWER_ACTION_POLICY LidClose
;
4955 SYSTEM_POWER_STATE LidOpenWake
;
4957 POWER_ACTION_POLICY Idle
;
4959 UCHAR IdleSensitivity
;
4960 UCHAR DynamicThrottle
;
4962 SYSTEM_POWER_STATE MinSleep
;
4963 SYSTEM_POWER_STATE MaxSleep
;
4964 SYSTEM_POWER_STATE ReducedLatencySleep
;
4965 ULONG WinLogonFlags
;
4967 ULONG DozeS4Timeout
;
4968 ULONG BroadcastCapacityResolution
;
4969 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
4971 BOOLEAN VideoDimDisplay
;
4972 ULONG VideoReserved
[3];
4973 ULONG SpindownTimeout
;
4974 BOOLEAN OptimizeForPower
;
4975 UCHAR FanThrottleTolerance
;
4976 UCHAR ForcedThrottle
;
4978 POWER_ACTION_POLICY OverThrottled
;
4979 } SYSTEM_POWER_POLICY
,
4980 *PSYSTEM_POWER_POLICY
;
4982 typedef union _FILE_SEGMENT_ELEMENT
{
4984 ULONGLONG Alignment
;
4985 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
4987 typedef struct _FILE_NOTIFY_INFORMATION
{
4988 DWORD NextEntryOffset
;
4990 DWORD FileNameLength
;
4992 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
4994 /* ----------------------------- begin tape storage --------------------- */
4996 #define TAPE_FIXED_PARTITIONS 0
4997 #define TAPE_SELECT_PARTITIONS 1
4998 #define TAPE_INITIATOR_PARTITIONS 2
4999 #define TAPE_ERASE_SHORT 0
5000 #define TAPE_ERASE_LONG 1
5002 #define TAPE_UNLOAD 1
5003 #define TAPE_TENSION 2
5005 #define TAPE_UNLOCK 4
5006 #define TAPE_FORMAT 5
5007 #define TAPE_SETMARKS 0
5008 #define TAPE_FILEMARKS 1
5009 #define TAPE_SHORT_FILEMARKS 2
5010 #define TAPE_LONG_FILEMARKS 3
5011 #define TAPE_REWIND 0
5012 #define TAPE_ABSOLUTE_BLOCK 1
5013 #define TAPE_LOGICAL_BLOCK 2
5014 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5015 #define TAPE_SPACE_END_OF_DATA 4
5016 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5017 #define TAPE_SPACE_FILEMARKS 6
5018 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5019 #define TAPE_SPACE_SETMARKS 8
5020 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5022 typedef struct _TAPE_CREATE_PARTITION
{
5026 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
5028 typedef struct _TAPE_ERASE
{
5031 } TAPE_ERASE
, *PTAPE_ERASE
;
5033 typedef struct _TAPE_PREPARE
{
5036 } TAPE_PREPARE
, *PTAPE_PREPARE
;
5038 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
5040 BOOLEAN Compression
;
5041 BOOLEAN DataPadding
;
5042 BOOLEAN ReportSetmarks
;
5043 ULONG EOTWarningZoneSize
;
5044 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
5046 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
5048 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
5050 typedef struct _TAPE_WRITE_MARKS
{
5054 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
5056 typedef struct _TAPE_GET_POSITION
{
5061 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
5063 typedef struct _TAPE_SET_POSITION
{
5066 LARGE_INTEGER Offset
;
5068 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
5070 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
5072 BOOLEAN Compression
;
5073 BOOLEAN DataPadding
;
5074 BOOLEAN ReportSetmarks
;
5075 DWORD DefaultBlockSize
;
5076 DWORD MaximumBlockSize
;
5077 DWORD MinimumBlockSize
;
5078 DWORD MaximumPartitionCount
;
5081 DWORD EOTWarningZoneSize
;
5082 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
5084 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
5085 LARGE_INTEGER Capacity
;
5086 LARGE_INTEGER Remaining
;
5088 DWORD PartitionCount
;
5089 BOOLEAN WriteProtected
;
5090 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
5092 /* ----------------------------- begin registry ----------------------------- */
5094 /* Registry security values */
5095 #define OWNER_SECURITY_INFORMATION 0x00000001
5096 #define GROUP_SECURITY_INFORMATION 0x00000002
5097 #define DACL_SECURITY_INFORMATION 0x00000004
5098 #define SACL_SECURITY_INFORMATION 0x00000008
5100 #define REG_OPTION_RESERVED 0x00000000
5101 #define REG_OPTION_NON_VOLATILE 0x00000000
5102 #define REG_OPTION_VOLATILE 0x00000001
5103 #define REG_OPTION_CREATE_LINK 0x00000002
5104 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5105 #define REG_OPTION_OPEN_LINK 0x00000008
5106 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
5107 REG_OPTION_NON_VOLATILE| \
5108 REG_OPTION_VOLATILE| \
5109 REG_OPTION_CREATE_LINK| \
5110 REG_OPTION_BACKUP_RESTORE| \
5111 REG_OPTION_OPEN_LINK)
5114 #define REG_CREATED_NEW_KEY 0x00000001
5115 #define REG_OPENED_EXISTING_KEY 0x00000002
5117 /* For RegNotifyChangeKeyValue */
5118 #define REG_NOTIFY_CHANGE_NAME 0x01
5119 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5120 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5121 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5123 #define KEY_QUERY_VALUE 0x00000001
5124 #define KEY_SET_VALUE 0x00000002
5125 #define KEY_CREATE_SUB_KEY 0x00000004
5126 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5127 #define KEY_NOTIFY 0x00000010
5128 #define KEY_CREATE_LINK 0x00000020
5129 #define KEY_WOW64_64KEY 0x00000100
5130 #define KEY_WOW64_32KEY 0x00000200
5131 #define KEY_WOW64_RES 0x00000300
5133 /* for RegKeyRestore flags */
5134 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5135 #define REG_REFRESH_HIVE 0x00000002
5136 #define REG_NO_LAZY_FLUSH 0x00000004
5137 #define REG_FORCE_RESTORE 0x00000008
5139 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5141 KEY_ENUMERATE_SUB_KEYS| \
5145 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5147 KEY_CREATE_SUB_KEY) \
5150 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5151 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5154 KEY_CREATE_SUB_KEY| \
5155 KEY_ENUMERATE_SUB_KEYS| \
5160 /* ------------------------------ end registry ------------------------------ */
5163 #define EVENTLOG_SUCCESS 0x0000
5164 #define EVENTLOG_ERROR_TYPE 0x0001
5165 #define EVENTLOG_WARNING_TYPE 0x0002
5166 #define EVENTLOG_INFORMATION_TYPE 0x0004
5167 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5168 #define EVENTLOG_AUDIT_FAILURE 0x0010
5170 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5171 #define EVENTLOG_SEEK_READ 0x0002
5172 #define EVENTLOG_FORWARDS_READ 0x0004
5173 #define EVENTLOG_BACKWARDS_READ 0x0008
5175 typedef struct _EVENTLOGRECORD
{
5179 DWORD TimeGenerated
;
5186 DWORD ClosingRecordNumber
;
5188 DWORD UserSidLength
;
5189 DWORD UserSidOffset
;
5192 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
5194 #define SERVICE_BOOT_START 0x00000000
5195 #define SERVICE_SYSTEM_START 0x00000001
5196 #define SERVICE_AUTO_START 0x00000002
5197 #define SERVICE_DEMAND_START 0x00000003
5198 #define SERVICE_DISABLED 0x00000004
5200 #define SERVICE_ERROR_IGNORE 0x00000000
5201 #define SERVICE_ERROR_NORMAL 0x00000001
5202 #define SERVICE_ERROR_SEVERE 0x00000002
5203 #define SERVICE_ERROR_CRITICAL 0x00000003
5206 #define SERVICE_KERNEL_DRIVER 0x00000001
5207 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5208 #define SERVICE_ADAPTER 0x00000004
5209 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5211 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5212 SERVICE_RECOGNIZER_DRIVER )
5214 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5215 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5216 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5218 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5220 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5221 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5224 typedef enum _CM_SERVICE_NODE_TYPE
5226 DriverType
= SERVICE_KERNEL_DRIVER
,
5227 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5228 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5229 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5230 AdapterType
= SERVICE_ADAPTER
,
5231 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5232 } SERVICE_NODE_TYPE
;
5234 typedef enum _CM_SERVICE_LOAD_TYPE
5236 BootLoad
= SERVICE_BOOT_START
,
5237 SystemLoad
= SERVICE_SYSTEM_START
,
5238 AutoLoad
= SERVICE_AUTO_START
,
5239 DemandLoad
= SERVICE_DEMAND_START
,
5240 DisableLoad
= SERVICE_DISABLED
5241 } SERVICE_LOAD_TYPE
;
5243 typedef enum _CM_ERROR_CONTROL_TYPE
5245 IgnoreError
= SERVICE_ERROR_IGNORE
,
5246 NormalError
= SERVICE_ERROR_NORMAL
,
5247 SevereError
= SERVICE_ERROR_SEVERE
,
5248 CriticalError
= SERVICE_ERROR_CRITICAL
5249 } SERVICE_ERROR_TYPE
;
5253 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5254 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5255 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5256 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5257 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5259 #include <guiddef.h>
5261 typedef struct _OBJECT_TYPE_LIST
{
5265 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
5267 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5270 WORD CreatorBackTraceIndex
;
5271 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
5272 LIST_ENTRY ProcessLocksList
;
5274 DWORD ContentionCount
;
5275 #ifdef __WINESRC__ /* in Wine we store the name here */
5276 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
5280 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
5282 typedef struct _RTL_CRITICAL_SECTION
{
5283 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
5285 LONG RecursionCount
;
5286 HANDLE OwningThread
;
5287 HANDLE LockSemaphore
;
5288 ULONG_PTR SpinCount
;
5289 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
5291 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5292 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5293 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5294 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5295 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5297 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
5298 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5300 #include <pshpack8.h>
5301 typedef struct _IO_COUNTERS
{
5302 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5303 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5304 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5305 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5306 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5307 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5308 } IO_COUNTERS
, *PIO_COUNTERS
;
5309 #include <poppack.h>
5312 DWORD dwOSVersionInfoSize
;
5313 DWORD dwMajorVersion
;
5314 DWORD dwMinorVersion
;
5315 DWORD dwBuildNumber
;
5317 CHAR szCSDVersion
[128];
5318 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5321 DWORD dwOSVersionInfoSize
;
5322 DWORD dwMajorVersion
;
5323 DWORD dwMinorVersion
;
5324 DWORD dwBuildNumber
;
5326 WCHAR szCSDVersion
[128];
5327 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5329 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5330 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5331 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5334 DWORD dwOSVersionInfoSize
;
5335 DWORD dwMajorVersion
;
5336 DWORD dwMinorVersion
;
5337 DWORD dwBuildNumber
;
5339 CHAR szCSDVersion
[128];
5340 WORD wServicePackMajor
;
5341 WORD wServicePackMinor
;
5345 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5348 DWORD dwOSVersionInfoSize
;
5349 DWORD dwMajorVersion
;
5350 DWORD dwMinorVersion
;
5351 DWORD dwBuildNumber
;
5353 WCHAR szCSDVersion
[128];
5354 WORD wServicePackMajor
;
5355 WORD wServicePackMinor
;
5359 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5361 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5362 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5363 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5365 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5367 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5369 #define VER_PLATFORM_WIN32s 0
5370 #define VER_PLATFORM_WIN32_WINDOWS 1
5371 #define VER_PLATFORM_WIN32_NT 2
5373 #define VER_MINORVERSION 0x00000001
5374 #define VER_MAJORVERSION 0x00000002
5375 #define VER_BUILDNUMBER 0x00000004
5376 #define VER_PLATFORMID 0x00000008
5377 #define VER_SERVICEPACKMINOR 0x00000010
5378 #define VER_SERVICEPACKMAJOR 0x00000020
5379 #define VER_SUITENAME 0x00000040
5380 #define VER_PRODUCT_TYPE 0x00000080
5382 #define VER_NT_WORKSTATION 1
5383 #define VER_NT_DOMAIN_CONTROLLER 2
5384 #define VER_NT_SERVER 3
5386 #define VER_SUITE_SMALLBUSINESS 0x00000001
5387 #define VER_SUITE_ENTERPRISE 0x00000002
5388 #define VER_SUITE_BACKOFFICE 0x00000004
5389 #define VER_SUITE_COMMUNICATIONS 0x00000008
5390 #define VER_SUITE_TERMINAL 0x00000010
5391 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5392 #define VER_SUITE_EMBEDDEDNT 0x00000040
5393 #define VER_SUITE_DATACENTER 0x00000080
5394 #define VER_SUITE_SINGLEUSERTS 0x00000100
5395 #define VER_SUITE_PERSONAL 0x00000200
5396 #define VER_SUITE_BLADE 0x00000400
5399 #define VER_GREATER 2
5400 #define VER_GREATER_EQUAL 3
5402 #define VER_LESS_EQUAL 5
5406 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5408 DWORD ulFormatVersion
;
5409 DWORD ulAssemblyCount
;
5410 DWORD ulRootManifestPathType
;
5411 DWORD ulRootManifestPathChars
;
5412 DWORD ulRootConfigurationPathType
;
5413 DWORD ulRootConfigurationPathChars
;
5414 DWORD ulAppDirPathType
;
5415 DWORD ulAppDirPathChars
;
5416 PCWSTR lpRootManifestPath
;
5417 PCWSTR lpRootConfigurationPath
;
5418 PCWSTR lpAppDirPath
;
5419 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5421 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5423 DWORD ulEncodedAssemblyIdentityLength
;
5424 DWORD ulManifestPathType
;
5425 DWORD ulManifestPathLength
;
5426 LARGE_INTEGER liManifestLastWriteTime
;
5427 DWORD ulPolicyPathType
;
5428 DWORD ulPolicyPathLength
;
5429 LARGE_INTEGER liPolicyLastWriteTime
;
5430 DWORD ulMetadataSatelliteRosterIndex
;
5431 DWORD ulManifestVersionMajor
;
5432 DWORD ulManifestVersionMinor
;
5433 DWORD ulPolicyVersionMajor
;
5434 DWORD ulPolicyVersionMinor
;
5435 DWORD ulAssemblyDirectoryNameLength
;
5436 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
5437 PCWSTR lpAssemblyManifestPath
;
5438 PCWSTR lpAssemblyPolicyPath
;
5439 PCWSTR lpAssemblyDirectoryName
;
5441 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
5443 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
5444 DWORD ulAssemblyIndex
;
5445 DWORD ulFileIndexInAssembly
;
5446 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
5448 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
5450 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
5452 DWORD ulFilenameLength
;
5456 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
5458 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
5460 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
5461 ActivationContextBasicInformation
= 1,
5462 ActivationContextDetailedInformation
= 2,
5463 AssemblyDetailedInformationInActivationContext
= 3,
5464 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
5465 MaxActivationContextInfoClass
,
5467 AssemblyDetailedInformationInActivationContxt
= 3,
5468 FileInformationInAssemblyOfAssemblyInActivationContxt
= 4
5469 } ACTIVATION_CONTEXT_INFO_CLASS
;
5471 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5472 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5473 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5474 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5476 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5477 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5478 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5479 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5480 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5481 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5482 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5483 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5484 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5486 typedef enum _JOBOBJECTINFOCLASS
5488 JobObjectBasicAccountingInformation
= 1,
5489 JobObjectBasicLimitInformation
,
5490 JobObjectBasicProcessIdList
,
5491 JobObjectBasicUIRestrictions
,
5492 JobObjectSecurityLimitInformation
,
5493 JobObjectEndOfJobTimeInformation
,
5494 JobObjectAssociateCompletionPortInformation
,
5495 JobObjectBasicAndIoAccountingInformation
,
5496 JobObjectExtendedLimitInformation
,
5497 JobObjectJobSetInformation
,
5498 MaxJobObjectInfoClass
5499 } JOBOBJECTINFOCLASS
;
5501 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5503 RelationProcessorCore
= 0,
5504 RelationNumaNode
= 1,
5506 RelationProcessorPackage
= 3,
5508 RelationAll
= 0xffff
5509 } LOGICAL_PROCESSOR_RELATIONSHIP
;
5511 typedef enum _PROCESSOR_CACHE_TYPE
5517 } PROCESSOR_CACHE_TYPE
;
5519 typedef struct _PROCESSOR_GROUP_INFO
5521 BYTE MaximumProcessorCount
;
5522 BYTE ActiveProcessorCount
;
5524 KAFFINITY ActiveProcessorMask
;
5525 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
5527 typedef struct _CACHE_DESCRIPTOR
5533 PROCESSOR_CACHE_TYPE Type
;
5534 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
5536 typedef struct _GROUP_AFFINITY
5541 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
5543 typedef struct _PROCESSOR_RELATIONSHIP
5548 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
5549 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
5552 typedef struct _NUMA_NODE_RELATIONSHIP
5556 GROUP_AFFINITY GroupMask
;
5557 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
5559 typedef struct _CACHE_RELATIONSHIP
5564 PROCESSOR_CACHE_TYPE Type
;
5566 GROUP_AFFINITY GroupMask
;
5567 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
5569 typedef struct _GROUP_RELATIONSHIP
5571 WORD MaximumGroupCount
;
5572 WORD ActiveGroupCount
;
5574 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
5575 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
5577 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5579 ULONG_PTR ProcessorMask
;
5580 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5591 CACHE_DESCRIPTOR Cache
;
5592 ULONGLONG Reserved
[2];
5594 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
5596 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5598 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5602 PROCESSOR_RELATIONSHIP Processor
;
5603 NUMA_NODE_RELATIONSHIP NumaNode
;
5604 CACHE_RELATIONSHIP Cache
;
5605 GROUP_RELATIONSHIP Group
;
5607 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
5609 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
5615 #endif /* _WINNT_ */