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 __attribute__((always_inline))
128 # define FORCEINLINE inline
132 #ifndef DECLSPEC_DEPRECATED
133 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
134 # define DECLSPEC_DEPRECATED __declspec(deprecated)
135 # define DEPRECATE_SUPPORTED
136 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
137 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
138 # define DEPRECATE_SUPPORTED
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
145 /* a couple of useful Wine extensions */
148 # define DECLSPEC_EXPORT __declspec(dllexport)
149 #elif defined(__MINGW32__)
150 # define DECLSPEC_EXPORT __attribute__((dllexport))
151 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
152 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
154 # define DECLSPEC_EXPORT
157 #if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
158 # define DECLSPEC_HIDDEN
159 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
160 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
162 # define DECLSPEC_HIDDEN
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
168 #define __WINE_ALLOC_SIZE(x)
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
175 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
176 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
177 # define NONAMELESSSTRUCT
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
186 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
187 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
188 # define NONAMELESSUNION
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
193 #endif /* NONAMELESSUNION */
195 #ifndef NONAMELESSSTRUCT
196 #define DUMMYSTRUCTNAME
197 #define DUMMYSTRUCTNAME1
198 #define DUMMYSTRUCTNAME2
199 #define DUMMYSTRUCTNAME3
200 #define DUMMYSTRUCTNAME4
201 #define DUMMYSTRUCTNAME5
202 #else /* !defined(NONAMELESSSTRUCT) */
203 #define DUMMYSTRUCTNAME s
204 #define DUMMYSTRUCTNAME1 s1
205 #define DUMMYSTRUCTNAME2 s2
206 #define DUMMYSTRUCTNAME3 s3
207 #define DUMMYSTRUCTNAME4 s4
208 #define DUMMYSTRUCTNAME5 s5
209 #endif /* !defined(NONAMELESSSTRUCT) */
211 #ifndef NONAMELESSUNION
212 #define DUMMYUNIONNAME
213 #define DUMMYUNIONNAME1
214 #define DUMMYUNIONNAME2
215 #define DUMMYUNIONNAME3
216 #define DUMMYUNIONNAME4
217 #define DUMMYUNIONNAME5
218 #define DUMMYUNIONNAME6
219 #define DUMMYUNIONNAME7
220 #define DUMMYUNIONNAME8
221 #else /* !defined(NONAMELESSUNION) */
222 #define DUMMYUNIONNAME u
223 #define DUMMYUNIONNAME1 u1
224 #define DUMMYUNIONNAME2 u2
225 #define DUMMYUNIONNAME3 u3
226 #define DUMMYUNIONNAME4 u4
227 #define DUMMYUNIONNAME5 u5
228 #define DUMMYUNIONNAME6 u6
229 #define DUMMYUNIONNAME7 u7
230 #define DUMMYUNIONNAME8 u8
231 #endif /* !defined(NONAMELESSUNION) */
233 /* C99 restrict support */
235 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
236 # if defined(_MSC_VER) && defined(_M_MRX000)
237 # define RESTRICTED_POINTER __restrict
238 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
239 # define RESTRICTED_POINTER __restrict
241 # define RESTRICTED_POINTER
244 # define RESTRICTED_POINTER
247 /* C99 unaligned support */
250 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
251 # define UNALIGNED __unaligned
253 # define UNALIGNED64 __unaligned
263 /* Alignment macros */
265 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
266 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
267 #define MEMORY_ALLOCATION_ALIGNMENT 16
269 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
270 #define MEMORY_ALLOCATION_ALIGNMENT 8
273 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
274 # define TYPE_ALIGNMENT(t) __alignof(t)
275 #elif defined(__GNUC__)
276 # define TYPE_ALIGNMENT(t) __alignof__(t)
278 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
282 # define PROBE_ALIGNMENT(_s) \
283 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
284 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
285 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
287 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
290 /* Compile time assertion */
292 #if defined(_MSC_VER)
293 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
295 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
298 /* Eliminate Microsoft C/C++ compiler warning 4715 */
299 #if (_MSC_VER > 1200)
300 # define DEFAULT_UNREACHABLE default: __assume(0)
302 # define DEFAULT_UNREACHABLE
306 #define APPLICATION_ERROR_MASK 0x20000000
307 #define ERROR_SEVERITY_SUCCESS 0x00000000
308 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
309 #define ERROR_SEVERITY_WARNING 0x80000000
310 #define ERROR_SEVERITY_ERROR 0xC0000000
312 /* Microsoft's macros for declaring functions */
315 # define EXTERN_C extern "C"
317 # define EXTERN_C extern
320 #define STDMETHODCALLTYPE __stdcall
321 #define STDMETHODVCALLTYPE __cdecl
322 #define STDAPICALLTYPE __stdcall
323 #define STDAPIVCALLTYPE __cdecl
325 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
326 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
327 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
328 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
329 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
330 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
331 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
332 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
334 /* Define the basic types */
339 typedef VOID
*PVOID64
;
340 typedef BYTE BOOLEAN
, *PBOOLEAN
;
341 typedef char CHAR
, *PCHAR
;
342 typedef short SHORT
, *PSHORT
;
344 typedef long LONG
, *PLONG
;
346 typedef int LONG
, *PLONG
;
349 /* Some systems might have wchar_t, but we really need 16 bit characters */
350 #ifdef WINE_UNICODE_NATIVE
351 typedef wchar_t WCHAR
, *PWCHAR
;
353 typedef unsigned short WCHAR
, *PWCHAR
;
356 /* 'Extended/Wide' numerical types */
360 typedef signed __int64 LONGLONG
, *PLONGLONG
;
361 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
363 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
364 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
371 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
373 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
377 /* ANSI string types */
378 typedef CHAR
*PCH
, *LPCH
;
379 typedef const CHAR
*PCCH
, *LPCCH
;
380 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
381 typedef const CHAR
*PCSTR
, *LPCSTR
;
383 /* Unicode string types */
384 typedef WCHAR
*PWCH
, *LPWCH
;
385 typedef const WCHAR
*PCWCH
, *LPCWCH
;
386 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
387 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
389 /* Neutral character and string types */
390 /* These are only defined for Winelib, i.e. _not_ defined for
391 * the emulator. The reason is they depend on the UNICODE
392 * macro which only exists in the user's code.
394 #ifndef WINE_NO_UNICODE_MACROS
396 # ifndef _TCHAR_DEFINED
397 typedef WCHAR TCHAR
, *PTCHAR
;
398 # define _TCHAR_DEFINED
400 typedef LPWSTR PTSTR
, LPTSTR
;
401 typedef LPCWSTR PCTSTR
, LPCTSTR
;
402 # define __TEXT(string) L##string
404 # ifndef _TCHAR_DEFINED
405 typedef CHAR TCHAR
, *PTCHAR
;
406 # define _TCHAR_DEFINED
408 typedef LPSTR PTSTR
, LPTSTR
;
409 typedef LPCSTR PCTSTR
, LPCTSTR
;
410 # define __TEXT(string) string
411 # endif /* UNICODE */
412 # define TEXT(quote) __TEXT(quote)
413 #endif /* WINE_NO_UNICODE_MACROS */
415 /* Misc common WIN32 types */
417 typedef DWORD LCID
, *PLCID
;
419 typedef DWORD EXECUTION_STATE
;
420 #ifndef _HRESULT_DEFINED
421 #define _HRESULT_DEFINED
422 typedef LONG HRESULT
;
427 typedef void *HANDLE
;
428 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
431 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
433 #define DECLARE_HANDLE(a) typedef HANDLE a
442 #ifndef WIN32_NO_STATUS
444 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
445 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
446 #define STATUS_USER_APC ((DWORD) 0x000000C0)
447 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
448 #define STATUS_PENDING ((DWORD) 0x00000103)
449 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
450 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
451 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
452 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
453 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
454 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
455 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
456 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
457 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
458 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
459 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
460 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
461 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
462 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
463 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
464 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
465 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
466 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
467 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
468 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
469 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
470 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
471 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
472 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
473 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
474 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
475 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
476 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
477 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
478 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
480 /* status values for ContinueDebugEvent */
481 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
482 #define DBG_CONTINUE ((DWORD) 0x00010002)
483 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
484 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
485 #define DBG_CONTROL_C ((DWORD) 0x40010005)
486 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
487 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
488 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
490 #endif /* WIN32_NO_STATUS */
492 /* Argument 1 passed to the DllEntryProc. */
493 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
494 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
495 #define DLL_THREAD_ATTACH 2 /* attach new thread */
496 #define DLL_THREAD_DETACH 3 /* detach thread */
498 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
501 /* u.x.wProcessorArchitecture (NT) */
502 #define PROCESSOR_ARCHITECTURE_INTEL 0
503 #define PROCESSOR_ARCHITECTURE_MIPS 1
504 #define PROCESSOR_ARCHITECTURE_ALPHA 2
505 #define PROCESSOR_ARCHITECTURE_PPC 3
506 #define PROCESSOR_ARCHITECTURE_SHX 4
507 #define PROCESSOR_ARCHITECTURE_ARM 5
508 #define PROCESSOR_ARCHITECTURE_IA64 6
509 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
510 #define PROCESSOR_ARCHITECTURE_MSIL 8
511 #define PROCESSOR_ARCHITECTURE_AMD64 9
512 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
514 /* dwProcessorType */
515 #define PROCESSOR_INTEL_386 386
516 #define PROCESSOR_INTEL_486 486
517 #define PROCESSOR_INTEL_PENTIUM 586
518 #define PROCESSOR_INTEL_860 860
519 #define PROCESSOR_INTEL_IA64 2200
520 #define PROCESSOR_AMD_X8664 8664
521 #define PROCESSOR_MIPS_R2000 2000
522 #define PROCESSOR_MIPS_R3000 3000
523 #define PROCESSOR_MIPS_R4000 4000
524 #define PROCESSOR_ALPHA_21064 21064
525 #define PROCESSOR_PPC_601 601
526 #define PROCESSOR_PPC_603 603
527 #define PROCESSOR_PPC_604 604
528 #define PROCESSOR_PPC_620 620
529 #define PROCESSOR_HITACHI_SH3 10003
530 #define PROCESSOR_HITACHI_SH3E 10004
531 #define PROCESSOR_HITACHI_SH4 10005
532 #define PROCESSOR_MOTOROLA_821 821
533 #define PROCESSOR_SHx_SH3 103
534 #define PROCESSOR_SHx_SH4 104
535 #define PROCESSOR_STRONGARM 2577
536 #define PROCESSOR_ARM720 1824 /* 0x720 */
537 #define PROCESSOR_ARM820 2080 /* 0x820 */
538 #define PROCESSOR_ARM920 2336 /* 0x920 */
539 #define PROCESSOR_ARM_7TDMI 70001
542 #define MAXIMUM_PROCESSORS 64
544 #define MAXIMUM_PROCESSORS 32
547 typedef struct _MEMORY_BASIC_INFORMATION
550 LPVOID AllocationBase
;
551 DWORD AllocationProtect
;
556 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
558 #define PAGE_NOACCESS 0x01
559 #define PAGE_READONLY 0x02
560 #define PAGE_READWRITE 0x04
561 #define PAGE_WRITECOPY 0x08
562 #define PAGE_EXECUTE 0x10
563 #define PAGE_EXECUTE_READ 0x20
564 #define PAGE_EXECUTE_READWRITE 0x40
565 #define PAGE_EXECUTE_WRITECOPY 0x80
566 #define PAGE_GUARD 0x100
567 #define PAGE_NOCACHE 0x200
568 #define PAGE_WRITECOMBINE 0x400
570 #define MEM_COMMIT 0x00001000
571 #define MEM_RESERVE 0x00002000
572 #define MEM_DECOMMIT 0x00004000
573 #define MEM_RELEASE 0x00008000
574 #define MEM_FREE 0x00010000
575 #define MEM_PRIVATE 0x00020000
576 #define MEM_MAPPED 0x00040000
577 #define MEM_RESET 0x00080000
578 #define MEM_TOP_DOWN 0x00100000
579 #define MEM_WRITE_WATCH 0x00200000
580 #define MEM_PHYSICAL 0x00400000
581 #define MEM_LARGE_PAGES 0x20000000
582 #define MEM_4MB_PAGES 0x80000000
584 #define SEC_FILE 0x00800000
585 #define SEC_IMAGE 0x01000000
586 #define SEC_RESERVE 0x04000000
587 #define SEC_COMMIT 0x08000000
588 #define SEC_NOCACHE 0x10000000
589 #define SEC_LARGE_PAGES 0x80000000
590 #define MEM_IMAGE SEC_IMAGE
592 #define WRITE_WATCH_FLAG_RESET 0x00000001
597 #define MINSHORT 0x8000
598 #define MAXSHORT 0x7fff
599 #define MINLONG 0x80000000
600 #define MAXLONG 0x7fffffff
602 #define MAXWORD 0xffff
603 #define MAXDWORD 0xffffffff
605 #define FIELD_OFFSET(type, field) \
606 ((LONG)(INT_PTR)&(((type *)0)->field))
608 #define CONTAINING_RECORD(address, type, field) \
609 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
613 typedef struct _LIST_ENTRY
{
614 struct _LIST_ENTRY
*Flink
;
615 struct _LIST_ENTRY
*Blink
;
616 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
618 typedef struct _SINGLE_LIST_ENTRY
{
619 struct _SINGLE_LIST_ENTRY
*Next
;
620 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
624 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
*PSLIST_ENTRY
;
625 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
629 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
636 ULONGLONG Sequence
:9;
637 ULONGLONG NextEntry
:39;
638 ULONGLONG HeaderType
:1;
640 ULONGLONG Reserved
:59;
645 ULONGLONG Sequence
:48;
646 ULONGLONG HeaderType
:1;
648 ULONGLONG Reserved
:2;
649 ULONGLONG NextEntry
:60;
651 } SLIST_HEADER
, *PSLIST_HEADER
;
655 #undef SLIST_ENTRY /* for Mac OS */
656 #define SLIST_ENTRY SINGLE_LIST_ENTRY
657 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
658 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
660 typedef union _SLIST_HEADER
{
667 } SLIST_HEADER
, *PSLIST_HEADER
;
671 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
672 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
673 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
674 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
675 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
676 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
681 #define HEAP_NO_SERIALIZE 0x00000001
682 #define HEAP_GROWABLE 0x00000002
683 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
684 #define HEAP_ZERO_MEMORY 0x00000008
685 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
686 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
687 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
688 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
689 #define HEAP_CREATE_ALIGN_16 0x00010000
690 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
691 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
693 /* This flag allows it to create heaps shared by all processes under win95,
694 FIXME: correct name */
695 #define HEAP_SHARED 0x04000000
697 typedef enum _HEAP_INFORMATION_CLASS
{
698 HeapCompatibilityInformation
,
699 } HEAP_INFORMATION_CLASS
;
701 /* Processor feature flags. */
702 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
703 #define PF_FLOATING_POINT_EMULATED 1
704 #define PF_COMPARE_EXCHANGE_DOUBLE 2
705 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
706 #define PF_PPC_MOVEMEM_64BIT_OK 4
707 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
708 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
709 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
710 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
711 #define PF_PAE_ENABLED 9
712 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
713 #define PF_SSE_DAZ_MODE_AVAILABLE 11
714 #define PF_NX_ENABLED 12
715 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
716 #define PF_COMPARE_EXCHANGE128 14
717 #define PF_COMPARE64_EXCHANGE128 15
718 #define PF_CHANNELS_ENABLED 16
721 /* Execution state flags */
722 #define ES_SYSTEM_REQUIRED 0x00000001
723 #define ES_DISPLAY_REQUIRED 0x00000002
724 #define ES_USER_PRESENT 0x00000004
725 #define ES_CONTINUOUS 0x80000000
727 /* The Win32 register context */
729 /* CONTEXT is the CPU-dependent context; it should be used */
730 /* wherever a platform-specific context is needed (e.g. exception */
731 /* handling, Win32 register functions). */
733 /* CONTEXT86 is the i386-specific context; it should be used */
734 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
735 /* Win16 register functions), so that this code can be compiled */
736 /* on all platforms. */
738 #define SIZE_OF_80387_REGISTERS 80
740 typedef struct _FLOATING_SAVE_AREA
749 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
751 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
753 #define MAXIMUM_SUPPORTED_EXTENSION 512
755 typedef struct _CONTEXT86
759 /* These are selected by CONTEXT_DEBUG_REGISTERS */
767 /* These are selected by CONTEXT_FLOATING_POINT */
768 FLOATING_SAVE_AREA FloatSave
;
770 /* These are selected by CONTEXT_SEGMENTS */
776 /* These are selected by CONTEXT_INTEGER */
784 /* These are selected by CONTEXT_CONTROL */
792 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
795 #define CONTEXT_X86 0x00010000
796 #define CONTEXT_i386 CONTEXT_X86
797 #define CONTEXT_i486 CONTEXT_X86
799 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
800 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
801 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
802 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
803 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
804 #define CONTEXT86_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020L)
805 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
806 #define CONTEXT86_ALL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS | \
807 CONTEXT86_FLOATING_POINT | CONTEXT86_DEBUG_REGISTERS | CONTEXT86_EXTENDED_REGISTERS)
809 /* i386 context definitions */
812 #define CONTEXT_CONTROL CONTEXT86_CONTROL
813 #define CONTEXT_INTEGER CONTEXT86_INTEGER
814 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
815 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
816 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
817 #define CONTEXT_EXTENDED_REGISTERS CONTEXT86_EXTENDED_REGISTERS
818 #define CONTEXT_FULL CONTEXT86_FULL
819 #define CONTEXT_ALL CONTEXT86_ALL
821 typedef CONTEXT86 CONTEXT
;
823 #define EXCEPTION_READ_FAULT 0
824 #define EXCEPTION_WRITE_FAULT 1
825 #define EXCEPTION_EXECUTE_FAULT 8
827 #endif /* __i386__ */
829 typedef struct _LDT_ENTRY
{
844 unsigned LimitHi
: 4;
846 unsigned Reserved_0
: 1;
847 unsigned Default_Big
: 1;
848 unsigned Granularity
: 1;
852 #ifdef _WIN64 /* FIXME: 64-bit code should not be using the LDT */
855 } LDT_ENTRY
, *PLDT_ENTRY
;
857 /* x86-64 context definitions */
858 #if defined(__x86_64__)
860 #define CONTEXT_AMD64 0x00100000
862 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
863 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
864 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
865 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
866 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
867 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
868 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
870 #define EXCEPTION_READ_FAULT 0
871 #define EXCEPTION_WRITE_FAULT 1
872 #define EXCEPTION_EXECUTE_FAULT 8
874 typedef struct DECLSPEC_ALIGN(16) _M128A
{
879 typedef struct _XMM_SAVE_AREA32
{
880 WORD ControlWord
; /* 000 */
881 WORD StatusWord
; /* 002 */
882 BYTE TagWord
; /* 004 */
883 BYTE Reserved1
; /* 005 */
884 WORD ErrorOpcode
; /* 006 */
885 DWORD ErrorOffset
; /* 008 */
886 WORD ErrorSelector
; /* 00c */
887 WORD Reserved2
; /* 00e */
888 DWORD DataOffset
; /* 010 */
889 WORD DataSelector
; /* 014 */
890 WORD Reserved3
; /* 016 */
891 DWORD MxCsr
; /* 018 */
892 DWORD MxCsr_Mask
; /* 01c */
893 M128A FloatRegisters
[8]; /* 020 */
894 M128A XmmRegisters
[16]; /* 0a0 */
895 BYTE Reserved4
[96]; /* 1a0 */
896 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
898 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
899 DWORD64 P1Home
; /* 000 */
900 DWORD64 P2Home
; /* 008 */
901 DWORD64 P3Home
; /* 010 */
902 DWORD64 P4Home
; /* 018 */
903 DWORD64 P5Home
; /* 020 */
904 DWORD64 P6Home
; /* 028 */
907 DWORD ContextFlags
; /* 030 */
908 DWORD MxCsr
; /* 034 */
911 WORD SegCs
; /* 038 */
912 WORD SegDs
; /* 03a */
913 WORD SegEs
; /* 03c */
914 WORD SegFs
; /* 03e */
915 WORD SegGs
; /* 040 */
916 WORD SegSs
; /* 042 */
917 DWORD EFlags
; /* 044 */
920 DWORD64 Dr0
; /* 048 */
921 DWORD64 Dr1
; /* 050 */
922 DWORD64 Dr2
; /* 058 */
923 DWORD64 Dr3
; /* 060 */
924 DWORD64 Dr6
; /* 068 */
925 DWORD64 Dr7
; /* 070 */
928 DWORD64 Rax
; /* 078 */
929 DWORD64 Rcx
; /* 080 */
930 DWORD64 Rdx
; /* 088 */
931 DWORD64 Rbx
; /* 090 */
932 DWORD64 Rsp
; /* 098 */
933 DWORD64 Rbp
; /* 0a0 */
934 DWORD64 Rsi
; /* 0a8 */
935 DWORD64 Rdi
; /* 0b0 */
936 DWORD64 R8
; /* 0b8 */
937 DWORD64 R9
; /* 0c0 */
938 DWORD64 R10
; /* 0c8 */
939 DWORD64 R11
; /* 0d0 */
940 DWORD64 R12
; /* 0d8 */
941 DWORD64 R13
; /* 0e0 */
942 DWORD64 R14
; /* 0e8 */
943 DWORD64 R15
; /* 0f0 */
946 DWORD64 Rip
; /* 0f8 */
950 XMM_SAVE_AREA32 FltSave
; /* 100 */
952 M128A Header
[2]; /* 100 */
953 M128A Legacy
[8]; /* 120 */
954 M128A Xmm0
; /* 1a0 */
955 M128A Xmm1
; /* 1b0 */
956 M128A Xmm2
; /* 1c0 */
957 M128A Xmm3
; /* 1d0 */
958 M128A Xmm4
; /* 1e0 */
959 M128A Xmm5
; /* 1f0 */
960 M128A Xmm6
; /* 200 */
961 M128A Xmm7
; /* 210 */
962 M128A Xmm8
; /* 220 */
963 M128A Xmm9
; /* 230 */
964 M128A Xmm10
; /* 240 */
965 M128A Xmm11
; /* 250 */
966 M128A Xmm12
; /* 260 */
967 M128A Xmm13
; /* 270 */
968 M128A Xmm14
; /* 280 */
969 M128A Xmm15
; /* 290 */
974 M128A VectorRegister
[26]; /* 300 */
975 DWORD64 VectorControl
; /* 4a0 */
978 DWORD64 DebugControl
; /* 4a8 */
979 DWORD64 LastBranchToRip
; /* 4b0 */
980 DWORD64 LastBranchFromRip
; /* 4b8 */
981 DWORD64 LastExceptionToRip
; /* 4c0 */
982 DWORD64 LastExceptionFromRip
; /* 4c8 */
985 typedef struct _RUNTIME_FUNCTION
990 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
992 #endif /* __x86_64__ */
994 /* Alpha context definitions */
995 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
997 #define CONTEXT_ALPHA 0x00020000
999 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
1000 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
1001 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
1002 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1004 #define EXCEPTION_READ_FAULT 0
1005 #define EXCEPTION_WRITE_FAULT 1
1006 #define EXCEPTION_EXECUTE_FAULT 8
1008 typedef struct _CONTEXT
1010 /* selected by CONTEXT_FLOATING_POINT */
1044 /* selected by CONTEXT_INTEGER */
1078 /* selected by CONTEXT_FLOATING_POINT */
1082 /* selected by CONTEXT_CONTROL */
1089 #define _QUAD_PSR_OFFSET HighSoftFpcr
1090 #define _QUAD_FLAGS_OFFSET HighFir
1092 #endif /* _ALPHA_ */
1096 /* The following flags control the contents of the CONTEXT structure. */
1098 #define CONTEXT_ARM 0x0000040
1099 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1100 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1102 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1104 #define EXCEPTION_READ_FAULT 0
1105 #define EXCEPTION_WRITE_FAULT 1
1106 #define EXCEPTION_EXECUTE_FAULT 8
1108 typedef struct _CONTEXT
{
1109 /* The flags values within this flag control the contents of
1112 If the context record is used as an input parameter, then
1113 for each portion of the context record controlled by a flag
1114 whose value is set, it is assumed that that portion of the
1115 context record contains valid context. If the context record
1116 is being used to modify a thread's context, then only that
1117 portion of the threads context will be modified.
1119 If the context record is used as an IN OUT parameter to capture
1120 the context of a thread, then only those portions of the thread's
1121 context corresponding to set flags will be returned.
1123 The context record is never used as an OUT only parameter. */
1127 /* This section is specified/returned if the ContextFlags word contains
1128 the flag CONTEXT_INTEGER. */
1149 #endif /* __arm__ */
1152 /* Mips context definitions */
1155 #define CONTEXT_R4000 0x00010000
1157 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1158 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1159 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1161 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1163 #define EXCEPTION_READ_FAULT 0
1164 #define EXCEPTION_WRITE_FAULT 1
1165 #define EXCEPTION_EXECUTE_FAULT 8
1167 typedef struct _CONTEXT
1170 /* These are selected by CONTEXT_FLOATING_POINT */
1204 /* These are selected by CONTEXT_INTEGER */
1240 /* These are selected by CONTEXT_FLOATING_POINT */
1243 /* These are selected by CONTEXT_CONTROL */
1253 /* PowerPC context definitions */
1256 #define CONTEXT_CONTROL 0x0001
1257 #define CONTEXT_FLOATING_POINT 0x0002
1258 #define CONTEXT_INTEGER 0x0004
1259 #define CONTEXT_DEBUG_REGISTERS 0x0008
1260 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1262 #define EXCEPTION_READ_FAULT 0
1263 #define EXCEPTION_WRITE_FAULT 1
1264 #define EXCEPTION_EXECUTE_FAULT 8
1268 /* These are selected by CONTEXT_FLOATING_POINT */
1303 /* These are selected by CONTEXT_INTEGER */
1340 /* These are selected by CONTEXT_CONTROL */
1342 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1348 DWORD Dar
; /* Fault registers for coredump */
1350 DWORD Trap
; /* number of powerpc exception taken */
1352 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1363 typedef struct _STACK_FRAME_HEADER
1380 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1382 #endif /* __powerpc__ */
1389 * There is no official CONTEXT structure defined for the SPARC
1390 * architecture, so I just made one up.
1392 * This structure is valid only for 32-bit SPARC architectures,
1393 * not for 64-bit SPARC.
1395 * Note that this structure contains only the 'top-level' registers;
1396 * the rest of the register window chain is not visible.
1398 * The layout follows the Solaris 'prgregset_t' structure.
1402 #define CONTEXT_SPARC 0x10000000
1404 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1405 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1406 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1408 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1410 #define EXCEPTION_READ_FAULT 0
1411 #define EXCEPTION_WRITE_FAULT 1
1412 #define EXCEPTION_EXECUTE_FAULT 8
1414 typedef struct _CONTEXT
1418 /* These are selected by CONTEXT_INTEGER */
1452 /* These are selected by CONTEXT_CONTROL */
1460 /* FIXME: floating point registers missing */
1464 #endif /* __sparc__ */
1468 #define CONTEXT_IA64 0x00080000
1469 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1470 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1471 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1472 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1473 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1474 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1475 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1476 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1477 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1479 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1480 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1481 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1482 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1484 typedef struct _CONTEXT
1679 ULONGLONG RsBSPSTORE
;
1693 ULONGLONG UNUSEDPACK
;
1694 } CONTEXT
, *PCONTEXT
;
1696 typedef struct _RUNTIME_FUNCTION
1700 ULONG UnwindInfoAddress
;
1701 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1703 #endif /* __ia64__ */
1705 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1706 #error You need to define a CONTEXT for your CPU
1709 typedef CONTEXT
*PCONTEXT
;
1711 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1716 #define PRODUCT_UNLICENSED 0xABCDABCD
1717 #define PRODUCT_BUSINESS 0x00000006
1718 #define PRODUCT_BUSINESS_N 0x00000010
1719 #define PRODUCT_CLUSTER_SERVER 0x00000012
1720 #define PRODUCT_DATACENTER_SERVER 0x00000008
1721 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1722 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1723 #define PRODUCT_SERVER_V 0x00000025
1724 #define PRODUCT_ENTERPRISE 0x00000004
1725 #define PRODUCT_ENTERPRISE_N 0x0000001B
1726 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1727 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1728 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1729 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1730 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1731 #define PRODUCT_HOME_BASIC 0x00000002
1732 #define PRODUCT_HOME_BASIC_N 0x00000005
1733 #define PRODUCT_HOME_PREMIUM 0x00000003
1734 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1735 #define PRODUCT_HYPERV 0x0000002A
1736 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1737 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1738 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1739 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1740 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1741 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1742 #define PRODUCT_STANDARD_SERVER 0x00000007
1743 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1744 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1745 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1746 #define PRODUCT_STARTER 0x0000000B
1747 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1748 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1749 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1750 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1751 #define PRODUCT_UNDEFINED 0x00000000
1752 #define PRODUCT_ULTIMATE 0x00000001
1753 #define PRODUCT_ULTIMATE_N 0x0000001C
1754 #define PRODUCT_WEB_SERVER 0x00000011
1755 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1762 #define MAKELCID(l, s) (MAKELONG(l, s))
1764 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1765 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1766 #define SUBLANGID(l) ((WORD)(l) >> 10)
1768 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1769 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1771 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1772 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1773 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1774 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1775 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1777 #define UNREFERENCED_PARAMETER(u) (void)(u)
1778 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1779 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1781 #define LANG_NEUTRAL 0x00
1782 #define LANG_INVARIANT 0x7f
1784 #define LANG_AFRIKAANS 0x36
1785 #define LANG_ALBANIAN 0x1c
1786 #define LANG_ALSATIAN 0x84
1787 #define LANG_AMHARIC 0x5e
1788 #define LANG_ARABIC 0x01
1789 #define LANG_ARMENIAN 0x2b
1790 #define LANG_ASSAMESE 0x4d
1791 #define LANG_AZERI 0x2c
1792 #define LANG_BASHKIR 0x6d
1793 #define LANG_BASQUE 0x2d
1794 #define LANG_BELARUSIAN 0x23
1795 #define LANG_BENGALI 0x45
1796 #define LANG_BOSNIAN 0x1a
1797 #define LANG_BOSNIAN_NEUTRAL 0x781a
1798 #define LANG_BRETON 0x7e
1799 #define LANG_BULGARIAN 0x02
1800 #define LANG_CATALAN 0x03
1801 #define LANG_CHINESE 0x04
1802 #define LANG_CHINESE_SIMPLIFIED 0x0004
1803 #define LANG_CHINESE_TRADITIONAL 0x7c04
1804 #define LANG_CORSICAN 0x83
1805 #define LANG_CROATIAN 0x1a
1806 #define LANG_CZECH 0x05
1807 #define LANG_DANISH 0x06
1808 #define LANG_DARI 0x8c
1809 #define LANG_DIVEHI 0x65
1810 #define LANG_DUTCH 0x13
1811 #define LANG_ENGLISH 0x09
1812 #define LANG_ESTONIAN 0x25
1813 #define LANG_FAEROESE 0x38
1814 #define LANG_FARSI LANG_PERSIAN
1815 #define LANG_FILIPINO 0x64
1816 #define LANG_FINNISH 0x0b
1817 #define LANG_FRENCH 0x0c
1818 #define LANG_FRISIAN 0x62
1819 #define LANG_GALICIAN 0x56
1820 #define LANG_GEORGIAN 0x37
1821 #define LANG_GERMAN 0x07
1822 #define LANG_GREEK 0x08
1823 #define LANG_GREENLANDIC 0x6f
1824 #define LANG_GUJARATI 0x47
1825 #define LANG_HAUSA 0x68
1826 #define LANG_HEBREW 0x0d
1827 #define LANG_HINDI 0x39
1828 #define LANG_HUNGARIAN 0x0e
1829 #define LANG_ICELANDIC 0x0f
1830 #define LANG_IGBO 0x70
1831 #define LANG_INDONESIAN 0x21
1832 #define LANG_INUKTITUT 0x5d
1833 #define LANG_IRISH 0x3c
1834 #define LANG_ITALIAN 0x10
1835 #define LANG_JAPANESE 0x11
1836 #define LANG_KANNADA 0x4b
1837 #define LANG_KASHMIRI 0x60
1838 #define LANG_KAZAK 0x3f
1839 #define LANG_KHMER 0x53
1840 #define LANG_KICHE 0x86
1841 #define LANG_KINYARWANDA 0x87
1842 #define LANG_KONKANI 0x57
1843 #define LANG_KOREAN 0x12
1844 #define LANG_KYRGYZ 0x40
1845 #define LANG_LAO 0x54
1846 #define LANG_LATVIAN 0x26
1847 #define LANG_LITHUANIAN 0x27
1848 #define LANG_LOWER_SORBIAN 0x2e
1849 #define LANG_LUXEMBOURGISH 0x6e
1850 #define LANG_MACEDONIAN 0x2f
1851 #define LANG_MALAY 0x3e
1852 #define LANG_MALAYALAM 0x4c
1853 #define LANG_MALTESE 0x3a
1854 #define LANG_MANIPURI 0x58
1855 #define LANG_MAORI 0x81
1856 #define LANG_MAPUDUNGUN 0x7a
1857 #define LANG_MARATHI 0x4e
1858 #define LANG_MOHAWK 0x7c
1859 #define LANG_MONGOLIAN 0x50
1860 #define LANG_NEPALI 0x61
1861 #define LANG_NORWEGIAN 0x14
1862 #define LANG_OCCITAN 0x82
1863 #define LANG_ORIYA 0x48
1864 #define LANG_PASHTO 0x63
1865 #define LANG_PERSIAN 0x29
1866 #define LANG_POLISH 0x15
1867 #define LANG_PORTUGUESE 0x16
1868 #define LANG_PUNJABI 0x46
1869 #define LANG_QUECHUA 0x6b
1870 #define LANG_ROMANIAN 0x18
1871 #define LANG_ROMANSH 0x17
1872 #define LANG_RUSSIAN 0x19
1873 #define LANG_SAMI 0x3b
1874 #define LANG_SANSKRIT 0x4f
1875 #define LANG_SERBIAN 0x1a
1876 #define LANG_SERBIAN_NEUTRAL 0x7c1a
1877 #define LANG_SINDHI 0x59
1878 #define LANG_SINHALESE 0x5b
1879 #define LANG_SLOVAK 0x1b
1880 #define LANG_SLOVENIAN 0x24
1881 #define LANG_SOTHO 0x6c
1882 #define LANG_SPANISH 0x0a
1883 #define LANG_SWAHILI 0x41
1884 #define LANG_SWEDISH 0x1d
1885 #define LANG_SYRIAC 0x5a
1886 #define LANG_TAJIK 0x28
1887 #define LANG_TAMAZIGHT 0x5f
1888 #define LANG_TAMIL 0x49
1889 #define LANG_TATAR 0x44
1890 #define LANG_TELUGU 0x4a
1891 #define LANG_THAI 0x1e
1892 #define LANG_TIBETAN 0x51
1893 #define LANG_TIGRIGNA 0x73
1894 #define LANG_TSWANA 0x32
1895 #define LANG_TURKISH 0x1f
1896 #define LANG_TURKMEN 0x42
1897 #define LANG_UIGHUR 0x80
1898 #define LANG_UKRAINIAN 0x22
1899 #define LANG_UPPER_SORBIAN 0x2e
1900 #define LANG_URDU 0x20
1901 #define LANG_UZBEK 0x43
1902 #define LANG_VIETNAMESE 0x2a
1903 #define LANG_WELSH 0x52
1904 #define LANG_WOLOF 0x88
1905 #define LANG_XHOSA 0x34
1906 #define LANG_YAKUT 0x85
1907 #define LANG_YI 0x78
1908 #define LANG_YORUBA 0x6a
1909 #define LANG_ZULU 0x35
1911 /* These are documented by the MSDN but are missing from the Windows header */
1912 #define LANG_MALAGASY 0x8d
1914 /* FIXME: these are not defined anywhere */
1915 #define LANG_SUTU 0x30
1916 #define LANG_TSONGA 0x31
1917 #define LANG_VENDA 0x33
1919 /* non standard; keep the number high enough (but < 0xff) */
1920 #define LANG_ESPERANTO 0x8f
1921 #define LANG_WALON 0x90
1922 #define LANG_CORNISH 0x91
1923 #define LANG_GAELIC 0x94
1925 /* Sublanguage definitions */
1926 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1927 #define SUBLANG_DEFAULT 0x01 /* user default */
1928 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1929 #define SUBLANG_CUSTOM_DEFAULT 0x03
1930 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1931 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1933 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1934 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1935 #define SUBLANG_ALSATIAN_FRANCE 0x01
1936 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1937 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1938 #define SUBLANG_ARABIC_IRAQ 0x02
1939 #define SUBLANG_ARABIC_EGYPT 0x03
1940 #define SUBLANG_ARABIC_LIBYA 0x04
1941 #define SUBLANG_ARABIC_ALGERIA 0x05
1942 #define SUBLANG_ARABIC_MOROCCO 0x06
1943 #define SUBLANG_ARABIC_TUNISIA 0x07
1944 #define SUBLANG_ARABIC_OMAN 0x08
1945 #define SUBLANG_ARABIC_YEMEN 0x09
1946 #define SUBLANG_ARABIC_SYRIA 0x0a
1947 #define SUBLANG_ARABIC_JORDAN 0x0b
1948 #define SUBLANG_ARABIC_LEBANON 0x0c
1949 #define SUBLANG_ARABIC_KUWAIT 0x0d
1950 #define SUBLANG_ARABIC_UAE 0x0e
1951 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1952 #define SUBLANG_ARABIC_QATAR 0x10
1953 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1954 #define SUBLANG_ASSAMESE_INDIA 0x01
1955 #define SUBLANG_AZERI_LATIN 0x01
1956 #define SUBLANG_AZERI_CYRILLIC 0x02
1957 #define SUBLANG_BASHKIR_RUSSIA 0x01
1958 #define SUBLANG_BASQUE_BASQUE 0x01
1959 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1960 #define SUBLANG_BENGALI_INDIA 0x01
1961 #define SUBLANG_BENGALI_BANGLADESH 0x02
1962 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1963 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1964 #define SUBLANG_BRETON_FRANCE 0x01
1965 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1966 #define SUBLANG_CATALAN_CATALAN 0x01
1967 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1968 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1969 #define SUBLANG_CHINESE_HONGKONG 0x03
1970 #define SUBLANG_CHINESE_SINGAPORE 0x04
1971 #define SUBLANG_CHINESE_MACAU 0x05
1972 #define SUBLANG_CORSICAN_FRANCE 0x01
1973 #define SUBLANG_CROATIAN_CROATIA 0x01
1974 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1975 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1976 #define SUBLANG_DANISH_DENMARK 0x01
1977 #define SUBLANG_DARI_AFGHANISTAN 0x01
1978 #define SUBLANG_DIVEHI_MALDIVES 0x01
1979 #define SUBLANG_DUTCH 0x01
1980 #define SUBLANG_DUTCH_BELGIAN 0x02
1981 #define SUBLANG_ENGLISH_US 0x01
1982 #define SUBLANG_ENGLISH_UK 0x02
1983 #define SUBLANG_ENGLISH_AUS 0x03
1984 #define SUBLANG_ENGLISH_CAN 0x04
1985 #define SUBLANG_ENGLISH_NZ 0x05
1986 #define SUBLANG_ENGLISH_EIRE 0x06
1987 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1988 #define SUBLANG_ENGLISH_JAMAICA 0x08
1989 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1990 #define SUBLANG_ENGLISH_BELIZE 0x0a
1991 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1992 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1993 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1994 #define SUBLANG_ENGLISH_INDIA 0x10
1995 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1996 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1997 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1998 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1999 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
2000 #define SUBLANG_FINNISH_FINLAND 0x01
2001 #define SUBLANG_FRENCH 0x01
2002 #define SUBLANG_FRENCH_BELGIAN 0x02
2003 #define SUBLANG_FRENCH_CANADIAN 0x03
2004 #define SUBLANG_FRENCH_SWISS 0x04
2005 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
2006 #define SUBLANG_FRENCH_MONACO 0x06
2007 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
2008 #define SUBLANG_GALICIAN_GALICIAN 0x01
2009 #define SUBLANG_GEORGIAN_GEORGIA 0x01
2010 #define SUBLANG_GERMAN 0x01
2011 #define SUBLANG_GERMAN_SWISS 0x02
2012 #define SUBLANG_GERMAN_AUSTRIAN 0x03
2013 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
2014 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
2015 #define SUBLANG_GREEK_GREECE 0x01
2016 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
2017 #define SUBLANG_GUJARATI_INDIA 0x01
2018 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
2019 #define SUBLANG_HEBREW_ISRAEL 0x01
2020 #define SUBLANG_HINDI_INDIA 0x01
2021 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
2022 #define SUBLANG_ICELANDIC_ICELAND 0x01
2023 #define SUBLANG_IGBO_NIGERIA 0x01
2024 #define SUBLANG_INDONESIAN_INDONESIA 0x01
2025 #define SUBLANG_INUKTITUT_CANADA 0x01
2026 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
2027 #define SUBLANG_IRISH_IRELAND 0x02
2028 #define SUBLANG_ITALIAN 0x01
2029 #define SUBLANG_ITALIAN_SWISS 0x02
2030 #define SUBLANG_JAPANESE_JAPAN 0x01
2031 #define SUBLANG_KANNADA_INDIA 0x01
2032 #define SUBLANG_KASHMIRI_SASIA 0x02
2033 #define SUBLANG_KASHMIRI_INDIA 0x02
2034 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
2035 #define SUBLANG_KHMER_CAMBODIA 0x01
2036 #define SUBLANG_KICHE_GUATEMALA 0x01
2037 #define SUBLANG_KINYARWANDA_RWANDA 0X01
2038 #define SUBLANG_KONKANI_INDIA 0x01
2039 #define SUBLANG_KOREAN 0x01
2040 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
2041 #define SUBLANG_LAO_LAO 0x01
2042 #define SUBLANG_LATVIAN_LATVIA 0x01
2043 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
2044 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
2045 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
2046 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
2047 #define SUBLANG_MALAY_MALAYSIA 0x01
2048 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
2049 #define SUBLANG_MALAYALAM_INDIA 0x01
2050 #define SUBLANG_MALTESE_MALTA 0x01
2051 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
2052 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
2053 #define SUBLANG_MARATHI_INDIA 0x01
2054 #define SUBLANG_MOHAWK_MOHAWK 0x01
2055 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
2056 #define SUBLANG_MONGOLIAN_PRC 0x02
2057 #define SUBLANG_NEPALI_INDIA 0x02
2058 #define SUBLANG_NEPALI_NEPAL 0x01
2059 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
2060 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
2061 #define SUBLANG_OCCITAN_FRANCE 0x01
2062 #define SUBLANG_ORIYA_INDIA 0x01
2063 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
2064 #define SUBLANG_PERSIAN_IRAN 0x01
2065 #define SUBLANG_POLISH_POLAND 0x01
2066 #define SUBLANG_PORTUGUESE 0x02
2067 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
2068 #define SUBLANG_PUNJABI_INDIA 0x01
2069 #define SUBLANG_QUECHUA_BOLIVIA 0x01
2070 #define SUBLANG_QUECHUA_ECUADOR 0x02
2071 #define SUBLANG_QUECHUA_PERU 0x03
2072 #define SUBLANG_ROMANIAN_ROMANIA 0x01
2073 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
2074 #define SUBLANG_RUSSIAN_RUSSIA 0x01
2075 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
2076 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
2077 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
2078 #define SUBLANG_SAMI_LULE_NORWAY 0x04
2079 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
2080 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
2081 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
2082 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
2083 #define SUBLANG_SAMI_INARI_FINLAND 0x09
2084 #define SUBLANG_SANSKRIT_INDIA 0x01
2085 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
2086 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
2087 #define SUBLANG_SERBIAN_CROATIA 0x01
2088 #define SUBLANG_SERBIAN_LATIN 0x02
2089 #define SUBLANG_SERBIAN_CYRILLIC 0x03
2090 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
2091 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
2092 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
2093 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
2094 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
2095 #define SUBLANG_SPANISH 0x01
2096 #define SUBLANG_SPANISH_MEXICAN 0x02
2097 #define SUBLANG_SPANISH_MODERN 0x03
2098 #define SUBLANG_SPANISH_GUATEMALA 0x04
2099 #define SUBLANG_SPANISH_COSTA_RICA 0x05
2100 #define SUBLANG_SPANISH_PANAMA 0x06
2101 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
2102 #define SUBLANG_SPANISH_VENEZUELA 0x08
2103 #define SUBLANG_SPANISH_COLOMBIA 0x09
2104 #define SUBLANG_SPANISH_PERU 0x0a
2105 #define SUBLANG_SPANISH_ARGENTINA 0x0b
2106 #define SUBLANG_SPANISH_ECUADOR 0x0c
2107 #define SUBLANG_SPANISH_CHILE 0x0d
2108 #define SUBLANG_SPANISH_URUGUAY 0x0e
2109 #define SUBLANG_SPANISH_PARAGUAY 0x0f
2110 #define SUBLANG_SPANISH_BOLIVIA 0x10
2111 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
2112 #define SUBLANG_SPANISH_HONDURAS 0x12
2113 #define SUBLANG_SPANISH_NICARAGUA 0x13
2114 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
2115 #define SUBLANG_SPANISH_US 0x15
2116 #define SUBLANG_SWAHILI_KENYA 0x01
2117 #define SUBLANG_SWEDISH 0x01
2118 #define SUBLANG_SWEDISH_FINLAND 0x02
2119 #define SUBLANG_SYRIAC_SYRIA 0x01
2120 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
2121 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
2122 #define SUBLANG_TAMIL_INDIA 0x01
2123 #define SUBLANG_TATAR_RUSSIA 0x01
2124 #define SUBLANG_TELUGU_INDIA 0x01
2125 #define SUBLANG_THAI_THAILAND 0x01
2126 #define SUBLANG_TIBETAN_PRC 0x01
2127 #define SUBLANG_TIBETAN_BHUTAN 0x02
2128 #define SUBLANG_TIGRIGNA_ERITREA 0x02
2129 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
2130 #define SUBLANG_TURKISH_TURKEY 0x01
2131 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
2132 #define SUBLANG_UIGHUR_PRC 0x01
2133 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
2134 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
2135 #define SUBLANG_URDU_PAKISTAN 0x01
2136 #define SUBLANG_URDU_INDIA 0x02
2137 #define SUBLANG_UZBEK_LATIN 0x01
2138 #define SUBLANG_UZBEK_CYRILLIC 0x02
2139 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
2140 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
2141 #define SUBLANG_WOLOF_SENEGAL 0x01
2142 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
2143 #define SUBLANG_YAKUT_RUSSIA 0x01
2144 #define SUBLANG_YI_PRC 0x01
2145 #define SUBLANG_YORUBA_NIGERIA 0x01
2146 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
2148 /* These are documented by the MSDN but are missing from the Windows header */
2149 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
2150 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
2151 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
2152 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
2153 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
2154 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
2155 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
2156 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
2158 /* FIXME: these are not defined anywhere */
2159 #define SUBLANG_DUTCH_SURINAM 0x03
2160 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
2161 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
2162 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
2163 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
2164 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
2165 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
2166 #define SUBLANG_GAELIC 0x01
2167 #define SUBLANG_GAELIC_SCOTTISH 0x02
2168 #define SUBLANG_GAELIC_MANX 0x03
2175 #define SORT_DEFAULT 0x0
2176 #define SORT_JAPANESE_XJIS 0x0
2177 #define SORT_JAPANESE_UNICODE 0x1
2178 #define SORT_CHINESE_BIG5 0x0
2179 #define SORT_CHINESE_UNICODE 0x1
2180 #define SORT_KOREAN_KSC 0x0
2181 #define SORT_KOREAN_UNICODE 0x1
2186 * Definitions for IsTextUnicode()
2189 #define IS_TEXT_UNICODE_ASCII16 0x0001
2190 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2191 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2192 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2193 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2194 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2195 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2196 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2197 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2198 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2199 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2200 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2201 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2202 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2203 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2204 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2206 #define MAXIMUM_WAIT_OBJECTS 64
2207 #define MAXIMUM_SUSPEND_COUNT 127
2209 #define WT_EXECUTEDEFAULT 0x00
2210 #define WT_EXECUTEINIOTHREAD 0x01
2211 #define WT_EXECUTEINUITHREAD 0x02
2212 #define WT_EXECUTEINWAITTHREAD 0x04
2213 #define WT_EXECUTEONLYONCE 0x08
2214 #define WT_EXECUTELONGFUNCTION 0x10
2215 #define WT_EXECUTEINTIMERTHREAD 0x20
2216 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2217 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2218 #define WT_EXECUTEINLONGTHREAD 0x10
2219 #define WT_EXECUTEDELETEWAIT 0x08
2220 #define WT_TRANSFER_IMPERSONATION 0x0100
2223 #define EXCEPTION_CONTINUABLE 0
2224 #define EXCEPTION_NONCONTINUABLE 0x01
2227 * The exception record used by Win32 to give additional information
2228 * about exception to exception handlers.
2231 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2233 typedef struct _EXCEPTION_RECORD
2235 DWORD ExceptionCode
;
2236 DWORD ExceptionFlags
;
2237 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2239 PVOID ExceptionAddress
;
2240 DWORD NumberParameters
;
2241 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2242 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2245 * The exception pointers structure passed to exception filters
2246 * in except() and the UnhandledExceptionFilter().
2249 typedef struct _EXCEPTION_POINTERS
2251 PEXCEPTION_RECORD ExceptionRecord
;
2252 PCONTEXT ContextRecord
;
2253 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2257 * The exception frame, used for registering exception handlers
2258 * Win32 cares only about this, but compilers generally emit
2259 * larger exception frames for their own use.
2262 struct _EXCEPTION_REGISTRATION_RECORD
;
2264 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2265 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2267 typedef struct _EXCEPTION_REGISTRATION_RECORD
2269 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2270 PEXCEPTION_HANDLER Handler
;
2271 } EXCEPTION_REGISTRATION_RECORD
;
2274 * function pointer to an exception filter
2277 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2279 typedef struct _NT_TIB
2281 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2289 PVOID ArbitraryUserPointer
;
2290 struct _NT_TIB
*Self
;
2295 #if defined(__i386__) && defined(__GNUC__)
2296 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
2297 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
2300 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2303 #elif defined(__i386__) && defined(_MSC_VER)
2304 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
2307 __asm mov eax
, fs
:[0x18];
2311 #elif defined(__x86_64__) && defined(__GNUC__)
2312 static inline struct _TEB
* WINAPI
NtCurrentTeb(void)
2315 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2318 #elif defined(__x86_64__) && defined (_MSC_VER)
2319 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
2322 __asm mov rax
, gs
:[0x30];
2327 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2330 #ifdef NONAMELESSUNION
2331 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2333 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2335 #define GetFiberData() (*(void **)GetCurrentFiber())
2337 #define TLS_MINIMUM_AVAILABLE 64
2340 * File formats definitions
2343 #include <pshpack2.h>
2344 typedef struct _IMAGE_DOS_HEADER
{
2345 WORD e_magic
; /* 00: MZ Header signature */
2346 WORD e_cblp
; /* 02: Bytes on last page of file */
2347 WORD e_cp
; /* 04: Pages in file */
2348 WORD e_crlc
; /* 06: Relocations */
2349 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2350 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2351 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2352 WORD e_ss
; /* 0e: Initial (relative) SS value */
2353 WORD e_sp
; /* 10: Initial SP value */
2354 WORD e_csum
; /* 12: Checksum */
2355 WORD e_ip
; /* 14: Initial IP value */
2356 WORD e_cs
; /* 16: Initial (relative) CS value */
2357 WORD e_lfarlc
; /* 18: File address of relocation table */
2358 WORD e_ovno
; /* 1a: Overlay number */
2359 WORD e_res
[4]; /* 1c: Reserved words */
2360 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2361 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2362 WORD e_res2
[10]; /* 28: Reserved words */
2363 DWORD e_lfanew
; /* 3c: Offset to extended header */
2364 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2365 #include <poppack.h>
2367 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2368 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2369 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2370 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2371 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2372 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2375 * This is the Windows executable (NE) header.
2376 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2378 #include <pshpack2.h>
2381 WORD ne_magic
; /* 00 NE signature 'NE' */
2382 BYTE ne_ver
; /* 02 Linker version number */
2383 BYTE ne_rev
; /* 03 Linker revision number */
2384 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2385 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2386 LONG ne_crc
; /* 08 Checksum */
2387 WORD ne_flags
; /* 0c Flags about segments in this file */
2388 WORD ne_autodata
; /* 0e Automatic data segment number */
2389 WORD ne_heap
; /* 10 Initial size of local heap */
2390 WORD ne_stack
; /* 12 Initial size of stack */
2391 DWORD ne_csip
; /* 14 Initial CS:IP */
2392 DWORD ne_sssp
; /* 18 Initial SS:SP */
2393 WORD ne_cseg
; /* 1c # of entries in segment table */
2394 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2395 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2396 WORD ne_segtab
; /* 22 Offset to segment table */
2397 WORD ne_rsrctab
; /* 24 Offset to resource table */
2398 WORD ne_restab
; /* 26 Offset to resident-name table */
2399 WORD ne_modtab
; /* 28 Offset to module reference table */
2400 WORD ne_imptab
; /* 2a Offset to imported name table */
2401 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2402 WORD ne_cmovent
; /* 30 # of movable entry points */
2403 WORD ne_align
; /* 32 Logical sector alignment shift count */
2404 WORD ne_cres
; /* 34 # of resource segments */
2405 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2406 BYTE ne_flagsothers
; /* 37 Additional information flags */
2407 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2408 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2409 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2410 WORD ne_expver
; /* 3e Expected Windows version number */
2411 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2412 #include <poppack.h>
2414 #include <pshpack2.h>
2415 typedef struct _IMAGE_VXD_HEADER
{
2430 DWORD e32_lastpagesize
;
2431 DWORD e32_fixupsize
;
2448 DWORD e32_impmodcnt
;
2454 DWORD e32_cbnrestab
;
2457 DWORD e32_debuginfo
;
2459 DWORD e32_instpreload
;
2460 DWORD e32_instdemand
;
2463 DWORD e32_winresoff
;
2464 DWORD e32_winreslen
;
2467 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2468 #include <poppack.h>
2470 /* These defines describe the meanings of the bits in the Characteristics
2473 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2474 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2475 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2476 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2477 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2478 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2479 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2480 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2481 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2482 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2483 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2484 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2485 #define IMAGE_FILE_SYSTEM 0x1000
2486 #define IMAGE_FILE_DLL 0x2000
2487 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2488 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2490 /* These are the settings of the Machine field. */
2491 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2492 #define IMAGE_FILE_MACHINE_I860 0x014d
2493 #define IMAGE_FILE_MACHINE_I386 0x014c
2494 #define IMAGE_FILE_MACHINE_R3000 0x0162
2495 #define IMAGE_FILE_MACHINE_R4000 0x0166
2496 #define IMAGE_FILE_MACHINE_R10000 0x0168
2497 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2498 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2499 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2500 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2501 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2502 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2503 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2504 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2505 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2506 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2507 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2508 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2509 #define IMAGE_FILE_MACHINE_IA64 0x0200
2510 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2511 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2512 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2513 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2514 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2515 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2516 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2517 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2518 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2519 #define IMAGE_FILE_MACHINE_M32R 0x9041
2520 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2522 #define IMAGE_SIZEOF_FILE_HEADER 20
2523 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2524 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2525 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2526 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2527 #define IMAGE_SIZEOF_SHORT_NAME 8
2528 #define IMAGE_SIZEOF_SECTION_HEADER 40
2529 #define IMAGE_SIZEOF_SYMBOL 18
2530 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2531 #define IMAGE_SIZEOF_RELOCATION 10
2532 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2533 #define IMAGE_SIZEOF_LINENUMBER 6
2534 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2536 /* Possible Magic values */
2537 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2538 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2539 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2542 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2543 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2545 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2546 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2549 /* These are indexes into the DataDirectory array */
2550 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2551 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2552 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2553 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2554 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2555 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2556 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2557 #define IMAGE_FILE_DESCRIPTION_STRING 7
2558 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2559 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2560 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2562 /* Directory Entries, indices into the DataDirectory array */
2564 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2565 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2566 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2567 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2568 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2569 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2570 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2571 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2572 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2573 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2574 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2575 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2576 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2577 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2578 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2580 /* Subsystem Values */
2582 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2583 #define IMAGE_SUBSYSTEM_NATIVE 1
2584 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2585 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2586 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2587 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2588 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2589 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2590 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2591 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2592 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2593 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2594 #define IMAGE_SUBSYSTEM_XBOX 14
2596 /* DLL Characteristics */
2597 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2598 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2599 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2600 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2601 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2602 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2603 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2604 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2606 typedef struct _IMAGE_FILE_HEADER
{
2608 WORD NumberOfSections
;
2609 DWORD TimeDateStamp
;
2610 DWORD PointerToSymbolTable
;
2611 DWORD NumberOfSymbols
;
2612 WORD SizeOfOptionalHeader
;
2613 WORD Characteristics
;
2614 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2616 typedef struct _IMAGE_DATA_DIRECTORY
{
2617 DWORD VirtualAddress
;
2619 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2621 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2623 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2624 WORD Magic
; /* 0x20b */
2625 BYTE MajorLinkerVersion
;
2626 BYTE MinorLinkerVersion
;
2628 DWORD SizeOfInitializedData
;
2629 DWORD SizeOfUninitializedData
;
2630 DWORD AddressOfEntryPoint
;
2632 ULONGLONG ImageBase
;
2633 DWORD SectionAlignment
;
2634 DWORD FileAlignment
;
2635 WORD MajorOperatingSystemVersion
;
2636 WORD MinorOperatingSystemVersion
;
2637 WORD MajorImageVersion
;
2638 WORD MinorImageVersion
;
2639 WORD MajorSubsystemVersion
;
2640 WORD MinorSubsystemVersion
;
2641 DWORD Win32VersionValue
;
2643 DWORD SizeOfHeaders
;
2646 WORD DllCharacteristics
;
2647 ULONGLONG SizeOfStackReserve
;
2648 ULONGLONG SizeOfStackCommit
;
2649 ULONGLONG SizeOfHeapReserve
;
2650 ULONGLONG SizeOfHeapCommit
;
2652 DWORD NumberOfRvaAndSizes
;
2653 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2654 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2656 typedef struct _IMAGE_NT_HEADERS64
{
2658 IMAGE_FILE_HEADER FileHeader
;
2659 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2660 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2662 typedef struct _IMAGE_OPTIONAL_HEADER
{
2664 /* Standard fields */
2666 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2667 BYTE MajorLinkerVersion
;
2668 BYTE MinorLinkerVersion
;
2670 DWORD SizeOfInitializedData
;
2671 DWORD SizeOfUninitializedData
;
2672 DWORD AddressOfEntryPoint
; /* 0x10 */
2676 /* NT additional fields */
2679 DWORD SectionAlignment
; /* 0x20 */
2680 DWORD FileAlignment
;
2681 WORD MajorOperatingSystemVersion
;
2682 WORD MinorOperatingSystemVersion
;
2683 WORD MajorImageVersion
;
2684 WORD MinorImageVersion
;
2685 WORD MajorSubsystemVersion
; /* 0x30 */
2686 WORD MinorSubsystemVersion
;
2687 DWORD Win32VersionValue
;
2689 DWORD SizeOfHeaders
;
2690 DWORD CheckSum
; /* 0x40 */
2692 WORD DllCharacteristics
;
2693 DWORD SizeOfStackReserve
;
2694 DWORD SizeOfStackCommit
;
2695 DWORD SizeOfHeapReserve
; /* 0x50 */
2696 DWORD SizeOfHeapCommit
;
2698 DWORD NumberOfRvaAndSizes
;
2699 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2701 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2703 typedef struct _IMAGE_NT_HEADERS
{
2704 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2705 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2706 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2707 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2710 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2711 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2712 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2713 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2715 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2716 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2717 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2718 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2721 #define IMAGE_SIZEOF_SHORT_NAME 8
2723 typedef struct _IMAGE_SECTION_HEADER
{
2724 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2726 DWORD PhysicalAddress
;
2729 DWORD VirtualAddress
;
2730 DWORD SizeOfRawData
;
2731 DWORD PointerToRawData
;
2732 DWORD PointerToRelocations
;
2733 DWORD PointerToLinenumbers
;
2734 WORD NumberOfRelocations
;
2735 WORD NumberOfLinenumbers
;
2736 DWORD Characteristics
;
2737 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2739 #define IMAGE_SIZEOF_SECTION_HEADER 40
2741 #define IMAGE_FIRST_SECTION(ntheader) \
2742 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2743 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2745 /* These defines are for the Characteristics bitfield. */
2746 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2747 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2748 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2749 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2750 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2751 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2753 #define IMAGE_SCN_CNT_CODE 0x00000020
2754 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2755 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2757 #define IMAGE_SCN_LNK_OTHER 0x00000100
2758 #define IMAGE_SCN_LNK_INFO 0x00000200
2759 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2760 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2761 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2763 /* 0x00002000 - Reserved */
2764 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2765 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2767 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2768 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2769 #define IMAGE_SCN_MEM_16BIT 0x00020000
2770 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2771 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2773 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2774 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2775 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2776 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2777 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2778 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2779 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2780 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2781 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2782 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2783 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2784 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2785 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2786 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2787 /* 0x00F00000 - Unused */
2788 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2790 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2793 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2794 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2795 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2796 #define IMAGE_SCN_MEM_SHARED 0x10000000
2797 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2798 #define IMAGE_SCN_MEM_READ 0x40000000
2799 #define IMAGE_SCN_MEM_WRITE 0x80000000
2801 #include <pshpack2.h>
2803 typedef struct _IMAGE_SYMBOL
{
2813 SHORT SectionNumber
;
2816 BYTE NumberOfAuxSymbols
;
2818 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2820 #define IMAGE_SIZEOF_SYMBOL 18
2822 typedef struct _IMAGE_LINENUMBER
{
2824 DWORD SymbolTableIndex
;
2825 DWORD VirtualAddress
;
2829 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2831 #define IMAGE_SIZEOF_LINENUMBER 6
2833 typedef union _IMAGE_AUX_SYMBOL
{
2845 DWORD PointerToLinenumber
;
2846 DWORD PointerToNextFunction
;
2855 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2859 WORD NumberOfRelocations
;
2860 WORD NumberOfLinenumbers
;
2866 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2868 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2870 #include <poppack.h>
2872 #define IMAGE_SYM_UNDEFINED (SHORT)0
2873 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2874 #define IMAGE_SYM_DEBUG (SHORT)-2
2876 #define IMAGE_SYM_TYPE_NULL 0x0000
2877 #define IMAGE_SYM_TYPE_VOID 0x0001
2878 #define IMAGE_SYM_TYPE_CHAR 0x0002
2879 #define IMAGE_SYM_TYPE_SHORT 0x0003
2880 #define IMAGE_SYM_TYPE_INT 0x0004
2881 #define IMAGE_SYM_TYPE_LONG 0x0005
2882 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2883 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2884 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2885 #define IMAGE_SYM_TYPE_UNION 0x0009
2886 #define IMAGE_SYM_TYPE_ENUM 0x000A
2887 #define IMAGE_SYM_TYPE_MOE 0x000B
2888 #define IMAGE_SYM_TYPE_BYTE 0x000C
2889 #define IMAGE_SYM_TYPE_WORD 0x000D
2890 #define IMAGE_SYM_TYPE_UINT 0x000E
2891 #define IMAGE_SYM_TYPE_DWORD 0x000F
2892 #define IMAGE_SYM_TYPE_PCODE 0x8000
2894 #define IMAGE_SYM_DTYPE_NULL 0
2895 #define IMAGE_SYM_DTYPE_POINTER 1
2896 #define IMAGE_SYM_DTYPE_FUNCTION 2
2897 #define IMAGE_SYM_DTYPE_ARRAY 3
2899 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2900 #define IMAGE_SYM_CLASS_NULL 0x0000
2901 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2902 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2903 #define IMAGE_SYM_CLASS_STATIC 0x0003
2904 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2905 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2906 #define IMAGE_SYM_CLASS_LABEL 0x0006
2907 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2908 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2909 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2910 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2911 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2912 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2913 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2914 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2915 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2916 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2917 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2918 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2920 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2921 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2922 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2923 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2924 #define IMAGE_SYM_CLASS_FILE 0x0067
2925 #define IMAGE_SYM_CLASS_SECTION 0x0068
2926 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2928 #define N_BTMASK 0x000F
2929 #define N_TMASK 0x0030
2930 #define N_TMASK1 0x00C0
2931 #define N_TMASK2 0x00F0
2935 #define BTYPE(x) ((x) & N_BTMASK)
2938 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2942 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2946 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2950 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2954 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2957 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2960 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2961 #define IMAGE_COMDAT_SELECT_ANY 2
2962 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2963 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2964 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2965 #define IMAGE_COMDAT_SELECT_LARGEST 6
2966 #define IMAGE_COMDAT_SELECT_NEWEST 7
2968 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2969 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2970 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2972 /* Export module directory */
2974 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2975 DWORD Characteristics
;
2976 DWORD TimeDateStamp
;
2981 DWORD NumberOfFunctions
;
2982 DWORD NumberOfNames
;
2983 DWORD AddressOfFunctions
;
2984 DWORD AddressOfNames
;
2985 DWORD AddressOfNameOrdinals
;
2986 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
2988 /* Import name entry */
2989 typedef struct _IMAGE_IMPORT_BY_NAME
{
2992 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
2994 #include <pshpack8.h>
2996 typedef struct _IMAGE_THUNK_DATA64
{
2998 ULONGLONG ForwarderString
;
3001 ULONGLONG AddressOfData
;
3003 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
3004 #include <poppack.h>
3006 typedef struct _IMAGE_THUNK_DATA32
{
3008 DWORD ForwarderString
;
3011 DWORD AddressOfData
;
3013 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
3015 /* Import module directory */
3017 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
3019 DWORD Characteristics
; /* 0 for terminating null import descriptor */
3020 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
3022 DWORD TimeDateStamp
; /* 0 if not bound,
3023 * -1 if bound, and real date\time stamp
3024 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3026 * otherwise date/time stamp of DLL bound to
3029 DWORD ForwarderChain
; /* -1 if no forwarders */
3031 /* RVA to IAT (if bound this IAT has actual addresses) */
3033 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
3035 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3036 #define IMAGE_ORDINAL_FLAG32 0x80000000
3037 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3038 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3039 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3040 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3043 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3044 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3045 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3046 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
3047 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
3049 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3050 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3051 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3052 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
3053 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
3056 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3058 DWORD TimeDateStamp
;
3059 WORD OffsetModuleName
;
3060 WORD NumberOfModuleForwarderRefs
;
3061 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3062 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
3064 typedef struct _IMAGE_BOUND_FORWARDER_REF
3066 DWORD TimeDateStamp
;
3067 WORD OffsetModuleName
;
3069 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
3071 typedef struct _IMAGE_BASE_RELOCATION
3073 DWORD VirtualAddress
;
3075 /* WORD TypeOffset[1]; */
3076 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
3078 #include <pshpack2.h>
3080 typedef struct _IMAGE_RELOCATION
3083 DWORD VirtualAddress
;
3086 DWORD SymbolTableIndex
;
3088 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
3090 #include <poppack.h>
3092 #define IMAGE_SIZEOF_RELOCATION 10
3094 /* generic relocation types */
3095 #define IMAGE_REL_BASED_ABSOLUTE 0
3096 #define IMAGE_REL_BASED_HIGH 1
3097 #define IMAGE_REL_BASED_LOW 2
3098 #define IMAGE_REL_BASED_HIGHLOW 3
3099 #define IMAGE_REL_BASED_HIGHADJ 4
3100 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3101 #define IMAGE_REL_BASED_SECTION 6
3102 #define IMAGE_REL_BASED_REL 7
3103 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3104 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3105 #define IMAGE_REL_BASED_DIR64 10
3106 #define IMAGE_REL_BASED_HIGH3ADJ 11
3108 /* I386 relocation types */
3109 #define IMAGE_REL_I386_ABSOLUTE 0
3110 #define IMAGE_REL_I386_DIR16 1
3111 #define IMAGE_REL_I386_REL16 2
3112 #define IMAGE_REL_I386_DIR32 6
3113 #define IMAGE_REL_I386_DIR32NB 7
3114 #define IMAGE_REL_I386_SEG12 9
3115 #define IMAGE_REL_I386_SECTION 10
3116 #define IMAGE_REL_I386_SECREL 11
3117 #define IMAGE_REL_I386_REL32 20
3119 /* MIPS relocation types */
3120 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3121 #define IMAGE_REL_MIPS_REFHALF 0x0001
3122 #define IMAGE_REL_MIPS_REFWORD 0x0002
3123 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3124 #define IMAGE_REL_MIPS_REFHI 0x0004
3125 #define IMAGE_REL_MIPS_REFLO 0x0005
3126 #define IMAGE_REL_MIPS_GPREL 0x0006
3127 #define IMAGE_REL_MIPS_LITERAL 0x0007
3128 #define IMAGE_REL_MIPS_SECTION 0x000A
3129 #define IMAGE_REL_MIPS_SECREL 0x000B
3130 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3131 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3132 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3133 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3134 #define IMAGE_REL_MIPS_PAIR 0x0025
3136 /* ALPHA relocation types */
3137 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3138 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3139 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3140 #define IMAGE_REL_ALPHA_GPREL 0x0003
3141 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3142 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3143 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3144 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3145 #define IMAGE_REL_ALPHA_HINT 0x0008
3146 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3147 #define IMAGE_REL_ALPHA_REFHI 0x000A
3148 #define IMAGE_REL_ALPHA_REFLO 0x000B
3149 #define IMAGE_REL_ALPHA_PAIR 0x000C
3150 #define IMAGE_REL_ALPHA_MATCH 0x000D
3151 #define IMAGE_REL_ALPHA_SECTION 0x000E
3152 #define IMAGE_REL_ALPHA_SECREL 0x000F
3153 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3154 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3155 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3156 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3157 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3158 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3159 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3160 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3162 /* PowerPC relocation types */
3163 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3164 #define IMAGE_REL_PPC_ADDR64 0x0001
3165 #define IMAGE_REL_PPC_ADDR 0x0002
3166 #define IMAGE_REL_PPC_ADDR24 0x0003
3167 #define IMAGE_REL_PPC_ADDR16 0x0004
3168 #define IMAGE_REL_PPC_ADDR14 0x0005
3169 #define IMAGE_REL_PPC_REL24 0x0006
3170 #define IMAGE_REL_PPC_REL14 0x0007
3171 #define IMAGE_REL_PPC_TOCREL16 0x0008
3172 #define IMAGE_REL_PPC_TOCREL14 0x0009
3173 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3174 #define IMAGE_REL_PPC_SECREL 0x000B
3175 #define IMAGE_REL_PPC_SECTION 0x000C
3176 #define IMAGE_REL_PPC_IFGLUE 0x000D
3177 #define IMAGE_REL_PPC_IMGLUE 0x000E
3178 #define IMAGE_REL_PPC_SECREL16 0x000F
3179 #define IMAGE_REL_PPC_REFHI 0x0010
3180 #define IMAGE_REL_PPC_REFLO 0x0011
3181 #define IMAGE_REL_PPC_PAIR 0x0012
3182 #define IMAGE_REL_PPC_SECRELLO 0x0013
3183 #define IMAGE_REL_PPC_SECRELHI 0x0014
3184 #define IMAGE_REL_PPC_GPREL 0x0015
3185 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3187 #define IMAGE_REL_PPC_NEG 0x0100
3188 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3189 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3190 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3192 /* SH3 ? relocation type */
3193 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3194 #define IMAGE_REL_SH3_DIRECT16 0x0001
3195 #define IMAGE_REL_SH3_DIRECT 0x0002
3196 #define IMAGE_REL_SH3_DIRECT8 0x0003
3197 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3198 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3199 #define IMAGE_REL_SH3_DIRECT4 0x0006
3200 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3201 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3202 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3203 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3204 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3205 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3206 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3207 #define IMAGE_REL_SH3_SECTION 0x000E
3208 #define IMAGE_REL_SH3_SECREL 0x000F
3209 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3211 /* ARM (Archimedes?) relocation types */
3212 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3213 #define IMAGE_REL_ARM_ADDR 0x0001
3214 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3215 #define IMAGE_REL_ARM_BRANCH24 0x0003
3216 #define IMAGE_REL_ARM_BRANCH11 0x0004
3217 #define IMAGE_REL_ARM_SECTION 0x000E
3218 #define IMAGE_REL_ARM_SECREL 0x000F
3220 /* IA64 relocation types */
3221 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3222 #define IMAGE_REL_IA64_IMM14 0x0001
3223 #define IMAGE_REL_IA64_IMM22 0x0002
3224 #define IMAGE_REL_IA64_IMM64 0x0003
3225 #define IMAGE_REL_IA64_DIR 0x0004
3226 #define IMAGE_REL_IA64_DIR64 0x0005
3227 #define IMAGE_REL_IA64_PCREL21B 0x0006
3228 #define IMAGE_REL_IA64_PCREL21M 0x0007
3229 #define IMAGE_REL_IA64_PCREL21F 0x0008
3230 #define IMAGE_REL_IA64_GPREL22 0x0009
3231 #define IMAGE_REL_IA64_LTOFF22 0x000A
3232 #define IMAGE_REL_IA64_SECTION 0x000B
3233 #define IMAGE_REL_IA64_SECREL22 0x000C
3234 #define IMAGE_REL_IA64_SECREL64I 0x000D
3235 #define IMAGE_REL_IA64_SECREL 0x000E
3236 #define IMAGE_REL_IA64_LTOFF64 0x000F
3237 #define IMAGE_REL_IA64_DIR32NB 0x0010
3238 #define IMAGE_REL_IA64_RESERVED_11 0x0011
3239 #define IMAGE_REL_IA64_RESERVED_12 0x0012
3240 #define IMAGE_REL_IA64_RESERVED_13 0x0013
3241 #define IMAGE_REL_IA64_RESERVED_14 0x0014
3242 #define IMAGE_REL_IA64_RESERVED_15 0x0015
3243 #define IMAGE_REL_IA64_RESERVED_16 0x0016
3244 #define IMAGE_REL_IA64_ADDEND 0x001F
3246 /* AMD64 relocation types */
3247 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3248 #define IMAGE_REL_AMD64_ADDR64 0x0001
3249 #define IMAGE_REL_AMD64_ADDR32 0x0002
3250 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3251 #define IMAGE_REL_AMD64_REL32 0x0004
3252 #define IMAGE_REL_AMD64_REL32_1 0x0005
3253 #define IMAGE_REL_AMD64_REL32_2 0x0006
3254 #define IMAGE_REL_AMD64_REL32_3 0x0007
3255 #define IMAGE_REL_AMD64_REL32_4 0x0008
3256 #define IMAGE_REL_AMD64_REL32_5 0x0009
3257 #define IMAGE_REL_AMD64_SECTION 0x000A
3258 #define IMAGE_REL_AMD64_SECREL 0x000B
3259 #define IMAGE_REL_AMD64_SECREL7 0x000C
3260 #define IMAGE_REL_AMD64_TOKEN 0x000D
3261 #define IMAGE_REL_AMD64_SREL32 0x000E
3262 #define IMAGE_REL_AMD64_PAIR 0x000F
3263 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3265 /* archive format */
3267 #define IMAGE_ARCHIVE_START_SIZE 8
3268 #define IMAGE_ARCHIVE_START "!<arch>\n"
3269 #define IMAGE_ARCHIVE_END "`\n"
3270 #define IMAGE_ARCHIVE_PAD "\n"
3271 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3272 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3274 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3283 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3285 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3287 typedef struct _IMPORT_OBJECT_HEADER
3293 DWORD TimeDateStamp
;
3303 } IMPORT_OBJECT_HEADER
;
3305 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3307 typedef enum IMPORT_OBJECT_TYPE
3309 IMPORT_OBJECT_CODE
= 0,
3310 IMPORT_OBJECT_DATA
= 1,
3311 IMPORT_OBJECT_CONST
= 2
3312 } IMPORT_OBJECT_TYPE
;
3314 typedef enum IMPORT_OBJECT_NAME_TYPE
3316 IMPORT_OBJECT_ORDINAL
= 0,
3317 IMPORT_OBJECT_NAME
= 1,
3318 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3319 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3320 } IMPORT_OBJECT_NAME_TYPE
;
3322 typedef struct _ANON_OBJECT_HEADER
3328 DWORD TimeDateStamp
;
3331 } ANON_OBJECT_HEADER
;
3334 * Resource directory stuff
3336 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3337 DWORD Characteristics
;
3338 DWORD TimeDateStamp
;
3341 WORD NumberOfNamedEntries
;
3342 WORD NumberOfIdEntries
;
3343 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3344 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3346 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3347 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3349 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3352 #ifdef BITFIELDS_BIGENDIAN
3353 unsigned NameIsString
:1;
3354 unsigned NameOffset
:31;
3356 unsigned NameOffset
:31;
3357 unsigned NameIsString
:1;
3362 #ifdef WORDS_BIGENDIAN
3374 #ifdef BITFIELDS_BIGENDIAN
3375 unsigned DataIsDirectory
:1;
3376 unsigned OffsetToDirectory
:31;
3378 unsigned OffsetToDirectory
:31;
3379 unsigned DataIsDirectory
:1;
3383 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3386 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3388 CHAR NameString
[ 1 ];
3389 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3391 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3393 WCHAR NameString
[ 1 ];
3394 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3396 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3401 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3404 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3405 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3408 typedef struct _IMAGE_TLS_DIRECTORY64
{
3409 ULONGLONG StartAddressOfRawData
;
3410 ULONGLONG EndAddressOfRawData
;
3411 ULONGLONG AddressOfIndex
;
3412 ULONGLONG AddressOfCallBacks
;
3413 DWORD SizeOfZeroFill
;
3414 DWORD Characteristics
;
3415 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3417 typedef struct _IMAGE_TLS_DIRECTORY32
{
3418 DWORD StartAddressOfRawData
;
3419 DWORD EndAddressOfRawData
;
3420 DWORD AddressOfIndex
;
3421 DWORD AddressOfCallBacks
;
3422 DWORD SizeOfZeroFill
;
3423 DWORD Characteristics
;
3424 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3427 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3428 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3430 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3431 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3434 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3435 DWORD Characteristics
;
3436 DWORD TimeDateStamp
;
3441 DWORD AddressOfRawData
;
3442 DWORD PointerToRawData
;
3443 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3445 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3446 #define IMAGE_DEBUG_TYPE_COFF 1
3447 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3448 #define IMAGE_DEBUG_TYPE_FPO 3
3449 #define IMAGE_DEBUG_TYPE_MISC 4
3450 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3451 #define IMAGE_DEBUG_TYPE_FIXUP 6
3452 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3453 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3454 #define IMAGE_DEBUG_TYPE_BORLAND 9
3455 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3457 typedef enum ReplacesCorHdrNumericDefines
3459 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3460 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3461 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3462 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3463 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3465 COR_VERSION_MAJOR_V2
= 2,
3466 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3467 COR_VERSION_MINOR
= 0,
3468 COR_DELETED_NAME_LENGTH
= 8,
3469 COR_VTABLEGAP_NAME_LENGTH
= 8,
3471 NATIVE_TYPE_MAX_CB
= 1,
3472 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3474 IMAGE_COR_MIH_METHODRVA
= 0x01,
3475 IMAGE_COR_MIH_EHRVA
= 0x02,
3476 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3478 COR_VTABLE_32BIT
= 0x01,
3479 COR_VTABLE_64BIT
= 0x02,
3480 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3481 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3483 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3485 MAX_CLASS_NAME
= 1024,
3486 MAX_PACKAGE_NAME
= 1024,
3487 } ReplacesCorHdrNumericDefines
;
3489 typedef struct IMAGE_COR20_HEADER
3492 WORD MajorRuntimeVersion
;
3493 WORD MinorRuntimeVersion
;
3495 IMAGE_DATA_DIRECTORY MetaData
;
3497 DWORD EntryPointToken
;
3499 IMAGE_DATA_DIRECTORY Resources
;
3500 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3501 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3502 IMAGE_DATA_DIRECTORY VTableFixups
;
3503 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3504 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3506 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3508 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3509 DWORD NumberOfSymbols
;
3510 DWORD LvaToFirstSymbol
;
3511 DWORD NumberOfLinenumbers
;
3512 DWORD LvaToFirstLinenumber
;
3513 DWORD RvaToFirstByteOfCode
;
3514 DWORD RvaToLastByteOfCode
;
3515 DWORD RvaToFirstByteOfData
;
3516 DWORD RvaToLastByteOfData
;
3517 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3520 #define FRAME_TRAP 1
3522 #define FRAME_NONFPO 3
3524 typedef struct _FPO_DATA
{
3535 } FPO_DATA
, *PFPO_DATA
;
3537 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
3539 DWORD TimeDateStamp
;
3542 DWORD GlobalFlagsClear
;
3543 DWORD GlobalFlagsSet
;
3544 DWORD CriticalSectionDefaultTimeout
;
3545 DWORD DeCommitFreeBlockThreshold
;
3546 DWORD DeCommitTotalFreeThreshold
;
3547 PVOID LockPrefixTable
;
3548 DWORD MaximumAllocationSize
;
3549 DWORD VirtualMemoryThreshold
;
3550 DWORD ProcessHeapFlags
;
3551 DWORD ProcessAffinityMask
;
3555 DWORD SecurityCookie
;
3556 DWORD SEHandlerTable
;
3557 DWORD SEHandlerCount
;
3558 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
3560 typedef struct _IMAGE_FUNCTION_ENTRY
{
3561 DWORD StartingAddress
;
3562 DWORD EndingAddress
;
3563 DWORD EndOfPrologue
;
3564 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3566 #define IMAGE_DEBUG_MISC_EXENAME 1
3568 typedef struct _IMAGE_DEBUG_MISC
{
3574 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3576 /* This is the structure that appears at the very start of a .DBG file. */
3578 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3582 WORD Characteristics
;
3583 DWORD TimeDateStamp
;
3587 DWORD NumberOfSections
;
3588 DWORD ExportedNamesSize
;
3589 DWORD DebugDirectorySize
;
3590 DWORD SectionAlignment
;
3591 DWORD Reserved
[ 2 ];
3592 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3594 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3597 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3601 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3602 #define MESSAGE_RESOURCE_UNICODE 0x0001
3604 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3607 DWORD OffsetToEntries
;
3608 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3610 typedef struct tagMESSAGE_RESOURCE_DATA
{
3611 DWORD NumberOfBlocks
;
3612 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3613 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3616 * Here follows typedefs for security and tokens.
3620 * First a constant for the following typedefs.
3623 #define ANYSIZE_ARRAY 1
3625 /* FIXME: Orphan. What does it point to? */
3626 typedef PVOID PACCESS_TOKEN
;
3627 typedef PVOID PSECURITY_DESCRIPTOR
;
3631 * TOKEN_INFORMATION_CLASS
3634 typedef enum _TOKEN_INFORMATION_CLASS
{
3643 TokenImpersonationLevel
,
3645 TokenRestrictedSids
,
3647 TokenGroupsAndPrivileges
,
3648 TokenSessionReference
,
3655 TokenHasRestrictions
,
3656 TokenAccessInformation
,
3657 TokenVirtualizationAllowed
,
3658 TokenVirtualizationEnabled
,
3659 TokenIntegrityLevel
,
3661 TokenMandatoryPolicy
,
3664 } TOKEN_INFORMATION_CLASS
;
3666 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3667 #define TOKEN_ADJUST_GROUPS 0x0040
3668 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3669 #define TOKEN_ADJUST_SESSIONID 0x0100
3670 #define TOKEN_ASSIGN_PRIMARY 0x0001
3671 #define TOKEN_DUPLICATE 0x0002
3672 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3673 #define TOKEN_IMPERSONATE 0x0004
3674 #define TOKEN_QUERY 0x0008
3675 #define TOKEN_QUERY_SOURCE 0x0010
3676 #define TOKEN_ADJUST_DEFAULT 0x0080
3677 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3678 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3679 TOKEN_ADJUST_PRIVILEGES | \
3680 TOKEN_ADJUST_GROUPS | \
3681 TOKEN_ADJUST_DEFAULT )
3682 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3683 TOKEN_ASSIGN_PRIMARY | \
3685 TOKEN_IMPERSONATE | \
3687 TOKEN_QUERY_SOURCE | \
3688 TOKEN_ADJUST_PRIVILEGES | \
3689 TOKEN_ADJUST_GROUPS | \
3690 TOKEN_ADJUST_SESSIONID | \
3691 TOKEN_ADJUST_DEFAULT )
3693 #ifndef _SECURITY_DEFINED
3694 #define _SECURITY_DEFINED
3697 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3699 typedef struct _GENERIC_MAPPING
{
3700 ACCESS_MASK GenericRead
;
3701 ACCESS_MASK GenericWrite
;
3702 ACCESS_MASK GenericExecute
;
3703 ACCESS_MASK GenericAll
;
3704 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3706 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3707 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3710 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3711 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3715 typedef struct _SID
{
3717 BYTE SubAuthorityCount
;
3718 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3719 DWORD SubAuthority
[1];
3721 #endif /* !defined(SID_DEFINED) */
3723 #define SID_REVISION (1) /* Current revision */
3724 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3725 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3727 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3733 #define ACL_REVISION1 1
3734 #define ACL_REVISION2 2
3735 #define ACL_REVISION3 3
3736 #define ACL_REVISION4 4
3738 #define MIN_ACL_REVISION ACL_REVISION2
3739 #define MAX_ACL_REVISION ACL_REVISION4
3741 #define ACL_REVISION 2
3743 typedef struct _ACL
{
3751 typedef enum _ACL_INFORMATION_CLASS
3753 AclRevisionInformation
= 1,
3755 } ACL_INFORMATION_CLASS
;
3757 typedef struct _ACL_REVISION_INFORMATION
3760 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
3762 typedef struct _ACL_SIZE_INFORMATION
3765 DWORD AclBytesInUse
;
3767 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
3769 /* SECURITY_DESCRIPTOR */
3770 #define SECURITY_DESCRIPTOR_REVISION 1
3771 #define SECURITY_DESCRIPTOR_REVISION1 1
3777 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3778 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3779 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3780 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3781 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3782 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3783 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3784 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3785 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3786 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3787 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3788 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3789 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3790 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3791 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3792 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3793 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3794 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3795 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3796 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3797 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3798 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3799 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3800 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3801 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3802 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3803 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3804 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3805 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3807 #define SE_GROUP_MANDATORY 0x00000001
3808 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3809 #define SE_GROUP_ENABLED 0x00000004
3810 #define SE_GROUP_OWNER 0x00000008
3811 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3812 #define SE_GROUP_LOGON_ID 0xC0000000
3813 #define SE_GROUP_RESOURCE 0x20000000
3815 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3816 #define SE_PRIVILEGE_ENABLED 0x00000002
3817 #define SE_PRIVILEGE_REMOVE 0x00000004
3818 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3820 #define PRIVILEGE_SET_ALL_NECESSARY 1
3822 #define SE_OWNER_DEFAULTED 0x00000001
3823 #define SE_GROUP_DEFAULTED 0x00000002
3824 #define SE_DACL_PRESENT 0x00000004
3825 #define SE_DACL_DEFAULTED 0x00000008
3826 #define SE_SACL_PRESENT 0x00000010
3827 #define SE_SACL_DEFAULTED 0x00000020
3828 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3829 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3830 #define SE_DACL_AUTO_INHERITED 0x00000400
3831 #define SE_SACL_AUTO_INHERITED 0x00000800
3832 #define SE_DACL_PROTECTED 0x00001000
3833 #define SE_SACL_PROTECTED 0x00002000
3834 #define SE_RM_CONTROL_VALID 0x00004000
3835 #define SE_SELF_RELATIVE 0x00008000
3837 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
3838 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
3840 /* The security descriptor structure */
3844 SECURITY_DESCRIPTOR_CONTROL Control
;
3849 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
3854 SECURITY_DESCRIPTOR_CONTROL Control
;
3859 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
3861 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3863 #endif /* _SECURITY_DEFINED */
3866 * SID_AND_ATTRIBUTES
3869 typedef struct _SID_AND_ATTRIBUTES
{
3872 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
3874 /* security entities */
3875 #define SECURITY_NULL_RID (0x00000000L)
3876 #define SECURITY_WORLD_RID (0x00000000L)
3877 #define SECURITY_LOCAL_RID (0X00000000L)
3879 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3882 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3885 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3888 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3889 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
3890 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
3891 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
3892 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
3895 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3898 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3899 #define SECURITY_DIALUP_RID 0x00000001L
3900 #define SECURITY_NETWORK_RID 0x00000002L
3901 #define SECURITY_BATCH_RID 0x00000003L
3902 #define SECURITY_INTERACTIVE_RID 0x00000004L
3903 #define SECURITY_LOGON_IDS_RID 0x00000005L
3904 #define SECURITY_SERVICE_RID 0x00000006L
3905 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
3906 #define SECURITY_PROXY_RID 0x00000008L
3907 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
3908 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3909 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
3910 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
3911 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
3912 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
3913 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
3914 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
3915 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
3916 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
3917 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
3918 #define SECURITY_NT_NON_UNIQUE 0x00000015L
3919 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
3921 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
3922 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
3923 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
3924 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
3925 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
3926 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
3927 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
3929 #define FOREST_USER_RID_MAX 0x000001F3L
3930 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
3931 #define DOMAIN_USER_RID_GUEST 0x000001F5L
3932 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
3933 #define DOMAIN_USER_RID_MAX 0x000003E7L
3935 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
3936 #define DOMAIN_GROUP_RID_USERS 0x00000201L
3937 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
3938 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
3939 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
3940 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
3941 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
3942 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
3943 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
3945 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
3946 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
3947 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
3948 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
3949 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
3950 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
3951 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
3953 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
3954 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
3955 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
3956 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
3958 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
3959 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
3960 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
3961 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
3963 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
3964 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
3965 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
3966 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
3967 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
3968 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
3970 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
3971 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
3972 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
3973 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
3974 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
3976 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3978 #define SECURITY_PACKAGE_RID_COUNT 2L
3979 #define SECURITY_LOGON_IDS_RID_COUNT 3L
3985 WinCreatorOwnerSid
= 3,
3986 WinCreatorGroupSid
= 4,
3987 WinCreatorOwnerServerSid
= 5,
3988 WinCreatorGroupServerSid
= 6,
3989 WinNtAuthoritySid
= 7,
3993 WinInteractiveSid
= 11,
3995 WinAnonymousSid
= 13,
3997 WinEnterpriseControllersSid
= 15,
3999 WinAuthenticatedUserSid
= 17,
4000 WinRestrictedCodeSid
= 18,
4001 WinTerminalServerSid
= 19,
4002 WinRemoteLogonIdSid
= 20,
4003 WinLogonIdsSid
= 21,
4004 WinLocalSystemSid
= 22,
4005 WinLocalServiceSid
= 23,
4006 WinNetworkServiceSid
= 24,
4007 WinBuiltinDomainSid
= 25,
4008 WinBuiltinAdministratorsSid
= 26,
4009 WinBuiltinUsersSid
= 27,
4010 WinBuiltinGuestsSid
= 28,
4011 WinBuiltinPowerUsersSid
= 29,
4012 WinBuiltinAccountOperatorsSid
= 30,
4013 WinBuiltinSystemOperatorsSid
= 31,
4014 WinBuiltinPrintOperatorsSid
= 32,
4015 WinBuiltinBackupOperatorsSid
= 33,
4016 WinBuiltinReplicatorSid
= 34,
4017 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
4018 WinBuiltinRemoteDesktopUsersSid
= 36,
4019 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
4020 WinAccountAdministratorSid
= 38,
4021 WinAccountGuestSid
= 39,
4022 WinAccountKrbtgtSid
= 40,
4023 WinAccountDomainAdminsSid
= 41,
4024 WinAccountDomainUsersSid
= 42,
4025 WinAccountDomainGuestsSid
= 43,
4026 WinAccountComputersSid
= 44,
4027 WinAccountControllersSid
= 45,
4028 WinAccountCertAdminsSid
= 46,
4029 WinAccountSchemaAdminsSid
= 47,
4030 WinAccountEnterpriseAdminsSid
= 48,
4031 WinAccountPolicyAdminsSid
= 49,
4032 WinAccountRasAndIasServersSid
= 50,
4033 WinNTLMAuthenticationSid
= 51,
4034 WinDigestAuthenticationSid
= 52,
4035 WinSChannelAuthenticationSid
= 53,
4036 WinThisOrganizationSid
= 54,
4037 WinOtherOrganizationSid
= 55,
4038 WinBuiltinIncomingForestTrustBuildersSid
= 56,
4039 WinBuiltinPerfMonitoringUsersSid
= 57,
4040 WinBuiltinPerfLoggingUsersSid
= 58,
4041 WinBuiltinAuthorizationAccessSid
= 59,
4042 WinBuiltinTerminalServerLicenseServersSid
= 60,
4043 WinBuiltinDCOMUsersSid
= 61,
4044 WinBuiltinIUsersSid
= 62,
4046 WinBuiltinCryptoOperatorsSid
= 64,
4047 WinUntrustedLabelSid
= 65,
4048 WinLowLabelSid
= 66,
4049 WinMediumLabelSid
= 67,
4050 WinHighLabelSid
= 68,
4051 WinSystemLabelSid
= 69,
4052 WinWriteRestrictedCodeSid
= 70,
4053 WinCreatorOwnerRightsSid
= 71,
4054 WinCacheablePrincipalsGroupSid
= 72,
4055 WinNonCacheablePrincipalsGroupSid
= 73,
4056 WinEnterpriseReadonlyControllersSid
= 74,
4057 WinAccountReadonlyControllersSid
= 75,
4058 WinBuiltinEventLogReadersGroup
= 76,
4059 } WELL_KNOWN_SID_TYPE
;
4065 typedef struct _TOKEN_USER
{
4066 SID_AND_ATTRIBUTES User
;
4067 } TOKEN_USER
, *PTOKEN_USER
;
4073 typedef struct _TOKEN_GROUPS
{
4075 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
4076 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
4079 * LUID_AND_ATTRIBUTES
4082 typedef union _LARGE_INTEGER
{
4084 #ifdef WORDS_BIGENDIAN
4092 #ifndef NONAMELESSSTRUCT
4094 #ifdef WORDS_BIGENDIAN
4104 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4106 typedef union _ULARGE_INTEGER
{
4108 #ifdef WORDS_BIGENDIAN
4116 #ifndef NONAMELESSSTRUCT
4118 #ifdef WORDS_BIGENDIAN
4128 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4131 * Locally Unique Identifier
4134 typedef struct _LUID
{
4139 #include <pshpack4.h>
4140 typedef struct _LUID_AND_ATTRIBUTES
{
4143 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4144 #include <poppack.h>
4150 typedef struct _PRIVILEGE_SET
{
4151 DWORD PrivilegeCount
;
4153 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4154 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4160 typedef struct _TOKEN_PRIVILEGES
{
4161 DWORD PrivilegeCount
;
4162 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4163 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4169 typedef struct _TOKEN_OWNER
{
4171 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4174 * TOKEN_PRIMARY_GROUP
4177 typedef struct _TOKEN_PRIMARY_GROUP
{
4179 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4183 * TOKEN_DEFAULT_DACL
4186 typedef struct _TOKEN_DEFAULT_DACL
{
4188 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4194 #define TOKEN_SOURCE_LENGTH 8
4196 typedef struct _TOKEN_SOURCE
{
4197 char SourceName
[TOKEN_SOURCE_LENGTH
];
4198 LUID SourceIdentifier
;
4199 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4205 typedef enum tagTOKEN_TYPE
{
4211 * SECURITY_IMPERSONATION_LEVEL
4214 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4216 SecurityIdentification
,
4217 SecurityImpersonation
,
4219 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4221 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4222 #define SECURITY_STATIC_TRACKING (FALSE)
4224 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4225 * PSECURITY_CONTEXT_TRACKING_MODE
;
4227 * Quality of Service
4230 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4232 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4233 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4234 BOOLEAN EffectiveOnly
;
4235 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4241 #include <pshpack4.h>
4242 typedef struct _TOKEN_STATISTICS
{
4244 LUID AuthenticationId
;
4245 LARGE_INTEGER ExpirationTime
;
4246 TOKEN_TYPE TokenType
;
4247 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4248 DWORD DynamicCharged
;
4249 DWORD DynamicAvailable
;
4251 DWORD PrivilegeCount
;
4254 #include <poppack.h>
4260 /* ACEs, directly starting after an ACL */
4261 typedef struct _ACE_HEADER
{
4265 } ACE_HEADER
,*PACE_HEADER
;
4268 #define ACCESS_ALLOWED_ACE_TYPE 0
4269 #define ACCESS_DENIED_ACE_TYPE 1
4270 #define SYSTEM_AUDIT_ACE_TYPE 2
4271 #define SYSTEM_ALARM_ACE_TYPE 3
4273 /* inherit AceFlags */
4274 #define OBJECT_INHERIT_ACE 0x01
4275 #define CONTAINER_INHERIT_ACE 0x02
4276 #define NO_PROPAGATE_INHERIT_ACE 0x04
4277 #define INHERIT_ONLY_ACE 0x08
4278 #define INHERITED_ACE 0x10
4279 #define VALID_INHERIT_FLAGS 0x1F
4281 /* AceFlags mask for what events we (should) audit */
4282 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4283 #define FAILED_ACCESS_ACE_FLAG 0x80
4285 /* different ACEs depending on AceType
4286 * SidStart marks the begin of a SID
4287 * so the thing finally looks like this:
4292 typedef struct _ACCESS_ALLOWED_ACE
{
4296 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4298 typedef struct _ACCESS_DENIED_ACE
{
4302 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4304 typedef struct _SYSTEM_AUDIT_ACE
{
4308 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4310 typedef struct _SYSTEM_ALARM_ACE
{
4314 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4316 typedef enum tagSID_NAME_USE
{
4321 SidTypeWellKnownGroup
,
4322 SidTypeDeletedAccount
,
4325 } SID_NAME_USE
,*PSID_NAME_USE
;
4327 #define ACE_OBJECT_TYPE_PRESENT 0x1
4328 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4332 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4334 #define DELETE 0x00010000
4335 #define READ_CONTROL 0x00020000
4336 #define WRITE_DAC 0x00040000
4337 #define WRITE_OWNER 0x00080000
4338 #define SYNCHRONIZE 0x00100000
4339 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4341 #define STANDARD_RIGHTS_READ READ_CONTROL
4342 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4343 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4345 #define STANDARD_RIGHTS_ALL 0x001f0000
4347 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4349 #define GENERIC_READ 0x80000000
4350 #define GENERIC_WRITE 0x40000000
4351 #define GENERIC_EXECUTE 0x20000000
4352 #define GENERIC_ALL 0x10000000
4354 #define MAXIMUM_ALLOWED 0x02000000
4355 #define ACCESS_SYSTEM_SECURITY 0x01000000
4357 #define EVENT_QUERY_STATE 0x0001
4358 #define EVENT_MODIFY_STATE 0x0002
4359 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4361 #define SEMAPHORE_MODIFY_STATE 0x0002
4362 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4364 #define MUTEX_MODIFY_STATE 0x0001
4365 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4367 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4368 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4369 #define JOB_OBJECT_QUERY 0x0004
4370 #define JOB_OBJECT_TERMINATE 0x0008
4371 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4372 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4374 #define TIMER_QUERY_STATE 0x0001
4375 #define TIMER_MODIFY_STATE 0x0002
4376 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4378 #define PROCESS_TERMINATE 0x0001
4379 #define PROCESS_CREATE_THREAD 0x0002
4380 #define PROCESS_VM_OPERATION 0x0008
4381 #define PROCESS_VM_READ 0x0010
4382 #define PROCESS_VM_WRITE 0x0020
4383 #define PROCESS_DUP_HANDLE 0x0040
4384 #define PROCESS_CREATE_PROCESS 0x0080
4385 #define PROCESS_SET_QUOTA 0x0100
4386 #define PROCESS_SET_INFORMATION 0x0200
4387 #define PROCESS_QUERY_INFORMATION 0x0400
4388 #define PROCESS_SUSPEND_RESUME 0x0800
4389 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4390 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4392 #define THREAD_TERMINATE 0x0001
4393 #define THREAD_SUSPEND_RESUME 0x0002
4394 #define THREAD_GET_CONTEXT 0x0008
4395 #define THREAD_SET_CONTEXT 0x0010
4396 #define THREAD_SET_INFORMATION 0x0020
4397 #define THREAD_QUERY_INFORMATION 0x0040
4398 #define THREAD_SET_THREAD_TOKEN 0x0080
4399 #define THREAD_IMPERSONATE 0x0100
4400 #define THREAD_DIRECT_IMPERSONATION 0x0200
4401 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4403 #define THREAD_BASE_PRIORITY_LOWRT 15
4404 #define THREAD_BASE_PRIORITY_MAX 2
4405 #define THREAD_BASE_PRIORITY_MIN -2
4406 #define THREAD_BASE_PRIORITY_IDLE -15
4408 typedef struct _QUOTA_LIMITS
{
4409 SIZE_T PagedPoolLimit
;
4410 SIZE_T NonPagedPoolLimit
;
4411 SIZE_T MinimumWorkingSetSize
;
4412 SIZE_T MaximumWorkingSetSize
;
4413 SIZE_T PagefileLimit
;
4414 LARGE_INTEGER TimeLimit
;
4415 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
4417 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4418 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4419 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4420 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4422 typedef struct _QUOTA_LIMITS_EX
{
4423 SIZE_T PagedPoolLimit
;
4424 SIZE_T NonPagedPoolLimit
;
4425 SIZE_T MinimumWorkingSetSize
;
4426 SIZE_T MaximumWorkingSetSize
;
4427 SIZE_T PagefileLimit
;
4428 LARGE_INTEGER TimeLimit
;
4435 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
4437 #define SECTION_QUERY 0x0001
4438 #define SECTION_MAP_WRITE 0x0002
4439 #define SECTION_MAP_READ 0x0004
4440 #define SECTION_MAP_EXECUTE 0x0008
4441 #define SECTION_EXTEND_SIZE 0x0010
4442 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4443 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4445 #define FILE_READ_DATA 0x0001 /* file & pipe */
4446 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4447 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4448 #define FILE_ADD_FILE 0x0002 /* directory */
4449 #define FILE_APPEND_DATA 0x0004 /* file */
4450 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4451 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4452 #define FILE_READ_EA 0x0008 /* file & directory */
4453 #define FILE_READ_PROPERTIES FILE_READ_EA
4454 #define FILE_WRITE_EA 0x0010 /* file & directory */
4455 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4456 #define FILE_EXECUTE 0x0020 /* file */
4457 #define FILE_TRAVERSE 0x0020 /* directory */
4458 #define FILE_DELETE_CHILD 0x0040 /* directory */
4459 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4460 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4461 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4463 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4464 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4466 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4467 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4468 FILE_APPEND_DATA | SYNCHRONIZE)
4469 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4470 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4472 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4473 #define DUPLICATE_SAME_ACCESS 0x00000002
4475 /* File attribute flags */
4476 #define FILE_SHARE_READ 0x00000001L
4477 #define FILE_SHARE_WRITE 0x00000002L
4478 #define FILE_SHARE_DELETE 0x00000004L
4480 #define FILE_ATTRIBUTE_READONLY 0x00000001
4481 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4482 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4483 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4484 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4485 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4486 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4487 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4488 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4489 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4490 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4491 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4492 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4493 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4495 /* File notification flags */
4496 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4497 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4498 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4499 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4500 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4501 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4502 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4503 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4504 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4505 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4506 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4507 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4509 #define FILE_ACTION_ADDED 0x00000001
4510 #define FILE_ACTION_REMOVED 0x00000002
4511 #define FILE_ACTION_MODIFIED 0x00000003
4512 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4513 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4514 #define FILE_ACTION_ADDED_STREAM 0x00000006
4515 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4516 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4518 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4519 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4520 #define FILE_UNICODE_ON_DISK 0x00000004
4521 #define FILE_PERSISTENT_ACLS 0x00000008
4522 #define FILE_FILE_COMPRESSION 0x00000010
4523 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4524 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4525 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4526 #define FILE_NAMED_STREAMS 0x00040000
4527 #define FILE_READ_ONLY_VOLUME 0x00080000
4529 /* File alignments (NT) */
4530 #define FILE_BYTE_ALIGNMENT 0x00000000
4531 #define FILE_WORD_ALIGNMENT 0x00000001
4532 #define FILE_LONG_ALIGNMENT 0x00000003
4533 #define FILE_QUAD_ALIGNMENT 0x00000007
4534 #define FILE_OCTA_ALIGNMENT 0x0000000f
4535 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4536 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4537 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4538 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4539 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4541 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4542 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4544 #define REG_NONE 0 /* no type */
4545 #define REG_SZ 1 /* string type (ASCII) */
4546 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4547 #define REG_BINARY 3 /* binary format, callerspecific */
4548 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4549 #define REG_DWORD 4 /* DWORD in little endian format */
4550 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4551 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4552 #define REG_LINK 6 /* symbolic link (UNICODE) */
4553 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4554 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4555 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4556 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4557 #define REG_QWORD 11 /* QWORD in little endian format */
4558 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4560 /* ----------------------------- begin power management --------------------- */
4562 typedef enum _LATENCY_TIME
{
4565 } LATENCY_TIME
, *PLATENCY_TIME
;
4567 #define DISCHARGE_POLICY_CRITICAL 0
4568 #define DISCHARGE_POLICY_LOW 1
4569 #define NUM_DISCHARGE_POLICIES 4
4571 #define PO_THROTTLE_NONE 0
4572 #define PO_THROTTLE_CONSTANT 1
4573 #define PO_THROTTLE_DEGRADE 2
4574 #define PO_THROTTLE_ADAPTIVE 3
4576 typedef enum _POWER_ACTION
{
4577 PowerActionNone
= 0,
4578 PowerActionReserved
,
4580 PowerActionHibernate
,
4581 PowerActionShutdown
,
4582 PowerActionShutdownReset
,
4583 PowerActionShutdownOff
,
4584 PowerActionWarmEject
4588 typedef enum _SYSTEM_POWER_STATE
{
4589 PowerSystemUnspecified
= 0,
4590 PowerSystemWorking
= 1,
4591 PowerSystemSleeping1
= 2,
4592 PowerSystemSleeping2
= 3,
4593 PowerSystemSleeping3
= 4,
4594 PowerSystemHibernate
= 5,
4595 PowerSystemShutdown
= 6,
4596 PowerSystemMaximum
= 7
4597 } SYSTEM_POWER_STATE
,
4598 *PSYSTEM_POWER_STATE
;
4600 typedef enum _DEVICE_POWER_STATE
{
4601 PowerDeviceUnspecified
,
4607 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
4609 typedef enum _POWER_INFORMATION_LEVEL
{
4610 SystemPowerPolicyAc
,
4611 SystemPowerPolicyDc
,
4612 VerifySystemPolicyAc
,
4613 VerifySystemPolicyDc
,
4614 SystemPowerCapabilities
,
4616 SystemPowerStateHandler
,
4617 ProcessorStateHandler
,
4618 SystemPowerPolicyCurrent
,
4619 AdministratorPowerPolicy
,
4620 SystemReserveHiberFile
,
4621 ProcessorInformation
,
4622 SystemPowerInformation
,
4623 ProcessorStateHandler2
,
4626 SystemExecutionState
,
4627 SystemPowerStateNotifyHandler
,
4628 ProcessorPowerPolicyAc
,
4629 ProcessorPowerPolicyDc
,
4630 VerifyProcessorPowerPolicyAc
,
4631 VerifyProcessorPowerPolicyDc
,
4632 ProcessorPowerPolicyCurrent
4633 } POWER_INFORMATION_LEVEL
;
4635 typedef struct _ADMINISTRATOR_POWER_POLICY
{
4636 SYSTEM_POWER_STATE MinSleep
;
4637 SYSTEM_POWER_STATE MaxSleep
;
4638 ULONG MinVideoTimeout
;
4639 ULONG MaxVideoTimeout
;
4640 ULONG MinSpindownTimeout
;
4641 ULONG MaxSpindownTimeout
;
4642 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
4647 } BATTERY_REPORTING_SCALE
,
4648 *PBATTERY_REPORTING_SCALE
;
4651 POWER_ACTION Action
;
4654 } POWER_ACTION_POLICY
,
4655 *PPOWER_ACTION_POLICY
;
4657 typedef struct _PROCESSOR_POWER_INFORMATION
{
4663 ULONG CurrentIdleState
;
4664 } PROCESSOR_POWER_INFORMATION
,
4665 *PPROCESSOR_POWER_INFORMATION
;
4667 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
4671 UCHAR DemotePercent
;
4672 UCHAR PromotePercent
;
4674 ULONG AllowDemotion
:1;
4675 ULONG AllowPromotion
:1;
4677 } PROCESSOR_POWER_POLICY_INFO
,
4678 *PPROCESSOR_POWER_POLICY_INFO
;
4680 typedef struct _PROCESSOR_POWER_POLICY
{
4682 BYTE DynamicThrottle
;
4684 DWORD DisableCStates
:1;
4687 PROCESSOR_POWER_POLICY_INFO Policy
[3];
4688 } PROCESSOR_POWER_POLICY
,
4689 *PPROCESSOR_POWER_POLICY
;
4693 BOOLEAN BatteryPresent
;
4695 BOOLEAN Discharging
;
4698 ULONG RemainingCapacity
;
4700 ULONG EstimatedTime
;
4701 ULONG DefaultAlert1
;
4702 ULONG DefaultAlert2
;
4703 } SYSTEM_BATTERY_STATE
,
4704 *PSYSTEM_BATTERY_STATE
;
4707 BOOLEAN PowerButtonPresent
;
4708 BOOLEAN SleepButtonPresent
;
4715 BOOLEAN HiberFilePresent
;
4717 BOOLEAN VideoDimPresent
;
4720 BOOLEAN ThermalControl
;
4721 BOOLEAN ProcessorThrottle
;
4722 UCHAR ProcessorMinThrottle
;
4723 UCHAR ProcessorMaxThrottle
;
4725 BOOLEAN DiskSpinDown
;
4727 BOOLEAN SystemBatteriesPresent
;
4728 BOOLEAN BatteriesAreShortTerm
;
4729 BATTERY_REPORTING_SCALE BatteryScale
[3];
4730 SYSTEM_POWER_STATE AcOnLineWake
;
4731 SYSTEM_POWER_STATE SoftLidWake
;
4732 SYSTEM_POWER_STATE RtcWake
;
4733 SYSTEM_POWER_STATE MinDeviceWakeState
;
4734 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
4735 } SYSTEM_POWER_CAPABILITIES
,
4736 *PSYSTEM_POWER_CAPABILITIES
;
4738 typedef struct _SYSTEM_POWER_INFORMATION
{
4739 ULONG MaxIdlenessAllowed
;
4741 ULONG TimeRemaining
;
4743 } SYSTEM_POWER_INFORMATION
,
4744 *PSYSTEM_POWER_INFORMATION
;
4746 typedef struct _SYSTEM_POWER_LEVEL
{
4750 POWER_ACTION_POLICY PowerPolicy
;
4751 SYSTEM_POWER_STATE MinSystemState
;
4752 } SYSTEM_POWER_LEVEL
,
4753 *PSYSTEM_POWER_LEVEL
;
4755 typedef struct _SYSTEM_POWER_POLICY
{
4757 POWER_ACTION_POLICY PowerButton
;
4758 POWER_ACTION_POLICY SleepButton
;
4759 POWER_ACTION_POLICY LidClose
;
4760 SYSTEM_POWER_STATE LidOpenWake
;
4762 POWER_ACTION_POLICY Idle
;
4764 UCHAR IdleSensitivity
;
4765 UCHAR DynamicThrottle
;
4767 SYSTEM_POWER_STATE MinSleep
;
4768 SYSTEM_POWER_STATE MaxSleep
;
4769 SYSTEM_POWER_STATE ReducedLatencySleep
;
4770 ULONG WinLogonFlags
;
4772 ULONG DozeS4Timeout
;
4773 ULONG BroadcastCapacityResolution
;
4774 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
4776 BOOLEAN VideoDimDisplay
;
4777 ULONG VideoReserved
[3];
4778 ULONG SpindownTimeout
;
4779 BOOLEAN OptimizeForPower
;
4780 UCHAR FanThrottleTolerance
;
4781 UCHAR ForcedThrottle
;
4783 POWER_ACTION_POLICY OverThrottled
;
4784 } SYSTEM_POWER_POLICY
,
4785 *PSYSTEM_POWER_POLICY
;
4787 typedef union _FILE_SEGMENT_ELEMENT
{
4789 ULONGLONG Alignment
;
4790 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
4792 typedef struct _FILE_NOTIFY_INFORMATION
{
4793 DWORD NextEntryOffset
;
4795 DWORD FileNameLength
;
4797 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
4799 /* ----------------------------- begin tape storage --------------------- */
4801 #define TAPE_FIXED_PARTITIONS 0
4802 #define TAPE_SELECT_PARTITIONS 1
4803 #define TAPE_INITIATOR_PARTITIONS 2
4804 #define TAPE_ERASE_SHORT 0
4805 #define TAPE_ERASE_LONG 1
4807 #define TAPE_UNLOAD 1
4808 #define TAPE_TENSION 2
4810 #define TAPE_UNLOCK 4
4811 #define TAPE_FORMAT 5
4812 #define TAPE_SETMARKS 0
4813 #define TAPE_FILEMARKS 1
4814 #define TAPE_SHORT_FILEMARKS 2
4815 #define TAPE_LONG_FILEMARKS 3
4816 #define TAPE_REWIND 0
4817 #define TAPE_ABSOLUTE_BLOCK 1
4818 #define TAPE_LOGICAL_BLOCK 2
4819 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4820 #define TAPE_SPACE_END_OF_DATA 4
4821 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4822 #define TAPE_SPACE_FILEMARKS 6
4823 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4824 #define TAPE_SPACE_SETMARKS 8
4825 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4827 typedef struct _TAPE_CREATE_PARTITION
{
4831 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
4833 typedef struct _TAPE_ERASE
{
4836 } TAPE_ERASE
, *PTAPE_ERASE
;
4838 typedef struct _TAPE_PREPARE
{
4841 } TAPE_PREPARE
, *PTAPE_PREPARE
;
4843 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
4845 BOOLEAN Compression
;
4846 BOOLEAN DataPadding
;
4847 BOOLEAN ReportSetmarks
;
4848 ULONG EOTWarningZoneSize
;
4849 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
4851 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
4853 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
4855 typedef struct _TAPE_WRITE_MARKS
{
4859 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
4861 typedef struct _TAPE_GET_POSITION
{
4866 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
4868 typedef struct _TAPE_SET_POSITION
{
4871 LARGE_INTEGER Offset
;
4873 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
4875 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
4877 BOOLEAN Compression
;
4878 BOOLEAN DataPadding
;
4879 BOOLEAN ReportSetmarks
;
4880 DWORD DefaultBlockSize
;
4881 DWORD MaximumBlockSize
;
4882 DWORD MinimumBlockSize
;
4883 DWORD MaximumPartitionCount
;
4886 DWORD EOTWarningZoneSize
;
4887 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
4889 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
4890 LARGE_INTEGER Capacity
;
4891 LARGE_INTEGER Remaining
;
4893 DWORD PartitionCount
;
4894 BOOLEAN WriteProtected
;
4895 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
4897 /* ----------------------------- begin registry ----------------------------- */
4899 /* Registry security values */
4900 #define OWNER_SECURITY_INFORMATION 0x00000001
4901 #define GROUP_SECURITY_INFORMATION 0x00000002
4902 #define DACL_SECURITY_INFORMATION 0x00000004
4903 #define SACL_SECURITY_INFORMATION 0x00000008
4905 #define REG_OPTION_RESERVED 0x00000000
4906 #define REG_OPTION_NON_VOLATILE 0x00000000
4907 #define REG_OPTION_VOLATILE 0x00000001
4908 #define REG_OPTION_CREATE_LINK 0x00000002
4909 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4910 #define REG_OPTION_OPEN_LINK 0x00000008
4911 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4912 REG_OPTION_NON_VOLATILE| \
4913 REG_OPTION_VOLATILE| \
4914 REG_OPTION_CREATE_LINK| \
4915 REG_OPTION_BACKUP_RESTORE| \
4916 REG_OPTION_OPEN_LINK)
4919 #define REG_CREATED_NEW_KEY 0x00000001
4920 #define REG_OPENED_EXISTING_KEY 0x00000002
4922 /* For RegNotifyChangeKeyValue */
4923 #define REG_NOTIFY_CHANGE_NAME 0x01
4924 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4925 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4926 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4928 #define KEY_QUERY_VALUE 0x00000001
4929 #define KEY_SET_VALUE 0x00000002
4930 #define KEY_CREATE_SUB_KEY 0x00000004
4931 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4932 #define KEY_NOTIFY 0x00000010
4933 #define KEY_CREATE_LINK 0x00000020
4934 #define KEY_WOW64_64KEY 0x00000100
4935 #define KEY_WOW64_32KEY 0x00000200
4936 #define KEY_WOW64_RES 0x00000300
4938 /* for RegKeyRestore flags */
4939 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4940 #define REG_REFRESH_HIVE 0x00000002
4941 #define REG_NO_LAZY_FLUSH 0x00000004
4942 #define REG_FORCE_RESTORE 0x00000008
4944 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4946 KEY_ENUMERATE_SUB_KEYS| \
4950 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4952 KEY_CREATE_SUB_KEY) \
4955 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4956 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4959 KEY_CREATE_SUB_KEY| \
4960 KEY_ENUMERATE_SUB_KEYS| \
4965 /* ------------------------------ end registry ------------------------------ */
4968 #define EVENTLOG_SUCCESS 0x0000
4969 #define EVENTLOG_ERROR_TYPE 0x0001
4970 #define EVENTLOG_WARNING_TYPE 0x0002
4971 #define EVENTLOG_INFORMATION_TYPE 0x0004
4972 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4973 #define EVENTLOG_AUDIT_FAILURE 0x0010
4975 #define EVENTLOG_SEQUENTIAL_READ 0x0001
4976 #define EVENTLOG_SEEK_READ 0x0002
4977 #define EVENTLOG_FORWARDS_READ 0x0004
4978 #define EVENTLOG_BACKWARDS_READ 0x0008
4980 typedef struct _EVENTLOGRECORD
{
4984 DWORD TimeGenerated
;
4991 DWORD ClosingRecordNumber
;
4993 DWORD UserSidLength
;
4994 DWORD UserSidOffset
;
4997 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
4999 #define SERVICE_BOOT_START 0x00000000
5000 #define SERVICE_SYSTEM_START 0x00000001
5001 #define SERVICE_AUTO_START 0x00000002
5002 #define SERVICE_DEMAND_START 0x00000003
5003 #define SERVICE_DISABLED 0x00000004
5005 #define SERVICE_ERROR_IGNORE 0x00000000
5006 #define SERVICE_ERROR_NORMAL 0x00000001
5007 #define SERVICE_ERROR_SEVERE 0x00000002
5008 #define SERVICE_ERROR_CRITICAL 0x00000003
5011 #define SERVICE_KERNEL_DRIVER 0x00000001
5012 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5013 #define SERVICE_ADAPTER 0x00000004
5014 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5016 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5017 SERVICE_RECOGNIZER_DRIVER )
5019 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5020 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5021 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5023 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5025 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5026 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5029 typedef enum _CM_SERVICE_NODE_TYPE
5031 DriverType
= SERVICE_KERNEL_DRIVER
,
5032 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
5033 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
5034 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
5035 AdapterType
= SERVICE_ADAPTER
,
5036 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
5037 } SERVICE_NODE_TYPE
;
5039 typedef enum _CM_SERVICE_LOAD_TYPE
5041 BootLoad
= SERVICE_BOOT_START
,
5042 SystemLoad
= SERVICE_SYSTEM_START
,
5043 AutoLoad
= SERVICE_AUTO_START
,
5044 DemandLoad
= SERVICE_DEMAND_START
,
5045 DisableLoad
= SERVICE_DISABLED
5046 } SERVICE_LOAD_TYPE
;
5048 typedef enum _CM_ERROR_CONTROL_TYPE
5050 IgnoreError
= SERVICE_ERROR_IGNORE
,
5051 NormalError
= SERVICE_ERROR_NORMAL
,
5052 SevereError
= SERVICE_ERROR_SEVERE
,
5053 CriticalError
= SERVICE_ERROR_CRITICAL
5054 } SERVICE_ERROR_TYPE
;
5058 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5059 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5060 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5061 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5062 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5064 #include <guiddef.h>
5066 typedef struct _OBJECT_TYPE_LIST
{
5070 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
5072 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5075 WORD CreatorBackTraceIndex
;
5076 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
5077 LIST_ENTRY ProcessLocksList
;
5079 DWORD ContentionCount
;
5080 #ifdef __WINESRC__ /* in Wine we store the name here */
5081 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
5085 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
5087 typedef struct _RTL_CRITICAL_SECTION
{
5088 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
5090 LONG RecursionCount
;
5091 HANDLE OwningThread
;
5092 HANDLE LockSemaphore
;
5093 ULONG_PTR SpinCount
;
5094 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
5096 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5097 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5098 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5099 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5100 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5102 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
5103 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5105 #include <pshpack8.h>
5106 typedef struct _IO_COUNTERS
{
5107 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5108 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5109 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5110 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5111 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5112 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5113 } IO_COUNTERS
, *PIO_COUNTERS
;
5114 #include <poppack.h>
5117 DWORD dwOSVersionInfoSize
;
5118 DWORD dwMajorVersion
;
5119 DWORD dwMinorVersion
;
5120 DWORD dwBuildNumber
;
5122 CHAR szCSDVersion
[128];
5123 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5126 DWORD dwOSVersionInfoSize
;
5127 DWORD dwMajorVersion
;
5128 DWORD dwMinorVersion
;
5129 DWORD dwBuildNumber
;
5131 WCHAR szCSDVersion
[128];
5132 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5134 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5135 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5136 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5139 DWORD dwOSVersionInfoSize
;
5140 DWORD dwMajorVersion
;
5141 DWORD dwMinorVersion
;
5142 DWORD dwBuildNumber
;
5144 CHAR szCSDVersion
[128];
5145 WORD wServicePackMajor
;
5146 WORD wServicePackMinor
;
5150 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5153 DWORD dwOSVersionInfoSize
;
5154 DWORD dwMajorVersion
;
5155 DWORD dwMinorVersion
;
5156 DWORD dwBuildNumber
;
5158 WCHAR szCSDVersion
[128];
5159 WORD wServicePackMajor
;
5160 WORD wServicePackMinor
;
5164 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5166 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5167 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5168 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5170 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5172 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5174 #define VER_PLATFORM_WIN32s 0
5175 #define VER_PLATFORM_WIN32_WINDOWS 1
5176 #define VER_PLATFORM_WIN32_NT 2
5178 #define VER_MINORVERSION 0x00000001
5179 #define VER_MAJORVERSION 0x00000002
5180 #define VER_BUILDNUMBER 0x00000004
5181 #define VER_PLATFORMID 0x00000008
5182 #define VER_SERVICEPACKMINOR 0x00000010
5183 #define VER_SERVICEPACKMAJOR 0x00000020
5184 #define VER_SUITENAME 0x00000040
5185 #define VER_PRODUCT_TYPE 0x00000080
5187 #define VER_NT_WORKSTATION 1
5188 #define VER_NT_DOMAIN_CONTROLLER 2
5189 #define VER_NT_SERVER 3
5191 #define VER_SUITE_SMALLBUSINESS 0x00000001
5192 #define VER_SUITE_ENTERPRISE 0x00000002
5193 #define VER_SUITE_BACKOFFICE 0x00000004
5194 #define VER_SUITE_COMMUNICATIONS 0x00000008
5195 #define VER_SUITE_TERMINAL 0x00000010
5196 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5197 #define VER_SUITE_EMBEDDEDNT 0x00000040
5198 #define VER_SUITE_DATACENTER 0x00000080
5199 #define VER_SUITE_SINGLEUSERTS 0x00000100
5200 #define VER_SUITE_PERSONAL 0x00000200
5201 #define VER_SUITE_BLADE 0x00000400
5204 #define VER_GREATER 2
5205 #define VER_GREATER_EQUAL 3
5207 #define VER_LESS_EQUAL 5
5211 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5213 DWORD ulFormatVersion
;
5214 DWORD ulAssemblyCount
;
5215 DWORD ulRootManifestPathType
;
5216 DWORD ulRootManifestPathChars
;
5217 DWORD ulRootConfigurationPathType
;
5218 DWORD ulRootConfigurationPathChars
;
5219 DWORD ulAppDirPathType
;
5220 DWORD ulAppDirPathChars
;
5221 PCWSTR lpRootManifestPath
;
5222 PCWSTR lpRootConfigurationPath
;
5223 PCWSTR lpAppDirPath
;
5224 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5226 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5228 DWORD ulEncodedAssemblyIdentityLength
;
5229 DWORD ulManifestPathType
;
5230 DWORD ulManifestPathLength
;
5231 LARGE_INTEGER liManifestLastWriteTime
;
5232 DWORD ulPolicyPathType
;
5233 DWORD ulPolicyPathLength
;
5234 LARGE_INTEGER liPolicyLastWriteTime
;
5235 DWORD ulMetadataSatelliteRosterIndex
;
5236 DWORD ulManifestVersionMajor
;
5237 DWORD ulManifestVersionMinor
;
5238 DWORD ulPolicyVersionMajor
;
5239 DWORD ulPolicyVersionMinor
;
5240 DWORD ulAssemblyDirectoryNameLength
;
5241 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
5242 PCWSTR lpAssemblyManifestPath
;
5243 PCWSTR lpAssemblyPolicyPath
;
5244 PCWSTR lpAssemblyDirectoryName
;
5246 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
5248 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
5249 DWORD ulAssemblyIndex
;
5250 DWORD ulFileIndexInAssembly
;
5251 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
5253 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
5255 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
5257 DWORD ulFilenameLength
;
5261 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
5263 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
5265 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
5266 ActivationContextBasicInformation
= 1,
5267 ActivationContextDetailedInformation
= 2,
5268 AssemblyDetailedInformationInActivationContext
= 3,
5269 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
5270 MaxActivationContextInfoClass
,
5272 AssemblyDetailedInformationInActivationContxt
= 3,
5273 FileInformationInAssemblyOfAssemblyInActivationContxt
= 4
5274 } ACTIVATION_CONTEXT_INFO_CLASS
;
5276 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5277 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5278 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5279 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5281 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5282 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5283 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5284 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5285 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5286 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5287 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5288 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5289 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5291 typedef enum _JOBOBJECTINFOCLASS
5293 JobObjectBasicAccountingInformation
= 1,
5294 JobObjectBasicLimitInformation
,
5295 JobObjectBasicProcessIdList
,
5296 JobObjectBasicUIRestrictions
,
5297 JobObjectSecurityLimitInformation
,
5298 JobObjectEndOfJobTimeInformation
,
5299 JobObjectAssociateCompletionPortInformation
,
5300 JobObjectBasicAndIoAccountingInformation
,
5301 JobObjectExtendedLimitInformation
,
5302 JobObjectJobSetInformation
,
5303 MaxJobObjectInfoClass
5304 } JOBOBJECTINFOCLASS
;
5306 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
5312 #endif /* _WINNT_ */