2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
41 #define NTSYSAPI DECLSPEC_IMPORT
44 #define NTAPI __stdcall
47 # if defined(_MSC_VER)
48 # define DECLSPEC_IMPORT __declspec(dllimport)
49 # elif defined(__MINGW32__) || defined(__CYGWIN__)
50 # define DECLSPEC_IMPORT __attribute__((dllimport))
52 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
55 # define DECLSPEC_IMPORT
58 #ifndef DECLSPEC_NORETURN
59 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
60 # define DECLSPEC_NORETURN __declspec(noreturn)
61 # elif defined(__GNUC__)
62 # define DECLSPEC_NORETURN __attribute__((noreturn))
64 # define DECLSPEC_NORETURN
68 #ifndef DECLSPEC_ALIGN
69 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
70 # define DECLSPEC_ALIGN(x) __declspec(align(x))
71 # elif defined(__GNUC__)
72 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
74 # define DECLSPEC_ALIGN(x)
78 #ifndef DECLSPEC_CACHEALIGN
79 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
83 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
84 # define DECLSPEC_UUID(x) __declspec(uuid(x))
86 # define DECLSPEC_UUID(x)
90 #ifndef DECLSPEC_NOVTABLE
91 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
92 # define DECLSPEC_NOVTABLE __declspec(novtable)
94 # define DECLSPEC_NOVTABLE
98 #ifndef DECLSPEC_SELECTANY
99 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
100 #define DECLSPEC_SELECTANY __declspec(selectany)
102 #define DECLSPEC_SELECTANY
107 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
108 # define NOP_FUNCTION __noop
110 # define NOP_FUNCTION (void)0
114 #ifndef DECLSPEC_ADDRSAFE
115 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
116 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
118 # define DECLSPEC_ADDRSAFE
123 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
124 # define FORCEINLINE __forceinline
125 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
126 # define FORCEINLINE inline __attribute__((always_inline))
128 # define FORCEINLINE inline
132 #ifndef DECLSPEC_DEPRECATED
133 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
134 # define DECLSPEC_DEPRECATED __declspec(deprecated)
135 # define DEPRECATE_SUPPORTED
136 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
137 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
138 # define DEPRECATE_SUPPORTED
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
145 /* a couple of useful Wine extensions */
148 # define DECLSPEC_EXPORT __declspec(dllexport)
149 #elif defined(__MINGW32__)
150 # define DECLSPEC_EXPORT __attribute__((dllexport))
151 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
152 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
154 # define DECLSPEC_EXPORT
157 #if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
158 # define DECLSPEC_HIDDEN
159 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
160 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
162 # define DECLSPEC_HIDDEN
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
168 #define __WINE_ALLOC_SIZE(x)
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
175 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
176 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
177 # define NONAMELESSSTRUCT
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
186 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
187 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
188 # define NONAMELESSUNION
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
193 #endif /* NONAMELESSUNION */
195 #undef DUMMYSTRUCTNAME
196 #undef DUMMYSTRUCTNAME1
197 #undef DUMMYSTRUCTNAME2
198 #undef DUMMYSTRUCTNAME3
199 #undef DUMMYSTRUCTNAME4
200 #undef DUMMYSTRUCTNAME5
201 #ifndef NONAMELESSSTRUCT
202 #define DUMMYSTRUCTNAME
203 #define DUMMYSTRUCTNAME1
204 #define DUMMYSTRUCTNAME2
205 #define DUMMYSTRUCTNAME3
206 #define DUMMYSTRUCTNAME4
207 #define DUMMYSTRUCTNAME5
208 #else /* !defined(NONAMELESSSTRUCT) */
209 #define DUMMYSTRUCTNAME s
210 #define DUMMYSTRUCTNAME1 s1
211 #define DUMMYSTRUCTNAME2 s2
212 #define DUMMYSTRUCTNAME3 s3
213 #define DUMMYSTRUCTNAME4 s4
214 #define DUMMYSTRUCTNAME5 s5
215 #endif /* !defined(NONAMELESSSTRUCT) */
217 #undef DUMMYUNIONNAME
218 #undef DUMMYUNIONNAME1
219 #undef DUMMYUNIONNAME2
220 #undef DUMMYUNIONNAME3
221 #undef DUMMYUNIONNAME4
222 #undef DUMMYUNIONNAME5
223 #undef DUMMYUNIONNAME6
224 #undef DUMMYUNIONNAME7
225 #undef DUMMYUNIONNAME8
226 #ifndef NONAMELESSUNION
227 #define DUMMYUNIONNAME
228 #define DUMMYUNIONNAME1
229 #define DUMMYUNIONNAME2
230 #define DUMMYUNIONNAME3
231 #define DUMMYUNIONNAME4
232 #define DUMMYUNIONNAME5
233 #define DUMMYUNIONNAME6
234 #define DUMMYUNIONNAME7
235 #define DUMMYUNIONNAME8
236 #else /* !defined(NONAMELESSUNION) */
237 #define DUMMYUNIONNAME u
238 #define DUMMYUNIONNAME1 u1
239 #define DUMMYUNIONNAME2 u2
240 #define DUMMYUNIONNAME3 u3
241 #define DUMMYUNIONNAME4 u4
242 #define DUMMYUNIONNAME5 u5
243 #define DUMMYUNIONNAME6 u6
244 #define DUMMYUNIONNAME7 u7
245 #define DUMMYUNIONNAME8 u8
246 #endif /* !defined(NONAMELESSUNION) */
248 #ifndef __C89_NAMELESS
249 # if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
251 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
252 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
253 # define __C89_NAMELESS __extension__
255 # elif defined(_MSC_VER)
256 # define __C89_NAMELESS
261 #ifdef __C89_NAMELESS
262 # define __C89_NAMELESSSTRUCTNAME
263 # define __C89_NAMELESSUNIONNAME
265 # define __C89_NAMELESS
266 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
267 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
270 /* C99 restrict support */
272 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
273 # if defined(_MSC_VER) && defined(_M_MRX000)
274 # define RESTRICTED_POINTER __restrict
275 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
276 # define RESTRICTED_POINTER __restrict
278 # define RESTRICTED_POINTER
281 # define RESTRICTED_POINTER
284 /* C99 unaligned support */
287 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
288 # define UNALIGNED __unaligned
290 # define UNALIGNED64 __unaligned
300 /* Alignment macros */
302 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
303 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
304 #define MEMORY_ALLOCATION_ALIGNMENT 16
306 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
307 #define MEMORY_ALLOCATION_ALIGNMENT 8
310 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
311 # define TYPE_ALIGNMENT(t) __alignof(t)
312 #elif defined(__GNUC__)
313 # define TYPE_ALIGNMENT(t) __alignof__(t)
315 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
319 # define PROBE_ALIGNMENT(_s) \
320 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
321 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
322 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
324 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
327 /* Compile time assertion */
329 #if defined(_MSC_VER)
330 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
332 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
335 /* Eliminate Microsoft C/C++ compiler warning 4715 */
336 #if defined(_MSC_VER) && (_MSC_VER > 1200)
337 # define DEFAULT_UNREACHABLE default: __assume(0)
339 # define DEFAULT_UNREACHABLE
343 #define APPLICATION_ERROR_MASK 0x20000000
344 #define ERROR_SEVERITY_SUCCESS 0x00000000
345 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
346 #define ERROR_SEVERITY_WARNING 0x80000000
347 #define ERROR_SEVERITY_ERROR 0xC0000000
350 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
352 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
353 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
354 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
355 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
356 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
357 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
358 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
361 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
364 /* Microsoft's macros for declaring functions */
367 # define EXTERN_C extern "C"
369 # define EXTERN_C extern
372 #define STDMETHODCALLTYPE __stdcall
373 #define STDMETHODVCALLTYPE __cdecl
374 #define STDAPICALLTYPE __stdcall
375 #define STDAPIVCALLTYPE __cdecl
377 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
378 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
379 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
380 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
381 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
382 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
383 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
384 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
386 /* Define the basic types */
391 typedef VOID
*PVOID64
;
392 typedef BYTE BOOLEAN
, *PBOOLEAN
;
393 typedef char CHAR
, *PCHAR
;
394 typedef short SHORT
, *PSHORT
;
396 typedef long LONG
, *PLONG
;
398 typedef int LONG
, *PLONG
;
401 /* Some systems might have wchar_t, but we really need 16 bit characters */
402 #ifdef WINE_UNICODE_NATIVE
403 typedef wchar_t WCHAR
, *PWCHAR
;
405 typedef unsigned short WCHAR
, *PWCHAR
;
408 /* 'Extended/Wide' numerical types */
412 typedef signed __int64 LONGLONG
, *PLONGLONG
;
413 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
415 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
416 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
423 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
425 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
429 /* ANSI string types */
430 typedef CHAR
*PCH
, *LPCH
;
431 typedef const CHAR
*PCCH
, *LPCCH
;
432 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
433 typedef const CHAR
*PCSTR
, *LPCSTR
;
434 typedef CHAR
*PZZSTR
;
435 typedef const CHAR
*PCZZSTR
;
437 /* Unicode string types */
438 typedef WCHAR
*PWCH
, *LPWCH
;
439 typedef const WCHAR
*PCWCH
, *LPCWCH
;
440 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
441 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
442 typedef WCHAR
*PZZWSTR
;
443 typedef const WCHAR
*PCZZWSTR
;
445 /* Neutral character and string types */
446 /* These are only defined for Winelib, i.e. _not_ defined for
447 * the emulator. The reason is they depend on the UNICODE
448 * macro which only exists in the user's code.
450 #ifndef WINE_NO_UNICODE_MACROS
452 # ifndef _TCHAR_DEFINED
453 typedef WCHAR TCHAR
, *PTCHAR
;
454 # define _TCHAR_DEFINED
456 typedef LPWSTR PTSTR
, LPTSTR
;
457 typedef LPCWSTR PCTSTR
, LPCTSTR
;
458 typedef PZZSTR PZZTSTR
;
459 typedef PCZZSTR PCZZTSTR
;
461 # ifndef _TCHAR_DEFINED
462 typedef CHAR TCHAR
, *PTCHAR
;
463 # define _TCHAR_DEFINED
465 typedef LPSTR PTSTR
, LPTSTR
;
466 typedef LPCSTR PCTSTR
, LPCTSTR
;
467 typedef PZZWSTR PZZTSTR
;
468 typedef PCZZWSTR PCZZTSTR
;
469 # endif /* UNICODE */
470 #endif /* WINE_NO_UNICODE_MACROS */
472 /* Misc common WIN32 types */
474 typedef DWORD LCID
, *PLCID
;
476 typedef DWORD EXECUTION_STATE
;
477 #ifndef _HRESULT_DEFINED
478 #define _HRESULT_DEFINED
479 typedef LONG HRESULT
;
484 typedef void *HANDLE
;
485 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
488 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
490 #define DECLARE_HANDLE(a) typedef HANDLE a
497 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
499 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
500 # define __MSABI_LONG(x) x ## l
502 # define __MSABI_LONG(x) x
508 #ifndef WIN32_NO_STATUS
510 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
511 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
512 #define STATUS_USER_APC ((DWORD) 0x000000C0)
513 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
514 #define STATUS_PENDING ((DWORD) 0x00000103)
515 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
516 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
517 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
518 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
519 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
520 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
521 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
522 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
523 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
524 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
525 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
526 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
527 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
528 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
529 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
530 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
531 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
532 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
533 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
534 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
535 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
536 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
537 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
538 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
539 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
540 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
541 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
542 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
543 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
544 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
546 /* status values for ContinueDebugEvent */
547 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
548 #define DBG_CONTINUE ((DWORD) 0x00010002)
549 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
550 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
551 #define DBG_CONTROL_C ((DWORD) 0x40010005)
552 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
553 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
554 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
556 #endif /* WIN32_NO_STATUS */
558 /* Argument 1 passed to the DllEntryProc. */
559 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
560 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
561 #define DLL_THREAD_ATTACH 2 /* attach new thread */
562 #define DLL_THREAD_DETACH 3 /* detach thread */
564 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
567 /* u.x.wProcessorArchitecture (NT) */
568 #define PROCESSOR_ARCHITECTURE_INTEL 0
569 #define PROCESSOR_ARCHITECTURE_MIPS 1
570 #define PROCESSOR_ARCHITECTURE_ALPHA 2
571 #define PROCESSOR_ARCHITECTURE_PPC 3
572 #define PROCESSOR_ARCHITECTURE_SHX 4
573 #define PROCESSOR_ARCHITECTURE_ARM 5
574 #define PROCESSOR_ARCHITECTURE_IA64 6
575 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
576 #define PROCESSOR_ARCHITECTURE_MSIL 8
577 #define PROCESSOR_ARCHITECTURE_AMD64 9
578 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
579 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
582 #define PROCESSOR_ARCHITECTURE_SPARC 20
584 /* dwProcessorType */
585 #define PROCESSOR_INTEL_386 386
586 #define PROCESSOR_INTEL_486 486
587 #define PROCESSOR_INTEL_PENTIUM 586
588 #define PROCESSOR_INTEL_860 860
589 #define PROCESSOR_INTEL_IA64 2200
590 #define PROCESSOR_AMD_X8664 8664
591 #define PROCESSOR_MIPS_R2000 2000
592 #define PROCESSOR_MIPS_R3000 3000
593 #define PROCESSOR_MIPS_R4000 4000
594 #define PROCESSOR_ALPHA_21064 21064
595 #define PROCESSOR_PPC_601 601
596 #define PROCESSOR_PPC_603 603
597 #define PROCESSOR_PPC_604 604
598 #define PROCESSOR_PPC_620 620
599 #define PROCESSOR_HITACHI_SH3 10003
600 #define PROCESSOR_HITACHI_SH3E 10004
601 #define PROCESSOR_HITACHI_SH4 10005
602 #define PROCESSOR_MOTOROLA_821 821
603 #define PROCESSOR_SHx_SH3 103
604 #define PROCESSOR_SHx_SH4 104
605 #define PROCESSOR_STRONGARM 2577
606 #define PROCESSOR_ARM720 1824 /* 0x720 */
607 #define PROCESSOR_ARM820 2080 /* 0x820 */
608 #define PROCESSOR_ARM920 2336 /* 0x920 */
609 #define PROCESSOR_ARM_7TDMI 70001
610 #define PROCESSOR_OPTIL 18767
613 #define MAXIMUM_PROCESSORS 64
615 #define MAXIMUM_PROCESSORS 32
618 typedef struct _MEMORY_BASIC_INFORMATION
621 LPVOID AllocationBase
;
622 DWORD AllocationProtect
;
627 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
629 #define PAGE_NOACCESS 0x01
630 #define PAGE_READONLY 0x02
631 #define PAGE_READWRITE 0x04
632 #define PAGE_WRITECOPY 0x08
633 #define PAGE_EXECUTE 0x10
634 #define PAGE_EXECUTE_READ 0x20
635 #define PAGE_EXECUTE_READWRITE 0x40
636 #define PAGE_EXECUTE_WRITECOPY 0x80
637 #define PAGE_GUARD 0x100
638 #define PAGE_NOCACHE 0x200
639 #define PAGE_WRITECOMBINE 0x400
641 #define MEM_COMMIT 0x00001000
642 #define MEM_RESERVE 0x00002000
643 #define MEM_DECOMMIT 0x00004000
644 #define MEM_RELEASE 0x00008000
645 #define MEM_FREE 0x00010000
646 #define MEM_PRIVATE 0x00020000
647 #define MEM_MAPPED 0x00040000
648 #define MEM_RESET 0x00080000
649 #define MEM_TOP_DOWN 0x00100000
650 #define MEM_WRITE_WATCH 0x00200000
651 #define MEM_PHYSICAL 0x00400000
652 #define MEM_LARGE_PAGES 0x20000000
653 #define MEM_4MB_PAGES 0x80000000
655 #define SEC_FILE 0x00800000
656 #define SEC_IMAGE 0x01000000
657 #define SEC_RESERVE 0x04000000
658 #define SEC_COMMIT 0x08000000
659 #define SEC_NOCACHE 0x10000000
660 #define SEC_LARGE_PAGES 0x80000000
661 #define MEM_IMAGE SEC_IMAGE
663 #define WRITE_WATCH_FLAG_RESET 0x00000001
668 #define MINSHORT 0x8000
669 #define MAXSHORT 0x7fff
670 #define MINLONG 0x80000000
671 #define MAXLONG 0x7fffffff
673 #define MAXWORD 0xffff
674 #define MAXDWORD 0xffffffff
676 #define UNICODE_STRING_MAX_CHARS 32767
678 #define FIELD_OFFSET(type, field) \
679 ((LONG)(INT_PTR)&(((type *)0)->field))
681 #define CONTAINING_RECORD(address, type, field) \
682 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
686 typedef struct _LIST_ENTRY
{
687 struct _LIST_ENTRY
*Flink
;
688 struct _LIST_ENTRY
*Blink
;
689 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
691 typedef struct _SINGLE_LIST_ENTRY
{
692 struct _SINGLE_LIST_ENTRY
*Next
;
693 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
697 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
*PSLIST_ENTRY
;
698 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
702 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
709 ULONGLONG Sequence
:9;
710 ULONGLONG NextEntry
:39;
711 ULONGLONG HeaderType
:1;
713 ULONGLONG Reserved
:59;
718 ULONGLONG Sequence
:48;
719 ULONGLONG HeaderType
:1;
721 ULONGLONG Reserved
:2;
722 ULONGLONG NextEntry
:60;
724 } SLIST_HEADER
, *PSLIST_HEADER
;
728 #undef SLIST_ENTRY /* for Mac OS */
729 #define SLIST_ENTRY SINGLE_LIST_ENTRY
730 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
731 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
733 typedef union _SLIST_HEADER
{
740 } SLIST_HEADER
, *PSLIST_HEADER
;
744 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
745 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
746 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
747 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
748 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
749 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
754 #define HEAP_NO_SERIALIZE 0x00000001
755 #define HEAP_GROWABLE 0x00000002
756 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
757 #define HEAP_ZERO_MEMORY 0x00000008
758 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
759 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
760 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
761 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
762 #define HEAP_CREATE_ALIGN_16 0x00010000
763 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
764 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
766 /* This flag allows it to create heaps shared by all processes under win95,
767 FIXME: correct name */
768 #define HEAP_SHARED 0x04000000
770 typedef enum _HEAP_INFORMATION_CLASS
{
771 HeapCompatibilityInformation
,
772 } HEAP_INFORMATION_CLASS
;
774 /* Processor feature flags. */
775 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
776 #define PF_FLOATING_POINT_EMULATED 1
777 #define PF_COMPARE_EXCHANGE_DOUBLE 2
778 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
779 #define PF_PPC_MOVEMEM_64BIT_OK 4
780 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
781 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
782 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
783 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
784 #define PF_PAE_ENABLED 9
785 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
786 #define PF_SSE_DAZ_MODE_AVAILABLE 11
787 #define PF_NX_ENABLED 12
788 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
789 #define PF_COMPARE_EXCHANGE128 14
790 #define PF_COMPARE64_EXCHANGE128 15
791 #define PF_CHANNELS_ENABLED 16
792 #define PF_XSAVE_ENABLED 17
793 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18
794 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
795 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20
796 #define PF_VIRT_FIRMWARE_ENABLED 21
797 #define PF_RDWRFSGSBASE_AVAILABLE 22
800 /* Execution state flags */
801 #define ES_SYSTEM_REQUIRED 0x00000001
802 #define ES_DISPLAY_REQUIRED 0x00000002
803 #define ES_USER_PRESENT 0x00000004
804 #define ES_CONTINUOUS 0x80000000
806 /* The Win32 register context */
808 /* i386 context definitions */
811 #define SIZE_OF_80387_REGISTERS 80
813 typedef struct _FLOATING_SAVE_AREA
822 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
824 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
826 #define MAXIMUM_SUPPORTED_EXTENSION 512
828 typedef struct _CONTEXT
832 /* These are selected by CONTEXT_DEBUG_REGISTERS */
840 /* These are selected by CONTEXT_FLOATING_POINT */
841 FLOATING_SAVE_AREA FloatSave
;
843 /* These are selected by CONTEXT_SEGMENTS */
849 /* These are selected by CONTEXT_INTEGER */
857 /* These are selected by CONTEXT_CONTROL */
865 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
868 #define CONTEXT_X86 0x00010000
869 #define CONTEXT_i386 CONTEXT_X86
870 #define CONTEXT_i486 CONTEXT_X86
872 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
873 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
874 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
875 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
876 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
877 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
878 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
879 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
880 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
882 #define EXCEPTION_READ_FAULT 0
883 #define EXCEPTION_WRITE_FAULT 1
884 #define EXCEPTION_EXECUTE_FAULT 8
886 #endif /* __i386__ */
888 typedef struct _LDT_ENTRY
{
903 unsigned LimitHi
: 4;
905 unsigned Reserved_0
: 1;
906 unsigned Default_Big
: 1;
907 unsigned Granularity
: 1;
911 } LDT_ENTRY
, *PLDT_ENTRY
;
913 /* x86-64 context definitions */
914 #if defined(__x86_64__)
916 #define CONTEXT_AMD64 0x00100000
918 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
919 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
920 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
921 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
922 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
923 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
924 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
926 #define EXCEPTION_READ_FAULT 0
927 #define EXCEPTION_WRITE_FAULT 1
928 #define EXCEPTION_EXECUTE_FAULT 8
930 typedef struct DECLSPEC_ALIGN(16) _M128A
{
935 typedef struct _XMM_SAVE_AREA32
{
936 WORD ControlWord
; /* 000 */
937 WORD StatusWord
; /* 002 */
938 BYTE TagWord
; /* 004 */
939 BYTE Reserved1
; /* 005 */
940 WORD ErrorOpcode
; /* 006 */
941 DWORD ErrorOffset
; /* 008 */
942 WORD ErrorSelector
; /* 00c */
943 WORD Reserved2
; /* 00e */
944 DWORD DataOffset
; /* 010 */
945 WORD DataSelector
; /* 014 */
946 WORD Reserved3
; /* 016 */
947 DWORD MxCsr
; /* 018 */
948 DWORD MxCsr_Mask
; /* 01c */
949 M128A FloatRegisters
[8]; /* 020 */
950 M128A XmmRegisters
[16]; /* 0a0 */
951 BYTE Reserved4
[96]; /* 1a0 */
952 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
954 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
955 DWORD64 P1Home
; /* 000 */
956 DWORD64 P2Home
; /* 008 */
957 DWORD64 P3Home
; /* 010 */
958 DWORD64 P4Home
; /* 018 */
959 DWORD64 P5Home
; /* 020 */
960 DWORD64 P6Home
; /* 028 */
963 DWORD ContextFlags
; /* 030 */
964 DWORD MxCsr
; /* 034 */
967 WORD SegCs
; /* 038 */
968 WORD SegDs
; /* 03a */
969 WORD SegEs
; /* 03c */
970 WORD SegFs
; /* 03e */
971 WORD SegGs
; /* 040 */
972 WORD SegSs
; /* 042 */
973 DWORD EFlags
; /* 044 */
976 DWORD64 Dr0
; /* 048 */
977 DWORD64 Dr1
; /* 050 */
978 DWORD64 Dr2
; /* 058 */
979 DWORD64 Dr3
; /* 060 */
980 DWORD64 Dr6
; /* 068 */
981 DWORD64 Dr7
; /* 070 */
984 DWORD64 Rax
; /* 078 */
985 DWORD64 Rcx
; /* 080 */
986 DWORD64 Rdx
; /* 088 */
987 DWORD64 Rbx
; /* 090 */
988 DWORD64 Rsp
; /* 098 */
989 DWORD64 Rbp
; /* 0a0 */
990 DWORD64 Rsi
; /* 0a8 */
991 DWORD64 Rdi
; /* 0b0 */
992 DWORD64 R8
; /* 0b8 */
993 DWORD64 R9
; /* 0c0 */
994 DWORD64 R10
; /* 0c8 */
995 DWORD64 R11
; /* 0d0 */
996 DWORD64 R12
; /* 0d8 */
997 DWORD64 R13
; /* 0e0 */
998 DWORD64 R14
; /* 0e8 */
999 DWORD64 R15
; /* 0f0 */
1002 DWORD64 Rip
; /* 0f8 */
1004 /* Floating point */
1006 XMM_SAVE_AREA32 FltSave
; /* 100 */
1008 M128A Header
[2]; /* 100 */
1009 M128A Legacy
[8]; /* 120 */
1010 M128A Xmm0
; /* 1a0 */
1011 M128A Xmm1
; /* 1b0 */
1012 M128A Xmm2
; /* 1c0 */
1013 M128A Xmm3
; /* 1d0 */
1014 M128A Xmm4
; /* 1e0 */
1015 M128A Xmm5
; /* 1f0 */
1016 M128A Xmm6
; /* 200 */
1017 M128A Xmm7
; /* 210 */
1018 M128A Xmm8
; /* 220 */
1019 M128A Xmm9
; /* 230 */
1020 M128A Xmm10
; /* 240 */
1021 M128A Xmm11
; /* 250 */
1022 M128A Xmm12
; /* 260 */
1023 M128A Xmm13
; /* 270 */
1024 M128A Xmm14
; /* 280 */
1025 M128A Xmm15
; /* 290 */
1030 M128A VectorRegister
[26]; /* 300 */
1031 DWORD64 VectorControl
; /* 4a0 */
1034 DWORD64 DebugControl
; /* 4a8 */
1035 DWORD64 LastBranchToRip
; /* 4b0 */
1036 DWORD64 LastBranchFromRip
; /* 4b8 */
1037 DWORD64 LastExceptionToRip
; /* 4c0 */
1038 DWORD64 LastExceptionFromRip
; /* 4c8 */
1041 typedef struct _RUNTIME_FUNCTION
1046 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1048 #define UNWIND_HISTORY_TABLE_SIZE 12
1050 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1053 PRUNTIME_FUNCTION FunctionEntry
;
1054 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1056 #define UNWIND_HISTORY_TABLE_NONE 0
1057 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1058 #define UNWIND_HISTORY_TABLE_LOCAL 2
1060 typedef struct _UNWIND_HISTORY_TABLE
1065 ULONG64 HighAddress
;
1066 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1067 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1069 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1073 PM128A FloatingContext
[16];
1097 PULONG64 IntegerContext
[16];
1118 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1120 BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD64
);
1121 BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
1122 PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD64
,DWORD64
*,UNWIND_HISTORY_TABLE
*);
1123 PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1125 #define UNW_FLAG_NHANDLER 0
1126 #define UNW_FLAG_EHANDLER 1
1127 #define UNW_FLAG_UHANDLER 2
1128 #define UNW_FLAG_CHAININFO 4
1130 #endif /* __x86_64__ */
1132 /* IA64 context definitions */
1135 #define CONTEXT_IA64 0x00080000
1136 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1137 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1138 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1139 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1140 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1141 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1142 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1143 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1144 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1146 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1147 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1148 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1149 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1151 typedef struct _CONTEXT
1346 ULONGLONG RsBSPSTORE
;
1360 ULONGLONG UNUSEDPACK
;
1361 } CONTEXT
, *PCONTEXT
;
1363 typedef struct _RUNTIME_FUNCTION
1367 ULONG UnwindInfoAddress
;
1368 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1370 typedef struct _FRAME_POINTERS
{
1371 ULONGLONG MemoryStackFp
;
1372 ULONGLONG BackingStoreFp
;
1373 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1375 #define UNWIND_HISTORY_TABLE_SIZE 12
1377 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1380 PRUNTIME_FUNCTION FunctionEntry
;
1381 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1383 typedef struct _UNWIND_HISTORY_TABLE
{
1387 ULONG64 HighAddress
;
1388 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1389 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1391 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1397 PFLOAT128 HighFloatingContext
[10];
1419 PULONGLONG IntS0Nat
;
1420 PULONGLONG IntS1Nat
;
1421 PULONGLONG IntS2Nat
;
1422 PULONGLONG IntS3Nat
;
1423 PULONGLONG IntSpNat
;
1439 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1441 ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1443 #endif /* __ia64__ */
1445 /* Alpha context definitions */
1446 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1448 #define CONTEXT_ALPHA 0x00020000
1450 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1451 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1452 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1453 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1455 #define EXCEPTION_READ_FAULT 0
1456 #define EXCEPTION_WRITE_FAULT 1
1457 #define EXCEPTION_EXECUTE_FAULT 8
1459 typedef struct _CONTEXT
1461 /* selected by CONTEXT_FLOATING_POINT */
1495 /* selected by CONTEXT_INTEGER */
1529 /* selected by CONTEXT_FLOATING_POINT */
1533 /* selected by CONTEXT_CONTROL */
1540 #define _QUAD_PSR_OFFSET HighSoftFpcr
1541 #define _QUAD_FLAGS_OFFSET HighFir
1543 #endif /* _ALPHA_ */
1547 /* The following flags control the contents of the CONTEXT structure. */
1549 #define CONTEXT_ARM 0x0200000
1550 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1551 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1552 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1553 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1555 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1557 #define EXCEPTION_READ_FAULT 0
1558 #define EXCEPTION_WRITE_FAULT 1
1559 #define EXCEPTION_EXECUTE_FAULT 8
1561 typedef struct _CONTEXT
{
1562 /* The flags values within this flag control the contents of
1565 If the context record is used as an input parameter, then
1566 for each portion of the context record controlled by a flag
1567 whose value is set, it is assumed that that portion of the
1568 context record contains valid context. If the context record
1569 is being used to modify a thread's context, then only that
1570 portion of the threads context will be modified.
1572 If the context record is used as an IN OUT parameter to capture
1573 the context of a thread, then only those portions of the thread's
1574 context corresponding to set flags will be returned.
1576 The context record is never used as an OUT only parameter. */
1580 /* This section is specified/returned if the ContextFlags word contains
1581 the flag CONTEXT_INTEGER. */
1596 /* These are selected by CONTEXT_CONTROL */
1603 #endif /* __arm__ */
1606 /* Mips context definitions */
1607 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1609 #define CONTEXT_R4000 0x00010000
1611 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1612 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1613 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1615 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1617 #define EXCEPTION_READ_FAULT 0
1618 #define EXCEPTION_WRITE_FAULT 1
1619 #define EXCEPTION_EXECUTE_FAULT 8
1621 typedef struct _CONTEXT
1624 /* These are selected by CONTEXT_FLOATING_POINT */
1658 /* These are selected by CONTEXT_INTEGER */
1694 /* These are selected by CONTEXT_FLOATING_POINT */
1697 /* These are selected by CONTEXT_CONTROL */
1707 /* PowerPC context definitions */
1710 #define CONTEXT_CONTROL 0x0001
1711 #define CONTEXT_FLOATING_POINT 0x0002
1712 #define CONTEXT_INTEGER 0x0004
1713 #define CONTEXT_DEBUG_REGISTERS 0x0008
1714 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1716 #define EXCEPTION_READ_FAULT 0
1717 #define EXCEPTION_WRITE_FAULT 1
1718 #define EXCEPTION_EXECUTE_FAULT 8
1722 /* These are selected by CONTEXT_FLOATING_POINT */
1757 /* These are selected by CONTEXT_INTEGER */
1794 /* These are selected by CONTEXT_CONTROL */
1796 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1802 DWORD Dar
; /* Fault registers for coredump */
1804 DWORD Trap
; /* number of powerpc exception taken */
1806 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1817 typedef struct _STACK_FRAME_HEADER
1834 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1836 #endif /* __powerpc__ */
1843 * There is no official CONTEXT structure defined for the SPARC
1844 * architecture, so I just made one up.
1846 * This structure is valid only for 32-bit SPARC architectures,
1847 * not for 64-bit SPARC.
1849 * Note that this structure contains only the 'top-level' registers;
1850 * the rest of the register window chain is not visible.
1852 * The layout follows the Solaris 'prgregset_t' structure.
1856 #define CONTEXT_SPARC 0x10000000
1858 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1859 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1860 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1862 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1864 #define EXCEPTION_READ_FAULT 0
1865 #define EXCEPTION_WRITE_FAULT 1
1866 #define EXCEPTION_EXECUTE_FAULT 8
1868 typedef struct _CONTEXT
1872 /* These are selected by CONTEXT_INTEGER */
1906 /* These are selected by CONTEXT_CONTROL */
1914 /* FIXME: floating point registers missing */
1918 #endif /* __sparc__ */
1920 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1921 #error You need to define a CONTEXT for your CPU
1924 typedef CONTEXT
*PCONTEXT
;
1926 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1931 #define PRODUCT_UNLICENSED 0xABCDABCD
1932 #define PRODUCT_BUSINESS 0x00000006
1933 #define PRODUCT_BUSINESS_N 0x00000010
1934 #define PRODUCT_CLUSTER_SERVER 0x00000012
1935 #define PRODUCT_DATACENTER_SERVER 0x00000008
1936 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1937 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1938 #define PRODUCT_SERVER_V 0x00000025
1939 #define PRODUCT_ENTERPRISE 0x00000004
1940 #define PRODUCT_ENTERPRISE_N 0x0000001B
1941 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1942 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1943 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1944 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1945 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1946 #define PRODUCT_HOME_BASIC 0x00000002
1947 #define PRODUCT_HOME_BASIC_N 0x00000005
1948 #define PRODUCT_HOME_PREMIUM 0x00000003
1949 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1950 #define PRODUCT_HYPERV 0x0000002A
1951 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1952 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1953 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1954 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1955 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1956 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1957 #define PRODUCT_STANDARD_SERVER 0x00000007
1958 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1959 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1960 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1961 #define PRODUCT_STARTER 0x0000000B
1962 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1963 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1964 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1965 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1966 #define PRODUCT_UNDEFINED 0x00000000
1967 #define PRODUCT_ULTIMATE 0x00000001
1968 #define PRODUCT_ULTIMATE_N 0x0000001C
1969 #define PRODUCT_WEB_SERVER 0x00000011
1970 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1977 #define MAKELCID(l, s) (MAKELONG(l, s))
1979 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1980 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1981 #define SUBLANGID(l) ((WORD)(l) >> 10)
1983 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1984 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1986 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1987 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1988 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1989 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1990 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1991 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1992 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
1993 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
1994 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
1995 #define LOCALE_NAME_MAX_LENGTH 85
1998 #define UNREFERENCED_PARAMETER(u) (void)(u)
1999 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2000 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2006 * Definitions for IsTextUnicode()
2009 #define IS_TEXT_UNICODE_ASCII16 0x0001
2010 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2011 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2012 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2013 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2014 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2015 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2016 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2017 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2018 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2019 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2020 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2021 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2022 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2023 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2024 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2026 #define MAXIMUM_WAIT_OBJECTS 64
2027 #define MAXIMUM_SUSPEND_COUNT 127
2029 #define WT_EXECUTEDEFAULT 0x00
2030 #define WT_EXECUTEINIOTHREAD 0x01
2031 #define WT_EXECUTEINUITHREAD 0x02
2032 #define WT_EXECUTEINWAITTHREAD 0x04
2033 #define WT_EXECUTEONLYONCE 0x08
2034 #define WT_EXECUTELONGFUNCTION 0x10
2035 #define WT_EXECUTEINTIMERTHREAD 0x20
2036 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2037 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2038 #define WT_EXECUTEINLONGTHREAD 0x10
2039 #define WT_EXECUTEDELETEWAIT 0x08
2040 #define WT_TRANSFER_IMPERSONATION 0x0100
2043 #define EXCEPTION_CONTINUABLE 0
2044 #define EXCEPTION_NONCONTINUABLE 0x01
2047 * The exception record used by Win32 to give additional information
2048 * about exception to exception handlers.
2051 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2053 typedef struct _EXCEPTION_RECORD
2055 DWORD ExceptionCode
;
2056 DWORD ExceptionFlags
;
2057 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2059 PVOID ExceptionAddress
;
2060 DWORD NumberParameters
;
2061 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2062 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2065 * The exception pointers structure passed to exception filters
2066 * in except() and the UnhandledExceptionFilter().
2069 typedef struct _EXCEPTION_POINTERS
2071 PEXCEPTION_RECORD ExceptionRecord
;
2072 PCONTEXT ContextRecord
;
2073 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2077 * The exception frame, used for registering exception handlers
2078 * Win32 cares only about this, but compilers generally emit
2079 * larger exception frames for their own use.
2082 struct _EXCEPTION_REGISTRATION_RECORD
;
2084 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2085 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2087 typedef struct _EXCEPTION_REGISTRATION_RECORD
2089 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2090 PEXCEPTION_HANDLER Handler
;
2091 } EXCEPTION_REGISTRATION_RECORD
;
2094 * function pointer to an exception filter
2097 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2099 typedef struct _NT_TIB
2101 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2109 PVOID ArbitraryUserPointer
;
2110 struct _NT_TIB
*Self
;
2115 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2116 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2119 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2122 #elif defined(__i386__) && defined(_MSC_VER)
2123 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2126 __asm mov eax
, fs
:[0x18];
2130 #elif defined(__x86_64__) && defined(__GNUC__)
2131 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2134 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2137 #elif defined(__x86_64__) && defined (_MSC_VER)
2138 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2141 __asm mov rax
, gs
:[0x30];
2146 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2149 #ifdef NONAMELESSUNION
2150 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2152 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2154 #define GetFiberData() (*(void **)GetCurrentFiber())
2156 #define TLS_MINIMUM_AVAILABLE 64
2159 * File formats definitions
2162 #include <pshpack2.h>
2163 typedef struct _IMAGE_DOS_HEADER
{
2164 WORD e_magic
; /* 00: MZ Header signature */
2165 WORD e_cblp
; /* 02: Bytes on last page of file */
2166 WORD e_cp
; /* 04: Pages in file */
2167 WORD e_crlc
; /* 06: Relocations */
2168 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2169 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2170 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2171 WORD e_ss
; /* 0e: Initial (relative) SS value */
2172 WORD e_sp
; /* 10: Initial SP value */
2173 WORD e_csum
; /* 12: Checksum */
2174 WORD e_ip
; /* 14: Initial IP value */
2175 WORD e_cs
; /* 16: Initial (relative) CS value */
2176 WORD e_lfarlc
; /* 18: File address of relocation table */
2177 WORD e_ovno
; /* 1a: Overlay number */
2178 WORD e_res
[4]; /* 1c: Reserved words */
2179 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2180 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2181 WORD e_res2
[10]; /* 28: Reserved words */
2182 DWORD e_lfanew
; /* 3c: Offset to extended header */
2183 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2184 #include <poppack.h>
2186 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2187 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2188 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2189 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2190 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2191 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2194 * This is the Windows executable (NE) header.
2195 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2197 #include <pshpack2.h>
2200 WORD ne_magic
; /* 00 NE signature 'NE' */
2201 BYTE ne_ver
; /* 02 Linker version number */
2202 BYTE ne_rev
; /* 03 Linker revision number */
2203 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2204 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2205 LONG ne_crc
; /* 08 Checksum */
2206 WORD ne_flags
; /* 0c Flags about segments in this file */
2207 WORD ne_autodata
; /* 0e Automatic data segment number */
2208 WORD ne_heap
; /* 10 Initial size of local heap */
2209 WORD ne_stack
; /* 12 Initial size of stack */
2210 DWORD ne_csip
; /* 14 Initial CS:IP */
2211 DWORD ne_sssp
; /* 18 Initial SS:SP */
2212 WORD ne_cseg
; /* 1c # of entries in segment table */
2213 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2214 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2215 WORD ne_segtab
; /* 22 Offset to segment table */
2216 WORD ne_rsrctab
; /* 24 Offset to resource table */
2217 WORD ne_restab
; /* 26 Offset to resident-name table */
2218 WORD ne_modtab
; /* 28 Offset to module reference table */
2219 WORD ne_imptab
; /* 2a Offset to imported name table */
2220 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2221 WORD ne_cmovent
; /* 30 # of movable entry points */
2222 WORD ne_align
; /* 32 Logical sector alignment shift count */
2223 WORD ne_cres
; /* 34 # of resource segments */
2224 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2225 BYTE ne_flagsothers
; /* 37 Additional information flags */
2226 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2227 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2228 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2229 WORD ne_expver
; /* 3e Expected Windows version number */
2230 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2231 #include <poppack.h>
2233 #include <pshpack2.h>
2234 typedef struct _IMAGE_VXD_HEADER
{
2249 DWORD e32_lastpagesize
;
2250 DWORD e32_fixupsize
;
2267 DWORD e32_impmodcnt
;
2273 DWORD e32_cbnrestab
;
2276 DWORD e32_debuginfo
;
2278 DWORD e32_instpreload
;
2279 DWORD e32_instdemand
;
2282 DWORD e32_winresoff
;
2283 DWORD e32_winreslen
;
2286 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2287 #include <poppack.h>
2289 /* These defines describe the meanings of the bits in the Characteristics
2292 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2293 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2294 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2295 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2296 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2297 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2298 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2299 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2300 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2301 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2302 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2303 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2304 #define IMAGE_FILE_SYSTEM 0x1000
2305 #define IMAGE_FILE_DLL 0x2000
2306 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2307 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2309 /* These are the settings of the Machine field. */
2310 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2311 #define IMAGE_FILE_MACHINE_I860 0x014d
2312 #define IMAGE_FILE_MACHINE_I386 0x014c
2313 #define IMAGE_FILE_MACHINE_R3000 0x0162
2314 #define IMAGE_FILE_MACHINE_R4000 0x0166
2315 #define IMAGE_FILE_MACHINE_R10000 0x0168
2316 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2317 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2318 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2319 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2320 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2321 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2322 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2323 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2324 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2325 #define IMAGE_FILE_MACHINE_ARMV7 0x01c4
2326 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2327 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2328 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2329 #define IMAGE_FILE_MACHINE_IA64 0x0200
2330 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2331 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2332 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2333 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2334 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2335 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2336 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2337 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2338 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2339 #define IMAGE_FILE_MACHINE_M32R 0x9041
2340 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2342 /* Wine extension */
2343 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2345 #define IMAGE_SIZEOF_FILE_HEADER 20
2346 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2347 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2348 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2349 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2350 #define IMAGE_SIZEOF_SHORT_NAME 8
2351 #define IMAGE_SIZEOF_SECTION_HEADER 40
2352 #define IMAGE_SIZEOF_SYMBOL 18
2353 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2354 #define IMAGE_SIZEOF_RELOCATION 10
2355 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2356 #define IMAGE_SIZEOF_LINENUMBER 6
2357 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2359 /* Possible Magic values */
2360 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2361 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2362 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2365 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2366 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2368 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2369 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2372 /* These are indexes into the DataDirectory array */
2373 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2374 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2375 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2376 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2377 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2378 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2379 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2380 #define IMAGE_FILE_DESCRIPTION_STRING 7
2381 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2382 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2383 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2385 /* Directory Entries, indices into the DataDirectory array */
2387 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2388 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2389 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2390 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2391 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2392 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2393 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2394 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2395 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2396 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2397 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2398 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2399 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2400 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2401 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2403 /* Subsystem Values */
2405 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2406 #define IMAGE_SUBSYSTEM_NATIVE 1
2407 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2408 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2409 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2410 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2411 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2412 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2413 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2414 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2415 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2416 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2417 #define IMAGE_SUBSYSTEM_XBOX 14
2418 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2420 /* DLL Characteristics */
2421 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2422 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2423 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2424 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2425 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2426 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2427 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2428 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2430 typedef struct _IMAGE_FILE_HEADER
{
2432 WORD NumberOfSections
;
2433 DWORD TimeDateStamp
;
2434 DWORD PointerToSymbolTable
;
2435 DWORD NumberOfSymbols
;
2436 WORD SizeOfOptionalHeader
;
2437 WORD Characteristics
;
2438 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2440 typedef struct _IMAGE_DATA_DIRECTORY
{
2441 DWORD VirtualAddress
;
2443 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2445 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2447 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2448 WORD Magic
; /* 0x20b */
2449 BYTE MajorLinkerVersion
;
2450 BYTE MinorLinkerVersion
;
2452 DWORD SizeOfInitializedData
;
2453 DWORD SizeOfUninitializedData
;
2454 DWORD AddressOfEntryPoint
;
2456 ULONGLONG ImageBase
;
2457 DWORD SectionAlignment
;
2458 DWORD FileAlignment
;
2459 WORD MajorOperatingSystemVersion
;
2460 WORD MinorOperatingSystemVersion
;
2461 WORD MajorImageVersion
;
2462 WORD MinorImageVersion
;
2463 WORD MajorSubsystemVersion
;
2464 WORD MinorSubsystemVersion
;
2465 DWORD Win32VersionValue
;
2467 DWORD SizeOfHeaders
;
2470 WORD DllCharacteristics
;
2471 ULONGLONG SizeOfStackReserve
;
2472 ULONGLONG SizeOfStackCommit
;
2473 ULONGLONG SizeOfHeapReserve
;
2474 ULONGLONG SizeOfHeapCommit
;
2476 DWORD NumberOfRvaAndSizes
;
2477 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2478 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2480 typedef struct _IMAGE_NT_HEADERS64
{
2482 IMAGE_FILE_HEADER FileHeader
;
2483 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2484 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2486 typedef struct _IMAGE_OPTIONAL_HEADER
{
2488 /* Standard fields */
2490 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2491 BYTE MajorLinkerVersion
;
2492 BYTE MinorLinkerVersion
;
2494 DWORD SizeOfInitializedData
;
2495 DWORD SizeOfUninitializedData
;
2496 DWORD AddressOfEntryPoint
; /* 0x10 */
2500 /* NT additional fields */
2503 DWORD SectionAlignment
; /* 0x20 */
2504 DWORD FileAlignment
;
2505 WORD MajorOperatingSystemVersion
;
2506 WORD MinorOperatingSystemVersion
;
2507 WORD MajorImageVersion
;
2508 WORD MinorImageVersion
;
2509 WORD MajorSubsystemVersion
; /* 0x30 */
2510 WORD MinorSubsystemVersion
;
2511 DWORD Win32VersionValue
;
2513 DWORD SizeOfHeaders
;
2514 DWORD CheckSum
; /* 0x40 */
2516 WORD DllCharacteristics
;
2517 DWORD SizeOfStackReserve
;
2518 DWORD SizeOfStackCommit
;
2519 DWORD SizeOfHeapReserve
; /* 0x50 */
2520 DWORD SizeOfHeapCommit
;
2522 DWORD NumberOfRvaAndSizes
;
2523 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2525 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2527 typedef struct _IMAGE_NT_HEADERS
{
2528 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2529 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2530 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2531 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2534 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2535 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2536 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2537 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2539 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2540 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2541 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2542 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2545 #define IMAGE_SIZEOF_SHORT_NAME 8
2547 typedef struct _IMAGE_SECTION_HEADER
{
2548 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2550 DWORD PhysicalAddress
;
2553 DWORD VirtualAddress
;
2554 DWORD SizeOfRawData
;
2555 DWORD PointerToRawData
;
2556 DWORD PointerToRelocations
;
2557 DWORD PointerToLinenumbers
;
2558 WORD NumberOfRelocations
;
2559 WORD NumberOfLinenumbers
;
2560 DWORD Characteristics
;
2561 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2563 #define IMAGE_SIZEOF_SECTION_HEADER 40
2565 #define IMAGE_FIRST_SECTION(ntheader) \
2566 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2567 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2569 /* These defines are for the Characteristics bitfield. */
2570 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2571 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2572 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2573 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2574 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2575 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2577 #define IMAGE_SCN_CNT_CODE 0x00000020
2578 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2579 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2581 #define IMAGE_SCN_LNK_OTHER 0x00000100
2582 #define IMAGE_SCN_LNK_INFO 0x00000200
2583 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2584 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2585 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2587 /* 0x00002000 - Reserved */
2588 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2589 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2591 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2592 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2593 #define IMAGE_SCN_MEM_16BIT 0x00020000
2594 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2595 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2597 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2598 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2599 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2600 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2601 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2602 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2603 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2604 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2605 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2606 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2607 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2608 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2609 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2610 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2611 /* 0x00F00000 - Unused */
2612 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2614 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2617 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2618 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2619 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2620 #define IMAGE_SCN_MEM_SHARED 0x10000000
2621 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2622 #define IMAGE_SCN_MEM_READ 0x40000000
2623 #define IMAGE_SCN_MEM_WRITE 0x80000000
2625 #include <pshpack2.h>
2627 typedef struct _IMAGE_SYMBOL
{
2637 SHORT SectionNumber
;
2640 BYTE NumberOfAuxSymbols
;
2642 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2644 #define IMAGE_SIZEOF_SYMBOL 18
2646 typedef struct _IMAGE_LINENUMBER
{
2648 DWORD SymbolTableIndex
;
2649 DWORD VirtualAddress
;
2653 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2655 #define IMAGE_SIZEOF_LINENUMBER 6
2657 typedef union _IMAGE_AUX_SYMBOL
{
2669 DWORD PointerToLinenumber
;
2670 DWORD PointerToNextFunction
;
2679 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2683 WORD NumberOfRelocations
;
2684 WORD NumberOfLinenumbers
;
2690 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2692 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2694 #include <poppack.h>
2696 #define IMAGE_SYM_UNDEFINED (SHORT)0
2697 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2698 #define IMAGE_SYM_DEBUG (SHORT)-2
2700 #define IMAGE_SYM_TYPE_NULL 0x0000
2701 #define IMAGE_SYM_TYPE_VOID 0x0001
2702 #define IMAGE_SYM_TYPE_CHAR 0x0002
2703 #define IMAGE_SYM_TYPE_SHORT 0x0003
2704 #define IMAGE_SYM_TYPE_INT 0x0004
2705 #define IMAGE_SYM_TYPE_LONG 0x0005
2706 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2707 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2708 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2709 #define IMAGE_SYM_TYPE_UNION 0x0009
2710 #define IMAGE_SYM_TYPE_ENUM 0x000A
2711 #define IMAGE_SYM_TYPE_MOE 0x000B
2712 #define IMAGE_SYM_TYPE_BYTE 0x000C
2713 #define IMAGE_SYM_TYPE_WORD 0x000D
2714 #define IMAGE_SYM_TYPE_UINT 0x000E
2715 #define IMAGE_SYM_TYPE_DWORD 0x000F
2716 #define IMAGE_SYM_TYPE_PCODE 0x8000
2718 #define IMAGE_SYM_DTYPE_NULL 0
2719 #define IMAGE_SYM_DTYPE_POINTER 1
2720 #define IMAGE_SYM_DTYPE_FUNCTION 2
2721 #define IMAGE_SYM_DTYPE_ARRAY 3
2723 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2724 #define IMAGE_SYM_CLASS_NULL 0x0000
2725 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2726 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2727 #define IMAGE_SYM_CLASS_STATIC 0x0003
2728 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2729 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2730 #define IMAGE_SYM_CLASS_LABEL 0x0006
2731 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2732 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2733 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2734 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2735 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2736 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2737 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2738 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2739 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2740 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2741 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2742 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2744 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2745 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2746 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2747 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2748 #define IMAGE_SYM_CLASS_FILE 0x0067
2749 #define IMAGE_SYM_CLASS_SECTION 0x0068
2750 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2752 #define N_BTMASK 0x000F
2753 #define N_TMASK 0x0030
2754 #define N_TMASK1 0x00C0
2755 #define N_TMASK2 0x00F0
2759 #define BTYPE(x) ((x) & N_BTMASK)
2762 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2766 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2770 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2774 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2778 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2781 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2784 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2785 #define IMAGE_COMDAT_SELECT_ANY 2
2786 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2787 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2788 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2789 #define IMAGE_COMDAT_SELECT_LARGEST 6
2790 #define IMAGE_COMDAT_SELECT_NEWEST 7
2792 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2793 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2794 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2796 /* Export module directory */
2798 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2799 DWORD Characteristics
;
2800 DWORD TimeDateStamp
;
2805 DWORD NumberOfFunctions
;
2806 DWORD NumberOfNames
;
2807 DWORD AddressOfFunctions
;
2808 DWORD AddressOfNames
;
2809 DWORD AddressOfNameOrdinals
;
2810 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
2812 /* Import name entry */
2813 typedef struct _IMAGE_IMPORT_BY_NAME
{
2816 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
2818 #include <pshpack8.h>
2820 typedef struct _IMAGE_THUNK_DATA64
{
2822 ULONGLONG ForwarderString
;
2825 ULONGLONG AddressOfData
;
2827 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
2828 #include <poppack.h>
2830 typedef struct _IMAGE_THUNK_DATA32
{
2832 DWORD ForwarderString
;
2835 DWORD AddressOfData
;
2837 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
2839 /* Import module directory */
2841 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
2843 DWORD Characteristics
; /* 0 for terminating null import descriptor */
2844 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
2846 DWORD TimeDateStamp
; /* 0 if not bound,
2847 * -1 if bound, and real date\time stamp
2848 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2850 * otherwise date/time stamp of DLL bound to
2853 DWORD ForwarderChain
; /* -1 if no forwarders */
2855 /* RVA to IAT (if bound this IAT has actual addresses) */
2857 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
2859 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
2860 #define IMAGE_ORDINAL_FLAG32 0x80000000
2861 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
2862 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
2863 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
2864 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
2867 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
2868 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
2869 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
2870 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
2871 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
2873 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
2874 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
2875 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
2876 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
2877 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
2880 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2882 DWORD TimeDateStamp
;
2883 WORD OffsetModuleName
;
2884 WORD NumberOfModuleForwarderRefs
;
2885 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2886 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
2888 typedef struct _IMAGE_BOUND_FORWARDER_REF
2890 DWORD TimeDateStamp
;
2891 WORD OffsetModuleName
;
2893 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
2895 typedef struct _IMAGE_BASE_RELOCATION
2897 DWORD VirtualAddress
;
2899 /* WORD TypeOffset[1]; */
2900 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
2902 #include <pshpack2.h>
2904 typedef struct _IMAGE_RELOCATION
2907 DWORD VirtualAddress
;
2910 DWORD SymbolTableIndex
;
2912 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
2914 #include <poppack.h>
2916 #define IMAGE_SIZEOF_RELOCATION 10
2918 /* generic relocation types */
2919 #define IMAGE_REL_BASED_ABSOLUTE 0
2920 #define IMAGE_REL_BASED_HIGH 1
2921 #define IMAGE_REL_BASED_LOW 2
2922 #define IMAGE_REL_BASED_HIGHLOW 3
2923 #define IMAGE_REL_BASED_HIGHADJ 4
2924 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2925 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
2926 #define IMAGE_REL_BASED_SECTION 6
2927 #define IMAGE_REL_BASED_REL 7
2928 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
2929 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2930 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2931 #define IMAGE_REL_BASED_DIR64 10
2932 #define IMAGE_REL_BASED_HIGH3ADJ 11
2934 /* I386 relocation types */
2935 #define IMAGE_REL_I386_ABSOLUTE 0
2936 #define IMAGE_REL_I386_DIR16 1
2937 #define IMAGE_REL_I386_REL16 2
2938 #define IMAGE_REL_I386_DIR32 6
2939 #define IMAGE_REL_I386_DIR32NB 7
2940 #define IMAGE_REL_I386_SEG12 9
2941 #define IMAGE_REL_I386_SECTION 10
2942 #define IMAGE_REL_I386_SECREL 11
2943 #define IMAGE_REL_I386_TOKEN 12
2944 #define IMAGE_REL_I386_SECREL7 13
2945 #define IMAGE_REL_I386_REL32 20
2947 /* MIPS relocation types */
2948 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2949 #define IMAGE_REL_MIPS_REFHALF 0x0001
2950 #define IMAGE_REL_MIPS_REFWORD 0x0002
2951 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2952 #define IMAGE_REL_MIPS_REFHI 0x0004
2953 #define IMAGE_REL_MIPS_REFLO 0x0005
2954 #define IMAGE_REL_MIPS_GPREL 0x0006
2955 #define IMAGE_REL_MIPS_LITERAL 0x0007
2956 #define IMAGE_REL_MIPS_SECTION 0x000A
2957 #define IMAGE_REL_MIPS_SECREL 0x000B
2958 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2959 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2960 #define IMAGE_REL_MIPS_TOKEN 0x000E
2961 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2962 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2963 #define IMAGE_REL_MIPS_PAIR 0x0025
2965 /* ALPHA relocation types */
2966 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2967 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2968 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2969 #define IMAGE_REL_ALPHA_GPREL 0x0003
2970 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2971 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2972 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2973 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2974 #define IMAGE_REL_ALPHA_HINT 0x0008
2975 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2976 #define IMAGE_REL_ALPHA_REFHI 0x000A
2977 #define IMAGE_REL_ALPHA_REFLO 0x000B
2978 #define IMAGE_REL_ALPHA_PAIR 0x000C
2979 #define IMAGE_REL_ALPHA_MATCH 0x000D
2980 #define IMAGE_REL_ALPHA_SECTION 0x000E
2981 #define IMAGE_REL_ALPHA_SECREL 0x000F
2982 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2983 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2984 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2985 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2986 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2987 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2988 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2989 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2991 /* PowerPC relocation types */
2992 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2993 #define IMAGE_REL_PPC_ADDR64 0x0001
2994 #define IMAGE_REL_PPC_ADDR 0x0002
2995 #define IMAGE_REL_PPC_ADDR24 0x0003
2996 #define IMAGE_REL_PPC_ADDR16 0x0004
2997 #define IMAGE_REL_PPC_ADDR14 0x0005
2998 #define IMAGE_REL_PPC_REL24 0x0006
2999 #define IMAGE_REL_PPC_REL14 0x0007
3000 #define IMAGE_REL_PPC_TOCREL16 0x0008
3001 #define IMAGE_REL_PPC_TOCREL14 0x0009
3002 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3003 #define IMAGE_REL_PPC_SECREL 0x000B
3004 #define IMAGE_REL_PPC_SECTION 0x000C
3005 #define IMAGE_REL_PPC_IFGLUE 0x000D
3006 #define IMAGE_REL_PPC_IMGLUE 0x000E
3007 #define IMAGE_REL_PPC_SECREL16 0x000F
3008 #define IMAGE_REL_PPC_REFHI 0x0010
3009 #define IMAGE_REL_PPC_REFLO 0x0011
3010 #define IMAGE_REL_PPC_PAIR 0x0012
3011 #define IMAGE_REL_PPC_SECRELLO 0x0013
3012 #define IMAGE_REL_PPC_SECRELHI 0x0014
3013 #define IMAGE_REL_PPC_GPREL 0x0015
3014 #define IMAGE_REL_PPC_TOKEN 0x0016
3015 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3017 #define IMAGE_REL_PPC_NEG 0x0100
3018 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3019 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3020 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3022 /* SH3 relocation types */
3023 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3024 #define IMAGE_REL_SH3_DIRECT16 0x0001
3025 #define IMAGE_REL_SH3_DIRECT 0x0002
3026 #define IMAGE_REL_SH3_DIRECT8 0x0003
3027 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3028 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3029 #define IMAGE_REL_SH3_DIRECT4 0x0006
3030 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3031 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3032 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3033 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3034 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3035 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3036 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3037 #define IMAGE_REL_SH3_SECTION 0x000E
3038 #define IMAGE_REL_SH3_SECREL 0x000F
3039 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3040 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3041 #define IMAGE_REL_SH3_TOKEN 0x0012
3043 /* ARM relocation types */
3044 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3045 #define IMAGE_REL_ARM_ADDR 0x0001
3046 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3047 #define IMAGE_REL_ARM_BRANCH24 0x0003
3048 #define IMAGE_REL_ARM_BRANCH11 0x0004
3049 #define IMAGE_REL_ARM_TOKEN 0x0005
3050 #define IMAGE_REL_ARM_GPREL12 0x0006
3051 #define IMAGE_REL_ARM_GPREL7 0x0007
3052 #define IMAGE_REL_ARM_BLX24 0x0008
3053 #define IMAGE_REL_ARM_BLX11 0x0009
3054 #define IMAGE_REL_ARM_SECTION 0x000E
3055 #define IMAGE_REL_ARM_SECREL 0x000F
3056 #define IMAGE_REL_ARM_MOV32A 0x0010
3057 #define IMAGE_REL_ARM_MOV32T 0x0011
3058 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3059 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3060 #define IMAGE_REL_ARM_BLX23T 0x0015
3062 /* IA64 relocation types */
3063 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3064 #define IMAGE_REL_IA64_IMM14 0x0001
3065 #define IMAGE_REL_IA64_IMM22 0x0002
3066 #define IMAGE_REL_IA64_IMM64 0x0003
3067 #define IMAGE_REL_IA64_DIR 0x0004
3068 #define IMAGE_REL_IA64_DIR64 0x0005
3069 #define IMAGE_REL_IA64_PCREL21B 0x0006
3070 #define IMAGE_REL_IA64_PCREL21M 0x0007
3071 #define IMAGE_REL_IA64_PCREL21F 0x0008
3072 #define IMAGE_REL_IA64_GPREL22 0x0009
3073 #define IMAGE_REL_IA64_LTOFF22 0x000A
3074 #define IMAGE_REL_IA64_SECTION 0x000B
3075 #define IMAGE_REL_IA64_SECREL22 0x000C
3076 #define IMAGE_REL_IA64_SECREL64I 0x000D
3077 #define IMAGE_REL_IA64_SECREL 0x000E
3078 #define IMAGE_REL_IA64_LTOFF64 0x000F
3079 #define IMAGE_REL_IA64_DIR32NB 0x0010
3080 #define IMAGE_REL_IA64_SREL14 0x0011
3081 #define IMAGE_REL_IA64_SREL22 0x0012
3082 #define IMAGE_REL_IA64_SREL32 0x0013
3083 #define IMAGE_REL_IA64_UREL32 0x0014
3084 #define IMAGE_REL_IA64_PCREL60X 0x0015
3085 #define IMAGE_REL_IA64_PCREL60B 0x0016
3086 #define IMAGE_REL_IA64_PCREL60F 0x0017
3087 #define IMAGE_REL_IA64_PCREL60I 0x0018
3088 #define IMAGE_REL_IA64_PCREL60M 0x0019
3089 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3090 #define IMAGE_REL_IA64_TOKEN 0x001B
3091 #define IMAGE_REL_IA64_GPREL32 0x001C
3092 #define IMAGE_REL_IA64_ADDEND 0x001F
3094 /* AMD64 relocation types */
3095 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3096 #define IMAGE_REL_AMD64_ADDR64 0x0001
3097 #define IMAGE_REL_AMD64_ADDR32 0x0002
3098 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3099 #define IMAGE_REL_AMD64_REL32 0x0004
3100 #define IMAGE_REL_AMD64_REL32_1 0x0005
3101 #define IMAGE_REL_AMD64_REL32_2 0x0006
3102 #define IMAGE_REL_AMD64_REL32_3 0x0007
3103 #define IMAGE_REL_AMD64_REL32_4 0x0008
3104 #define IMAGE_REL_AMD64_REL32_5 0x0009
3105 #define IMAGE_REL_AMD64_SECTION 0x000A
3106 #define IMAGE_REL_AMD64_SECREL 0x000B
3107 #define IMAGE_REL_AMD64_SECREL7 0x000C
3108 #define IMAGE_REL_AMD64_TOKEN 0x000D
3109 #define IMAGE_REL_AMD64_SREL32 0x000E
3110 #define IMAGE_REL_AMD64_PAIR 0x000F
3111 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3113 /* archive format */
3115 #define IMAGE_ARCHIVE_START_SIZE 8
3116 #define IMAGE_ARCHIVE_START "!<arch>\n"
3117 #define IMAGE_ARCHIVE_END "`\n"
3118 #define IMAGE_ARCHIVE_PAD "\n"
3119 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3120 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3122 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3131 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3133 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3135 typedef struct _IMPORT_OBJECT_HEADER
3141 DWORD TimeDateStamp
;
3151 } IMPORT_OBJECT_HEADER
;
3153 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3155 typedef enum IMPORT_OBJECT_TYPE
3157 IMPORT_OBJECT_CODE
= 0,
3158 IMPORT_OBJECT_DATA
= 1,
3159 IMPORT_OBJECT_CONST
= 2
3160 } IMPORT_OBJECT_TYPE
;
3162 typedef enum IMPORT_OBJECT_NAME_TYPE
3164 IMPORT_OBJECT_ORDINAL
= 0,
3165 IMPORT_OBJECT_NAME
= 1,
3166 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3167 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3168 } IMPORT_OBJECT_NAME_TYPE
;
3170 typedef struct _ANON_OBJECT_HEADER
3176 DWORD TimeDateStamp
;
3179 } ANON_OBJECT_HEADER
;
3182 * Resource directory stuff
3184 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3185 DWORD Characteristics
;
3186 DWORD TimeDateStamp
;
3189 WORD NumberOfNamedEntries
;
3190 WORD NumberOfIdEntries
;
3191 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3192 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3194 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3195 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3197 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3200 #ifdef BITFIELDS_BIGENDIAN
3201 unsigned NameIsString
:1;
3202 unsigned NameOffset
:31;
3204 unsigned NameOffset
:31;
3205 unsigned NameIsString
:1;
3210 #ifdef WORDS_BIGENDIAN
3222 #ifdef BITFIELDS_BIGENDIAN
3223 unsigned DataIsDirectory
:1;
3224 unsigned OffsetToDirectory
:31;
3226 unsigned OffsetToDirectory
:31;
3227 unsigned DataIsDirectory
:1;
3231 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3234 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3236 CHAR NameString
[ 1 ];
3237 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3239 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3241 WCHAR NameString
[ 1 ];
3242 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3244 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3249 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3252 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3253 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3256 typedef struct _IMAGE_TLS_DIRECTORY64
{
3257 ULONGLONG StartAddressOfRawData
;
3258 ULONGLONG EndAddressOfRawData
;
3259 ULONGLONG AddressOfIndex
;
3260 ULONGLONG AddressOfCallBacks
;
3261 DWORD SizeOfZeroFill
;
3262 DWORD Characteristics
;
3263 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3265 typedef struct _IMAGE_TLS_DIRECTORY32
{
3266 DWORD StartAddressOfRawData
;
3267 DWORD EndAddressOfRawData
;
3268 DWORD AddressOfIndex
;
3269 DWORD AddressOfCallBacks
;
3270 DWORD SizeOfZeroFill
;
3271 DWORD Characteristics
;
3272 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3275 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3276 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3278 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3279 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3282 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3283 DWORD Characteristics
;
3284 DWORD TimeDateStamp
;
3289 DWORD AddressOfRawData
;
3290 DWORD PointerToRawData
;
3291 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3293 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3294 #define IMAGE_DEBUG_TYPE_COFF 1
3295 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3296 #define IMAGE_DEBUG_TYPE_FPO 3
3297 #define IMAGE_DEBUG_TYPE_MISC 4
3298 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3299 #define IMAGE_DEBUG_TYPE_FIXUP 6
3300 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3301 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3302 #define IMAGE_DEBUG_TYPE_BORLAND 9
3303 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3305 typedef enum ReplacesCorHdrNumericDefines
3307 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3308 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3309 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3310 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3311 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3313 COR_VERSION_MAJOR_V2
= 2,
3314 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3315 COR_VERSION_MINOR
= 0,
3316 COR_DELETED_NAME_LENGTH
= 8,
3317 COR_VTABLEGAP_NAME_LENGTH
= 8,
3319 NATIVE_TYPE_MAX_CB
= 1,
3320 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3322 IMAGE_COR_MIH_METHODRVA
= 0x01,
3323 IMAGE_COR_MIH_EHRVA
= 0x02,
3324 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3326 COR_VTABLE_32BIT
= 0x01,
3327 COR_VTABLE_64BIT
= 0x02,
3328 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3329 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3331 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3333 MAX_CLASS_NAME
= 1024,
3334 MAX_PACKAGE_NAME
= 1024,
3335 } ReplacesCorHdrNumericDefines
;
3337 typedef struct IMAGE_COR20_HEADER
3340 WORD MajorRuntimeVersion
;
3341 WORD MinorRuntimeVersion
;
3343 IMAGE_DATA_DIRECTORY MetaData
;
3345 DWORD EntryPointToken
;
3347 IMAGE_DATA_DIRECTORY Resources
;
3348 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3349 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3350 IMAGE_DATA_DIRECTORY VTableFixups
;
3351 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3352 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3354 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3356 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3357 DWORD NumberOfSymbols
;
3358 DWORD LvaToFirstSymbol
;
3359 DWORD NumberOfLinenumbers
;
3360 DWORD LvaToFirstLinenumber
;
3361 DWORD RvaToFirstByteOfCode
;
3362 DWORD RvaToLastByteOfCode
;
3363 DWORD RvaToFirstByteOfData
;
3364 DWORD RvaToLastByteOfData
;
3365 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3368 #define FRAME_TRAP 1
3370 #define FRAME_NONFPO 3
3372 typedef struct _FPO_DATA
{
3383 } FPO_DATA
, *PFPO_DATA
;
3385 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
3387 DWORD TimeDateStamp
;
3390 DWORD GlobalFlagsClear
;
3391 DWORD GlobalFlagsSet
;
3392 DWORD CriticalSectionDefaultTimeout
;
3393 DWORD DeCommitFreeBlockThreshold
;
3394 DWORD DeCommitTotalFreeThreshold
;
3395 PVOID LockPrefixTable
;
3396 DWORD MaximumAllocationSize
;
3397 DWORD VirtualMemoryThreshold
;
3398 DWORD ProcessHeapFlags
;
3399 DWORD ProcessAffinityMask
;
3403 DWORD SecurityCookie
;
3404 DWORD SEHandlerTable
;
3405 DWORD SEHandlerCount
;
3406 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
3408 typedef struct _IMAGE_FUNCTION_ENTRY
{
3409 DWORD StartingAddress
;
3410 DWORD EndingAddress
;
3411 DWORD EndOfPrologue
;
3412 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3414 #define IMAGE_DEBUG_MISC_EXENAME 1
3416 typedef struct _IMAGE_DEBUG_MISC
{
3422 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3424 /* This is the structure that appears at the very start of a .DBG file. */
3426 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3430 WORD Characteristics
;
3431 DWORD TimeDateStamp
;
3435 DWORD NumberOfSections
;
3436 DWORD ExportedNamesSize
;
3437 DWORD DebugDirectorySize
;
3438 DWORD SectionAlignment
;
3439 DWORD Reserved
[ 2 ];
3440 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3442 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3445 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3449 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3450 #define MESSAGE_RESOURCE_UNICODE 0x0001
3452 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3455 DWORD OffsetToEntries
;
3456 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3458 typedef struct tagMESSAGE_RESOURCE_DATA
{
3459 DWORD NumberOfBlocks
;
3460 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3461 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3464 * Here follows typedefs for security and tokens.
3468 * First a constant for the following typedefs.
3471 #define ANYSIZE_ARRAY 1
3473 /* FIXME: Orphan. What does it point to? */
3474 typedef PVOID PACCESS_TOKEN
;
3475 typedef PVOID PSECURITY_DESCRIPTOR
;
3478 typedef enum _TOKEN_ELEVATION_TYPE
{
3479 TokenElevationTypeDefault
= 1,
3480 TokenElevationTypeFull
,
3481 TokenElevationTypeLimited
3482 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
3485 * TOKEN_INFORMATION_CLASS
3488 typedef enum _TOKEN_INFORMATION_CLASS
{
3497 TokenImpersonationLevel
,
3499 TokenRestrictedSids
,
3501 TokenGroupsAndPrivileges
,
3502 TokenSessionReference
,
3509 TokenHasRestrictions
,
3510 TokenAccessInformation
,
3511 TokenVirtualizationAllowed
,
3512 TokenVirtualizationEnabled
,
3513 TokenIntegrityLevel
,
3515 TokenMandatoryPolicy
,
3518 } TOKEN_INFORMATION_CLASS
;
3520 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3521 #define TOKEN_ADJUST_GROUPS 0x0040
3522 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3523 #define TOKEN_ADJUST_SESSIONID 0x0100
3524 #define TOKEN_ASSIGN_PRIMARY 0x0001
3525 #define TOKEN_DUPLICATE 0x0002
3526 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3527 #define TOKEN_IMPERSONATE 0x0004
3528 #define TOKEN_QUERY 0x0008
3529 #define TOKEN_QUERY_SOURCE 0x0010
3530 #define TOKEN_ADJUST_DEFAULT 0x0080
3531 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3532 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3533 TOKEN_ADJUST_PRIVILEGES | \
3534 TOKEN_ADJUST_GROUPS | \
3535 TOKEN_ADJUST_DEFAULT )
3536 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3537 TOKEN_ASSIGN_PRIMARY | \
3539 TOKEN_IMPERSONATE | \
3541 TOKEN_QUERY_SOURCE | \
3542 TOKEN_ADJUST_PRIVILEGES | \
3543 TOKEN_ADJUST_GROUPS | \
3544 TOKEN_ADJUST_SESSIONID | \
3545 TOKEN_ADJUST_DEFAULT )
3547 #ifndef _SECURITY_DEFINED
3548 #define _SECURITY_DEFINED
3551 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3553 typedef struct _GENERIC_MAPPING
{
3554 ACCESS_MASK GenericRead
;
3555 ACCESS_MASK GenericWrite
;
3556 ACCESS_MASK GenericExecute
;
3557 ACCESS_MASK GenericAll
;
3558 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3560 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3561 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3564 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3565 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3569 typedef struct _SID
{
3571 BYTE SubAuthorityCount
;
3572 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3573 DWORD SubAuthority
[1];
3575 #endif /* !defined(SID_DEFINED) */
3577 #define SID_REVISION (1) /* Current revision */
3578 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3579 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3581 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3587 #define ACL_REVISION1 1
3588 #define ACL_REVISION2 2
3589 #define ACL_REVISION3 3
3590 #define ACL_REVISION4 4
3592 #define MIN_ACL_REVISION ACL_REVISION2
3593 #define MAX_ACL_REVISION ACL_REVISION4
3595 #define ACL_REVISION 2
3597 typedef struct _ACL
{
3605 typedef enum _ACL_INFORMATION_CLASS
3607 AclRevisionInformation
= 1,
3609 } ACL_INFORMATION_CLASS
;
3611 typedef struct _ACL_REVISION_INFORMATION
3614 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
3616 typedef struct _ACL_SIZE_INFORMATION
3619 DWORD AclBytesInUse
;
3621 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
3623 /* SECURITY_DESCRIPTOR */
3624 #define SECURITY_DESCRIPTOR_REVISION 1
3625 #define SECURITY_DESCRIPTOR_REVISION1 1
3631 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3632 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3633 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3634 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3635 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3636 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3637 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3638 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3639 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3640 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3641 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3642 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3643 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3644 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3645 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3646 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3647 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3648 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3649 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3650 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3651 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3652 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3653 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3654 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3655 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3656 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3657 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3658 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3659 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3661 #define SE_GROUP_MANDATORY 0x00000001
3662 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3663 #define SE_GROUP_ENABLED 0x00000004
3664 #define SE_GROUP_OWNER 0x00000008
3665 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3666 #define SE_GROUP_LOGON_ID 0xC0000000
3667 #define SE_GROUP_RESOURCE 0x20000000
3669 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3670 #define SE_PRIVILEGE_ENABLED 0x00000002
3671 #define SE_PRIVILEGE_REMOVED 0x00000004
3672 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3674 #define PRIVILEGE_SET_ALL_NECESSARY 1
3676 #define SE_OWNER_DEFAULTED 0x00000001
3677 #define SE_GROUP_DEFAULTED 0x00000002
3678 #define SE_DACL_PRESENT 0x00000004
3679 #define SE_DACL_DEFAULTED 0x00000008
3680 #define SE_SACL_PRESENT 0x00000010
3681 #define SE_SACL_DEFAULTED 0x00000020
3682 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3683 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3684 #define SE_DACL_AUTO_INHERITED 0x00000400
3685 #define SE_SACL_AUTO_INHERITED 0x00000800
3686 #define SE_DACL_PROTECTED 0x00001000
3687 #define SE_SACL_PROTECTED 0x00002000
3688 #define SE_RM_CONTROL_VALID 0x00004000
3689 #define SE_SELF_RELATIVE 0x00008000
3691 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
3692 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
3694 /* The security descriptor structure */
3698 SECURITY_DESCRIPTOR_CONTROL Control
;
3703 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
3708 SECURITY_DESCRIPTOR_CONTROL Control
;
3713 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
3715 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3717 #endif /* _SECURITY_DEFINED */
3720 * SID_AND_ATTRIBUTES
3723 typedef struct _SID_AND_ATTRIBUTES
{
3726 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
3728 /* security entities */
3729 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
3730 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
3731 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
3733 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3736 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3739 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3742 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3743 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
3744 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
3745 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
3746 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
3749 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3752 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3753 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
3754 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
3755 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
3756 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
3757 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
3758 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
3759 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
3760 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
3761 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
3762 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3763 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
3764 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
3765 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
3766 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
3767 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
3768 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
3769 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
3770 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
3771 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
3772 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
3773 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
3775 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
3776 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
3777 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
3778 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
3779 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
3780 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
3781 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
3783 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
3784 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
3785 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
3786 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
3787 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
3789 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
3790 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
3791 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
3792 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
3793 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
3794 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
3795 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
3796 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
3797 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
3799 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
3800 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
3801 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
3802 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
3803 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
3804 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
3805 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
3807 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
3808 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
3809 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
3810 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
3812 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
3813 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
3814 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
3815 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
3817 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
3818 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
3819 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
3820 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
3821 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
3822 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
3824 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
3825 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
3826 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
3827 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
3828 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
3830 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3832 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
3833 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
3839 WinCreatorOwnerSid
= 3,
3840 WinCreatorGroupSid
= 4,
3841 WinCreatorOwnerServerSid
= 5,
3842 WinCreatorGroupServerSid
= 6,
3843 WinNtAuthoritySid
= 7,
3847 WinInteractiveSid
= 11,
3849 WinAnonymousSid
= 13,
3851 WinEnterpriseControllersSid
= 15,
3853 WinAuthenticatedUserSid
= 17,
3854 WinRestrictedCodeSid
= 18,
3855 WinTerminalServerSid
= 19,
3856 WinRemoteLogonIdSid
= 20,
3857 WinLogonIdsSid
= 21,
3858 WinLocalSystemSid
= 22,
3859 WinLocalServiceSid
= 23,
3860 WinNetworkServiceSid
= 24,
3861 WinBuiltinDomainSid
= 25,
3862 WinBuiltinAdministratorsSid
= 26,
3863 WinBuiltinUsersSid
= 27,
3864 WinBuiltinGuestsSid
= 28,
3865 WinBuiltinPowerUsersSid
= 29,
3866 WinBuiltinAccountOperatorsSid
= 30,
3867 WinBuiltinSystemOperatorsSid
= 31,
3868 WinBuiltinPrintOperatorsSid
= 32,
3869 WinBuiltinBackupOperatorsSid
= 33,
3870 WinBuiltinReplicatorSid
= 34,
3871 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
3872 WinBuiltinRemoteDesktopUsersSid
= 36,
3873 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
3874 WinAccountAdministratorSid
= 38,
3875 WinAccountGuestSid
= 39,
3876 WinAccountKrbtgtSid
= 40,
3877 WinAccountDomainAdminsSid
= 41,
3878 WinAccountDomainUsersSid
= 42,
3879 WinAccountDomainGuestsSid
= 43,
3880 WinAccountComputersSid
= 44,
3881 WinAccountControllersSid
= 45,
3882 WinAccountCertAdminsSid
= 46,
3883 WinAccountSchemaAdminsSid
= 47,
3884 WinAccountEnterpriseAdminsSid
= 48,
3885 WinAccountPolicyAdminsSid
= 49,
3886 WinAccountRasAndIasServersSid
= 50,
3887 WinNTLMAuthenticationSid
= 51,
3888 WinDigestAuthenticationSid
= 52,
3889 WinSChannelAuthenticationSid
= 53,
3890 WinThisOrganizationSid
= 54,
3891 WinOtherOrganizationSid
= 55,
3892 WinBuiltinIncomingForestTrustBuildersSid
= 56,
3893 WinBuiltinPerfMonitoringUsersSid
= 57,
3894 WinBuiltinPerfLoggingUsersSid
= 58,
3895 WinBuiltinAuthorizationAccessSid
= 59,
3896 WinBuiltinTerminalServerLicenseServersSid
= 60,
3897 WinBuiltinDCOMUsersSid
= 61,
3898 WinBuiltinIUsersSid
= 62,
3900 WinBuiltinCryptoOperatorsSid
= 64,
3901 WinUntrustedLabelSid
= 65,
3902 WinLowLabelSid
= 66,
3903 WinMediumLabelSid
= 67,
3904 WinHighLabelSid
= 68,
3905 WinSystemLabelSid
= 69,
3906 WinWriteRestrictedCodeSid
= 70,
3907 WinCreatorOwnerRightsSid
= 71,
3908 WinCacheablePrincipalsGroupSid
= 72,
3909 WinNonCacheablePrincipalsGroupSid
= 73,
3910 WinEnterpriseReadonlyControllersSid
= 74,
3911 WinAccountReadonlyControllersSid
= 75,
3912 WinBuiltinEventLogReadersGroup
= 76,
3913 WinNewEnterpriseReadonlyControllersSid
= 77,
3914 WinBuiltinCertSvcDComAccessGroup
= 78,
3915 WinMediumPlusLabelSid
= 79,
3916 WinLocalLogonSid
= 80,
3917 WinConsoleLogonSid
= 81,
3918 WinThisOrganizationCertificateSid
= 82,
3919 } WELL_KNOWN_SID_TYPE
;
3925 typedef struct _TOKEN_USER
{
3926 SID_AND_ATTRIBUTES User
;
3927 } TOKEN_USER
, *PTOKEN_USER
;
3933 typedef struct _TOKEN_GROUPS
{
3935 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
3936 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
3939 * LUID_AND_ATTRIBUTES
3942 typedef union _LARGE_INTEGER
{
3944 #ifdef WORDS_BIGENDIAN
3952 #ifndef NONAMELESSSTRUCT
3954 #ifdef WORDS_BIGENDIAN
3964 } LARGE_INTEGER
, *PLARGE_INTEGER
;
3966 typedef union _ULARGE_INTEGER
{
3968 #ifdef WORDS_BIGENDIAN
3976 #ifndef NONAMELESSSTRUCT
3978 #ifdef WORDS_BIGENDIAN
3988 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
3991 * Locally Unique Identifier
3994 typedef struct _LUID
{
3999 #include <pshpack4.h>
4000 typedef struct _LUID_AND_ATTRIBUTES
{
4003 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4004 #include <poppack.h>
4010 typedef struct _PRIVILEGE_SET
{
4011 DWORD PrivilegeCount
;
4013 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4014 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4020 typedef struct _TOKEN_PRIVILEGES
{
4021 DWORD PrivilegeCount
;
4022 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4023 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4029 typedef struct _TOKEN_OWNER
{
4031 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4034 * TOKEN_PRIMARY_GROUP
4037 typedef struct _TOKEN_PRIMARY_GROUP
{
4039 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4043 * TOKEN_DEFAULT_DACL
4046 typedef struct _TOKEN_DEFAULT_DACL
{
4048 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4054 #define TOKEN_SOURCE_LENGTH 8
4056 typedef struct _TOKEN_SOURCE
{
4057 char SourceName
[TOKEN_SOURCE_LENGTH
];
4058 LUID SourceIdentifier
;
4059 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4065 typedef enum tagTOKEN_TYPE
{
4071 * SECURITY_IMPERSONATION_LEVEL
4074 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4076 SecurityIdentification
,
4077 SecurityImpersonation
,
4079 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4081 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4082 #define SECURITY_STATIC_TRACKING (FALSE)
4084 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4085 * PSECURITY_CONTEXT_TRACKING_MODE
;
4087 * Quality of Service
4090 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4092 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4093 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4094 BOOLEAN EffectiveOnly
;
4095 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4101 #include <pshpack4.h>
4102 typedef struct _TOKEN_STATISTICS
{
4104 LUID AuthenticationId
;
4105 LARGE_INTEGER ExpirationTime
;
4106 TOKEN_TYPE TokenType
;
4107 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4108 DWORD DynamicCharged
;
4109 DWORD DynamicAvailable
;
4111 DWORD PrivilegeCount
;
4114 #include <poppack.h>
4116 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4119 PSID_AND_ATTRIBUTES Sids
;
4120 DWORD RestrictedSidCount
;
4121 DWORD RestrictedSidLength
;
4122 PSID_AND_ATTRIBUTES RestrictedSids
;
4123 DWORD PrivilegeCount
;
4124 DWORD PrivilegeLength
;
4125 PLUID_AND_ATTRIBUTES Privileges
;
4126 LUID AuthenticationId
;
4127 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4129 typedef struct _TOKEN_ORIGIN
{
4130 LUID OriginatingLogonSession
;
4131 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4133 typedef struct _TOKEN_LINKED_TOKEN
{
4135 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4137 typedef struct _TOKEN_ELEVATION
{
4138 DWORD TokenIsElevated
;
4139 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4146 /* ACEs, directly starting after an ACL */
4147 typedef struct _ACE_HEADER
{
4151 } ACE_HEADER
,*PACE_HEADER
;
4154 #define ACCESS_ALLOWED_ACE_TYPE 0
4155 #define ACCESS_DENIED_ACE_TYPE 1
4156 #define SYSTEM_AUDIT_ACE_TYPE 2
4157 #define SYSTEM_ALARM_ACE_TYPE 3
4159 /* inherit AceFlags */
4160 #define OBJECT_INHERIT_ACE 0x01
4161 #define CONTAINER_INHERIT_ACE 0x02
4162 #define NO_PROPAGATE_INHERIT_ACE 0x04
4163 #define INHERIT_ONLY_ACE 0x08
4164 #define INHERITED_ACE 0x10
4165 #define VALID_INHERIT_FLAGS 0x1F
4167 /* AceFlags mask for what events we (should) audit */
4168 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4169 #define FAILED_ACCESS_ACE_FLAG 0x80
4171 /* different ACEs depending on AceType
4172 * SidStart marks the begin of a SID
4173 * so the thing finally looks like this:
4178 typedef struct _ACCESS_ALLOWED_ACE
{
4182 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4184 typedef struct _ACCESS_DENIED_ACE
{
4188 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4190 typedef struct _SYSTEM_AUDIT_ACE
{
4194 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4196 typedef struct _SYSTEM_ALARM_ACE
{
4200 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4202 typedef enum tagSID_NAME_USE
{
4207 SidTypeWellKnownGroup
,
4208 SidTypeDeletedAccount
,
4211 } SID_NAME_USE
,*PSID_NAME_USE
;
4213 #define ACE_OBJECT_TYPE_PRESENT 0x1
4214 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4218 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4220 #define DELETE 0x00010000
4221 #define READ_CONTROL 0x00020000
4222 #define WRITE_DAC 0x00040000
4223 #define WRITE_OWNER 0x00080000
4224 #define SYNCHRONIZE 0x00100000
4225 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4227 #define STANDARD_RIGHTS_READ READ_CONTROL
4228 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4229 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4231 #define STANDARD_RIGHTS_ALL 0x001f0000
4233 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4235 #define GENERIC_READ 0x80000000
4236 #define GENERIC_WRITE 0x40000000
4237 #define GENERIC_EXECUTE 0x20000000
4238 #define GENERIC_ALL 0x10000000
4240 #define MAXIMUM_ALLOWED 0x02000000
4241 #define ACCESS_SYSTEM_SECURITY 0x01000000
4243 #define EVENT_QUERY_STATE 0x0001
4244 #define EVENT_MODIFY_STATE 0x0002
4245 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4247 #define SEMAPHORE_MODIFY_STATE 0x0002
4248 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4250 #define MUTEX_MODIFY_STATE 0x0001
4251 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4253 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4254 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4255 #define JOB_OBJECT_QUERY 0x0004
4256 #define JOB_OBJECT_TERMINATE 0x0008
4257 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4258 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4260 #define TIMER_QUERY_STATE 0x0001
4261 #define TIMER_MODIFY_STATE 0x0002
4262 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4264 #define PROCESS_TERMINATE 0x0001
4265 #define PROCESS_CREATE_THREAD 0x0002
4266 #define PROCESS_VM_OPERATION 0x0008
4267 #define PROCESS_VM_READ 0x0010
4268 #define PROCESS_VM_WRITE 0x0020
4269 #define PROCESS_DUP_HANDLE 0x0040
4270 #define PROCESS_CREATE_PROCESS 0x0080
4271 #define PROCESS_SET_QUOTA 0x0100
4272 #define PROCESS_SET_INFORMATION 0x0200
4273 #define PROCESS_QUERY_INFORMATION 0x0400
4274 #define PROCESS_SUSPEND_RESUME 0x0800
4275 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4276 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4278 #define THREAD_TERMINATE 0x0001
4279 #define THREAD_SUSPEND_RESUME 0x0002
4280 #define THREAD_GET_CONTEXT 0x0008
4281 #define THREAD_SET_CONTEXT 0x0010
4282 #define THREAD_SET_INFORMATION 0x0020
4283 #define THREAD_QUERY_INFORMATION 0x0040
4284 #define THREAD_SET_THREAD_TOKEN 0x0080
4285 #define THREAD_IMPERSONATE 0x0100
4286 #define THREAD_DIRECT_IMPERSONATION 0x0200
4287 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4289 #define THREAD_BASE_PRIORITY_LOWRT 15
4290 #define THREAD_BASE_PRIORITY_MAX 2
4291 #define THREAD_BASE_PRIORITY_MIN -2
4292 #define THREAD_BASE_PRIORITY_IDLE -15
4294 typedef struct _QUOTA_LIMITS
{
4295 SIZE_T PagedPoolLimit
;
4296 SIZE_T NonPagedPoolLimit
;
4297 SIZE_T MinimumWorkingSetSize
;
4298 SIZE_T MaximumWorkingSetSize
;
4299 SIZE_T PagefileLimit
;
4300 LARGE_INTEGER TimeLimit
;
4301 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
4303 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4304 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4305 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4306 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4308 typedef struct _QUOTA_LIMITS_EX
{
4309 SIZE_T PagedPoolLimit
;
4310 SIZE_T NonPagedPoolLimit
;
4311 SIZE_T MinimumWorkingSetSize
;
4312 SIZE_T MaximumWorkingSetSize
;
4313 SIZE_T PagefileLimit
;
4314 LARGE_INTEGER TimeLimit
;
4321 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
4323 #define SECTION_QUERY 0x0001
4324 #define SECTION_MAP_WRITE 0x0002
4325 #define SECTION_MAP_READ 0x0004
4326 #define SECTION_MAP_EXECUTE 0x0008
4327 #define SECTION_EXTEND_SIZE 0x0010
4328 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4329 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4331 #define FILE_READ_DATA 0x0001 /* file & pipe */
4332 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4333 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4334 #define FILE_ADD_FILE 0x0002 /* directory */
4335 #define FILE_APPEND_DATA 0x0004 /* file */
4336 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4337 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4338 #define FILE_READ_EA 0x0008 /* file & directory */
4339 #define FILE_READ_PROPERTIES FILE_READ_EA
4340 #define FILE_WRITE_EA 0x0010 /* file & directory */
4341 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4342 #define FILE_EXECUTE 0x0020 /* file */
4343 #define FILE_TRAVERSE 0x0020 /* directory */
4344 #define FILE_DELETE_CHILD 0x0040 /* directory */
4345 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4346 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4347 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4349 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4350 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4352 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4353 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4354 FILE_APPEND_DATA | SYNCHRONIZE)
4355 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4356 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4358 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4359 #define DUPLICATE_SAME_ACCESS 0x00000002
4361 /* File attribute flags */
4362 #define FILE_SHARE_READ 0x00000001
4363 #define FILE_SHARE_WRITE 0x00000002
4364 #define FILE_SHARE_DELETE 0x00000004
4366 #define FILE_ATTRIBUTE_READONLY 0x00000001
4367 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4368 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4369 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4370 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4371 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4372 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4373 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4374 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4375 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4376 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4377 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4378 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4379 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4381 /* File notification flags */
4382 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4383 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4384 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4385 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4386 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4387 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4388 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4389 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4390 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4391 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4392 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4393 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4395 #define FILE_ACTION_ADDED 0x00000001
4396 #define FILE_ACTION_REMOVED 0x00000002
4397 #define FILE_ACTION_MODIFIED 0x00000003
4398 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4399 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4400 #define FILE_ACTION_ADDED_STREAM 0x00000006
4401 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4402 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4404 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4405 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4406 #define FILE_UNICODE_ON_DISK 0x00000004
4407 #define FILE_PERSISTENT_ACLS 0x00000008
4408 #define FILE_FILE_COMPRESSION 0x00000010
4409 #define FILE_VOLUME_QUOTAS 0x00000020
4410 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
4411 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
4412 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4413 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4414 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4415 #define FILE_NAMED_STREAMS 0x00040000
4416 #define FILE_READ_ONLY_VOLUME 0x00080000
4418 /* File alignments (NT) */
4419 #define FILE_BYTE_ALIGNMENT 0x00000000
4420 #define FILE_WORD_ALIGNMENT 0x00000001
4421 #define FILE_LONG_ALIGNMENT 0x00000003
4422 #define FILE_QUAD_ALIGNMENT 0x00000007
4423 #define FILE_OCTA_ALIGNMENT 0x0000000f
4424 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4425 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4426 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4427 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4428 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4430 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4431 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4433 #define REG_NONE 0 /* no type */
4434 #define REG_SZ 1 /* string type (ASCII) */
4435 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4436 #define REG_BINARY 3 /* binary format, callerspecific */
4437 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4438 #define REG_DWORD 4 /* DWORD in little endian format */
4439 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4440 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4441 #define REG_LINK 6 /* symbolic link (UNICODE) */
4442 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4443 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4444 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4445 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4446 #define REG_QWORD 11 /* QWORD in little endian format */
4447 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4449 /* ----------------------------- begin power management --------------------- */
4451 typedef enum _LATENCY_TIME
{
4454 } LATENCY_TIME
, *PLATENCY_TIME
;
4456 #define DISCHARGE_POLICY_CRITICAL 0
4457 #define DISCHARGE_POLICY_LOW 1
4458 #define NUM_DISCHARGE_POLICIES 4
4460 #define PO_THROTTLE_NONE 0
4461 #define PO_THROTTLE_CONSTANT 1
4462 #define PO_THROTTLE_DEGRADE 2
4463 #define PO_THROTTLE_ADAPTIVE 3
4465 typedef enum _POWER_ACTION
{
4466 PowerActionNone
= 0,
4467 PowerActionReserved
,
4469 PowerActionHibernate
,
4470 PowerActionShutdown
,
4471 PowerActionShutdownReset
,
4472 PowerActionShutdownOff
,
4473 PowerActionWarmEject
4477 typedef enum _SYSTEM_POWER_STATE
{
4478 PowerSystemUnspecified
= 0,
4479 PowerSystemWorking
= 1,
4480 PowerSystemSleeping1
= 2,
4481 PowerSystemSleeping2
= 3,
4482 PowerSystemSleeping3
= 4,
4483 PowerSystemHibernate
= 5,
4484 PowerSystemShutdown
= 6,
4485 PowerSystemMaximum
= 7
4486 } SYSTEM_POWER_STATE
,
4487 *PSYSTEM_POWER_STATE
;
4489 typedef enum _DEVICE_POWER_STATE
{
4490 PowerDeviceUnspecified
,
4496 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
4498 typedef enum _POWER_INFORMATION_LEVEL
{
4499 SystemPowerPolicyAc
,
4500 SystemPowerPolicyDc
,
4501 VerifySystemPolicyAc
,
4502 VerifySystemPolicyDc
,
4503 SystemPowerCapabilities
,
4505 SystemPowerStateHandler
,
4506 ProcessorStateHandler
,
4507 SystemPowerPolicyCurrent
,
4508 AdministratorPowerPolicy
,
4509 SystemReserveHiberFile
,
4510 ProcessorInformation
,
4511 SystemPowerInformation
,
4512 ProcessorStateHandler2
,
4515 SystemExecutionState
,
4516 SystemPowerStateNotifyHandler
,
4517 ProcessorPowerPolicyAc
,
4518 ProcessorPowerPolicyDc
,
4519 VerifyProcessorPowerPolicyAc
,
4520 VerifyProcessorPowerPolicyDc
,
4521 ProcessorPowerPolicyCurrent
4522 } POWER_INFORMATION_LEVEL
;
4524 typedef struct _ADMINISTRATOR_POWER_POLICY
{
4525 SYSTEM_POWER_STATE MinSleep
;
4526 SYSTEM_POWER_STATE MaxSleep
;
4527 ULONG MinVideoTimeout
;
4528 ULONG MaxVideoTimeout
;
4529 ULONG MinSpindownTimeout
;
4530 ULONG MaxSpindownTimeout
;
4531 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
4536 } BATTERY_REPORTING_SCALE
,
4537 *PBATTERY_REPORTING_SCALE
;
4540 POWER_ACTION Action
;
4543 } POWER_ACTION_POLICY
,
4544 *PPOWER_ACTION_POLICY
;
4546 typedef struct _PROCESSOR_POWER_INFORMATION
{
4552 ULONG CurrentIdleState
;
4553 } PROCESSOR_POWER_INFORMATION
,
4554 *PPROCESSOR_POWER_INFORMATION
;
4556 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
4560 UCHAR DemotePercent
;
4561 UCHAR PromotePercent
;
4563 ULONG AllowDemotion
:1;
4564 ULONG AllowPromotion
:1;
4566 } PROCESSOR_POWER_POLICY_INFO
,
4567 *PPROCESSOR_POWER_POLICY_INFO
;
4569 typedef struct _PROCESSOR_POWER_POLICY
{
4571 BYTE DynamicThrottle
;
4573 DWORD DisableCStates
:1;
4576 PROCESSOR_POWER_POLICY_INFO Policy
[3];
4577 } PROCESSOR_POWER_POLICY
,
4578 *PPROCESSOR_POWER_POLICY
;
4582 BOOLEAN BatteryPresent
;
4584 BOOLEAN Discharging
;
4587 ULONG RemainingCapacity
;
4589 ULONG EstimatedTime
;
4590 ULONG DefaultAlert1
;
4591 ULONG DefaultAlert2
;
4592 } SYSTEM_BATTERY_STATE
,
4593 *PSYSTEM_BATTERY_STATE
;
4596 BOOLEAN PowerButtonPresent
;
4597 BOOLEAN SleepButtonPresent
;
4604 BOOLEAN HiberFilePresent
;
4606 BOOLEAN VideoDimPresent
;
4609 BOOLEAN ThermalControl
;
4610 BOOLEAN ProcessorThrottle
;
4611 UCHAR ProcessorMinThrottle
;
4612 UCHAR ProcessorMaxThrottle
;
4614 BOOLEAN DiskSpinDown
;
4616 BOOLEAN SystemBatteriesPresent
;
4617 BOOLEAN BatteriesAreShortTerm
;
4618 BATTERY_REPORTING_SCALE BatteryScale
[3];
4619 SYSTEM_POWER_STATE AcOnLineWake
;
4620 SYSTEM_POWER_STATE SoftLidWake
;
4621 SYSTEM_POWER_STATE RtcWake
;
4622 SYSTEM_POWER_STATE MinDeviceWakeState
;
4623 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
4624 } SYSTEM_POWER_CAPABILITIES
,
4625 *PSYSTEM_POWER_CAPABILITIES
;
4627 typedef struct _SYSTEM_POWER_INFORMATION
{
4628 ULONG MaxIdlenessAllowed
;
4630 ULONG TimeRemaining
;
4632 } SYSTEM_POWER_INFORMATION
,
4633 *PSYSTEM_POWER_INFORMATION
;
4635 typedef struct _SYSTEM_POWER_LEVEL
{
4639 POWER_ACTION_POLICY PowerPolicy
;
4640 SYSTEM_POWER_STATE MinSystemState
;
4641 } SYSTEM_POWER_LEVEL
,
4642 *PSYSTEM_POWER_LEVEL
;
4644 typedef struct _SYSTEM_POWER_POLICY
{
4646 POWER_ACTION_POLICY PowerButton
;
4647 POWER_ACTION_POLICY SleepButton
;
4648 POWER_ACTION_POLICY LidClose
;
4649 SYSTEM_POWER_STATE LidOpenWake
;
4651 POWER_ACTION_POLICY Idle
;
4653 UCHAR IdleSensitivity
;
4654 UCHAR DynamicThrottle
;
4656 SYSTEM_POWER_STATE MinSleep
;
4657 SYSTEM_POWER_STATE MaxSleep
;
4658 SYSTEM_POWER_STATE ReducedLatencySleep
;
4659 ULONG WinLogonFlags
;
4661 ULONG DozeS4Timeout
;
4662 ULONG BroadcastCapacityResolution
;
4663 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
4665 BOOLEAN VideoDimDisplay
;
4666 ULONG VideoReserved
[3];
4667 ULONG SpindownTimeout
;
4668 BOOLEAN OptimizeForPower
;
4669 UCHAR FanThrottleTolerance
;
4670 UCHAR ForcedThrottle
;
4672 POWER_ACTION_POLICY OverThrottled
;
4673 } SYSTEM_POWER_POLICY
,
4674 *PSYSTEM_POWER_POLICY
;
4676 typedef union _FILE_SEGMENT_ELEMENT
{
4678 ULONGLONG Alignment
;
4679 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
4681 typedef struct _FILE_NOTIFY_INFORMATION
{
4682 DWORD NextEntryOffset
;
4684 DWORD FileNameLength
;
4686 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
4688 /* ----------------------------- begin tape storage --------------------- */
4690 #define TAPE_FIXED_PARTITIONS 0
4691 #define TAPE_SELECT_PARTITIONS 1
4692 #define TAPE_INITIATOR_PARTITIONS 2
4693 #define TAPE_ERASE_SHORT 0
4694 #define TAPE_ERASE_LONG 1
4696 #define TAPE_UNLOAD 1
4697 #define TAPE_TENSION 2
4699 #define TAPE_UNLOCK 4
4700 #define TAPE_FORMAT 5
4701 #define TAPE_SETMARKS 0
4702 #define TAPE_FILEMARKS 1
4703 #define TAPE_SHORT_FILEMARKS 2
4704 #define TAPE_LONG_FILEMARKS 3
4705 #define TAPE_REWIND 0
4706 #define TAPE_ABSOLUTE_BLOCK 1
4707 #define TAPE_LOGICAL_BLOCK 2
4708 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4709 #define TAPE_SPACE_END_OF_DATA 4
4710 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4711 #define TAPE_SPACE_FILEMARKS 6
4712 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4713 #define TAPE_SPACE_SETMARKS 8
4714 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4716 typedef struct _TAPE_CREATE_PARTITION
{
4720 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
4722 typedef struct _TAPE_ERASE
{
4725 } TAPE_ERASE
, *PTAPE_ERASE
;
4727 typedef struct _TAPE_PREPARE
{
4730 } TAPE_PREPARE
, *PTAPE_PREPARE
;
4732 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
4734 BOOLEAN Compression
;
4735 BOOLEAN DataPadding
;
4736 BOOLEAN ReportSetmarks
;
4737 ULONG EOTWarningZoneSize
;
4738 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
4740 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
4742 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
4744 typedef struct _TAPE_WRITE_MARKS
{
4748 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
4750 typedef struct _TAPE_GET_POSITION
{
4755 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
4757 typedef struct _TAPE_SET_POSITION
{
4760 LARGE_INTEGER Offset
;
4762 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
4764 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
4766 BOOLEAN Compression
;
4767 BOOLEAN DataPadding
;
4768 BOOLEAN ReportSetmarks
;
4769 DWORD DefaultBlockSize
;
4770 DWORD MaximumBlockSize
;
4771 DWORD MinimumBlockSize
;
4772 DWORD MaximumPartitionCount
;
4775 DWORD EOTWarningZoneSize
;
4776 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
4778 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
4779 LARGE_INTEGER Capacity
;
4780 LARGE_INTEGER Remaining
;
4782 DWORD PartitionCount
;
4783 BOOLEAN WriteProtected
;
4784 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
4786 /* ----------------------------- begin registry ----------------------------- */
4788 /* Registry security values */
4789 #define OWNER_SECURITY_INFORMATION 0x00000001
4790 #define GROUP_SECURITY_INFORMATION 0x00000002
4791 #define DACL_SECURITY_INFORMATION 0x00000004
4792 #define SACL_SECURITY_INFORMATION 0x00000008
4794 #define REG_OPTION_RESERVED 0x00000000
4795 #define REG_OPTION_NON_VOLATILE 0x00000000
4796 #define REG_OPTION_VOLATILE 0x00000001
4797 #define REG_OPTION_CREATE_LINK 0x00000002
4798 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4799 #define REG_OPTION_OPEN_LINK 0x00000008
4800 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4801 REG_OPTION_NON_VOLATILE| \
4802 REG_OPTION_VOLATILE| \
4803 REG_OPTION_CREATE_LINK| \
4804 REG_OPTION_BACKUP_RESTORE| \
4805 REG_OPTION_OPEN_LINK)
4808 #define REG_CREATED_NEW_KEY 0x00000001
4809 #define REG_OPENED_EXISTING_KEY 0x00000002
4811 /* For RegNotifyChangeKeyValue */
4812 #define REG_NOTIFY_CHANGE_NAME 0x01
4813 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4814 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4815 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4817 #define KEY_QUERY_VALUE 0x00000001
4818 #define KEY_SET_VALUE 0x00000002
4819 #define KEY_CREATE_SUB_KEY 0x00000004
4820 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4821 #define KEY_NOTIFY 0x00000010
4822 #define KEY_CREATE_LINK 0x00000020
4823 #define KEY_WOW64_64KEY 0x00000100
4824 #define KEY_WOW64_32KEY 0x00000200
4825 #define KEY_WOW64_RES 0x00000300
4827 /* for RegKeyRestore flags */
4828 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4829 #define REG_REFRESH_HIVE 0x00000002
4830 #define REG_NO_LAZY_FLUSH 0x00000004
4831 #define REG_FORCE_RESTORE 0x00000008
4833 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4835 KEY_ENUMERATE_SUB_KEYS| \
4839 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4841 KEY_CREATE_SUB_KEY) \
4844 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4845 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4848 KEY_CREATE_SUB_KEY| \
4849 KEY_ENUMERATE_SUB_KEYS| \
4854 /* ------------------------------ end registry ------------------------------ */
4857 #define EVENTLOG_SUCCESS 0x0000
4858 #define EVENTLOG_ERROR_TYPE 0x0001
4859 #define EVENTLOG_WARNING_TYPE 0x0002
4860 #define EVENTLOG_INFORMATION_TYPE 0x0004
4861 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4862 #define EVENTLOG_AUDIT_FAILURE 0x0010
4864 #define EVENTLOG_SEQUENTIAL_READ 0x0001
4865 #define EVENTLOG_SEEK_READ 0x0002
4866 #define EVENTLOG_FORWARDS_READ 0x0004
4867 #define EVENTLOG_BACKWARDS_READ 0x0008
4869 typedef struct _EVENTLOGRECORD
{
4873 DWORD TimeGenerated
;
4880 DWORD ClosingRecordNumber
;
4882 DWORD UserSidLength
;
4883 DWORD UserSidOffset
;
4886 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
4888 #define SERVICE_BOOT_START 0x00000000
4889 #define SERVICE_SYSTEM_START 0x00000001
4890 #define SERVICE_AUTO_START 0x00000002
4891 #define SERVICE_DEMAND_START 0x00000003
4892 #define SERVICE_DISABLED 0x00000004
4894 #define SERVICE_ERROR_IGNORE 0x00000000
4895 #define SERVICE_ERROR_NORMAL 0x00000001
4896 #define SERVICE_ERROR_SEVERE 0x00000002
4897 #define SERVICE_ERROR_CRITICAL 0x00000003
4900 #define SERVICE_KERNEL_DRIVER 0x00000001
4901 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4902 #define SERVICE_ADAPTER 0x00000004
4903 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4905 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4906 SERVICE_RECOGNIZER_DRIVER )
4908 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4909 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4910 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4912 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4914 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4915 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4918 typedef enum _CM_SERVICE_NODE_TYPE
4920 DriverType
= SERVICE_KERNEL_DRIVER
,
4921 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
4922 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
4923 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
4924 AdapterType
= SERVICE_ADAPTER
,
4925 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
4926 } SERVICE_NODE_TYPE
;
4928 typedef enum _CM_SERVICE_LOAD_TYPE
4930 BootLoad
= SERVICE_BOOT_START
,
4931 SystemLoad
= SERVICE_SYSTEM_START
,
4932 AutoLoad
= SERVICE_AUTO_START
,
4933 DemandLoad
= SERVICE_DEMAND_START
,
4934 DisableLoad
= SERVICE_DISABLED
4935 } SERVICE_LOAD_TYPE
;
4937 typedef enum _CM_ERROR_CONTROL_TYPE
4939 IgnoreError
= SERVICE_ERROR_IGNORE
,
4940 NormalError
= SERVICE_ERROR_NORMAL
,
4941 SevereError
= SERVICE_ERROR_SEVERE
,
4942 CriticalError
= SERVICE_ERROR_CRITICAL
4943 } SERVICE_ERROR_TYPE
;
4947 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4948 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4949 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4950 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4951 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4953 #include <guiddef.h>
4955 typedef struct _OBJECT_TYPE_LIST
{
4959 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
4961 typedef struct _RTL_CRITICAL_SECTION_DEBUG
4964 WORD CreatorBackTraceIndex
;
4965 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
4966 LIST_ENTRY ProcessLocksList
;
4968 DWORD ContentionCount
;
4969 #ifdef __WINESRC__ /* in Wine we store the name here */
4970 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
4974 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
4976 typedef struct _RTL_CRITICAL_SECTION
{
4977 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
4979 LONG RecursionCount
;
4980 HANDLE OwningThread
;
4981 HANDLE LockSemaphore
;
4982 ULONG_PTR SpinCount
;
4983 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
4985 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
4986 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
4987 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
4988 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
4989 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
4991 typedef struct _RTL_SRWLOCK
{
4993 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
4995 #define RTL_SRWLOCK_INIT {0}
4997 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
4998 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5000 #include <pshpack8.h>
5001 typedef struct _IO_COUNTERS
{
5002 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5003 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5004 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5005 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5006 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5007 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5008 } IO_COUNTERS
, *PIO_COUNTERS
;
5009 #include <poppack.h>
5012 DWORD dwOSVersionInfoSize
;
5013 DWORD dwMajorVersion
;
5014 DWORD dwMinorVersion
;
5015 DWORD dwBuildNumber
;
5017 CHAR szCSDVersion
[128];
5018 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5021 DWORD dwOSVersionInfoSize
;
5022 DWORD dwMajorVersion
;
5023 DWORD dwMinorVersion
;
5024 DWORD dwBuildNumber
;
5026 WCHAR szCSDVersion
[128];
5027 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5029 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5030 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5031 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5034 DWORD dwOSVersionInfoSize
;
5035 DWORD dwMajorVersion
;
5036 DWORD dwMinorVersion
;
5037 DWORD dwBuildNumber
;
5039 CHAR szCSDVersion
[128];
5040 WORD wServicePackMajor
;
5041 WORD wServicePackMinor
;
5045 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5048 DWORD dwOSVersionInfoSize
;
5049 DWORD dwMajorVersion
;
5050 DWORD dwMinorVersion
;
5051 DWORD dwBuildNumber
;
5053 WCHAR szCSDVersion
[128];
5054 WORD wServicePackMajor
;
5055 WORD wServicePackMinor
;
5059 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5061 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5062 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5063 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5065 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5067 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5069 #define VER_PLATFORM_WIN32s 0
5070 #define VER_PLATFORM_WIN32_WINDOWS 1
5071 #define VER_PLATFORM_WIN32_NT 2
5073 #define VER_MINORVERSION 0x00000001
5074 #define VER_MAJORVERSION 0x00000002
5075 #define VER_BUILDNUMBER 0x00000004
5076 #define VER_PLATFORMID 0x00000008
5077 #define VER_SERVICEPACKMINOR 0x00000010
5078 #define VER_SERVICEPACKMAJOR 0x00000020
5079 #define VER_SUITENAME 0x00000040
5080 #define VER_PRODUCT_TYPE 0x00000080
5082 #define VER_NT_WORKSTATION 1
5083 #define VER_NT_DOMAIN_CONTROLLER 2
5084 #define VER_NT_SERVER 3
5086 #define VER_SUITE_SMALLBUSINESS 0x00000001
5087 #define VER_SUITE_ENTERPRISE 0x00000002
5088 #define VER_SUITE_BACKOFFICE 0x00000004
5089 #define VER_SUITE_COMMUNICATIONS 0x00000008
5090 #define VER_SUITE_TERMINAL 0x00000010
5091 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5092 #define VER_SUITE_EMBEDDEDNT 0x00000040
5093 #define VER_SUITE_DATACENTER 0x00000080
5094 #define VER_SUITE_SINGLEUSERTS 0x00000100
5095 #define VER_SUITE_PERSONAL 0x00000200
5096 #define VER_SUITE_BLADE 0x00000400
5097 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5098 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5099 #define VER_SUITE_STORAGE_SERVER 0x00002000
5100 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5101 #define VER_SUITE_WH_SERVER 0x00008000
5104 #define VER_GREATER 2
5105 #define VER_GREATER_EQUAL 3
5107 #define VER_LESS_EQUAL 5
5111 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5113 DWORD ulFormatVersion
;
5114 DWORD ulAssemblyCount
;
5115 DWORD ulRootManifestPathType
;
5116 DWORD ulRootManifestPathChars
;
5117 DWORD ulRootConfigurationPathType
;
5118 DWORD ulRootConfigurationPathChars
;
5119 DWORD ulAppDirPathType
;
5120 DWORD ulAppDirPathChars
;
5121 PCWSTR lpRootManifestPath
;
5122 PCWSTR lpRootConfigurationPath
;
5123 PCWSTR lpAppDirPath
;
5124 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5126 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5128 DWORD ulEncodedAssemblyIdentityLength
;
5129 DWORD ulManifestPathType
;
5130 DWORD ulManifestPathLength
;
5131 LARGE_INTEGER liManifestLastWriteTime
;
5132 DWORD ulPolicyPathType
;
5133 DWORD ulPolicyPathLength
;
5134 LARGE_INTEGER liPolicyLastWriteTime
;
5135 DWORD ulMetadataSatelliteRosterIndex
;
5136 DWORD ulManifestVersionMajor
;
5137 DWORD ulManifestVersionMinor
;
5138 DWORD ulPolicyVersionMajor
;
5139 DWORD ulPolicyVersionMinor
;
5140 DWORD ulAssemblyDirectoryNameLength
;
5141 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
5142 PCWSTR lpAssemblyManifestPath
;
5143 PCWSTR lpAssemblyPolicyPath
;
5144 PCWSTR lpAssemblyDirectoryName
;
5146 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
5148 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
5149 DWORD ulAssemblyIndex
;
5150 DWORD ulFileIndexInAssembly
;
5151 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
5153 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
5155 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
5157 DWORD ulFilenameLength
;
5161 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
5163 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
5165 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
5166 ActivationContextBasicInformation
= 1,
5167 ActivationContextDetailedInformation
= 2,
5168 AssemblyDetailedInformationInActivationContext
= 3,
5169 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
5170 MaxActivationContextInfoClass
,
5172 AssemblyDetailedInformationInActivationContxt
= 3,
5173 FileInformationInAssemblyOfAssemblyInActivationContxt
= 4
5174 } ACTIVATION_CONTEXT_INFO_CLASS
;
5176 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5177 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5178 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5179 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5181 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5182 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5183 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5184 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5185 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5186 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5187 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5188 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5189 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5191 typedef enum _JOBOBJECTINFOCLASS
5193 JobObjectBasicAccountingInformation
= 1,
5194 JobObjectBasicLimitInformation
,
5195 JobObjectBasicProcessIdList
,
5196 JobObjectBasicUIRestrictions
,
5197 JobObjectSecurityLimitInformation
,
5198 JobObjectEndOfJobTimeInformation
,
5199 JobObjectAssociateCompletionPortInformation
,
5200 JobObjectBasicAndIoAccountingInformation
,
5201 JobObjectExtendedLimitInformation
,
5202 JobObjectJobSetInformation
,
5203 MaxJobObjectInfoClass
5204 } JOBOBJECTINFOCLASS
;
5206 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5208 RelationProcessorCore
= 0,
5209 RelationNumaNode
= 1,
5211 RelationProcessorPackage
= 3,
5213 RelationAll
= 0xffff
5214 } LOGICAL_PROCESSOR_RELATIONSHIP
;
5216 typedef enum _PROCESSOR_CACHE_TYPE
5222 } PROCESSOR_CACHE_TYPE
;
5224 typedef struct _PROCESSOR_GROUP_INFO
5226 BYTE MaximumProcessorCount
;
5227 BYTE ActiveProcessorCount
;
5229 KAFFINITY ActiveProcessorMask
;
5230 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
5232 typedef struct _CACHE_DESCRIPTOR
5238 PROCESSOR_CACHE_TYPE Type
;
5239 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
5241 typedef struct _GROUP_AFFINITY
5246 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
5248 typedef struct _PROCESSOR_RELATIONSHIP
5253 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
5254 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
5257 typedef struct _NUMA_NODE_RELATIONSHIP
5261 GROUP_AFFINITY GroupMask
;
5262 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
5264 typedef struct _CACHE_RELATIONSHIP
5269 PROCESSOR_CACHE_TYPE Type
;
5271 GROUP_AFFINITY GroupMask
;
5272 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
5274 typedef struct _GROUP_RELATIONSHIP
5276 WORD MaximumGroupCount
;
5277 WORD ActiveGroupCount
;
5279 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
5280 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
5282 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5284 ULONG_PTR ProcessorMask
;
5285 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5296 CACHE_DESCRIPTOR Cache
;
5297 ULONGLONG Reserved
[2];
5299 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
5301 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5303 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5307 PROCESSOR_RELATIONSHIP Processor
;
5308 NUMA_NODE_RELATIONSHIP NumaNode
;
5309 CACHE_RELATIONSHIP Cache
;
5310 GROUP_RELATIONSHIP Group
;
5312 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
5314 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
5320 #endif /* _WINNT_ */