mmdevapi: Don't use invalid This pointer on static object.
[wine/multimedia.git] / include / winnt.h
blobf8adbcbacf414bfee51720ca8032e211e25dc5ff
1 /*
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
21 #ifndef _WINNT_
22 #define _WINNT_
24 #include <basetsd.h>
25 #include <guiddef.h>
27 #ifndef RC_INVOKED
28 #include <ctype.h>
29 #include <stddef.h>
30 #include <string.h>
31 #endif
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #ifdef _NTSYSTEM_
39 #define NTSYSAPI
40 #else
41 #define NTSYSAPI DECLSPEC_IMPORT
42 #endif
44 #define NTAPI __stdcall
46 #ifndef MIDL_PASS
47 # if defined(_MSC_VER)
48 # define DECLSPEC_IMPORT __declspec(dllimport)
49 # elif defined(__MINGW32__) || defined(__CYGWIN__)
50 # define DECLSPEC_IMPORT __attribute__((dllimport))
51 # else
52 # define DECLSPEC_IMPORT DECLSPEC_HIDDEN
53 # endif
54 #else
55 # define DECLSPEC_IMPORT
56 #endif
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))
63 # else
64 # define DECLSPEC_NORETURN
65 # endif
66 #endif
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)))
73 # else
74 # define DECLSPEC_ALIGN(x)
75 # endif
76 #endif
78 #ifndef DECLSPEC_CACHEALIGN
79 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
80 #endif
82 #ifndef DECLSPEC_UUID
83 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
84 # define DECLSPEC_UUID(x) __declspec(uuid(x))
85 # else
86 # define DECLSPEC_UUID(x)
87 # endif
88 #endif
90 #ifndef DECLSPEC_NOVTABLE
91 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
92 # define DECLSPEC_NOVTABLE __declspec(novtable)
93 # else
94 # define DECLSPEC_NOVTABLE
95 # endif
96 #endif
98 #ifndef DECLSPEC_SELECTANY
99 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
100 #define DECLSPEC_SELECTANY __declspec(selectany)
101 #else
102 #define DECLSPEC_SELECTANY
103 #endif
104 #endif
106 #ifndef NOP_FUNCTION
107 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
108 # define NOP_FUNCTION __noop
109 # else
110 # define NOP_FUNCTION (void)0
111 # endif
112 #endif
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)
117 # else
118 # define DECLSPEC_ADDRSAFE
119 # endif
120 #endif
122 #ifndef FORCEINLINE
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))
127 # else
128 # define FORCEINLINE inline
129 # endif
130 #endif
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
139 # else
140 # define DECLSPEC_DEPRECATED
141 # undef DEPRECATE_SUPPORTED
142 # endif
143 #endif
145 /* a couple of useful Wine extensions */
147 #ifdef _MSC_VER
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")))
153 #else
154 # define DECLSPEC_EXPORT
155 #endif
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")))
161 #else
162 # define DECLSPEC_HIDDEN
163 #endif
165 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)))
166 #define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x)))
167 #else
168 #define __WINE_ALLOC_SIZE(x)
169 #endif
171 /* Anonymous union/struct handling */
173 #ifndef NONAMELESSSTRUCT
174 # ifdef __GNUC__
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
178 # endif
179 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
180 # define NONAMELESSSTRUCT
181 # endif
182 #endif /* NONAMELESSSTRUCT */
184 #ifndef NONAMELESSUNION
185 # ifdef __GNUC__
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
189 # endif
190 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
191 # define NONAMELESSUNION
192 # endif
193 #endif /* NONAMELESSUNION */
195 #undef DUMMYSTRUCTNAME
196 #undef DUMMYSTRUCTNAME1
197 #undef DUMMYSTRUCTNAME2
198 #undef DUMMYSTRUCTNAME3
199 #undef DUMMYSTRUCTNAME4
200 #undef DUMMYSTRUCTNAME5
201 #ifndef NONAMELESSSTRUCT
202 #define DUMMYSTRUCTNAME
203 #define DUMMYSTRUCTNAME1
204 #define DUMMYSTRUCTNAME2
205 #define DUMMYSTRUCTNAME3
206 #define DUMMYSTRUCTNAME4
207 #define DUMMYSTRUCTNAME5
208 #else /* !defined(NONAMELESSSTRUCT) */
209 #define DUMMYSTRUCTNAME s
210 #define DUMMYSTRUCTNAME1 s1
211 #define DUMMYSTRUCTNAME2 s2
212 #define DUMMYSTRUCTNAME3 s3
213 #define DUMMYSTRUCTNAME4 s4
214 #define DUMMYSTRUCTNAME5 s5
215 #endif /* !defined(NONAMELESSSTRUCT) */
217 #undef DUMMYUNIONNAME
218 #undef DUMMYUNIONNAME1
219 #undef DUMMYUNIONNAME2
220 #undef DUMMYUNIONNAME3
221 #undef DUMMYUNIONNAME4
222 #undef DUMMYUNIONNAME5
223 #undef DUMMYUNIONNAME6
224 #undef DUMMYUNIONNAME7
225 #undef DUMMYUNIONNAME8
226 #ifndef NONAMELESSUNION
227 #define DUMMYUNIONNAME
228 #define DUMMYUNIONNAME1
229 #define DUMMYUNIONNAME2
230 #define DUMMYUNIONNAME3
231 #define DUMMYUNIONNAME4
232 #define DUMMYUNIONNAME5
233 #define DUMMYUNIONNAME6
234 #define DUMMYUNIONNAME7
235 #define DUMMYUNIONNAME8
236 #else /* !defined(NONAMELESSUNION) */
237 #define DUMMYUNIONNAME u
238 #define DUMMYUNIONNAME1 u1
239 #define DUMMYUNIONNAME2 u2
240 #define DUMMYUNIONNAME3 u3
241 #define DUMMYUNIONNAME4 u4
242 #define DUMMYUNIONNAME5 u5
243 #define DUMMYUNIONNAME6 u6
244 #define DUMMYUNIONNAME7 u7
245 #define DUMMYUNIONNAME8 u8
246 #endif /* !defined(NONAMELESSUNION) */
248 #ifndef __C89_NAMELESS
249 # if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION)
250 # ifdef __GNUC__
251 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */
252 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus))))
253 # define __C89_NAMELESS __extension__
254 # endif
255 # elif defined(_MSC_VER)
256 # define __C89_NAMELESS
257 # endif
258 # endif
259 #endif
261 #ifdef __C89_NAMELESS
262 # define __C89_NAMELESSSTRUCTNAME
263 # define __C89_NAMELESSUNIONNAME
264 #else
265 # define __C89_NAMELESS
266 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME
267 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME
268 #endif
270 /* C99 restrict support */
272 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
273 # if defined(_MSC_VER) && defined(_M_MRX000)
274 # define RESTRICTED_POINTER __restrict
275 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
276 # define RESTRICTED_POINTER __restrict
277 # else
278 # define RESTRICTED_POINTER
279 # endif
280 #else
281 # define RESTRICTED_POINTER
282 #endif
284 /* C99 unaligned support */
286 #ifndef UNALIGNED
287 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
288 # define UNALIGNED __unaligned
289 # ifdef _WIN64
290 # define UNALIGNED64 __unaligned
291 # else
292 # define UNALIGNED64
293 # endif
294 #else
295 # define UNALIGNED
296 # define UNALIGNED64
297 #endif
298 #endif
300 /* Alignment macros */
302 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
303 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
304 #define MEMORY_ALLOCATION_ALIGNMENT 16
305 #else
306 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
307 #define MEMORY_ALLOCATION_ALIGNMENT 8
308 #endif
310 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
311 # define TYPE_ALIGNMENT(t) __alignof(t)
312 #elif defined(__GNUC__)
313 # define TYPE_ALIGNMENT(t) __alignof__(t)
314 #else
315 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
316 #endif
318 #ifdef _WIN64
319 # define PROBE_ALIGNMENT(_s) \
320 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
321 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
322 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
323 #else
324 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
325 #endif
327 /* Compile time assertion */
329 #if defined(_MSC_VER)
330 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
331 #else
332 # define C_ASSERT(e) extern void __C_ASSERT__(int [(e)?1:-1])
333 #endif
335 /* Eliminate Microsoft C/C++ compiler warning 4715 */
336 #if defined(_MSC_VER) && (_MSC_VER > 1200)
337 # define DEFAULT_UNREACHABLE default: __assume(0)
338 #else
339 # define DEFAULT_UNREACHABLE
340 #endif
342 /* Error Masks */
343 #define APPLICATION_ERROR_MASK 0x20000000
344 #define ERROR_SEVERITY_SUCCESS 0x00000000
345 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
346 #define ERROR_SEVERITY_WARNING 0x80000000
347 #define ERROR_SEVERITY_ERROR 0xC0000000
349 #ifdef __cplusplus
350 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) \
351 extern "C++" { \
352 inline ENUMTYPE operator | (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)|((int)b)); } \
353 inline ENUMTYPE operator |= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) |= ((int)b)); } \
354 inline ENUMTYPE operator & (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)&((int)b)); } \
355 inline ENUMTYPE operator &= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) &= ((int)b)); } \
356 inline ENUMTYPE operator ~ (ENUMTYPE a) { return (ENUMTYPE)(~((int)a)); } \
357 inline ENUMTYPE operator ^ (ENUMTYPE a, ENUMTYPE b) { return ENUMTYPE(((int)a)^((int)b)); } \
358 inline ENUMTYPE operator ^= (ENUMTYPE &a, ENUMTYPE b) { return (ENUMTYPE &)(((int &)a) ^= ((int)b)); } \
360 #else
361 #define DEFINE_ENUM_FLAG_OPERATORS(ENUMTYPE) /* */
362 #endif
364 /* Microsoft's macros for declaring functions */
366 #ifdef __cplusplus
367 # define EXTERN_C extern "C"
368 #else
369 # define EXTERN_C extern
370 #endif
372 #define STDMETHODCALLTYPE __stdcall
373 #define STDMETHODVCALLTYPE __cdecl
374 #define STDAPICALLTYPE __stdcall
375 #define STDAPIVCALLTYPE __cdecl
377 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
378 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
379 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
380 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
381 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
382 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
383 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
384 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
386 /* Define the basic types */
387 #ifndef VOID
388 #define VOID void
389 #endif
390 typedef VOID *PVOID;
391 typedef VOID *PVOID64;
392 typedef BYTE BOOLEAN, *PBOOLEAN;
393 typedef char CHAR, *PCHAR;
394 typedef short SHORT, *PSHORT;
395 #ifdef _MSC_VER
396 typedef long LONG, *PLONG;
397 #else
398 typedef int LONG, *PLONG;
399 #endif
401 /* Some systems might have wchar_t, but we really need 16 bit characters */
402 #ifdef WINE_UNICODE_NATIVE
403 typedef wchar_t WCHAR, *PWCHAR;
404 #else
405 typedef unsigned short WCHAR, *PWCHAR;
406 #endif
408 /* 'Extended/Wide' numerical types */
409 #ifndef _ULONGLONG_
410 # define _ULONGLONG_
411 # ifdef _MSC_VER
412 typedef signed __int64 LONGLONG, *PLONGLONG;
413 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
414 # else
415 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
416 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
417 # endif
418 #endif
420 #ifndef _DWORDLONG_
421 # define _DWORDLONG_
422 # ifdef _MSC_VER
423 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
424 # else
425 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
426 # endif
427 #endif
429 /* ANSI string types */
430 typedef CHAR *PCH, *LPCH;
431 typedef const CHAR *PCCH, *LPCCH;
432 typedef CHAR *PSTR, *LPSTR, *NPSTR;
433 typedef const CHAR *PCSTR, *LPCSTR;
434 typedef CHAR *PZZSTR;
435 typedef const CHAR *PCZZSTR;
437 /* Unicode string types */
438 typedef WCHAR *PWCH, *LPWCH;
439 typedef const WCHAR *PCWCH, *LPCWCH;
440 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
441 typedef const WCHAR *PCWSTR, *LPCWSTR;
442 typedef WCHAR *PZZWSTR;
443 typedef const WCHAR *PCZZWSTR;
445 /* Neutral character and string types */
446 /* These are only defined for Winelib, i.e. _not_ defined for
447 * the emulator. The reason is they depend on the UNICODE
448 * macro which only exists in the user's code.
450 #ifndef WINE_NO_UNICODE_MACROS
451 # ifdef UNICODE
452 # ifndef _TCHAR_DEFINED
453 typedef WCHAR TCHAR, *PTCHAR;
454 # define _TCHAR_DEFINED
455 #endif
456 typedef LPWSTR PTSTR, LPTSTR;
457 typedef LPCWSTR PCTSTR, LPCTSTR;
458 typedef PZZSTR PZZTSTR;
459 typedef PCZZSTR PCZZTSTR;
460 # define __TEXT(string) L##string
461 # else /* UNICODE */
462 # ifndef _TCHAR_DEFINED
463 typedef CHAR TCHAR, *PTCHAR;
464 # define _TCHAR_DEFINED
465 # endif
466 typedef LPSTR PTSTR, LPTSTR;
467 typedef LPCSTR PCTSTR, LPCTSTR;
468 typedef PZZWSTR PZZTSTR;
469 typedef PCZZWSTR PCZZTSTR;
470 # define __TEXT(string) string
471 # endif /* UNICODE */
472 # define TEXT(quote) __TEXT(quote)
473 #endif /* WINE_NO_UNICODE_MACROS */
475 /* Misc common WIN32 types */
476 typedef char CCHAR;
477 typedef DWORD LCID, *PLCID;
478 typedef WORD LANGID;
479 typedef DWORD EXECUTION_STATE;
480 #ifndef _HRESULT_DEFINED
481 #define _HRESULT_DEFINED
482 typedef LONG HRESULT;
483 #endif
485 /* Handle type */
487 typedef void *HANDLE;
488 typedef HANDLE *PHANDLE, *LPHANDLE;
490 #ifdef STRICT
491 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
492 #else /*STRICT*/
493 #define DECLARE_HANDLE(a) typedef HANDLE a
494 #endif /*STRICT*/
496 typedef BYTE FCHAR;
497 typedef WORD FSHORT;
498 typedef DWORD FLONG;
500 /* Defines */
502 #ifndef WIN32_NO_STATUS
504 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
505 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
506 #define STATUS_USER_APC ((DWORD) 0x000000C0)
507 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
508 #define STATUS_PENDING ((DWORD) 0x00000103)
509 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
510 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
511 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
512 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
513 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
514 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
515 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
516 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
517 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
518 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
519 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
520 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
521 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
522 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
523 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
524 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
525 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
526 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
527 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
528 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
529 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
530 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
531 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
532 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
533 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
534 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
535 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
536 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
537 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
538 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
540 /* status values for ContinueDebugEvent */
541 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
542 #define DBG_CONTINUE ((DWORD) 0x00010002)
543 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
544 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
545 #define DBG_CONTROL_C ((DWORD) 0x40010005)
546 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
547 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
548 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
550 #endif /* WIN32_NO_STATUS */
552 /* Argument 1 passed to the DllEntryProc. */
553 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
554 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
555 #define DLL_THREAD_ATTACH 2 /* attach new thread */
556 #define DLL_THREAD_DETACH 3 /* detach thread */
557 #ifdef __WINESRC__
558 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
559 #endif
561 /* u.x.wProcessorArchitecture (NT) */
562 #define PROCESSOR_ARCHITECTURE_INTEL 0
563 #define PROCESSOR_ARCHITECTURE_MIPS 1
564 #define PROCESSOR_ARCHITECTURE_ALPHA 2
565 #define PROCESSOR_ARCHITECTURE_PPC 3
566 #define PROCESSOR_ARCHITECTURE_SHX 4
567 #define PROCESSOR_ARCHITECTURE_ARM 5
568 #define PROCESSOR_ARCHITECTURE_IA64 6
569 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
570 #define PROCESSOR_ARCHITECTURE_MSIL 8
571 #define PROCESSOR_ARCHITECTURE_AMD64 9
572 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
573 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
575 /* Wine extension */
576 #define PROCESSOR_ARCHITECTURE_SPARC 20
578 /* dwProcessorType */
579 #define PROCESSOR_INTEL_386 386
580 #define PROCESSOR_INTEL_486 486
581 #define PROCESSOR_INTEL_PENTIUM 586
582 #define PROCESSOR_INTEL_860 860
583 #define PROCESSOR_INTEL_IA64 2200
584 #define PROCESSOR_AMD_X8664 8664
585 #define PROCESSOR_MIPS_R2000 2000
586 #define PROCESSOR_MIPS_R3000 3000
587 #define PROCESSOR_MIPS_R4000 4000
588 #define PROCESSOR_ALPHA_21064 21064
589 #define PROCESSOR_PPC_601 601
590 #define PROCESSOR_PPC_603 603
591 #define PROCESSOR_PPC_604 604
592 #define PROCESSOR_PPC_620 620
593 #define PROCESSOR_HITACHI_SH3 10003
594 #define PROCESSOR_HITACHI_SH3E 10004
595 #define PROCESSOR_HITACHI_SH4 10005
596 #define PROCESSOR_MOTOROLA_821 821
597 #define PROCESSOR_SHx_SH3 103
598 #define PROCESSOR_SHx_SH4 104
599 #define PROCESSOR_STRONGARM 2577
600 #define PROCESSOR_ARM720 1824 /* 0x720 */
601 #define PROCESSOR_ARM820 2080 /* 0x820 */
602 #define PROCESSOR_ARM920 2336 /* 0x920 */
603 #define PROCESSOR_ARM_7TDMI 70001
604 #define PROCESSOR_OPTIL 18767
606 #ifdef _WIN64
607 #define MAXIMUM_PROCESSORS 64
608 #else
609 #define MAXIMUM_PROCESSORS 32
610 #endif
612 typedef struct _MEMORY_BASIC_INFORMATION
614 LPVOID BaseAddress;
615 LPVOID AllocationBase;
616 DWORD AllocationProtect;
617 SIZE_T RegionSize;
618 DWORD State;
619 DWORD Protect;
620 DWORD Type;
621 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
623 #define PAGE_NOACCESS 0x01
624 #define PAGE_READONLY 0x02
625 #define PAGE_READWRITE 0x04
626 #define PAGE_WRITECOPY 0x08
627 #define PAGE_EXECUTE 0x10
628 #define PAGE_EXECUTE_READ 0x20
629 #define PAGE_EXECUTE_READWRITE 0x40
630 #define PAGE_EXECUTE_WRITECOPY 0x80
631 #define PAGE_GUARD 0x100
632 #define PAGE_NOCACHE 0x200
633 #define PAGE_WRITECOMBINE 0x400
635 #define MEM_COMMIT 0x00001000
636 #define MEM_RESERVE 0x00002000
637 #define MEM_DECOMMIT 0x00004000
638 #define MEM_RELEASE 0x00008000
639 #define MEM_FREE 0x00010000
640 #define MEM_PRIVATE 0x00020000
641 #define MEM_MAPPED 0x00040000
642 #define MEM_RESET 0x00080000
643 #define MEM_TOP_DOWN 0x00100000
644 #define MEM_WRITE_WATCH 0x00200000
645 #define MEM_PHYSICAL 0x00400000
646 #define MEM_LARGE_PAGES 0x20000000
647 #define MEM_4MB_PAGES 0x80000000
649 #define SEC_FILE 0x00800000
650 #define SEC_IMAGE 0x01000000
651 #define SEC_RESERVE 0x04000000
652 #define SEC_COMMIT 0x08000000
653 #define SEC_NOCACHE 0x10000000
654 #define SEC_LARGE_PAGES 0x80000000
655 #define MEM_IMAGE SEC_IMAGE
657 #define WRITE_WATCH_FLAG_RESET 0x00000001
660 #define MINCHAR 0x80
661 #define MAXCHAR 0x7f
662 #define MINSHORT 0x8000
663 #define MAXSHORT 0x7fff
664 #define MINLONG 0x80000000
665 #define MAXLONG 0x7fffffff
666 #define MAXBYTE 0xff
667 #define MAXWORD 0xffff
668 #define MAXDWORD 0xffffffff
670 #define UNICODE_STRING_MAX_CHARS 32767
672 #define FIELD_OFFSET(type, field) \
673 ((LONG)(INT_PTR)&(((type *)0)->field))
675 #define CONTAINING_RECORD(address, type, field) \
676 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
678 /* Types */
680 typedef struct _LIST_ENTRY {
681 struct _LIST_ENTRY *Flink;
682 struct _LIST_ENTRY *Blink;
683 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
685 typedef struct _SINGLE_LIST_ENTRY {
686 struct _SINGLE_LIST_ENTRY *Next;
687 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
689 #ifdef _WIN64
691 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY;
692 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
693 PSLIST_ENTRY Next;
694 } SLIST_ENTRY;
696 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
697 struct {
698 ULONGLONG Alignment;
699 ULONGLONG Region;
700 } DUMMYSTRUCTNAME;
701 struct {
702 ULONGLONG Depth:16;
703 ULONGLONG Sequence:9;
704 ULONGLONG NextEntry:39;
705 ULONGLONG HeaderType:1;
706 ULONGLONG Init:1;
707 ULONGLONG Reserved:59;
708 ULONGLONG Region:3;
709 } Header8;
710 struct {
711 ULONGLONG Depth:16;
712 ULONGLONG Sequence:48;
713 ULONGLONG HeaderType:1;
714 ULONGLONG Init:1;
715 ULONGLONG Reserved:2;
716 ULONGLONG NextEntry:60;
717 } Header16;
718 } SLIST_HEADER, *PSLIST_HEADER;
720 #else
722 #undef SLIST_ENTRY /* for Mac OS */
723 #define SLIST_ENTRY SINGLE_LIST_ENTRY
724 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
725 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
727 typedef union _SLIST_HEADER {
728 ULONGLONG Alignment;
729 struct {
730 SLIST_ENTRY Next;
731 WORD Depth;
732 WORD Sequence;
733 } DUMMYSTRUCTNAME;
734 } SLIST_HEADER, *PSLIST_HEADER;
736 #endif
738 NTSYSAPI PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER*);
739 NTSYSAPI VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER);
740 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER);
741 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER);
742 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
743 NTSYSAPI WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
746 /* Heap flags */
748 #define HEAP_NO_SERIALIZE 0x00000001
749 #define HEAP_GROWABLE 0x00000002
750 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
751 #define HEAP_ZERO_MEMORY 0x00000008
752 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
753 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
754 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
755 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
756 #define HEAP_CREATE_ALIGN_16 0x00010000
757 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
758 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
760 /* This flag allows it to create heaps shared by all processes under win95,
761 FIXME: correct name */
762 #define HEAP_SHARED 0x04000000
764 typedef enum _HEAP_INFORMATION_CLASS {
765 HeapCompatibilityInformation,
766 } HEAP_INFORMATION_CLASS;
768 /* Processor feature flags. */
769 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
770 #define PF_FLOATING_POINT_EMULATED 1
771 #define PF_COMPARE_EXCHANGE_DOUBLE 2
772 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
773 #define PF_PPC_MOVEMEM_64BIT_OK 4
774 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
775 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
776 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
777 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
778 #define PF_PAE_ENABLED 9
779 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
780 #define PF_SSE_DAZ_MODE_AVAILABLE 11
781 #define PF_NX_ENABLED 12
782 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
783 #define PF_COMPARE_EXCHANGE128 14
784 #define PF_COMPARE64_EXCHANGE128 15
785 #define PF_CHANNELS_ENABLED 16
786 #define PF_XSAVE_ENABLED 17
789 /* Execution state flags */
790 #define ES_SYSTEM_REQUIRED 0x00000001
791 #define ES_DISPLAY_REQUIRED 0x00000002
792 #define ES_USER_PRESENT 0x00000004
793 #define ES_CONTINUOUS 0x80000000
795 /* The Win32 register context */
797 /* i386 context definitions */
798 #ifdef __i386__
800 #define SIZE_OF_80387_REGISTERS 80
802 typedef struct _FLOATING_SAVE_AREA
804 DWORD ControlWord;
805 DWORD StatusWord;
806 DWORD TagWord;
807 DWORD ErrorOffset;
808 DWORD ErrorSelector;
809 DWORD DataOffset;
810 DWORD DataSelector;
811 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
812 DWORD Cr0NpxState;
813 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
815 #define MAXIMUM_SUPPORTED_EXTENSION 512
817 typedef struct _CONTEXT
819 DWORD ContextFlags;
821 /* These are selected by CONTEXT_DEBUG_REGISTERS */
822 DWORD Dr0;
823 DWORD Dr1;
824 DWORD Dr2;
825 DWORD Dr3;
826 DWORD Dr6;
827 DWORD Dr7;
829 /* These are selected by CONTEXT_FLOATING_POINT */
830 FLOATING_SAVE_AREA FloatSave;
832 /* These are selected by CONTEXT_SEGMENTS */
833 DWORD SegGs;
834 DWORD SegFs;
835 DWORD SegEs;
836 DWORD SegDs;
838 /* These are selected by CONTEXT_INTEGER */
839 DWORD Edi;
840 DWORD Esi;
841 DWORD Ebx;
842 DWORD Edx;
843 DWORD Ecx;
844 DWORD Eax;
846 /* These are selected by CONTEXT_CONTROL */
847 DWORD Ebp;
848 DWORD Eip;
849 DWORD SegCs;
850 DWORD EFlags;
851 DWORD Esp;
852 DWORD SegSs;
854 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
855 } CONTEXT;
857 #define CONTEXT_X86 0x00010000
858 #define CONTEXT_i386 CONTEXT_X86
859 #define CONTEXT_i486 CONTEXT_X86
861 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
862 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
863 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
864 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
865 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
866 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020L)
867 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
868 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
869 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
871 #define EXCEPTION_READ_FAULT 0
872 #define EXCEPTION_WRITE_FAULT 1
873 #define EXCEPTION_EXECUTE_FAULT 8
875 #endif /* __i386__ */
877 typedef struct _LDT_ENTRY {
878 WORD LimitLow;
879 WORD BaseLow;
880 union {
881 struct {
882 BYTE BaseMid;
883 BYTE Flags1;
884 BYTE Flags2;
885 BYTE BaseHi;
886 } Bytes;
887 struct {
888 unsigned BaseMid: 8;
889 unsigned Type : 5;
890 unsigned Dpl : 2;
891 unsigned Pres : 1;
892 unsigned LimitHi : 4;
893 unsigned Sys : 1;
894 unsigned Reserved_0 : 1;
895 unsigned Default_Big : 1;
896 unsigned Granularity : 1;
897 unsigned BaseHi : 8;
898 } Bits;
899 } HighWord;
900 } LDT_ENTRY, *PLDT_ENTRY;
902 /* x86-64 context definitions */
903 #if defined(__x86_64__)
905 #define CONTEXT_AMD64 0x00100000
907 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
908 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
909 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
910 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
911 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
912 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
913 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
915 #define EXCEPTION_READ_FAULT 0
916 #define EXCEPTION_WRITE_FAULT 1
917 #define EXCEPTION_EXECUTE_FAULT 8
919 typedef struct DECLSPEC_ALIGN(16) _M128A {
920 ULONGLONG Low;
921 LONGLONG High;
922 } M128A, *PM128A;
924 typedef struct _XMM_SAVE_AREA32 {
925 WORD ControlWord; /* 000 */
926 WORD StatusWord; /* 002 */
927 BYTE TagWord; /* 004 */
928 BYTE Reserved1; /* 005 */
929 WORD ErrorOpcode; /* 006 */
930 DWORD ErrorOffset; /* 008 */
931 WORD ErrorSelector; /* 00c */
932 WORD Reserved2; /* 00e */
933 DWORD DataOffset; /* 010 */
934 WORD DataSelector; /* 014 */
935 WORD Reserved3; /* 016 */
936 DWORD MxCsr; /* 018 */
937 DWORD MxCsr_Mask; /* 01c */
938 M128A FloatRegisters[8]; /* 020 */
939 M128A XmmRegisters[16]; /* 0a0 */
940 BYTE Reserved4[96]; /* 1a0 */
941 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
943 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
944 DWORD64 P1Home; /* 000 */
945 DWORD64 P2Home; /* 008 */
946 DWORD64 P3Home; /* 010 */
947 DWORD64 P4Home; /* 018 */
948 DWORD64 P5Home; /* 020 */
949 DWORD64 P6Home; /* 028 */
951 /* Control flags */
952 DWORD ContextFlags; /* 030 */
953 DWORD MxCsr; /* 034 */
955 /* Segment */
956 WORD SegCs; /* 038 */
957 WORD SegDs; /* 03a */
958 WORD SegEs; /* 03c */
959 WORD SegFs; /* 03e */
960 WORD SegGs; /* 040 */
961 WORD SegSs; /* 042 */
962 DWORD EFlags; /* 044 */
964 /* Debug */
965 DWORD64 Dr0; /* 048 */
966 DWORD64 Dr1; /* 050 */
967 DWORD64 Dr2; /* 058 */
968 DWORD64 Dr3; /* 060 */
969 DWORD64 Dr6; /* 068 */
970 DWORD64 Dr7; /* 070 */
972 /* Integer */
973 DWORD64 Rax; /* 078 */
974 DWORD64 Rcx; /* 080 */
975 DWORD64 Rdx; /* 088 */
976 DWORD64 Rbx; /* 090 */
977 DWORD64 Rsp; /* 098 */
978 DWORD64 Rbp; /* 0a0 */
979 DWORD64 Rsi; /* 0a8 */
980 DWORD64 Rdi; /* 0b0 */
981 DWORD64 R8; /* 0b8 */
982 DWORD64 R9; /* 0c0 */
983 DWORD64 R10; /* 0c8 */
984 DWORD64 R11; /* 0d0 */
985 DWORD64 R12; /* 0d8 */
986 DWORD64 R13; /* 0e0 */
987 DWORD64 R14; /* 0e8 */
988 DWORD64 R15; /* 0f0 */
990 /* Counter */
991 DWORD64 Rip; /* 0f8 */
993 /* Floating point */
994 union {
995 XMM_SAVE_AREA32 FltSave; /* 100 */
996 struct {
997 M128A Header[2]; /* 100 */
998 M128A Legacy[8]; /* 120 */
999 M128A Xmm0; /* 1a0 */
1000 M128A Xmm1; /* 1b0 */
1001 M128A Xmm2; /* 1c0 */
1002 M128A Xmm3; /* 1d0 */
1003 M128A Xmm4; /* 1e0 */
1004 M128A Xmm5; /* 1f0 */
1005 M128A Xmm6; /* 200 */
1006 M128A Xmm7; /* 210 */
1007 M128A Xmm8; /* 220 */
1008 M128A Xmm9; /* 230 */
1009 M128A Xmm10; /* 240 */
1010 M128A Xmm11; /* 250 */
1011 M128A Xmm12; /* 260 */
1012 M128A Xmm13; /* 270 */
1013 M128A Xmm14; /* 280 */
1014 M128A Xmm15; /* 290 */
1015 } DUMMYSTRUCTNAME;
1016 } DUMMYUNIONNAME;
1018 /* Vector */
1019 M128A VectorRegister[26]; /* 300 */
1020 DWORD64 VectorControl; /* 4a0 */
1022 /* Debug control */
1023 DWORD64 DebugControl; /* 4a8 */
1024 DWORD64 LastBranchToRip; /* 4b0 */
1025 DWORD64 LastBranchFromRip; /* 4b8 */
1026 DWORD64 LastExceptionToRip; /* 4c0 */
1027 DWORD64 LastExceptionFromRip; /* 4c8 */
1028 } CONTEXT;
1030 typedef struct _RUNTIME_FUNCTION
1032 DWORD BeginAddress;
1033 DWORD EndAddress;
1034 DWORD UnwindData;
1035 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1037 #define UNWIND_HISTORY_TABLE_SIZE 12
1039 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1041 ULONG64 ImageBase;
1042 PRUNTIME_FUNCTION FunctionEntry;
1043 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1045 #define UNWIND_HISTORY_TABLE_NONE 0
1046 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1047 #define UNWIND_HISTORY_TABLE_LOCAL 2
1049 typedef struct _UNWIND_HISTORY_TABLE
1051 ULONG Count;
1052 UCHAR Search;
1053 ULONG64 LowAddress;
1054 ULONG64 HighAddress;
1055 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1056 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1058 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1060 union
1062 PM128A FloatingContext[16];
1063 struct
1065 PM128A Xmm0;
1066 PM128A Xmm1;
1067 PM128A Xmm2;
1068 PM128A Xmm3;
1069 PM128A Xmm4;
1070 PM128A Xmm5;
1071 PM128A Xmm6;
1072 PM128A Xmm7;
1073 PM128A Xmm8;
1074 PM128A Xmm9;
1075 PM128A Xmm10;
1076 PM128A Xmm11;
1077 PM128A Xmm12;
1078 PM128A Xmm13;
1079 PM128A Xmm14;
1080 PM128A Xmm15;
1081 } DUMMYSTRUCTNAME1;
1082 } DUMMYUNIONNAME1;
1084 union
1086 PULONG64 IntegerContext[16];
1087 struct
1089 PULONG64 Rax;
1090 PULONG64 Rcx;
1091 PULONG64 Rdx;
1092 PULONG64 Rbx;
1093 PULONG64 Rsp;
1094 PULONG64 Rbp;
1095 PULONG64 Rsi;
1096 PULONG64 Rdi;
1097 PULONG64 R8;
1098 PULONG64 R9;
1099 PULONG64 R10;
1100 PULONG64 R11;
1101 PULONG64 R12;
1102 PULONG64 R13;
1103 PULONG64 R14;
1104 PULONG64 R15;
1105 } DUMMYSTRUCTNAME2;
1106 } DUMMYUNIONNAME2;
1107 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1109 BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64);
1110 BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
1111 PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD64,DWORD64*,UNWIND_HISTORY_TABLE*);
1112 PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
1114 #define UNW_FLAG_NHANDLER 0
1115 #define UNW_FLAG_EHANDLER 1
1116 #define UNW_FLAG_UHANDLER 2
1117 #define UNW_FLAG_CHAININFO 4
1119 #endif /* __x86_64__ */
1121 /* IA64 context definitions */
1122 #ifdef __ia64__
1124 #define CONTEXT_IA64 0x00080000
1125 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1126 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1127 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1128 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1129 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1130 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1131 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1132 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1133 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1135 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1136 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1137 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1138 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1140 typedef struct _CONTEXT
1142 DWORD ContextFlags;
1143 DWORD Fill1[3];
1144 ULONGLONG DbI0;
1145 ULONGLONG DbI1;
1146 ULONGLONG DbI2;
1147 ULONGLONG DbI3;
1148 ULONGLONG DbI4;
1149 ULONGLONG DbI5;
1150 ULONGLONG DbI6;
1151 ULONGLONG DbI7;
1152 ULONGLONG DbD0;
1153 ULONGLONG DbD1;
1154 ULONGLONG DbD2;
1155 ULONGLONG DbD3;
1156 ULONGLONG DbD4;
1157 ULONGLONG DbD5;
1158 ULONGLONG DbD6;
1159 ULONGLONG DbD7;
1160 FLOAT128 FltS0;
1161 FLOAT128 FltS1;
1162 FLOAT128 FltS2;
1163 FLOAT128 FltS3;
1164 FLOAT128 FltT0;
1165 FLOAT128 FltT1;
1166 FLOAT128 FltT2;
1167 FLOAT128 FltT3;
1168 FLOAT128 FltT4;
1169 FLOAT128 FltT5;
1170 FLOAT128 FltT6;
1171 FLOAT128 FltT7;
1172 FLOAT128 FltT8;
1173 FLOAT128 FltT9;
1174 FLOAT128 FltS4;
1175 FLOAT128 FltS5;
1176 FLOAT128 FltS6;
1177 FLOAT128 FltS7;
1178 FLOAT128 FltS8;
1179 FLOAT128 FltS9;
1180 FLOAT128 FltS10;
1181 FLOAT128 FltS11;
1182 FLOAT128 FltS12;
1183 FLOAT128 FltS13;
1184 FLOAT128 FltS14;
1185 FLOAT128 FltS15;
1186 FLOAT128 FltS16;
1187 FLOAT128 FltS17;
1188 FLOAT128 FltS18;
1189 FLOAT128 FltS19;
1190 FLOAT128 FltF32;
1191 FLOAT128 FltF33;
1192 FLOAT128 FltF34;
1193 FLOAT128 FltF35;
1194 FLOAT128 FltF36;
1195 FLOAT128 FltF37;
1196 FLOAT128 FltF38;
1197 FLOAT128 FltF39;
1198 FLOAT128 FltF40;
1199 FLOAT128 FltF41;
1200 FLOAT128 FltF42;
1201 FLOAT128 FltF43;
1202 FLOAT128 FltF44;
1203 FLOAT128 FltF45;
1204 FLOAT128 FltF46;
1205 FLOAT128 FltF47;
1206 FLOAT128 FltF48;
1207 FLOAT128 FltF49;
1208 FLOAT128 FltF50;
1209 FLOAT128 FltF51;
1210 FLOAT128 FltF52;
1211 FLOAT128 FltF53;
1212 FLOAT128 FltF54;
1213 FLOAT128 FltF55;
1214 FLOAT128 FltF56;
1215 FLOAT128 FltF57;
1216 FLOAT128 FltF58;
1217 FLOAT128 FltF59;
1218 FLOAT128 FltF60;
1219 FLOAT128 FltF61;
1220 FLOAT128 FltF62;
1221 FLOAT128 FltF63;
1222 FLOAT128 FltF64;
1223 FLOAT128 FltF65;
1224 FLOAT128 FltF66;
1225 FLOAT128 FltF67;
1226 FLOAT128 FltF68;
1227 FLOAT128 FltF69;
1228 FLOAT128 FltF70;
1229 FLOAT128 FltF71;
1230 FLOAT128 FltF72;
1231 FLOAT128 FltF73;
1232 FLOAT128 FltF74;
1233 FLOAT128 FltF75;
1234 FLOAT128 FltF76;
1235 FLOAT128 FltF77;
1236 FLOAT128 FltF78;
1237 FLOAT128 FltF79;
1238 FLOAT128 FltF80;
1239 FLOAT128 FltF81;
1240 FLOAT128 FltF82;
1241 FLOAT128 FltF83;
1242 FLOAT128 FltF84;
1243 FLOAT128 FltF85;
1244 FLOAT128 FltF86;
1245 FLOAT128 FltF87;
1246 FLOAT128 FltF88;
1247 FLOAT128 FltF89;
1248 FLOAT128 FltF90;
1249 FLOAT128 FltF91;
1250 FLOAT128 FltF92;
1251 FLOAT128 FltF93;
1252 FLOAT128 FltF94;
1253 FLOAT128 FltF95;
1254 FLOAT128 FltF96;
1255 FLOAT128 FltF97;
1256 FLOAT128 FltF98;
1257 FLOAT128 FltF99;
1258 FLOAT128 FltF100;
1259 FLOAT128 FltF101;
1260 FLOAT128 FltF102;
1261 FLOAT128 FltF103;
1262 FLOAT128 FltF104;
1263 FLOAT128 FltF105;
1264 FLOAT128 FltF106;
1265 FLOAT128 FltF107;
1266 FLOAT128 FltF108;
1267 FLOAT128 FltF109;
1268 FLOAT128 FltF110;
1269 FLOAT128 FltF111;
1270 FLOAT128 FltF112;
1271 FLOAT128 FltF113;
1272 FLOAT128 FltF114;
1273 FLOAT128 FltF115;
1274 FLOAT128 FltF116;
1275 FLOAT128 FltF117;
1276 FLOAT128 FltF118;
1277 FLOAT128 FltF119;
1278 FLOAT128 FltF120;
1279 FLOAT128 FltF121;
1280 FLOAT128 FltF122;
1281 FLOAT128 FltF123;
1282 FLOAT128 FltF124;
1283 FLOAT128 FltF125;
1284 FLOAT128 FltF126;
1285 FLOAT128 FltF127;
1286 ULONGLONG StFPSR;
1287 ULONGLONG IntGp;
1288 ULONGLONG IntT0;
1289 ULONGLONG IntT1;
1290 ULONGLONG IntS0;
1291 ULONGLONG IntS1;
1292 ULONGLONG IntS2;
1293 ULONGLONG IntS3;
1294 ULONGLONG IntV0;
1295 ULONGLONG IntT2;
1296 ULONGLONG IntT3;
1297 ULONGLONG IntT4;
1298 ULONGLONG IntSp;
1299 ULONGLONG IntTeb;
1300 ULONGLONG IntT5;
1301 ULONGLONG IntT6;
1302 ULONGLONG IntT7;
1303 ULONGLONG IntT8;
1304 ULONGLONG IntT9;
1305 ULONGLONG IntT10;
1306 ULONGLONG IntT11;
1307 ULONGLONG IntT12;
1308 ULONGLONG IntT13;
1309 ULONGLONG IntT14;
1310 ULONGLONG IntT15;
1311 ULONGLONG IntT16;
1312 ULONGLONG IntT17;
1313 ULONGLONG IntT18;
1314 ULONGLONG IntT19;
1315 ULONGLONG IntT20;
1316 ULONGLONG IntT21;
1317 ULONGLONG IntT22;
1318 ULONGLONG IntNats;
1319 ULONGLONG Preds;
1320 ULONGLONG BrRp;
1321 ULONGLONG BrS0;
1322 ULONGLONG BrS1;
1323 ULONGLONG BrS2;
1324 ULONGLONG BrS3;
1325 ULONGLONG BrS4;
1326 ULONGLONG BrT0;
1327 ULONGLONG BrT1;
1328 ULONGLONG ApUNAT;
1329 ULONGLONG ApLC;
1330 ULONGLONG ApEC;
1331 ULONGLONG ApCCV;
1332 ULONGLONG ApDCR;
1333 ULONGLONG RsPFS;
1334 ULONGLONG RsBSP;
1335 ULONGLONG RsBSPSTORE;
1336 ULONGLONG RsRSC;
1337 ULONGLONG RsRNAT;
1338 ULONGLONG StIPSR;
1339 ULONGLONG StIIP;
1340 ULONGLONG StIFS;
1341 ULONGLONG StFCR;
1342 ULONGLONG Eflag;
1343 ULONGLONG SegCSD;
1344 ULONGLONG SegSSD;
1345 ULONGLONG Cflag;
1346 ULONGLONG StFSR;
1347 ULONGLONG StFIR;
1348 ULONGLONG StFDR;
1349 ULONGLONG UNUSEDPACK;
1350 } CONTEXT, *PCONTEXT;
1352 typedef struct _RUNTIME_FUNCTION
1354 ULONG BeginAddress;
1355 ULONG EndAddress;
1356 ULONG UnwindInfoAddress;
1357 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1359 typedef struct _FRAME_POINTERS {
1360 ULONGLONG MemoryStackFp;
1361 ULONGLONG BackingStoreFp;
1362 } FRAME_POINTERS, *PFRAME_POINTERS;
1364 #define UNWIND_HISTORY_TABLE_SIZE 12
1366 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
1367 ULONG64 ImageBase;
1368 ULONG64 Gp;
1369 PRUNTIME_FUNCTION FunctionEntry;
1370 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1372 typedef struct _UNWIND_HISTORY_TABLE {
1373 ULONG Count;
1374 UCHAR Search;
1375 ULONG64 LowAddress;
1376 ULONG64 HighAddress;
1377 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1378 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1380 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1382 PFLOAT128 FltS0;
1383 PFLOAT128 FltS1;
1384 PFLOAT128 FltS2;
1385 PFLOAT128 FltS3;
1386 PFLOAT128 HighFloatingContext[10];
1387 PFLOAT128 FltS4;
1388 PFLOAT128 FltS5;
1389 PFLOAT128 FltS6;
1390 PFLOAT128 FltS7;
1391 PFLOAT128 FltS8;
1392 PFLOAT128 FltS9;
1393 PFLOAT128 FltS10;
1394 PFLOAT128 FltS11;
1395 PFLOAT128 FltS12;
1396 PFLOAT128 FltS13;
1397 PFLOAT128 FltS14;
1398 PFLOAT128 FltS15;
1399 PFLOAT128 FltS16;
1400 PFLOAT128 FltS17;
1401 PFLOAT128 FltS18;
1402 PFLOAT128 FltS19;
1403 PULONGLONG IntS0;
1404 PULONGLONG IntS1;
1405 PULONGLONG IntS2;
1406 PULONGLONG IntS3;
1407 PULONGLONG IntSp;
1408 PULONGLONG IntS0Nat;
1409 PULONGLONG IntS1Nat;
1410 PULONGLONG IntS2Nat;
1411 PULONGLONG IntS3Nat;
1412 PULONGLONG IntSpNat;
1413 PULONGLONG Preds;
1414 PULONGLONG BrRp;
1415 PULONGLONG BrS0;
1416 PULONGLONG BrS1;
1417 PULONGLONG BrS2;
1418 PULONGLONG BrS3;
1419 PULONGLONG BrS4;
1420 PULONGLONG ApUNAT;
1421 PULONGLONG ApLC;
1422 PULONGLONG ApEC;
1423 PULONGLONG RsPFS;
1424 PULONGLONG StFSR;
1425 PULONGLONG StFIR;
1426 PULONGLONG StFDR;
1427 PULONGLONG Cflag;
1428 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1430 ULONGLONG WINAPI RtlVirtualUnwind(ULONGLONG,ULONGLONG,RUNTIME_FUNCTION*,CONTEXT*,BOOLEAN*,FRAME_POINTERS*,KNONVOLATILE_CONTEXT_POINTERS*);
1432 #endif /* __ia64__ */
1434 /* Alpha context definitions */
1435 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1437 #define CONTEXT_ALPHA 0x00020000
1439 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
1440 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
1441 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
1442 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1444 #define EXCEPTION_READ_FAULT 0
1445 #define EXCEPTION_WRITE_FAULT 1
1446 #define EXCEPTION_EXECUTE_FAULT 8
1448 typedef struct _CONTEXT
1450 /* selected by CONTEXT_FLOATING_POINT */
1451 ULONGLONG FltF0;
1452 ULONGLONG FltF1;
1453 ULONGLONG FltF2;
1454 ULONGLONG FltF3;
1455 ULONGLONG FltF4;
1456 ULONGLONG FltF5;
1457 ULONGLONG FltF6;
1458 ULONGLONG FltF7;
1459 ULONGLONG FltF8;
1460 ULONGLONG FltF9;
1461 ULONGLONG FltF10;
1462 ULONGLONG FltF11;
1463 ULONGLONG FltF12;
1464 ULONGLONG FltF13;
1465 ULONGLONG FltF14;
1466 ULONGLONG FltF15;
1467 ULONGLONG FltF16;
1468 ULONGLONG FltF17;
1469 ULONGLONG FltF18;
1470 ULONGLONG FltF19;
1471 ULONGLONG FltF20;
1472 ULONGLONG FltF21;
1473 ULONGLONG FltF22;
1474 ULONGLONG FltF23;
1475 ULONGLONG FltF24;
1476 ULONGLONG FltF25;
1477 ULONGLONG FltF26;
1478 ULONGLONG FltF27;
1479 ULONGLONG FltF28;
1480 ULONGLONG FltF29;
1481 ULONGLONG FltF30;
1482 ULONGLONG FltF31;
1484 /* selected by CONTEXT_INTEGER */
1485 ULONGLONG IntV0;
1486 ULONGLONG IntT0;
1487 ULONGLONG IntT1;
1488 ULONGLONG IntT2;
1489 ULONGLONG IntT3;
1490 ULONGLONG IntT4;
1491 ULONGLONG IntT5;
1492 ULONGLONG IntT6;
1493 ULONGLONG IntT7;
1494 ULONGLONG IntS0;
1495 ULONGLONG IntS1;
1496 ULONGLONG IntS2;
1497 ULONGLONG IntS3;
1498 ULONGLONG IntS4;
1499 ULONGLONG IntS5;
1500 ULONGLONG IntFp;
1501 ULONGLONG IntA0;
1502 ULONGLONG IntA1;
1503 ULONGLONG IntA2;
1504 ULONGLONG IntA3;
1505 ULONGLONG IntA4;
1506 ULONGLONG IntA5;
1507 ULONGLONG IntT8;
1508 ULONGLONG IntT9;
1509 ULONGLONG IntT10;
1510 ULONGLONG IntT11;
1511 ULONGLONG IntRa;
1512 ULONGLONG IntT12;
1513 ULONGLONG IntAt;
1514 ULONGLONG IntGp;
1515 ULONGLONG IntSp;
1516 ULONGLONG IntZero;
1518 /* selected by CONTEXT_FLOATING_POINT */
1519 ULONGLONG Fpcr;
1520 ULONGLONG SoftFpcr;
1522 /* selected by CONTEXT_CONTROL */
1523 ULONGLONG Fir;
1524 DWORD Psr;
1525 DWORD ContextFlags;
1526 DWORD Fill[4];
1527 } CONTEXT;
1529 #define _QUAD_PSR_OFFSET HighSoftFpcr
1530 #define _QUAD_FLAGS_OFFSET HighFir
1532 #endif /* _ALPHA_ */
1534 #ifdef __arm__
1536 /* The following flags control the contents of the CONTEXT structure. */
1538 #define CONTEXT_ARM 0x0000040
1539 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1540 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1542 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1544 #define EXCEPTION_READ_FAULT 0
1545 #define EXCEPTION_WRITE_FAULT 1
1546 #define EXCEPTION_EXECUTE_FAULT 8
1548 typedef struct _CONTEXT {
1549 /* The flags values within this flag control the contents of
1550 a CONTEXT record.
1552 If the context record is used as an input parameter, then
1553 for each portion of the context record controlled by a flag
1554 whose value is set, it is assumed that that portion of the
1555 context record contains valid context. If the context record
1556 is being used to modify a thread's context, then only that
1557 portion of the threads context will be modified.
1559 If the context record is used as an IN OUT parameter to capture
1560 the context of a thread, then only those portions of the thread's
1561 context corresponding to set flags will be returned.
1563 The context record is never used as an OUT only parameter. */
1565 ULONG ContextFlags;
1567 /* This section is specified/returned if the ContextFlags word contains
1568 the flag CONTEXT_INTEGER. */
1569 ULONG R0;
1570 ULONG R1;
1571 ULONG R2;
1572 ULONG R3;
1573 ULONG R4;
1574 ULONG R5;
1575 ULONG R6;
1576 ULONG R7;
1577 ULONG R8;
1578 ULONG R9;
1579 ULONG R10;
1580 ULONG Fp;
1581 ULONG Ip;
1583 /* These are selected by CONTEXT_CONTROL */
1584 ULONG Sp;
1585 ULONG Lr;
1586 ULONG Pc;
1587 ULONG Cpsr;
1588 } CONTEXT;
1590 #endif /* __arm__ */
1593 /* Mips context definitions */
1594 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1596 #define CONTEXT_R4000 0x00010000
1598 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1599 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1600 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1602 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1604 #define EXCEPTION_READ_FAULT 0
1605 #define EXCEPTION_WRITE_FAULT 1
1606 #define EXCEPTION_EXECUTE_FAULT 8
1608 typedef struct _CONTEXT
1610 DWORD Argument[4];
1611 /* These are selected by CONTEXT_FLOATING_POINT */
1612 DWORD FltF0;
1613 DWORD FltF1;
1614 DWORD FltF2;
1615 DWORD FltF3;
1616 DWORD FltF4;
1617 DWORD FltF5;
1618 DWORD FltF6;
1619 DWORD FltF7;
1620 DWORD FltF8;
1621 DWORD FltF9;
1622 DWORD FltF10;
1623 DWORD FltF11;
1624 DWORD FltF12;
1625 DWORD FltF13;
1626 DWORD FltF14;
1627 DWORD FltF15;
1628 DWORD FltF16;
1629 DWORD FltF17;
1630 DWORD FltF18;
1631 DWORD FltF19;
1632 DWORD FltF20;
1633 DWORD FltF21;
1634 DWORD FltF22;
1635 DWORD FltF23;
1636 DWORD FltF24;
1637 DWORD FltF25;
1638 DWORD FltF26;
1639 DWORD FltF27;
1640 DWORD FltF28;
1641 DWORD FltF29;
1642 DWORD FltF30;
1643 DWORD FltF31;
1645 /* These are selected by CONTEXT_INTEGER */
1646 DWORD IntZero;
1647 DWORD IntAt;
1648 DWORD IntV0;
1649 DWORD IntV1;
1650 DWORD IntA0;
1651 DWORD IntA1;
1652 DWORD IntA2;
1653 DWORD IntA3;
1654 DWORD IntT0;
1655 DWORD IntT1;
1656 DWORD IntT2;
1657 DWORD IntT3;
1658 DWORD IntT4;
1659 DWORD IntT5;
1660 DWORD IntT6;
1661 DWORD IntT7;
1662 DWORD IntS0;
1663 DWORD IntS1;
1664 DWORD IntS2;
1665 DWORD IntS3;
1666 DWORD IntS4;
1667 DWORD IntS5;
1668 DWORD IntS6;
1669 DWORD IntS7;
1670 DWORD IntT8;
1671 DWORD IntT9;
1672 DWORD IntK0;
1673 DWORD IntK1;
1674 DWORD IntGp;
1675 DWORD IntSp;
1676 DWORD IntS8;
1677 DWORD IntRa;
1678 DWORD IntLo;
1679 DWORD IntHi;
1681 /* These are selected by CONTEXT_FLOATING_POINT */
1682 DWORD Fsr;
1684 /* These are selected by CONTEXT_CONTROL */
1685 DWORD Fir;
1686 DWORD Psr;
1688 DWORD ContextFlags;
1689 DWORD Fill[2];
1690 } CONTEXT;
1692 #endif /* _MIPS_ */
1694 /* PowerPC context definitions */
1695 #ifdef __powerpc__
1697 #define CONTEXT_CONTROL 0x0001
1698 #define CONTEXT_FLOATING_POINT 0x0002
1699 #define CONTEXT_INTEGER 0x0004
1700 #define CONTEXT_DEBUG_REGISTERS 0x0008
1701 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1703 #define EXCEPTION_READ_FAULT 0
1704 #define EXCEPTION_WRITE_FAULT 1
1705 #define EXCEPTION_EXECUTE_FAULT 8
1707 typedef struct
1709 /* These are selected by CONTEXT_FLOATING_POINT */
1710 double Fpr0;
1711 double Fpr1;
1712 double Fpr2;
1713 double Fpr3;
1714 double Fpr4;
1715 double Fpr5;
1716 double Fpr6;
1717 double Fpr7;
1718 double Fpr8;
1719 double Fpr9;
1720 double Fpr10;
1721 double Fpr11;
1722 double Fpr12;
1723 double Fpr13;
1724 double Fpr14;
1725 double Fpr15;
1726 double Fpr16;
1727 double Fpr17;
1728 double Fpr18;
1729 double Fpr19;
1730 double Fpr20;
1731 double Fpr21;
1732 double Fpr22;
1733 double Fpr23;
1734 double Fpr24;
1735 double Fpr25;
1736 double Fpr26;
1737 double Fpr27;
1738 double Fpr28;
1739 double Fpr29;
1740 double Fpr30;
1741 double Fpr31;
1742 double Fpscr;
1744 /* These are selected by CONTEXT_INTEGER */
1745 DWORD Gpr0;
1746 DWORD Gpr1;
1747 DWORD Gpr2;
1748 DWORD Gpr3;
1749 DWORD Gpr4;
1750 DWORD Gpr5;
1751 DWORD Gpr6;
1752 DWORD Gpr7;
1753 DWORD Gpr8;
1754 DWORD Gpr9;
1755 DWORD Gpr10;
1756 DWORD Gpr11;
1757 DWORD Gpr12;
1758 DWORD Gpr13;
1759 DWORD Gpr14;
1760 DWORD Gpr15;
1761 DWORD Gpr16;
1762 DWORD Gpr17;
1763 DWORD Gpr18;
1764 DWORD Gpr19;
1765 DWORD Gpr20;
1766 DWORD Gpr21;
1767 DWORD Gpr22;
1768 DWORD Gpr23;
1769 DWORD Gpr24;
1770 DWORD Gpr25;
1771 DWORD Gpr26;
1772 DWORD Gpr27;
1773 DWORD Gpr28;
1774 DWORD Gpr29;
1775 DWORD Gpr30;
1776 DWORD Gpr31;
1778 DWORD Cr;
1779 DWORD Xer;
1781 /* These are selected by CONTEXT_CONTROL */
1782 DWORD Msr;
1783 DWORD Iar; /* Instruction Address Register , aka PC ... */
1784 DWORD Lr;
1785 DWORD Ctr;
1787 DWORD ContextFlags;
1789 DWORD Dar; /* Fault registers for coredump */
1790 DWORD Dsisr;
1791 DWORD Trap; /* number of powerpc exception taken */
1793 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1794 DWORD Dr0;
1795 DWORD Dr1;
1796 DWORD Dr2;
1797 DWORD Dr3;
1798 DWORD Dr4;
1799 DWORD Dr5;
1800 DWORD Dr6;
1801 DWORD Dr7;
1802 } CONTEXT;
1804 typedef struct _STACK_FRAME_HEADER
1806 DWORD BackChain;
1807 DWORD GlueSaved1;
1808 DWORD GlueSaved2;
1809 DWORD Reserved1;
1810 DWORD Spare1;
1811 DWORD Spare2;
1813 DWORD Parameter0;
1814 DWORD Parameter1;
1815 DWORD Parameter2;
1816 DWORD Parameter3;
1817 DWORD Parameter4;
1818 DWORD Parameter5;
1819 DWORD Parameter6;
1820 DWORD Parameter7;
1821 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1823 #endif /* __powerpc__ */
1825 #ifdef __sparc__
1828 * FIXME:
1830 * There is no official CONTEXT structure defined for the SPARC
1831 * architecture, so I just made one up.
1833 * This structure is valid only for 32-bit SPARC architectures,
1834 * not for 64-bit SPARC.
1836 * Note that this structure contains only the 'top-level' registers;
1837 * the rest of the register window chain is not visible.
1839 * The layout follows the Solaris 'prgregset_t' structure.
1843 #define CONTEXT_SPARC 0x10000000
1845 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1846 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1847 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1849 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1851 #define EXCEPTION_READ_FAULT 0
1852 #define EXCEPTION_WRITE_FAULT 1
1853 #define EXCEPTION_EXECUTE_FAULT 8
1855 typedef struct _CONTEXT
1857 DWORD ContextFlags;
1859 /* These are selected by CONTEXT_INTEGER */
1860 DWORD g0;
1861 DWORD g1;
1862 DWORD g2;
1863 DWORD g3;
1864 DWORD g4;
1865 DWORD g5;
1866 DWORD g6;
1867 DWORD g7;
1868 DWORD o0;
1869 DWORD o1;
1870 DWORD o2;
1871 DWORD o3;
1872 DWORD o4;
1873 DWORD o5;
1874 DWORD o6;
1875 DWORD o7;
1876 DWORD l0;
1877 DWORD l1;
1878 DWORD l2;
1879 DWORD l3;
1880 DWORD l4;
1881 DWORD l5;
1882 DWORD l6;
1883 DWORD l7;
1884 DWORD i0;
1885 DWORD i1;
1886 DWORD i2;
1887 DWORD i3;
1888 DWORD i4;
1889 DWORD i5;
1890 DWORD i6;
1891 DWORD i7;
1893 /* These are selected by CONTEXT_CONTROL */
1894 DWORD psr;
1895 DWORD pc;
1896 DWORD npc;
1897 DWORD y;
1898 DWORD wim;
1899 DWORD tbr;
1901 /* FIXME: floating point registers missing */
1903 } CONTEXT;
1905 #endif /* __sparc__ */
1907 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1908 #error You need to define a CONTEXT for your CPU
1909 #endif
1911 typedef CONTEXT *PCONTEXT;
1913 NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
1916 * Product types
1918 #define PRODUCT_UNLICENSED 0xABCDABCD
1919 #define PRODUCT_BUSINESS 0x00000006
1920 #define PRODUCT_BUSINESS_N 0x00000010
1921 #define PRODUCT_CLUSTER_SERVER 0x00000012
1922 #define PRODUCT_DATACENTER_SERVER 0x00000008
1923 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1924 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1925 #define PRODUCT_SERVER_V 0x00000025
1926 #define PRODUCT_ENTERPRISE 0x00000004
1927 #define PRODUCT_ENTERPRISE_N 0x0000001B
1928 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1929 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1930 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1931 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1932 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1933 #define PRODUCT_HOME_BASIC 0x00000002
1934 #define PRODUCT_HOME_BASIC_N 0x00000005
1935 #define PRODUCT_HOME_PREMIUM 0x00000003
1936 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1937 #define PRODUCT_HYPERV 0x0000002A
1938 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1939 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1940 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1941 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1942 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1943 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1944 #define PRODUCT_STANDARD_SERVER 0x00000007
1945 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1946 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1947 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1948 #define PRODUCT_STARTER 0x0000000B
1949 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1950 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1951 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1952 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1953 #define PRODUCT_UNDEFINED 0x00000000
1954 #define PRODUCT_ULTIMATE 0x00000001
1955 #define PRODUCT_ULTIMATE_N 0x0000001C
1956 #define PRODUCT_WEB_SERVER 0x00000011
1957 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1961 * Language IDs
1964 #define MAKELCID(l, s) (MAKELONG(l, s))
1966 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1967 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1968 #define SUBLANGID(l) ((WORD)(l) >> 10)
1970 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1971 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1973 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1974 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1975 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1976 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1977 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1978 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1979 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
1980 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
1981 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
1984 #define UNREFERENCED_PARAMETER(u) (void)(u)
1985 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1986 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1988 #define LANG_NEUTRAL 0x00
1989 #define LANG_INVARIANT 0x7f
1991 #define LANG_AFRIKAANS 0x36
1992 #define LANG_ALBANIAN 0x1c
1993 #define LANG_ALSATIAN 0x84
1994 #define LANG_AMHARIC 0x5e
1995 #define LANG_ARABIC 0x01
1996 #define LANG_ARMENIAN 0x2b
1997 #define LANG_ASSAMESE 0x4d
1998 #define LANG_AZERI 0x2c
1999 #define LANG_BASHKIR 0x6d
2000 #define LANG_BASQUE 0x2d
2001 #define LANG_BELARUSIAN 0x23
2002 #define LANG_BENGALI 0x45
2003 #define LANG_BOSNIAN 0x1a
2004 #define LANG_BOSNIAN_NEUTRAL 0x781a
2005 #define LANG_BRETON 0x7e
2006 #define LANG_BULGARIAN 0x02
2007 #define LANG_CATALAN 0x03
2008 #define LANG_CHINESE 0x04
2009 #define LANG_CHINESE_SIMPLIFIED 0x0004
2010 #define LANG_CHINESE_TRADITIONAL 0x7c04
2011 #define LANG_CORSICAN 0x83
2012 #define LANG_CROATIAN 0x1a
2013 #define LANG_CZECH 0x05
2014 #define LANG_DANISH 0x06
2015 #define LANG_DARI 0x8c
2016 #define LANG_DIVEHI 0x65
2017 #define LANG_DUTCH 0x13
2018 #define LANG_ENGLISH 0x09
2019 #define LANG_ESTONIAN 0x25
2020 #define LANG_FAEROESE 0x38
2021 #define LANG_FARSI LANG_PERSIAN
2022 #define LANG_FILIPINO 0x64
2023 #define LANG_FINNISH 0x0b
2024 #define LANG_FRENCH 0x0c
2025 #define LANG_FRISIAN 0x62
2026 #define LANG_GALICIAN 0x56
2027 #define LANG_GEORGIAN 0x37
2028 #define LANG_GERMAN 0x07
2029 #define LANG_GREEK 0x08
2030 #define LANG_GREENLANDIC 0x6f
2031 #define LANG_GUJARATI 0x47
2032 #define LANG_HAUSA 0x68
2033 #define LANG_HEBREW 0x0d
2034 #define LANG_HINDI 0x39
2035 #define LANG_HUNGARIAN 0x0e
2036 #define LANG_ICELANDIC 0x0f
2037 #define LANG_IGBO 0x70
2038 #define LANG_INDONESIAN 0x21
2039 #define LANG_INUKTITUT 0x5d
2040 #define LANG_IRISH 0x3c
2041 #define LANG_ITALIAN 0x10
2042 #define LANG_JAPANESE 0x11
2043 #define LANG_KANNADA 0x4b
2044 #define LANG_KASHMIRI 0x60
2045 #define LANG_KAZAK 0x3f
2046 #define LANG_KHMER 0x53
2047 #define LANG_KICHE 0x86
2048 #define LANG_KINYARWANDA 0x87
2049 #define LANG_KONKANI 0x57
2050 #define LANG_KOREAN 0x12
2051 #define LANG_KYRGYZ 0x40
2052 #define LANG_LAO 0x54
2053 #define LANG_LATVIAN 0x26
2054 #define LANG_LITHUANIAN 0x27
2055 #define LANG_LOWER_SORBIAN 0x2e
2056 #define LANG_LUXEMBOURGISH 0x6e
2057 #define LANG_MACEDONIAN 0x2f
2058 #define LANG_MALAY 0x3e
2059 #define LANG_MALAYALAM 0x4c
2060 #define LANG_MALTESE 0x3a
2061 #define LANG_MANIPURI 0x58
2062 #define LANG_MAORI 0x81
2063 #define LANG_MAPUDUNGUN 0x7a
2064 #define LANG_MARATHI 0x4e
2065 #define LANG_MOHAWK 0x7c
2066 #define LANG_MONGOLIAN 0x50
2067 #define LANG_NEPALI 0x61
2068 #define LANG_NORWEGIAN 0x14
2069 #define LANG_OCCITAN 0x82
2070 #define LANG_ORIYA 0x48
2071 #define LANG_PASHTO 0x63
2072 #define LANG_PERSIAN 0x29
2073 #define LANG_POLISH 0x15
2074 #define LANG_PORTUGUESE 0x16
2075 #define LANG_PUNJABI 0x46
2076 #define LANG_QUECHUA 0x6b
2077 #define LANG_ROMANIAN 0x18
2078 #define LANG_ROMANSH 0x17
2079 #define LANG_RUSSIAN 0x19
2080 #define LANG_SAMI 0x3b
2081 #define LANG_SANSKRIT 0x4f
2082 #define LANG_SERBIAN 0x1a
2083 #define LANG_SERBIAN_NEUTRAL 0x7c1a
2084 #define LANG_SINDHI 0x59
2085 #define LANG_SINHALESE 0x5b
2086 #define LANG_SLOVAK 0x1b
2087 #define LANG_SLOVENIAN 0x24
2088 #define LANG_SOTHO 0x6c
2089 #define LANG_SPANISH 0x0a
2090 #define LANG_SWAHILI 0x41
2091 #define LANG_SWEDISH 0x1d
2092 #define LANG_SYRIAC 0x5a
2093 #define LANG_TAJIK 0x28
2094 #define LANG_TAMAZIGHT 0x5f
2095 #define LANG_TAMIL 0x49
2096 #define LANG_TATAR 0x44
2097 #define LANG_TELUGU 0x4a
2098 #define LANG_THAI 0x1e
2099 #define LANG_TIBETAN 0x51
2100 #define LANG_TIGRIGNA 0x73
2101 #define LANG_TSWANA 0x32
2102 #define LANG_TURKISH 0x1f
2103 #define LANG_TURKMEN 0x42
2104 #define LANG_UIGHUR 0x80
2105 #define LANG_UKRAINIAN 0x22
2106 #define LANG_UPPER_SORBIAN 0x2e
2107 #define LANG_URDU 0x20
2108 #define LANG_UZBEK 0x43
2109 #define LANG_VIETNAMESE 0x2a
2110 #define LANG_WELSH 0x52
2111 #define LANG_WOLOF 0x88
2112 #define LANG_XHOSA 0x34
2113 #define LANG_YAKUT 0x85
2114 #define LANG_YI 0x78
2115 #define LANG_YORUBA 0x6a
2116 #define LANG_ZULU 0x35
2118 /* These are documented by the MSDN but are missing from the Windows header */
2119 #define LANG_MALAGASY 0x8d
2121 /* FIXME: these are not defined anywhere */
2122 #define LANG_SUTU 0x30
2123 #define LANG_TSONGA 0x31
2124 #define LANG_VENDA 0x33
2126 /* non standard; keep the number high enough (but < 0xff) */
2127 #define LANG_ESPERANTO 0x8f
2128 #define LANG_WALON 0x90
2129 #define LANG_CORNISH 0x91
2130 #define LANG_GAELIC 0x94
2132 /* Sublanguage definitions */
2133 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
2134 #define SUBLANG_DEFAULT 0x01 /* user default */
2135 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
2136 #define SUBLANG_CUSTOM_DEFAULT 0x03
2137 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
2138 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
2140 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
2141 #define SUBLANG_ALBANIAN_ALBANIA 0x01
2142 #define SUBLANG_ALSATIAN_FRANCE 0x01
2143 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
2144 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
2145 #define SUBLANG_ARABIC_IRAQ 0x02
2146 #define SUBLANG_ARABIC_EGYPT 0x03
2147 #define SUBLANG_ARABIC_LIBYA 0x04
2148 #define SUBLANG_ARABIC_ALGERIA 0x05
2149 #define SUBLANG_ARABIC_MOROCCO 0x06
2150 #define SUBLANG_ARABIC_TUNISIA 0x07
2151 #define SUBLANG_ARABIC_OMAN 0x08
2152 #define SUBLANG_ARABIC_YEMEN 0x09
2153 #define SUBLANG_ARABIC_SYRIA 0x0a
2154 #define SUBLANG_ARABIC_JORDAN 0x0b
2155 #define SUBLANG_ARABIC_LEBANON 0x0c
2156 #define SUBLANG_ARABIC_KUWAIT 0x0d
2157 #define SUBLANG_ARABIC_UAE 0x0e
2158 #define SUBLANG_ARABIC_BAHRAIN 0x0f
2159 #define SUBLANG_ARABIC_QATAR 0x10
2160 #define SUBLANG_ARMENIAN_ARMENIA 0x01
2161 #define SUBLANG_ASSAMESE_INDIA 0x01
2162 #define SUBLANG_AZERI_LATIN 0x01
2163 #define SUBLANG_AZERI_CYRILLIC 0x02
2164 #define SUBLANG_BASHKIR_RUSSIA 0x01
2165 #define SUBLANG_BASQUE_BASQUE 0x01
2166 #define SUBLANG_BELARUSIAN_BELARUS 0x01
2167 #define SUBLANG_BENGALI_INDIA 0x01
2168 #define SUBLANG_BENGALI_BANGLADESH 0x02
2169 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
2170 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
2171 #define SUBLANG_BRETON_FRANCE 0x01
2172 #define SUBLANG_BULGARIAN_BULGARIA 0x01
2173 #define SUBLANG_CATALAN_CATALAN 0x01
2174 #define SUBLANG_CHINESE_TRADITIONAL 0x01
2175 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
2176 #define SUBLANG_CHINESE_HONGKONG 0x03
2177 #define SUBLANG_CHINESE_SINGAPORE 0x04
2178 #define SUBLANG_CHINESE_MACAU 0x05
2179 #define SUBLANG_CORSICAN_FRANCE 0x01
2180 #define SUBLANG_CROATIAN_CROATIA 0x01
2181 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
2182 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
2183 #define SUBLANG_DANISH_DENMARK 0x01
2184 #define SUBLANG_DARI_AFGHANISTAN 0x01
2185 #define SUBLANG_DIVEHI_MALDIVES 0x01
2186 #define SUBLANG_DUTCH 0x01
2187 #define SUBLANG_DUTCH_BELGIAN 0x02
2188 #define SUBLANG_ENGLISH_US 0x01
2189 #define SUBLANG_ENGLISH_UK 0x02
2190 #define SUBLANG_ENGLISH_AUS 0x03
2191 #define SUBLANG_ENGLISH_CAN 0x04
2192 #define SUBLANG_ENGLISH_NZ 0x05
2193 #define SUBLANG_ENGLISH_EIRE 0x06
2194 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
2195 #define SUBLANG_ENGLISH_JAMAICA 0x08
2196 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
2197 #define SUBLANG_ENGLISH_BELIZE 0x0a
2198 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
2199 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
2200 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
2201 #define SUBLANG_ENGLISH_INDIA 0x10
2202 #define SUBLANG_ENGLISH_MALAYSIA 0x11
2203 #define SUBLANG_ENGLISH_SINGAPORE 0x12
2204 #define SUBLANG_ESTONIAN_ESTONIA 0x01
2205 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
2206 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
2207 #define SUBLANG_FINNISH_FINLAND 0x01
2208 #define SUBLANG_FRENCH 0x01
2209 #define SUBLANG_FRENCH_BELGIAN 0x02
2210 #define SUBLANG_FRENCH_CANADIAN 0x03
2211 #define SUBLANG_FRENCH_SWISS 0x04
2212 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
2213 #define SUBLANG_FRENCH_MONACO 0x06
2214 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
2215 #define SUBLANG_GALICIAN_GALICIAN 0x01
2216 #define SUBLANG_GEORGIAN_GEORGIA 0x01
2217 #define SUBLANG_GERMAN 0x01
2218 #define SUBLANG_GERMAN_SWISS 0x02
2219 #define SUBLANG_GERMAN_AUSTRIAN 0x03
2220 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
2221 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
2222 #define SUBLANG_GREEK_GREECE 0x01
2223 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
2224 #define SUBLANG_GUJARATI_INDIA 0x01
2225 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
2226 #define SUBLANG_HEBREW_ISRAEL 0x01
2227 #define SUBLANG_HINDI_INDIA 0x01
2228 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
2229 #define SUBLANG_ICELANDIC_ICELAND 0x01
2230 #define SUBLANG_IGBO_NIGERIA 0x01
2231 #define SUBLANG_INDONESIAN_INDONESIA 0x01
2232 #define SUBLANG_INUKTITUT_CANADA 0x01
2233 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
2234 #define SUBLANG_IRISH_IRELAND 0x02
2235 #define SUBLANG_ITALIAN 0x01
2236 #define SUBLANG_ITALIAN_SWISS 0x02
2237 #define SUBLANG_JAPANESE_JAPAN 0x01
2238 #define SUBLANG_KANNADA_INDIA 0x01
2239 #define SUBLANG_KASHMIRI_SASIA 0x02
2240 #define SUBLANG_KASHMIRI_INDIA 0x02
2241 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
2242 #define SUBLANG_KHMER_CAMBODIA 0x01
2243 #define SUBLANG_KICHE_GUATEMALA 0x01
2244 #define SUBLANG_KINYARWANDA_RWANDA 0X01
2245 #define SUBLANG_KONKANI_INDIA 0x01
2246 #define SUBLANG_KOREAN 0x01
2247 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
2248 #define SUBLANG_LAO_LAO 0x01
2249 #define SUBLANG_LATVIAN_LATVIA 0x01
2250 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
2251 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
2252 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
2253 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
2254 #define SUBLANG_MALAY_MALAYSIA 0x01
2255 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
2256 #define SUBLANG_MALAYALAM_INDIA 0x01
2257 #define SUBLANG_MALTESE_MALTA 0x01
2258 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
2259 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
2260 #define SUBLANG_MARATHI_INDIA 0x01
2261 #define SUBLANG_MOHAWK_MOHAWK 0x01
2262 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
2263 #define SUBLANG_MONGOLIAN_PRC 0x02
2264 #define SUBLANG_NEPALI_INDIA 0x02
2265 #define SUBLANG_NEPALI_NEPAL 0x01
2266 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
2267 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
2268 #define SUBLANG_OCCITAN_FRANCE 0x01
2269 #define SUBLANG_ORIYA_INDIA 0x01
2270 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
2271 #define SUBLANG_PERSIAN_IRAN 0x01
2272 #define SUBLANG_POLISH_POLAND 0x01
2273 #define SUBLANG_PORTUGUESE 0x02
2274 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
2275 #define SUBLANG_PUNJABI_INDIA 0x01
2276 #define SUBLANG_QUECHUA_BOLIVIA 0x01
2277 #define SUBLANG_QUECHUA_ECUADOR 0x02
2278 #define SUBLANG_QUECHUA_PERU 0x03
2279 #define SUBLANG_ROMANIAN_ROMANIA 0x01
2280 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
2281 #define SUBLANG_RUSSIAN_RUSSIA 0x01
2282 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
2283 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
2284 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
2285 #define SUBLANG_SAMI_LULE_NORWAY 0x04
2286 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
2287 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
2288 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
2289 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
2290 #define SUBLANG_SAMI_INARI_FINLAND 0x09
2291 #define SUBLANG_SANSKRIT_INDIA 0x01
2292 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
2293 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
2294 #define SUBLANG_SERBIAN_CROATIA 0x01
2295 #define SUBLANG_SERBIAN_LATIN 0x02
2296 #define SUBLANG_SERBIAN_CYRILLIC 0x03
2297 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
2298 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
2299 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
2300 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
2301 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
2302 #define SUBLANG_SPANISH 0x01
2303 #define SUBLANG_SPANISH_MEXICAN 0x02
2304 #define SUBLANG_SPANISH_MODERN 0x03
2305 #define SUBLANG_SPANISH_GUATEMALA 0x04
2306 #define SUBLANG_SPANISH_COSTA_RICA 0x05
2307 #define SUBLANG_SPANISH_PANAMA 0x06
2308 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
2309 #define SUBLANG_SPANISH_VENEZUELA 0x08
2310 #define SUBLANG_SPANISH_COLOMBIA 0x09
2311 #define SUBLANG_SPANISH_PERU 0x0a
2312 #define SUBLANG_SPANISH_ARGENTINA 0x0b
2313 #define SUBLANG_SPANISH_ECUADOR 0x0c
2314 #define SUBLANG_SPANISH_CHILE 0x0d
2315 #define SUBLANG_SPANISH_URUGUAY 0x0e
2316 #define SUBLANG_SPANISH_PARAGUAY 0x0f
2317 #define SUBLANG_SPANISH_BOLIVIA 0x10
2318 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
2319 #define SUBLANG_SPANISH_HONDURAS 0x12
2320 #define SUBLANG_SPANISH_NICARAGUA 0x13
2321 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
2322 #define SUBLANG_SPANISH_US 0x15
2323 #define SUBLANG_SWAHILI_KENYA 0x01
2324 #define SUBLANG_SWEDISH 0x01
2325 #define SUBLANG_SWEDISH_FINLAND 0x02
2326 #define SUBLANG_SYRIAC_SYRIA 0x01
2327 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
2328 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
2329 #define SUBLANG_TAMIL_INDIA 0x01
2330 #define SUBLANG_TATAR_RUSSIA 0x01
2331 #define SUBLANG_TELUGU_INDIA 0x01
2332 #define SUBLANG_THAI_THAILAND 0x01
2333 #define SUBLANG_TIBETAN_PRC 0x01
2334 #define SUBLANG_TIBETAN_BHUTAN 0x02
2335 #define SUBLANG_TIGRIGNA_ERITREA 0x02
2336 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
2337 #define SUBLANG_TURKISH_TURKEY 0x01
2338 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
2339 #define SUBLANG_UIGHUR_PRC 0x01
2340 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
2341 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
2342 #define SUBLANG_URDU_PAKISTAN 0x01
2343 #define SUBLANG_URDU_INDIA 0x02
2344 #define SUBLANG_UZBEK_LATIN 0x01
2345 #define SUBLANG_UZBEK_CYRILLIC 0x02
2346 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
2347 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
2348 #define SUBLANG_WOLOF_SENEGAL 0x01
2349 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
2350 #define SUBLANG_YAKUT_RUSSIA 0x01
2351 #define SUBLANG_YI_PRC 0x01
2352 #define SUBLANG_YORUBA_NIGERIA 0x01
2353 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
2355 /* These are documented by the MSDN but are missing from the Windows header */
2356 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
2357 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
2358 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
2359 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
2360 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
2361 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
2362 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
2363 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
2365 /* FIXME: these are not defined anywhere */
2366 #define SUBLANG_DUTCH_SURINAM 0x03
2367 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
2368 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
2369 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
2370 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
2371 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
2372 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
2373 #define SUBLANG_GAELIC 0x01
2374 #define SUBLANG_GAELIC_SCOTTISH 0x02
2375 #define SUBLANG_GAELIC_MANX 0x03
2379 * Sort definitions
2382 #define SORT_DEFAULT 0x0
2383 #define SORT_JAPANESE_XJIS 0x0
2384 #define SORT_JAPANESE_UNICODE 0x1
2385 #define SORT_CHINESE_BIG5 0x0
2386 #define SORT_CHINESE_UNICODE 0x1
2387 #define SORT_KOREAN_KSC 0x0
2388 #define SORT_KOREAN_UNICODE 0x1
2393 * Definitions for IsTextUnicode()
2396 #define IS_TEXT_UNICODE_ASCII16 0x0001
2397 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2398 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2399 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2400 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2401 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2402 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2403 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2404 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2405 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2406 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2407 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2408 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2409 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2410 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2411 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2413 #define MAXIMUM_WAIT_OBJECTS 64
2414 #define MAXIMUM_SUSPEND_COUNT 127
2416 #define WT_EXECUTEDEFAULT 0x00
2417 #define WT_EXECUTEINIOTHREAD 0x01
2418 #define WT_EXECUTEINUITHREAD 0x02
2419 #define WT_EXECUTEINWAITTHREAD 0x04
2420 #define WT_EXECUTEONLYONCE 0x08
2421 #define WT_EXECUTELONGFUNCTION 0x10
2422 #define WT_EXECUTEINTIMERTHREAD 0x20
2423 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2424 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2425 #define WT_EXECUTEINLONGTHREAD 0x10
2426 #define WT_EXECUTEDELETEWAIT 0x08
2427 #define WT_TRANSFER_IMPERSONATION 0x0100
2430 #define EXCEPTION_CONTINUABLE 0
2431 #define EXCEPTION_NONCONTINUABLE 0x01
2434 * The exception record used by Win32 to give additional information
2435 * about exception to exception handlers.
2438 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2440 typedef struct _EXCEPTION_RECORD
2442 DWORD ExceptionCode;
2443 DWORD ExceptionFlags;
2444 struct _EXCEPTION_RECORD *ExceptionRecord;
2446 PVOID ExceptionAddress;
2447 DWORD NumberParameters;
2448 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2449 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2452 * The exception pointers structure passed to exception filters
2453 * in except() and the UnhandledExceptionFilter().
2456 typedef struct _EXCEPTION_POINTERS
2458 PEXCEPTION_RECORD ExceptionRecord;
2459 PCONTEXT ContextRecord;
2460 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
2464 * The exception frame, used for registering exception handlers
2465 * Win32 cares only about this, but compilers generally emit
2466 * larger exception frames for their own use.
2469 struct _EXCEPTION_REGISTRATION_RECORD;
2471 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
2472 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
2474 typedef struct _EXCEPTION_REGISTRATION_RECORD
2476 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
2477 PEXCEPTION_HANDLER Handler;
2478 } EXCEPTION_REGISTRATION_RECORD;
2481 * function pointer to an exception filter
2484 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
2486 typedef struct _NT_TIB
2488 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2489 PVOID StackBase;
2490 PVOID StackLimit;
2491 PVOID SubSystemTib;
2492 union {
2493 PVOID FiberData;
2494 DWORD Version;
2495 } DUMMYUNIONNAME;
2496 PVOID ArbitraryUserPointer;
2497 struct _NT_TIB *Self;
2498 } NT_TIB, *PNT_TIB;
2500 struct _TEB;
2502 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2503 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2505 struct _TEB *teb;
2506 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2507 return teb;
2509 #elif defined(__i386__) && defined(_MSC_VER)
2510 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2512 struct _TEB *teb;
2513 __asm mov eax, fs:[0x18];
2514 __asm mov teb, eax;
2515 return teb;
2517 #elif defined(__x86_64__) && defined(__GNUC__)
2518 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2520 struct _TEB *teb;
2521 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
2522 return teb;
2524 #elif defined(__x86_64__) && defined (_MSC_VER)
2525 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2527 struct _TEB *teb;
2528 __asm mov rax, gs:[0x30];
2529 __asm mov teb, rax;
2530 return teb;
2532 #else
2533 extern struct _TEB * WINAPI NtCurrentTeb(void);
2534 #endif
2536 #ifdef NONAMELESSUNION
2537 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2538 #else
2539 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2540 #endif
2541 #define GetFiberData() (*(void **)GetCurrentFiber())
2543 #define TLS_MINIMUM_AVAILABLE 64
2546 * File formats definitions
2549 #include <pshpack2.h>
2550 typedef struct _IMAGE_DOS_HEADER {
2551 WORD e_magic; /* 00: MZ Header signature */
2552 WORD e_cblp; /* 02: Bytes on last page of file */
2553 WORD e_cp; /* 04: Pages in file */
2554 WORD e_crlc; /* 06: Relocations */
2555 WORD e_cparhdr; /* 08: Size of header in paragraphs */
2556 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2557 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2558 WORD e_ss; /* 0e: Initial (relative) SS value */
2559 WORD e_sp; /* 10: Initial SP value */
2560 WORD e_csum; /* 12: Checksum */
2561 WORD e_ip; /* 14: Initial IP value */
2562 WORD e_cs; /* 16: Initial (relative) CS value */
2563 WORD e_lfarlc; /* 18: File address of relocation table */
2564 WORD e_ovno; /* 1a: Overlay number */
2565 WORD e_res[4]; /* 1c: Reserved words */
2566 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2567 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2568 WORD e_res2[10]; /* 28: Reserved words */
2569 DWORD e_lfanew; /* 3c: Offset to extended header */
2570 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2571 #include <poppack.h>
2573 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2574 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2575 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2576 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2577 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2578 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2581 * This is the Windows executable (NE) header.
2582 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2584 #include <pshpack2.h>
2585 typedef struct
2587 WORD ne_magic; /* 00 NE signature 'NE' */
2588 BYTE ne_ver; /* 02 Linker version number */
2589 BYTE ne_rev; /* 03 Linker revision number */
2590 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2591 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2592 LONG ne_crc; /* 08 Checksum */
2593 WORD ne_flags; /* 0c Flags about segments in this file */
2594 WORD ne_autodata; /* 0e Automatic data segment number */
2595 WORD ne_heap; /* 10 Initial size of local heap */
2596 WORD ne_stack; /* 12 Initial size of stack */
2597 DWORD ne_csip; /* 14 Initial CS:IP */
2598 DWORD ne_sssp; /* 18 Initial SS:SP */
2599 WORD ne_cseg; /* 1c # of entries in segment table */
2600 WORD ne_cmod; /* 1e # of entries in module reference tab. */
2601 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2602 WORD ne_segtab; /* 22 Offset to segment table */
2603 WORD ne_rsrctab; /* 24 Offset to resource table */
2604 WORD ne_restab; /* 26 Offset to resident-name table */
2605 WORD ne_modtab; /* 28 Offset to module reference table */
2606 WORD ne_imptab; /* 2a Offset to imported name table */
2607 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2608 WORD ne_cmovent; /* 30 # of movable entry points */
2609 WORD ne_align; /* 32 Logical sector alignment shift count */
2610 WORD ne_cres; /* 34 # of resource segments */
2611 BYTE ne_exetyp; /* 36 Flags indicating target OS */
2612 BYTE ne_flagsothers; /* 37 Additional information flags */
2613 WORD ne_pretthunks; /* 38 Offset to return thunks */
2614 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2615 WORD ne_swaparea; /* 3c Reserved by Microsoft */
2616 WORD ne_expver; /* 3e Expected Windows version number */
2617 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2618 #include <poppack.h>
2620 #include <pshpack2.h>
2621 typedef struct _IMAGE_VXD_HEADER {
2622 WORD e32_magic;
2623 BYTE e32_border;
2624 BYTE e32_worder;
2625 DWORD e32_level;
2626 WORD e32_cpu;
2627 WORD e32_os;
2628 DWORD e32_ver;
2629 DWORD e32_mflags;
2630 DWORD e32_mpages;
2631 DWORD e32_startobj;
2632 DWORD e32_eip;
2633 DWORD e32_stackobj;
2634 DWORD e32_esp;
2635 DWORD e32_pagesize;
2636 DWORD e32_lastpagesize;
2637 DWORD e32_fixupsize;
2638 DWORD e32_fixupsum;
2639 DWORD e32_ldrsize;
2640 DWORD e32_ldrsum;
2641 DWORD e32_objtab;
2642 DWORD e32_objcnt;
2643 DWORD e32_objmap;
2644 DWORD e32_itermap;
2645 DWORD e32_rsrctab;
2646 DWORD e32_rsrccnt;
2647 DWORD e32_restab;
2648 DWORD e32_enttab;
2649 DWORD e32_dirtab;
2650 DWORD e32_dircnt;
2651 DWORD e32_fpagetab;
2652 DWORD e32_frectab;
2653 DWORD e32_impmod;
2654 DWORD e32_impmodcnt;
2655 DWORD e32_impproc;
2656 DWORD e32_pagesum;
2657 DWORD e32_datapage;
2658 DWORD e32_preload;
2659 DWORD e32_nrestab;
2660 DWORD e32_cbnrestab;
2661 DWORD e32_nressum;
2662 DWORD e32_autodata;
2663 DWORD e32_debuginfo;
2664 DWORD e32_debuglen;
2665 DWORD e32_instpreload;
2666 DWORD e32_instdemand;
2667 DWORD e32_heapsize;
2668 BYTE e32_res3[12];
2669 DWORD e32_winresoff;
2670 DWORD e32_winreslen;
2671 WORD e32_devid;
2672 WORD e32_ddkver;
2673 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2674 #include <poppack.h>
2676 /* These defines describe the meanings of the bits in the Characteristics
2677 field */
2679 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2680 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2681 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2682 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2683 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2684 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2685 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2686 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2687 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2688 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2689 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2690 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2691 #define IMAGE_FILE_SYSTEM 0x1000
2692 #define IMAGE_FILE_DLL 0x2000
2693 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2694 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2696 /* These are the settings of the Machine field. */
2697 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2698 #define IMAGE_FILE_MACHINE_I860 0x014d
2699 #define IMAGE_FILE_MACHINE_I386 0x014c
2700 #define IMAGE_FILE_MACHINE_R3000 0x0162
2701 #define IMAGE_FILE_MACHINE_R4000 0x0166
2702 #define IMAGE_FILE_MACHINE_R10000 0x0168
2703 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2704 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2705 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2706 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2707 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2708 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2709 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2710 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2711 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2712 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2713 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2714 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2715 #define IMAGE_FILE_MACHINE_IA64 0x0200
2716 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2717 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2718 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2719 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2720 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2721 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2722 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2723 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2724 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2725 #define IMAGE_FILE_MACHINE_M32R 0x9041
2726 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2728 /* Wine extension */
2729 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2731 #define IMAGE_SIZEOF_FILE_HEADER 20
2732 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2733 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2734 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2735 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2736 #define IMAGE_SIZEOF_SHORT_NAME 8
2737 #define IMAGE_SIZEOF_SECTION_HEADER 40
2738 #define IMAGE_SIZEOF_SYMBOL 18
2739 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2740 #define IMAGE_SIZEOF_RELOCATION 10
2741 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2742 #define IMAGE_SIZEOF_LINENUMBER 6
2743 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2745 /* Possible Magic values */
2746 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2747 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2748 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2750 #ifdef _WIN64
2751 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2752 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2753 #else
2754 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2755 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2756 #endif
2758 /* These are indexes into the DataDirectory array */
2759 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2760 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2761 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2762 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2763 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2764 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2765 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2766 #define IMAGE_FILE_DESCRIPTION_STRING 7
2767 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2768 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2769 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2771 /* Directory Entries, indices into the DataDirectory array */
2773 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2774 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2775 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2776 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2777 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2778 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2779 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2780 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2781 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2782 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2783 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2784 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2785 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2786 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2787 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2789 /* Subsystem Values */
2791 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2792 #define IMAGE_SUBSYSTEM_NATIVE 1
2793 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2794 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2795 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2796 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2797 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2798 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2799 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2800 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2801 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2802 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2803 #define IMAGE_SUBSYSTEM_XBOX 14
2804 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2806 /* DLL Characteristics */
2807 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2808 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2809 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2810 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2811 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2812 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2813 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2814 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2816 typedef struct _IMAGE_FILE_HEADER {
2817 WORD Machine;
2818 WORD NumberOfSections;
2819 DWORD TimeDateStamp;
2820 DWORD PointerToSymbolTable;
2821 DWORD NumberOfSymbols;
2822 WORD SizeOfOptionalHeader;
2823 WORD Characteristics;
2824 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2826 typedef struct _IMAGE_DATA_DIRECTORY {
2827 DWORD VirtualAddress;
2828 DWORD Size;
2829 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2831 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2833 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2834 WORD Magic; /* 0x20b */
2835 BYTE MajorLinkerVersion;
2836 BYTE MinorLinkerVersion;
2837 DWORD SizeOfCode;
2838 DWORD SizeOfInitializedData;
2839 DWORD SizeOfUninitializedData;
2840 DWORD AddressOfEntryPoint;
2841 DWORD BaseOfCode;
2842 ULONGLONG ImageBase;
2843 DWORD SectionAlignment;
2844 DWORD FileAlignment;
2845 WORD MajorOperatingSystemVersion;
2846 WORD MinorOperatingSystemVersion;
2847 WORD MajorImageVersion;
2848 WORD MinorImageVersion;
2849 WORD MajorSubsystemVersion;
2850 WORD MinorSubsystemVersion;
2851 DWORD Win32VersionValue;
2852 DWORD SizeOfImage;
2853 DWORD SizeOfHeaders;
2854 DWORD CheckSum;
2855 WORD Subsystem;
2856 WORD DllCharacteristics;
2857 ULONGLONG SizeOfStackReserve;
2858 ULONGLONG SizeOfStackCommit;
2859 ULONGLONG SizeOfHeapReserve;
2860 ULONGLONG SizeOfHeapCommit;
2861 DWORD LoaderFlags;
2862 DWORD NumberOfRvaAndSizes;
2863 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2864 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2866 typedef struct _IMAGE_NT_HEADERS64 {
2867 DWORD Signature;
2868 IMAGE_FILE_HEADER FileHeader;
2869 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2870 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2872 typedef struct _IMAGE_OPTIONAL_HEADER {
2874 /* Standard fields */
2876 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
2877 BYTE MajorLinkerVersion;
2878 BYTE MinorLinkerVersion;
2879 DWORD SizeOfCode;
2880 DWORD SizeOfInitializedData;
2881 DWORD SizeOfUninitializedData;
2882 DWORD AddressOfEntryPoint; /* 0x10 */
2883 DWORD BaseOfCode;
2884 DWORD BaseOfData;
2886 /* NT additional fields */
2888 DWORD ImageBase;
2889 DWORD SectionAlignment; /* 0x20 */
2890 DWORD FileAlignment;
2891 WORD MajorOperatingSystemVersion;
2892 WORD MinorOperatingSystemVersion;
2893 WORD MajorImageVersion;
2894 WORD MinorImageVersion;
2895 WORD MajorSubsystemVersion; /* 0x30 */
2896 WORD MinorSubsystemVersion;
2897 DWORD Win32VersionValue;
2898 DWORD SizeOfImage;
2899 DWORD SizeOfHeaders;
2900 DWORD CheckSum; /* 0x40 */
2901 WORD Subsystem;
2902 WORD DllCharacteristics;
2903 DWORD SizeOfStackReserve;
2904 DWORD SizeOfStackCommit;
2905 DWORD SizeOfHeapReserve; /* 0x50 */
2906 DWORD SizeOfHeapCommit;
2907 DWORD LoaderFlags;
2908 DWORD NumberOfRvaAndSizes;
2909 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2910 /* 0xE0 */
2911 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2913 typedef struct _IMAGE_NT_HEADERS {
2914 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2915 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2916 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
2917 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2919 #ifdef _WIN64
2920 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2921 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2922 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2923 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2924 #else
2925 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2926 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2927 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2928 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2929 #endif
2931 #define IMAGE_SIZEOF_SHORT_NAME 8
2933 typedef struct _IMAGE_SECTION_HEADER {
2934 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2935 union {
2936 DWORD PhysicalAddress;
2937 DWORD VirtualSize;
2938 } Misc;
2939 DWORD VirtualAddress;
2940 DWORD SizeOfRawData;
2941 DWORD PointerToRawData;
2942 DWORD PointerToRelocations;
2943 DWORD PointerToLinenumbers;
2944 WORD NumberOfRelocations;
2945 WORD NumberOfLinenumbers;
2946 DWORD Characteristics;
2947 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2949 #define IMAGE_SIZEOF_SECTION_HEADER 40
2951 #define IMAGE_FIRST_SECTION(ntheader) \
2952 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2953 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2955 /* These defines are for the Characteristics bitfield. */
2956 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2957 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2958 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2959 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2960 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2961 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2963 #define IMAGE_SCN_CNT_CODE 0x00000020
2964 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2965 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2967 #define IMAGE_SCN_LNK_OTHER 0x00000100
2968 #define IMAGE_SCN_LNK_INFO 0x00000200
2969 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2970 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2971 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2973 /* 0x00002000 - Reserved */
2974 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2975 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2977 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2978 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2979 #define IMAGE_SCN_MEM_16BIT 0x00020000
2980 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2981 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2983 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2984 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2985 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2986 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2987 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2988 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2989 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2990 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2991 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2992 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2993 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2994 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2995 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2996 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2997 /* 0x00F00000 - Unused */
2998 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
3000 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3003 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3004 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3005 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3006 #define IMAGE_SCN_MEM_SHARED 0x10000000
3007 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3008 #define IMAGE_SCN_MEM_READ 0x40000000
3009 #define IMAGE_SCN_MEM_WRITE 0x80000000
3011 #include <pshpack2.h>
3013 typedef struct _IMAGE_SYMBOL {
3014 union {
3015 BYTE ShortName[8];
3016 struct {
3017 DWORD Short;
3018 DWORD Long;
3019 } Name;
3020 DWORD LongName[2];
3021 } N;
3022 DWORD Value;
3023 SHORT SectionNumber;
3024 WORD Type;
3025 BYTE StorageClass;
3026 BYTE NumberOfAuxSymbols;
3027 } IMAGE_SYMBOL;
3028 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
3030 #define IMAGE_SIZEOF_SYMBOL 18
3032 typedef struct _IMAGE_LINENUMBER {
3033 union {
3034 DWORD SymbolTableIndex;
3035 DWORD VirtualAddress;
3036 } Type;
3037 WORD Linenumber;
3038 } IMAGE_LINENUMBER;
3039 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
3041 #define IMAGE_SIZEOF_LINENUMBER 6
3043 typedef union _IMAGE_AUX_SYMBOL {
3044 struct {
3045 DWORD TagIndex;
3046 union {
3047 struct {
3048 WORD Linenumber;
3049 WORD Size;
3050 } LnSz;
3051 DWORD TotalSize;
3052 } Misc;
3053 union {
3054 struct {
3055 DWORD PointerToLinenumber;
3056 DWORD PointerToNextFunction;
3057 } Function;
3058 struct {
3059 WORD Dimension[4];
3060 } Array;
3061 } FcnAry;
3062 WORD TvIndex;
3063 } Sym;
3064 struct {
3065 BYTE Name[IMAGE_SIZEOF_SYMBOL];
3066 } File;
3067 struct {
3068 DWORD Length;
3069 WORD NumberOfRelocations;
3070 WORD NumberOfLinenumbers;
3071 DWORD CheckSum;
3072 SHORT Number;
3073 BYTE Selection;
3074 } Section;
3075 } IMAGE_AUX_SYMBOL;
3076 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
3078 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3080 #include <poppack.h>
3082 #define IMAGE_SYM_UNDEFINED (SHORT)0
3083 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3084 #define IMAGE_SYM_DEBUG (SHORT)-2
3086 #define IMAGE_SYM_TYPE_NULL 0x0000
3087 #define IMAGE_SYM_TYPE_VOID 0x0001
3088 #define IMAGE_SYM_TYPE_CHAR 0x0002
3089 #define IMAGE_SYM_TYPE_SHORT 0x0003
3090 #define IMAGE_SYM_TYPE_INT 0x0004
3091 #define IMAGE_SYM_TYPE_LONG 0x0005
3092 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3093 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3094 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3095 #define IMAGE_SYM_TYPE_UNION 0x0009
3096 #define IMAGE_SYM_TYPE_ENUM 0x000A
3097 #define IMAGE_SYM_TYPE_MOE 0x000B
3098 #define IMAGE_SYM_TYPE_BYTE 0x000C
3099 #define IMAGE_SYM_TYPE_WORD 0x000D
3100 #define IMAGE_SYM_TYPE_UINT 0x000E
3101 #define IMAGE_SYM_TYPE_DWORD 0x000F
3102 #define IMAGE_SYM_TYPE_PCODE 0x8000
3104 #define IMAGE_SYM_DTYPE_NULL 0
3105 #define IMAGE_SYM_DTYPE_POINTER 1
3106 #define IMAGE_SYM_DTYPE_FUNCTION 2
3107 #define IMAGE_SYM_DTYPE_ARRAY 3
3109 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3110 #define IMAGE_SYM_CLASS_NULL 0x0000
3111 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3112 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3113 #define IMAGE_SYM_CLASS_STATIC 0x0003
3114 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3115 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3116 #define IMAGE_SYM_CLASS_LABEL 0x0006
3117 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3118 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3119 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3120 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3121 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3122 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3123 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3124 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3125 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3126 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3127 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3128 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3130 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3131 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3132 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3133 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3134 #define IMAGE_SYM_CLASS_FILE 0x0067
3135 #define IMAGE_SYM_CLASS_SECTION 0x0068
3136 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3138 #define N_BTMASK 0x000F
3139 #define N_TMASK 0x0030
3140 #define N_TMASK1 0x00C0
3141 #define N_TMASK2 0x00F0
3142 #define N_BTSHFT 4
3143 #define N_TSHIFT 2
3145 #define BTYPE(x) ((x) & N_BTMASK)
3147 #ifndef ISPTR
3148 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3149 #endif
3151 #ifndef ISFCN
3152 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3153 #endif
3155 #ifndef ISARY
3156 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3157 #endif
3159 #ifndef ISTAG
3160 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3161 #endif
3163 #ifndef INCREF
3164 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3165 #endif
3166 #ifndef DECREF
3167 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3168 #endif
3170 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3171 #define IMAGE_COMDAT_SELECT_ANY 2
3172 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3173 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3174 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3175 #define IMAGE_COMDAT_SELECT_LARGEST 6
3176 #define IMAGE_COMDAT_SELECT_NEWEST 7
3178 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3179 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3180 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3182 /* Export module directory */
3184 typedef struct _IMAGE_EXPORT_DIRECTORY {
3185 DWORD Characteristics;
3186 DWORD TimeDateStamp;
3187 WORD MajorVersion;
3188 WORD MinorVersion;
3189 DWORD Name;
3190 DWORD Base;
3191 DWORD NumberOfFunctions;
3192 DWORD NumberOfNames;
3193 DWORD AddressOfFunctions;
3194 DWORD AddressOfNames;
3195 DWORD AddressOfNameOrdinals;
3196 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
3198 /* Import name entry */
3199 typedef struct _IMAGE_IMPORT_BY_NAME {
3200 WORD Hint;
3201 BYTE Name[1];
3202 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
3204 #include <pshpack8.h>
3205 /* Import thunk */
3206 typedef struct _IMAGE_THUNK_DATA64 {
3207 union {
3208 ULONGLONG ForwarderString;
3209 ULONGLONG Function;
3210 ULONGLONG Ordinal;
3211 ULONGLONG AddressOfData;
3212 } u1;
3213 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
3214 #include <poppack.h>
3216 typedef struct _IMAGE_THUNK_DATA32 {
3217 union {
3218 DWORD ForwarderString;
3219 DWORD Function;
3220 DWORD Ordinal;
3221 DWORD AddressOfData;
3222 } u1;
3223 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
3225 /* Import module directory */
3227 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3228 union {
3229 DWORD Characteristics; /* 0 for terminating null import descriptor */
3230 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
3231 } DUMMYUNIONNAME;
3232 DWORD TimeDateStamp; /* 0 if not bound,
3233 * -1 if bound, and real date\time stamp
3234 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3235 * (new BIND)
3236 * otherwise date/time stamp of DLL bound to
3237 * (Old BIND)
3239 DWORD ForwarderChain; /* -1 if no forwarders */
3240 DWORD Name;
3241 /* RVA to IAT (if bound this IAT has actual addresses) */
3242 DWORD FirstThunk;
3243 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
3245 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
3246 #define IMAGE_ORDINAL_FLAG32 0x80000000
3247 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
3248 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
3249 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
3250 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
3252 #ifdef _WIN64
3253 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
3254 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
3255 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
3256 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
3257 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
3258 #else
3259 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
3260 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
3261 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
3262 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
3263 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
3264 #endif
3266 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3268 DWORD TimeDateStamp;
3269 WORD OffsetModuleName;
3270 WORD NumberOfModuleForwarderRefs;
3271 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3272 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3274 typedef struct _IMAGE_BOUND_FORWARDER_REF
3276 DWORD TimeDateStamp;
3277 WORD OffsetModuleName;
3278 WORD Reserved;
3279 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3281 typedef struct _IMAGE_BASE_RELOCATION
3283 DWORD VirtualAddress;
3284 DWORD SizeOfBlock;
3285 /* WORD TypeOffset[1]; */
3286 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
3288 #include <pshpack2.h>
3290 typedef struct _IMAGE_RELOCATION
3292 union {
3293 DWORD VirtualAddress;
3294 DWORD RelocCount;
3295 } DUMMYUNIONNAME;
3296 DWORD SymbolTableIndex;
3297 WORD Type;
3298 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
3300 #include <poppack.h>
3302 #define IMAGE_SIZEOF_RELOCATION 10
3304 /* generic relocation types */
3305 #define IMAGE_REL_BASED_ABSOLUTE 0
3306 #define IMAGE_REL_BASED_HIGH 1
3307 #define IMAGE_REL_BASED_LOW 2
3308 #define IMAGE_REL_BASED_HIGHLOW 3
3309 #define IMAGE_REL_BASED_HIGHADJ 4
3310 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3311 #define IMAGE_REL_BASED_SECTION 6
3312 #define IMAGE_REL_BASED_REL 7
3313 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3314 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3315 #define IMAGE_REL_BASED_DIR64 10
3316 #define IMAGE_REL_BASED_HIGH3ADJ 11
3318 /* I386 relocation types */
3319 #define IMAGE_REL_I386_ABSOLUTE 0
3320 #define IMAGE_REL_I386_DIR16 1
3321 #define IMAGE_REL_I386_REL16 2
3322 #define IMAGE_REL_I386_DIR32 6
3323 #define IMAGE_REL_I386_DIR32NB 7
3324 #define IMAGE_REL_I386_SEG12 9
3325 #define IMAGE_REL_I386_SECTION 10
3326 #define IMAGE_REL_I386_SECREL 11
3327 #define IMAGE_REL_I386_TOKEN 12
3328 #define IMAGE_REL_I386_SECREL7 13
3329 #define IMAGE_REL_I386_REL32 20
3331 /* MIPS relocation types */
3332 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3333 #define IMAGE_REL_MIPS_REFHALF 0x0001
3334 #define IMAGE_REL_MIPS_REFWORD 0x0002
3335 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3336 #define IMAGE_REL_MIPS_REFHI 0x0004
3337 #define IMAGE_REL_MIPS_REFLO 0x0005
3338 #define IMAGE_REL_MIPS_GPREL 0x0006
3339 #define IMAGE_REL_MIPS_LITERAL 0x0007
3340 #define IMAGE_REL_MIPS_SECTION 0x000A
3341 #define IMAGE_REL_MIPS_SECREL 0x000B
3342 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3343 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3344 #define IMAGE_REL_MIPS_TOKEN 0x000E
3345 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3346 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3347 #define IMAGE_REL_MIPS_PAIR 0x0025
3349 /* ALPHA relocation types */
3350 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3351 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3352 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3353 #define IMAGE_REL_ALPHA_GPREL 0x0003
3354 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3355 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3356 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3357 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3358 #define IMAGE_REL_ALPHA_HINT 0x0008
3359 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3360 #define IMAGE_REL_ALPHA_REFHI 0x000A
3361 #define IMAGE_REL_ALPHA_REFLO 0x000B
3362 #define IMAGE_REL_ALPHA_PAIR 0x000C
3363 #define IMAGE_REL_ALPHA_MATCH 0x000D
3364 #define IMAGE_REL_ALPHA_SECTION 0x000E
3365 #define IMAGE_REL_ALPHA_SECREL 0x000F
3366 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3367 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3368 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3369 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3370 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3371 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3372 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3373 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3375 /* PowerPC relocation types */
3376 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3377 #define IMAGE_REL_PPC_ADDR64 0x0001
3378 #define IMAGE_REL_PPC_ADDR 0x0002
3379 #define IMAGE_REL_PPC_ADDR24 0x0003
3380 #define IMAGE_REL_PPC_ADDR16 0x0004
3381 #define IMAGE_REL_PPC_ADDR14 0x0005
3382 #define IMAGE_REL_PPC_REL24 0x0006
3383 #define IMAGE_REL_PPC_REL14 0x0007
3384 #define IMAGE_REL_PPC_TOCREL16 0x0008
3385 #define IMAGE_REL_PPC_TOCREL14 0x0009
3386 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3387 #define IMAGE_REL_PPC_SECREL 0x000B
3388 #define IMAGE_REL_PPC_SECTION 0x000C
3389 #define IMAGE_REL_PPC_IFGLUE 0x000D
3390 #define IMAGE_REL_PPC_IMGLUE 0x000E
3391 #define IMAGE_REL_PPC_SECREL16 0x000F
3392 #define IMAGE_REL_PPC_REFHI 0x0010
3393 #define IMAGE_REL_PPC_REFLO 0x0011
3394 #define IMAGE_REL_PPC_PAIR 0x0012
3395 #define IMAGE_REL_PPC_SECRELLO 0x0013
3396 #define IMAGE_REL_PPC_SECRELHI 0x0014
3397 #define IMAGE_REL_PPC_GPREL 0x0015
3398 #define IMAGE_REL_PPC_TOKEN 0x0016
3399 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3400 /* modifier bits */
3401 #define IMAGE_REL_PPC_NEG 0x0100
3402 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3403 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3404 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3406 /* SH3 ? relocation type */
3407 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3408 #define IMAGE_REL_SH3_DIRECT16 0x0001
3409 #define IMAGE_REL_SH3_DIRECT 0x0002
3410 #define IMAGE_REL_SH3_DIRECT8 0x0003
3411 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3412 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3413 #define IMAGE_REL_SH3_DIRECT4 0x0006
3414 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3415 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3416 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3417 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3418 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3419 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3420 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3421 #define IMAGE_REL_SH3_SECTION 0x000E
3422 #define IMAGE_REL_SH3_SECREL 0x000F
3423 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3424 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3425 #define IMAGE_REL_SH3_TOKEN 0x0012
3427 /* ARM (Archimedes?) relocation types */
3428 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3429 #define IMAGE_REL_ARM_ADDR 0x0001
3430 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3431 #define IMAGE_REL_ARM_BRANCH24 0x0003
3432 #define IMAGE_REL_ARM_BRANCH11 0x0004
3433 #define IMAGE_REL_ARM_TOKEN 0x0005
3434 #define IMAGE_REL_ARM_GPREL12 0x0006
3435 #define IMAGE_REL_ARM_GPREL7 0x0007
3436 #define IMAGE_REL_ARM_BLX24 0x0008
3437 #define IMAGE_REL_ARM_BLX11 0x0009
3438 #define IMAGE_REL_ARM_SECTION 0x000E
3439 #define IMAGE_REL_ARM_SECREL 0x000F
3441 /* IA64 relocation types */
3442 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3443 #define IMAGE_REL_IA64_IMM14 0x0001
3444 #define IMAGE_REL_IA64_IMM22 0x0002
3445 #define IMAGE_REL_IA64_IMM64 0x0003
3446 #define IMAGE_REL_IA64_DIR 0x0004
3447 #define IMAGE_REL_IA64_DIR64 0x0005
3448 #define IMAGE_REL_IA64_PCREL21B 0x0006
3449 #define IMAGE_REL_IA64_PCREL21M 0x0007
3450 #define IMAGE_REL_IA64_PCREL21F 0x0008
3451 #define IMAGE_REL_IA64_GPREL22 0x0009
3452 #define IMAGE_REL_IA64_LTOFF22 0x000A
3453 #define IMAGE_REL_IA64_SECTION 0x000B
3454 #define IMAGE_REL_IA64_SECREL22 0x000C
3455 #define IMAGE_REL_IA64_SECREL64I 0x000D
3456 #define IMAGE_REL_IA64_SECREL 0x000E
3457 #define IMAGE_REL_IA64_LTOFF64 0x000F
3458 #define IMAGE_REL_IA64_DIR32NB 0x0010
3459 #define IMAGE_REL_IA64_SREL14 0x0011
3460 #define IMAGE_REL_IA64_SREL22 0x0012
3461 #define IMAGE_REL_IA64_SREL32 0x0013
3462 #define IMAGE_REL_IA64_UREL32 0x0014
3463 #define IMAGE_REL_IA64_PCREL60X 0x0015
3464 #define IMAGE_REL_IA64_PCREL60B 0x0016
3465 #define IMAGE_REL_IA64_PCREL60F 0x0017
3466 #define IMAGE_REL_IA64_PCREL60I 0x0018
3467 #define IMAGE_REL_IA64_PCREL60M 0x0019
3468 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3469 #define IMAGE_REL_IA64_TOKEN 0x001B
3470 #define IMAGE_REL_IA64_GPREL32 0x001C
3471 #define IMAGE_REL_IA64_ADDEND 0x001F
3473 /* AMD64 relocation types */
3474 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3475 #define IMAGE_REL_AMD64_ADDR64 0x0001
3476 #define IMAGE_REL_AMD64_ADDR32 0x0002
3477 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3478 #define IMAGE_REL_AMD64_REL32 0x0004
3479 #define IMAGE_REL_AMD64_REL32_1 0x0005
3480 #define IMAGE_REL_AMD64_REL32_2 0x0006
3481 #define IMAGE_REL_AMD64_REL32_3 0x0007
3482 #define IMAGE_REL_AMD64_REL32_4 0x0008
3483 #define IMAGE_REL_AMD64_REL32_5 0x0009
3484 #define IMAGE_REL_AMD64_SECTION 0x000A
3485 #define IMAGE_REL_AMD64_SECREL 0x000B
3486 #define IMAGE_REL_AMD64_SECREL7 0x000C
3487 #define IMAGE_REL_AMD64_TOKEN 0x000D
3488 #define IMAGE_REL_AMD64_SREL32 0x000E
3489 #define IMAGE_REL_AMD64_PAIR 0x000F
3490 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3492 /* archive format */
3494 #define IMAGE_ARCHIVE_START_SIZE 8
3495 #define IMAGE_ARCHIVE_START "!<arch>\n"
3496 #define IMAGE_ARCHIVE_END "`\n"
3497 #define IMAGE_ARCHIVE_PAD "\n"
3498 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3499 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3501 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3503 BYTE Name[16];
3504 BYTE Date[12];
3505 BYTE UserID[6];
3506 BYTE GroupID[6];
3507 BYTE Mode[8];
3508 BYTE Size[10];
3509 BYTE EndHeader[2];
3510 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3512 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3514 typedef struct _IMPORT_OBJECT_HEADER
3516 WORD Sig1;
3517 WORD Sig2;
3518 WORD Version;
3519 WORD Machine;
3520 DWORD TimeDateStamp;
3521 DWORD SizeOfData;
3522 union
3524 WORD Ordinal;
3525 WORD Hint;
3526 } DUMMYUNIONNAME;
3527 WORD Type : 2;
3528 WORD NameType : 3;
3529 WORD Reserved : 11;
3530 } IMPORT_OBJECT_HEADER;
3532 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3534 typedef enum IMPORT_OBJECT_TYPE
3536 IMPORT_OBJECT_CODE = 0,
3537 IMPORT_OBJECT_DATA = 1,
3538 IMPORT_OBJECT_CONST = 2
3539 } IMPORT_OBJECT_TYPE;
3541 typedef enum IMPORT_OBJECT_NAME_TYPE
3543 IMPORT_OBJECT_ORDINAL = 0,
3544 IMPORT_OBJECT_NAME = 1,
3545 IMPORT_OBJECT_NAME_NO_PREFIX = 2,
3546 IMPORT_OBJECT_NAME_UNDECORATE = 3
3547 } IMPORT_OBJECT_NAME_TYPE;
3549 typedef struct _ANON_OBJECT_HEADER
3551 WORD Sig1;
3552 WORD Sig2;
3553 WORD Version;
3554 WORD Machine;
3555 DWORD TimeDateStamp;
3556 CLSID ClassID;
3557 DWORD SizeOfData;
3558 } ANON_OBJECT_HEADER;
3561 * Resource directory stuff
3563 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3564 DWORD Characteristics;
3565 DWORD TimeDateStamp;
3566 WORD MajorVersion;
3567 WORD MinorVersion;
3568 WORD NumberOfNamedEntries;
3569 WORD NumberOfIdEntries;
3570 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3571 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3573 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3574 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3576 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3577 union {
3578 struct {
3579 #ifdef BITFIELDS_BIGENDIAN
3580 unsigned NameIsString:1;
3581 unsigned NameOffset:31;
3582 #else
3583 unsigned NameOffset:31;
3584 unsigned NameIsString:1;
3585 #endif
3586 } DUMMYSTRUCTNAME1;
3587 DWORD Name;
3588 struct {
3589 #ifdef WORDS_BIGENDIAN
3590 WORD __pad;
3591 WORD Id;
3592 #else
3593 WORD Id;
3594 WORD __pad;
3595 #endif
3596 } DUMMYSTRUCTNAME2;
3597 } DUMMYUNIONNAME1;
3598 union {
3599 DWORD OffsetToData;
3600 struct {
3601 #ifdef BITFIELDS_BIGENDIAN
3602 unsigned DataIsDirectory:1;
3603 unsigned OffsetToDirectory:31;
3604 #else
3605 unsigned OffsetToDirectory:31;
3606 unsigned DataIsDirectory:1;
3607 #endif
3608 } DUMMYSTRUCTNAME3;
3609 } DUMMYUNIONNAME2;
3610 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3613 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3614 WORD Length;
3615 CHAR NameString[ 1 ];
3616 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3618 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3619 WORD Length;
3620 WCHAR NameString[ 1 ];
3621 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3623 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3624 DWORD OffsetToData;
3625 DWORD Size;
3626 DWORD CodePage;
3627 DWORD Reserved;
3628 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3631 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
3632 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3635 typedef struct _IMAGE_TLS_DIRECTORY64 {
3636 ULONGLONG StartAddressOfRawData;
3637 ULONGLONG EndAddressOfRawData;
3638 ULONGLONG AddressOfIndex;
3639 ULONGLONG AddressOfCallBacks;
3640 DWORD SizeOfZeroFill;
3641 DWORD Characteristics;
3642 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3644 typedef struct _IMAGE_TLS_DIRECTORY32 {
3645 DWORD StartAddressOfRawData;
3646 DWORD EndAddressOfRawData;
3647 DWORD AddressOfIndex;
3648 DWORD AddressOfCallBacks;
3649 DWORD SizeOfZeroFill;
3650 DWORD Characteristics;
3651 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3653 #ifdef _WIN64
3654 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3655 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3656 #else
3657 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3658 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3659 #endif
3661 typedef struct _IMAGE_DEBUG_DIRECTORY {
3662 DWORD Characteristics;
3663 DWORD TimeDateStamp;
3664 WORD MajorVersion;
3665 WORD MinorVersion;
3666 DWORD Type;
3667 DWORD SizeOfData;
3668 DWORD AddressOfRawData;
3669 DWORD PointerToRawData;
3670 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3672 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3673 #define IMAGE_DEBUG_TYPE_COFF 1
3674 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3675 #define IMAGE_DEBUG_TYPE_FPO 3
3676 #define IMAGE_DEBUG_TYPE_MISC 4
3677 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3678 #define IMAGE_DEBUG_TYPE_FIXUP 6
3679 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3680 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3681 #define IMAGE_DEBUG_TYPE_BORLAND 9
3682 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3684 typedef enum ReplacesCorHdrNumericDefines
3686 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3687 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3688 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3689 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3690 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3692 COR_VERSION_MAJOR_V2 = 2,
3693 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3694 COR_VERSION_MINOR = 0,
3695 COR_DELETED_NAME_LENGTH = 8,
3696 COR_VTABLEGAP_NAME_LENGTH = 8,
3698 NATIVE_TYPE_MAX_CB = 1,
3699 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xff,
3701 IMAGE_COR_MIH_METHODRVA = 0x01,
3702 IMAGE_COR_MIH_EHRVA = 0x02,
3703 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3705 COR_VTABLE_32BIT = 0x01,
3706 COR_VTABLE_64BIT = 0x02,
3707 COR_VTABLE_FROM_UNMANAGED = 0x04,
3708 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3710 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3712 MAX_CLASS_NAME = 1024,
3713 MAX_PACKAGE_NAME = 1024,
3714 } ReplacesCorHdrNumericDefines;
3716 typedef struct IMAGE_COR20_HEADER
3718 DWORD cb;
3719 WORD MajorRuntimeVersion;
3720 WORD MinorRuntimeVersion;
3722 IMAGE_DATA_DIRECTORY MetaData;
3723 DWORD Flags;
3724 DWORD EntryPointToken;
3726 IMAGE_DATA_DIRECTORY Resources;
3727 IMAGE_DATA_DIRECTORY StrongNameSignature;
3728 IMAGE_DATA_DIRECTORY CodeManagerTable;
3729 IMAGE_DATA_DIRECTORY VTableFixups;
3730 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3731 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3733 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3735 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3736 DWORD NumberOfSymbols;
3737 DWORD LvaToFirstSymbol;
3738 DWORD NumberOfLinenumbers;
3739 DWORD LvaToFirstLinenumber;
3740 DWORD RvaToFirstByteOfCode;
3741 DWORD RvaToLastByteOfCode;
3742 DWORD RvaToFirstByteOfData;
3743 DWORD RvaToLastByteOfData;
3744 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3746 #define FRAME_FPO 0
3747 #define FRAME_TRAP 1
3748 #define FRAME_TSS 2
3749 #define FRAME_NONFPO 3
3751 typedef struct _FPO_DATA {
3752 DWORD ulOffStart;
3753 DWORD cbProcSize;
3754 DWORD cdwLocals;
3755 WORD cdwParams;
3756 WORD cbProlog : 8;
3757 WORD cbRegs : 3;
3758 WORD fHasSEH : 1;
3759 WORD fUseBP : 1;
3760 WORD reserved : 1;
3761 WORD cbFrame : 2;
3762 } FPO_DATA, *PFPO_DATA;
3764 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
3765 DWORD Size;
3766 DWORD TimeDateStamp;
3767 WORD MajorVersion;
3768 WORD MinorVersion;
3769 DWORD GlobalFlagsClear;
3770 DWORD GlobalFlagsSet;
3771 DWORD CriticalSectionDefaultTimeout;
3772 DWORD DeCommitFreeBlockThreshold;
3773 DWORD DeCommitTotalFreeThreshold;
3774 PVOID LockPrefixTable;
3775 DWORD MaximumAllocationSize;
3776 DWORD VirtualMemoryThreshold;
3777 DWORD ProcessHeapFlags;
3778 DWORD ProcessAffinityMask;
3779 WORD CSDVersion;
3780 WORD Reserved1;
3781 PVOID EditList;
3782 DWORD SecurityCookie;
3783 DWORD SEHandlerTable;
3784 DWORD SEHandlerCount;
3785 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3787 typedef struct _IMAGE_FUNCTION_ENTRY {
3788 DWORD StartingAddress;
3789 DWORD EndingAddress;
3790 DWORD EndOfPrologue;
3791 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3793 #define IMAGE_DEBUG_MISC_EXENAME 1
3795 typedef struct _IMAGE_DEBUG_MISC {
3796 DWORD DataType;
3797 DWORD Length;
3798 BYTE Unicode;
3799 BYTE Reserved[ 3 ];
3800 BYTE Data[ 1 ];
3801 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3803 /* This is the structure that appears at the very start of a .DBG file. */
3805 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3806 WORD Signature;
3807 WORD Flags;
3808 WORD Machine;
3809 WORD Characteristics;
3810 DWORD TimeDateStamp;
3811 DWORD CheckSum;
3812 DWORD ImageBase;
3813 DWORD SizeOfImage;
3814 DWORD NumberOfSections;
3815 DWORD ExportedNamesSize;
3816 DWORD DebugDirectorySize;
3817 DWORD SectionAlignment;
3818 DWORD Reserved[ 2 ];
3819 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3821 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3824 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3825 WORD Length;
3826 WORD Flags;
3827 BYTE Text[1];
3828 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3829 #define MESSAGE_RESOURCE_UNICODE 0x0001
3831 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3832 DWORD LowId;
3833 DWORD HighId;
3834 DWORD OffsetToEntries;
3835 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3837 typedef struct tagMESSAGE_RESOURCE_DATA {
3838 DWORD NumberOfBlocks;
3839 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3840 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3843 * Here follows typedefs for security and tokens.
3847 * First a constant for the following typedefs.
3850 #define ANYSIZE_ARRAY 1
3852 /* FIXME: Orphan. What does it point to? */
3853 typedef PVOID PACCESS_TOKEN;
3854 typedef PVOID PSECURITY_DESCRIPTOR;
3855 typedef PVOID PSID;
3857 typedef enum _TOKEN_ELEVATION_TYPE {
3858 TokenElevationTypeDefault = 1,
3859 TokenElevationTypeFull,
3860 TokenElevationTypeLimited
3861 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
3864 * TOKEN_INFORMATION_CLASS
3867 typedef enum _TOKEN_INFORMATION_CLASS {
3868 TokenUser = 1,
3869 TokenGroups,
3870 TokenPrivileges,
3871 TokenOwner,
3872 TokenPrimaryGroup,
3873 TokenDefaultDacl,
3874 TokenSource,
3875 TokenType,
3876 TokenImpersonationLevel,
3877 TokenStatistics,
3878 TokenRestrictedSids,
3879 TokenSessionId,
3880 TokenGroupsAndPrivileges,
3881 TokenSessionReference,
3882 TokenSandBoxInert,
3883 TokenAuditPolicy,
3884 TokenOrigin,
3885 TokenElevationType,
3886 TokenLinkedToken,
3887 TokenElevation,
3888 TokenHasRestrictions,
3889 TokenAccessInformation,
3890 TokenVirtualizationAllowed,
3891 TokenVirtualizationEnabled,
3892 TokenIntegrityLevel,
3893 TokenUIAccess,
3894 TokenMandatoryPolicy,
3895 TokenLogonSid,
3896 MaxTokenInfoClass
3897 } TOKEN_INFORMATION_CLASS;
3899 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3900 #define TOKEN_ADJUST_GROUPS 0x0040
3901 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3902 #define TOKEN_ADJUST_SESSIONID 0x0100
3903 #define TOKEN_ASSIGN_PRIMARY 0x0001
3904 #define TOKEN_DUPLICATE 0x0002
3905 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3906 #define TOKEN_IMPERSONATE 0x0004
3907 #define TOKEN_QUERY 0x0008
3908 #define TOKEN_QUERY_SOURCE 0x0010
3909 #define TOKEN_ADJUST_DEFAULT 0x0080
3910 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3911 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3912 TOKEN_ADJUST_PRIVILEGES | \
3913 TOKEN_ADJUST_GROUPS | \
3914 TOKEN_ADJUST_DEFAULT )
3915 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3916 TOKEN_ASSIGN_PRIMARY | \
3917 TOKEN_DUPLICATE | \
3918 TOKEN_IMPERSONATE | \
3919 TOKEN_QUERY | \
3920 TOKEN_QUERY_SOURCE | \
3921 TOKEN_ADJUST_PRIVILEGES | \
3922 TOKEN_ADJUST_GROUPS | \
3923 TOKEN_ADJUST_SESSIONID | \
3924 TOKEN_ADJUST_DEFAULT )
3926 #ifndef _SECURITY_DEFINED
3927 #define _SECURITY_DEFINED
3930 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3932 typedef struct _GENERIC_MAPPING {
3933 ACCESS_MASK GenericRead;
3934 ACCESS_MASK GenericWrite;
3935 ACCESS_MASK GenericExecute;
3936 ACCESS_MASK GenericAll;
3937 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3939 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3940 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3941 typedef struct {
3942 BYTE Value[6];
3943 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
3944 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3946 #ifndef SID_DEFINED
3947 #define SID_DEFINED
3948 typedef struct _SID {
3949 BYTE Revision;
3950 BYTE SubAuthorityCount;
3951 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3952 DWORD SubAuthority[1];
3953 } SID,*PISID;
3954 #endif /* !defined(SID_DEFINED) */
3956 #define SID_REVISION (1) /* Current revision */
3957 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3958 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3960 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3963 * ACL
3966 #define ACL_REVISION1 1
3967 #define ACL_REVISION2 2
3968 #define ACL_REVISION3 3
3969 #define ACL_REVISION4 4
3971 #define MIN_ACL_REVISION ACL_REVISION2
3972 #define MAX_ACL_REVISION ACL_REVISION4
3974 #define ACL_REVISION 2
3976 typedef struct _ACL {
3977 BYTE AclRevision;
3978 BYTE Sbz1;
3979 WORD AclSize;
3980 WORD AceCount;
3981 WORD Sbz2;
3982 } ACL, *PACL;
3984 typedef enum _ACL_INFORMATION_CLASS
3986 AclRevisionInformation = 1,
3987 AclSizeInformation
3988 } ACL_INFORMATION_CLASS;
3990 typedef struct _ACL_REVISION_INFORMATION
3992 DWORD AclRevision;
3993 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
3995 typedef struct _ACL_SIZE_INFORMATION
3997 DWORD AceCount;
3998 DWORD AclBytesInUse;
3999 DWORD AclBytesFree;
4000 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
4002 /* SECURITY_DESCRIPTOR */
4003 #define SECURITY_DESCRIPTOR_REVISION 1
4004 #define SECURITY_DESCRIPTOR_REVISION1 1
4008 * Privilege Names
4010 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
4011 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
4012 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
4013 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
4014 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
4015 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
4016 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
4017 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
4018 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
4019 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
4020 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
4021 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
4022 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
4023 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
4024 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
4025 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
4026 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
4027 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
4028 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
4029 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
4030 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
4031 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
4032 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
4033 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
4034 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
4035 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
4036 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
4037 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
4038 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
4040 #define SE_GROUP_MANDATORY 0x00000001
4041 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
4042 #define SE_GROUP_ENABLED 0x00000004
4043 #define SE_GROUP_OWNER 0x00000008
4044 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
4045 #define SE_GROUP_LOGON_ID 0xC0000000
4046 #define SE_GROUP_RESOURCE 0x20000000
4048 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
4049 #define SE_PRIVILEGE_ENABLED 0x00000002
4050 #define SE_PRIVILEGE_REMOVED 0x00000004
4051 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
4053 #define PRIVILEGE_SET_ALL_NECESSARY 1
4055 #define SE_OWNER_DEFAULTED 0x00000001
4056 #define SE_GROUP_DEFAULTED 0x00000002
4057 #define SE_DACL_PRESENT 0x00000004
4058 #define SE_DACL_DEFAULTED 0x00000008
4059 #define SE_SACL_PRESENT 0x00000010
4060 #define SE_SACL_DEFAULTED 0x00000020
4061 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
4062 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
4063 #define SE_DACL_AUTO_INHERITED 0x00000400
4064 #define SE_SACL_AUTO_INHERITED 0x00000800
4065 #define SE_DACL_PROTECTED 0x00001000
4066 #define SE_SACL_PROTECTED 0x00002000
4067 #define SE_RM_CONTROL_VALID 0x00004000
4068 #define SE_SELF_RELATIVE 0x00008000
4070 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
4071 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
4073 /* The security descriptor structure */
4074 typedef struct {
4075 BYTE Revision;
4076 BYTE Sbz1;
4077 SECURITY_DESCRIPTOR_CONTROL Control;
4078 DWORD Owner;
4079 DWORD Group;
4080 DWORD Sacl;
4081 DWORD Dacl;
4082 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
4084 typedef struct {
4085 BYTE Revision;
4086 BYTE Sbz1;
4087 SECURITY_DESCRIPTOR_CONTROL Control;
4088 PSID Owner;
4089 PSID Group;
4090 PACL Sacl;
4091 PACL Dacl;
4092 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
4094 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
4096 #endif /* _SECURITY_DEFINED */
4099 * SID_AND_ATTRIBUTES
4102 typedef struct _SID_AND_ATTRIBUTES {
4103 PSID Sid;
4104 DWORD Attributes;
4105 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
4107 /* security entities */
4108 #define SECURITY_NULL_RID (0x00000000L)
4109 #define SECURITY_WORLD_RID (0x00000000L)
4110 #define SECURITY_LOCAL_RID (0X00000000L)
4112 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
4114 /* S-1-1 */
4115 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
4117 /* S-1-2 */
4118 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4120 /* S-1-3 */
4121 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4122 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
4123 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
4124 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
4125 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
4127 /* S-1-4 */
4128 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4130 /* S-1-5 */
4131 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4132 #define SECURITY_DIALUP_RID 0x00000001L
4133 #define SECURITY_NETWORK_RID 0x00000002L
4134 #define SECURITY_BATCH_RID 0x00000003L
4135 #define SECURITY_INTERACTIVE_RID 0x00000004L
4136 #define SECURITY_LOGON_IDS_RID 0x00000005L
4137 #define SECURITY_SERVICE_RID 0x00000006L
4138 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
4139 #define SECURITY_PROXY_RID 0x00000008L
4140 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
4141 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4142 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
4143 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
4144 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
4145 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
4146 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
4147 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
4148 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
4149 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
4150 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
4151 #define SECURITY_NT_NON_UNIQUE 0x00000015L
4152 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
4154 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
4155 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
4156 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
4157 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
4158 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
4159 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
4160 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
4162 #define FOREST_USER_RID_MAX 0x000001F3L
4163 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
4164 #define DOMAIN_USER_RID_GUEST 0x000001F5L
4165 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
4166 #define DOMAIN_USER_RID_MAX 0x000003E7L
4168 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
4169 #define DOMAIN_GROUP_RID_USERS 0x00000201L
4170 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
4171 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
4172 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
4173 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
4174 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
4175 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
4176 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
4178 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
4179 #define SECURITY_MANDATORY_UNTRUSTED_RID 0x00000000L
4180 #define SECURITY_MANDATORY_LOW_RID 0x00001000L
4181 #define SECURITY_MANDATORY_MEDIUM_RID 0x00002000L
4182 #define SECURITY_MANDATORY_HIGH_RID 0x00003000L
4183 #define SECURITY_MANDATORY_SYSTEM_RID 0x00004000L
4184 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID 0x00005000L
4186 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
4187 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
4188 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
4189 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
4191 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
4192 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
4193 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
4194 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
4196 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
4197 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
4198 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
4199 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
4200 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
4201 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
4203 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
4204 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
4205 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
4206 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
4207 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
4209 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4211 #define SECURITY_PACKAGE_RID_COUNT 2L
4212 #define SECURITY_LOGON_IDS_RID_COUNT 3L
4214 typedef enum {
4215 WinNullSid = 0,
4216 WinWorldSid = 1,
4217 WinLocalSid = 2,
4218 WinCreatorOwnerSid = 3,
4219 WinCreatorGroupSid = 4,
4220 WinCreatorOwnerServerSid = 5,
4221 WinCreatorGroupServerSid = 6,
4222 WinNtAuthoritySid = 7,
4223 WinDialupSid = 8,
4224 WinNetworkSid = 9,
4225 WinBatchSid = 10,
4226 WinInteractiveSid = 11,
4227 WinServiceSid = 12,
4228 WinAnonymousSid = 13,
4229 WinProxySid = 14,
4230 WinEnterpriseControllersSid = 15,
4231 WinSelfSid = 16,
4232 WinAuthenticatedUserSid = 17,
4233 WinRestrictedCodeSid = 18,
4234 WinTerminalServerSid = 19,
4235 WinRemoteLogonIdSid = 20,
4236 WinLogonIdsSid = 21,
4237 WinLocalSystemSid = 22,
4238 WinLocalServiceSid = 23,
4239 WinNetworkServiceSid = 24,
4240 WinBuiltinDomainSid = 25,
4241 WinBuiltinAdministratorsSid = 26,
4242 WinBuiltinUsersSid = 27,
4243 WinBuiltinGuestsSid = 28,
4244 WinBuiltinPowerUsersSid = 29,
4245 WinBuiltinAccountOperatorsSid = 30,
4246 WinBuiltinSystemOperatorsSid = 31,
4247 WinBuiltinPrintOperatorsSid = 32,
4248 WinBuiltinBackupOperatorsSid = 33,
4249 WinBuiltinReplicatorSid = 34,
4250 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
4251 WinBuiltinRemoteDesktopUsersSid = 36,
4252 WinBuiltinNetworkConfigurationOperatorsSid = 37,
4253 WinAccountAdministratorSid = 38,
4254 WinAccountGuestSid = 39,
4255 WinAccountKrbtgtSid = 40,
4256 WinAccountDomainAdminsSid = 41,
4257 WinAccountDomainUsersSid = 42,
4258 WinAccountDomainGuestsSid = 43,
4259 WinAccountComputersSid = 44,
4260 WinAccountControllersSid = 45,
4261 WinAccountCertAdminsSid = 46,
4262 WinAccountSchemaAdminsSid = 47,
4263 WinAccountEnterpriseAdminsSid = 48,
4264 WinAccountPolicyAdminsSid = 49,
4265 WinAccountRasAndIasServersSid = 50,
4266 WinNTLMAuthenticationSid = 51,
4267 WinDigestAuthenticationSid = 52,
4268 WinSChannelAuthenticationSid = 53,
4269 WinThisOrganizationSid = 54,
4270 WinOtherOrganizationSid = 55,
4271 WinBuiltinIncomingForestTrustBuildersSid = 56,
4272 WinBuiltinPerfMonitoringUsersSid = 57,
4273 WinBuiltinPerfLoggingUsersSid = 58,
4274 WinBuiltinAuthorizationAccessSid = 59,
4275 WinBuiltinTerminalServerLicenseServersSid = 60,
4276 WinBuiltinDCOMUsersSid = 61,
4277 WinBuiltinIUsersSid = 62,
4278 WinIUserSid = 63,
4279 WinBuiltinCryptoOperatorsSid = 64,
4280 WinUntrustedLabelSid = 65,
4281 WinLowLabelSid = 66,
4282 WinMediumLabelSid = 67,
4283 WinHighLabelSid = 68,
4284 WinSystemLabelSid = 69,
4285 WinWriteRestrictedCodeSid = 70,
4286 WinCreatorOwnerRightsSid = 71,
4287 WinCacheablePrincipalsGroupSid = 72,
4288 WinNonCacheablePrincipalsGroupSid = 73,
4289 WinEnterpriseReadonlyControllersSid = 74,
4290 WinAccountReadonlyControllersSid = 75,
4291 WinBuiltinEventLogReadersGroup = 76,
4292 WinNewEnterpriseReadonlyControllersSid = 77,
4293 WinBuiltinCertSvcDComAccessGroup = 78,
4294 WinMediumPlusLabelSid = 79,
4295 WinLocalLogonSid = 80,
4296 WinConsoleLogonSid = 81,
4297 WinThisOrganizationCertificateSid = 82,
4298 } WELL_KNOWN_SID_TYPE;
4301 * TOKEN_USER
4304 typedef struct _TOKEN_USER {
4305 SID_AND_ATTRIBUTES User;
4306 } TOKEN_USER, *PTOKEN_USER;
4309 * TOKEN_GROUPS
4312 typedef struct _TOKEN_GROUPS {
4313 DWORD GroupCount;
4314 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
4315 } TOKEN_GROUPS, *PTOKEN_GROUPS;
4318 * LUID_AND_ATTRIBUTES
4321 typedef union _LARGE_INTEGER {
4322 struct {
4323 #ifdef WORDS_BIGENDIAN
4324 LONG HighPart;
4325 DWORD LowPart;
4326 #else
4327 DWORD LowPart;
4328 LONG HighPart;
4329 #endif
4330 } u;
4331 #ifndef NONAMELESSSTRUCT
4332 struct {
4333 #ifdef WORDS_BIGENDIAN
4334 LONG HighPart;
4335 DWORD LowPart;
4336 #else
4337 DWORD LowPart;
4338 LONG HighPart;
4339 #endif
4341 #endif
4342 LONGLONG QuadPart;
4343 } LARGE_INTEGER, *PLARGE_INTEGER;
4345 typedef union _ULARGE_INTEGER {
4346 struct {
4347 #ifdef WORDS_BIGENDIAN
4348 DWORD HighPart;
4349 DWORD LowPart;
4350 #else
4351 DWORD LowPart;
4352 DWORD HighPart;
4353 #endif
4354 } u;
4355 #ifndef NONAMELESSSTRUCT
4356 struct {
4357 #ifdef WORDS_BIGENDIAN
4358 DWORD HighPart;
4359 DWORD LowPart;
4360 #else
4361 DWORD LowPart;
4362 DWORD HighPart;
4363 #endif
4365 #endif
4366 ULONGLONG QuadPart;
4367 } ULARGE_INTEGER, *PULARGE_INTEGER;
4370 * Locally Unique Identifier
4373 typedef struct _LUID {
4374 DWORD LowPart;
4375 LONG HighPart;
4376 } LUID, *PLUID;
4378 #include <pshpack4.h>
4379 typedef struct _LUID_AND_ATTRIBUTES {
4380 LUID Luid;
4381 DWORD Attributes;
4382 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
4383 #include <poppack.h>
4386 * PRIVILEGE_SET
4389 typedef struct _PRIVILEGE_SET {
4390 DWORD PrivilegeCount;
4391 DWORD Control;
4392 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
4393 } PRIVILEGE_SET, *PPRIVILEGE_SET;
4396 * TOKEN_PRIVILEGES
4399 typedef struct _TOKEN_PRIVILEGES {
4400 DWORD PrivilegeCount;
4401 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
4402 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
4405 * TOKEN_OWNER
4408 typedef struct _TOKEN_OWNER {
4409 PSID Owner;
4410 } TOKEN_OWNER, *PTOKEN_OWNER;
4413 * TOKEN_PRIMARY_GROUP
4416 typedef struct _TOKEN_PRIMARY_GROUP {
4417 PSID PrimaryGroup;
4418 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
4422 * TOKEN_DEFAULT_DACL
4425 typedef struct _TOKEN_DEFAULT_DACL {
4426 PACL DefaultDacl;
4427 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
4430 * TOKEN_SOURCE
4433 #define TOKEN_SOURCE_LENGTH 8
4435 typedef struct _TOKEN_SOURCE {
4436 char SourceName[TOKEN_SOURCE_LENGTH];
4437 LUID SourceIdentifier;
4438 } TOKEN_SOURCE, *PTOKEN_SOURCE;
4441 * TOKEN_TYPE
4444 typedef enum tagTOKEN_TYPE {
4445 TokenPrimary = 1,
4446 TokenImpersonation
4447 } TOKEN_TYPE;
4450 * SECURITY_IMPERSONATION_LEVEL
4453 typedef enum _SECURITY_IMPERSONATION_LEVEL {
4454 SecurityAnonymous,
4455 SecurityIdentification,
4456 SecurityImpersonation,
4457 SecurityDelegation
4458 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
4460 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4461 #define SECURITY_STATIC_TRACKING (FALSE)
4463 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
4464 * PSECURITY_CONTEXT_TRACKING_MODE;
4466 * Quality of Service
4469 typedef struct _SECURITY_QUALITY_OF_SERVICE {
4470 DWORD Length;
4471 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4472 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
4473 BOOLEAN EffectiveOnly;
4474 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
4477 * TOKEN_STATISTICS
4480 #include <pshpack4.h>
4481 typedef struct _TOKEN_STATISTICS {
4482 LUID TokenId;
4483 LUID AuthenticationId;
4484 LARGE_INTEGER ExpirationTime;
4485 TOKEN_TYPE TokenType;
4486 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4487 DWORD DynamicCharged;
4488 DWORD DynamicAvailable;
4489 DWORD GroupCount;
4490 DWORD PrivilegeCount;
4491 LUID ModifiedId;
4492 } TOKEN_STATISTICS;
4493 #include <poppack.h>
4495 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
4496 DWORD SidCount;
4497 DWORD SidLength;
4498 PSID_AND_ATTRIBUTES Sids;
4499 DWORD RestrictedSidCount;
4500 DWORD RestrictedSidLength;
4501 PSID_AND_ATTRIBUTES RestrictedSids;
4502 DWORD PrivilegeCount;
4503 DWORD PrivilegeLength;
4504 PLUID_AND_ATTRIBUTES Privileges;
4505 LUID AuthenticationId;
4506 } TOKEN_GROUPS_AND_PRIVILEGES, * PTOKEN_GROUPS_AND_PRIVILEGES;
4508 typedef struct _TOKEN_ORIGIN {
4509 LUID OriginatingLogonSession;
4510 } TOKEN_ORIGIN, * PTOKEN_ORIGIN;
4512 typedef struct _TOKEN_LINKED_TOKEN {
4513 HANDLE LinkedToken;
4514 } TOKEN_LINKED_TOKEN, * PTOKEN_LINKED_TOKEN;
4516 typedef struct _TOKEN_ELEVATION {
4517 DWORD TokenIsElevated;
4518 } TOKEN_ELEVATION, * PTOKEN_ELEVATION;
4522 * ACLs of NT
4525 /* ACEs, directly starting after an ACL */
4526 typedef struct _ACE_HEADER {
4527 BYTE AceType;
4528 BYTE AceFlags;
4529 WORD AceSize;
4530 } ACE_HEADER,*PACE_HEADER;
4532 /* AceType */
4533 #define ACCESS_ALLOWED_ACE_TYPE 0
4534 #define ACCESS_DENIED_ACE_TYPE 1
4535 #define SYSTEM_AUDIT_ACE_TYPE 2
4536 #define SYSTEM_ALARM_ACE_TYPE 3
4538 /* inherit AceFlags */
4539 #define OBJECT_INHERIT_ACE 0x01
4540 #define CONTAINER_INHERIT_ACE 0x02
4541 #define NO_PROPAGATE_INHERIT_ACE 0x04
4542 #define INHERIT_ONLY_ACE 0x08
4543 #define INHERITED_ACE 0x10
4544 #define VALID_INHERIT_FLAGS 0x1F
4546 /* AceFlags mask for what events we (should) audit */
4547 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4548 #define FAILED_ACCESS_ACE_FLAG 0x80
4550 /* different ACEs depending on AceType
4551 * SidStart marks the begin of a SID
4552 * so the thing finally looks like this:
4553 * 0: ACE_HEADER
4554 * 4: ACCESS_MASK
4555 * 8... : SID
4557 typedef struct _ACCESS_ALLOWED_ACE {
4558 ACE_HEADER Header;
4559 DWORD Mask;
4560 DWORD SidStart;
4561 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
4563 typedef struct _ACCESS_DENIED_ACE {
4564 ACE_HEADER Header;
4565 DWORD Mask;
4566 DWORD SidStart;
4567 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
4569 typedef struct _SYSTEM_AUDIT_ACE {
4570 ACE_HEADER Header;
4571 DWORD Mask;
4572 DWORD SidStart;
4573 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
4575 typedef struct _SYSTEM_ALARM_ACE {
4576 ACE_HEADER Header;
4577 DWORD Mask;
4578 DWORD SidStart;
4579 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
4581 typedef enum tagSID_NAME_USE {
4582 SidTypeUser = 1,
4583 SidTypeGroup,
4584 SidTypeDomain,
4585 SidTypeAlias,
4586 SidTypeWellKnownGroup,
4587 SidTypeDeletedAccount,
4588 SidTypeInvalid,
4589 SidTypeUnknown
4590 } SID_NAME_USE,*PSID_NAME_USE;
4592 #define ACE_OBJECT_TYPE_PRESENT 0x1
4593 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4595 /* Access rights */
4597 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4598 #undef DELETE
4599 #define DELETE 0x00010000
4600 #define READ_CONTROL 0x00020000
4601 #define WRITE_DAC 0x00040000
4602 #define WRITE_OWNER 0x00080000
4603 #define SYNCHRONIZE 0x00100000
4604 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4606 #define STANDARD_RIGHTS_READ READ_CONTROL
4607 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4608 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4610 #define STANDARD_RIGHTS_ALL 0x001f0000
4612 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4614 #define GENERIC_READ 0x80000000
4615 #define GENERIC_WRITE 0x40000000
4616 #define GENERIC_EXECUTE 0x20000000
4617 #define GENERIC_ALL 0x10000000
4619 #define MAXIMUM_ALLOWED 0x02000000
4620 #define ACCESS_SYSTEM_SECURITY 0x01000000
4622 #define EVENT_QUERY_STATE 0x0001
4623 #define EVENT_MODIFY_STATE 0x0002
4624 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4626 #define SEMAPHORE_MODIFY_STATE 0x0002
4627 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4629 #define MUTEX_MODIFY_STATE 0x0001
4630 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4632 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4633 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4634 #define JOB_OBJECT_QUERY 0x0004
4635 #define JOB_OBJECT_TERMINATE 0x0008
4636 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4637 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4639 #define TIMER_QUERY_STATE 0x0001
4640 #define TIMER_MODIFY_STATE 0x0002
4641 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4643 #define PROCESS_TERMINATE 0x0001
4644 #define PROCESS_CREATE_THREAD 0x0002
4645 #define PROCESS_VM_OPERATION 0x0008
4646 #define PROCESS_VM_READ 0x0010
4647 #define PROCESS_VM_WRITE 0x0020
4648 #define PROCESS_DUP_HANDLE 0x0040
4649 #define PROCESS_CREATE_PROCESS 0x0080
4650 #define PROCESS_SET_QUOTA 0x0100
4651 #define PROCESS_SET_INFORMATION 0x0200
4652 #define PROCESS_QUERY_INFORMATION 0x0400
4653 #define PROCESS_SUSPEND_RESUME 0x0800
4654 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4655 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4657 #define THREAD_TERMINATE 0x0001
4658 #define THREAD_SUSPEND_RESUME 0x0002
4659 #define THREAD_GET_CONTEXT 0x0008
4660 #define THREAD_SET_CONTEXT 0x0010
4661 #define THREAD_SET_INFORMATION 0x0020
4662 #define THREAD_QUERY_INFORMATION 0x0040
4663 #define THREAD_SET_THREAD_TOKEN 0x0080
4664 #define THREAD_IMPERSONATE 0x0100
4665 #define THREAD_DIRECT_IMPERSONATION 0x0200
4666 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4668 #define THREAD_BASE_PRIORITY_LOWRT 15
4669 #define THREAD_BASE_PRIORITY_MAX 2
4670 #define THREAD_BASE_PRIORITY_MIN -2
4671 #define THREAD_BASE_PRIORITY_IDLE -15
4673 typedef struct _QUOTA_LIMITS {
4674 SIZE_T PagedPoolLimit;
4675 SIZE_T NonPagedPoolLimit;
4676 SIZE_T MinimumWorkingSetSize;
4677 SIZE_T MaximumWorkingSetSize;
4678 SIZE_T PagefileLimit;
4679 LARGE_INTEGER TimeLimit;
4680 } QUOTA_LIMITS, *PQUOTA_LIMITS;
4682 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4683 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4684 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4685 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4687 typedef struct _QUOTA_LIMITS_EX {
4688 SIZE_T PagedPoolLimit;
4689 SIZE_T NonPagedPoolLimit;
4690 SIZE_T MinimumWorkingSetSize;
4691 SIZE_T MaximumWorkingSetSize;
4692 SIZE_T PagefileLimit;
4693 LARGE_INTEGER TimeLimit;
4694 SIZE_T Reserved1;
4695 SIZE_T Reserved2;
4696 SIZE_T Reserved3;
4697 SIZE_T Reserved4;
4698 DWORD Flags;
4699 DWORD Reserved5;
4700 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
4702 #define SECTION_QUERY 0x0001
4703 #define SECTION_MAP_WRITE 0x0002
4704 #define SECTION_MAP_READ 0x0004
4705 #define SECTION_MAP_EXECUTE 0x0008
4706 #define SECTION_EXTEND_SIZE 0x0010
4707 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4708 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4710 #define FILE_READ_DATA 0x0001 /* file & pipe */
4711 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4712 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4713 #define FILE_ADD_FILE 0x0002 /* directory */
4714 #define FILE_APPEND_DATA 0x0004 /* file */
4715 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4716 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4717 #define FILE_READ_EA 0x0008 /* file & directory */
4718 #define FILE_READ_PROPERTIES FILE_READ_EA
4719 #define FILE_WRITE_EA 0x0010 /* file & directory */
4720 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4721 #define FILE_EXECUTE 0x0020 /* file */
4722 #define FILE_TRAVERSE 0x0020 /* directory */
4723 #define FILE_DELETE_CHILD 0x0040 /* directory */
4724 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4725 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4726 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4728 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4729 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4730 SYNCHRONIZE)
4731 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4732 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4733 FILE_APPEND_DATA | SYNCHRONIZE)
4734 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4735 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4737 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4738 #define DUPLICATE_SAME_ACCESS 0x00000002
4740 /* File attribute flags */
4741 #define FILE_SHARE_READ 0x00000001L
4742 #define FILE_SHARE_WRITE 0x00000002L
4743 #define FILE_SHARE_DELETE 0x00000004L
4745 #define FILE_ATTRIBUTE_READONLY 0x00000001
4746 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4747 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4748 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4749 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4750 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4751 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4752 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4753 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4754 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4755 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4756 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4757 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4758 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4760 /* File notification flags */
4761 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4762 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4763 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4764 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4765 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4766 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4767 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4768 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4769 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4770 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4771 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4772 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4774 #define FILE_ACTION_ADDED 0x00000001
4775 #define FILE_ACTION_REMOVED 0x00000002
4776 #define FILE_ACTION_MODIFIED 0x00000003
4777 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4778 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4779 #define FILE_ACTION_ADDED_STREAM 0x00000006
4780 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4781 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4783 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4784 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4785 #define FILE_UNICODE_ON_DISK 0x00000004
4786 #define FILE_PERSISTENT_ACLS 0x00000008
4787 #define FILE_FILE_COMPRESSION 0x00000010
4788 #define FILE_VOLUME_QUOTAS 0x00000020
4789 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
4790 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
4791 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4792 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4793 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4794 #define FILE_NAMED_STREAMS 0x00040000
4795 #define FILE_READ_ONLY_VOLUME 0x00080000
4797 /* File alignments (NT) */
4798 #define FILE_BYTE_ALIGNMENT 0x00000000
4799 #define FILE_WORD_ALIGNMENT 0x00000001
4800 #define FILE_LONG_ALIGNMENT 0x00000003
4801 #define FILE_QUAD_ALIGNMENT 0x00000007
4802 #define FILE_OCTA_ALIGNMENT 0x0000000f
4803 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4804 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4805 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4806 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4807 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4809 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4810 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4812 #define REG_NONE 0 /* no type */
4813 #define REG_SZ 1 /* string type (ASCII) */
4814 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4815 #define REG_BINARY 3 /* binary format, callerspecific */
4816 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4817 #define REG_DWORD 4 /* DWORD in little endian format */
4818 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4819 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4820 #define REG_LINK 6 /* symbolic link (UNICODE) */
4821 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4822 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4823 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4824 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4825 #define REG_QWORD 11 /* QWORD in little endian format */
4826 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4828 /* ----------------------------- begin power management --------------------- */
4830 typedef enum _LATENCY_TIME {
4831 LT_DONT_CARE,
4832 LT_LOWEST_LATENCY
4833 } LATENCY_TIME, *PLATENCY_TIME;
4835 #define DISCHARGE_POLICY_CRITICAL 0
4836 #define DISCHARGE_POLICY_LOW 1
4837 #define NUM_DISCHARGE_POLICIES 4
4839 #define PO_THROTTLE_NONE 0
4840 #define PO_THROTTLE_CONSTANT 1
4841 #define PO_THROTTLE_DEGRADE 2
4842 #define PO_THROTTLE_ADAPTIVE 3
4844 typedef enum _POWER_ACTION {
4845 PowerActionNone = 0,
4846 PowerActionReserved,
4847 PowerActionSleep,
4848 PowerActionHibernate,
4849 PowerActionShutdown,
4850 PowerActionShutdownReset,
4851 PowerActionShutdownOff,
4852 PowerActionWarmEject
4853 } POWER_ACTION,
4854 *PPOWER_ACTION;
4856 typedef enum _SYSTEM_POWER_STATE {
4857 PowerSystemUnspecified = 0,
4858 PowerSystemWorking = 1,
4859 PowerSystemSleeping1 = 2,
4860 PowerSystemSleeping2 = 3,
4861 PowerSystemSleeping3 = 4,
4862 PowerSystemHibernate = 5,
4863 PowerSystemShutdown = 6,
4864 PowerSystemMaximum = 7
4865 } SYSTEM_POWER_STATE,
4866 *PSYSTEM_POWER_STATE;
4868 typedef enum _DEVICE_POWER_STATE {
4869 PowerDeviceUnspecified,
4870 PowerDeviceD0,
4871 PowerDeviceD1,
4872 PowerDeviceD2,
4873 PowerDeviceD3,
4874 PowerDeviceMaximum
4875 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
4877 typedef enum _POWER_INFORMATION_LEVEL {
4878 SystemPowerPolicyAc,
4879 SystemPowerPolicyDc,
4880 VerifySystemPolicyAc,
4881 VerifySystemPolicyDc,
4882 SystemPowerCapabilities,
4883 SystemBatteryState,
4884 SystemPowerStateHandler,
4885 ProcessorStateHandler,
4886 SystemPowerPolicyCurrent,
4887 AdministratorPowerPolicy,
4888 SystemReserveHiberFile,
4889 ProcessorInformation,
4890 SystemPowerInformation,
4891 ProcessorStateHandler2,
4892 LastWakeTime,
4893 LastSleepTime,
4894 SystemExecutionState,
4895 SystemPowerStateNotifyHandler,
4896 ProcessorPowerPolicyAc,
4897 ProcessorPowerPolicyDc,
4898 VerifyProcessorPowerPolicyAc,
4899 VerifyProcessorPowerPolicyDc,
4900 ProcessorPowerPolicyCurrent
4901 } POWER_INFORMATION_LEVEL;
4903 typedef struct _ADMINISTRATOR_POWER_POLICY {
4904 SYSTEM_POWER_STATE MinSleep;
4905 SYSTEM_POWER_STATE MaxSleep;
4906 ULONG MinVideoTimeout;
4907 ULONG MaxVideoTimeout;
4908 ULONG MinSpindownTimeout;
4909 ULONG MaxSpindownTimeout;
4910 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
4912 typedef struct {
4913 ULONG Granularity;
4914 ULONG Capacity;
4915 } BATTERY_REPORTING_SCALE,
4916 *PBATTERY_REPORTING_SCALE;
4918 typedef struct {
4919 POWER_ACTION Action;
4920 ULONG Flags;
4921 ULONG EventCode;
4922 } POWER_ACTION_POLICY,
4923 *PPOWER_ACTION_POLICY;
4925 typedef struct _PROCESSOR_POWER_INFORMATION {
4926 ULONG Number;
4927 ULONG MaxMhz;
4928 ULONG CurrentMhz;
4929 ULONG MhzLimit;
4930 ULONG MaxIdleState;
4931 ULONG CurrentIdleState;
4932 } PROCESSOR_POWER_INFORMATION,
4933 *PPROCESSOR_POWER_INFORMATION;
4935 typedef struct _PROCESSOR_POWER_POLICY_INFO {
4936 ULONG TimeCheck;
4937 ULONG DemoteLimit;
4938 ULONG PromoteLimit;
4939 UCHAR DemotePercent;
4940 UCHAR PromotePercent;
4941 UCHAR Spare[2];
4942 ULONG AllowDemotion:1;
4943 ULONG AllowPromotion:1;
4944 ULONG Reserved:30;
4945 } PROCESSOR_POWER_POLICY_INFO,
4946 *PPROCESSOR_POWER_POLICY_INFO;
4948 typedef struct _PROCESSOR_POWER_POLICY {
4949 DWORD Revision;
4950 BYTE DynamicThrottle;
4951 BYTE Spare[3];
4952 DWORD DisableCStates:1;
4953 DWORD Reserved:31;
4954 DWORD PolicyCount;
4955 PROCESSOR_POWER_POLICY_INFO Policy[3];
4956 } PROCESSOR_POWER_POLICY,
4957 *PPROCESSOR_POWER_POLICY;
4959 typedef struct {
4960 BOOLEAN AcOnLine;
4961 BOOLEAN BatteryPresent;
4962 BOOLEAN Charging;
4963 BOOLEAN Discharging;
4964 BOOLEAN Spare1[4];
4965 ULONG MaxCapacity;
4966 ULONG RemainingCapacity;
4967 ULONG Rate;
4968 ULONG EstimatedTime;
4969 ULONG DefaultAlert1;
4970 ULONG DefaultAlert2;
4971 } SYSTEM_BATTERY_STATE,
4972 *PSYSTEM_BATTERY_STATE;
4974 typedef struct {
4975 BOOLEAN PowerButtonPresent;
4976 BOOLEAN SleepButtonPresent;
4977 BOOLEAN LidPresent;
4978 BOOLEAN SystemS1;
4979 BOOLEAN SystemS2;
4980 BOOLEAN SystemS3;
4981 BOOLEAN SystemS4;
4982 BOOLEAN SystemS5;
4983 BOOLEAN HiberFilePresent;
4984 BOOLEAN FullWake;
4985 BOOLEAN VideoDimPresent;
4986 BOOLEAN ApmPresent;
4987 BOOLEAN UpsPresent;
4988 BOOLEAN ThermalControl;
4989 BOOLEAN ProcessorThrottle;
4990 UCHAR ProcessorMinThrottle;
4991 UCHAR ProcessorMaxThrottle;
4992 UCHAR spare2[4];
4993 BOOLEAN DiskSpinDown;
4994 UCHAR spare3[8];
4995 BOOLEAN SystemBatteriesPresent;
4996 BOOLEAN BatteriesAreShortTerm;
4997 BATTERY_REPORTING_SCALE BatteryScale[3];
4998 SYSTEM_POWER_STATE AcOnLineWake;
4999 SYSTEM_POWER_STATE SoftLidWake;
5000 SYSTEM_POWER_STATE RtcWake;
5001 SYSTEM_POWER_STATE MinDeviceWakeState;
5002 SYSTEM_POWER_STATE DefaultLowLatencyWake;
5003 } SYSTEM_POWER_CAPABILITIES,
5004 *PSYSTEM_POWER_CAPABILITIES;
5006 typedef struct _SYSTEM_POWER_INFORMATION {
5007 ULONG MaxIdlenessAllowed;
5008 ULONG Idleness;
5009 ULONG TimeRemaining;
5010 UCHAR CoolingMode;
5011 } SYSTEM_POWER_INFORMATION,
5012 *PSYSTEM_POWER_INFORMATION;
5014 typedef struct _SYSTEM_POWER_LEVEL {
5015 BOOLEAN Enable;
5016 UCHAR Spare[3];
5017 ULONG BatteryLevel;
5018 POWER_ACTION_POLICY PowerPolicy;
5019 SYSTEM_POWER_STATE MinSystemState;
5020 } SYSTEM_POWER_LEVEL,
5021 *PSYSTEM_POWER_LEVEL;
5023 typedef struct _SYSTEM_POWER_POLICY {
5024 ULONG Revision;
5025 POWER_ACTION_POLICY PowerButton;
5026 POWER_ACTION_POLICY SleepButton;
5027 POWER_ACTION_POLICY LidClose;
5028 SYSTEM_POWER_STATE LidOpenWake;
5029 ULONG Reserved;
5030 POWER_ACTION_POLICY Idle;
5031 ULONG IdleTimeout;
5032 UCHAR IdleSensitivity;
5033 UCHAR DynamicThrottle;
5034 UCHAR Spare2[2];
5035 SYSTEM_POWER_STATE MinSleep;
5036 SYSTEM_POWER_STATE MaxSleep;
5037 SYSTEM_POWER_STATE ReducedLatencySleep;
5038 ULONG WinLogonFlags;
5039 ULONG Spare3;
5040 ULONG DozeS4Timeout;
5041 ULONG BroadcastCapacityResolution;
5042 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
5043 ULONG VideoTimeout;
5044 BOOLEAN VideoDimDisplay;
5045 ULONG VideoReserved[3];
5046 ULONG SpindownTimeout;
5047 BOOLEAN OptimizeForPower;
5048 UCHAR FanThrottleTolerance;
5049 UCHAR ForcedThrottle;
5050 UCHAR MinThrottle;
5051 POWER_ACTION_POLICY OverThrottled;
5052 } SYSTEM_POWER_POLICY,
5053 *PSYSTEM_POWER_POLICY;
5055 typedef union _FILE_SEGMENT_ELEMENT {
5056 PVOID64 Buffer;
5057 ULONGLONG Alignment;
5058 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
5060 typedef struct _FILE_NOTIFY_INFORMATION {
5061 DWORD NextEntryOffset;
5062 DWORD Action;
5063 DWORD FileNameLength;
5064 WCHAR FileName[1];
5065 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
5067 /* ----------------------------- begin tape storage --------------------- */
5069 #define TAPE_FIXED_PARTITIONS 0
5070 #define TAPE_SELECT_PARTITIONS 1
5071 #define TAPE_INITIATOR_PARTITIONS 2
5072 #define TAPE_ERASE_SHORT 0
5073 #define TAPE_ERASE_LONG 1
5074 #define TAPE_LOAD 0
5075 #define TAPE_UNLOAD 1
5076 #define TAPE_TENSION 2
5077 #define TAPE_LOCK 3
5078 #define TAPE_UNLOCK 4
5079 #define TAPE_FORMAT 5
5080 #define TAPE_SETMARKS 0
5081 #define TAPE_FILEMARKS 1
5082 #define TAPE_SHORT_FILEMARKS 2
5083 #define TAPE_LONG_FILEMARKS 3
5084 #define TAPE_REWIND 0
5085 #define TAPE_ABSOLUTE_BLOCK 1
5086 #define TAPE_LOGICAL_BLOCK 2
5087 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
5088 #define TAPE_SPACE_END_OF_DATA 4
5089 #define TAPE_SPACE_RELATIVE_BLOCKS 5
5090 #define TAPE_SPACE_FILEMARKS 6
5091 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
5092 #define TAPE_SPACE_SETMARKS 8
5093 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
5095 typedef struct _TAPE_CREATE_PARTITION {
5096 DWORD Method;
5097 DWORD Count;
5098 DWORD Size;
5099 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
5101 typedef struct _TAPE_ERASE {
5102 DWORD Type;
5103 BOOLEAN Immediate;
5104 } TAPE_ERASE, *PTAPE_ERASE;
5106 typedef struct _TAPE_PREPARE {
5107 DWORD Operation;
5108 BOOLEAN Immediate;
5109 } TAPE_PREPARE, *PTAPE_PREPARE;
5111 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
5112 BOOLEAN ECC;
5113 BOOLEAN Compression;
5114 BOOLEAN DataPadding;
5115 BOOLEAN ReportSetmarks;
5116 ULONG EOTWarningZoneSize;
5117 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
5119 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
5120 ULONG BlockSize;
5121 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
5123 typedef struct _TAPE_WRITE_MARKS {
5124 DWORD Type;
5125 DWORD Count;
5126 BOOLEAN Immediate;
5127 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
5129 typedef struct _TAPE_GET_POSITION {
5130 ULONG Type;
5131 ULONG Partition;
5132 ULONG OffsetLow;
5133 ULONG OffsetHigh;
5134 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
5136 typedef struct _TAPE_SET_POSITION {
5137 ULONG Method;
5138 ULONG Partition;
5139 LARGE_INTEGER Offset;
5140 BOOLEAN Immediate;
5141 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
5143 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
5144 BOOLEAN ECC;
5145 BOOLEAN Compression;
5146 BOOLEAN DataPadding;
5147 BOOLEAN ReportSetmarks;
5148 DWORD DefaultBlockSize;
5149 DWORD MaximumBlockSize;
5150 DWORD MinimumBlockSize;
5151 DWORD MaximumPartitionCount;
5152 DWORD FeaturesLow;
5153 DWORD FeaturesHigh;
5154 DWORD EOTWarningZoneSize;
5155 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
5157 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
5158 LARGE_INTEGER Capacity;
5159 LARGE_INTEGER Remaining;
5160 DWORD BlockSize;
5161 DWORD PartitionCount;
5162 BOOLEAN WriteProtected;
5163 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
5165 /* ----------------------------- begin registry ----------------------------- */
5167 /* Registry security values */
5168 #define OWNER_SECURITY_INFORMATION 0x00000001
5169 #define GROUP_SECURITY_INFORMATION 0x00000002
5170 #define DACL_SECURITY_INFORMATION 0x00000004
5171 #define SACL_SECURITY_INFORMATION 0x00000008
5173 #define REG_OPTION_RESERVED 0x00000000
5174 #define REG_OPTION_NON_VOLATILE 0x00000000
5175 #define REG_OPTION_VOLATILE 0x00000001
5176 #define REG_OPTION_CREATE_LINK 0x00000002
5177 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
5178 #define REG_OPTION_OPEN_LINK 0x00000008
5179 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
5180 REG_OPTION_NON_VOLATILE| \
5181 REG_OPTION_VOLATILE| \
5182 REG_OPTION_CREATE_LINK| \
5183 REG_OPTION_BACKUP_RESTORE| \
5184 REG_OPTION_OPEN_LINK)
5187 #define REG_CREATED_NEW_KEY 0x00000001
5188 #define REG_OPENED_EXISTING_KEY 0x00000002
5190 /* For RegNotifyChangeKeyValue */
5191 #define REG_NOTIFY_CHANGE_NAME 0x01
5192 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
5193 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
5194 #define REG_NOTIFY_CHANGE_SECURITY 0x08
5196 #define KEY_QUERY_VALUE 0x00000001
5197 #define KEY_SET_VALUE 0x00000002
5198 #define KEY_CREATE_SUB_KEY 0x00000004
5199 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
5200 #define KEY_NOTIFY 0x00000010
5201 #define KEY_CREATE_LINK 0x00000020
5202 #define KEY_WOW64_64KEY 0x00000100
5203 #define KEY_WOW64_32KEY 0x00000200
5204 #define KEY_WOW64_RES 0x00000300
5206 /* for RegKeyRestore flags */
5207 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
5208 #define REG_REFRESH_HIVE 0x00000002
5209 #define REG_NO_LAZY_FLUSH 0x00000004
5210 #define REG_FORCE_RESTORE 0x00000008
5212 #define KEY_READ ((STANDARD_RIGHTS_READ| \
5213 KEY_QUERY_VALUE| \
5214 KEY_ENUMERATE_SUB_KEYS| \
5215 KEY_NOTIFY) \
5216 & (~SYNCHRONIZE) \
5218 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
5219 KEY_SET_VALUE| \
5220 KEY_CREATE_SUB_KEY) \
5221 & (~SYNCHRONIZE) \
5223 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
5224 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
5225 KEY_QUERY_VALUE| \
5226 KEY_SET_VALUE| \
5227 KEY_CREATE_SUB_KEY| \
5228 KEY_ENUMERATE_SUB_KEYS| \
5229 KEY_NOTIFY| \
5230 KEY_CREATE_LINK) \
5231 & (~SYNCHRONIZE) \
5233 /* ------------------------------ end registry ------------------------------ */
5236 #define EVENTLOG_SUCCESS 0x0000
5237 #define EVENTLOG_ERROR_TYPE 0x0001
5238 #define EVENTLOG_WARNING_TYPE 0x0002
5239 #define EVENTLOG_INFORMATION_TYPE 0x0004
5240 #define EVENTLOG_AUDIT_SUCCESS 0x0008
5241 #define EVENTLOG_AUDIT_FAILURE 0x0010
5243 #define EVENTLOG_SEQUENTIAL_READ 0x0001
5244 #define EVENTLOG_SEEK_READ 0x0002
5245 #define EVENTLOG_FORWARDS_READ 0x0004
5246 #define EVENTLOG_BACKWARDS_READ 0x0008
5248 typedef struct _EVENTLOGRECORD {
5249 DWORD Length;
5250 DWORD Reserved;
5251 DWORD RecordNumber;
5252 DWORD TimeGenerated;
5253 DWORD TimeWritten;
5254 DWORD EventID;
5255 WORD EventType;
5256 WORD NumStrings;
5257 WORD EventCategory;
5258 WORD ReservedFlags;
5259 DWORD ClosingRecordNumber;
5260 DWORD StringOffset;
5261 DWORD UserSidLength;
5262 DWORD UserSidOffset;
5263 DWORD DataLength;
5264 DWORD DataOffset;
5265 } EVENTLOGRECORD, *PEVENTLOGRECORD;
5267 #define SERVICE_BOOT_START 0x00000000
5268 #define SERVICE_SYSTEM_START 0x00000001
5269 #define SERVICE_AUTO_START 0x00000002
5270 #define SERVICE_DEMAND_START 0x00000003
5271 #define SERVICE_DISABLED 0x00000004
5273 #define SERVICE_ERROR_IGNORE 0x00000000
5274 #define SERVICE_ERROR_NORMAL 0x00000001
5275 #define SERVICE_ERROR_SEVERE 0x00000002
5276 #define SERVICE_ERROR_CRITICAL 0x00000003
5278 /* Service types */
5279 #define SERVICE_KERNEL_DRIVER 0x00000001
5280 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
5281 #define SERVICE_ADAPTER 0x00000004
5282 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
5284 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
5285 SERVICE_RECOGNIZER_DRIVER )
5287 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
5288 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
5289 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
5291 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
5293 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
5294 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
5297 typedef enum _CM_SERVICE_NODE_TYPE
5299 DriverType = SERVICE_KERNEL_DRIVER,
5300 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
5301 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
5302 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
5303 AdapterType = SERVICE_ADAPTER,
5304 RecognizerType = SERVICE_RECOGNIZER_DRIVER
5305 } SERVICE_NODE_TYPE;
5307 typedef enum _CM_SERVICE_LOAD_TYPE
5309 BootLoad = SERVICE_BOOT_START,
5310 SystemLoad = SERVICE_SYSTEM_START,
5311 AutoLoad = SERVICE_AUTO_START,
5312 DemandLoad = SERVICE_DEMAND_START,
5313 DisableLoad = SERVICE_DISABLED
5314 } SERVICE_LOAD_TYPE;
5316 typedef enum _CM_ERROR_CONTROL_TYPE
5318 IgnoreError = SERVICE_ERROR_IGNORE,
5319 NormalError = SERVICE_ERROR_NORMAL,
5320 SevereError = SERVICE_ERROR_SEVERE,
5321 CriticalError = SERVICE_ERROR_CRITICAL
5322 } SERVICE_ERROR_TYPE;
5326 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
5327 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
5328 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
5329 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
5330 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
5332 #include <guiddef.h>
5334 typedef struct _OBJECT_TYPE_LIST {
5335 WORD Level;
5336 WORD Sbz;
5337 GUID *ObjectType;
5338 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
5340 typedef struct _RTL_CRITICAL_SECTION_DEBUG
5342 WORD Type;
5343 WORD CreatorBackTraceIndex;
5344 struct _RTL_CRITICAL_SECTION *CriticalSection;
5345 LIST_ENTRY ProcessLocksList;
5346 DWORD EntryCount;
5347 DWORD ContentionCount;
5348 #ifdef __WINESRC__ /* in Wine we store the name here */
5349 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
5350 #else
5351 DWORD Spare[ 2 ];
5352 #endif
5353 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
5355 typedef struct _RTL_CRITICAL_SECTION {
5356 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
5357 LONG LockCount;
5358 LONG RecursionCount;
5359 HANDLE OwningThread;
5360 HANDLE LockSemaphore;
5361 ULONG_PTR SpinCount;
5362 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
5364 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
5365 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
5366 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
5367 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
5368 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
5370 typedef struct _RTL_SRWLOCK {
5371 PVOID Ptr;
5372 } RTL_SRWLOCK, *PRTL_SRWLOCK;
5374 #define RTL_SRWLOCK_INIT {0}
5376 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
5377 typedef VOID (NTAPI * PFLS_CALLBACK_FUNCTION) ( PVOID );
5379 #include <pshpack8.h>
5380 typedef struct _IO_COUNTERS {
5381 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
5382 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
5383 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
5384 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
5385 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
5386 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
5387 } IO_COUNTERS, *PIO_COUNTERS;
5388 #include <poppack.h>
5390 typedef struct {
5391 DWORD dwOSVersionInfoSize;
5392 DWORD dwMajorVersion;
5393 DWORD dwMinorVersion;
5394 DWORD dwBuildNumber;
5395 DWORD dwPlatformId;
5396 CHAR szCSDVersion[128];
5397 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
5399 typedef struct {
5400 DWORD dwOSVersionInfoSize;
5401 DWORD dwMajorVersion;
5402 DWORD dwMinorVersion;
5403 DWORD dwBuildNumber;
5404 DWORD dwPlatformId;
5405 WCHAR szCSDVersion[128];
5406 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
5408 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
5409 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
5410 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
5412 typedef struct {
5413 DWORD dwOSVersionInfoSize;
5414 DWORD dwMajorVersion;
5415 DWORD dwMinorVersion;
5416 DWORD dwBuildNumber;
5417 DWORD dwPlatformId;
5418 CHAR szCSDVersion[128];
5419 WORD wServicePackMajor;
5420 WORD wServicePackMinor;
5421 WORD wSuiteMask;
5422 BYTE wProductType;
5423 BYTE wReserved;
5424 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
5426 typedef struct {
5427 DWORD dwOSVersionInfoSize;
5428 DWORD dwMajorVersion;
5429 DWORD dwMinorVersion;
5430 DWORD dwBuildNumber;
5431 DWORD dwPlatformId;
5432 WCHAR szCSDVersion[128];
5433 WORD wServicePackMajor;
5434 WORD wServicePackMinor;
5435 WORD wSuiteMask;
5436 BYTE wProductType;
5437 BYTE wReserved;
5438 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
5440 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
5441 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
5442 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
5444 NTSYSAPI ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
5446 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5448 #define VER_PLATFORM_WIN32s 0
5449 #define VER_PLATFORM_WIN32_WINDOWS 1
5450 #define VER_PLATFORM_WIN32_NT 2
5452 #define VER_MINORVERSION 0x00000001
5453 #define VER_MAJORVERSION 0x00000002
5454 #define VER_BUILDNUMBER 0x00000004
5455 #define VER_PLATFORMID 0x00000008
5456 #define VER_SERVICEPACKMINOR 0x00000010
5457 #define VER_SERVICEPACKMAJOR 0x00000020
5458 #define VER_SUITENAME 0x00000040
5459 #define VER_PRODUCT_TYPE 0x00000080
5461 #define VER_NT_WORKSTATION 1
5462 #define VER_NT_DOMAIN_CONTROLLER 2
5463 #define VER_NT_SERVER 3
5465 #define VER_SUITE_SMALLBUSINESS 0x00000001
5466 #define VER_SUITE_ENTERPRISE 0x00000002
5467 #define VER_SUITE_BACKOFFICE 0x00000004
5468 #define VER_SUITE_COMMUNICATIONS 0x00000008
5469 #define VER_SUITE_TERMINAL 0x00000010
5470 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5471 #define VER_SUITE_EMBEDDEDNT 0x00000040
5472 #define VER_SUITE_DATACENTER 0x00000080
5473 #define VER_SUITE_SINGLEUSERTS 0x00000100
5474 #define VER_SUITE_PERSONAL 0x00000200
5475 #define VER_SUITE_BLADE 0x00000400
5476 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5477 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5478 #define VER_SUITE_STORAGE_SERVER 0x00002000
5479 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5480 #define VER_SUITE_WH_SERVER 0x00008000
5482 #define VER_EQUAL 1
5483 #define VER_GREATER 2
5484 #define VER_GREATER_EQUAL 3
5485 #define VER_LESS 4
5486 #define VER_LESS_EQUAL 5
5487 #define VER_AND 6
5488 #define VER_OR 7
5490 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
5491 DWORD dwFlags;
5492 DWORD ulFormatVersion;
5493 DWORD ulAssemblyCount;
5494 DWORD ulRootManifestPathType;
5495 DWORD ulRootManifestPathChars;
5496 DWORD ulRootConfigurationPathType;
5497 DWORD ulRootConfigurationPathChars;
5498 DWORD ulAppDirPathType;
5499 DWORD ulAppDirPathChars;
5500 PCWSTR lpRootManifestPath;
5501 PCWSTR lpRootConfigurationPath;
5502 PCWSTR lpAppDirPath;
5503 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
5505 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
5506 DWORD ulFlags;
5507 DWORD ulEncodedAssemblyIdentityLength;
5508 DWORD ulManifestPathType;
5509 DWORD ulManifestPathLength;
5510 LARGE_INTEGER liManifestLastWriteTime;
5511 DWORD ulPolicyPathType;
5512 DWORD ulPolicyPathLength;
5513 LARGE_INTEGER liPolicyLastWriteTime;
5514 DWORD ulMetadataSatelliteRosterIndex;
5515 DWORD ulManifestVersionMajor;
5516 DWORD ulManifestVersionMinor;
5517 DWORD ulPolicyVersionMajor;
5518 DWORD ulPolicyVersionMinor;
5519 DWORD ulAssemblyDirectoryNameLength;
5520 PCWSTR lpAssemblyEncodedAssemblyIdentity;
5521 PCWSTR lpAssemblyManifestPath;
5522 PCWSTR lpAssemblyPolicyPath;
5523 PCWSTR lpAssemblyDirectoryName;
5524 DWORD ulFileCount;
5525 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
5527 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
5528 DWORD ulAssemblyIndex;
5529 DWORD ulFileIndexInAssembly;
5530 } ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
5532 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
5534 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
5535 DWORD ulFlags;
5536 DWORD ulFilenameLength;
5537 DWORD ulPathLength;
5538 PCWSTR lpFileName;
5539 PCWSTR lpFilePath;
5540 } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
5542 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
5544 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
5545 ActivationContextBasicInformation = 1,
5546 ActivationContextDetailedInformation = 2,
5547 AssemblyDetailedInformationInActivationContext = 3,
5548 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
5549 MaxActivationContextInfoClass,
5551 AssemblyDetailedInformationInActivationContxt = 3,
5552 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
5553 } ACTIVATION_CONTEXT_INFO_CLASS;
5555 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5556 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5557 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5558 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5560 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5561 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5562 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5563 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5564 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5565 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5566 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5567 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5568 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5570 typedef enum _JOBOBJECTINFOCLASS
5572 JobObjectBasicAccountingInformation = 1,
5573 JobObjectBasicLimitInformation,
5574 JobObjectBasicProcessIdList,
5575 JobObjectBasicUIRestrictions,
5576 JobObjectSecurityLimitInformation,
5577 JobObjectEndOfJobTimeInformation,
5578 JobObjectAssociateCompletionPortInformation,
5579 JobObjectBasicAndIoAccountingInformation,
5580 JobObjectExtendedLimitInformation,
5581 JobObjectJobSetInformation,
5582 MaxJobObjectInfoClass
5583 } JOBOBJECTINFOCLASS;
5585 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5587 RelationProcessorCore = 0,
5588 RelationNumaNode = 1,
5589 RelationCache = 2,
5590 RelationProcessorPackage = 3,
5591 RelationGroup = 4,
5592 RelationAll = 0xffff
5593 } LOGICAL_PROCESSOR_RELATIONSHIP;
5595 typedef enum _PROCESSOR_CACHE_TYPE
5597 CacheUnified,
5598 CacheInstruction,
5599 CacheData,
5600 CacheTrace
5601 } PROCESSOR_CACHE_TYPE;
5603 typedef struct _PROCESSOR_GROUP_INFO
5605 BYTE MaximumProcessorCount;
5606 BYTE ActiveProcessorCount;
5607 BYTE Reserved[38];
5608 KAFFINITY ActiveProcessorMask;
5609 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
5611 typedef struct _CACHE_DESCRIPTOR
5613 BYTE Level;
5614 BYTE Associativity;
5615 WORD LineSize;
5616 DWORD Size;
5617 PROCESSOR_CACHE_TYPE Type;
5618 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
5620 typedef struct _GROUP_AFFINITY
5622 KAFFINITY Mask;
5623 WORD Group;
5624 WORD Reserved[3];
5625 } GROUP_AFFINITY, *PGROUP_AFFINITY;
5627 typedef struct _PROCESSOR_RELATIONSHIP
5629 BYTE Flags;
5630 BYTE Reserved[21];
5631 WORD GroupCount;
5632 GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
5633 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
5636 typedef struct _NUMA_NODE_RELATIONSHIP
5638 DWORD NodeNumber;
5639 BYTE Reserved[20];
5640 GROUP_AFFINITY GroupMask;
5641 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
5643 typedef struct _CACHE_RELATIONSHIP
5645 BYTE Level;
5646 BYTE Associativity;
5647 WORD LineSize;
5648 PROCESSOR_CACHE_TYPE Type;
5649 BYTE Reserved[20];
5650 GROUP_AFFINITY GroupMask;
5651 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
5653 typedef struct _GROUP_RELATIONSHIP
5655 WORD MaximumGroupCount;
5656 WORD ActiveGroupCount;
5657 BYTE Reserved[20];
5658 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
5659 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
5661 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5663 ULONG_PTR ProcessorMask;
5664 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5665 union
5667 struct
5669 BYTE Flags;
5670 } ProcessorCore;
5671 struct
5673 DWORD NodeNumber;
5674 } NumaNode;
5675 CACHE_DESCRIPTOR Cache;
5676 ULONGLONG Reserved[2];
5677 } DUMMYUNIONNAME;
5678 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
5680 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5682 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5683 DWORD Size;
5684 union
5686 PROCESSOR_RELATIONSHIP Processor;
5687 NUMA_NODE_RELATIONSHIP NumaNode;
5688 CACHE_RELATIONSHIP Cache;
5689 GROUP_RELATIONSHIP Group;
5690 } DUMMYUNIONNAME;
5691 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
5693 NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
5695 #ifdef __cplusplus
5697 #endif
5699 #endif /* _WINNT_ */