2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
41 #define NTSYSAPI DECLSPEC_IMPORT
44 #define NTAPI __stdcall
47 # if defined(_MSC_VER)
48 # define DECLSPEC_IMPORT __declspec(dllimport)
49 # elif defined(__MINGW32__) || defined(__CYGWIN__)
50 # define DECLSPEC_IMPORT __attribute__((dllimport))
52 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
55 # define DECLSPEC_IMPORT
58 #ifndef DECLSPEC_NORETURN
59 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
60 # define DECLSPEC_NORETURN __declspec(noreturn)
61 # elif defined(__GNUC__)
62 # define DECLSPEC_NORETURN __attribute__((noreturn))
64 # define DECLSPEC_NORETURN
68 #ifndef DECLSPEC_ALIGN
69 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
70 # define DECLSPEC_ALIGN(x) __declspec(align(x))
71 # elif defined(__GNUC__)
72 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
74 # define DECLSPEC_ALIGN(x)
78 #ifndef DECLSPEC_CACHEALIGN
79 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
83 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
84 # define DECLSPEC_UUID(x) __declspec(uuid(x))
86 # define DECLSPEC_UUID(x)
90 #ifndef DECLSPEC_NOVTABLE
91 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
92 # define DECLSPEC_NOVTABLE __declspec(novtable)
94 # define DECLSPEC_NOVTABLE
98 #ifndef DECLSPEC_SELECTANY
99 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
100 #define DECLSPEC_SELECTANY __declspec(selectany)
102 #define DECLSPEC_SELECTANY
107 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
108 # define NOP_FUNCTION __noop
110 # define NOP_FUNCTION (void)0
114 #ifndef DECLSPEC_ADDRSAFE
115 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
116 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
118 # define DECLSPEC_ADDRSAFE
123 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
124 # define FORCEINLINE __forceinline
125 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
126 # define FORCEINLINE inline __attribute__((always_inline))
128 # define FORCEINLINE inline
132 #ifndef DECLSPEC_DEPRECATED
133 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
134 # define DECLSPEC_DEPRECATED __declspec(deprecated)
135 # define DEPRECATE_SUPPORTED
136 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
137 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
138 # define DEPRECATE_SUPPORTED
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
145 /* a couple of useful Wine extensions */
148 # define DECLSPEC_EXPORT __declspec(dllexport)
149 #elif defined(__MINGW32__)
150 # define DECLSPEC_EXPORT __attribute__((dllexport))
151 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
152 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
154 # define DECLSPEC_EXPORT
157 #if defined(__MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
158 # define DECLSPEC_HIDDEN
159 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
160 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
162 # define DECLSPEC_HIDDEN
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
168 #define __WINE_ALLOC_SIZE(x)
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
175 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
176 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
177 # define NONAMELESSSTRUCT
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
186 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
187 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
188 # define NONAMELESSUNION
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
193 #endif /* NONAMELESSUNION */
195 #undef DUMMYSTRUCTNAME
196 #undef DUMMYSTRUCTNAME1
197 #undef DUMMYSTRUCTNAME2
198 #undef DUMMYSTRUCTNAME3
199 #undef DUMMYSTRUCTNAME4
200 #undef DUMMYSTRUCTNAME5
201 #ifndef NONAMELESSSTRUCT
202 #define DUMMYSTRUCTNAME
203 #define DUMMYSTRUCTNAME1
204 #define DUMMYSTRUCTNAME2
205 #define DUMMYSTRUCTNAME3
206 #define DUMMYSTRUCTNAME4
207 #define DUMMYSTRUCTNAME5
208 #else /* !defined(NONAMELESSSTRUCT) */
209 #define DUMMYSTRUCTNAME s
210 #define DUMMYSTRUCTNAME1 s1
211 #define DUMMYSTRUCTNAME2 s2
212 #define DUMMYSTRUCTNAME3 s3
213 #define DUMMYSTRUCTNAME4 s4
214 #define DUMMYSTRUCTNAME5 s5
215 #endif /* !defined(NONAMELESSSTRUCT) */
217 #undef DUMMYUNIONNAME
218 #undef DUMMYUNIONNAME1
219 #undef DUMMYUNIONNAME2
220 #undef DUMMYUNIONNAME3
221 #undef DUMMYUNIONNAME4
222 #undef DUMMYUNIONNAME5
223 #undef DUMMYUNIONNAME6
224 #undef DUMMYUNIONNAME7
225 #undef DUMMYUNIONNAME8
226 #ifndef NONAMELESSUNION
227 #define DUMMYUNIONNAME
228 #define DUMMYUNIONNAME1
229 #define DUMMYUNIONNAME2
230 #define DUMMYUNIONNAME3
231 #define DUMMYUNIONNAME4
232 #define DUMMYUNIONNAME5
233 #define DUMMYUNIONNAME6
234 #define DUMMYUNIONNAME7
235 #define DUMMYUNIONNAME8
236 #else /* !defined(NONAMELESSUNION) */
237 #define DUMMYUNIONNAME u
238 #define DUMMYUNIONNAME1 u1
239 #define DUMMYUNIONNAME2 u2
240 #define DUMMYUNIONNAME3 u3
241 #define DUMMYUNIONNAME4 u4
242 #define DUMMYUNIONNAME5 u5
243 #define DUMMYUNIONNAME6 u6
244 #define DUMMYUNIONNAME7 u7
245 #define DUMMYUNIONNAME8 u8
246 #endif /* !defined(NONAMELESSUNION) */
248 #undef __C89_NAMELESS
249 #undef __C89_NAMELESSSTRUCTNAME
250 #undef __C89_NAMELESSSTRUCTNAME1
251 #undef __C89_NAMELESSSTRUCTNAME2
252 #undef __C89_NAMELESSSTRUCTNAME3
253 #undef __C89_NAMELESSSTRUCTNAME4
254 #undef __C89_NAMELESSSTRUCTNAME5
255 #undef __C89_NAMELESSUNIONNAME
256 #undef __C89_NAMELESSUNIONNAME1
257 #undef __C89_NAMELESSUNIONNAME2
258 #undef __C89_NAMELESSUNIONNAME3
259 #undef __C89_NAMELESSUNIONNAME4
260 #undef __C89_NAMELESSUNIONNAME5
261 #undef __C89_NAMELESSUNIONNAME6
262 #undef __C89_NAMELESSUNIONNAME7
263 #undef __C89_NAMELESSUNIONNAME8
265 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
267 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
268 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
269 # define __C89_NAMELESS __extension__
271 # elif defined(_MSC_VER)
272 # define __C89_NAMELESS
276 #ifdef __C89_NAMELESS
277 # define __C89_NAMELESSSTRUCTNAME
278 # define __C89_NAMELESSSTRUCTNAME1
279 # define __C89_NAMELESSSTRUCTNAME2
280 # define __C89_NAMELESSSTRUCTNAME3
281 # define __C89_NAMELESSSTRUCTNAME4
282 # define __C89_NAMELESSSTRUCTNAME5
283 # define __C89_NAMELESSUNIONNAME
284 # define __C89_NAMELESSUNIONNAME1
285 # define __C89_NAMELESSUNIONNAME2
286 # define __C89_NAMELESSUNIONNAME3
287 # define __C89_NAMELESSUNIONNAME4
288 # define __C89_NAMELESSUNIONNAME5
289 # define __C89_NAMELESSUNIONNAME6
290 # define __C89_NAMELESSUNIONNAME7
291 # define __C89_NAMELESSUNIONNAME8
293 # define __C89_NAMELESS
294 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
295 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1
296 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2
297 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3
298 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4
299 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5
300 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
301 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1
302 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2
303 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3
304 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4
305 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5
306 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6
307 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7
308 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8
311 /* C99 restrict support */
313 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
314 # if defined(_MSC_VER) && defined(_M_MRX000)
315 # define RESTRICTED_POINTER __restrict
316 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
317 # define RESTRICTED_POINTER __restrict
319 # define RESTRICTED_POINTER
322 # define RESTRICTED_POINTER
325 /* C99 unaligned support */
328 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
329 # define UNALIGNED __unaligned
331 # define UNALIGNED64 __unaligned
341 /* Alignment macros */
343 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
344 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
345 #define MEMORY_ALLOCATION_ALIGNMENT 16
347 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
348 #define MEMORY_ALLOCATION_ALIGNMENT 8
351 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
352 # define TYPE_ALIGNMENT(t) __alignof(t)
353 #elif defined(__GNUC__)
354 # define TYPE_ALIGNMENT(t) __alignof__(t)
356 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
360 # define PROBE_ALIGNMENT(_s) \
361 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
362 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
363 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
365 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
368 /* Compile time assertion */
370 #if defined(_MSC_VER)
371 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
373 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
376 /* Eliminate Microsoft C/C++ compiler warning 4715 */
377 #if defined(_MSC_VER) && (_MSC_VER > 1200)
378 # define DEFAULT_UNREACHABLE default: __assume(0)
380 # define DEFAULT_UNREACHABLE
384 #define APPLICATION_ERROR_MASK 0x20000000
385 #define ERROR_SEVERITY_SUCCESS 0x00000000
386 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
387 #define ERROR_SEVERITY_WARNING 0x80000000
388 #define ERROR_SEVERITY_ERROR 0xC0000000
391 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
393 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
394 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
395 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
396 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
397 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
398 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
399 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
402 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
405 /* Microsoft's macros for declaring functions */
408 # define EXTERN_C extern "C"
410 # define EXTERN_C extern
413 #define STDMETHODCALLTYPE __stdcall
414 #define STDMETHODVCALLTYPE __cdecl
415 #define STDAPICALLTYPE __stdcall
416 #define STDAPIVCALLTYPE __cdecl
418 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
419 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
420 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
421 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
422 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
423 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
424 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
425 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
427 /* Define the basic types */
432 typedef VOID
*PVOID64
;
433 typedef BYTE BOOLEAN
, *PBOOLEAN
;
434 typedef char CHAR
, *PCHAR
;
435 typedef short SHORT
, *PSHORT
;
437 typedef long LONG
, *PLONG
;
439 typedef int LONG
, *PLONG
;
442 /* Some systems might have wchar_t, but we really need 16 bit characters */
443 #ifdef WINE_UNICODE_NATIVE
444 typedef wchar_t WCHAR
, *PWCHAR
;
446 typedef unsigned short WCHAR
, *PWCHAR
;
449 /* 'Extended/Wide' numerical types */
453 typedef signed __int64 LONGLONG
, *PLONGLONG
;
454 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
456 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
457 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
464 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
466 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
470 /* ANSI string types */
471 typedef CHAR
*PCH
, *LPCH
;
472 typedef const CHAR
*PCCH
, *LPCCH
;
473 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
474 typedef const CHAR
*PCSTR
, *LPCSTR
;
475 typedef CHAR
*PZZSTR
;
476 typedef const CHAR
*PCZZSTR
;
478 /* Unicode string types */
479 typedef WCHAR
*PWCH
, *LPWCH
;
480 typedef const WCHAR
*PCWCH
, *LPCWCH
;
481 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
482 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
483 typedef WCHAR
*PZZWSTR
;
484 typedef const WCHAR
*PCZZWSTR
;
486 /* Neutral character and string types */
487 /* These are only defined for Winelib, i.e. _not_ defined for
488 * the emulator. The reason is they depend on the UNICODE
489 * macro which only exists in the user's code.
491 #ifndef WINE_NO_UNICODE_MACROS
493 # ifndef _TCHAR_DEFINED
494 typedef WCHAR TCHAR
, *PTCHAR
;
495 # define _TCHAR_DEFINED
497 typedef LPWSTR PTSTR
, LPTSTR
;
498 typedef LPCWSTR PCTSTR
, LPCTSTR
;
499 typedef PZZSTR PZZTSTR
;
500 typedef PCZZSTR PCZZTSTR
;
502 # ifndef _TCHAR_DEFINED
503 typedef CHAR TCHAR
, *PTCHAR
;
504 # define _TCHAR_DEFINED
506 typedef LPSTR PTSTR
, LPTSTR
;
507 typedef LPCSTR PCTSTR
, LPCTSTR
;
508 typedef PZZWSTR PZZTSTR
;
509 typedef PCZZWSTR PCZZTSTR
;
510 # endif /* UNICODE */
511 #endif /* WINE_NO_UNICODE_MACROS */
513 /* Misc common WIN32 types */
515 typedef DWORD LCID
, *PLCID
;
517 typedef DWORD EXECUTION_STATE
;
518 #ifndef _HRESULT_DEFINED
519 #define _HRESULT_DEFINED
520 typedef LONG HRESULT
;
525 typedef void *HANDLE
;
526 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
529 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
531 #define DECLARE_HANDLE(a) typedef HANDLE a
538 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
540 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
541 # define __MSABI_LONG(x) x ## l
543 # define __MSABI_LONG(x) x
549 #ifndef WIN32_NO_STATUS
551 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
552 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
553 #define STATUS_USER_APC ((DWORD) 0x000000C0)
554 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
555 #define STATUS_PENDING ((DWORD) 0x00000103)
556 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
557 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
558 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
559 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
560 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
561 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
562 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
563 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
564 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
565 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
566 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
567 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
568 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
569 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
570 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
571 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
572 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
573 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
574 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
575 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
576 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
577 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
578 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
579 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
580 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
581 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
582 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
583 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
584 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
585 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
587 /* status values for ContinueDebugEvent */
588 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
589 #define DBG_CONTINUE ((DWORD) 0x00010002)
590 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
591 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
592 #define DBG_CONTROL_C ((DWORD) 0x40010005)
593 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
594 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
595 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
597 #endif /* WIN32_NO_STATUS */
599 /* Argument 1 passed to the DllEntryProc. */
600 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
601 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
602 #define DLL_THREAD_ATTACH 2 /* attach new thread */
603 #define DLL_THREAD_DETACH 3 /* detach thread */
605 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
608 /* u.x.wProcessorArchitecture (NT) */
609 #define PROCESSOR_ARCHITECTURE_INTEL 0
610 #define PROCESSOR_ARCHITECTURE_MIPS 1
611 #define PROCESSOR_ARCHITECTURE_ALPHA 2
612 #define PROCESSOR_ARCHITECTURE_PPC 3
613 #define PROCESSOR_ARCHITECTURE_SHX 4
614 #define PROCESSOR_ARCHITECTURE_ARM 5
615 #define PROCESSOR_ARCHITECTURE_IA64 6
616 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
617 #define PROCESSOR_ARCHITECTURE_MSIL 8
618 #define PROCESSOR_ARCHITECTURE_AMD64 9
619 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
620 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
623 #define PROCESSOR_ARCHITECTURE_SPARC 20
625 /* dwProcessorType */
626 #define PROCESSOR_INTEL_386 386
627 #define PROCESSOR_INTEL_486 486
628 #define PROCESSOR_INTEL_PENTIUM 586
629 #define PROCESSOR_INTEL_860 860
630 #define PROCESSOR_INTEL_IA64 2200
631 #define PROCESSOR_AMD_X8664 8664
632 #define PROCESSOR_MIPS_R2000 2000
633 #define PROCESSOR_MIPS_R3000 3000
634 #define PROCESSOR_MIPS_R4000 4000
635 #define PROCESSOR_ALPHA_21064 21064
636 #define PROCESSOR_PPC_601 601
637 #define PROCESSOR_PPC_603 603
638 #define PROCESSOR_PPC_604 604
639 #define PROCESSOR_PPC_620 620
640 #define PROCESSOR_HITACHI_SH3 10003
641 #define PROCESSOR_HITACHI_SH3E 10004
642 #define PROCESSOR_HITACHI_SH4 10005
643 #define PROCESSOR_MOTOROLA_821 821
644 #define PROCESSOR_SHx_SH3 103
645 #define PROCESSOR_SHx_SH4 104
646 #define PROCESSOR_STRONGARM 2577
647 #define PROCESSOR_ARM720 1824 /* 0x720 */
648 #define PROCESSOR_ARM820 2080 /* 0x820 */
649 #define PROCESSOR_ARM920 2336 /* 0x920 */
650 #define PROCESSOR_ARM_7TDMI 70001
651 #define PROCESSOR_OPTIL 18767
654 #define MAXIMUM_PROCESSORS 64
656 #define MAXIMUM_PROCESSORS 32
659 typedef struct _MEMORY_BASIC_INFORMATION
662 LPVOID AllocationBase
;
663 DWORD AllocationProtect
;
668 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
670 #define PAGE_NOACCESS 0x01
671 #define PAGE_READONLY 0x02
672 #define PAGE_READWRITE 0x04
673 #define PAGE_WRITECOPY 0x08
674 #define PAGE_EXECUTE 0x10
675 #define PAGE_EXECUTE_READ 0x20
676 #define PAGE_EXECUTE_READWRITE 0x40
677 #define PAGE_EXECUTE_WRITECOPY 0x80
678 #define PAGE_GUARD 0x100
679 #define PAGE_NOCACHE 0x200
680 #define PAGE_WRITECOMBINE 0x400
682 #define MEM_COMMIT 0x00001000
683 #define MEM_RESERVE 0x00002000
684 #define MEM_DECOMMIT 0x00004000
685 #define MEM_RELEASE 0x00008000
686 #define MEM_FREE 0x00010000
687 #define MEM_PRIVATE 0x00020000
688 #define MEM_MAPPED 0x00040000
689 #define MEM_RESET 0x00080000
690 #define MEM_TOP_DOWN 0x00100000
691 #define MEM_WRITE_WATCH 0x00200000
692 #define MEM_PHYSICAL 0x00400000
693 #define MEM_LARGE_PAGES 0x20000000
694 #define MEM_4MB_PAGES 0x80000000
696 #define SEC_FILE 0x00800000
697 #define SEC_IMAGE 0x01000000
698 #define SEC_RESERVE 0x04000000
699 #define SEC_COMMIT 0x08000000
700 #define SEC_NOCACHE 0x10000000
701 #define SEC_LARGE_PAGES 0x80000000
702 #define MEM_IMAGE SEC_IMAGE
704 #define WRITE_WATCH_FLAG_RESET 0x00000001
709 #define MINSHORT 0x8000
710 #define MAXSHORT 0x7fff
711 #define MINLONG 0x80000000
712 #define MAXLONG 0x7fffffff
714 #define MAXWORD 0xffff
715 #define MAXDWORD 0xffffffff
717 #define UNICODE_STRING_MAX_CHARS 32767
719 #define FIELD_OFFSET(type, field) \
720 ((LONG)(INT_PTR)&(((type *)0)->field))
722 #define CONTAINING_RECORD(address, type, field) \
723 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
727 typedef struct _LIST_ENTRY
{
728 struct _LIST_ENTRY
*Flink
;
729 struct _LIST_ENTRY
*Blink
;
730 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
732 typedef struct _SINGLE_LIST_ENTRY
{
733 struct _SINGLE_LIST_ENTRY
*Next
;
734 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
738 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
*PSLIST_ENTRY
;
739 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY
{
743 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER
{
750 ULONGLONG Sequence
:9;
751 ULONGLONG NextEntry
:39;
752 ULONGLONG HeaderType
:1;
754 ULONGLONG Reserved
:59;
759 ULONGLONG Sequence
:48;
760 ULONGLONG HeaderType
:1;
762 ULONGLONG Reserved
:2;
763 ULONGLONG NextEntry
:60;
765 } SLIST_HEADER
, *PSLIST_HEADER
;
769 #undef SLIST_ENTRY /* for Mac OS */
770 #define SLIST_ENTRY SINGLE_LIST_ENTRY
771 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
772 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
774 typedef union _SLIST_HEADER
{
781 } SLIST_HEADER
, *PSLIST_HEADER
;
785 NTSYSAPI PSLIST_ENTRY WINAPI
RtlFirstEntrySList(const SLIST_HEADER
*);
786 NTSYSAPI VOID WINAPI
RtlInitializeSListHead(PSLIST_HEADER
);
787 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedFlushSList(PSLIST_HEADER
);
788 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPopEntrySList(PSLIST_HEADER
);
789 NTSYSAPI PSLIST_ENTRY WINAPI
RtlInterlockedPushEntrySList(PSLIST_HEADER
, PSLIST_ENTRY
);
790 NTSYSAPI WORD WINAPI
RtlQueryDepthSList(PSLIST_HEADER
);
795 #define HEAP_NO_SERIALIZE 0x00000001
796 #define HEAP_GROWABLE 0x00000002
797 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
798 #define HEAP_ZERO_MEMORY 0x00000008
799 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
800 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
801 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
802 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
803 #define HEAP_CREATE_ALIGN_16 0x00010000
804 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
805 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
807 /* This flag allows it to create heaps shared by all processes under win95,
808 FIXME: correct name */
809 #define HEAP_SHARED 0x04000000
811 typedef enum _HEAP_INFORMATION_CLASS
{
812 HeapCompatibilityInformation
,
813 } HEAP_INFORMATION_CLASS
;
815 /* Processor feature flags. */
816 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
817 #define PF_FLOATING_POINT_EMULATED 1
818 #define PF_COMPARE_EXCHANGE_DOUBLE 2
819 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
820 #define PF_PPC_MOVEMEM_64BIT_OK 4
821 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
822 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
823 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
824 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
825 #define PF_PAE_ENABLED 9
826 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
827 #define PF_SSE_DAZ_MODE_AVAILABLE 11
828 #define PF_NX_ENABLED 12
829 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
830 #define PF_COMPARE_EXCHANGE128 14
831 #define PF_COMPARE64_EXCHANGE128 15
832 #define PF_CHANNELS_ENABLED 16
833 #define PF_XSAVE_ENABLED 17
836 /* Execution state flags */
837 #define ES_SYSTEM_REQUIRED 0x00000001
838 #define ES_DISPLAY_REQUIRED 0x00000002
839 #define ES_USER_PRESENT 0x00000004
840 #define ES_CONTINUOUS 0x80000000
842 /* The Win32 register context */
844 /* i386 context definitions */
847 #define SIZE_OF_80387_REGISTERS 80
849 typedef struct _FLOATING_SAVE_AREA
858 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
860 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
862 #define MAXIMUM_SUPPORTED_EXTENSION 512
864 typedef struct _CONTEXT
868 /* These are selected by CONTEXT_DEBUG_REGISTERS */
876 /* These are selected by CONTEXT_FLOATING_POINT */
877 FLOATING_SAVE_AREA FloatSave
;
879 /* These are selected by CONTEXT_SEGMENTS */
885 /* These are selected by CONTEXT_INTEGER */
893 /* These are selected by CONTEXT_CONTROL */
901 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
904 #define CONTEXT_X86 0x00010000
905 #define CONTEXT_i386 CONTEXT_X86
906 #define CONTEXT_i486 CONTEXT_X86
908 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
909 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
910 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
911 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
912 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
913 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
914 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
915 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
916 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
918 #define EXCEPTION_READ_FAULT 0
919 #define EXCEPTION_WRITE_FAULT 1
920 #define EXCEPTION_EXECUTE_FAULT 8
922 #endif /* __i386__ */
924 typedef struct _LDT_ENTRY
{
939 unsigned LimitHi
: 4;
941 unsigned Reserved_0
: 1;
942 unsigned Default_Big
: 1;
943 unsigned Granularity
: 1;
947 } LDT_ENTRY
, *PLDT_ENTRY
;
949 /* x86-64 context definitions */
950 #if defined(__x86_64__)
952 #define CONTEXT_AMD64 0x00100000
954 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
955 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
956 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
957 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
958 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
959 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
960 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
962 #define EXCEPTION_READ_FAULT 0
963 #define EXCEPTION_WRITE_FAULT 1
964 #define EXCEPTION_EXECUTE_FAULT 8
966 typedef struct DECLSPEC_ALIGN(16) _M128A
{
971 typedef struct _XMM_SAVE_AREA32
{
972 WORD ControlWord
; /* 000 */
973 WORD StatusWord
; /* 002 */
974 BYTE TagWord
; /* 004 */
975 BYTE Reserved1
; /* 005 */
976 WORD ErrorOpcode
; /* 006 */
977 DWORD ErrorOffset
; /* 008 */
978 WORD ErrorSelector
; /* 00c */
979 WORD Reserved2
; /* 00e */
980 DWORD DataOffset
; /* 010 */
981 WORD DataSelector
; /* 014 */
982 WORD Reserved3
; /* 016 */
983 DWORD MxCsr
; /* 018 */
984 DWORD MxCsr_Mask
; /* 01c */
985 M128A FloatRegisters
[8]; /* 020 */
986 M128A XmmRegisters
[16]; /* 0a0 */
987 BYTE Reserved4
[96]; /* 1a0 */
988 } XMM_SAVE_AREA32
, *PXMM_SAVE_AREA32
;
990 typedef struct DECLSPEC_ALIGN(16) _CONTEXT
{
991 DWORD64 P1Home
; /* 000 */
992 DWORD64 P2Home
; /* 008 */
993 DWORD64 P3Home
; /* 010 */
994 DWORD64 P4Home
; /* 018 */
995 DWORD64 P5Home
; /* 020 */
996 DWORD64 P6Home
; /* 028 */
999 DWORD ContextFlags
; /* 030 */
1000 DWORD MxCsr
; /* 034 */
1003 WORD SegCs
; /* 038 */
1004 WORD SegDs
; /* 03a */
1005 WORD SegEs
; /* 03c */
1006 WORD SegFs
; /* 03e */
1007 WORD SegGs
; /* 040 */
1008 WORD SegSs
; /* 042 */
1009 DWORD EFlags
; /* 044 */
1012 DWORD64 Dr0
; /* 048 */
1013 DWORD64 Dr1
; /* 050 */
1014 DWORD64 Dr2
; /* 058 */
1015 DWORD64 Dr3
; /* 060 */
1016 DWORD64 Dr6
; /* 068 */
1017 DWORD64 Dr7
; /* 070 */
1020 DWORD64 Rax
; /* 078 */
1021 DWORD64 Rcx
; /* 080 */
1022 DWORD64 Rdx
; /* 088 */
1023 DWORD64 Rbx
; /* 090 */
1024 DWORD64 Rsp
; /* 098 */
1025 DWORD64 Rbp
; /* 0a0 */
1026 DWORD64 Rsi
; /* 0a8 */
1027 DWORD64 Rdi
; /* 0b0 */
1028 DWORD64 R8
; /* 0b8 */
1029 DWORD64 R9
; /* 0c0 */
1030 DWORD64 R10
; /* 0c8 */
1031 DWORD64 R11
; /* 0d0 */
1032 DWORD64 R12
; /* 0d8 */
1033 DWORD64 R13
; /* 0e0 */
1034 DWORD64 R14
; /* 0e8 */
1035 DWORD64 R15
; /* 0f0 */
1038 DWORD64 Rip
; /* 0f8 */
1040 /* Floating point */
1042 XMM_SAVE_AREA32 FltSave
; /* 100 */
1044 M128A Header
[2]; /* 100 */
1045 M128A Legacy
[8]; /* 120 */
1046 M128A Xmm0
; /* 1a0 */
1047 M128A Xmm1
; /* 1b0 */
1048 M128A Xmm2
; /* 1c0 */
1049 M128A Xmm3
; /* 1d0 */
1050 M128A Xmm4
; /* 1e0 */
1051 M128A Xmm5
; /* 1f0 */
1052 M128A Xmm6
; /* 200 */
1053 M128A Xmm7
; /* 210 */
1054 M128A Xmm8
; /* 220 */
1055 M128A Xmm9
; /* 230 */
1056 M128A Xmm10
; /* 240 */
1057 M128A Xmm11
; /* 250 */
1058 M128A Xmm12
; /* 260 */
1059 M128A Xmm13
; /* 270 */
1060 M128A Xmm14
; /* 280 */
1061 M128A Xmm15
; /* 290 */
1066 M128A VectorRegister
[26]; /* 300 */
1067 DWORD64 VectorControl
; /* 4a0 */
1070 DWORD64 DebugControl
; /* 4a8 */
1071 DWORD64 LastBranchToRip
; /* 4b0 */
1072 DWORD64 LastBranchFromRip
; /* 4b8 */
1073 DWORD64 LastExceptionToRip
; /* 4c0 */
1074 DWORD64 LastExceptionFromRip
; /* 4c8 */
1077 typedef struct _RUNTIME_FUNCTION
1082 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1084 #define UNWIND_HISTORY_TABLE_SIZE 12
1086 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1089 PRUNTIME_FUNCTION FunctionEntry
;
1090 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1092 #define UNWIND_HISTORY_TABLE_NONE 0
1093 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1094 #define UNWIND_HISTORY_TABLE_LOCAL 2
1096 typedef struct _UNWIND_HISTORY_TABLE
1101 ULONG64 HighAddress
;
1102 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1103 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1105 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1109 PM128A FloatingContext
[16];
1133 PULONG64 IntegerContext
[16];
1154 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1156 BOOLEAN CDECL
RtlAddFunctionTable(RUNTIME_FUNCTION
*,DWORD
,DWORD64
);
1157 BOOLEAN CDECL
RtlDeleteFunctionTable(RUNTIME_FUNCTION
*);
1158 PRUNTIME_FUNCTION WINAPI
RtlLookupFunctionEntry(DWORD64
,DWORD64
*,UNWIND_HISTORY_TABLE
*);
1159 PVOID WINAPI
RtlVirtualUnwind(ULONG
,ULONG64
,ULONG64
,RUNTIME_FUNCTION
*,CONTEXT
*,PVOID
*,ULONG64
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1161 #define UNW_FLAG_NHANDLER 0
1162 #define UNW_FLAG_EHANDLER 1
1163 #define UNW_FLAG_UHANDLER 2
1164 #define UNW_FLAG_CHAININFO 4
1166 #endif /* __x86_64__ */
1168 /* IA64 context definitions */
1171 #define CONTEXT_IA64 0x00080000
1172 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1173 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1174 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1175 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1176 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1177 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1178 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1179 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1180 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1182 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1183 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1184 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1185 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1187 typedef struct _CONTEXT
1382 ULONGLONG RsBSPSTORE
;
1396 ULONGLONG UNUSEDPACK
;
1397 } CONTEXT
, *PCONTEXT
;
1399 typedef struct _RUNTIME_FUNCTION
1403 ULONG UnwindInfoAddress
;
1404 } RUNTIME_FUNCTION
, *PRUNTIME_FUNCTION
;
1406 typedef struct _FRAME_POINTERS
{
1407 ULONGLONG MemoryStackFp
;
1408 ULONGLONG BackingStoreFp
;
1409 } FRAME_POINTERS
, *PFRAME_POINTERS
;
1411 #define UNWIND_HISTORY_TABLE_SIZE 12
1413 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
{
1416 PRUNTIME_FUNCTION FunctionEntry
;
1417 } UNWIND_HISTORY_TABLE_ENTRY
, *PUNWIND_HISTORY_TABLE_ENTRY
;
1419 typedef struct _UNWIND_HISTORY_TABLE
{
1423 ULONG64 HighAddress
;
1424 UNWIND_HISTORY_TABLE_ENTRY Entry
[UNWIND_HISTORY_TABLE_SIZE
];
1425 } UNWIND_HISTORY_TABLE
, *PUNWIND_HISTORY_TABLE
;
1427 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1433 PFLOAT128 HighFloatingContext
[10];
1455 PULONGLONG IntS0Nat
;
1456 PULONGLONG IntS1Nat
;
1457 PULONGLONG IntS2Nat
;
1458 PULONGLONG IntS3Nat
;
1459 PULONGLONG IntSpNat
;
1475 } KNONVOLATILE_CONTEXT_POINTERS
, *PKNONVOLATILE_CONTEXT_POINTERS
;
1477 ULONGLONG WINAPI
RtlVirtualUnwind(ULONGLONG
,ULONGLONG
,RUNTIME_FUNCTION
*,CONTEXT
*,BOOLEAN
*,FRAME_POINTERS
*,KNONVOLATILE_CONTEXT_POINTERS
*);
1479 #endif /* __ia64__ */
1481 /* Alpha context definitions */
1482 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1484 #define CONTEXT_ALPHA 0x00020000
1486 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1487 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1488 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1489 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1491 #define EXCEPTION_READ_FAULT 0
1492 #define EXCEPTION_WRITE_FAULT 1
1493 #define EXCEPTION_EXECUTE_FAULT 8
1495 typedef struct _CONTEXT
1497 /* selected by CONTEXT_FLOATING_POINT */
1531 /* selected by CONTEXT_INTEGER */
1565 /* selected by CONTEXT_FLOATING_POINT */
1569 /* selected by CONTEXT_CONTROL */
1576 #define _QUAD_PSR_OFFSET HighSoftFpcr
1577 #define _QUAD_FLAGS_OFFSET HighFir
1579 #endif /* _ALPHA_ */
1583 /* The following flags control the contents of the CONTEXT structure. */
1585 #define CONTEXT_ARM 0x0000040
1586 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1587 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1589 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1591 #define EXCEPTION_READ_FAULT 0
1592 #define EXCEPTION_WRITE_FAULT 1
1593 #define EXCEPTION_EXECUTE_FAULT 8
1595 typedef struct _CONTEXT
{
1596 /* The flags values within this flag control the contents of
1599 If the context record is used as an input parameter, then
1600 for each portion of the context record controlled by a flag
1601 whose value is set, it is assumed that that portion of the
1602 context record contains valid context. If the context record
1603 is being used to modify a thread's context, then only that
1604 portion of the threads context will be modified.
1606 If the context record is used as an IN OUT parameter to capture
1607 the context of a thread, then only those portions of the thread's
1608 context corresponding to set flags will be returned.
1610 The context record is never used as an OUT only parameter. */
1614 /* This section is specified/returned if the ContextFlags word contains
1615 the flag CONTEXT_INTEGER. */
1630 /* These are selected by CONTEXT_CONTROL */
1637 #endif /* __arm__ */
1640 /* Mips context definitions */
1641 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1643 #define CONTEXT_R4000 0x00010000
1645 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1646 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1647 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1649 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1651 #define EXCEPTION_READ_FAULT 0
1652 #define EXCEPTION_WRITE_FAULT 1
1653 #define EXCEPTION_EXECUTE_FAULT 8
1655 typedef struct _CONTEXT
1658 /* These are selected by CONTEXT_FLOATING_POINT */
1692 /* These are selected by CONTEXT_INTEGER */
1728 /* These are selected by CONTEXT_FLOATING_POINT */
1731 /* These are selected by CONTEXT_CONTROL */
1741 /* PowerPC context definitions */
1744 #define CONTEXT_CONTROL 0x0001
1745 #define CONTEXT_FLOATING_POINT 0x0002
1746 #define CONTEXT_INTEGER 0x0004
1747 #define CONTEXT_DEBUG_REGISTERS 0x0008
1748 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1750 #define EXCEPTION_READ_FAULT 0
1751 #define EXCEPTION_WRITE_FAULT 1
1752 #define EXCEPTION_EXECUTE_FAULT 8
1756 /* These are selected by CONTEXT_FLOATING_POINT */
1791 /* These are selected by CONTEXT_INTEGER */
1828 /* These are selected by CONTEXT_CONTROL */
1830 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1836 DWORD Dar
; /* Fault registers for coredump */
1838 DWORD Trap
; /* number of powerpc exception taken */
1840 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1851 typedef struct _STACK_FRAME_HEADER
1868 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1870 #endif /* __powerpc__ */
1877 * There is no official CONTEXT structure defined for the SPARC
1878 * architecture, so I just made one up.
1880 * This structure is valid only for 32-bit SPARC architectures,
1881 * not for 64-bit SPARC.
1883 * Note that this structure contains only the 'top-level' registers;
1884 * the rest of the register window chain is not visible.
1886 * The layout follows the Solaris 'prgregset_t' structure.
1890 #define CONTEXT_SPARC 0x10000000
1892 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1893 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1894 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1896 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1898 #define EXCEPTION_READ_FAULT 0
1899 #define EXCEPTION_WRITE_FAULT 1
1900 #define EXCEPTION_EXECUTE_FAULT 8
1902 typedef struct _CONTEXT
1906 /* These are selected by CONTEXT_INTEGER */
1940 /* These are selected by CONTEXT_CONTROL */
1948 /* FIXME: floating point registers missing */
1952 #endif /* __sparc__ */
1954 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1955 #error You need to define a CONTEXT for your CPU
1958 typedef CONTEXT
*PCONTEXT
;
1960 NTSYSAPI
void WINAPI
RtlCaptureContext(CONTEXT
*);
1965 #define PRODUCT_UNLICENSED 0xABCDABCD
1966 #define PRODUCT_BUSINESS 0x00000006
1967 #define PRODUCT_BUSINESS_N 0x00000010
1968 #define PRODUCT_CLUSTER_SERVER 0x00000012
1969 #define PRODUCT_DATACENTER_SERVER 0x00000008
1970 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1971 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1972 #define PRODUCT_EMBEDDED 0x00000041
1973 #define PRODUCT_ENTERPRISE 0x00000004
1974 #define PRODUCT_ENTERPRISE_N 0x0000001B
1975 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1976 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1977 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1978 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1979 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1980 #define PRODUCT_HOME_BASIC 0x00000002
1981 #define PRODUCT_HOME_BASIC_N 0x00000005
1982 #define PRODUCT_HOME_PREMIUM 0x00000003
1983 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1984 #define PRODUCT_HYPERV 0x0000002A
1985 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1986 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1987 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1988 #define PRODUCT_PROFESSIONAL 0x00000030
1989 #define PRODUCT_PROFESSIONAL_N 0x00000031
1990 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1991 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1992 #define PRODUCT_SERVER_V 0x00000025
1993 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1994 #define PRODUCT_STANDARD_SERVER 0x00000007
1995 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1996 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1997 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1998 #define PRODUCT_STARTER 0x0000000B
1999 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
2000 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
2001 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
2002 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
2003 #define PRODUCT_UNDEFINED 0x00000000
2004 #define PRODUCT_ULTIMATE 0x00000001
2005 #define PRODUCT_ULTIMATE_N 0x0000001C
2006 #define PRODUCT_WEB_SERVER 0x00000011
2007 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
2014 #define MAKELCID(l, s) (MAKELONG(l, s))
2016 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
2017 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
2018 #define SUBLANGID(l) ((WORD)(l) >> 10)
2020 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
2021 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
2023 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
2024 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
2025 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
2026 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
2027 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
2028 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
2029 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
2030 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
2031 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
2032 #define LOCALE_NAME_MAX_LENGTH 85
2035 #define UNREFERENCED_PARAMETER(u) (void)(u)
2036 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
2037 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
2043 * Definitions for IsTextUnicode()
2046 #define IS_TEXT_UNICODE_ASCII16 0x0001
2047 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2048 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2049 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2050 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2051 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2052 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2053 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2054 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2055 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2056 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2057 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2058 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2059 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2060 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2061 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2063 #define MAXIMUM_WAIT_OBJECTS 64
2064 #define MAXIMUM_SUSPEND_COUNT 127
2066 #define WT_EXECUTEDEFAULT 0x00
2067 #define WT_EXECUTEINIOTHREAD 0x01
2068 #define WT_EXECUTEINUITHREAD 0x02
2069 #define WT_EXECUTEINWAITTHREAD 0x04
2070 #define WT_EXECUTEONLYONCE 0x08
2071 #define WT_EXECUTELONGFUNCTION 0x10
2072 #define WT_EXECUTEINTIMERTHREAD 0x20
2073 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2074 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2075 #define WT_EXECUTEINLONGTHREAD 0x10
2076 #define WT_EXECUTEDELETEWAIT 0x08
2077 #define WT_TRANSFER_IMPERSONATION 0x0100
2080 #define EXCEPTION_CONTINUABLE 0
2081 #define EXCEPTION_NONCONTINUABLE 0x01
2084 * The exception record used by Win32 to give additional information
2085 * about exception to exception handlers.
2088 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2090 typedef struct _EXCEPTION_RECORD
2092 DWORD ExceptionCode
;
2093 DWORD ExceptionFlags
;
2094 struct _EXCEPTION_RECORD
*ExceptionRecord
;
2096 PVOID ExceptionAddress
;
2097 DWORD NumberParameters
;
2098 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
2099 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
2102 * The exception pointers structure passed to exception filters
2103 * in except() and the UnhandledExceptionFilter().
2106 typedef struct _EXCEPTION_POINTERS
2108 PEXCEPTION_RECORD ExceptionRecord
;
2109 PCONTEXT ContextRecord
;
2110 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
2114 * The exception frame, used for registering exception handlers
2115 * Win32 cares only about this, but compilers generally emit
2116 * larger exception frames for their own use.
2119 struct _EXCEPTION_REGISTRATION_RECORD
;
2121 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
2122 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
2124 typedef struct _EXCEPTION_REGISTRATION_RECORD
2126 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
2127 PEXCEPTION_HANDLER Handler
;
2128 } EXCEPTION_REGISTRATION_RECORD
;
2131 * function pointer to an exception filter
2134 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
2136 typedef struct _NT_TIB
2138 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
2146 PVOID ArbitraryUserPointer
;
2147 struct _NT_TIB
*Self
;
2152 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2153 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2156 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
2159 #elif defined(__i386__) && defined(_MSC_VER)
2160 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2163 __asm mov eax
, fs
:[0x18];
2167 #elif defined(__x86_64__) && defined(__GNUC__)
2168 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2171 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb
));
2174 #elif defined(__x86_64__) && defined (_MSC_VER)
2175 static FORCEINLINE
struct _TEB
* WINAPI
NtCurrentTeb(void)
2178 __asm mov rax
, gs
:[0x30];
2183 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
2186 #ifdef NONAMELESSUNION
2187 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2189 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2191 #define GetFiberData() (*(void **)GetCurrentFiber())
2193 #define TLS_MINIMUM_AVAILABLE 64
2196 * File formats definitions
2199 #include <pshpack2.h>
2200 typedef struct _IMAGE_DOS_HEADER
{
2201 WORD e_magic
; /* 00: MZ Header signature */
2202 WORD e_cblp
; /* 02: Bytes on last page of file */
2203 WORD e_cp
; /* 04: Pages in file */
2204 WORD e_crlc
; /* 06: Relocations */
2205 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
2206 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
2207 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
2208 WORD e_ss
; /* 0e: Initial (relative) SS value */
2209 WORD e_sp
; /* 10: Initial SP value */
2210 WORD e_csum
; /* 12: Checksum */
2211 WORD e_ip
; /* 14: Initial IP value */
2212 WORD e_cs
; /* 16: Initial (relative) CS value */
2213 WORD e_lfarlc
; /* 18: File address of relocation table */
2214 WORD e_ovno
; /* 1a: Overlay number */
2215 WORD e_res
[4]; /* 1c: Reserved words */
2216 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
2217 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
2218 WORD e_res2
[10]; /* 28: Reserved words */
2219 DWORD e_lfanew
; /* 3c: Offset to extended header */
2220 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
2221 #include <poppack.h>
2223 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2224 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2225 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2226 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2227 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2228 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2231 * This is the Windows executable (NE) header.
2232 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2234 #include <pshpack2.h>
2237 WORD ne_magic
; /* 00 NE signature 'NE' */
2238 BYTE ne_ver
; /* 02 Linker version number */
2239 BYTE ne_rev
; /* 03 Linker revision number */
2240 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
2241 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
2242 LONG ne_crc
; /* 08 Checksum */
2243 WORD ne_flags
; /* 0c Flags about segments in this file */
2244 WORD ne_autodata
; /* 0e Automatic data segment number */
2245 WORD ne_heap
; /* 10 Initial size of local heap */
2246 WORD ne_stack
; /* 12 Initial size of stack */
2247 DWORD ne_csip
; /* 14 Initial CS:IP */
2248 DWORD ne_sssp
; /* 18 Initial SS:SP */
2249 WORD ne_cseg
; /* 1c # of entries in segment table */
2250 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
2251 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
2252 WORD ne_segtab
; /* 22 Offset to segment table */
2253 WORD ne_rsrctab
; /* 24 Offset to resource table */
2254 WORD ne_restab
; /* 26 Offset to resident-name table */
2255 WORD ne_modtab
; /* 28 Offset to module reference table */
2256 WORD ne_imptab
; /* 2a Offset to imported name table */
2257 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
2258 WORD ne_cmovent
; /* 30 # of movable entry points */
2259 WORD ne_align
; /* 32 Logical sector alignment shift count */
2260 WORD ne_cres
; /* 34 # of resource segments */
2261 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
2262 BYTE ne_flagsothers
; /* 37 Additional information flags */
2263 WORD ne_pretthunks
; /* 38 Offset to return thunks */
2264 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
2265 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
2266 WORD ne_expver
; /* 3e Expected Windows version number */
2267 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
2268 #include <poppack.h>
2270 #include <pshpack2.h>
2271 typedef struct _IMAGE_VXD_HEADER
{
2286 DWORD e32_lastpagesize
;
2287 DWORD e32_fixupsize
;
2304 DWORD e32_impmodcnt
;
2310 DWORD e32_cbnrestab
;
2313 DWORD e32_debuginfo
;
2315 DWORD e32_instpreload
;
2316 DWORD e32_instdemand
;
2319 DWORD e32_winresoff
;
2320 DWORD e32_winreslen
;
2323 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
2324 #include <poppack.h>
2326 /* These defines describe the meanings of the bits in the Characteristics
2329 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2330 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2331 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2332 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2333 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2334 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2335 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2336 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2337 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2338 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2339 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2340 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2341 #define IMAGE_FILE_SYSTEM 0x1000
2342 #define IMAGE_FILE_DLL 0x2000
2343 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2344 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2346 /* These are the settings of the Machine field. */
2347 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2348 #define IMAGE_FILE_MACHINE_I860 0x014d
2349 #define IMAGE_FILE_MACHINE_I386 0x014c
2350 #define IMAGE_FILE_MACHINE_R3000 0x0162
2351 #define IMAGE_FILE_MACHINE_R4000 0x0166
2352 #define IMAGE_FILE_MACHINE_R10000 0x0168
2353 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2354 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2355 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2356 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2357 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2358 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2359 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2360 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2361 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2362 #define IMAGE_FILE_MACHINE_ARMV7 0x01c4
2363 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2364 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2365 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2366 #define IMAGE_FILE_MACHINE_IA64 0x0200
2367 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2368 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2369 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2370 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2371 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2372 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2373 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2374 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2375 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2376 #define IMAGE_FILE_MACHINE_M32R 0x9041
2377 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2379 /* Wine extension */
2380 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2382 #define IMAGE_SIZEOF_FILE_HEADER 20
2383 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2384 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2385 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2386 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2387 #define IMAGE_SIZEOF_SHORT_NAME 8
2388 #define IMAGE_SIZEOF_SECTION_HEADER 40
2389 #define IMAGE_SIZEOF_SYMBOL 18
2390 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2391 #define IMAGE_SIZEOF_RELOCATION 10
2392 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2393 #define IMAGE_SIZEOF_LINENUMBER 6
2394 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2396 /* Possible Magic values */
2397 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2398 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2399 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2402 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2403 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2405 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2406 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2409 /* These are indexes into the DataDirectory array */
2410 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2411 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2412 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2413 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2414 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2415 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2416 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2417 #define IMAGE_FILE_DESCRIPTION_STRING 7
2418 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2419 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2420 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2422 /* Directory Entries, indices into the DataDirectory array */
2424 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2425 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2426 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2427 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2428 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2429 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2430 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2431 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2432 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2433 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2434 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2435 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2436 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2437 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2438 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2440 /* Subsystem Values */
2442 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2443 #define IMAGE_SUBSYSTEM_NATIVE 1
2444 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2445 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2446 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2447 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2448 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2449 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2450 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2451 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2452 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2453 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2454 #define IMAGE_SUBSYSTEM_XBOX 14
2455 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2457 /* DLL Characteristics */
2458 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2459 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2460 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2461 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2462 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2463 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2464 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2465 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2467 typedef struct _IMAGE_FILE_HEADER
{
2469 WORD NumberOfSections
;
2470 DWORD TimeDateStamp
;
2471 DWORD PointerToSymbolTable
;
2472 DWORD NumberOfSymbols
;
2473 WORD SizeOfOptionalHeader
;
2474 WORD Characteristics
;
2475 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
2477 typedef struct _IMAGE_DATA_DIRECTORY
{
2478 DWORD VirtualAddress
;
2480 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
2482 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2484 typedef struct _IMAGE_OPTIONAL_HEADER64
{
2485 WORD Magic
; /* 0x20b */
2486 BYTE MajorLinkerVersion
;
2487 BYTE MinorLinkerVersion
;
2489 DWORD SizeOfInitializedData
;
2490 DWORD SizeOfUninitializedData
;
2491 DWORD AddressOfEntryPoint
;
2493 ULONGLONG ImageBase
;
2494 DWORD SectionAlignment
;
2495 DWORD FileAlignment
;
2496 WORD MajorOperatingSystemVersion
;
2497 WORD MinorOperatingSystemVersion
;
2498 WORD MajorImageVersion
;
2499 WORD MinorImageVersion
;
2500 WORD MajorSubsystemVersion
;
2501 WORD MinorSubsystemVersion
;
2502 DWORD Win32VersionValue
;
2504 DWORD SizeOfHeaders
;
2507 WORD DllCharacteristics
;
2508 ULONGLONG SizeOfStackReserve
;
2509 ULONGLONG SizeOfStackCommit
;
2510 ULONGLONG SizeOfHeapReserve
;
2511 ULONGLONG SizeOfHeapCommit
;
2513 DWORD NumberOfRvaAndSizes
;
2514 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
2515 } IMAGE_OPTIONAL_HEADER64
, *PIMAGE_OPTIONAL_HEADER64
;
2517 typedef struct _IMAGE_NT_HEADERS64
{
2519 IMAGE_FILE_HEADER FileHeader
;
2520 IMAGE_OPTIONAL_HEADER64 OptionalHeader
;
2521 } IMAGE_NT_HEADERS64
, *PIMAGE_NT_HEADERS64
;
2523 typedef struct _IMAGE_OPTIONAL_HEADER
{
2525 /* Standard fields */
2527 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
2528 BYTE MajorLinkerVersion
;
2529 BYTE MinorLinkerVersion
;
2531 DWORD SizeOfInitializedData
;
2532 DWORD SizeOfUninitializedData
;
2533 DWORD AddressOfEntryPoint
; /* 0x10 */
2537 /* NT additional fields */
2540 DWORD SectionAlignment
; /* 0x20 */
2541 DWORD FileAlignment
;
2542 WORD MajorOperatingSystemVersion
;
2543 WORD MinorOperatingSystemVersion
;
2544 WORD MajorImageVersion
;
2545 WORD MinorImageVersion
;
2546 WORD MajorSubsystemVersion
; /* 0x30 */
2547 WORD MinorSubsystemVersion
;
2548 DWORD Win32VersionValue
;
2550 DWORD SizeOfHeaders
;
2551 DWORD CheckSum
; /* 0x40 */
2553 WORD DllCharacteristics
;
2554 DWORD SizeOfStackReserve
;
2555 DWORD SizeOfStackCommit
;
2556 DWORD SizeOfHeapReserve
; /* 0x50 */
2557 DWORD SizeOfHeapCommit
;
2559 DWORD NumberOfRvaAndSizes
;
2560 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
2562 } IMAGE_OPTIONAL_HEADER32
, *PIMAGE_OPTIONAL_HEADER32
;
2564 typedef struct _IMAGE_NT_HEADERS
{
2565 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
2566 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
2567 IMAGE_OPTIONAL_HEADER32 OptionalHeader
; /* 0x18 */
2568 } IMAGE_NT_HEADERS32
, *PIMAGE_NT_HEADERS32
;
2571 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS
;
2572 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS
;
2573 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER
;
2574 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER
;
2576 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS
;
2577 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS
;
2578 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER
;
2579 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER
;
2582 #define IMAGE_SIZEOF_SHORT_NAME 8
2584 typedef struct _IMAGE_SECTION_HEADER
{
2585 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
2587 DWORD PhysicalAddress
;
2590 DWORD VirtualAddress
;
2591 DWORD SizeOfRawData
;
2592 DWORD PointerToRawData
;
2593 DWORD PointerToRelocations
;
2594 DWORD PointerToLinenumbers
;
2595 WORD NumberOfRelocations
;
2596 WORD NumberOfLinenumbers
;
2597 DWORD Characteristics
;
2598 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
2600 #define IMAGE_SIZEOF_SECTION_HEADER 40
2602 #define IMAGE_FIRST_SECTION(ntheader) \
2603 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2604 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2606 /* These defines are for the Characteristics bitfield. */
2607 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2608 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2609 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2610 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2611 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2612 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2614 #define IMAGE_SCN_CNT_CODE 0x00000020
2615 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2616 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2618 #define IMAGE_SCN_LNK_OTHER 0x00000100
2619 #define IMAGE_SCN_LNK_INFO 0x00000200
2620 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2621 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2622 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2624 /* 0x00002000 - Reserved */
2625 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2626 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2628 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2629 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2630 #define IMAGE_SCN_MEM_16BIT 0x00020000
2631 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2632 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2634 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2635 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2636 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2637 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2638 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2639 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2640 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2641 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2642 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2643 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2644 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2645 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2646 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2647 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2648 /* 0x00F00000 - Unused */
2649 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2651 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2654 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2655 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2656 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2657 #define IMAGE_SCN_MEM_SHARED 0x10000000
2658 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2659 #define IMAGE_SCN_MEM_READ 0x40000000
2660 #define IMAGE_SCN_MEM_WRITE 0x80000000
2662 #include <pshpack2.h>
2664 typedef struct _IMAGE_SYMBOL
{
2674 SHORT SectionNumber
;
2677 BYTE NumberOfAuxSymbols
;
2679 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2681 #define IMAGE_SIZEOF_SYMBOL 18
2683 typedef struct _IMAGE_LINENUMBER
{
2685 DWORD SymbolTableIndex
;
2686 DWORD VirtualAddress
;
2690 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2692 #define IMAGE_SIZEOF_LINENUMBER 6
2694 typedef union _IMAGE_AUX_SYMBOL
{
2706 DWORD PointerToLinenumber
;
2707 DWORD PointerToNextFunction
;
2716 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2720 WORD NumberOfRelocations
;
2721 WORD NumberOfLinenumbers
;
2727 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2729 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2731 #include <poppack.h>
2733 #define IMAGE_SYM_UNDEFINED (SHORT)0
2734 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2735 #define IMAGE_SYM_DEBUG (SHORT)-2
2737 #define IMAGE_SYM_TYPE_NULL 0x0000
2738 #define IMAGE_SYM_TYPE_VOID 0x0001
2739 #define IMAGE_SYM_TYPE_CHAR 0x0002
2740 #define IMAGE_SYM_TYPE_SHORT 0x0003
2741 #define IMAGE_SYM_TYPE_INT 0x0004
2742 #define IMAGE_SYM_TYPE_LONG 0x0005
2743 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2744 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2745 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2746 #define IMAGE_SYM_TYPE_UNION 0x0009
2747 #define IMAGE_SYM_TYPE_ENUM 0x000A
2748 #define IMAGE_SYM_TYPE_MOE 0x000B
2749 #define IMAGE_SYM_TYPE_BYTE 0x000C
2750 #define IMAGE_SYM_TYPE_WORD 0x000D
2751 #define IMAGE_SYM_TYPE_UINT 0x000E
2752 #define IMAGE_SYM_TYPE_DWORD 0x000F
2753 #define IMAGE_SYM_TYPE_PCODE 0x8000
2755 #define IMAGE_SYM_DTYPE_NULL 0
2756 #define IMAGE_SYM_DTYPE_POINTER 1
2757 #define IMAGE_SYM_DTYPE_FUNCTION 2
2758 #define IMAGE_SYM_DTYPE_ARRAY 3
2760 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2761 #define IMAGE_SYM_CLASS_NULL 0x0000
2762 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2763 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2764 #define IMAGE_SYM_CLASS_STATIC 0x0003
2765 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2766 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2767 #define IMAGE_SYM_CLASS_LABEL 0x0006
2768 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2769 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2770 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2771 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2772 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2773 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2774 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2775 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2776 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2777 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2778 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2779 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2781 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2782 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2783 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2784 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2785 #define IMAGE_SYM_CLASS_FILE 0x0067
2786 #define IMAGE_SYM_CLASS_SECTION 0x0068
2787 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2789 #define N_BTMASK 0x000F
2790 #define N_TMASK 0x0030
2791 #define N_TMASK1 0x00C0
2792 #define N_TMASK2 0x00F0
2796 #define BTYPE(x) ((x) & N_BTMASK)
2799 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2803 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2807 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2811 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2815 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2818 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2821 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2822 #define IMAGE_COMDAT_SELECT_ANY 2
2823 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2824 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2825 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2826 #define IMAGE_COMDAT_SELECT_LARGEST 6
2827 #define IMAGE_COMDAT_SELECT_NEWEST 7
2829 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2830 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2831 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2833 /* Export module directory */
2835 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2836 DWORD Characteristics
;
2837 DWORD TimeDateStamp
;
2842 DWORD NumberOfFunctions
;
2843 DWORD NumberOfNames
;
2844 DWORD AddressOfFunctions
;
2845 DWORD AddressOfNames
;
2846 DWORD AddressOfNameOrdinals
;
2847 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
2849 /* Import name entry */
2850 typedef struct _IMAGE_IMPORT_BY_NAME
{
2853 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
2855 #include <pshpack8.h>
2857 typedef struct _IMAGE_THUNK_DATA64
{
2859 ULONGLONG ForwarderString
;
2862 ULONGLONG AddressOfData
;
2864 } IMAGE_THUNK_DATA64
,*PIMAGE_THUNK_DATA64
;
2865 #include <poppack.h>
2867 typedef struct _IMAGE_THUNK_DATA32
{
2869 DWORD ForwarderString
;
2872 DWORD AddressOfData
;
2874 } IMAGE_THUNK_DATA32
,*PIMAGE_THUNK_DATA32
;
2876 /* Import module directory */
2878 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
2880 DWORD Characteristics
; /* 0 for terminating null import descriptor */
2881 DWORD OriginalFirstThunk
; /* RVA to original unbound IAT */
2883 DWORD TimeDateStamp
; /* 0 if not bound,
2884 * -1 if bound, and real date\time stamp
2885 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2887 * otherwise date/time stamp of DLL bound to
2890 DWORD ForwarderChain
; /* -1 if no forwarders */
2892 /* RVA to IAT (if bound this IAT has actual addresses) */
2894 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
2896 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
2897 #define IMAGE_ORDINAL_FLAG32 0x80000000
2898 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
2899 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
2900 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
2901 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
2904 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
2905 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
2906 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
2907 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA
;
2908 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA
;
2910 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
2911 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
2912 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
2913 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA
;
2914 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA
;
2917 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2919 DWORD TimeDateStamp
;
2920 WORD OffsetModuleName
;
2921 WORD NumberOfModuleForwarderRefs
;
2922 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2923 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
2925 typedef struct _IMAGE_BOUND_FORWARDER_REF
2927 DWORD TimeDateStamp
;
2928 WORD OffsetModuleName
;
2930 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
2932 typedef struct _IMAGE_BASE_RELOCATION
2934 DWORD VirtualAddress
;
2936 /* WORD TypeOffset[1]; */
2937 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
2939 #include <pshpack2.h>
2941 typedef struct _IMAGE_RELOCATION
2944 DWORD VirtualAddress
;
2947 DWORD SymbolTableIndex
;
2949 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
2951 #include <poppack.h>
2953 #define IMAGE_SIZEOF_RELOCATION 10
2955 /* generic relocation types */
2956 #define IMAGE_REL_BASED_ABSOLUTE 0
2957 #define IMAGE_REL_BASED_HIGH 1
2958 #define IMAGE_REL_BASED_LOW 2
2959 #define IMAGE_REL_BASED_HIGHLOW 3
2960 #define IMAGE_REL_BASED_HIGHADJ 4
2961 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2962 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
2963 #define IMAGE_REL_BASED_SECTION 6
2964 #define IMAGE_REL_BASED_REL 7
2965 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
2966 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2967 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2968 #define IMAGE_REL_BASED_DIR64 10
2969 #define IMAGE_REL_BASED_HIGH3ADJ 11
2971 /* I386 relocation types */
2972 #define IMAGE_REL_I386_ABSOLUTE 0
2973 #define IMAGE_REL_I386_DIR16 1
2974 #define IMAGE_REL_I386_REL16 2
2975 #define IMAGE_REL_I386_DIR32 6
2976 #define IMAGE_REL_I386_DIR32NB 7
2977 #define IMAGE_REL_I386_SEG12 9
2978 #define IMAGE_REL_I386_SECTION 10
2979 #define IMAGE_REL_I386_SECREL 11
2980 #define IMAGE_REL_I386_TOKEN 12
2981 #define IMAGE_REL_I386_SECREL7 13
2982 #define IMAGE_REL_I386_REL32 20
2984 /* MIPS relocation types */
2985 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2986 #define IMAGE_REL_MIPS_REFHALF 0x0001
2987 #define IMAGE_REL_MIPS_REFWORD 0x0002
2988 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2989 #define IMAGE_REL_MIPS_REFHI 0x0004
2990 #define IMAGE_REL_MIPS_REFLO 0x0005
2991 #define IMAGE_REL_MIPS_GPREL 0x0006
2992 #define IMAGE_REL_MIPS_LITERAL 0x0007
2993 #define IMAGE_REL_MIPS_SECTION 0x000A
2994 #define IMAGE_REL_MIPS_SECREL 0x000B
2995 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2996 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2997 #define IMAGE_REL_MIPS_TOKEN 0x000E
2998 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2999 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3000 #define IMAGE_REL_MIPS_PAIR 0x0025
3002 /* ALPHA relocation types */
3003 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3004 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3005 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3006 #define IMAGE_REL_ALPHA_GPREL 0x0003
3007 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3008 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3009 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3010 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3011 #define IMAGE_REL_ALPHA_HINT 0x0008
3012 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3013 #define IMAGE_REL_ALPHA_REFHI 0x000A
3014 #define IMAGE_REL_ALPHA_REFLO 0x000B
3015 #define IMAGE_REL_ALPHA_PAIR 0x000C
3016 #define IMAGE_REL_ALPHA_MATCH 0x000D
3017 #define IMAGE_REL_ALPHA_SECTION 0x000E
3018 #define IMAGE_REL_ALPHA_SECREL 0x000F
3019 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3020 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3021 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3022 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3023 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3024 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3025 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3026 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3028 /* PowerPC relocation types */
3029 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3030 #define IMAGE_REL_PPC_ADDR64 0x0001
3031 #define IMAGE_REL_PPC_ADDR 0x0002
3032 #define IMAGE_REL_PPC_ADDR24 0x0003
3033 #define IMAGE_REL_PPC_ADDR16 0x0004
3034 #define IMAGE_REL_PPC_ADDR14 0x0005
3035 #define IMAGE_REL_PPC_REL24 0x0006
3036 #define IMAGE_REL_PPC_REL14 0x0007
3037 #define IMAGE_REL_PPC_TOCREL16 0x0008
3038 #define IMAGE_REL_PPC_TOCREL14 0x0009
3039 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3040 #define IMAGE_REL_PPC_SECREL 0x000B
3041 #define IMAGE_REL_PPC_SECTION 0x000C
3042 #define IMAGE_REL_PPC_IFGLUE 0x000D
3043 #define IMAGE_REL_PPC_IMGLUE 0x000E
3044 #define IMAGE_REL_PPC_SECREL16 0x000F
3045 #define IMAGE_REL_PPC_REFHI 0x0010
3046 #define IMAGE_REL_PPC_REFLO 0x0011
3047 #define IMAGE_REL_PPC_PAIR 0x0012
3048 #define IMAGE_REL_PPC_SECRELLO 0x0013
3049 #define IMAGE_REL_PPC_SECRELHI 0x0014
3050 #define IMAGE_REL_PPC_GPREL 0x0015
3051 #define IMAGE_REL_PPC_TOKEN 0x0016
3052 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3054 #define IMAGE_REL_PPC_NEG 0x0100
3055 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3056 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3057 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3059 /* SH3 relocation types */
3060 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3061 #define IMAGE_REL_SH3_DIRECT16 0x0001
3062 #define IMAGE_REL_SH3_DIRECT 0x0002
3063 #define IMAGE_REL_SH3_DIRECT8 0x0003
3064 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3065 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3066 #define IMAGE_REL_SH3_DIRECT4 0x0006
3067 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3068 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3069 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3070 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3071 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3072 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3073 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3074 #define IMAGE_REL_SH3_SECTION 0x000E
3075 #define IMAGE_REL_SH3_SECREL 0x000F
3076 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3077 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3078 #define IMAGE_REL_SH3_TOKEN 0x0012
3080 /* ARM relocation types */
3081 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3082 #define IMAGE_REL_ARM_ADDR 0x0001
3083 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3084 #define IMAGE_REL_ARM_BRANCH24 0x0003
3085 #define IMAGE_REL_ARM_BRANCH11 0x0004
3086 #define IMAGE_REL_ARM_TOKEN 0x0005
3087 #define IMAGE_REL_ARM_GPREL12 0x0006
3088 #define IMAGE_REL_ARM_GPREL7 0x0007
3089 #define IMAGE_REL_ARM_BLX24 0x0008
3090 #define IMAGE_REL_ARM_BLX11 0x0009
3091 #define IMAGE_REL_ARM_SECTION 0x000E
3092 #define IMAGE_REL_ARM_SECREL 0x000F
3093 #define IMAGE_REL_ARM_MOV32A 0x0010
3094 #define IMAGE_REL_ARM_MOV32T 0x0011
3095 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3096 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3097 #define IMAGE_REL_ARM_BLX23T 0x0015
3099 /* IA64 relocation types */
3100 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3101 #define IMAGE_REL_IA64_IMM14 0x0001
3102 #define IMAGE_REL_IA64_IMM22 0x0002
3103 #define IMAGE_REL_IA64_IMM64 0x0003
3104 #define IMAGE_REL_IA64_DIR 0x0004
3105 #define IMAGE_REL_IA64_DIR64 0x0005
3106 #define IMAGE_REL_IA64_PCREL21B 0x0006
3107 #define IMAGE_REL_IA64_PCREL21M 0x0007
3108 #define IMAGE_REL_IA64_PCREL21F 0x0008
3109 #define IMAGE_REL_IA64_GPREL22 0x0009
3110 #define IMAGE_REL_IA64_LTOFF22 0x000A
3111 #define IMAGE_REL_IA64_SECTION 0x000B
3112 #define IMAGE_REL_IA64_SECREL22 0x000C
3113 #define IMAGE_REL_IA64_SECREL64I 0x000D
3114 #define IMAGE_REL_IA64_SECREL 0x000E
3115 #define IMAGE_REL_IA64_LTOFF64 0x000F
3116 #define IMAGE_REL_IA64_DIR32NB 0x0010
3117 #define IMAGE_REL_IA64_SREL14 0x0011
3118 #define IMAGE_REL_IA64_SREL22 0x0012
3119 #define IMAGE_REL_IA64_SREL32 0x0013
3120 #define IMAGE_REL_IA64_UREL32 0x0014
3121 #define IMAGE_REL_IA64_PCREL60X 0x0015
3122 #define IMAGE_REL_IA64_PCREL60B 0x0016
3123 #define IMAGE_REL_IA64_PCREL60F 0x0017
3124 #define IMAGE_REL_IA64_PCREL60I 0x0018
3125 #define IMAGE_REL_IA64_PCREL60M 0x0019
3126 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3127 #define IMAGE_REL_IA64_TOKEN 0x001B
3128 #define IMAGE_REL_IA64_GPREL32 0x001C
3129 #define IMAGE_REL_IA64_ADDEND 0x001F
3131 /* AMD64 relocation types */
3132 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3133 #define IMAGE_REL_AMD64_ADDR64 0x0001
3134 #define IMAGE_REL_AMD64_ADDR32 0x0002
3135 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3136 #define IMAGE_REL_AMD64_REL32 0x0004
3137 #define IMAGE_REL_AMD64_REL32_1 0x0005
3138 #define IMAGE_REL_AMD64_REL32_2 0x0006
3139 #define IMAGE_REL_AMD64_REL32_3 0x0007
3140 #define IMAGE_REL_AMD64_REL32_4 0x0008
3141 #define IMAGE_REL_AMD64_REL32_5 0x0009
3142 #define IMAGE_REL_AMD64_SECTION 0x000A
3143 #define IMAGE_REL_AMD64_SECREL 0x000B
3144 #define IMAGE_REL_AMD64_SECREL7 0x000C
3145 #define IMAGE_REL_AMD64_TOKEN 0x000D
3146 #define IMAGE_REL_AMD64_SREL32 0x000E
3147 #define IMAGE_REL_AMD64_PAIR 0x000F
3148 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3150 /* archive format */
3152 #define IMAGE_ARCHIVE_START_SIZE 8
3153 #define IMAGE_ARCHIVE_START "!<arch>\n"
3154 #define IMAGE_ARCHIVE_END "`\n"
3155 #define IMAGE_ARCHIVE_PAD "\n"
3156 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3157 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3159 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3168 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
3170 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3172 typedef struct _IMPORT_OBJECT_HEADER
3178 DWORD TimeDateStamp
;
3188 } IMPORT_OBJECT_HEADER
;
3190 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3192 typedef enum IMPORT_OBJECT_TYPE
3194 IMPORT_OBJECT_CODE
= 0,
3195 IMPORT_OBJECT_DATA
= 1,
3196 IMPORT_OBJECT_CONST
= 2
3197 } IMPORT_OBJECT_TYPE
;
3199 typedef enum IMPORT_OBJECT_NAME_TYPE
3201 IMPORT_OBJECT_ORDINAL
= 0,
3202 IMPORT_OBJECT_NAME
= 1,
3203 IMPORT_OBJECT_NAME_NO_PREFIX
= 2,
3204 IMPORT_OBJECT_NAME_UNDECORATE
= 3
3205 } IMPORT_OBJECT_NAME_TYPE
;
3207 typedef struct _ANON_OBJECT_HEADER
3213 DWORD TimeDateStamp
;
3216 } ANON_OBJECT_HEADER
;
3219 * Resource directory stuff
3221 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
3222 DWORD Characteristics
;
3223 DWORD TimeDateStamp
;
3226 WORD NumberOfNamedEntries
;
3227 WORD NumberOfIdEntries
;
3228 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3229 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
3231 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3232 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3234 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
3237 #ifdef BITFIELDS_BIGENDIAN
3238 unsigned NameIsString
:1;
3239 unsigned NameOffset
:31;
3241 unsigned NameOffset
:31;
3242 unsigned NameIsString
:1;
3247 #ifdef WORDS_BIGENDIAN
3259 #ifdef BITFIELDS_BIGENDIAN
3260 unsigned DataIsDirectory
:1;
3261 unsigned OffsetToDirectory
:31;
3263 unsigned OffsetToDirectory
:31;
3264 unsigned DataIsDirectory
:1;
3268 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
3271 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
3273 CHAR NameString
[ 1 ];
3274 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
3276 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
3278 WCHAR NameString
[ 1 ];
3279 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
3281 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
3286 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
3289 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
3290 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
3293 typedef struct _IMAGE_TLS_DIRECTORY64
{
3294 ULONGLONG StartAddressOfRawData
;
3295 ULONGLONG EndAddressOfRawData
;
3296 ULONGLONG AddressOfIndex
;
3297 ULONGLONG AddressOfCallBacks
;
3298 DWORD SizeOfZeroFill
;
3299 DWORD Characteristics
;
3300 } IMAGE_TLS_DIRECTORY64
, *PIMAGE_TLS_DIRECTORY64
;
3302 typedef struct _IMAGE_TLS_DIRECTORY32
{
3303 DWORD StartAddressOfRawData
;
3304 DWORD EndAddressOfRawData
;
3305 DWORD AddressOfIndex
;
3306 DWORD AddressOfCallBacks
;
3307 DWORD SizeOfZeroFill
;
3308 DWORD Characteristics
;
3309 } IMAGE_TLS_DIRECTORY32
, *PIMAGE_TLS_DIRECTORY32
;
3312 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY
;
3313 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY
;
3315 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY
;
3316 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY
;
3319 typedef struct _IMAGE_DEBUG_DIRECTORY
{
3320 DWORD Characteristics
;
3321 DWORD TimeDateStamp
;
3326 DWORD AddressOfRawData
;
3327 DWORD PointerToRawData
;
3328 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
3330 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3331 #define IMAGE_DEBUG_TYPE_COFF 1
3332 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3333 #define IMAGE_DEBUG_TYPE_FPO 3
3334 #define IMAGE_DEBUG_TYPE_MISC 4
3335 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3336 #define IMAGE_DEBUG_TYPE_FIXUP 6
3337 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3338 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3339 #define IMAGE_DEBUG_TYPE_BORLAND 9
3340 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3342 typedef enum ReplacesCorHdrNumericDefines
3344 COMIMAGE_FLAGS_ILONLY
= 0x00000001,
3345 COMIMAGE_FLAGS_32BITREQUIRED
= 0x00000002,
3346 COMIMAGE_FLAGS_IL_LIBRARY
= 0x00000004,
3347 COMIMAGE_FLAGS_STRONGNAMESIGNED
= 0x00000008,
3348 COMIMAGE_FLAGS_TRACKDEBUGDATA
= 0x00010000,
3350 COR_VERSION_MAJOR_V2
= 2,
3351 COR_VERSION_MAJOR
= COR_VERSION_MAJOR_V2
,
3352 COR_VERSION_MINOR
= 0,
3353 COR_DELETED_NAME_LENGTH
= 8,
3354 COR_VTABLEGAP_NAME_LENGTH
= 8,
3356 NATIVE_TYPE_MAX_CB
= 1,
3357 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE
= 0xff,
3359 IMAGE_COR_MIH_METHODRVA
= 0x01,
3360 IMAGE_COR_MIH_EHRVA
= 0x02,
3361 IMAGE_COR_MIH_BASICBLOCK
= 0x08,
3363 COR_VTABLE_32BIT
= 0x01,
3364 COR_VTABLE_64BIT
= 0x02,
3365 COR_VTABLE_FROM_UNMANAGED
= 0x04,
3366 COR_VTABLE_CALL_MOST_DERIVED
= 0x10,
3368 IMAGE_COR_EATJ_THUNK_SIZE
= 32,
3370 MAX_CLASS_NAME
= 1024,
3371 MAX_PACKAGE_NAME
= 1024,
3372 } ReplacesCorHdrNumericDefines
;
3374 typedef struct IMAGE_COR20_HEADER
3377 WORD MajorRuntimeVersion
;
3378 WORD MinorRuntimeVersion
;
3380 IMAGE_DATA_DIRECTORY MetaData
;
3382 DWORD EntryPointToken
;
3384 IMAGE_DATA_DIRECTORY Resources
;
3385 IMAGE_DATA_DIRECTORY StrongNameSignature
;
3386 IMAGE_DATA_DIRECTORY CodeManagerTable
;
3387 IMAGE_DATA_DIRECTORY VTableFixups
;
3388 IMAGE_DATA_DIRECTORY ExportAddressTableJumps
;
3389 IMAGE_DATA_DIRECTORY ManagedNativeHeader
;
3391 } IMAGE_COR20_HEADER
, *PIMAGE_COR20_HEADER
;
3393 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
3394 DWORD NumberOfSymbols
;
3395 DWORD LvaToFirstSymbol
;
3396 DWORD NumberOfLinenumbers
;
3397 DWORD LvaToFirstLinenumber
;
3398 DWORD RvaToFirstByteOfCode
;
3399 DWORD RvaToLastByteOfCode
;
3400 DWORD RvaToFirstByteOfData
;
3401 DWORD RvaToLastByteOfData
;
3402 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
3405 #define FRAME_TRAP 1
3407 #define FRAME_NONFPO 3
3409 typedef struct _FPO_DATA
{
3420 } FPO_DATA
, *PFPO_DATA
;
3422 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
3424 DWORD TimeDateStamp
;
3427 DWORD GlobalFlagsClear
;
3428 DWORD GlobalFlagsSet
;
3429 DWORD CriticalSectionDefaultTimeout
;
3430 DWORD DeCommitFreeBlockThreshold
;
3431 DWORD DeCommitTotalFreeThreshold
;
3432 PVOID LockPrefixTable
;
3433 DWORD MaximumAllocationSize
;
3434 DWORD VirtualMemoryThreshold
;
3435 DWORD ProcessHeapFlags
;
3436 DWORD ProcessAffinityMask
;
3440 DWORD SecurityCookie
;
3441 DWORD SEHandlerTable
;
3442 DWORD SEHandlerCount
;
3443 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
3445 typedef struct _IMAGE_FUNCTION_ENTRY
{
3446 DWORD StartingAddress
;
3447 DWORD EndingAddress
;
3448 DWORD EndOfPrologue
;
3449 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
3451 #define IMAGE_DEBUG_MISC_EXENAME 1
3453 typedef struct _IMAGE_DEBUG_MISC
{
3459 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
3461 /* This is the structure that appears at the very start of a .DBG file. */
3463 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
3467 WORD Characteristics
;
3468 DWORD TimeDateStamp
;
3472 DWORD NumberOfSections
;
3473 DWORD ExportedNamesSize
;
3474 DWORD DebugDirectorySize
;
3475 DWORD SectionAlignment
;
3476 DWORD Reserved
[ 2 ];
3477 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
3479 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3482 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
3486 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
3487 #define MESSAGE_RESOURCE_UNICODE 0x0001
3489 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
3492 DWORD OffsetToEntries
;
3493 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
3495 typedef struct tagMESSAGE_RESOURCE_DATA
{
3496 DWORD NumberOfBlocks
;
3497 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
3498 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
3501 * Here follows typedefs for security and tokens.
3505 * First a constant for the following typedefs.
3508 #define ANYSIZE_ARRAY 1
3510 /* FIXME: Orphan. What does it point to? */
3511 typedef PVOID PACCESS_TOKEN
;
3512 typedef PVOID PSECURITY_DESCRIPTOR
;
3515 typedef enum _TOKEN_ELEVATION_TYPE
{
3516 TokenElevationTypeDefault
= 1,
3517 TokenElevationTypeFull
,
3518 TokenElevationTypeLimited
3519 } TOKEN_ELEVATION_TYPE
, *PTOKEN_ELEVATION_TYPE
;
3522 * TOKEN_INFORMATION_CLASS
3525 typedef enum _TOKEN_INFORMATION_CLASS
{
3534 TokenImpersonationLevel
,
3536 TokenRestrictedSids
,
3538 TokenGroupsAndPrivileges
,
3539 TokenSessionReference
,
3546 TokenHasRestrictions
,
3547 TokenAccessInformation
,
3548 TokenVirtualizationAllowed
,
3549 TokenVirtualizationEnabled
,
3550 TokenIntegrityLevel
,
3552 TokenMandatoryPolicy
,
3555 } TOKEN_INFORMATION_CLASS
;
3557 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3558 #define TOKEN_ADJUST_GROUPS 0x0040
3559 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3560 #define TOKEN_ADJUST_SESSIONID 0x0100
3561 #define TOKEN_ASSIGN_PRIMARY 0x0001
3562 #define TOKEN_DUPLICATE 0x0002
3563 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3564 #define TOKEN_IMPERSONATE 0x0004
3565 #define TOKEN_QUERY 0x0008
3566 #define TOKEN_QUERY_SOURCE 0x0010
3567 #define TOKEN_ADJUST_DEFAULT 0x0080
3568 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3569 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3570 TOKEN_ADJUST_PRIVILEGES | \
3571 TOKEN_ADJUST_GROUPS | \
3572 TOKEN_ADJUST_DEFAULT )
3573 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3574 TOKEN_ASSIGN_PRIMARY | \
3576 TOKEN_IMPERSONATE | \
3578 TOKEN_QUERY_SOURCE | \
3579 TOKEN_ADJUST_PRIVILEGES | \
3580 TOKEN_ADJUST_GROUPS | \
3581 TOKEN_ADJUST_SESSIONID | \
3582 TOKEN_ADJUST_DEFAULT )
3584 #ifndef _SECURITY_DEFINED
3585 #define _SECURITY_DEFINED
3588 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
3590 typedef struct _GENERIC_MAPPING
{
3591 ACCESS_MASK GenericRead
;
3592 ACCESS_MASK GenericWrite
;
3593 ACCESS_MASK GenericExecute
;
3594 ACCESS_MASK GenericAll
;
3595 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
3597 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3598 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3601 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
3602 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3606 typedef struct _SID
{
3608 BYTE SubAuthorityCount
;
3609 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
3610 DWORD SubAuthority
[1];
3612 #endif /* !defined(SID_DEFINED) */
3614 #define SID_REVISION (1) /* Current revision */
3615 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3616 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3618 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3624 #define ACL_REVISION1 1
3625 #define ACL_REVISION2 2
3626 #define ACL_REVISION3 3
3627 #define ACL_REVISION4 4
3629 #define MIN_ACL_REVISION ACL_REVISION2
3630 #define MAX_ACL_REVISION ACL_REVISION4
3632 #define ACL_REVISION 2
3634 typedef struct _ACL
{
3642 typedef enum _ACL_INFORMATION_CLASS
3644 AclRevisionInformation
= 1,
3646 } ACL_INFORMATION_CLASS
;
3648 typedef struct _ACL_REVISION_INFORMATION
3651 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
3653 typedef struct _ACL_SIZE_INFORMATION
3656 DWORD AclBytesInUse
;
3658 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
3660 /* SECURITY_DESCRIPTOR */
3661 #define SECURITY_DESCRIPTOR_REVISION 1
3662 #define SECURITY_DESCRIPTOR_REVISION1 1
3668 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3669 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3670 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3671 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3672 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3673 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3674 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3675 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3676 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3677 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3678 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3679 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3680 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3681 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3682 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3683 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3684 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3685 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3686 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3687 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3688 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3689 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3690 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3691 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3692 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3693 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3694 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3695 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3696 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3698 #define SE_GROUP_MANDATORY 0x00000001
3699 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3700 #define SE_GROUP_ENABLED 0x00000004
3701 #define SE_GROUP_OWNER 0x00000008
3702 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3703 #define SE_GROUP_LOGON_ID 0xC0000000
3704 #define SE_GROUP_RESOURCE 0x20000000
3706 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3707 #define SE_PRIVILEGE_ENABLED 0x00000002
3708 #define SE_PRIVILEGE_REMOVED 0x00000004
3709 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3711 #define PRIVILEGE_SET_ALL_NECESSARY 1
3713 #define SE_OWNER_DEFAULTED 0x00000001
3714 #define SE_GROUP_DEFAULTED 0x00000002
3715 #define SE_DACL_PRESENT 0x00000004
3716 #define SE_DACL_DEFAULTED 0x00000008
3717 #define SE_SACL_PRESENT 0x00000010
3718 #define SE_SACL_DEFAULTED 0x00000020
3719 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3720 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3721 #define SE_DACL_AUTO_INHERITED 0x00000400
3722 #define SE_SACL_AUTO_INHERITED 0x00000800
3723 #define SE_DACL_PROTECTED 0x00001000
3724 #define SE_SACL_PROTECTED 0x00002000
3725 #define SE_RM_CONTROL_VALID 0x00004000
3726 #define SE_SELF_RELATIVE 0x00008000
3728 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
3729 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
3731 /* The security descriptor structure */
3735 SECURITY_DESCRIPTOR_CONTROL Control
;
3740 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
3745 SECURITY_DESCRIPTOR_CONTROL Control
;
3750 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
3752 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3754 #endif /* _SECURITY_DEFINED */
3757 * SID_AND_ATTRIBUTES
3760 typedef struct _SID_AND_ATTRIBUTES
{
3763 } SID_AND_ATTRIBUTES
, *PSID_AND_ATTRIBUTES
;
3765 /* security entities */
3766 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
3767 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
3768 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
3770 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3773 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3776 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3779 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3780 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
3781 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
3782 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
3783 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
3786 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3789 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3790 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
3791 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
3792 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
3793 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
3794 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
3795 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
3796 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
3797 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
3798 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
3799 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3800 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
3801 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
3802 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
3803 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
3804 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
3805 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
3806 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
3807 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
3808 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
3809 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
3810 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
3812 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
3813 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
3814 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
3815 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
3816 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
3817 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
3818 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
3820 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
3821 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
3822 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
3823 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
3824 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
3826 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
3827 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
3828 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
3829 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
3830 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
3831 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
3832 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
3833 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
3834 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
3836 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
3837 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
3838 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
3839 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
3840 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
3841 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
3842 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
3844 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
3845 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
3846 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
3847 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
3849 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
3850 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
3851 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
3852 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
3854 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
3855 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
3856 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
3857 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
3858 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
3859 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
3861 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
3862 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
3863 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
3864 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
3865 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
3867 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3869 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
3870 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
3876 WinCreatorOwnerSid
= 3,
3877 WinCreatorGroupSid
= 4,
3878 WinCreatorOwnerServerSid
= 5,
3879 WinCreatorGroupServerSid
= 6,
3880 WinNtAuthoritySid
= 7,
3884 WinInteractiveSid
= 11,
3886 WinAnonymousSid
= 13,
3888 WinEnterpriseControllersSid
= 15,
3890 WinAuthenticatedUserSid
= 17,
3891 WinRestrictedCodeSid
= 18,
3892 WinTerminalServerSid
= 19,
3893 WinRemoteLogonIdSid
= 20,
3894 WinLogonIdsSid
= 21,
3895 WinLocalSystemSid
= 22,
3896 WinLocalServiceSid
= 23,
3897 WinNetworkServiceSid
= 24,
3898 WinBuiltinDomainSid
= 25,
3899 WinBuiltinAdministratorsSid
= 26,
3900 WinBuiltinUsersSid
= 27,
3901 WinBuiltinGuestsSid
= 28,
3902 WinBuiltinPowerUsersSid
= 29,
3903 WinBuiltinAccountOperatorsSid
= 30,
3904 WinBuiltinSystemOperatorsSid
= 31,
3905 WinBuiltinPrintOperatorsSid
= 32,
3906 WinBuiltinBackupOperatorsSid
= 33,
3907 WinBuiltinReplicatorSid
= 34,
3908 WinBuiltinPreWindows2000CompatibleAccessSid
= 35,
3909 WinBuiltinRemoteDesktopUsersSid
= 36,
3910 WinBuiltinNetworkConfigurationOperatorsSid
= 37,
3911 WinAccountAdministratorSid
= 38,
3912 WinAccountGuestSid
= 39,
3913 WinAccountKrbtgtSid
= 40,
3914 WinAccountDomainAdminsSid
= 41,
3915 WinAccountDomainUsersSid
= 42,
3916 WinAccountDomainGuestsSid
= 43,
3917 WinAccountComputersSid
= 44,
3918 WinAccountControllersSid
= 45,
3919 WinAccountCertAdminsSid
= 46,
3920 WinAccountSchemaAdminsSid
= 47,
3921 WinAccountEnterpriseAdminsSid
= 48,
3922 WinAccountPolicyAdminsSid
= 49,
3923 WinAccountRasAndIasServersSid
= 50,
3924 WinNTLMAuthenticationSid
= 51,
3925 WinDigestAuthenticationSid
= 52,
3926 WinSChannelAuthenticationSid
= 53,
3927 WinThisOrganizationSid
= 54,
3928 WinOtherOrganizationSid
= 55,
3929 WinBuiltinIncomingForestTrustBuildersSid
= 56,
3930 WinBuiltinPerfMonitoringUsersSid
= 57,
3931 WinBuiltinPerfLoggingUsersSid
= 58,
3932 WinBuiltinAuthorizationAccessSid
= 59,
3933 WinBuiltinTerminalServerLicenseServersSid
= 60,
3934 WinBuiltinDCOMUsersSid
= 61,
3935 WinBuiltinIUsersSid
= 62,
3937 WinBuiltinCryptoOperatorsSid
= 64,
3938 WinUntrustedLabelSid
= 65,
3939 WinLowLabelSid
= 66,
3940 WinMediumLabelSid
= 67,
3941 WinHighLabelSid
= 68,
3942 WinSystemLabelSid
= 69,
3943 WinWriteRestrictedCodeSid
= 70,
3944 WinCreatorOwnerRightsSid
= 71,
3945 WinCacheablePrincipalsGroupSid
= 72,
3946 WinNonCacheablePrincipalsGroupSid
= 73,
3947 WinEnterpriseReadonlyControllersSid
= 74,
3948 WinAccountReadonlyControllersSid
= 75,
3949 WinBuiltinEventLogReadersGroup
= 76,
3950 WinNewEnterpriseReadonlyControllersSid
= 77,
3951 WinBuiltinCertSvcDComAccessGroup
= 78,
3952 WinMediumPlusLabelSid
= 79,
3953 WinLocalLogonSid
= 80,
3954 WinConsoleLogonSid
= 81,
3955 WinThisOrganizationCertificateSid
= 82,
3956 } WELL_KNOWN_SID_TYPE
;
3962 typedef struct _TOKEN_USER
{
3963 SID_AND_ATTRIBUTES User
;
3964 } TOKEN_USER
, *PTOKEN_USER
;
3970 typedef struct _TOKEN_GROUPS
{
3972 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
3973 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
3976 * LUID_AND_ATTRIBUTES
3979 typedef union _LARGE_INTEGER
{
3981 #ifdef WORDS_BIGENDIAN
3989 #ifndef NONAMELESSSTRUCT
3991 #ifdef WORDS_BIGENDIAN
4001 } LARGE_INTEGER
, *PLARGE_INTEGER
;
4003 typedef union _ULARGE_INTEGER
{
4005 #ifdef WORDS_BIGENDIAN
4013 #ifndef NONAMELESSSTRUCT
4015 #ifdef WORDS_BIGENDIAN
4025 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
4028 * Locally Unique Identifier
4031 typedef struct _LUID
{
4036 #include <pshpack4.h>
4037 typedef struct _LUID_AND_ATTRIBUTES
{
4040 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
4041 #include <poppack.h>
4047 typedef struct _PRIVILEGE_SET
{
4048 DWORD PrivilegeCount
;
4050 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
4051 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
4057 typedef struct _TOKEN_PRIVILEGES
{
4058 DWORD PrivilegeCount
;
4059 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
4060 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
4066 typedef struct _TOKEN_OWNER
{
4068 } TOKEN_OWNER
, *PTOKEN_OWNER
;
4071 * TOKEN_PRIMARY_GROUP
4074 typedef struct _TOKEN_PRIMARY_GROUP
{
4076 } TOKEN_PRIMARY_GROUP
, *PTOKEN_PRIMARY_GROUP
;
4080 * TOKEN_DEFAULT_DACL
4083 typedef struct _TOKEN_DEFAULT_DACL
{
4085 } TOKEN_DEFAULT_DACL
, *PTOKEN_DEFAULT_DACL
;
4091 #define TOKEN_SOURCE_LENGTH 8
4093 typedef struct _TOKEN_SOURCE
{
4094 char SourceName
[TOKEN_SOURCE_LENGTH
];
4095 LUID SourceIdentifier
;
4096 } TOKEN_SOURCE
, *PTOKEN_SOURCE
;
4102 typedef enum tagTOKEN_TYPE
{
4108 * SECURITY_IMPERSONATION_LEVEL
4111 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
4113 SecurityIdentification
,
4114 SecurityImpersonation
,
4116 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
4118 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4119 #define SECURITY_STATIC_TRACKING (FALSE)
4121 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
4122 * PSECURITY_CONTEXT_TRACKING_MODE
;
4124 * Quality of Service
4127 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
4129 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4130 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
4131 BOOLEAN EffectiveOnly
;
4132 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
4138 #include <pshpack4.h>
4139 typedef struct _TOKEN_STATISTICS
{
4141 LUID AuthenticationId
;
4142 LARGE_INTEGER ExpirationTime
;
4143 TOKEN_TYPE TokenType
;
4144 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
4145 DWORD DynamicCharged
;
4146 DWORD DynamicAvailable
;
4148 DWORD PrivilegeCount
;
4151 #include <poppack.h>
4153 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES
{
4156 PSID_AND_ATTRIBUTES Sids
;
4157 DWORD RestrictedSidCount
;
4158 DWORD RestrictedSidLength
;
4159 PSID_AND_ATTRIBUTES RestrictedSids
;
4160 DWORD PrivilegeCount
;
4161 DWORD PrivilegeLength
;
4162 PLUID_AND_ATTRIBUTES Privileges
;
4163 LUID AuthenticationId
;
4164 } TOKEN_GROUPS_AND_PRIVILEGES
, * PTOKEN_GROUPS_AND_PRIVILEGES
;
4166 typedef struct _TOKEN_ORIGIN
{
4167 LUID OriginatingLogonSession
;
4168 } TOKEN_ORIGIN
, * PTOKEN_ORIGIN
;
4170 typedef struct _TOKEN_LINKED_TOKEN
{
4172 } TOKEN_LINKED_TOKEN
, * PTOKEN_LINKED_TOKEN
;
4174 typedef struct _TOKEN_ELEVATION
{
4175 DWORD TokenIsElevated
;
4176 } TOKEN_ELEVATION
, * PTOKEN_ELEVATION
;
4183 /* ACEs, directly starting after an ACL */
4184 typedef struct _ACE_HEADER
{
4188 } ACE_HEADER
,*PACE_HEADER
;
4191 #define ACCESS_ALLOWED_ACE_TYPE 0
4192 #define ACCESS_DENIED_ACE_TYPE 1
4193 #define SYSTEM_AUDIT_ACE_TYPE 2
4194 #define SYSTEM_ALARM_ACE_TYPE 3
4196 /* inherit AceFlags */
4197 #define OBJECT_INHERIT_ACE 0x01
4198 #define CONTAINER_INHERIT_ACE 0x02
4199 #define NO_PROPAGATE_INHERIT_ACE 0x04
4200 #define INHERIT_ONLY_ACE 0x08
4201 #define INHERITED_ACE 0x10
4202 #define VALID_INHERIT_FLAGS 0x1F
4204 /* AceFlags mask for what events we (should) audit */
4205 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4206 #define FAILED_ACCESS_ACE_FLAG 0x80
4208 /* different ACEs depending on AceType
4209 * SidStart marks the begin of a SID
4210 * so the thing finally looks like this:
4215 typedef struct _ACCESS_ALLOWED_ACE
{
4219 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
4221 typedef struct _ACCESS_DENIED_ACE
{
4225 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
4227 typedef struct _SYSTEM_AUDIT_ACE
{
4231 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
4233 typedef struct _SYSTEM_ALARM_ACE
{
4237 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
4239 typedef enum tagSID_NAME_USE
{
4244 SidTypeWellKnownGroup
,
4245 SidTypeDeletedAccount
,
4248 } SID_NAME_USE
,*PSID_NAME_USE
;
4250 #define ACE_OBJECT_TYPE_PRESENT 0x1
4251 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4255 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4257 #define DELETE 0x00010000
4258 #define READ_CONTROL 0x00020000
4259 #define WRITE_DAC 0x00040000
4260 #define WRITE_OWNER 0x00080000
4261 #define SYNCHRONIZE 0x00100000
4262 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4264 #define STANDARD_RIGHTS_READ READ_CONTROL
4265 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4266 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4268 #define STANDARD_RIGHTS_ALL 0x001f0000
4270 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4272 #define GENERIC_READ 0x80000000
4273 #define GENERIC_WRITE 0x40000000
4274 #define GENERIC_EXECUTE 0x20000000
4275 #define GENERIC_ALL 0x10000000
4277 #define MAXIMUM_ALLOWED 0x02000000
4278 #define ACCESS_SYSTEM_SECURITY 0x01000000
4280 #define EVENT_QUERY_STATE 0x0001
4281 #define EVENT_MODIFY_STATE 0x0002
4282 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4284 #define SEMAPHORE_MODIFY_STATE 0x0002
4285 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4287 #define MUTANT_QUERY_STATE 0x0001
4288 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE)
4290 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4291 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4292 #define JOB_OBJECT_QUERY 0x0004
4293 #define JOB_OBJECT_TERMINATE 0x0008
4294 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4295 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4297 #define TIMER_QUERY_STATE 0x0001
4298 #define TIMER_MODIFY_STATE 0x0002
4299 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4301 #define PROCESS_TERMINATE 0x0001
4302 #define PROCESS_CREATE_THREAD 0x0002
4303 #define PROCESS_VM_OPERATION 0x0008
4304 #define PROCESS_VM_READ 0x0010
4305 #define PROCESS_VM_WRITE 0x0020
4306 #define PROCESS_DUP_HANDLE 0x0040
4307 #define PROCESS_CREATE_PROCESS 0x0080
4308 #define PROCESS_SET_QUOTA 0x0100
4309 #define PROCESS_SET_INFORMATION 0x0200
4310 #define PROCESS_QUERY_INFORMATION 0x0400
4311 #define PROCESS_SUSPEND_RESUME 0x0800
4312 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4313 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4315 #define THREAD_TERMINATE 0x0001
4316 #define THREAD_SUSPEND_RESUME 0x0002
4317 #define THREAD_GET_CONTEXT 0x0008
4318 #define THREAD_SET_CONTEXT 0x0010
4319 #define THREAD_SET_INFORMATION 0x0020
4320 #define THREAD_QUERY_INFORMATION 0x0040
4321 #define THREAD_SET_THREAD_TOKEN 0x0080
4322 #define THREAD_IMPERSONATE 0x0100
4323 #define THREAD_DIRECT_IMPERSONATION 0x0200
4324 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4326 #define THREAD_BASE_PRIORITY_LOWRT 15
4327 #define THREAD_BASE_PRIORITY_MAX 2
4328 #define THREAD_BASE_PRIORITY_MIN -2
4329 #define THREAD_BASE_PRIORITY_IDLE -15
4331 typedef struct _QUOTA_LIMITS
{
4332 SIZE_T PagedPoolLimit
;
4333 SIZE_T NonPagedPoolLimit
;
4334 SIZE_T MinimumWorkingSetSize
;
4335 SIZE_T MaximumWorkingSetSize
;
4336 SIZE_T PagefileLimit
;
4337 LARGE_INTEGER TimeLimit
;
4338 } QUOTA_LIMITS
, *PQUOTA_LIMITS
;
4340 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4341 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4342 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4343 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4345 typedef struct _QUOTA_LIMITS_EX
{
4346 SIZE_T PagedPoolLimit
;
4347 SIZE_T NonPagedPoolLimit
;
4348 SIZE_T MinimumWorkingSetSize
;
4349 SIZE_T MaximumWorkingSetSize
;
4350 SIZE_T PagefileLimit
;
4351 LARGE_INTEGER TimeLimit
;
4358 } QUOTA_LIMITS_EX
, *PQUOTA_LIMITS_EX
;
4360 #define SECTION_QUERY 0x0001
4361 #define SECTION_MAP_WRITE 0x0002
4362 #define SECTION_MAP_READ 0x0004
4363 #define SECTION_MAP_EXECUTE 0x0008
4364 #define SECTION_EXTEND_SIZE 0x0010
4365 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4366 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4368 #define FILE_READ_DATA 0x0001 /* file & pipe */
4369 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4370 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4371 #define FILE_ADD_FILE 0x0002 /* directory */
4372 #define FILE_APPEND_DATA 0x0004 /* file */
4373 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4374 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4375 #define FILE_READ_EA 0x0008 /* file & directory */
4376 #define FILE_READ_PROPERTIES FILE_READ_EA
4377 #define FILE_WRITE_EA 0x0010 /* file & directory */
4378 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4379 #define FILE_EXECUTE 0x0020 /* file */
4380 #define FILE_TRAVERSE 0x0020 /* directory */
4381 #define FILE_DELETE_CHILD 0x0040 /* directory */
4382 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4383 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4384 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4386 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4387 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4389 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4390 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4391 FILE_APPEND_DATA | SYNCHRONIZE)
4392 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4393 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4395 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4396 #define DUPLICATE_SAME_ACCESS 0x00000002
4398 /* File attribute flags */
4399 #define FILE_SHARE_READ 0x00000001
4400 #define FILE_SHARE_WRITE 0x00000002
4401 #define FILE_SHARE_DELETE 0x00000004
4403 #define FILE_ATTRIBUTE_READONLY 0x00000001
4404 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4405 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4406 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4407 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4408 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4409 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4410 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4411 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4412 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4413 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4414 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4415 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4416 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4418 /* File notification flags */
4419 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4420 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4421 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4422 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4423 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4424 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4425 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4426 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4427 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4428 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4429 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4430 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4432 #define FILE_ACTION_ADDED 0x00000001
4433 #define FILE_ACTION_REMOVED 0x00000002
4434 #define FILE_ACTION_MODIFIED 0x00000003
4435 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4436 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4437 #define FILE_ACTION_ADDED_STREAM 0x00000006
4438 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4439 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4441 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4442 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4443 #define FILE_UNICODE_ON_DISK 0x00000004
4444 #define FILE_PERSISTENT_ACLS 0x00000008
4445 #define FILE_FILE_COMPRESSION 0x00000010
4446 #define FILE_VOLUME_QUOTAS 0x00000020
4447 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
4448 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
4449 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4450 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4451 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4452 #define FILE_NAMED_STREAMS 0x00040000
4453 #define FILE_READ_ONLY_VOLUME 0x00080000
4455 /* File alignments (NT) */
4456 #define FILE_BYTE_ALIGNMENT 0x00000000
4457 #define FILE_WORD_ALIGNMENT 0x00000001
4458 #define FILE_LONG_ALIGNMENT 0x00000003
4459 #define FILE_QUAD_ALIGNMENT 0x00000007
4460 #define FILE_OCTA_ALIGNMENT 0x0000000f
4461 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4462 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4463 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4464 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4465 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4467 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4468 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4470 #define REG_NONE 0 /* no type */
4471 #define REG_SZ 1 /* string type (ASCII) */
4472 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4473 #define REG_BINARY 3 /* binary format, callerspecific */
4474 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4475 #define REG_DWORD 4 /* DWORD in little endian format */
4476 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4477 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4478 #define REG_LINK 6 /* symbolic link (UNICODE) */
4479 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4480 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4481 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4482 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4483 #define REG_QWORD 11 /* QWORD in little endian format */
4484 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4486 /* ----------------------------- begin power management --------------------- */
4488 typedef enum _LATENCY_TIME
{
4491 } LATENCY_TIME
, *PLATENCY_TIME
;
4493 #define DISCHARGE_POLICY_CRITICAL 0
4494 #define DISCHARGE_POLICY_LOW 1
4495 #define NUM_DISCHARGE_POLICIES 4
4497 #define PO_THROTTLE_NONE 0
4498 #define PO_THROTTLE_CONSTANT 1
4499 #define PO_THROTTLE_DEGRADE 2
4500 #define PO_THROTTLE_ADAPTIVE 3
4502 typedef enum _POWER_ACTION
{
4503 PowerActionNone
= 0,
4504 PowerActionReserved
,
4506 PowerActionHibernate
,
4507 PowerActionShutdown
,
4508 PowerActionShutdownReset
,
4509 PowerActionShutdownOff
,
4510 PowerActionWarmEject
4514 typedef enum _SYSTEM_POWER_STATE
{
4515 PowerSystemUnspecified
= 0,
4516 PowerSystemWorking
= 1,
4517 PowerSystemSleeping1
= 2,
4518 PowerSystemSleeping2
= 3,
4519 PowerSystemSleeping3
= 4,
4520 PowerSystemHibernate
= 5,
4521 PowerSystemShutdown
= 6,
4522 PowerSystemMaximum
= 7
4523 } SYSTEM_POWER_STATE
,
4524 *PSYSTEM_POWER_STATE
;
4526 typedef enum _DEVICE_POWER_STATE
{
4527 PowerDeviceUnspecified
,
4533 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
4535 typedef enum _POWER_INFORMATION_LEVEL
{
4536 SystemPowerPolicyAc
,
4537 SystemPowerPolicyDc
,
4538 VerifySystemPolicyAc
,
4539 VerifySystemPolicyDc
,
4540 SystemPowerCapabilities
,
4542 SystemPowerStateHandler
,
4543 ProcessorStateHandler
,
4544 SystemPowerPolicyCurrent
,
4545 AdministratorPowerPolicy
,
4546 SystemReserveHiberFile
,
4547 ProcessorInformation
,
4548 SystemPowerInformation
,
4549 ProcessorStateHandler2
,
4552 SystemExecutionState
,
4553 SystemPowerStateNotifyHandler
,
4554 ProcessorPowerPolicyAc
,
4555 ProcessorPowerPolicyDc
,
4556 VerifyProcessorPowerPolicyAc
,
4557 VerifyProcessorPowerPolicyDc
,
4558 ProcessorPowerPolicyCurrent
4559 } POWER_INFORMATION_LEVEL
;
4561 typedef struct _ADMINISTRATOR_POWER_POLICY
{
4562 SYSTEM_POWER_STATE MinSleep
;
4563 SYSTEM_POWER_STATE MaxSleep
;
4564 ULONG MinVideoTimeout
;
4565 ULONG MaxVideoTimeout
;
4566 ULONG MinSpindownTimeout
;
4567 ULONG MaxSpindownTimeout
;
4568 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
4573 } BATTERY_REPORTING_SCALE
,
4574 *PBATTERY_REPORTING_SCALE
;
4577 POWER_ACTION Action
;
4580 } POWER_ACTION_POLICY
,
4581 *PPOWER_ACTION_POLICY
;
4583 typedef struct _PROCESSOR_POWER_INFORMATION
{
4589 ULONG CurrentIdleState
;
4590 } PROCESSOR_POWER_INFORMATION
,
4591 *PPROCESSOR_POWER_INFORMATION
;
4593 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
4597 UCHAR DemotePercent
;
4598 UCHAR PromotePercent
;
4600 ULONG AllowDemotion
:1;
4601 ULONG AllowPromotion
:1;
4603 } PROCESSOR_POWER_POLICY_INFO
,
4604 *PPROCESSOR_POWER_POLICY_INFO
;
4606 typedef struct _PROCESSOR_POWER_POLICY
{
4608 BYTE DynamicThrottle
;
4610 DWORD DisableCStates
:1;
4613 PROCESSOR_POWER_POLICY_INFO Policy
[3];
4614 } PROCESSOR_POWER_POLICY
,
4615 *PPROCESSOR_POWER_POLICY
;
4619 BOOLEAN BatteryPresent
;
4621 BOOLEAN Discharging
;
4624 ULONG RemainingCapacity
;
4626 ULONG EstimatedTime
;
4627 ULONG DefaultAlert1
;
4628 ULONG DefaultAlert2
;
4629 } SYSTEM_BATTERY_STATE
,
4630 *PSYSTEM_BATTERY_STATE
;
4633 BOOLEAN PowerButtonPresent
;
4634 BOOLEAN SleepButtonPresent
;
4641 BOOLEAN HiberFilePresent
;
4643 BOOLEAN VideoDimPresent
;
4646 BOOLEAN ThermalControl
;
4647 BOOLEAN ProcessorThrottle
;
4648 UCHAR ProcessorMinThrottle
;
4649 UCHAR ProcessorMaxThrottle
;
4651 BOOLEAN DiskSpinDown
;
4653 BOOLEAN SystemBatteriesPresent
;
4654 BOOLEAN BatteriesAreShortTerm
;
4655 BATTERY_REPORTING_SCALE BatteryScale
[3];
4656 SYSTEM_POWER_STATE AcOnLineWake
;
4657 SYSTEM_POWER_STATE SoftLidWake
;
4658 SYSTEM_POWER_STATE RtcWake
;
4659 SYSTEM_POWER_STATE MinDeviceWakeState
;
4660 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
4661 } SYSTEM_POWER_CAPABILITIES
,
4662 *PSYSTEM_POWER_CAPABILITIES
;
4664 typedef struct _SYSTEM_POWER_INFORMATION
{
4665 ULONG MaxIdlenessAllowed
;
4667 ULONG TimeRemaining
;
4669 } SYSTEM_POWER_INFORMATION
,
4670 *PSYSTEM_POWER_INFORMATION
;
4672 typedef struct _SYSTEM_POWER_LEVEL
{
4676 POWER_ACTION_POLICY PowerPolicy
;
4677 SYSTEM_POWER_STATE MinSystemState
;
4678 } SYSTEM_POWER_LEVEL
,
4679 *PSYSTEM_POWER_LEVEL
;
4681 typedef struct _SYSTEM_POWER_POLICY
{
4683 POWER_ACTION_POLICY PowerButton
;
4684 POWER_ACTION_POLICY SleepButton
;
4685 POWER_ACTION_POLICY LidClose
;
4686 SYSTEM_POWER_STATE LidOpenWake
;
4688 POWER_ACTION_POLICY Idle
;
4690 UCHAR IdleSensitivity
;
4691 UCHAR DynamicThrottle
;
4693 SYSTEM_POWER_STATE MinSleep
;
4694 SYSTEM_POWER_STATE MaxSleep
;
4695 SYSTEM_POWER_STATE ReducedLatencySleep
;
4696 ULONG WinLogonFlags
;
4698 ULONG DozeS4Timeout
;
4699 ULONG BroadcastCapacityResolution
;
4700 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
4702 BOOLEAN VideoDimDisplay
;
4703 ULONG VideoReserved
[3];
4704 ULONG SpindownTimeout
;
4705 BOOLEAN OptimizeForPower
;
4706 UCHAR FanThrottleTolerance
;
4707 UCHAR ForcedThrottle
;
4709 POWER_ACTION_POLICY OverThrottled
;
4710 } SYSTEM_POWER_POLICY
,
4711 *PSYSTEM_POWER_POLICY
;
4713 typedef union _FILE_SEGMENT_ELEMENT
{
4715 ULONGLONG Alignment
;
4716 } FILE_SEGMENT_ELEMENT
, *PFILE_SEGMENT_ELEMENT
;
4718 typedef struct _FILE_NOTIFY_INFORMATION
{
4719 DWORD NextEntryOffset
;
4721 DWORD FileNameLength
;
4723 } FILE_NOTIFY_INFORMATION
, *PFILE_NOTIFY_INFORMATION
;
4725 /* ----------------------------- begin tape storage --------------------- */
4727 #define TAPE_FIXED_PARTITIONS 0
4728 #define TAPE_SELECT_PARTITIONS 1
4729 #define TAPE_INITIATOR_PARTITIONS 2
4730 #define TAPE_ERASE_SHORT 0
4731 #define TAPE_ERASE_LONG 1
4733 #define TAPE_UNLOAD 1
4734 #define TAPE_TENSION 2
4736 #define TAPE_UNLOCK 4
4737 #define TAPE_FORMAT 5
4738 #define TAPE_SETMARKS 0
4739 #define TAPE_FILEMARKS 1
4740 #define TAPE_SHORT_FILEMARKS 2
4741 #define TAPE_LONG_FILEMARKS 3
4742 #define TAPE_REWIND 0
4743 #define TAPE_ABSOLUTE_BLOCK 1
4744 #define TAPE_LOGICAL_BLOCK 2
4745 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4746 #define TAPE_SPACE_END_OF_DATA 4
4747 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4748 #define TAPE_SPACE_FILEMARKS 6
4749 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4750 #define TAPE_SPACE_SETMARKS 8
4751 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4753 typedef struct _TAPE_CREATE_PARTITION
{
4757 } TAPE_CREATE_PARTITION
, *PTAPE_CREATE_PARTITION
;
4759 typedef struct _TAPE_ERASE
{
4762 } TAPE_ERASE
, *PTAPE_ERASE
;
4764 typedef struct _TAPE_PREPARE
{
4767 } TAPE_PREPARE
, *PTAPE_PREPARE
;
4769 typedef struct _TAPE_SET_DRIVE_PARAMETERS
{
4771 BOOLEAN Compression
;
4772 BOOLEAN DataPadding
;
4773 BOOLEAN ReportSetmarks
;
4774 ULONG EOTWarningZoneSize
;
4775 } TAPE_SET_DRIVE_PARAMETERS
, *PTAPE_SET_DRIVE_PARAMETERS
;
4777 typedef struct _TAPE_SET_MEDIA_PARAMETERS
{
4779 } TAPE_SET_MEDIA_PARAMETERS
, *PTAPE_SET_MEDIA_PARAMETERS
;
4781 typedef struct _TAPE_WRITE_MARKS
{
4785 } TAPE_WRITE_MARKS
, *PTAPE_WRITE_MARKS
;
4787 typedef struct _TAPE_GET_POSITION
{
4792 } TAPE_GET_POSITION
, *PTAPE_GET_POSITION
;
4794 typedef struct _TAPE_SET_POSITION
{
4797 LARGE_INTEGER Offset
;
4799 } TAPE_SET_POSITION
, *PTAPE_SET_POSITION
;
4801 typedef struct _TAPE_GET_DRIVE_PARAMETERS
{
4803 BOOLEAN Compression
;
4804 BOOLEAN DataPadding
;
4805 BOOLEAN ReportSetmarks
;
4806 DWORD DefaultBlockSize
;
4807 DWORD MaximumBlockSize
;
4808 DWORD MinimumBlockSize
;
4809 DWORD MaximumPartitionCount
;
4812 DWORD EOTWarningZoneSize
;
4813 } TAPE_GET_DRIVE_PARAMETERS
, *PTAPE_GET_DRIVE_PARAMETERS
;
4815 typedef struct _TAPE_GET_MEDIA_PARAMETERS
{
4816 LARGE_INTEGER Capacity
;
4817 LARGE_INTEGER Remaining
;
4819 DWORD PartitionCount
;
4820 BOOLEAN WriteProtected
;
4821 } TAPE_GET_MEDIA_PARAMETERS
, *PTAPE_GET_MEDIA_PARAMETERS
;
4823 /* ----------------------------- begin registry ----------------------------- */
4825 /* Registry security values */
4826 #define OWNER_SECURITY_INFORMATION 0x00000001
4827 #define GROUP_SECURITY_INFORMATION 0x00000002
4828 #define DACL_SECURITY_INFORMATION 0x00000004
4829 #define SACL_SECURITY_INFORMATION 0x00000008
4831 #define REG_OPTION_RESERVED 0x00000000
4832 #define REG_OPTION_NON_VOLATILE 0x00000000
4833 #define REG_OPTION_VOLATILE 0x00000001
4834 #define REG_OPTION_CREATE_LINK 0x00000002
4835 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4836 #define REG_OPTION_OPEN_LINK 0x00000008
4837 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4838 REG_OPTION_NON_VOLATILE| \
4839 REG_OPTION_VOLATILE| \
4840 REG_OPTION_CREATE_LINK| \
4841 REG_OPTION_BACKUP_RESTORE| \
4842 REG_OPTION_OPEN_LINK)
4845 #define REG_CREATED_NEW_KEY 0x00000001
4846 #define REG_OPENED_EXISTING_KEY 0x00000002
4848 /* For RegNotifyChangeKeyValue */
4849 #define REG_NOTIFY_CHANGE_NAME 0x01
4850 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4851 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4852 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4854 #define KEY_QUERY_VALUE 0x00000001
4855 #define KEY_SET_VALUE 0x00000002
4856 #define KEY_CREATE_SUB_KEY 0x00000004
4857 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4858 #define KEY_NOTIFY 0x00000010
4859 #define KEY_CREATE_LINK 0x00000020
4860 #define KEY_WOW64_64KEY 0x00000100
4861 #define KEY_WOW64_32KEY 0x00000200
4862 #define KEY_WOW64_RES 0x00000300
4864 /* for RegKeyRestore flags */
4865 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4866 #define REG_REFRESH_HIVE 0x00000002
4867 #define REG_NO_LAZY_FLUSH 0x00000004
4868 #define REG_FORCE_RESTORE 0x00000008
4870 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4872 KEY_ENUMERATE_SUB_KEYS| \
4876 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4878 KEY_CREATE_SUB_KEY) \
4881 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4882 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4885 KEY_CREATE_SUB_KEY| \
4886 KEY_ENUMERATE_SUB_KEYS| \
4891 /* ------------------------------ end registry ------------------------------ */
4894 #define EVENTLOG_SUCCESS 0x0000
4895 #define EVENTLOG_ERROR_TYPE 0x0001
4896 #define EVENTLOG_WARNING_TYPE 0x0002
4897 #define EVENTLOG_INFORMATION_TYPE 0x0004
4898 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4899 #define EVENTLOG_AUDIT_FAILURE 0x0010
4901 #define EVENTLOG_SEQUENTIAL_READ 0x0001
4902 #define EVENTLOG_SEEK_READ 0x0002
4903 #define EVENTLOG_FORWARDS_READ 0x0004
4904 #define EVENTLOG_BACKWARDS_READ 0x0008
4906 typedef struct _EVENTLOGRECORD
{
4910 DWORD TimeGenerated
;
4917 DWORD ClosingRecordNumber
;
4919 DWORD UserSidLength
;
4920 DWORD UserSidOffset
;
4923 } EVENTLOGRECORD
, *PEVENTLOGRECORD
;
4925 #define SERVICE_BOOT_START 0x00000000
4926 #define SERVICE_SYSTEM_START 0x00000001
4927 #define SERVICE_AUTO_START 0x00000002
4928 #define SERVICE_DEMAND_START 0x00000003
4929 #define SERVICE_DISABLED 0x00000004
4931 #define SERVICE_ERROR_IGNORE 0x00000000
4932 #define SERVICE_ERROR_NORMAL 0x00000001
4933 #define SERVICE_ERROR_SEVERE 0x00000002
4934 #define SERVICE_ERROR_CRITICAL 0x00000003
4937 #define SERVICE_KERNEL_DRIVER 0x00000001
4938 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4939 #define SERVICE_ADAPTER 0x00000004
4940 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4942 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4943 SERVICE_RECOGNIZER_DRIVER )
4945 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4946 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4947 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4949 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4951 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4952 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4955 typedef enum _CM_SERVICE_NODE_TYPE
4957 DriverType
= SERVICE_KERNEL_DRIVER
,
4958 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
4959 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
4960 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
4961 AdapterType
= SERVICE_ADAPTER
,
4962 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
4963 } SERVICE_NODE_TYPE
;
4965 typedef enum _CM_SERVICE_LOAD_TYPE
4967 BootLoad
= SERVICE_BOOT_START
,
4968 SystemLoad
= SERVICE_SYSTEM_START
,
4969 AutoLoad
= SERVICE_AUTO_START
,
4970 DemandLoad
= SERVICE_DEMAND_START
,
4971 DisableLoad
= SERVICE_DISABLED
4972 } SERVICE_LOAD_TYPE
;
4974 typedef enum _CM_ERROR_CONTROL_TYPE
4976 IgnoreError
= SERVICE_ERROR_IGNORE
,
4977 NormalError
= SERVICE_ERROR_NORMAL
,
4978 SevereError
= SERVICE_ERROR_SEVERE
,
4979 CriticalError
= SERVICE_ERROR_CRITICAL
4980 } SERVICE_ERROR_TYPE
;
4984 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4985 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4986 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4987 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4988 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4990 #include <guiddef.h>
4992 typedef struct _OBJECT_TYPE_LIST
{
4996 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
4998 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5001 WORD CreatorBackTraceIndex
;
5002 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
5003 LIST_ENTRY ProcessLocksList
;
5005 DWORD ContentionCount
;
5006 #ifdef __WINESRC__ /* in Wine we store the name here */
5007 DWORD_PTR Spare
[8/sizeof(DWORD_PTR
)];
5011 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
5013 typedef struct _RTL_CRITICAL_SECTION
{
5014 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
5016 LONG RecursionCount
;
5017 HANDLE OwningThread
;
5018 HANDLE LockSemaphore
;
5019 ULONG_PTR SpinCount
;
5020 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
5022 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5023 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5024 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5025 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5026 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5028 typedef struct _RTL_SRWLOCK
{
5030 } RTL_SRWLOCK
, *PRTL_SRWLOCK
;
5032 #define RTL_SRWLOCK_INIT {0}
5034 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
5035 typedef VOID (NTAPI
* PFLS_CALLBACK_FUNCTION
) ( PVOID
);
5037 #include <pshpack8.h>
5038 typedef struct _IO_COUNTERS
{
5039 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
5040 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
5041 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
5042 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
5043 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
5044 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
5045 } IO_COUNTERS
, *PIO_COUNTERS
;
5046 #include <poppack.h>
5049 DWORD dwOSVersionInfoSize
;
5050 DWORD dwMajorVersion
;
5051 DWORD dwMinorVersion
;
5052 DWORD dwBuildNumber
;
5054 CHAR szCSDVersion
[128];
5055 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
5058 DWORD dwOSVersionInfoSize
;
5059 DWORD dwMajorVersion
;
5060 DWORD dwMinorVersion
;
5061 DWORD dwBuildNumber
;
5063 WCHAR szCSDVersion
[128];
5064 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
5066 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
5067 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
5068 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
5071 DWORD dwOSVersionInfoSize
;
5072 DWORD dwMajorVersion
;
5073 DWORD dwMinorVersion
;
5074 DWORD dwBuildNumber
;
5076 CHAR szCSDVersion
[128];
5077 WORD wServicePackMajor
;
5078 WORD wServicePackMinor
;
5082 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
5085 DWORD dwOSVersionInfoSize
;
5086 DWORD dwMajorVersion
;
5087 DWORD dwMinorVersion
;
5088 DWORD dwBuildNumber
;
5090 WCHAR szCSDVersion
[128];
5091 WORD wServicePackMajor
;
5092 WORD wServicePackMinor
;
5096 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
5098 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
5099 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
5100 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
5102 NTSYSAPI ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
5104 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5106 #define VER_PLATFORM_WIN32s 0
5107 #define VER_PLATFORM_WIN32_WINDOWS 1
5108 #define VER_PLATFORM_WIN32_NT 2
5110 #define VER_MINORVERSION 0x00000001
5111 #define VER_MAJORVERSION 0x00000002
5112 #define VER_BUILDNUMBER 0x00000004
5113 #define VER_PLATFORMID 0x00000008
5114 #define VER_SERVICEPACKMINOR 0x00000010
5115 #define VER_SERVICEPACKMAJOR 0x00000020
5116 #define VER_SUITENAME 0x00000040
5117 #define VER_PRODUCT_TYPE 0x00000080
5119 #define VER_NT_WORKSTATION 1
5120 #define VER_NT_DOMAIN_CONTROLLER 2
5121 #define VER_NT_SERVER 3
5123 #define VER_SUITE_SMALLBUSINESS 0x00000001
5124 #define VER_SUITE_ENTERPRISE 0x00000002
5125 #define VER_SUITE_BACKOFFICE 0x00000004
5126 #define VER_SUITE_COMMUNICATIONS 0x00000008
5127 #define VER_SUITE_TERMINAL 0x00000010
5128 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5129 #define VER_SUITE_EMBEDDEDNT 0x00000040
5130 #define VER_SUITE_DATACENTER 0x00000080
5131 #define VER_SUITE_SINGLEUSERTS 0x00000100
5132 #define VER_SUITE_PERSONAL 0x00000200
5133 #define VER_SUITE_BLADE 0x00000400
5134 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5135 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5136 #define VER_SUITE_STORAGE_SERVER 0x00002000
5137 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5138 #define VER_SUITE_WH_SERVER 0x00008000
5141 #define VER_GREATER 2
5142 #define VER_GREATER_EQUAL 3
5144 #define VER_LESS_EQUAL 5
5148 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION
{
5150 DWORD ulFormatVersion
;
5151 DWORD ulAssemblyCount
;
5152 DWORD ulRootManifestPathType
;
5153 DWORD ulRootManifestPathChars
;
5154 DWORD ulRootConfigurationPathType
;
5155 DWORD ulRootConfigurationPathChars
;
5156 DWORD ulAppDirPathType
;
5157 DWORD ulAppDirPathChars
;
5158 PCWSTR lpRootManifestPath
;
5159 PCWSTR lpRootConfigurationPath
;
5160 PCWSTR lpAppDirPath
;
5161 } ACTIVATION_CONTEXT_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_DETAILED_INFORMATION
;
5163 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
{
5165 DWORD ulEncodedAssemblyIdentityLength
;
5166 DWORD ulManifestPathType
;
5167 DWORD ulManifestPathLength
;
5168 LARGE_INTEGER liManifestLastWriteTime
;
5169 DWORD ulPolicyPathType
;
5170 DWORD ulPolicyPathLength
;
5171 LARGE_INTEGER liPolicyLastWriteTime
;
5172 DWORD ulMetadataSatelliteRosterIndex
;
5173 DWORD ulManifestVersionMajor
;
5174 DWORD ulManifestVersionMinor
;
5175 DWORD ulPolicyVersionMajor
;
5176 DWORD ulPolicyVersionMinor
;
5177 DWORD ulAssemblyDirectoryNameLength
;
5178 PCWSTR lpAssemblyEncodedAssemblyIdentity
;
5179 PCWSTR lpAssemblyManifestPath
;
5180 PCWSTR lpAssemblyPolicyPath
;
5181 PCWSTR lpAssemblyDirectoryName
;
5183 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION
;
5185 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX
{
5186 DWORD ulAssemblyIndex
;
5187 DWORD ulFileIndexInAssembly
;
5188 } ACTIVATION_CONTEXT_QUERY_INDEX
, *PACTIVATION_CONTEXT_QUERY_INDEX
;
5190 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX
*PCACTIVATION_CONTEXT_QUERY_INDEX
;
5192 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION
{
5194 DWORD ulFilenameLength
;
5198 } ASSEMBLY_FILE_DETAILED_INFORMATION
, *PASSEMBLY_FILE_DETAILED_INFORMATION
;
5200 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION
*PCASSEMBLY_FILE_DETAILED_INFORMATION
;
5202 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS
{
5203 ActivationContextBasicInformation
= 1,
5204 ActivationContextDetailedInformation
= 2,
5205 AssemblyDetailedInformationInActivationContext
= 3,
5206 FileInformationInAssemblyOfAssemblyInActivationContext
= 4,
5207 MaxActivationContextInfoClass
,
5209 AssemblyDetailedInformationInActivationContxt
= 3,
5210 FileInformationInAssemblyOfAssemblyInActivationContxt
= 4
5211 } ACTIVATION_CONTEXT_INFO_CLASS
;
5213 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5214 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5215 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5216 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5218 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5219 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5220 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5221 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5222 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5223 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5224 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5225 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5226 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5228 typedef enum _JOBOBJECTINFOCLASS
5230 JobObjectBasicAccountingInformation
= 1,
5231 JobObjectBasicLimitInformation
,
5232 JobObjectBasicProcessIdList
,
5233 JobObjectBasicUIRestrictions
,
5234 JobObjectSecurityLimitInformation
,
5235 JobObjectEndOfJobTimeInformation
,
5236 JobObjectAssociateCompletionPortInformation
,
5237 JobObjectBasicAndIoAccountingInformation
,
5238 JobObjectExtendedLimitInformation
,
5239 JobObjectJobSetInformation
,
5240 MaxJobObjectInfoClass
5241 } JOBOBJECTINFOCLASS
;
5243 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5245 RelationProcessorCore
= 0,
5246 RelationNumaNode
= 1,
5248 RelationProcessorPackage
= 3,
5250 RelationAll
= 0xffff
5251 } LOGICAL_PROCESSOR_RELATIONSHIP
;
5253 typedef enum _PROCESSOR_CACHE_TYPE
5259 } PROCESSOR_CACHE_TYPE
;
5261 typedef struct _PROCESSOR_GROUP_INFO
5263 BYTE MaximumProcessorCount
;
5264 BYTE ActiveProcessorCount
;
5266 KAFFINITY ActiveProcessorMask
;
5267 } PROCESSOR_GROUP_INFO
, *PPROCESSOR_GROUP_INFO
;
5269 typedef struct _CACHE_DESCRIPTOR
5275 PROCESSOR_CACHE_TYPE Type
;
5276 } CACHE_DESCRIPTOR
, *PCACHE_DESCRIPTOR
;
5278 typedef struct _GROUP_AFFINITY
5283 } GROUP_AFFINITY
, *PGROUP_AFFINITY
;
5285 typedef struct _PROCESSOR_RELATIONSHIP
5290 GROUP_AFFINITY GroupMask
[ANYSIZE_ARRAY
];
5291 } PROCESSOR_RELATIONSHIP
, *PPROCESSOR_RELATIONSHIP
;
5294 typedef struct _NUMA_NODE_RELATIONSHIP
5298 GROUP_AFFINITY GroupMask
;
5299 } NUMA_NODE_RELATIONSHIP
, *PNUMA_NODE_RELATIONSHIP
;
5301 typedef struct _CACHE_RELATIONSHIP
5306 PROCESSOR_CACHE_TYPE Type
;
5308 GROUP_AFFINITY GroupMask
;
5309 } CACHE_RELATIONSHIP
, *PCACHE_RELATIONSHIP
;
5311 typedef struct _GROUP_RELATIONSHIP
5313 WORD MaximumGroupCount
;
5314 WORD ActiveGroupCount
;
5316 PROCESSOR_GROUP_INFO GroupInfo
[ANYSIZE_ARRAY
];
5317 } GROUP_RELATIONSHIP
, *PGROUP_RELATIONSHIP
;
5319 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5321 ULONG_PTR ProcessorMask
;
5322 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5333 CACHE_DESCRIPTOR Cache
;
5334 ULONGLONG Reserved
[2];
5336 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
;
5338 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5340 LOGICAL_PROCESSOR_RELATIONSHIP Relationship
;
5344 PROCESSOR_RELATIONSHIP Processor
;
5345 NUMA_NODE_RELATIONSHIP NumaNode
;
5346 CACHE_RELATIONSHIP Cache
;
5347 GROUP_RELATIONSHIP Group
;
5349 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
;
5351 NTSYSAPI BOOLEAN NTAPI
RtlGetProductInfo(DWORD
,DWORD
,DWORD
,DWORD
,PDWORD
);
5357 #endif /* _WINNT_ */