wshom.ocx: Implement IWshShortcut_put_WorkingDirectory().
[wine.git] / include / winnt.h
blobfc471b83a40fc5e77eac4005944c7062432da5a4
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 # else /* UNICODE */
461 # ifndef _TCHAR_DEFINED
462 typedef CHAR TCHAR, *PTCHAR;
463 # define _TCHAR_DEFINED
464 # endif
465 typedef LPSTR PTSTR, LPTSTR;
466 typedef LPCSTR PCTSTR, LPCTSTR;
467 typedef PZZWSTR PZZTSTR;
468 typedef PCZZWSTR PCZZTSTR;
469 # endif /* UNICODE */
470 #endif /* WINE_NO_UNICODE_MACROS */
472 /* Misc common WIN32 types */
473 typedef char CCHAR;
474 typedef DWORD LCID, *PLCID;
475 typedef WORD LANGID;
476 typedef DWORD EXECUTION_STATE;
477 #ifndef _HRESULT_DEFINED
478 #define _HRESULT_DEFINED
479 typedef LONG HRESULT;
480 #endif
482 /* Handle type */
484 typedef void *HANDLE;
485 typedef HANDLE *PHANDLE, *LPHANDLE;
487 #ifdef STRICT
488 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
489 #else /*STRICT*/
490 #define DECLARE_HANDLE(a) typedef HANDLE a
491 #endif /*STRICT*/
493 typedef BYTE FCHAR;
494 typedef WORD FSHORT;
495 typedef DWORD FLONG;
497 /* Macro to deal with LP64 <=> LLP64 differences in numeric constants with 'l' modifier */
498 #ifndef __MSABI_LONG
499 # if defined(_MSC_VER) || defined(__MINGW32__) || defined(__CYGWIN__)
500 # define __MSABI_LONG(x) x ## l
501 # else
502 # define __MSABI_LONG(x) x
503 # endif
504 #endif
506 /* Defines */
508 #ifndef WIN32_NO_STATUS
510 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
511 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
512 #define STATUS_USER_APC ((DWORD) 0x000000C0)
513 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
514 #define STATUS_PENDING ((DWORD) 0x00000103)
515 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
516 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
517 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
518 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
519 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
520 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
521 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
522 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
523 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
524 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
525 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
526 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
527 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
528 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
529 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
530 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
531 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
532 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
533 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
534 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
535 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
536 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
537 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
538 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
539 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
540 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
541 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
542 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
543 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
544 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
546 /* status values for ContinueDebugEvent */
547 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
548 #define DBG_CONTINUE ((DWORD) 0x00010002)
549 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
550 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
551 #define DBG_CONTROL_C ((DWORD) 0x40010005)
552 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
553 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
554 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
556 #endif /* WIN32_NO_STATUS */
558 /* Argument 1 passed to the DllEntryProc. */
559 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
560 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
561 #define DLL_THREAD_ATTACH 2 /* attach new thread */
562 #define DLL_THREAD_DETACH 3 /* detach thread */
563 #ifdef __WINESRC__
564 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
565 #endif
567 /* u.x.wProcessorArchitecture (NT) */
568 #define PROCESSOR_ARCHITECTURE_INTEL 0
569 #define PROCESSOR_ARCHITECTURE_MIPS 1
570 #define PROCESSOR_ARCHITECTURE_ALPHA 2
571 #define PROCESSOR_ARCHITECTURE_PPC 3
572 #define PROCESSOR_ARCHITECTURE_SHX 4
573 #define PROCESSOR_ARCHITECTURE_ARM 5
574 #define PROCESSOR_ARCHITECTURE_IA64 6
575 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
576 #define PROCESSOR_ARCHITECTURE_MSIL 8
577 #define PROCESSOR_ARCHITECTURE_AMD64 9
578 #define PROCESSOR_ARCHITECTURE_IA32_ON_WIN64 10
579 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
581 /* Wine extension */
582 #define PROCESSOR_ARCHITECTURE_SPARC 20
584 /* dwProcessorType */
585 #define PROCESSOR_INTEL_386 386
586 #define PROCESSOR_INTEL_486 486
587 #define PROCESSOR_INTEL_PENTIUM 586
588 #define PROCESSOR_INTEL_860 860
589 #define PROCESSOR_INTEL_IA64 2200
590 #define PROCESSOR_AMD_X8664 8664
591 #define PROCESSOR_MIPS_R2000 2000
592 #define PROCESSOR_MIPS_R3000 3000
593 #define PROCESSOR_MIPS_R4000 4000
594 #define PROCESSOR_ALPHA_21064 21064
595 #define PROCESSOR_PPC_601 601
596 #define PROCESSOR_PPC_603 603
597 #define PROCESSOR_PPC_604 604
598 #define PROCESSOR_PPC_620 620
599 #define PROCESSOR_HITACHI_SH3 10003
600 #define PROCESSOR_HITACHI_SH3E 10004
601 #define PROCESSOR_HITACHI_SH4 10005
602 #define PROCESSOR_MOTOROLA_821 821
603 #define PROCESSOR_SHx_SH3 103
604 #define PROCESSOR_SHx_SH4 104
605 #define PROCESSOR_STRONGARM 2577
606 #define PROCESSOR_ARM720 1824 /* 0x720 */
607 #define PROCESSOR_ARM820 2080 /* 0x820 */
608 #define PROCESSOR_ARM920 2336 /* 0x920 */
609 #define PROCESSOR_ARM_7TDMI 70001
610 #define PROCESSOR_OPTIL 18767
612 #ifdef _WIN64
613 #define MAXIMUM_PROCESSORS 64
614 #else
615 #define MAXIMUM_PROCESSORS 32
616 #endif
618 typedef struct _MEMORY_BASIC_INFORMATION
620 LPVOID BaseAddress;
621 LPVOID AllocationBase;
622 DWORD AllocationProtect;
623 SIZE_T RegionSize;
624 DWORD State;
625 DWORD Protect;
626 DWORD Type;
627 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
629 #define PAGE_NOACCESS 0x01
630 #define PAGE_READONLY 0x02
631 #define PAGE_READWRITE 0x04
632 #define PAGE_WRITECOPY 0x08
633 #define PAGE_EXECUTE 0x10
634 #define PAGE_EXECUTE_READ 0x20
635 #define PAGE_EXECUTE_READWRITE 0x40
636 #define PAGE_EXECUTE_WRITECOPY 0x80
637 #define PAGE_GUARD 0x100
638 #define PAGE_NOCACHE 0x200
639 #define PAGE_WRITECOMBINE 0x400
641 #define MEM_COMMIT 0x00001000
642 #define MEM_RESERVE 0x00002000
643 #define MEM_DECOMMIT 0x00004000
644 #define MEM_RELEASE 0x00008000
645 #define MEM_FREE 0x00010000
646 #define MEM_PRIVATE 0x00020000
647 #define MEM_MAPPED 0x00040000
648 #define MEM_RESET 0x00080000
649 #define MEM_TOP_DOWN 0x00100000
650 #define MEM_WRITE_WATCH 0x00200000
651 #define MEM_PHYSICAL 0x00400000
652 #define MEM_LARGE_PAGES 0x20000000
653 #define MEM_4MB_PAGES 0x80000000
655 #define SEC_FILE 0x00800000
656 #define SEC_IMAGE 0x01000000
657 #define SEC_RESERVE 0x04000000
658 #define SEC_COMMIT 0x08000000
659 #define SEC_NOCACHE 0x10000000
660 #define SEC_LARGE_PAGES 0x80000000
661 #define MEM_IMAGE SEC_IMAGE
663 #define WRITE_WATCH_FLAG_RESET 0x00000001
666 #define MINCHAR 0x80
667 #define MAXCHAR 0x7f
668 #define MINSHORT 0x8000
669 #define MAXSHORT 0x7fff
670 #define MINLONG 0x80000000
671 #define MAXLONG 0x7fffffff
672 #define MAXBYTE 0xff
673 #define MAXWORD 0xffff
674 #define MAXDWORD 0xffffffff
676 #define UNICODE_STRING_MAX_CHARS 32767
678 #define FIELD_OFFSET(type, field) \
679 ((LONG)(INT_PTR)&(((type *)0)->field))
681 #define CONTAINING_RECORD(address, type, field) \
682 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
684 /* Types */
686 typedef struct _LIST_ENTRY {
687 struct _LIST_ENTRY *Flink;
688 struct _LIST_ENTRY *Blink;
689 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
691 typedef struct _SINGLE_LIST_ENTRY {
692 struct _SINGLE_LIST_ENTRY *Next;
693 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
695 #ifdef _WIN64
697 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY;
698 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
699 PSLIST_ENTRY Next;
700 } SLIST_ENTRY;
702 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
703 struct {
704 ULONGLONG Alignment;
705 ULONGLONG Region;
706 } DUMMYSTRUCTNAME;
707 struct {
708 ULONGLONG Depth:16;
709 ULONGLONG Sequence:9;
710 ULONGLONG NextEntry:39;
711 ULONGLONG HeaderType:1;
712 ULONGLONG Init:1;
713 ULONGLONG Reserved:59;
714 ULONGLONG Region:3;
715 } Header8;
716 struct {
717 ULONGLONG Depth:16;
718 ULONGLONG Sequence:48;
719 ULONGLONG HeaderType:1;
720 ULONGLONG Init:1;
721 ULONGLONG Reserved:2;
722 ULONGLONG NextEntry:60;
723 } Header16;
724 } SLIST_HEADER, *PSLIST_HEADER;
726 #else
728 #undef SLIST_ENTRY /* for Mac OS */
729 #define SLIST_ENTRY SINGLE_LIST_ENTRY
730 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
731 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
733 typedef union _SLIST_HEADER {
734 ULONGLONG Alignment;
735 struct {
736 SLIST_ENTRY Next;
737 WORD Depth;
738 WORD Sequence;
739 } DUMMYSTRUCTNAME;
740 } SLIST_HEADER, *PSLIST_HEADER;
742 #endif
744 NTSYSAPI PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER*);
745 NTSYSAPI VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER);
746 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER);
747 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER);
748 NTSYSAPI PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
749 NTSYSAPI WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
752 /* Heap flags */
754 #define HEAP_NO_SERIALIZE 0x00000001
755 #define HEAP_GROWABLE 0x00000002
756 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
757 #define HEAP_ZERO_MEMORY 0x00000008
758 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
759 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
760 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
761 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
762 #define HEAP_CREATE_ALIGN_16 0x00010000
763 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
764 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
766 /* This flag allows it to create heaps shared by all processes under win95,
767 FIXME: correct name */
768 #define HEAP_SHARED 0x04000000
770 typedef enum _HEAP_INFORMATION_CLASS {
771 HeapCompatibilityInformation,
772 } HEAP_INFORMATION_CLASS;
774 /* Processor feature flags. */
775 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
776 #define PF_FLOATING_POINT_EMULATED 1
777 #define PF_COMPARE_EXCHANGE_DOUBLE 2
778 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
779 #define PF_PPC_MOVEMEM_64BIT_OK 4
780 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
781 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
782 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
783 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
784 #define PF_PAE_ENABLED 9
785 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
786 #define PF_SSE_DAZ_MODE_AVAILABLE 11
787 #define PF_NX_ENABLED 12
788 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13
789 #define PF_COMPARE_EXCHANGE128 14
790 #define PF_COMPARE64_EXCHANGE128 15
791 #define PF_CHANNELS_ENABLED 16
792 #define PF_XSAVE_ENABLED 17
795 /* Execution state flags */
796 #define ES_SYSTEM_REQUIRED 0x00000001
797 #define ES_DISPLAY_REQUIRED 0x00000002
798 #define ES_USER_PRESENT 0x00000004
799 #define ES_CONTINUOUS 0x80000000
801 /* The Win32 register context */
803 /* i386 context definitions */
804 #ifdef __i386__
806 #define SIZE_OF_80387_REGISTERS 80
808 typedef struct _FLOATING_SAVE_AREA
810 DWORD ControlWord;
811 DWORD StatusWord;
812 DWORD TagWord;
813 DWORD ErrorOffset;
814 DWORD ErrorSelector;
815 DWORD DataOffset;
816 DWORD DataSelector;
817 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
818 DWORD Cr0NpxState;
819 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
821 #define MAXIMUM_SUPPORTED_EXTENSION 512
823 typedef struct _CONTEXT
825 DWORD ContextFlags;
827 /* These are selected by CONTEXT_DEBUG_REGISTERS */
828 DWORD Dr0;
829 DWORD Dr1;
830 DWORD Dr2;
831 DWORD Dr3;
832 DWORD Dr6;
833 DWORD Dr7;
835 /* These are selected by CONTEXT_FLOATING_POINT */
836 FLOATING_SAVE_AREA FloatSave;
838 /* These are selected by CONTEXT_SEGMENTS */
839 DWORD SegGs;
840 DWORD SegFs;
841 DWORD SegEs;
842 DWORD SegDs;
844 /* These are selected by CONTEXT_INTEGER */
845 DWORD Edi;
846 DWORD Esi;
847 DWORD Ebx;
848 DWORD Edx;
849 DWORD Ecx;
850 DWORD Eax;
852 /* These are selected by CONTEXT_CONTROL */
853 DWORD Ebp;
854 DWORD Eip;
855 DWORD SegCs;
856 DWORD EFlags;
857 DWORD Esp;
858 DWORD SegSs;
860 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
861 } CONTEXT;
863 #define CONTEXT_X86 0x00010000
864 #define CONTEXT_i386 CONTEXT_X86
865 #define CONTEXT_i486 CONTEXT_X86
867 #define CONTEXT_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
868 #define CONTEXT_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
869 #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
870 #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x0008) /* 387 state */
871 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010) /* DB 0-3,6,7 */
872 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386 | 0x0020)
873 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS)
874 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \
875 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | CONTEXT_EXTENDED_REGISTERS)
877 #define EXCEPTION_READ_FAULT 0
878 #define EXCEPTION_WRITE_FAULT 1
879 #define EXCEPTION_EXECUTE_FAULT 8
881 #endif /* __i386__ */
883 typedef struct _LDT_ENTRY {
884 WORD LimitLow;
885 WORD BaseLow;
886 union {
887 struct {
888 BYTE BaseMid;
889 BYTE Flags1;
890 BYTE Flags2;
891 BYTE BaseHi;
892 } Bytes;
893 struct {
894 unsigned BaseMid: 8;
895 unsigned Type : 5;
896 unsigned Dpl : 2;
897 unsigned Pres : 1;
898 unsigned LimitHi : 4;
899 unsigned Sys : 1;
900 unsigned Reserved_0 : 1;
901 unsigned Default_Big : 1;
902 unsigned Granularity : 1;
903 unsigned BaseHi : 8;
904 } Bits;
905 } HighWord;
906 } LDT_ENTRY, *PLDT_ENTRY;
908 /* x86-64 context definitions */
909 #if defined(__x86_64__)
911 #define CONTEXT_AMD64 0x00100000
913 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
914 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
915 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
916 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008)
917 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010)
918 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
919 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
921 #define EXCEPTION_READ_FAULT 0
922 #define EXCEPTION_WRITE_FAULT 1
923 #define EXCEPTION_EXECUTE_FAULT 8
925 typedef struct DECLSPEC_ALIGN(16) _M128A {
926 ULONGLONG Low;
927 LONGLONG High;
928 } M128A, *PM128A;
930 typedef struct _XMM_SAVE_AREA32 {
931 WORD ControlWord; /* 000 */
932 WORD StatusWord; /* 002 */
933 BYTE TagWord; /* 004 */
934 BYTE Reserved1; /* 005 */
935 WORD ErrorOpcode; /* 006 */
936 DWORD ErrorOffset; /* 008 */
937 WORD ErrorSelector; /* 00c */
938 WORD Reserved2; /* 00e */
939 DWORD DataOffset; /* 010 */
940 WORD DataSelector; /* 014 */
941 WORD Reserved3; /* 016 */
942 DWORD MxCsr; /* 018 */
943 DWORD MxCsr_Mask; /* 01c */
944 M128A FloatRegisters[8]; /* 020 */
945 M128A XmmRegisters[16]; /* 0a0 */
946 BYTE Reserved4[96]; /* 1a0 */
947 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
949 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
950 DWORD64 P1Home; /* 000 */
951 DWORD64 P2Home; /* 008 */
952 DWORD64 P3Home; /* 010 */
953 DWORD64 P4Home; /* 018 */
954 DWORD64 P5Home; /* 020 */
955 DWORD64 P6Home; /* 028 */
957 /* Control flags */
958 DWORD ContextFlags; /* 030 */
959 DWORD MxCsr; /* 034 */
961 /* Segment */
962 WORD SegCs; /* 038 */
963 WORD SegDs; /* 03a */
964 WORD SegEs; /* 03c */
965 WORD SegFs; /* 03e */
966 WORD SegGs; /* 040 */
967 WORD SegSs; /* 042 */
968 DWORD EFlags; /* 044 */
970 /* Debug */
971 DWORD64 Dr0; /* 048 */
972 DWORD64 Dr1; /* 050 */
973 DWORD64 Dr2; /* 058 */
974 DWORD64 Dr3; /* 060 */
975 DWORD64 Dr6; /* 068 */
976 DWORD64 Dr7; /* 070 */
978 /* Integer */
979 DWORD64 Rax; /* 078 */
980 DWORD64 Rcx; /* 080 */
981 DWORD64 Rdx; /* 088 */
982 DWORD64 Rbx; /* 090 */
983 DWORD64 Rsp; /* 098 */
984 DWORD64 Rbp; /* 0a0 */
985 DWORD64 Rsi; /* 0a8 */
986 DWORD64 Rdi; /* 0b0 */
987 DWORD64 R8; /* 0b8 */
988 DWORD64 R9; /* 0c0 */
989 DWORD64 R10; /* 0c8 */
990 DWORD64 R11; /* 0d0 */
991 DWORD64 R12; /* 0d8 */
992 DWORD64 R13; /* 0e0 */
993 DWORD64 R14; /* 0e8 */
994 DWORD64 R15; /* 0f0 */
996 /* Counter */
997 DWORD64 Rip; /* 0f8 */
999 /* Floating point */
1000 union {
1001 XMM_SAVE_AREA32 FltSave; /* 100 */
1002 struct {
1003 M128A Header[2]; /* 100 */
1004 M128A Legacy[8]; /* 120 */
1005 M128A Xmm0; /* 1a0 */
1006 M128A Xmm1; /* 1b0 */
1007 M128A Xmm2; /* 1c0 */
1008 M128A Xmm3; /* 1d0 */
1009 M128A Xmm4; /* 1e0 */
1010 M128A Xmm5; /* 1f0 */
1011 M128A Xmm6; /* 200 */
1012 M128A Xmm7; /* 210 */
1013 M128A Xmm8; /* 220 */
1014 M128A Xmm9; /* 230 */
1015 M128A Xmm10; /* 240 */
1016 M128A Xmm11; /* 250 */
1017 M128A Xmm12; /* 260 */
1018 M128A Xmm13; /* 270 */
1019 M128A Xmm14; /* 280 */
1020 M128A Xmm15; /* 290 */
1021 } DUMMYSTRUCTNAME;
1022 } DUMMYUNIONNAME;
1024 /* Vector */
1025 M128A VectorRegister[26]; /* 300 */
1026 DWORD64 VectorControl; /* 4a0 */
1028 /* Debug control */
1029 DWORD64 DebugControl; /* 4a8 */
1030 DWORD64 LastBranchToRip; /* 4b0 */
1031 DWORD64 LastBranchFromRip; /* 4b8 */
1032 DWORD64 LastExceptionToRip; /* 4c0 */
1033 DWORD64 LastExceptionFromRip; /* 4c8 */
1034 } CONTEXT;
1036 typedef struct _RUNTIME_FUNCTION
1038 DWORD BeginAddress;
1039 DWORD EndAddress;
1040 DWORD UnwindData;
1041 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1043 #define UNWIND_HISTORY_TABLE_SIZE 12
1045 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
1047 ULONG64 ImageBase;
1048 PRUNTIME_FUNCTION FunctionEntry;
1049 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1051 #define UNWIND_HISTORY_TABLE_NONE 0
1052 #define UNWIND_HISTORY_TABLE_GLOBAL 1
1053 #define UNWIND_HISTORY_TABLE_LOCAL 2
1055 typedef struct _UNWIND_HISTORY_TABLE
1057 ULONG Count;
1058 UCHAR Search;
1059 ULONG64 LowAddress;
1060 ULONG64 HighAddress;
1061 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1062 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1064 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1066 union
1068 PM128A FloatingContext[16];
1069 struct
1071 PM128A Xmm0;
1072 PM128A Xmm1;
1073 PM128A Xmm2;
1074 PM128A Xmm3;
1075 PM128A Xmm4;
1076 PM128A Xmm5;
1077 PM128A Xmm6;
1078 PM128A Xmm7;
1079 PM128A Xmm8;
1080 PM128A Xmm9;
1081 PM128A Xmm10;
1082 PM128A Xmm11;
1083 PM128A Xmm12;
1084 PM128A Xmm13;
1085 PM128A Xmm14;
1086 PM128A Xmm15;
1087 } DUMMYSTRUCTNAME1;
1088 } DUMMYUNIONNAME1;
1090 union
1092 PULONG64 IntegerContext[16];
1093 struct
1095 PULONG64 Rax;
1096 PULONG64 Rcx;
1097 PULONG64 Rdx;
1098 PULONG64 Rbx;
1099 PULONG64 Rsp;
1100 PULONG64 Rbp;
1101 PULONG64 Rsi;
1102 PULONG64 Rdi;
1103 PULONG64 R8;
1104 PULONG64 R9;
1105 PULONG64 R10;
1106 PULONG64 R11;
1107 PULONG64 R12;
1108 PULONG64 R13;
1109 PULONG64 R14;
1110 PULONG64 R15;
1111 } DUMMYSTRUCTNAME2;
1112 } DUMMYUNIONNAME2;
1113 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1115 BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64);
1116 BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
1117 PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD64,DWORD64*,UNWIND_HISTORY_TABLE*);
1118 PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
1120 #define UNW_FLAG_NHANDLER 0
1121 #define UNW_FLAG_EHANDLER 1
1122 #define UNW_FLAG_UHANDLER 2
1123 #define UNW_FLAG_CHAININFO 4
1125 #endif /* __x86_64__ */
1127 /* IA64 context definitions */
1128 #ifdef __ia64__
1130 #define CONTEXT_IA64 0x00080000
1131 #define CONTEXT_CONTROL (CONTEXT_IA64 | 0x00000001)
1132 #define CONTEXT_LOWER_FLOATING_POINT (CONTEXT_IA64 | 0x00000002)
1133 #define CONTEXT_HIGHER_FLOATING_POINT (CONTEXT_IA64 | 0x00000004)
1134 #define CONTEXT_INTEGER (CONTEXT_IA64 | 0x00000008)
1135 #define CONTEXT_DEBUG (CONTEXT_IA64 | 0x00000010)
1136 #define CONTEXT_IA32_CONTROL (CONTEXT_IA64 | 0x00000020)
1137 #define CONTEXT_FLOATING_POINT (CONTEXT_LOWER_FLOATING_POINT | CONTEXT_HIGHER_FLOATING_POINT)
1138 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_IA32_CONTROL)
1139 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER | CONTEXT_DEBUG | CONTEXT_IA32_CONTROL)
1141 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000
1142 #define CONTEXT_SERVICE_ACTIVE 0x10000000
1143 #define CONTEXT_EXCEPTION_REQUEST 0x40000000
1144 #define CONTEXT_EXCEPTION_REPORTING 0x80000000
1146 typedef struct _CONTEXT
1148 DWORD ContextFlags;
1149 DWORD Fill1[3];
1150 ULONGLONG DbI0;
1151 ULONGLONG DbI1;
1152 ULONGLONG DbI2;
1153 ULONGLONG DbI3;
1154 ULONGLONG DbI4;
1155 ULONGLONG DbI5;
1156 ULONGLONG DbI6;
1157 ULONGLONG DbI7;
1158 ULONGLONG DbD0;
1159 ULONGLONG DbD1;
1160 ULONGLONG DbD2;
1161 ULONGLONG DbD3;
1162 ULONGLONG DbD4;
1163 ULONGLONG DbD5;
1164 ULONGLONG DbD6;
1165 ULONGLONG DbD7;
1166 FLOAT128 FltS0;
1167 FLOAT128 FltS1;
1168 FLOAT128 FltS2;
1169 FLOAT128 FltS3;
1170 FLOAT128 FltT0;
1171 FLOAT128 FltT1;
1172 FLOAT128 FltT2;
1173 FLOAT128 FltT3;
1174 FLOAT128 FltT4;
1175 FLOAT128 FltT5;
1176 FLOAT128 FltT6;
1177 FLOAT128 FltT7;
1178 FLOAT128 FltT8;
1179 FLOAT128 FltT9;
1180 FLOAT128 FltS4;
1181 FLOAT128 FltS5;
1182 FLOAT128 FltS6;
1183 FLOAT128 FltS7;
1184 FLOAT128 FltS8;
1185 FLOAT128 FltS9;
1186 FLOAT128 FltS10;
1187 FLOAT128 FltS11;
1188 FLOAT128 FltS12;
1189 FLOAT128 FltS13;
1190 FLOAT128 FltS14;
1191 FLOAT128 FltS15;
1192 FLOAT128 FltS16;
1193 FLOAT128 FltS17;
1194 FLOAT128 FltS18;
1195 FLOAT128 FltS19;
1196 FLOAT128 FltF32;
1197 FLOAT128 FltF33;
1198 FLOAT128 FltF34;
1199 FLOAT128 FltF35;
1200 FLOAT128 FltF36;
1201 FLOAT128 FltF37;
1202 FLOAT128 FltF38;
1203 FLOAT128 FltF39;
1204 FLOAT128 FltF40;
1205 FLOAT128 FltF41;
1206 FLOAT128 FltF42;
1207 FLOAT128 FltF43;
1208 FLOAT128 FltF44;
1209 FLOAT128 FltF45;
1210 FLOAT128 FltF46;
1211 FLOAT128 FltF47;
1212 FLOAT128 FltF48;
1213 FLOAT128 FltF49;
1214 FLOAT128 FltF50;
1215 FLOAT128 FltF51;
1216 FLOAT128 FltF52;
1217 FLOAT128 FltF53;
1218 FLOAT128 FltF54;
1219 FLOAT128 FltF55;
1220 FLOAT128 FltF56;
1221 FLOAT128 FltF57;
1222 FLOAT128 FltF58;
1223 FLOAT128 FltF59;
1224 FLOAT128 FltF60;
1225 FLOAT128 FltF61;
1226 FLOAT128 FltF62;
1227 FLOAT128 FltF63;
1228 FLOAT128 FltF64;
1229 FLOAT128 FltF65;
1230 FLOAT128 FltF66;
1231 FLOAT128 FltF67;
1232 FLOAT128 FltF68;
1233 FLOAT128 FltF69;
1234 FLOAT128 FltF70;
1235 FLOAT128 FltF71;
1236 FLOAT128 FltF72;
1237 FLOAT128 FltF73;
1238 FLOAT128 FltF74;
1239 FLOAT128 FltF75;
1240 FLOAT128 FltF76;
1241 FLOAT128 FltF77;
1242 FLOAT128 FltF78;
1243 FLOAT128 FltF79;
1244 FLOAT128 FltF80;
1245 FLOAT128 FltF81;
1246 FLOAT128 FltF82;
1247 FLOAT128 FltF83;
1248 FLOAT128 FltF84;
1249 FLOAT128 FltF85;
1250 FLOAT128 FltF86;
1251 FLOAT128 FltF87;
1252 FLOAT128 FltF88;
1253 FLOAT128 FltF89;
1254 FLOAT128 FltF90;
1255 FLOAT128 FltF91;
1256 FLOAT128 FltF92;
1257 FLOAT128 FltF93;
1258 FLOAT128 FltF94;
1259 FLOAT128 FltF95;
1260 FLOAT128 FltF96;
1261 FLOAT128 FltF97;
1262 FLOAT128 FltF98;
1263 FLOAT128 FltF99;
1264 FLOAT128 FltF100;
1265 FLOAT128 FltF101;
1266 FLOAT128 FltF102;
1267 FLOAT128 FltF103;
1268 FLOAT128 FltF104;
1269 FLOAT128 FltF105;
1270 FLOAT128 FltF106;
1271 FLOAT128 FltF107;
1272 FLOAT128 FltF108;
1273 FLOAT128 FltF109;
1274 FLOAT128 FltF110;
1275 FLOAT128 FltF111;
1276 FLOAT128 FltF112;
1277 FLOAT128 FltF113;
1278 FLOAT128 FltF114;
1279 FLOAT128 FltF115;
1280 FLOAT128 FltF116;
1281 FLOAT128 FltF117;
1282 FLOAT128 FltF118;
1283 FLOAT128 FltF119;
1284 FLOAT128 FltF120;
1285 FLOAT128 FltF121;
1286 FLOAT128 FltF122;
1287 FLOAT128 FltF123;
1288 FLOAT128 FltF124;
1289 FLOAT128 FltF125;
1290 FLOAT128 FltF126;
1291 FLOAT128 FltF127;
1292 ULONGLONG StFPSR;
1293 ULONGLONG IntGp;
1294 ULONGLONG IntT0;
1295 ULONGLONG IntT1;
1296 ULONGLONG IntS0;
1297 ULONGLONG IntS1;
1298 ULONGLONG IntS2;
1299 ULONGLONG IntS3;
1300 ULONGLONG IntV0;
1301 ULONGLONG IntT2;
1302 ULONGLONG IntT3;
1303 ULONGLONG IntT4;
1304 ULONGLONG IntSp;
1305 ULONGLONG IntTeb;
1306 ULONGLONG IntT5;
1307 ULONGLONG IntT6;
1308 ULONGLONG IntT7;
1309 ULONGLONG IntT8;
1310 ULONGLONG IntT9;
1311 ULONGLONG IntT10;
1312 ULONGLONG IntT11;
1313 ULONGLONG IntT12;
1314 ULONGLONG IntT13;
1315 ULONGLONG IntT14;
1316 ULONGLONG IntT15;
1317 ULONGLONG IntT16;
1318 ULONGLONG IntT17;
1319 ULONGLONG IntT18;
1320 ULONGLONG IntT19;
1321 ULONGLONG IntT20;
1322 ULONGLONG IntT21;
1323 ULONGLONG IntT22;
1324 ULONGLONG IntNats;
1325 ULONGLONG Preds;
1326 ULONGLONG BrRp;
1327 ULONGLONG BrS0;
1328 ULONGLONG BrS1;
1329 ULONGLONG BrS2;
1330 ULONGLONG BrS3;
1331 ULONGLONG BrS4;
1332 ULONGLONG BrT0;
1333 ULONGLONG BrT1;
1334 ULONGLONG ApUNAT;
1335 ULONGLONG ApLC;
1336 ULONGLONG ApEC;
1337 ULONGLONG ApCCV;
1338 ULONGLONG ApDCR;
1339 ULONGLONG RsPFS;
1340 ULONGLONG RsBSP;
1341 ULONGLONG RsBSPSTORE;
1342 ULONGLONG RsRSC;
1343 ULONGLONG RsRNAT;
1344 ULONGLONG StIPSR;
1345 ULONGLONG StIIP;
1346 ULONGLONG StIFS;
1347 ULONGLONG StFCR;
1348 ULONGLONG Eflag;
1349 ULONGLONG SegCSD;
1350 ULONGLONG SegSSD;
1351 ULONGLONG Cflag;
1352 ULONGLONG StFSR;
1353 ULONGLONG StFIR;
1354 ULONGLONG StFDR;
1355 ULONGLONG UNUSEDPACK;
1356 } CONTEXT, *PCONTEXT;
1358 typedef struct _RUNTIME_FUNCTION
1360 ULONG BeginAddress;
1361 ULONG EndAddress;
1362 ULONG UnwindInfoAddress;
1363 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
1365 typedef struct _FRAME_POINTERS {
1366 ULONGLONG MemoryStackFp;
1367 ULONGLONG BackingStoreFp;
1368 } FRAME_POINTERS, *PFRAME_POINTERS;
1370 #define UNWIND_HISTORY_TABLE_SIZE 12
1372 typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
1373 ULONG64 ImageBase;
1374 ULONG64 Gp;
1375 PRUNTIME_FUNCTION FunctionEntry;
1376 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
1378 typedef struct _UNWIND_HISTORY_TABLE {
1379 ULONG Count;
1380 UCHAR Search;
1381 ULONG64 LowAddress;
1382 ULONG64 HighAddress;
1383 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
1384 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
1386 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
1388 PFLOAT128 FltS0;
1389 PFLOAT128 FltS1;
1390 PFLOAT128 FltS2;
1391 PFLOAT128 FltS3;
1392 PFLOAT128 HighFloatingContext[10];
1393 PFLOAT128 FltS4;
1394 PFLOAT128 FltS5;
1395 PFLOAT128 FltS6;
1396 PFLOAT128 FltS7;
1397 PFLOAT128 FltS8;
1398 PFLOAT128 FltS9;
1399 PFLOAT128 FltS10;
1400 PFLOAT128 FltS11;
1401 PFLOAT128 FltS12;
1402 PFLOAT128 FltS13;
1403 PFLOAT128 FltS14;
1404 PFLOAT128 FltS15;
1405 PFLOAT128 FltS16;
1406 PFLOAT128 FltS17;
1407 PFLOAT128 FltS18;
1408 PFLOAT128 FltS19;
1409 PULONGLONG IntS0;
1410 PULONGLONG IntS1;
1411 PULONGLONG IntS2;
1412 PULONGLONG IntS3;
1413 PULONGLONG IntSp;
1414 PULONGLONG IntS0Nat;
1415 PULONGLONG IntS1Nat;
1416 PULONGLONG IntS2Nat;
1417 PULONGLONG IntS3Nat;
1418 PULONGLONG IntSpNat;
1419 PULONGLONG Preds;
1420 PULONGLONG BrRp;
1421 PULONGLONG BrS0;
1422 PULONGLONG BrS1;
1423 PULONGLONG BrS2;
1424 PULONGLONG BrS3;
1425 PULONGLONG BrS4;
1426 PULONGLONG ApUNAT;
1427 PULONGLONG ApLC;
1428 PULONGLONG ApEC;
1429 PULONGLONG RsPFS;
1430 PULONGLONG StFSR;
1431 PULONGLONG StFIR;
1432 PULONGLONG StFDR;
1433 PULONGLONG Cflag;
1434 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
1436 ULONGLONG WINAPI RtlVirtualUnwind(ULONGLONG,ULONGLONG,RUNTIME_FUNCTION*,CONTEXT*,BOOLEAN*,FRAME_POINTERS*,KNONVOLATILE_CONTEXT_POINTERS*);
1438 #endif /* __ia64__ */
1440 /* Alpha context definitions */
1441 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
1443 #define CONTEXT_ALPHA 0x00020000
1445 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001)
1446 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002)
1447 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004)
1448 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1450 #define EXCEPTION_READ_FAULT 0
1451 #define EXCEPTION_WRITE_FAULT 1
1452 #define EXCEPTION_EXECUTE_FAULT 8
1454 typedef struct _CONTEXT
1456 /* selected by CONTEXT_FLOATING_POINT */
1457 ULONGLONG FltF0;
1458 ULONGLONG FltF1;
1459 ULONGLONG FltF2;
1460 ULONGLONG FltF3;
1461 ULONGLONG FltF4;
1462 ULONGLONG FltF5;
1463 ULONGLONG FltF6;
1464 ULONGLONG FltF7;
1465 ULONGLONG FltF8;
1466 ULONGLONG FltF9;
1467 ULONGLONG FltF10;
1468 ULONGLONG FltF11;
1469 ULONGLONG FltF12;
1470 ULONGLONG FltF13;
1471 ULONGLONG FltF14;
1472 ULONGLONG FltF15;
1473 ULONGLONG FltF16;
1474 ULONGLONG FltF17;
1475 ULONGLONG FltF18;
1476 ULONGLONG FltF19;
1477 ULONGLONG FltF20;
1478 ULONGLONG FltF21;
1479 ULONGLONG FltF22;
1480 ULONGLONG FltF23;
1481 ULONGLONG FltF24;
1482 ULONGLONG FltF25;
1483 ULONGLONG FltF26;
1484 ULONGLONG FltF27;
1485 ULONGLONG FltF28;
1486 ULONGLONG FltF29;
1487 ULONGLONG FltF30;
1488 ULONGLONG FltF31;
1490 /* selected by CONTEXT_INTEGER */
1491 ULONGLONG IntV0;
1492 ULONGLONG IntT0;
1493 ULONGLONG IntT1;
1494 ULONGLONG IntT2;
1495 ULONGLONG IntT3;
1496 ULONGLONG IntT4;
1497 ULONGLONG IntT5;
1498 ULONGLONG IntT6;
1499 ULONGLONG IntT7;
1500 ULONGLONG IntS0;
1501 ULONGLONG IntS1;
1502 ULONGLONG IntS2;
1503 ULONGLONG IntS3;
1504 ULONGLONG IntS4;
1505 ULONGLONG IntS5;
1506 ULONGLONG IntFp;
1507 ULONGLONG IntA0;
1508 ULONGLONG IntA1;
1509 ULONGLONG IntA2;
1510 ULONGLONG IntA3;
1511 ULONGLONG IntA4;
1512 ULONGLONG IntA5;
1513 ULONGLONG IntT8;
1514 ULONGLONG IntT9;
1515 ULONGLONG IntT10;
1516 ULONGLONG IntT11;
1517 ULONGLONG IntRa;
1518 ULONGLONG IntT12;
1519 ULONGLONG IntAt;
1520 ULONGLONG IntGp;
1521 ULONGLONG IntSp;
1522 ULONGLONG IntZero;
1524 /* selected by CONTEXT_FLOATING_POINT */
1525 ULONGLONG Fpcr;
1526 ULONGLONG SoftFpcr;
1528 /* selected by CONTEXT_CONTROL */
1529 ULONGLONG Fir;
1530 DWORD Psr;
1531 DWORD ContextFlags;
1532 DWORD Fill[4];
1533 } CONTEXT;
1535 #define _QUAD_PSR_OFFSET HighSoftFpcr
1536 #define _QUAD_FLAGS_OFFSET HighFir
1538 #endif /* _ALPHA_ */
1540 #ifdef __arm__
1542 /* The following flags control the contents of the CONTEXT structure. */
1544 #define CONTEXT_ARM 0x0000040
1545 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1546 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1548 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1550 #define EXCEPTION_READ_FAULT 0
1551 #define EXCEPTION_WRITE_FAULT 1
1552 #define EXCEPTION_EXECUTE_FAULT 8
1554 typedef struct _CONTEXT {
1555 /* The flags values within this flag control the contents of
1556 a CONTEXT record.
1558 If the context record is used as an input parameter, then
1559 for each portion of the context record controlled by a flag
1560 whose value is set, it is assumed that that portion of the
1561 context record contains valid context. If the context record
1562 is being used to modify a thread's context, then only that
1563 portion of the threads context will be modified.
1565 If the context record is used as an IN OUT parameter to capture
1566 the context of a thread, then only those portions of the thread's
1567 context corresponding to set flags will be returned.
1569 The context record is never used as an OUT only parameter. */
1571 ULONG ContextFlags;
1573 /* This section is specified/returned if the ContextFlags word contains
1574 the flag CONTEXT_INTEGER. */
1575 ULONG R0;
1576 ULONG R1;
1577 ULONG R2;
1578 ULONG R3;
1579 ULONG R4;
1580 ULONG R5;
1581 ULONG R6;
1582 ULONG R7;
1583 ULONG R8;
1584 ULONG R9;
1585 ULONG R10;
1586 ULONG Fp;
1587 ULONG Ip;
1589 /* These are selected by CONTEXT_CONTROL */
1590 ULONG Sp;
1591 ULONG Lr;
1592 ULONG Pc;
1593 ULONG Cpsr;
1594 } CONTEXT;
1596 #endif /* __arm__ */
1599 /* Mips context definitions */
1600 #if defined(_MIPS_) || defined(__MIPS__) || defined(__mips__)
1602 #define CONTEXT_R4000 0x00010000
1604 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1605 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1606 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1608 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1610 #define EXCEPTION_READ_FAULT 0
1611 #define EXCEPTION_WRITE_FAULT 1
1612 #define EXCEPTION_EXECUTE_FAULT 8
1614 typedef struct _CONTEXT
1616 DWORD Argument[4];
1617 /* These are selected by CONTEXT_FLOATING_POINT */
1618 DWORD FltF0;
1619 DWORD FltF1;
1620 DWORD FltF2;
1621 DWORD FltF3;
1622 DWORD FltF4;
1623 DWORD FltF5;
1624 DWORD FltF6;
1625 DWORD FltF7;
1626 DWORD FltF8;
1627 DWORD FltF9;
1628 DWORD FltF10;
1629 DWORD FltF11;
1630 DWORD FltF12;
1631 DWORD FltF13;
1632 DWORD FltF14;
1633 DWORD FltF15;
1634 DWORD FltF16;
1635 DWORD FltF17;
1636 DWORD FltF18;
1637 DWORD FltF19;
1638 DWORD FltF20;
1639 DWORD FltF21;
1640 DWORD FltF22;
1641 DWORD FltF23;
1642 DWORD FltF24;
1643 DWORD FltF25;
1644 DWORD FltF26;
1645 DWORD FltF27;
1646 DWORD FltF28;
1647 DWORD FltF29;
1648 DWORD FltF30;
1649 DWORD FltF31;
1651 /* These are selected by CONTEXT_INTEGER */
1652 DWORD IntZero;
1653 DWORD IntAt;
1654 DWORD IntV0;
1655 DWORD IntV1;
1656 DWORD IntA0;
1657 DWORD IntA1;
1658 DWORD IntA2;
1659 DWORD IntA3;
1660 DWORD IntT0;
1661 DWORD IntT1;
1662 DWORD IntT2;
1663 DWORD IntT3;
1664 DWORD IntT4;
1665 DWORD IntT5;
1666 DWORD IntT6;
1667 DWORD IntT7;
1668 DWORD IntS0;
1669 DWORD IntS1;
1670 DWORD IntS2;
1671 DWORD IntS3;
1672 DWORD IntS4;
1673 DWORD IntS5;
1674 DWORD IntS6;
1675 DWORD IntS7;
1676 DWORD IntT8;
1677 DWORD IntT9;
1678 DWORD IntK0;
1679 DWORD IntK1;
1680 DWORD IntGp;
1681 DWORD IntSp;
1682 DWORD IntS8;
1683 DWORD IntRa;
1684 DWORD IntLo;
1685 DWORD IntHi;
1687 /* These are selected by CONTEXT_FLOATING_POINT */
1688 DWORD Fsr;
1690 /* These are selected by CONTEXT_CONTROL */
1691 DWORD Fir;
1692 DWORD Psr;
1694 DWORD ContextFlags;
1695 DWORD Fill[2];
1696 } CONTEXT;
1698 #endif /* _MIPS_ */
1700 /* PowerPC context definitions */
1701 #ifdef __powerpc__
1703 #define CONTEXT_CONTROL 0x0001
1704 #define CONTEXT_FLOATING_POINT 0x0002
1705 #define CONTEXT_INTEGER 0x0004
1706 #define CONTEXT_DEBUG_REGISTERS 0x0008
1707 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1709 #define EXCEPTION_READ_FAULT 0
1710 #define EXCEPTION_WRITE_FAULT 1
1711 #define EXCEPTION_EXECUTE_FAULT 8
1713 typedef struct
1715 /* These are selected by CONTEXT_FLOATING_POINT */
1716 double Fpr0;
1717 double Fpr1;
1718 double Fpr2;
1719 double Fpr3;
1720 double Fpr4;
1721 double Fpr5;
1722 double Fpr6;
1723 double Fpr7;
1724 double Fpr8;
1725 double Fpr9;
1726 double Fpr10;
1727 double Fpr11;
1728 double Fpr12;
1729 double Fpr13;
1730 double Fpr14;
1731 double Fpr15;
1732 double Fpr16;
1733 double Fpr17;
1734 double Fpr18;
1735 double Fpr19;
1736 double Fpr20;
1737 double Fpr21;
1738 double Fpr22;
1739 double Fpr23;
1740 double Fpr24;
1741 double Fpr25;
1742 double Fpr26;
1743 double Fpr27;
1744 double Fpr28;
1745 double Fpr29;
1746 double Fpr30;
1747 double Fpr31;
1748 double Fpscr;
1750 /* These are selected by CONTEXT_INTEGER */
1751 DWORD Gpr0;
1752 DWORD Gpr1;
1753 DWORD Gpr2;
1754 DWORD Gpr3;
1755 DWORD Gpr4;
1756 DWORD Gpr5;
1757 DWORD Gpr6;
1758 DWORD Gpr7;
1759 DWORD Gpr8;
1760 DWORD Gpr9;
1761 DWORD Gpr10;
1762 DWORD Gpr11;
1763 DWORD Gpr12;
1764 DWORD Gpr13;
1765 DWORD Gpr14;
1766 DWORD Gpr15;
1767 DWORD Gpr16;
1768 DWORD Gpr17;
1769 DWORD Gpr18;
1770 DWORD Gpr19;
1771 DWORD Gpr20;
1772 DWORD Gpr21;
1773 DWORD Gpr22;
1774 DWORD Gpr23;
1775 DWORD Gpr24;
1776 DWORD Gpr25;
1777 DWORD Gpr26;
1778 DWORD Gpr27;
1779 DWORD Gpr28;
1780 DWORD Gpr29;
1781 DWORD Gpr30;
1782 DWORD Gpr31;
1784 DWORD Cr;
1785 DWORD Xer;
1787 /* These are selected by CONTEXT_CONTROL */
1788 DWORD Msr;
1789 DWORD Iar; /* Instruction Address Register , aka PC ... */
1790 DWORD Lr;
1791 DWORD Ctr;
1793 DWORD ContextFlags;
1795 DWORD Dar; /* Fault registers for coredump */
1796 DWORD Dsisr;
1797 DWORD Trap; /* number of powerpc exception taken */
1799 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1800 DWORD Dr0;
1801 DWORD Dr1;
1802 DWORD Dr2;
1803 DWORD Dr3;
1804 DWORD Dr4;
1805 DWORD Dr5;
1806 DWORD Dr6;
1807 DWORD Dr7;
1808 } CONTEXT;
1810 typedef struct _STACK_FRAME_HEADER
1812 DWORD BackChain;
1813 DWORD GlueSaved1;
1814 DWORD GlueSaved2;
1815 DWORD Reserved1;
1816 DWORD Spare1;
1817 DWORD Spare2;
1819 DWORD Parameter0;
1820 DWORD Parameter1;
1821 DWORD Parameter2;
1822 DWORD Parameter3;
1823 DWORD Parameter4;
1824 DWORD Parameter5;
1825 DWORD Parameter6;
1826 DWORD Parameter7;
1827 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1829 #endif /* __powerpc__ */
1831 #ifdef __sparc__
1834 * FIXME:
1836 * There is no official CONTEXT structure defined for the SPARC
1837 * architecture, so I just made one up.
1839 * This structure is valid only for 32-bit SPARC architectures,
1840 * not for 64-bit SPARC.
1842 * Note that this structure contains only the 'top-level' registers;
1843 * the rest of the register window chain is not visible.
1845 * The layout follows the Solaris 'prgregset_t' structure.
1849 #define CONTEXT_SPARC 0x10000000
1851 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1852 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1853 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1855 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1857 #define EXCEPTION_READ_FAULT 0
1858 #define EXCEPTION_WRITE_FAULT 1
1859 #define EXCEPTION_EXECUTE_FAULT 8
1861 typedef struct _CONTEXT
1863 DWORD ContextFlags;
1865 /* These are selected by CONTEXT_INTEGER */
1866 DWORD g0;
1867 DWORD g1;
1868 DWORD g2;
1869 DWORD g3;
1870 DWORD g4;
1871 DWORD g5;
1872 DWORD g6;
1873 DWORD g7;
1874 DWORD o0;
1875 DWORD o1;
1876 DWORD o2;
1877 DWORD o3;
1878 DWORD o4;
1879 DWORD o5;
1880 DWORD o6;
1881 DWORD o7;
1882 DWORD l0;
1883 DWORD l1;
1884 DWORD l2;
1885 DWORD l3;
1886 DWORD l4;
1887 DWORD l5;
1888 DWORD l6;
1889 DWORD l7;
1890 DWORD i0;
1891 DWORD i1;
1892 DWORD i2;
1893 DWORD i3;
1894 DWORD i4;
1895 DWORD i5;
1896 DWORD i6;
1897 DWORD i7;
1899 /* These are selected by CONTEXT_CONTROL */
1900 DWORD psr;
1901 DWORD pc;
1902 DWORD npc;
1903 DWORD y;
1904 DWORD wim;
1905 DWORD tbr;
1907 /* FIXME: floating point registers missing */
1909 } CONTEXT;
1911 #endif /* __sparc__ */
1913 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1914 #error You need to define a CONTEXT for your CPU
1915 #endif
1917 typedef CONTEXT *PCONTEXT;
1919 NTSYSAPI void WINAPI RtlCaptureContext(CONTEXT*);
1922 * Product types
1924 #define PRODUCT_UNLICENSED 0xABCDABCD
1925 #define PRODUCT_BUSINESS 0x00000006
1926 #define PRODUCT_BUSINESS_N 0x00000010
1927 #define PRODUCT_CLUSTER_SERVER 0x00000012
1928 #define PRODUCT_DATACENTER_SERVER 0x00000008
1929 #define PRODUCT_DATACENTER_SERVER_CORE 0x0000000C
1930 #define PRODUCT_DATACENTER_SERVER_CORE_V 0x00000027
1931 #define PRODUCT_SERVER_V 0x00000025
1932 #define PRODUCT_ENTERPRISE 0x00000004
1933 #define PRODUCT_ENTERPRISE_N 0x0000001B
1934 #define PRODUCT_ENTERPRISE_SERVER 0x0000000A
1935 #define PRODUCT_ENTERPRISE_SERVER_CORE 0x0000000E
1936 #define PRODUCT_ENTERPRISE_SERVER_CORE_V 0x00000029
1937 #define PRODUCT_ENTERPRISE_SERVER_IA64 0x0000000F
1938 #define PRODUCT_ENTERPRISE_SERVER_V 0x00000026
1939 #define PRODUCT_HOME_BASIC 0x00000002
1940 #define PRODUCT_HOME_BASIC_N 0x00000005
1941 #define PRODUCT_HOME_PREMIUM 0x00000003
1942 #define PRODUCT_HOME_PREMIUM_N 0x0000001A
1943 #define PRODUCT_HYPERV 0x0000002A
1944 #define PRODUCT_MEDIUMBUSINESS_SERVER_MANAGEMENT 0x0000001E
1945 #define PRODUCT_MEDIUMBUSINESS_SERVER_MESSAGING 0x00000020
1946 #define PRODUCT_MEDIUMBUSINESS_SERVER_SECURITY 0x0000001F
1947 #define PRODUCT_SERVER_FOR_SMALLBUSINESS 0x00000018
1948 #define PRODUCT_SERVER_FOR_SMALLBUSINESS_V 0x00000023
1949 #define PRODUCT_SMALLBUSINESS_SERVER 0x00000009
1950 #define PRODUCT_STANDARD_SERVER 0x00000007
1951 #define PRODUCT_STANDARD_SERVER_CORE 0x0000000D
1952 #define PRODUCT_STANDARD_SERVER_CORE_V 0x00000028
1953 #define PRODUCT_STANDARD_SERVER_V 0x00000024
1954 #define PRODUCT_STARTER 0x0000000B
1955 #define PRODUCT_STORAGE_ENTERPRISE_SERVER 0x00000017
1956 #define PRODUCT_STORAGE_EXPRESS_SERVER 0x00000014
1957 #define PRODUCT_STORAGE_STANDARD_SERVER 0x00000015
1958 #define PRODUCT_STORAGE_WORKGROUP_SERVER 0x00000016
1959 #define PRODUCT_UNDEFINED 0x00000000
1960 #define PRODUCT_ULTIMATE 0x00000001
1961 #define PRODUCT_ULTIMATE_N 0x0000001C
1962 #define PRODUCT_WEB_SERVER 0x00000011
1963 #define PRODUCT_WEB_SERVER_CORE 0x0000001D
1967 * Language IDs
1970 #define MAKELCID(l, s) (MAKELONG(l, s))
1972 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1973 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1974 #define SUBLANGID(l) ((WORD)(l) >> 10)
1976 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1977 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1979 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1980 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1981 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1982 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1983 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1984 #define LOCALE_INVARIANT (MAKELCID(MAKELANGID(LANG_INVARIANT,SUBLANG_NEUTRAL),SORT_DEFAULT))
1985 #define LOCALE_CUSTOM_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_DEFAULT),SORT_DEFAULT))
1986 #define LOCALE_CUSTOM_UNSPECIFIED (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_CUSTOM_UNSPECIFIED),SORT_DEFAULT))
1987 #define LOCALE_CUSTOM_UI_DEFAULT (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_UI_CUSTOM_DEFAULT),SORT_DEFAULT))
1990 #define UNREFERENCED_PARAMETER(u) (void)(u)
1991 #define DBG_UNREFERENCED_PARAMETER(u) (void)(u)
1992 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (void)(u)
1994 #include <winnt.rh>
1998 * Definitions for IsTextUnicode()
2001 #define IS_TEXT_UNICODE_ASCII16 0x0001
2002 #define IS_TEXT_UNICODE_STATISTICS 0x0002
2003 #define IS_TEXT_UNICODE_CONTROLS 0x0004
2004 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
2005 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
2006 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
2007 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
2008 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
2009 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
2010 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
2011 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
2012 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
2013 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
2014 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
2015 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
2016 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
2018 #define MAXIMUM_WAIT_OBJECTS 64
2019 #define MAXIMUM_SUSPEND_COUNT 127
2021 #define WT_EXECUTEDEFAULT 0x00
2022 #define WT_EXECUTEINIOTHREAD 0x01
2023 #define WT_EXECUTEINUITHREAD 0x02
2024 #define WT_EXECUTEINWAITTHREAD 0x04
2025 #define WT_EXECUTEONLYONCE 0x08
2026 #define WT_EXECUTELONGFUNCTION 0x10
2027 #define WT_EXECUTEINTIMERTHREAD 0x20
2028 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
2029 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
2030 #define WT_EXECUTEINLONGTHREAD 0x10
2031 #define WT_EXECUTEDELETEWAIT 0x08
2032 #define WT_TRANSFER_IMPERSONATION 0x0100
2035 #define EXCEPTION_CONTINUABLE 0
2036 #define EXCEPTION_NONCONTINUABLE 0x01
2039 * The exception record used by Win32 to give additional information
2040 * about exception to exception handlers.
2043 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2045 typedef struct _EXCEPTION_RECORD
2047 DWORD ExceptionCode;
2048 DWORD ExceptionFlags;
2049 struct _EXCEPTION_RECORD *ExceptionRecord;
2051 PVOID ExceptionAddress;
2052 DWORD NumberParameters;
2053 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2054 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2057 * The exception pointers structure passed to exception filters
2058 * in except() and the UnhandledExceptionFilter().
2061 typedef struct _EXCEPTION_POINTERS
2063 PEXCEPTION_RECORD ExceptionRecord;
2064 PCONTEXT ContextRecord;
2065 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
2069 * The exception frame, used for registering exception handlers
2070 * Win32 cares only about this, but compilers generally emit
2071 * larger exception frames for their own use.
2074 struct _EXCEPTION_REGISTRATION_RECORD;
2076 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
2077 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
2079 typedef struct _EXCEPTION_REGISTRATION_RECORD
2081 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
2082 PEXCEPTION_HANDLER Handler;
2083 } EXCEPTION_REGISTRATION_RECORD;
2086 * function pointer to an exception filter
2089 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
2091 typedef struct _NT_TIB
2093 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2094 PVOID StackBase;
2095 PVOID StackLimit;
2096 PVOID SubSystemTib;
2097 union {
2098 PVOID FiberData;
2099 DWORD Version;
2100 } DUMMYUNIONNAME;
2101 PVOID ArbitraryUserPointer;
2102 struct _NT_TIB *Self;
2103 } NT_TIB, *PNT_TIB;
2105 struct _TEB;
2107 #if defined(__i386__) && defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
2108 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2110 struct _TEB *teb;
2111 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2112 return teb;
2114 #elif defined(__i386__) && defined(_MSC_VER)
2115 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2117 struct _TEB *teb;
2118 __asm mov eax, fs:[0x18];
2119 __asm mov teb, eax;
2120 return teb;
2122 #elif defined(__x86_64__) && defined(__GNUC__)
2123 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2125 struct _TEB *teb;
2126 __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb));
2127 return teb;
2129 #elif defined(__x86_64__) && defined (_MSC_VER)
2130 static FORCEINLINE struct _TEB * WINAPI NtCurrentTeb(void)
2132 struct _TEB *teb;
2133 __asm mov rax, gs:[0x30];
2134 __asm mov teb, rax;
2135 return teb;
2137 #else
2138 extern struct _TEB * WINAPI NtCurrentTeb(void);
2139 #endif
2141 #ifdef NONAMELESSUNION
2142 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2143 #else
2144 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2145 #endif
2146 #define GetFiberData() (*(void **)GetCurrentFiber())
2148 #define TLS_MINIMUM_AVAILABLE 64
2151 * File formats definitions
2154 #include <pshpack2.h>
2155 typedef struct _IMAGE_DOS_HEADER {
2156 WORD e_magic; /* 00: MZ Header signature */
2157 WORD e_cblp; /* 02: Bytes on last page of file */
2158 WORD e_cp; /* 04: Pages in file */
2159 WORD e_crlc; /* 06: Relocations */
2160 WORD e_cparhdr; /* 08: Size of header in paragraphs */
2161 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2162 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2163 WORD e_ss; /* 0e: Initial (relative) SS value */
2164 WORD e_sp; /* 10: Initial SP value */
2165 WORD e_csum; /* 12: Checksum */
2166 WORD e_ip; /* 14: Initial IP value */
2167 WORD e_cs; /* 16: Initial (relative) CS value */
2168 WORD e_lfarlc; /* 18: File address of relocation table */
2169 WORD e_ovno; /* 1a: Overlay number */
2170 WORD e_res[4]; /* 1c: Reserved words */
2171 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2172 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2173 WORD e_res2[10]; /* 28: Reserved words */
2174 DWORD e_lfanew; /* 3c: Offset to extended header */
2175 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2176 #include <poppack.h>
2178 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2179 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2180 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2181 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2182 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2183 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2186 * This is the Windows executable (NE) header.
2187 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2189 #include <pshpack2.h>
2190 typedef struct
2192 WORD ne_magic; /* 00 NE signature 'NE' */
2193 BYTE ne_ver; /* 02 Linker version number */
2194 BYTE ne_rev; /* 03 Linker revision number */
2195 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2196 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2197 LONG ne_crc; /* 08 Checksum */
2198 WORD ne_flags; /* 0c Flags about segments in this file */
2199 WORD ne_autodata; /* 0e Automatic data segment number */
2200 WORD ne_heap; /* 10 Initial size of local heap */
2201 WORD ne_stack; /* 12 Initial size of stack */
2202 DWORD ne_csip; /* 14 Initial CS:IP */
2203 DWORD ne_sssp; /* 18 Initial SS:SP */
2204 WORD ne_cseg; /* 1c # of entries in segment table */
2205 WORD ne_cmod; /* 1e # of entries in module reference tab. */
2206 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2207 WORD ne_segtab; /* 22 Offset to segment table */
2208 WORD ne_rsrctab; /* 24 Offset to resource table */
2209 WORD ne_restab; /* 26 Offset to resident-name table */
2210 WORD ne_modtab; /* 28 Offset to module reference table */
2211 WORD ne_imptab; /* 2a Offset to imported name table */
2212 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2213 WORD ne_cmovent; /* 30 # of movable entry points */
2214 WORD ne_align; /* 32 Logical sector alignment shift count */
2215 WORD ne_cres; /* 34 # of resource segments */
2216 BYTE ne_exetyp; /* 36 Flags indicating target OS */
2217 BYTE ne_flagsothers; /* 37 Additional information flags */
2218 WORD ne_pretthunks; /* 38 Offset to return thunks */
2219 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2220 WORD ne_swaparea; /* 3c Reserved by Microsoft */
2221 WORD ne_expver; /* 3e Expected Windows version number */
2222 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2223 #include <poppack.h>
2225 #include <pshpack2.h>
2226 typedef struct _IMAGE_VXD_HEADER {
2227 WORD e32_magic;
2228 BYTE e32_border;
2229 BYTE e32_worder;
2230 DWORD e32_level;
2231 WORD e32_cpu;
2232 WORD e32_os;
2233 DWORD e32_ver;
2234 DWORD e32_mflags;
2235 DWORD e32_mpages;
2236 DWORD e32_startobj;
2237 DWORD e32_eip;
2238 DWORD e32_stackobj;
2239 DWORD e32_esp;
2240 DWORD e32_pagesize;
2241 DWORD e32_lastpagesize;
2242 DWORD e32_fixupsize;
2243 DWORD e32_fixupsum;
2244 DWORD e32_ldrsize;
2245 DWORD e32_ldrsum;
2246 DWORD e32_objtab;
2247 DWORD e32_objcnt;
2248 DWORD e32_objmap;
2249 DWORD e32_itermap;
2250 DWORD e32_rsrctab;
2251 DWORD e32_rsrccnt;
2252 DWORD e32_restab;
2253 DWORD e32_enttab;
2254 DWORD e32_dirtab;
2255 DWORD e32_dircnt;
2256 DWORD e32_fpagetab;
2257 DWORD e32_frectab;
2258 DWORD e32_impmod;
2259 DWORD e32_impmodcnt;
2260 DWORD e32_impproc;
2261 DWORD e32_pagesum;
2262 DWORD e32_datapage;
2263 DWORD e32_preload;
2264 DWORD e32_nrestab;
2265 DWORD e32_cbnrestab;
2266 DWORD e32_nressum;
2267 DWORD e32_autodata;
2268 DWORD e32_debuginfo;
2269 DWORD e32_debuglen;
2270 DWORD e32_instpreload;
2271 DWORD e32_instdemand;
2272 DWORD e32_heapsize;
2273 BYTE e32_res3[12];
2274 DWORD e32_winresoff;
2275 DWORD e32_winreslen;
2276 WORD e32_devid;
2277 WORD e32_ddkver;
2278 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2279 #include <poppack.h>
2281 /* These defines describe the meanings of the bits in the Characteristics
2282 field */
2284 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2285 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2286 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2287 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2288 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2289 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2290 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2291 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2292 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2293 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2294 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2295 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2296 #define IMAGE_FILE_SYSTEM 0x1000
2297 #define IMAGE_FILE_DLL 0x2000
2298 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2299 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2301 /* These are the settings of the Machine field. */
2302 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2303 #define IMAGE_FILE_MACHINE_I860 0x014d
2304 #define IMAGE_FILE_MACHINE_I386 0x014c
2305 #define IMAGE_FILE_MACHINE_R3000 0x0162
2306 #define IMAGE_FILE_MACHINE_R4000 0x0166
2307 #define IMAGE_FILE_MACHINE_R10000 0x0168
2308 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2309 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2310 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2311 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2312 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2313 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2314 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2315 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2316 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2317 #define IMAGE_FILE_MACHINE_ARMV7 0x01c4
2318 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2319 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2320 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2321 #define IMAGE_FILE_MACHINE_IA64 0x0200
2322 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2323 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2324 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2325 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2326 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2327 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2328 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2329 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2330 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2331 #define IMAGE_FILE_MACHINE_M32R 0x9041
2332 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2334 /* Wine extension */
2335 #define IMAGE_FILE_MACHINE_SPARC 0x2000
2337 #define IMAGE_SIZEOF_FILE_HEADER 20
2338 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2339 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2340 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2341 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2342 #define IMAGE_SIZEOF_SHORT_NAME 8
2343 #define IMAGE_SIZEOF_SECTION_HEADER 40
2344 #define IMAGE_SIZEOF_SYMBOL 18
2345 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2346 #define IMAGE_SIZEOF_RELOCATION 10
2347 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2348 #define IMAGE_SIZEOF_LINENUMBER 6
2349 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2351 /* Possible Magic values */
2352 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2353 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2354 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2356 #ifdef _WIN64
2357 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2358 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2359 #else
2360 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2361 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2362 #endif
2364 /* These are indexes into the DataDirectory array */
2365 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2366 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2367 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2368 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2369 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2370 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2371 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2372 #define IMAGE_FILE_DESCRIPTION_STRING 7
2373 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2374 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2375 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2377 /* Directory Entries, indices into the DataDirectory array */
2379 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2380 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2381 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2382 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2383 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2384 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2385 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2386 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2387 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2388 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2389 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2390 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2391 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2392 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2393 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2395 /* Subsystem Values */
2397 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2398 #define IMAGE_SUBSYSTEM_NATIVE 1
2399 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2400 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2401 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2402 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2403 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2404 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2405 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2406 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2407 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2408 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2409 #define IMAGE_SUBSYSTEM_XBOX 14
2410 #define IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION 16
2412 /* DLL Characteristics */
2413 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2414 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2415 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2416 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2417 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2418 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2419 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2420 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2422 typedef struct _IMAGE_FILE_HEADER {
2423 WORD Machine;
2424 WORD NumberOfSections;
2425 DWORD TimeDateStamp;
2426 DWORD PointerToSymbolTable;
2427 DWORD NumberOfSymbols;
2428 WORD SizeOfOptionalHeader;
2429 WORD Characteristics;
2430 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2432 typedef struct _IMAGE_DATA_DIRECTORY {
2433 DWORD VirtualAddress;
2434 DWORD Size;
2435 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2437 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2439 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2440 WORD Magic; /* 0x20b */
2441 BYTE MajorLinkerVersion;
2442 BYTE MinorLinkerVersion;
2443 DWORD SizeOfCode;
2444 DWORD SizeOfInitializedData;
2445 DWORD SizeOfUninitializedData;
2446 DWORD AddressOfEntryPoint;
2447 DWORD BaseOfCode;
2448 ULONGLONG ImageBase;
2449 DWORD SectionAlignment;
2450 DWORD FileAlignment;
2451 WORD MajorOperatingSystemVersion;
2452 WORD MinorOperatingSystemVersion;
2453 WORD MajorImageVersion;
2454 WORD MinorImageVersion;
2455 WORD MajorSubsystemVersion;
2456 WORD MinorSubsystemVersion;
2457 DWORD Win32VersionValue;
2458 DWORD SizeOfImage;
2459 DWORD SizeOfHeaders;
2460 DWORD CheckSum;
2461 WORD Subsystem;
2462 WORD DllCharacteristics;
2463 ULONGLONG SizeOfStackReserve;
2464 ULONGLONG SizeOfStackCommit;
2465 ULONGLONG SizeOfHeapReserve;
2466 ULONGLONG SizeOfHeapCommit;
2467 DWORD LoaderFlags;
2468 DWORD NumberOfRvaAndSizes;
2469 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2470 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2472 typedef struct _IMAGE_NT_HEADERS64 {
2473 DWORD Signature;
2474 IMAGE_FILE_HEADER FileHeader;
2475 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2476 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2478 typedef struct _IMAGE_OPTIONAL_HEADER {
2480 /* Standard fields */
2482 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
2483 BYTE MajorLinkerVersion;
2484 BYTE MinorLinkerVersion;
2485 DWORD SizeOfCode;
2486 DWORD SizeOfInitializedData;
2487 DWORD SizeOfUninitializedData;
2488 DWORD AddressOfEntryPoint; /* 0x10 */
2489 DWORD BaseOfCode;
2490 DWORD BaseOfData;
2492 /* NT additional fields */
2494 DWORD ImageBase;
2495 DWORD SectionAlignment; /* 0x20 */
2496 DWORD FileAlignment;
2497 WORD MajorOperatingSystemVersion;
2498 WORD MinorOperatingSystemVersion;
2499 WORD MajorImageVersion;
2500 WORD MinorImageVersion;
2501 WORD MajorSubsystemVersion; /* 0x30 */
2502 WORD MinorSubsystemVersion;
2503 DWORD Win32VersionValue;
2504 DWORD SizeOfImage;
2505 DWORD SizeOfHeaders;
2506 DWORD CheckSum; /* 0x40 */
2507 WORD Subsystem;
2508 WORD DllCharacteristics;
2509 DWORD SizeOfStackReserve;
2510 DWORD SizeOfStackCommit;
2511 DWORD SizeOfHeapReserve; /* 0x50 */
2512 DWORD SizeOfHeapCommit;
2513 DWORD LoaderFlags;
2514 DWORD NumberOfRvaAndSizes;
2515 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2516 /* 0xE0 */
2517 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2519 typedef struct _IMAGE_NT_HEADERS {
2520 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2521 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2522 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
2523 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2525 #ifdef _WIN64
2526 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2527 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2528 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2529 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2530 #else
2531 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2532 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2533 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2534 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2535 #endif
2537 #define IMAGE_SIZEOF_SHORT_NAME 8
2539 typedef struct _IMAGE_SECTION_HEADER {
2540 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2541 union {
2542 DWORD PhysicalAddress;
2543 DWORD VirtualSize;
2544 } Misc;
2545 DWORD VirtualAddress;
2546 DWORD SizeOfRawData;
2547 DWORD PointerToRawData;
2548 DWORD PointerToRelocations;
2549 DWORD PointerToLinenumbers;
2550 WORD NumberOfRelocations;
2551 WORD NumberOfLinenumbers;
2552 DWORD Characteristics;
2553 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2555 #define IMAGE_SIZEOF_SECTION_HEADER 40
2557 #define IMAGE_FIRST_SECTION(ntheader) \
2558 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2559 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2561 /* These defines are for the Characteristics bitfield. */
2562 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2563 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2564 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2565 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2566 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2567 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2569 #define IMAGE_SCN_CNT_CODE 0x00000020
2570 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2571 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2573 #define IMAGE_SCN_LNK_OTHER 0x00000100
2574 #define IMAGE_SCN_LNK_INFO 0x00000200
2575 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2576 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2577 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2579 /* 0x00002000 - Reserved */
2580 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2581 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2583 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2584 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2585 #define IMAGE_SCN_MEM_16BIT 0x00020000
2586 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2587 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2589 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2590 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2591 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2592 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2593 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2594 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2595 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2596 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2597 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2598 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2599 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2600 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2601 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2602 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2603 /* 0x00F00000 - Unused */
2604 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2606 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2609 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2610 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2611 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2612 #define IMAGE_SCN_MEM_SHARED 0x10000000
2613 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2614 #define IMAGE_SCN_MEM_READ 0x40000000
2615 #define IMAGE_SCN_MEM_WRITE 0x80000000
2617 #include <pshpack2.h>
2619 typedef struct _IMAGE_SYMBOL {
2620 union {
2621 BYTE ShortName[8];
2622 struct {
2623 DWORD Short;
2624 DWORD Long;
2625 } Name;
2626 DWORD LongName[2];
2627 } N;
2628 DWORD Value;
2629 SHORT SectionNumber;
2630 WORD Type;
2631 BYTE StorageClass;
2632 BYTE NumberOfAuxSymbols;
2633 } IMAGE_SYMBOL;
2634 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
2636 #define IMAGE_SIZEOF_SYMBOL 18
2638 typedef struct _IMAGE_LINENUMBER {
2639 union {
2640 DWORD SymbolTableIndex;
2641 DWORD VirtualAddress;
2642 } Type;
2643 WORD Linenumber;
2644 } IMAGE_LINENUMBER;
2645 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
2647 #define IMAGE_SIZEOF_LINENUMBER 6
2649 typedef union _IMAGE_AUX_SYMBOL {
2650 struct {
2651 DWORD TagIndex;
2652 union {
2653 struct {
2654 WORD Linenumber;
2655 WORD Size;
2656 } LnSz;
2657 DWORD TotalSize;
2658 } Misc;
2659 union {
2660 struct {
2661 DWORD PointerToLinenumber;
2662 DWORD PointerToNextFunction;
2663 } Function;
2664 struct {
2665 WORD Dimension[4];
2666 } Array;
2667 } FcnAry;
2668 WORD TvIndex;
2669 } Sym;
2670 struct {
2671 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2672 } File;
2673 struct {
2674 DWORD Length;
2675 WORD NumberOfRelocations;
2676 WORD NumberOfLinenumbers;
2677 DWORD CheckSum;
2678 SHORT Number;
2679 BYTE Selection;
2680 } Section;
2681 } IMAGE_AUX_SYMBOL;
2682 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2684 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2686 #include <poppack.h>
2688 #define IMAGE_SYM_UNDEFINED (SHORT)0
2689 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2690 #define IMAGE_SYM_DEBUG (SHORT)-2
2692 #define IMAGE_SYM_TYPE_NULL 0x0000
2693 #define IMAGE_SYM_TYPE_VOID 0x0001
2694 #define IMAGE_SYM_TYPE_CHAR 0x0002
2695 #define IMAGE_SYM_TYPE_SHORT 0x0003
2696 #define IMAGE_SYM_TYPE_INT 0x0004
2697 #define IMAGE_SYM_TYPE_LONG 0x0005
2698 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2699 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2700 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2701 #define IMAGE_SYM_TYPE_UNION 0x0009
2702 #define IMAGE_SYM_TYPE_ENUM 0x000A
2703 #define IMAGE_SYM_TYPE_MOE 0x000B
2704 #define IMAGE_SYM_TYPE_BYTE 0x000C
2705 #define IMAGE_SYM_TYPE_WORD 0x000D
2706 #define IMAGE_SYM_TYPE_UINT 0x000E
2707 #define IMAGE_SYM_TYPE_DWORD 0x000F
2708 #define IMAGE_SYM_TYPE_PCODE 0x8000
2710 #define IMAGE_SYM_DTYPE_NULL 0
2711 #define IMAGE_SYM_DTYPE_POINTER 1
2712 #define IMAGE_SYM_DTYPE_FUNCTION 2
2713 #define IMAGE_SYM_DTYPE_ARRAY 3
2715 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2716 #define IMAGE_SYM_CLASS_NULL 0x0000
2717 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2718 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2719 #define IMAGE_SYM_CLASS_STATIC 0x0003
2720 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2721 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2722 #define IMAGE_SYM_CLASS_LABEL 0x0006
2723 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2724 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2725 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2726 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2727 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2728 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2729 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2730 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2731 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2732 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2733 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2734 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2736 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2737 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2738 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2739 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2740 #define IMAGE_SYM_CLASS_FILE 0x0067
2741 #define IMAGE_SYM_CLASS_SECTION 0x0068
2742 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2744 #define N_BTMASK 0x000F
2745 #define N_TMASK 0x0030
2746 #define N_TMASK1 0x00C0
2747 #define N_TMASK2 0x00F0
2748 #define N_BTSHFT 4
2749 #define N_TSHIFT 2
2751 #define BTYPE(x) ((x) & N_BTMASK)
2753 #ifndef ISPTR
2754 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2755 #endif
2757 #ifndef ISFCN
2758 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2759 #endif
2761 #ifndef ISARY
2762 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2763 #endif
2765 #ifndef ISTAG
2766 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2767 #endif
2769 #ifndef INCREF
2770 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2771 #endif
2772 #ifndef DECREF
2773 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2774 #endif
2776 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2777 #define IMAGE_COMDAT_SELECT_ANY 2
2778 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2779 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2780 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2781 #define IMAGE_COMDAT_SELECT_LARGEST 6
2782 #define IMAGE_COMDAT_SELECT_NEWEST 7
2784 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2785 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2786 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2788 /* Export module directory */
2790 typedef struct _IMAGE_EXPORT_DIRECTORY {
2791 DWORD Characteristics;
2792 DWORD TimeDateStamp;
2793 WORD MajorVersion;
2794 WORD MinorVersion;
2795 DWORD Name;
2796 DWORD Base;
2797 DWORD NumberOfFunctions;
2798 DWORD NumberOfNames;
2799 DWORD AddressOfFunctions;
2800 DWORD AddressOfNames;
2801 DWORD AddressOfNameOrdinals;
2802 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2804 /* Import name entry */
2805 typedef struct _IMAGE_IMPORT_BY_NAME {
2806 WORD Hint;
2807 BYTE Name[1];
2808 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2810 #include <pshpack8.h>
2811 /* Import thunk */
2812 typedef struct _IMAGE_THUNK_DATA64 {
2813 union {
2814 ULONGLONG ForwarderString;
2815 ULONGLONG Function;
2816 ULONGLONG Ordinal;
2817 ULONGLONG AddressOfData;
2818 } u1;
2819 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
2820 #include <poppack.h>
2822 typedef struct _IMAGE_THUNK_DATA32 {
2823 union {
2824 DWORD ForwarderString;
2825 DWORD Function;
2826 DWORD Ordinal;
2827 DWORD AddressOfData;
2828 } u1;
2829 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
2831 /* Import module directory */
2833 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2834 union {
2835 DWORD Characteristics; /* 0 for terminating null import descriptor */
2836 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
2837 } DUMMYUNIONNAME;
2838 DWORD TimeDateStamp; /* 0 if not bound,
2839 * -1 if bound, and real date\time stamp
2840 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2841 * (new BIND)
2842 * otherwise date/time stamp of DLL bound to
2843 * (Old BIND)
2845 DWORD ForwarderChain; /* -1 if no forwarders */
2846 DWORD Name;
2847 /* RVA to IAT (if bound this IAT has actual addresses) */
2848 DWORD FirstThunk;
2849 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2851 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
2852 #define IMAGE_ORDINAL_FLAG32 0x80000000
2853 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
2854 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
2855 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
2856 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
2858 #ifdef _WIN64
2859 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
2860 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
2861 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
2862 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
2863 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
2864 #else
2865 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
2866 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
2867 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
2868 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
2869 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
2870 #endif
2872 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2874 DWORD TimeDateStamp;
2875 WORD OffsetModuleName;
2876 WORD NumberOfModuleForwarderRefs;
2877 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2878 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2880 typedef struct _IMAGE_BOUND_FORWARDER_REF
2882 DWORD TimeDateStamp;
2883 WORD OffsetModuleName;
2884 WORD Reserved;
2885 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2887 typedef struct _IMAGE_BASE_RELOCATION
2889 DWORD VirtualAddress;
2890 DWORD SizeOfBlock;
2891 /* WORD TypeOffset[1]; */
2892 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2894 #include <pshpack2.h>
2896 typedef struct _IMAGE_RELOCATION
2898 union {
2899 DWORD VirtualAddress;
2900 DWORD RelocCount;
2901 } DUMMYUNIONNAME;
2902 DWORD SymbolTableIndex;
2903 WORD Type;
2904 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2906 #include <poppack.h>
2908 #define IMAGE_SIZEOF_RELOCATION 10
2910 /* generic relocation types */
2911 #define IMAGE_REL_BASED_ABSOLUTE 0
2912 #define IMAGE_REL_BASED_HIGH 1
2913 #define IMAGE_REL_BASED_LOW 2
2914 #define IMAGE_REL_BASED_HIGHLOW 3
2915 #define IMAGE_REL_BASED_HIGHADJ 4
2916 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2917 #define IMAGE_REL_BASED_ARM_MOV32A 5 /* yes, 5 too */
2918 #define IMAGE_REL_BASED_SECTION 6
2919 #define IMAGE_REL_BASED_REL 7
2920 #define IMAGE_REL_BASED_ARM_MOV32T 7 /* yes, 7 too */
2921 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2922 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2923 #define IMAGE_REL_BASED_DIR64 10
2924 #define IMAGE_REL_BASED_HIGH3ADJ 11
2926 /* I386 relocation types */
2927 #define IMAGE_REL_I386_ABSOLUTE 0
2928 #define IMAGE_REL_I386_DIR16 1
2929 #define IMAGE_REL_I386_REL16 2
2930 #define IMAGE_REL_I386_DIR32 6
2931 #define IMAGE_REL_I386_DIR32NB 7
2932 #define IMAGE_REL_I386_SEG12 9
2933 #define IMAGE_REL_I386_SECTION 10
2934 #define IMAGE_REL_I386_SECREL 11
2935 #define IMAGE_REL_I386_TOKEN 12
2936 #define IMAGE_REL_I386_SECREL7 13
2937 #define IMAGE_REL_I386_REL32 20
2939 /* MIPS relocation types */
2940 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2941 #define IMAGE_REL_MIPS_REFHALF 0x0001
2942 #define IMAGE_REL_MIPS_REFWORD 0x0002
2943 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2944 #define IMAGE_REL_MIPS_REFHI 0x0004
2945 #define IMAGE_REL_MIPS_REFLO 0x0005
2946 #define IMAGE_REL_MIPS_GPREL 0x0006
2947 #define IMAGE_REL_MIPS_LITERAL 0x0007
2948 #define IMAGE_REL_MIPS_SECTION 0x000A
2949 #define IMAGE_REL_MIPS_SECREL 0x000B
2950 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2951 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2952 #define IMAGE_REL_MIPS_TOKEN 0x000E
2953 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2954 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2955 #define IMAGE_REL_MIPS_PAIR 0x0025
2957 /* ALPHA relocation types */
2958 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2959 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2960 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2961 #define IMAGE_REL_ALPHA_GPREL 0x0003
2962 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2963 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2964 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2965 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2966 #define IMAGE_REL_ALPHA_HINT 0x0008
2967 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2968 #define IMAGE_REL_ALPHA_REFHI 0x000A
2969 #define IMAGE_REL_ALPHA_REFLO 0x000B
2970 #define IMAGE_REL_ALPHA_PAIR 0x000C
2971 #define IMAGE_REL_ALPHA_MATCH 0x000D
2972 #define IMAGE_REL_ALPHA_SECTION 0x000E
2973 #define IMAGE_REL_ALPHA_SECREL 0x000F
2974 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2975 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2976 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2977 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2978 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2979 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2980 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2981 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2983 /* PowerPC relocation types */
2984 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2985 #define IMAGE_REL_PPC_ADDR64 0x0001
2986 #define IMAGE_REL_PPC_ADDR 0x0002
2987 #define IMAGE_REL_PPC_ADDR24 0x0003
2988 #define IMAGE_REL_PPC_ADDR16 0x0004
2989 #define IMAGE_REL_PPC_ADDR14 0x0005
2990 #define IMAGE_REL_PPC_REL24 0x0006
2991 #define IMAGE_REL_PPC_REL14 0x0007
2992 #define IMAGE_REL_PPC_TOCREL16 0x0008
2993 #define IMAGE_REL_PPC_TOCREL14 0x0009
2994 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2995 #define IMAGE_REL_PPC_SECREL 0x000B
2996 #define IMAGE_REL_PPC_SECTION 0x000C
2997 #define IMAGE_REL_PPC_IFGLUE 0x000D
2998 #define IMAGE_REL_PPC_IMGLUE 0x000E
2999 #define IMAGE_REL_PPC_SECREL16 0x000F
3000 #define IMAGE_REL_PPC_REFHI 0x0010
3001 #define IMAGE_REL_PPC_REFLO 0x0011
3002 #define IMAGE_REL_PPC_PAIR 0x0012
3003 #define IMAGE_REL_PPC_SECRELLO 0x0013
3004 #define IMAGE_REL_PPC_SECRELHI 0x0014
3005 #define IMAGE_REL_PPC_GPREL 0x0015
3006 #define IMAGE_REL_PPC_TOKEN 0x0016
3007 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3008 /* modifier bits */
3009 #define IMAGE_REL_PPC_NEG 0x0100
3010 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3011 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3012 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3014 /* SH3 relocation types */
3015 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3016 #define IMAGE_REL_SH3_DIRECT16 0x0001
3017 #define IMAGE_REL_SH3_DIRECT 0x0002
3018 #define IMAGE_REL_SH3_DIRECT8 0x0003
3019 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3020 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3021 #define IMAGE_REL_SH3_DIRECT4 0x0006
3022 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3023 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3024 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3025 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3026 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3027 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3028 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3029 #define IMAGE_REL_SH3_SECTION 0x000E
3030 #define IMAGE_REL_SH3_SECREL 0x000F
3031 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3032 #define IMAGE_REL_SH3_GPREL4_LONG 0x0011
3033 #define IMAGE_REL_SH3_TOKEN 0x0012
3035 /* ARM relocation types */
3036 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3037 #define IMAGE_REL_ARM_ADDR 0x0001
3038 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3039 #define IMAGE_REL_ARM_BRANCH24 0x0003
3040 #define IMAGE_REL_ARM_BRANCH11 0x0004
3041 #define IMAGE_REL_ARM_TOKEN 0x0005
3042 #define IMAGE_REL_ARM_GPREL12 0x0006
3043 #define IMAGE_REL_ARM_GPREL7 0x0007
3044 #define IMAGE_REL_ARM_BLX24 0x0008
3045 #define IMAGE_REL_ARM_BLX11 0x0009
3046 #define IMAGE_REL_ARM_SECTION 0x000E
3047 #define IMAGE_REL_ARM_SECREL 0x000F
3048 #define IMAGE_REL_ARM_MOV32A 0x0010
3049 #define IMAGE_REL_ARM_MOV32T 0x0011
3050 #define IMAGE_REL_ARM_BRANCH20T 0x0012
3051 #define IMAGE_REL_ARM_BRANCH24T 0x0014
3052 #define IMAGE_REL_ARM_BLX23T 0x0015
3054 /* IA64 relocation types */
3055 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3056 #define IMAGE_REL_IA64_IMM14 0x0001
3057 #define IMAGE_REL_IA64_IMM22 0x0002
3058 #define IMAGE_REL_IA64_IMM64 0x0003
3059 #define IMAGE_REL_IA64_DIR 0x0004
3060 #define IMAGE_REL_IA64_DIR64 0x0005
3061 #define IMAGE_REL_IA64_PCREL21B 0x0006
3062 #define IMAGE_REL_IA64_PCREL21M 0x0007
3063 #define IMAGE_REL_IA64_PCREL21F 0x0008
3064 #define IMAGE_REL_IA64_GPREL22 0x0009
3065 #define IMAGE_REL_IA64_LTOFF22 0x000A
3066 #define IMAGE_REL_IA64_SECTION 0x000B
3067 #define IMAGE_REL_IA64_SECREL22 0x000C
3068 #define IMAGE_REL_IA64_SECREL64I 0x000D
3069 #define IMAGE_REL_IA64_SECREL 0x000E
3070 #define IMAGE_REL_IA64_LTOFF64 0x000F
3071 #define IMAGE_REL_IA64_DIR32NB 0x0010
3072 #define IMAGE_REL_IA64_SREL14 0x0011
3073 #define IMAGE_REL_IA64_SREL22 0x0012
3074 #define IMAGE_REL_IA64_SREL32 0x0013
3075 #define IMAGE_REL_IA64_UREL32 0x0014
3076 #define IMAGE_REL_IA64_PCREL60X 0x0015
3077 #define IMAGE_REL_IA64_PCREL60B 0x0016
3078 #define IMAGE_REL_IA64_PCREL60F 0x0017
3079 #define IMAGE_REL_IA64_PCREL60I 0x0018
3080 #define IMAGE_REL_IA64_PCREL60M 0x0019
3081 #define IMAGE_REL_IA64_IMMGPREL64 0x001A
3082 #define IMAGE_REL_IA64_TOKEN 0x001B
3083 #define IMAGE_REL_IA64_GPREL32 0x001C
3084 #define IMAGE_REL_IA64_ADDEND 0x001F
3086 /* AMD64 relocation types */
3087 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
3088 #define IMAGE_REL_AMD64_ADDR64 0x0001
3089 #define IMAGE_REL_AMD64_ADDR32 0x0002
3090 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
3091 #define IMAGE_REL_AMD64_REL32 0x0004
3092 #define IMAGE_REL_AMD64_REL32_1 0x0005
3093 #define IMAGE_REL_AMD64_REL32_2 0x0006
3094 #define IMAGE_REL_AMD64_REL32_3 0x0007
3095 #define IMAGE_REL_AMD64_REL32_4 0x0008
3096 #define IMAGE_REL_AMD64_REL32_5 0x0009
3097 #define IMAGE_REL_AMD64_SECTION 0x000A
3098 #define IMAGE_REL_AMD64_SECREL 0x000B
3099 #define IMAGE_REL_AMD64_SECREL7 0x000C
3100 #define IMAGE_REL_AMD64_TOKEN 0x000D
3101 #define IMAGE_REL_AMD64_SREL32 0x000E
3102 #define IMAGE_REL_AMD64_PAIR 0x000F
3103 #define IMAGE_REL_AMD64_SSPAN32 0x0010
3105 /* archive format */
3107 #define IMAGE_ARCHIVE_START_SIZE 8
3108 #define IMAGE_ARCHIVE_START "!<arch>\n"
3109 #define IMAGE_ARCHIVE_END "`\n"
3110 #define IMAGE_ARCHIVE_PAD "\n"
3111 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3112 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3114 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3116 BYTE Name[16];
3117 BYTE Date[12];
3118 BYTE UserID[6];
3119 BYTE GroupID[6];
3120 BYTE Mode[8];
3121 BYTE Size[10];
3122 BYTE EndHeader[2];
3123 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3125 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3127 typedef struct _IMPORT_OBJECT_HEADER
3129 WORD Sig1;
3130 WORD Sig2;
3131 WORD Version;
3132 WORD Machine;
3133 DWORD TimeDateStamp;
3134 DWORD SizeOfData;
3135 union
3137 WORD Ordinal;
3138 WORD Hint;
3139 } DUMMYUNIONNAME;
3140 WORD Type : 2;
3141 WORD NameType : 3;
3142 WORD Reserved : 11;
3143 } IMPORT_OBJECT_HEADER;
3145 #define IMPORT_OBJECT_HDR_SIG2 0xffff
3147 typedef enum IMPORT_OBJECT_TYPE
3149 IMPORT_OBJECT_CODE = 0,
3150 IMPORT_OBJECT_DATA = 1,
3151 IMPORT_OBJECT_CONST = 2
3152 } IMPORT_OBJECT_TYPE;
3154 typedef enum IMPORT_OBJECT_NAME_TYPE
3156 IMPORT_OBJECT_ORDINAL = 0,
3157 IMPORT_OBJECT_NAME = 1,
3158 IMPORT_OBJECT_NAME_NO_PREFIX = 2,
3159 IMPORT_OBJECT_NAME_UNDECORATE = 3
3160 } IMPORT_OBJECT_NAME_TYPE;
3162 typedef struct _ANON_OBJECT_HEADER
3164 WORD Sig1;
3165 WORD Sig2;
3166 WORD Version;
3167 WORD Machine;
3168 DWORD TimeDateStamp;
3169 CLSID ClassID;
3170 DWORD SizeOfData;
3171 } ANON_OBJECT_HEADER;
3174 * Resource directory stuff
3176 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3177 DWORD Characteristics;
3178 DWORD TimeDateStamp;
3179 WORD MajorVersion;
3180 WORD MinorVersion;
3181 WORD NumberOfNamedEntries;
3182 WORD NumberOfIdEntries;
3183 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3184 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3186 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3187 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3189 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3190 union {
3191 struct {
3192 #ifdef BITFIELDS_BIGENDIAN
3193 unsigned NameIsString:1;
3194 unsigned NameOffset:31;
3195 #else
3196 unsigned NameOffset:31;
3197 unsigned NameIsString:1;
3198 #endif
3199 } DUMMYSTRUCTNAME1;
3200 DWORD Name;
3201 struct {
3202 #ifdef WORDS_BIGENDIAN
3203 WORD __pad;
3204 WORD Id;
3205 #else
3206 WORD Id;
3207 WORD __pad;
3208 #endif
3209 } DUMMYSTRUCTNAME2;
3210 } DUMMYUNIONNAME1;
3211 union {
3212 DWORD OffsetToData;
3213 struct {
3214 #ifdef BITFIELDS_BIGENDIAN
3215 unsigned DataIsDirectory:1;
3216 unsigned OffsetToDirectory:31;
3217 #else
3218 unsigned OffsetToDirectory:31;
3219 unsigned DataIsDirectory:1;
3220 #endif
3221 } DUMMYSTRUCTNAME3;
3222 } DUMMYUNIONNAME2;
3223 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3226 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3227 WORD Length;
3228 CHAR NameString[ 1 ];
3229 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3231 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3232 WORD Length;
3233 WCHAR NameString[ 1 ];
3234 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3236 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3237 DWORD OffsetToData;
3238 DWORD Size;
3239 DWORD CodePage;
3240 DWORD Reserved;
3241 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3244 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
3245 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3248 typedef struct _IMAGE_TLS_DIRECTORY64 {
3249 ULONGLONG StartAddressOfRawData;
3250 ULONGLONG EndAddressOfRawData;
3251 ULONGLONG AddressOfIndex;
3252 ULONGLONG AddressOfCallBacks;
3253 DWORD SizeOfZeroFill;
3254 DWORD Characteristics;
3255 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3257 typedef struct _IMAGE_TLS_DIRECTORY32 {
3258 DWORD StartAddressOfRawData;
3259 DWORD EndAddressOfRawData;
3260 DWORD AddressOfIndex;
3261 DWORD AddressOfCallBacks;
3262 DWORD SizeOfZeroFill;
3263 DWORD Characteristics;
3264 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3266 #ifdef _WIN64
3267 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3268 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3269 #else
3270 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3271 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3272 #endif
3274 typedef struct _IMAGE_DEBUG_DIRECTORY {
3275 DWORD Characteristics;
3276 DWORD TimeDateStamp;
3277 WORD MajorVersion;
3278 WORD MinorVersion;
3279 DWORD Type;
3280 DWORD SizeOfData;
3281 DWORD AddressOfRawData;
3282 DWORD PointerToRawData;
3283 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3285 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3286 #define IMAGE_DEBUG_TYPE_COFF 1
3287 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3288 #define IMAGE_DEBUG_TYPE_FPO 3
3289 #define IMAGE_DEBUG_TYPE_MISC 4
3290 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3291 #define IMAGE_DEBUG_TYPE_FIXUP 6
3292 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3293 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3294 #define IMAGE_DEBUG_TYPE_BORLAND 9
3295 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3297 typedef enum ReplacesCorHdrNumericDefines
3299 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3300 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3301 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3302 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3303 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3305 COR_VERSION_MAJOR_V2 = 2,
3306 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3307 COR_VERSION_MINOR = 0,
3308 COR_DELETED_NAME_LENGTH = 8,
3309 COR_VTABLEGAP_NAME_LENGTH = 8,
3311 NATIVE_TYPE_MAX_CB = 1,
3312 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xff,
3314 IMAGE_COR_MIH_METHODRVA = 0x01,
3315 IMAGE_COR_MIH_EHRVA = 0x02,
3316 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3318 COR_VTABLE_32BIT = 0x01,
3319 COR_VTABLE_64BIT = 0x02,
3320 COR_VTABLE_FROM_UNMANAGED = 0x04,
3321 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3323 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3325 MAX_CLASS_NAME = 1024,
3326 MAX_PACKAGE_NAME = 1024,
3327 } ReplacesCorHdrNumericDefines;
3329 typedef struct IMAGE_COR20_HEADER
3331 DWORD cb;
3332 WORD MajorRuntimeVersion;
3333 WORD MinorRuntimeVersion;
3335 IMAGE_DATA_DIRECTORY MetaData;
3336 DWORD Flags;
3337 DWORD EntryPointToken;
3339 IMAGE_DATA_DIRECTORY Resources;
3340 IMAGE_DATA_DIRECTORY StrongNameSignature;
3341 IMAGE_DATA_DIRECTORY CodeManagerTable;
3342 IMAGE_DATA_DIRECTORY VTableFixups;
3343 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3344 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3346 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3348 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3349 DWORD NumberOfSymbols;
3350 DWORD LvaToFirstSymbol;
3351 DWORD NumberOfLinenumbers;
3352 DWORD LvaToFirstLinenumber;
3353 DWORD RvaToFirstByteOfCode;
3354 DWORD RvaToLastByteOfCode;
3355 DWORD RvaToFirstByteOfData;
3356 DWORD RvaToLastByteOfData;
3357 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3359 #define FRAME_FPO 0
3360 #define FRAME_TRAP 1
3361 #define FRAME_TSS 2
3362 #define FRAME_NONFPO 3
3364 typedef struct _FPO_DATA {
3365 DWORD ulOffStart;
3366 DWORD cbProcSize;
3367 DWORD cdwLocals;
3368 WORD cdwParams;
3369 WORD cbProlog : 8;
3370 WORD cbRegs : 3;
3371 WORD fHasSEH : 1;
3372 WORD fUseBP : 1;
3373 WORD reserved : 1;
3374 WORD cbFrame : 2;
3375 } FPO_DATA, *PFPO_DATA;
3377 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
3378 DWORD Size;
3379 DWORD TimeDateStamp;
3380 WORD MajorVersion;
3381 WORD MinorVersion;
3382 DWORD GlobalFlagsClear;
3383 DWORD GlobalFlagsSet;
3384 DWORD CriticalSectionDefaultTimeout;
3385 DWORD DeCommitFreeBlockThreshold;
3386 DWORD DeCommitTotalFreeThreshold;
3387 PVOID LockPrefixTable;
3388 DWORD MaximumAllocationSize;
3389 DWORD VirtualMemoryThreshold;
3390 DWORD ProcessHeapFlags;
3391 DWORD ProcessAffinityMask;
3392 WORD CSDVersion;
3393 WORD Reserved1;
3394 PVOID EditList;
3395 DWORD SecurityCookie;
3396 DWORD SEHandlerTable;
3397 DWORD SEHandlerCount;
3398 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3400 typedef struct _IMAGE_FUNCTION_ENTRY {
3401 DWORD StartingAddress;
3402 DWORD EndingAddress;
3403 DWORD EndOfPrologue;
3404 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3406 #define IMAGE_DEBUG_MISC_EXENAME 1
3408 typedef struct _IMAGE_DEBUG_MISC {
3409 DWORD DataType;
3410 DWORD Length;
3411 BYTE Unicode;
3412 BYTE Reserved[ 3 ];
3413 BYTE Data[ 1 ];
3414 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3416 /* This is the structure that appears at the very start of a .DBG file. */
3418 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3419 WORD Signature;
3420 WORD Flags;
3421 WORD Machine;
3422 WORD Characteristics;
3423 DWORD TimeDateStamp;
3424 DWORD CheckSum;
3425 DWORD ImageBase;
3426 DWORD SizeOfImage;
3427 DWORD NumberOfSections;
3428 DWORD ExportedNamesSize;
3429 DWORD DebugDirectorySize;
3430 DWORD SectionAlignment;
3431 DWORD Reserved[ 2 ];
3432 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3434 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3437 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3438 WORD Length;
3439 WORD Flags;
3440 BYTE Text[1];
3441 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3442 #define MESSAGE_RESOURCE_UNICODE 0x0001
3444 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3445 DWORD LowId;
3446 DWORD HighId;
3447 DWORD OffsetToEntries;
3448 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3450 typedef struct tagMESSAGE_RESOURCE_DATA {
3451 DWORD NumberOfBlocks;
3452 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3453 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3456 * Here follows typedefs for security and tokens.
3460 * First a constant for the following typedefs.
3463 #define ANYSIZE_ARRAY 1
3465 /* FIXME: Orphan. What does it point to? */
3466 typedef PVOID PACCESS_TOKEN;
3467 typedef PVOID PSECURITY_DESCRIPTOR;
3468 typedef PVOID PSID;
3470 typedef enum _TOKEN_ELEVATION_TYPE {
3471 TokenElevationTypeDefault = 1,
3472 TokenElevationTypeFull,
3473 TokenElevationTypeLimited
3474 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE;
3477 * TOKEN_INFORMATION_CLASS
3480 typedef enum _TOKEN_INFORMATION_CLASS {
3481 TokenUser = 1,
3482 TokenGroups,
3483 TokenPrivileges,
3484 TokenOwner,
3485 TokenPrimaryGroup,
3486 TokenDefaultDacl,
3487 TokenSource,
3488 TokenType,
3489 TokenImpersonationLevel,
3490 TokenStatistics,
3491 TokenRestrictedSids,
3492 TokenSessionId,
3493 TokenGroupsAndPrivileges,
3494 TokenSessionReference,
3495 TokenSandBoxInert,
3496 TokenAuditPolicy,
3497 TokenOrigin,
3498 TokenElevationType,
3499 TokenLinkedToken,
3500 TokenElevation,
3501 TokenHasRestrictions,
3502 TokenAccessInformation,
3503 TokenVirtualizationAllowed,
3504 TokenVirtualizationEnabled,
3505 TokenIntegrityLevel,
3506 TokenUIAccess,
3507 TokenMandatoryPolicy,
3508 TokenLogonSid,
3509 MaxTokenInfoClass
3510 } TOKEN_INFORMATION_CLASS;
3512 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3513 #define TOKEN_ADJUST_GROUPS 0x0040
3514 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3515 #define TOKEN_ADJUST_SESSIONID 0x0100
3516 #define TOKEN_ASSIGN_PRIMARY 0x0001
3517 #define TOKEN_DUPLICATE 0x0002
3518 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3519 #define TOKEN_IMPERSONATE 0x0004
3520 #define TOKEN_QUERY 0x0008
3521 #define TOKEN_QUERY_SOURCE 0x0010
3522 #define TOKEN_ADJUST_DEFAULT 0x0080
3523 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3524 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3525 TOKEN_ADJUST_PRIVILEGES | \
3526 TOKEN_ADJUST_GROUPS | \
3527 TOKEN_ADJUST_DEFAULT )
3528 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3529 TOKEN_ASSIGN_PRIMARY | \
3530 TOKEN_DUPLICATE | \
3531 TOKEN_IMPERSONATE | \
3532 TOKEN_QUERY | \
3533 TOKEN_QUERY_SOURCE | \
3534 TOKEN_ADJUST_PRIVILEGES | \
3535 TOKEN_ADJUST_GROUPS | \
3536 TOKEN_ADJUST_SESSIONID | \
3537 TOKEN_ADJUST_DEFAULT )
3539 #ifndef _SECURITY_DEFINED
3540 #define _SECURITY_DEFINED
3543 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3545 typedef struct _GENERIC_MAPPING {
3546 ACCESS_MASK GenericRead;
3547 ACCESS_MASK GenericWrite;
3548 ACCESS_MASK GenericExecute;
3549 ACCESS_MASK GenericAll;
3550 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3552 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3553 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3554 typedef struct {
3555 BYTE Value[6];
3556 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
3557 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3559 #ifndef SID_DEFINED
3560 #define SID_DEFINED
3561 typedef struct _SID {
3562 BYTE Revision;
3563 BYTE SubAuthorityCount;
3564 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3565 DWORD SubAuthority[1];
3566 } SID,*PISID;
3567 #endif /* !defined(SID_DEFINED) */
3569 #define SID_REVISION (1) /* Current revision */
3570 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3571 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3573 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3576 * ACL
3579 #define ACL_REVISION1 1
3580 #define ACL_REVISION2 2
3581 #define ACL_REVISION3 3
3582 #define ACL_REVISION4 4
3584 #define MIN_ACL_REVISION ACL_REVISION2
3585 #define MAX_ACL_REVISION ACL_REVISION4
3587 #define ACL_REVISION 2
3589 typedef struct _ACL {
3590 BYTE AclRevision;
3591 BYTE Sbz1;
3592 WORD AclSize;
3593 WORD AceCount;
3594 WORD Sbz2;
3595 } ACL, *PACL;
3597 typedef enum _ACL_INFORMATION_CLASS
3599 AclRevisionInformation = 1,
3600 AclSizeInformation
3601 } ACL_INFORMATION_CLASS;
3603 typedef struct _ACL_REVISION_INFORMATION
3605 DWORD AclRevision;
3606 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
3608 typedef struct _ACL_SIZE_INFORMATION
3610 DWORD AceCount;
3611 DWORD AclBytesInUse;
3612 DWORD AclBytesFree;
3613 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
3615 /* SECURITY_DESCRIPTOR */
3616 #define SECURITY_DESCRIPTOR_REVISION 1
3617 #define SECURITY_DESCRIPTOR_REVISION1 1
3621 * Privilege Names
3623 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3624 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3625 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3626 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3627 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3628 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3629 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3630 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3631 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3632 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3633 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3634 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3635 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3636 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3637 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3638 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3639 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3640 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3641 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3642 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3643 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3644 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3645 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3646 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3647 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3648 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3649 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3650 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3651 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3653 #define SE_GROUP_MANDATORY 0x00000001
3654 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3655 #define SE_GROUP_ENABLED 0x00000004
3656 #define SE_GROUP_OWNER 0x00000008
3657 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3658 #define SE_GROUP_LOGON_ID 0xC0000000
3659 #define SE_GROUP_RESOURCE 0x20000000
3661 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3662 #define SE_PRIVILEGE_ENABLED 0x00000002
3663 #define SE_PRIVILEGE_REMOVED 0x00000004
3664 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3666 #define PRIVILEGE_SET_ALL_NECESSARY 1
3668 #define SE_OWNER_DEFAULTED 0x00000001
3669 #define SE_GROUP_DEFAULTED 0x00000002
3670 #define SE_DACL_PRESENT 0x00000004
3671 #define SE_DACL_DEFAULTED 0x00000008
3672 #define SE_SACL_PRESENT 0x00000010
3673 #define SE_SACL_DEFAULTED 0x00000020
3674 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3675 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3676 #define SE_DACL_AUTO_INHERITED 0x00000400
3677 #define SE_SACL_AUTO_INHERITED 0x00000800
3678 #define SE_DACL_PROTECTED 0x00001000
3679 #define SE_SACL_PROTECTED 0x00002000
3680 #define SE_RM_CONTROL_VALID 0x00004000
3681 #define SE_SELF_RELATIVE 0x00008000
3683 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
3684 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
3686 /* The security descriptor structure */
3687 typedef struct {
3688 BYTE Revision;
3689 BYTE Sbz1;
3690 SECURITY_DESCRIPTOR_CONTROL Control;
3691 DWORD Owner;
3692 DWORD Group;
3693 DWORD Sacl;
3694 DWORD Dacl;
3695 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3697 typedef struct {
3698 BYTE Revision;
3699 BYTE Sbz1;
3700 SECURITY_DESCRIPTOR_CONTROL Control;
3701 PSID Owner;
3702 PSID Group;
3703 PACL Sacl;
3704 PACL Dacl;
3705 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3707 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3709 #endif /* _SECURITY_DEFINED */
3712 * SID_AND_ATTRIBUTES
3715 typedef struct _SID_AND_ATTRIBUTES {
3716 PSID Sid;
3717 DWORD Attributes;
3718 } SID_AND_ATTRIBUTES, *PSID_AND_ATTRIBUTES;
3720 /* security entities */
3721 #define SECURITY_NULL_RID __MSABI_LONG(0x00000000)
3722 #define SECURITY_WORLD_RID __MSABI_LONG(0x00000000)
3723 #define SECURITY_LOCAL_RID __MSABI_LONG(0X00000000)
3725 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3727 /* S-1-1 */
3728 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3730 /* S-1-2 */
3731 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3733 /* S-1-3 */
3734 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3735 #define SECURITY_CREATOR_OWNER_RID __MSABI_LONG(0x00000000)
3736 #define SECURITY_CREATOR_GROUP_RID __MSABI_LONG(0x00000001)
3737 #define SECURITY_CREATOR_OWNER_SERVER_RID __MSABI_LONG(0x00000002)
3738 #define SECURITY_CREATOR_GROUP_SERVER_RID __MSABI_LONG(0x00000003)
3740 /* S-1-4 */
3741 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3743 /* S-1-5 */
3744 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3745 #define SECURITY_DIALUP_RID __MSABI_LONG(0x00000001)
3746 #define SECURITY_NETWORK_RID __MSABI_LONG(0x00000002)
3747 #define SECURITY_BATCH_RID __MSABI_LONG(0x00000003)
3748 #define SECURITY_INTERACTIVE_RID __MSABI_LONG(0x00000004)
3749 #define SECURITY_LOGON_IDS_RID __MSABI_LONG(0x00000005)
3750 #define SECURITY_SERVICE_RID __MSABI_LONG(0x00000006)
3751 #define SECURITY_ANONYMOUS_LOGON_RID __MSABI_LONG(0x00000007)
3752 #define SECURITY_PROXY_RID __MSABI_LONG(0x00000008)
3753 #define SECURITY_ENTERPRISE_CONTROLLERS_RID __MSABI_LONG(0x00000009)
3754 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3755 #define SECURITY_PRINCIPAL_SELF_RID __MSABI_LONG(0x0000000A)
3756 #define SECURITY_AUTHENTICATED_USER_RID __MSABI_LONG(0x0000000B)
3757 #define SECURITY_RESTRICTED_CODE_RID __MSABI_LONG(0x0000000C)
3758 #define SECURITY_TERMINAL_SERVER_RID __MSABI_LONG(0x0000000D)
3759 #define SECURITY_REMOTE_LOGON_RID __MSABI_LONG(0x0000000E)
3760 #define SECURITY_THIS_ORGANIZATION_RID __MSABI_LONG(0x0000000F)
3761 #define SECURITY_LOCAL_SYSTEM_RID __MSABI_LONG(0x00000012)
3762 #define SECURITY_LOCAL_SERVICE_RID __MSABI_LONG(0x00000013)
3763 #define SECURITY_NETWORK_SERVICE_RID __MSABI_LONG(0x00000014)
3764 #define SECURITY_NT_NON_UNIQUE __MSABI_LONG(0x00000015)
3765 #define SECURITY_BUILTIN_DOMAIN_RID __MSABI_LONG(0x00000020)
3767 #define SECURITY_PACKAGE_BASE_RID __MSABI_LONG(0x00000040)
3768 #define SECURITY_PACKAGE_NTLM_RID __MSABI_LONG(0x0000000A)
3769 #define SECURITY_PACKAGE_SCHANNEL_RID __MSABI_LONG(0x0000000E)
3770 #define SECURITY_PACKAGE_DIGEST_RID __MSABI_LONG(0x00000015)
3771 #define SECURITY_MAX_ALWAYS_FILTERED __MSABI_LONG(0x000003E7)
3772 #define SECURITY_MIN_NEVER_FILTERED __MSABI_LONG(0x000003E8)
3773 #define SECURITY_OTHER_ORGANIZATION_RID __MSABI_LONG(0x000003E8)
3775 #define FOREST_USER_RID_MAX __MSABI_LONG(0x000001F3)
3776 #define DOMAIN_USER_RID_ADMIN __MSABI_LONG(0x000001F4)
3777 #define DOMAIN_USER_RID_GUEST __MSABI_LONG(0x000001F5)
3778 #define DOMAIN_USER_RID_KRBTGT __MSABI_LONG(0x000001F6)
3779 #define DOMAIN_USER_RID_MAX __MSABI_LONG(0x000003E7)
3781 #define DOMAIN_GROUP_RID_ADMINS __MSABI_LONG(0x00000200)
3782 #define DOMAIN_GROUP_RID_USERS __MSABI_LONG(0x00000201)
3783 #define DOMAIN_GROUP_RID_GUESTS __MSABI_LONG(0x00000202)
3784 #define DOMAIN_GROUP_RID_COMPUTERS __MSABI_LONG(0x00000203)
3785 #define DOMAIN_GROUP_RID_CONTROLLERS __MSABI_LONG(0x00000204)
3786 #define DOMAIN_GROUP_RID_CERT_ADMINS __MSABI_LONG(0x00000205)
3787 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS __MSABI_LONG(0x00000206)
3788 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS __MSABI_LONG(0x00000207)
3789 #define DOMAIN_GROUP_RID_POLICY_ADMINS __MSABI_LONG(0x00000208)
3791 #define SECURITY_MANDATORY_LABEL_AUTHORITY {0,0,0,0,0,16}
3792 #define SECURITY_MANDATORY_UNTRUSTED_RID __MSABI_LONG(0x00000000)
3793 #define SECURITY_MANDATORY_LOW_RID __MSABI_LONG(0x00001000)
3794 #define SECURITY_MANDATORY_MEDIUM_RID __MSABI_LONG(0x00002000)
3795 #define SECURITY_MANDATORY_HIGH_RID __MSABI_LONG(0x00003000)
3796 #define SECURITY_MANDATORY_SYSTEM_RID __MSABI_LONG(0x00004000)
3797 #define SECURITY_MANDATORY_PROTECTED_PROCESS_RID __MSABI_LONG(0x00005000)
3799 #define DOMAIN_ALIAS_RID_ADMINS __MSABI_LONG(0x00000220)
3800 #define DOMAIN_ALIAS_RID_USERS __MSABI_LONG(0x00000221)
3801 #define DOMAIN_ALIAS_RID_GUESTS __MSABI_LONG(0x00000222)
3802 #define DOMAIN_ALIAS_RID_POWER_USERS __MSABI_LONG(0x00000223)
3804 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS __MSABI_LONG(0x00000224)
3805 #define DOMAIN_ALIAS_RID_SYSTEM_OPS __MSABI_LONG(0x00000225)
3806 #define DOMAIN_ALIAS_RID_PRINT_OPS __MSABI_LONG(0x00000226)
3807 #define DOMAIN_ALIAS_RID_BACKUP_OPS __MSABI_LONG(0x00000227)
3809 #define DOMAIN_ALIAS_RID_REPLICATOR __MSABI_LONG(0x00000228)
3810 #define DOMAIN_ALIAS_RID_RAS_SERVERS __MSABI_LONG(0x00000229)
3811 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS __MSABI_LONG(0x0000022A)
3812 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS __MSABI_LONG(0x0000022B)
3813 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS __MSABI_LONG(0x0000022C)
3814 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS __MSABI_LONG(0x0000022D)
3816 #define DOMAIN_ALIAS_RID_MONITORING_USERS __MSABI_LONG(0x0000022E)
3817 #define DOMAIN_ALIAS_RID_LOGGING_USERS __MSABI_LONG(0x0000022F)
3818 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS __MSABI_LONG(0x00000230)
3819 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS __MSABI_LONG(0x00000231)
3820 #define DOMAIN_ALIAS_RID_DCOM_USERS __MSABI_LONG(0x00000232)
3822 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3824 #define SECURITY_PACKAGE_RID_COUNT __MSABI_LONG(2)
3825 #define SECURITY_LOGON_IDS_RID_COUNT __MSABI_LONG(3)
3827 typedef enum {
3828 WinNullSid = 0,
3829 WinWorldSid = 1,
3830 WinLocalSid = 2,
3831 WinCreatorOwnerSid = 3,
3832 WinCreatorGroupSid = 4,
3833 WinCreatorOwnerServerSid = 5,
3834 WinCreatorGroupServerSid = 6,
3835 WinNtAuthoritySid = 7,
3836 WinDialupSid = 8,
3837 WinNetworkSid = 9,
3838 WinBatchSid = 10,
3839 WinInteractiveSid = 11,
3840 WinServiceSid = 12,
3841 WinAnonymousSid = 13,
3842 WinProxySid = 14,
3843 WinEnterpriseControllersSid = 15,
3844 WinSelfSid = 16,
3845 WinAuthenticatedUserSid = 17,
3846 WinRestrictedCodeSid = 18,
3847 WinTerminalServerSid = 19,
3848 WinRemoteLogonIdSid = 20,
3849 WinLogonIdsSid = 21,
3850 WinLocalSystemSid = 22,
3851 WinLocalServiceSid = 23,
3852 WinNetworkServiceSid = 24,
3853 WinBuiltinDomainSid = 25,
3854 WinBuiltinAdministratorsSid = 26,
3855 WinBuiltinUsersSid = 27,
3856 WinBuiltinGuestsSid = 28,
3857 WinBuiltinPowerUsersSid = 29,
3858 WinBuiltinAccountOperatorsSid = 30,
3859 WinBuiltinSystemOperatorsSid = 31,
3860 WinBuiltinPrintOperatorsSid = 32,
3861 WinBuiltinBackupOperatorsSid = 33,
3862 WinBuiltinReplicatorSid = 34,
3863 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
3864 WinBuiltinRemoteDesktopUsersSid = 36,
3865 WinBuiltinNetworkConfigurationOperatorsSid = 37,
3866 WinAccountAdministratorSid = 38,
3867 WinAccountGuestSid = 39,
3868 WinAccountKrbtgtSid = 40,
3869 WinAccountDomainAdminsSid = 41,
3870 WinAccountDomainUsersSid = 42,
3871 WinAccountDomainGuestsSid = 43,
3872 WinAccountComputersSid = 44,
3873 WinAccountControllersSid = 45,
3874 WinAccountCertAdminsSid = 46,
3875 WinAccountSchemaAdminsSid = 47,
3876 WinAccountEnterpriseAdminsSid = 48,
3877 WinAccountPolicyAdminsSid = 49,
3878 WinAccountRasAndIasServersSid = 50,
3879 WinNTLMAuthenticationSid = 51,
3880 WinDigestAuthenticationSid = 52,
3881 WinSChannelAuthenticationSid = 53,
3882 WinThisOrganizationSid = 54,
3883 WinOtherOrganizationSid = 55,
3884 WinBuiltinIncomingForestTrustBuildersSid = 56,
3885 WinBuiltinPerfMonitoringUsersSid = 57,
3886 WinBuiltinPerfLoggingUsersSid = 58,
3887 WinBuiltinAuthorizationAccessSid = 59,
3888 WinBuiltinTerminalServerLicenseServersSid = 60,
3889 WinBuiltinDCOMUsersSid = 61,
3890 WinBuiltinIUsersSid = 62,
3891 WinIUserSid = 63,
3892 WinBuiltinCryptoOperatorsSid = 64,
3893 WinUntrustedLabelSid = 65,
3894 WinLowLabelSid = 66,
3895 WinMediumLabelSid = 67,
3896 WinHighLabelSid = 68,
3897 WinSystemLabelSid = 69,
3898 WinWriteRestrictedCodeSid = 70,
3899 WinCreatorOwnerRightsSid = 71,
3900 WinCacheablePrincipalsGroupSid = 72,
3901 WinNonCacheablePrincipalsGroupSid = 73,
3902 WinEnterpriseReadonlyControllersSid = 74,
3903 WinAccountReadonlyControllersSid = 75,
3904 WinBuiltinEventLogReadersGroup = 76,
3905 WinNewEnterpriseReadonlyControllersSid = 77,
3906 WinBuiltinCertSvcDComAccessGroup = 78,
3907 WinMediumPlusLabelSid = 79,
3908 WinLocalLogonSid = 80,
3909 WinConsoleLogonSid = 81,
3910 WinThisOrganizationCertificateSid = 82,
3911 } WELL_KNOWN_SID_TYPE;
3914 * TOKEN_USER
3917 typedef struct _TOKEN_USER {
3918 SID_AND_ATTRIBUTES User;
3919 } TOKEN_USER, *PTOKEN_USER;
3922 * TOKEN_GROUPS
3925 typedef struct _TOKEN_GROUPS {
3926 DWORD GroupCount;
3927 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3928 } TOKEN_GROUPS, *PTOKEN_GROUPS;
3931 * LUID_AND_ATTRIBUTES
3934 typedef union _LARGE_INTEGER {
3935 struct {
3936 #ifdef WORDS_BIGENDIAN
3937 LONG HighPart;
3938 DWORD LowPart;
3939 #else
3940 DWORD LowPart;
3941 LONG HighPart;
3942 #endif
3943 } u;
3944 #ifndef NONAMELESSSTRUCT
3945 struct {
3946 #ifdef WORDS_BIGENDIAN
3947 LONG HighPart;
3948 DWORD LowPart;
3949 #else
3950 DWORD LowPart;
3951 LONG HighPart;
3952 #endif
3954 #endif
3955 LONGLONG QuadPart;
3956 } LARGE_INTEGER, *PLARGE_INTEGER;
3958 typedef union _ULARGE_INTEGER {
3959 struct {
3960 #ifdef WORDS_BIGENDIAN
3961 DWORD HighPart;
3962 DWORD LowPart;
3963 #else
3964 DWORD LowPart;
3965 DWORD HighPart;
3966 #endif
3967 } u;
3968 #ifndef NONAMELESSSTRUCT
3969 struct {
3970 #ifdef WORDS_BIGENDIAN
3971 DWORD HighPart;
3972 DWORD LowPart;
3973 #else
3974 DWORD LowPart;
3975 DWORD HighPart;
3976 #endif
3978 #endif
3979 ULONGLONG QuadPart;
3980 } ULARGE_INTEGER, *PULARGE_INTEGER;
3983 * Locally Unique Identifier
3986 typedef struct _LUID {
3987 DWORD LowPart;
3988 LONG HighPart;
3989 } LUID, *PLUID;
3991 #include <pshpack4.h>
3992 typedef struct _LUID_AND_ATTRIBUTES {
3993 LUID Luid;
3994 DWORD Attributes;
3995 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3996 #include <poppack.h>
3999 * PRIVILEGE_SET
4002 typedef struct _PRIVILEGE_SET {
4003 DWORD PrivilegeCount;
4004 DWORD Control;
4005 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
4006 } PRIVILEGE_SET, *PPRIVILEGE_SET;
4009 * TOKEN_PRIVILEGES
4012 typedef struct _TOKEN_PRIVILEGES {
4013 DWORD PrivilegeCount;
4014 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
4015 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
4018 * TOKEN_OWNER
4021 typedef struct _TOKEN_OWNER {
4022 PSID Owner;
4023 } TOKEN_OWNER, *PTOKEN_OWNER;
4026 * TOKEN_PRIMARY_GROUP
4029 typedef struct _TOKEN_PRIMARY_GROUP {
4030 PSID PrimaryGroup;
4031 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
4035 * TOKEN_DEFAULT_DACL
4038 typedef struct _TOKEN_DEFAULT_DACL {
4039 PACL DefaultDacl;
4040 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
4043 * TOKEN_SOURCE
4046 #define TOKEN_SOURCE_LENGTH 8
4048 typedef struct _TOKEN_SOURCE {
4049 char SourceName[TOKEN_SOURCE_LENGTH];
4050 LUID SourceIdentifier;
4051 } TOKEN_SOURCE, *PTOKEN_SOURCE;
4054 * TOKEN_TYPE
4057 typedef enum tagTOKEN_TYPE {
4058 TokenPrimary = 1,
4059 TokenImpersonation
4060 } TOKEN_TYPE;
4063 * SECURITY_IMPERSONATION_LEVEL
4066 typedef enum _SECURITY_IMPERSONATION_LEVEL {
4067 SecurityAnonymous,
4068 SecurityIdentification,
4069 SecurityImpersonation,
4070 SecurityDelegation
4071 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
4073 #define SECURITY_DYNAMIC_TRACKING (TRUE)
4074 #define SECURITY_STATIC_TRACKING (FALSE)
4076 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
4077 * PSECURITY_CONTEXT_TRACKING_MODE;
4079 * Quality of Service
4082 typedef struct _SECURITY_QUALITY_OF_SERVICE {
4083 DWORD Length;
4084 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4085 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
4086 BOOLEAN EffectiveOnly;
4087 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
4090 * TOKEN_STATISTICS
4093 #include <pshpack4.h>
4094 typedef struct _TOKEN_STATISTICS {
4095 LUID TokenId;
4096 LUID AuthenticationId;
4097 LARGE_INTEGER ExpirationTime;
4098 TOKEN_TYPE TokenType;
4099 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4100 DWORD DynamicCharged;
4101 DWORD DynamicAvailable;
4102 DWORD GroupCount;
4103 DWORD PrivilegeCount;
4104 LUID ModifiedId;
4105 } TOKEN_STATISTICS;
4106 #include <poppack.h>
4108 typedef struct _TOKEN_GROUPS_AND_PRIVILEGES {
4109 DWORD SidCount;
4110 DWORD SidLength;
4111 PSID_AND_ATTRIBUTES Sids;
4112 DWORD RestrictedSidCount;
4113 DWORD RestrictedSidLength;
4114 PSID_AND_ATTRIBUTES RestrictedSids;
4115 DWORD PrivilegeCount;
4116 DWORD PrivilegeLength;
4117 PLUID_AND_ATTRIBUTES Privileges;
4118 LUID AuthenticationId;
4119 } TOKEN_GROUPS_AND_PRIVILEGES, * PTOKEN_GROUPS_AND_PRIVILEGES;
4121 typedef struct _TOKEN_ORIGIN {
4122 LUID OriginatingLogonSession;
4123 } TOKEN_ORIGIN, * PTOKEN_ORIGIN;
4125 typedef struct _TOKEN_LINKED_TOKEN {
4126 HANDLE LinkedToken;
4127 } TOKEN_LINKED_TOKEN, * PTOKEN_LINKED_TOKEN;
4129 typedef struct _TOKEN_ELEVATION {
4130 DWORD TokenIsElevated;
4131 } TOKEN_ELEVATION, * PTOKEN_ELEVATION;
4135 * ACLs of NT
4138 /* ACEs, directly starting after an ACL */
4139 typedef struct _ACE_HEADER {
4140 BYTE AceType;
4141 BYTE AceFlags;
4142 WORD AceSize;
4143 } ACE_HEADER,*PACE_HEADER;
4145 /* AceType */
4146 #define ACCESS_ALLOWED_ACE_TYPE 0
4147 #define ACCESS_DENIED_ACE_TYPE 1
4148 #define SYSTEM_AUDIT_ACE_TYPE 2
4149 #define SYSTEM_ALARM_ACE_TYPE 3
4151 /* inherit AceFlags */
4152 #define OBJECT_INHERIT_ACE 0x01
4153 #define CONTAINER_INHERIT_ACE 0x02
4154 #define NO_PROPAGATE_INHERIT_ACE 0x04
4155 #define INHERIT_ONLY_ACE 0x08
4156 #define INHERITED_ACE 0x10
4157 #define VALID_INHERIT_FLAGS 0x1F
4159 /* AceFlags mask for what events we (should) audit */
4160 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4161 #define FAILED_ACCESS_ACE_FLAG 0x80
4163 /* different ACEs depending on AceType
4164 * SidStart marks the begin of a SID
4165 * so the thing finally looks like this:
4166 * 0: ACE_HEADER
4167 * 4: ACCESS_MASK
4168 * 8... : SID
4170 typedef struct _ACCESS_ALLOWED_ACE {
4171 ACE_HEADER Header;
4172 DWORD Mask;
4173 DWORD SidStart;
4174 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
4176 typedef struct _ACCESS_DENIED_ACE {
4177 ACE_HEADER Header;
4178 DWORD Mask;
4179 DWORD SidStart;
4180 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
4182 typedef struct _SYSTEM_AUDIT_ACE {
4183 ACE_HEADER Header;
4184 DWORD Mask;
4185 DWORD SidStart;
4186 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
4188 typedef struct _SYSTEM_ALARM_ACE {
4189 ACE_HEADER Header;
4190 DWORD Mask;
4191 DWORD SidStart;
4192 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
4194 typedef enum tagSID_NAME_USE {
4195 SidTypeUser = 1,
4196 SidTypeGroup,
4197 SidTypeDomain,
4198 SidTypeAlias,
4199 SidTypeWellKnownGroup,
4200 SidTypeDeletedAccount,
4201 SidTypeInvalid,
4202 SidTypeUnknown
4203 } SID_NAME_USE,*PSID_NAME_USE;
4205 #define ACE_OBJECT_TYPE_PRESENT 0x1
4206 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
4208 /* Access rights */
4210 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4211 #undef DELETE
4212 #define DELETE 0x00010000
4213 #define READ_CONTROL 0x00020000
4214 #define WRITE_DAC 0x00040000
4215 #define WRITE_OWNER 0x00080000
4216 #define SYNCHRONIZE 0x00100000
4217 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4219 #define STANDARD_RIGHTS_READ READ_CONTROL
4220 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4221 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4223 #define STANDARD_RIGHTS_ALL 0x001f0000
4225 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4227 #define GENERIC_READ 0x80000000
4228 #define GENERIC_WRITE 0x40000000
4229 #define GENERIC_EXECUTE 0x20000000
4230 #define GENERIC_ALL 0x10000000
4232 #define MAXIMUM_ALLOWED 0x02000000
4233 #define ACCESS_SYSTEM_SECURITY 0x01000000
4235 #define EVENT_QUERY_STATE 0x0001
4236 #define EVENT_MODIFY_STATE 0x0002
4237 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4239 #define SEMAPHORE_MODIFY_STATE 0x0002
4240 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4242 #define MUTEX_MODIFY_STATE 0x0001
4243 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4245 #define JOB_OBJECT_ASSIGN_PROCESS 0x0001
4246 #define JOB_OBJECT_SET_ATTRIBUTES 0x0002
4247 #define JOB_OBJECT_QUERY 0x0004
4248 #define JOB_OBJECT_TERMINATE 0x0008
4249 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 0x0010
4250 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1f)
4252 #define TIMER_QUERY_STATE 0x0001
4253 #define TIMER_MODIFY_STATE 0x0002
4254 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4256 #define PROCESS_TERMINATE 0x0001
4257 #define PROCESS_CREATE_THREAD 0x0002
4258 #define PROCESS_VM_OPERATION 0x0008
4259 #define PROCESS_VM_READ 0x0010
4260 #define PROCESS_VM_WRITE 0x0020
4261 #define PROCESS_DUP_HANDLE 0x0040
4262 #define PROCESS_CREATE_PROCESS 0x0080
4263 #define PROCESS_SET_QUOTA 0x0100
4264 #define PROCESS_SET_INFORMATION 0x0200
4265 #define PROCESS_QUERY_INFORMATION 0x0400
4266 #define PROCESS_SUSPEND_RESUME 0x0800
4267 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000
4268 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4270 #define THREAD_TERMINATE 0x0001
4271 #define THREAD_SUSPEND_RESUME 0x0002
4272 #define THREAD_GET_CONTEXT 0x0008
4273 #define THREAD_SET_CONTEXT 0x0010
4274 #define THREAD_SET_INFORMATION 0x0020
4275 #define THREAD_QUERY_INFORMATION 0x0040
4276 #define THREAD_SET_THREAD_TOKEN 0x0080
4277 #define THREAD_IMPERSONATE 0x0100
4278 #define THREAD_DIRECT_IMPERSONATION 0x0200
4279 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4281 #define THREAD_BASE_PRIORITY_LOWRT 15
4282 #define THREAD_BASE_PRIORITY_MAX 2
4283 #define THREAD_BASE_PRIORITY_MIN -2
4284 #define THREAD_BASE_PRIORITY_IDLE -15
4286 typedef struct _QUOTA_LIMITS {
4287 SIZE_T PagedPoolLimit;
4288 SIZE_T NonPagedPoolLimit;
4289 SIZE_T MinimumWorkingSetSize;
4290 SIZE_T MaximumWorkingSetSize;
4291 SIZE_T PagefileLimit;
4292 LARGE_INTEGER TimeLimit;
4293 } QUOTA_LIMITS, *PQUOTA_LIMITS;
4295 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4296 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4297 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4298 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4300 typedef struct _QUOTA_LIMITS_EX {
4301 SIZE_T PagedPoolLimit;
4302 SIZE_T NonPagedPoolLimit;
4303 SIZE_T MinimumWorkingSetSize;
4304 SIZE_T MaximumWorkingSetSize;
4305 SIZE_T PagefileLimit;
4306 LARGE_INTEGER TimeLimit;
4307 SIZE_T Reserved1;
4308 SIZE_T Reserved2;
4309 SIZE_T Reserved3;
4310 SIZE_T Reserved4;
4311 DWORD Flags;
4312 DWORD Reserved5;
4313 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
4315 #define SECTION_QUERY 0x0001
4316 #define SECTION_MAP_WRITE 0x0002
4317 #define SECTION_MAP_READ 0x0004
4318 #define SECTION_MAP_EXECUTE 0x0008
4319 #define SECTION_EXTEND_SIZE 0x0010
4320 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4321 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4323 #define FILE_READ_DATA 0x0001 /* file & pipe */
4324 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4325 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4326 #define FILE_ADD_FILE 0x0002 /* directory */
4327 #define FILE_APPEND_DATA 0x0004 /* file */
4328 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4329 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4330 #define FILE_READ_EA 0x0008 /* file & directory */
4331 #define FILE_READ_PROPERTIES FILE_READ_EA
4332 #define FILE_WRITE_EA 0x0010 /* file & directory */
4333 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4334 #define FILE_EXECUTE 0x0020 /* file */
4335 #define FILE_TRAVERSE 0x0020 /* directory */
4336 #define FILE_DELETE_CHILD 0x0040 /* directory */
4337 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4338 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4339 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4341 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4342 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4343 SYNCHRONIZE)
4344 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4345 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4346 FILE_APPEND_DATA | SYNCHRONIZE)
4347 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4348 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4350 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4351 #define DUPLICATE_SAME_ACCESS 0x00000002
4353 /* File attribute flags */
4354 #define FILE_SHARE_READ 0x00000001
4355 #define FILE_SHARE_WRITE 0x00000002
4356 #define FILE_SHARE_DELETE 0x00000004
4358 #define FILE_ATTRIBUTE_READONLY 0x00000001
4359 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4360 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4361 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4362 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4363 #define FILE_ATTRIBUTE_DEVICE 0x00000040
4364 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4365 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4366 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4367 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4368 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4369 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4370 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4371 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4373 /* File notification flags */
4374 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4375 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4376 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4377 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4378 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4379 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4380 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4381 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4382 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4383 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4384 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4385 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4387 #define FILE_ACTION_ADDED 0x00000001
4388 #define FILE_ACTION_REMOVED 0x00000002
4389 #define FILE_ACTION_MODIFIED 0x00000003
4390 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4391 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4392 #define FILE_ACTION_ADDED_STREAM 0x00000006
4393 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4394 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4396 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4397 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4398 #define FILE_UNICODE_ON_DISK 0x00000004
4399 #define FILE_PERSISTENT_ACLS 0x00000008
4400 #define FILE_FILE_COMPRESSION 0x00000010
4401 #define FILE_VOLUME_QUOTAS 0x00000020
4402 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040
4403 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080
4404 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4405 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4406 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4407 #define FILE_NAMED_STREAMS 0x00040000
4408 #define FILE_READ_ONLY_VOLUME 0x00080000
4410 /* File alignments (NT) */
4411 #define FILE_BYTE_ALIGNMENT 0x00000000
4412 #define FILE_WORD_ALIGNMENT 0x00000001
4413 #define FILE_LONG_ALIGNMENT 0x00000003
4414 #define FILE_QUAD_ALIGNMENT 0x00000007
4415 #define FILE_OCTA_ALIGNMENT 0x0000000f
4416 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4417 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4418 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4419 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4420 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4422 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4423 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4425 #define REG_NONE 0 /* no type */
4426 #define REG_SZ 1 /* string type (ASCII) */
4427 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4428 #define REG_BINARY 3 /* binary format, callerspecific */
4429 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4430 #define REG_DWORD 4 /* DWORD in little endian format */
4431 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4432 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4433 #define REG_LINK 6 /* symbolic link (UNICODE) */
4434 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4435 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4436 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4437 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4438 #define REG_QWORD 11 /* QWORD in little endian format */
4439 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4441 /* ----------------------------- begin power management --------------------- */
4443 typedef enum _LATENCY_TIME {
4444 LT_DONT_CARE,
4445 LT_LOWEST_LATENCY
4446 } LATENCY_TIME, *PLATENCY_TIME;
4448 #define DISCHARGE_POLICY_CRITICAL 0
4449 #define DISCHARGE_POLICY_LOW 1
4450 #define NUM_DISCHARGE_POLICIES 4
4452 #define PO_THROTTLE_NONE 0
4453 #define PO_THROTTLE_CONSTANT 1
4454 #define PO_THROTTLE_DEGRADE 2
4455 #define PO_THROTTLE_ADAPTIVE 3
4457 typedef enum _POWER_ACTION {
4458 PowerActionNone = 0,
4459 PowerActionReserved,
4460 PowerActionSleep,
4461 PowerActionHibernate,
4462 PowerActionShutdown,
4463 PowerActionShutdownReset,
4464 PowerActionShutdownOff,
4465 PowerActionWarmEject
4466 } POWER_ACTION,
4467 *PPOWER_ACTION;
4469 typedef enum _SYSTEM_POWER_STATE {
4470 PowerSystemUnspecified = 0,
4471 PowerSystemWorking = 1,
4472 PowerSystemSleeping1 = 2,
4473 PowerSystemSleeping2 = 3,
4474 PowerSystemSleeping3 = 4,
4475 PowerSystemHibernate = 5,
4476 PowerSystemShutdown = 6,
4477 PowerSystemMaximum = 7
4478 } SYSTEM_POWER_STATE,
4479 *PSYSTEM_POWER_STATE;
4481 typedef enum _DEVICE_POWER_STATE {
4482 PowerDeviceUnspecified,
4483 PowerDeviceD0,
4484 PowerDeviceD1,
4485 PowerDeviceD2,
4486 PowerDeviceD3,
4487 PowerDeviceMaximum
4488 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
4490 typedef enum _POWER_INFORMATION_LEVEL {
4491 SystemPowerPolicyAc,
4492 SystemPowerPolicyDc,
4493 VerifySystemPolicyAc,
4494 VerifySystemPolicyDc,
4495 SystemPowerCapabilities,
4496 SystemBatteryState,
4497 SystemPowerStateHandler,
4498 ProcessorStateHandler,
4499 SystemPowerPolicyCurrent,
4500 AdministratorPowerPolicy,
4501 SystemReserveHiberFile,
4502 ProcessorInformation,
4503 SystemPowerInformation,
4504 ProcessorStateHandler2,
4505 LastWakeTime,
4506 LastSleepTime,
4507 SystemExecutionState,
4508 SystemPowerStateNotifyHandler,
4509 ProcessorPowerPolicyAc,
4510 ProcessorPowerPolicyDc,
4511 VerifyProcessorPowerPolicyAc,
4512 VerifyProcessorPowerPolicyDc,
4513 ProcessorPowerPolicyCurrent
4514 } POWER_INFORMATION_LEVEL;
4516 typedef struct _ADMINISTRATOR_POWER_POLICY {
4517 SYSTEM_POWER_STATE MinSleep;
4518 SYSTEM_POWER_STATE MaxSleep;
4519 ULONG MinVideoTimeout;
4520 ULONG MaxVideoTimeout;
4521 ULONG MinSpindownTimeout;
4522 ULONG MaxSpindownTimeout;
4523 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
4525 typedef struct {
4526 ULONG Granularity;
4527 ULONG Capacity;
4528 } BATTERY_REPORTING_SCALE,
4529 *PBATTERY_REPORTING_SCALE;
4531 typedef struct {
4532 POWER_ACTION Action;
4533 ULONG Flags;
4534 ULONG EventCode;
4535 } POWER_ACTION_POLICY,
4536 *PPOWER_ACTION_POLICY;
4538 typedef struct _PROCESSOR_POWER_INFORMATION {
4539 ULONG Number;
4540 ULONG MaxMhz;
4541 ULONG CurrentMhz;
4542 ULONG MhzLimit;
4543 ULONG MaxIdleState;
4544 ULONG CurrentIdleState;
4545 } PROCESSOR_POWER_INFORMATION,
4546 *PPROCESSOR_POWER_INFORMATION;
4548 typedef struct _PROCESSOR_POWER_POLICY_INFO {
4549 ULONG TimeCheck;
4550 ULONG DemoteLimit;
4551 ULONG PromoteLimit;
4552 UCHAR DemotePercent;
4553 UCHAR PromotePercent;
4554 UCHAR Spare[2];
4555 ULONG AllowDemotion:1;
4556 ULONG AllowPromotion:1;
4557 ULONG Reserved:30;
4558 } PROCESSOR_POWER_POLICY_INFO,
4559 *PPROCESSOR_POWER_POLICY_INFO;
4561 typedef struct _PROCESSOR_POWER_POLICY {
4562 DWORD Revision;
4563 BYTE DynamicThrottle;
4564 BYTE Spare[3];
4565 DWORD DisableCStates:1;
4566 DWORD Reserved:31;
4567 DWORD PolicyCount;
4568 PROCESSOR_POWER_POLICY_INFO Policy[3];
4569 } PROCESSOR_POWER_POLICY,
4570 *PPROCESSOR_POWER_POLICY;
4572 typedef struct {
4573 BOOLEAN AcOnLine;
4574 BOOLEAN BatteryPresent;
4575 BOOLEAN Charging;
4576 BOOLEAN Discharging;
4577 BOOLEAN Spare1[4];
4578 ULONG MaxCapacity;
4579 ULONG RemainingCapacity;
4580 ULONG Rate;
4581 ULONG EstimatedTime;
4582 ULONG DefaultAlert1;
4583 ULONG DefaultAlert2;
4584 } SYSTEM_BATTERY_STATE,
4585 *PSYSTEM_BATTERY_STATE;
4587 typedef struct {
4588 BOOLEAN PowerButtonPresent;
4589 BOOLEAN SleepButtonPresent;
4590 BOOLEAN LidPresent;
4591 BOOLEAN SystemS1;
4592 BOOLEAN SystemS2;
4593 BOOLEAN SystemS3;
4594 BOOLEAN SystemS4;
4595 BOOLEAN SystemS5;
4596 BOOLEAN HiberFilePresent;
4597 BOOLEAN FullWake;
4598 BOOLEAN VideoDimPresent;
4599 BOOLEAN ApmPresent;
4600 BOOLEAN UpsPresent;
4601 BOOLEAN ThermalControl;
4602 BOOLEAN ProcessorThrottle;
4603 UCHAR ProcessorMinThrottle;
4604 UCHAR ProcessorMaxThrottle;
4605 UCHAR spare2[4];
4606 BOOLEAN DiskSpinDown;
4607 UCHAR spare3[8];
4608 BOOLEAN SystemBatteriesPresent;
4609 BOOLEAN BatteriesAreShortTerm;
4610 BATTERY_REPORTING_SCALE BatteryScale[3];
4611 SYSTEM_POWER_STATE AcOnLineWake;
4612 SYSTEM_POWER_STATE SoftLidWake;
4613 SYSTEM_POWER_STATE RtcWake;
4614 SYSTEM_POWER_STATE MinDeviceWakeState;
4615 SYSTEM_POWER_STATE DefaultLowLatencyWake;
4616 } SYSTEM_POWER_CAPABILITIES,
4617 *PSYSTEM_POWER_CAPABILITIES;
4619 typedef struct _SYSTEM_POWER_INFORMATION {
4620 ULONG MaxIdlenessAllowed;
4621 ULONG Idleness;
4622 ULONG TimeRemaining;
4623 UCHAR CoolingMode;
4624 } SYSTEM_POWER_INFORMATION,
4625 *PSYSTEM_POWER_INFORMATION;
4627 typedef struct _SYSTEM_POWER_LEVEL {
4628 BOOLEAN Enable;
4629 UCHAR Spare[3];
4630 ULONG BatteryLevel;
4631 POWER_ACTION_POLICY PowerPolicy;
4632 SYSTEM_POWER_STATE MinSystemState;
4633 } SYSTEM_POWER_LEVEL,
4634 *PSYSTEM_POWER_LEVEL;
4636 typedef struct _SYSTEM_POWER_POLICY {
4637 ULONG Revision;
4638 POWER_ACTION_POLICY PowerButton;
4639 POWER_ACTION_POLICY SleepButton;
4640 POWER_ACTION_POLICY LidClose;
4641 SYSTEM_POWER_STATE LidOpenWake;
4642 ULONG Reserved;
4643 POWER_ACTION_POLICY Idle;
4644 ULONG IdleTimeout;
4645 UCHAR IdleSensitivity;
4646 UCHAR DynamicThrottle;
4647 UCHAR Spare2[2];
4648 SYSTEM_POWER_STATE MinSleep;
4649 SYSTEM_POWER_STATE MaxSleep;
4650 SYSTEM_POWER_STATE ReducedLatencySleep;
4651 ULONG WinLogonFlags;
4652 ULONG Spare3;
4653 ULONG DozeS4Timeout;
4654 ULONG BroadcastCapacityResolution;
4655 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
4656 ULONG VideoTimeout;
4657 BOOLEAN VideoDimDisplay;
4658 ULONG VideoReserved[3];
4659 ULONG SpindownTimeout;
4660 BOOLEAN OptimizeForPower;
4661 UCHAR FanThrottleTolerance;
4662 UCHAR ForcedThrottle;
4663 UCHAR MinThrottle;
4664 POWER_ACTION_POLICY OverThrottled;
4665 } SYSTEM_POWER_POLICY,
4666 *PSYSTEM_POWER_POLICY;
4668 typedef union _FILE_SEGMENT_ELEMENT {
4669 PVOID64 Buffer;
4670 ULONGLONG Alignment;
4671 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
4673 typedef struct _FILE_NOTIFY_INFORMATION {
4674 DWORD NextEntryOffset;
4675 DWORD Action;
4676 DWORD FileNameLength;
4677 WCHAR FileName[1];
4678 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
4680 /* ----------------------------- begin tape storage --------------------- */
4682 #define TAPE_FIXED_PARTITIONS 0
4683 #define TAPE_SELECT_PARTITIONS 1
4684 #define TAPE_INITIATOR_PARTITIONS 2
4685 #define TAPE_ERASE_SHORT 0
4686 #define TAPE_ERASE_LONG 1
4687 #define TAPE_LOAD 0
4688 #define TAPE_UNLOAD 1
4689 #define TAPE_TENSION 2
4690 #define TAPE_LOCK 3
4691 #define TAPE_UNLOCK 4
4692 #define TAPE_FORMAT 5
4693 #define TAPE_SETMARKS 0
4694 #define TAPE_FILEMARKS 1
4695 #define TAPE_SHORT_FILEMARKS 2
4696 #define TAPE_LONG_FILEMARKS 3
4697 #define TAPE_REWIND 0
4698 #define TAPE_ABSOLUTE_BLOCK 1
4699 #define TAPE_LOGICAL_BLOCK 2
4700 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4701 #define TAPE_SPACE_END_OF_DATA 4
4702 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4703 #define TAPE_SPACE_FILEMARKS 6
4704 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4705 #define TAPE_SPACE_SETMARKS 8
4706 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4708 typedef struct _TAPE_CREATE_PARTITION {
4709 DWORD Method;
4710 DWORD Count;
4711 DWORD Size;
4712 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
4714 typedef struct _TAPE_ERASE {
4715 DWORD Type;
4716 BOOLEAN Immediate;
4717 } TAPE_ERASE, *PTAPE_ERASE;
4719 typedef struct _TAPE_PREPARE {
4720 DWORD Operation;
4721 BOOLEAN Immediate;
4722 } TAPE_PREPARE, *PTAPE_PREPARE;
4724 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
4725 BOOLEAN ECC;
4726 BOOLEAN Compression;
4727 BOOLEAN DataPadding;
4728 BOOLEAN ReportSetmarks;
4729 ULONG EOTWarningZoneSize;
4730 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
4732 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
4733 ULONG BlockSize;
4734 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
4736 typedef struct _TAPE_WRITE_MARKS {
4737 DWORD Type;
4738 DWORD Count;
4739 BOOLEAN Immediate;
4740 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
4742 typedef struct _TAPE_GET_POSITION {
4743 ULONG Type;
4744 ULONG Partition;
4745 ULONG OffsetLow;
4746 ULONG OffsetHigh;
4747 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
4749 typedef struct _TAPE_SET_POSITION {
4750 ULONG Method;
4751 ULONG Partition;
4752 LARGE_INTEGER Offset;
4753 BOOLEAN Immediate;
4754 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
4756 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
4757 BOOLEAN ECC;
4758 BOOLEAN Compression;
4759 BOOLEAN DataPadding;
4760 BOOLEAN ReportSetmarks;
4761 DWORD DefaultBlockSize;
4762 DWORD MaximumBlockSize;
4763 DWORD MinimumBlockSize;
4764 DWORD MaximumPartitionCount;
4765 DWORD FeaturesLow;
4766 DWORD FeaturesHigh;
4767 DWORD EOTWarningZoneSize;
4768 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
4770 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
4771 LARGE_INTEGER Capacity;
4772 LARGE_INTEGER Remaining;
4773 DWORD BlockSize;
4774 DWORD PartitionCount;
4775 BOOLEAN WriteProtected;
4776 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
4778 /* ----------------------------- begin registry ----------------------------- */
4780 /* Registry security values */
4781 #define OWNER_SECURITY_INFORMATION 0x00000001
4782 #define GROUP_SECURITY_INFORMATION 0x00000002
4783 #define DACL_SECURITY_INFORMATION 0x00000004
4784 #define SACL_SECURITY_INFORMATION 0x00000008
4786 #define REG_OPTION_RESERVED 0x00000000
4787 #define REG_OPTION_NON_VOLATILE 0x00000000
4788 #define REG_OPTION_VOLATILE 0x00000001
4789 #define REG_OPTION_CREATE_LINK 0x00000002
4790 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4791 #define REG_OPTION_OPEN_LINK 0x00000008
4792 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4793 REG_OPTION_NON_VOLATILE| \
4794 REG_OPTION_VOLATILE| \
4795 REG_OPTION_CREATE_LINK| \
4796 REG_OPTION_BACKUP_RESTORE| \
4797 REG_OPTION_OPEN_LINK)
4800 #define REG_CREATED_NEW_KEY 0x00000001
4801 #define REG_OPENED_EXISTING_KEY 0x00000002
4803 /* For RegNotifyChangeKeyValue */
4804 #define REG_NOTIFY_CHANGE_NAME 0x01
4805 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4806 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4807 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4809 #define KEY_QUERY_VALUE 0x00000001
4810 #define KEY_SET_VALUE 0x00000002
4811 #define KEY_CREATE_SUB_KEY 0x00000004
4812 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4813 #define KEY_NOTIFY 0x00000010
4814 #define KEY_CREATE_LINK 0x00000020
4815 #define KEY_WOW64_64KEY 0x00000100
4816 #define KEY_WOW64_32KEY 0x00000200
4817 #define KEY_WOW64_RES 0x00000300
4819 /* for RegKeyRestore flags */
4820 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4821 #define REG_REFRESH_HIVE 0x00000002
4822 #define REG_NO_LAZY_FLUSH 0x00000004
4823 #define REG_FORCE_RESTORE 0x00000008
4825 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4826 KEY_QUERY_VALUE| \
4827 KEY_ENUMERATE_SUB_KEYS| \
4828 KEY_NOTIFY) \
4829 & (~SYNCHRONIZE) \
4831 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4832 KEY_SET_VALUE| \
4833 KEY_CREATE_SUB_KEY) \
4834 & (~SYNCHRONIZE) \
4836 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4837 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4838 KEY_QUERY_VALUE| \
4839 KEY_SET_VALUE| \
4840 KEY_CREATE_SUB_KEY| \
4841 KEY_ENUMERATE_SUB_KEYS| \
4842 KEY_NOTIFY| \
4843 KEY_CREATE_LINK) \
4844 & (~SYNCHRONIZE) \
4846 /* ------------------------------ end registry ------------------------------ */
4849 #define EVENTLOG_SUCCESS 0x0000
4850 #define EVENTLOG_ERROR_TYPE 0x0001
4851 #define EVENTLOG_WARNING_TYPE 0x0002
4852 #define EVENTLOG_INFORMATION_TYPE 0x0004
4853 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4854 #define EVENTLOG_AUDIT_FAILURE 0x0010
4856 #define EVENTLOG_SEQUENTIAL_READ 0x0001
4857 #define EVENTLOG_SEEK_READ 0x0002
4858 #define EVENTLOG_FORWARDS_READ 0x0004
4859 #define EVENTLOG_BACKWARDS_READ 0x0008
4861 typedef struct _EVENTLOGRECORD {
4862 DWORD Length;
4863 DWORD Reserved;
4864 DWORD RecordNumber;
4865 DWORD TimeGenerated;
4866 DWORD TimeWritten;
4867 DWORD EventID;
4868 WORD EventType;
4869 WORD NumStrings;
4870 WORD EventCategory;
4871 WORD ReservedFlags;
4872 DWORD ClosingRecordNumber;
4873 DWORD StringOffset;
4874 DWORD UserSidLength;
4875 DWORD UserSidOffset;
4876 DWORD DataLength;
4877 DWORD DataOffset;
4878 } EVENTLOGRECORD, *PEVENTLOGRECORD;
4880 #define SERVICE_BOOT_START 0x00000000
4881 #define SERVICE_SYSTEM_START 0x00000001
4882 #define SERVICE_AUTO_START 0x00000002
4883 #define SERVICE_DEMAND_START 0x00000003
4884 #define SERVICE_DISABLED 0x00000004
4886 #define SERVICE_ERROR_IGNORE 0x00000000
4887 #define SERVICE_ERROR_NORMAL 0x00000001
4888 #define SERVICE_ERROR_SEVERE 0x00000002
4889 #define SERVICE_ERROR_CRITICAL 0x00000003
4891 /* Service types */
4892 #define SERVICE_KERNEL_DRIVER 0x00000001
4893 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4894 #define SERVICE_ADAPTER 0x00000004
4895 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4897 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4898 SERVICE_RECOGNIZER_DRIVER )
4900 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4901 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4902 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4904 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4906 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4907 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4910 typedef enum _CM_SERVICE_NODE_TYPE
4912 DriverType = SERVICE_KERNEL_DRIVER,
4913 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
4914 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
4915 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
4916 AdapterType = SERVICE_ADAPTER,
4917 RecognizerType = SERVICE_RECOGNIZER_DRIVER
4918 } SERVICE_NODE_TYPE;
4920 typedef enum _CM_SERVICE_LOAD_TYPE
4922 BootLoad = SERVICE_BOOT_START,
4923 SystemLoad = SERVICE_SYSTEM_START,
4924 AutoLoad = SERVICE_AUTO_START,
4925 DemandLoad = SERVICE_DEMAND_START,
4926 DisableLoad = SERVICE_DISABLED
4927 } SERVICE_LOAD_TYPE;
4929 typedef enum _CM_ERROR_CONTROL_TYPE
4931 IgnoreError = SERVICE_ERROR_IGNORE,
4932 NormalError = SERVICE_ERROR_NORMAL,
4933 SevereError = SERVICE_ERROR_SEVERE,
4934 CriticalError = SERVICE_ERROR_CRITICAL
4935 } SERVICE_ERROR_TYPE;
4939 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4940 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4941 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4942 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4943 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4945 #include <guiddef.h>
4947 typedef struct _OBJECT_TYPE_LIST {
4948 WORD Level;
4949 WORD Sbz;
4950 GUID *ObjectType;
4951 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
4953 typedef struct _RTL_CRITICAL_SECTION_DEBUG
4955 WORD Type;
4956 WORD CreatorBackTraceIndex;
4957 struct _RTL_CRITICAL_SECTION *CriticalSection;
4958 LIST_ENTRY ProcessLocksList;
4959 DWORD EntryCount;
4960 DWORD ContentionCount;
4961 #ifdef __WINESRC__ /* in Wine we store the name here */
4962 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
4963 #else
4964 DWORD Spare[ 2 ];
4965 #endif
4966 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
4968 typedef struct _RTL_CRITICAL_SECTION {
4969 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
4970 LONG LockCount;
4971 LONG RecursionCount;
4972 HANDLE OwningThread;
4973 HANDLE LockSemaphore;
4974 ULONG_PTR SpinCount;
4975 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
4977 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x1000000
4978 #define RTL_CRITICAL_SECTION_FLAG_DYNAMIC_SPIN 0x2000000
4979 #define RTL_CRITICAL_SECTION_FLAG_STATIC_INIT 0x4000000
4980 #define RTL_CRITICAL_SECTION_ALL_FLAG_BITS 0xFF000000
4981 #define RTL_CRITICAL_SECTION_FLAG_RESERVED (RTL_CRITICAL_SECTION_ALL_FLAG_BITS & ~0x7000000)
4983 typedef struct _RTL_SRWLOCK {
4984 PVOID Ptr;
4985 } RTL_SRWLOCK, *PRTL_SRWLOCK;
4987 #define RTL_SRWLOCK_INIT {0}
4989 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
4990 typedef VOID (NTAPI * PFLS_CALLBACK_FUNCTION) ( PVOID );
4992 #include <pshpack8.h>
4993 typedef struct _IO_COUNTERS {
4994 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
4995 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
4996 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
4997 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
4998 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
4999 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
5000 } IO_COUNTERS, *PIO_COUNTERS;
5001 #include <poppack.h>
5003 typedef struct {
5004 DWORD dwOSVersionInfoSize;
5005 DWORD dwMajorVersion;
5006 DWORD dwMinorVersion;
5007 DWORD dwBuildNumber;
5008 DWORD dwPlatformId;
5009 CHAR szCSDVersion[128];
5010 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
5012 typedef struct {
5013 DWORD dwOSVersionInfoSize;
5014 DWORD dwMajorVersion;
5015 DWORD dwMinorVersion;
5016 DWORD dwBuildNumber;
5017 DWORD dwPlatformId;
5018 WCHAR szCSDVersion[128];
5019 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
5021 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
5022 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
5023 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
5025 typedef struct {
5026 DWORD dwOSVersionInfoSize;
5027 DWORD dwMajorVersion;
5028 DWORD dwMinorVersion;
5029 DWORD dwBuildNumber;
5030 DWORD dwPlatformId;
5031 CHAR szCSDVersion[128];
5032 WORD wServicePackMajor;
5033 WORD wServicePackMinor;
5034 WORD wSuiteMask;
5035 BYTE wProductType;
5036 BYTE wReserved;
5037 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
5039 typedef struct {
5040 DWORD dwOSVersionInfoSize;
5041 DWORD dwMajorVersion;
5042 DWORD dwMinorVersion;
5043 DWORD dwBuildNumber;
5044 DWORD dwPlatformId;
5045 WCHAR szCSDVersion[128];
5046 WORD wServicePackMajor;
5047 WORD wServicePackMinor;
5048 WORD wSuiteMask;
5049 BYTE wProductType;
5050 BYTE wReserved;
5051 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
5053 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
5054 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
5055 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
5057 NTSYSAPI ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
5059 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
5061 #define VER_PLATFORM_WIN32s 0
5062 #define VER_PLATFORM_WIN32_WINDOWS 1
5063 #define VER_PLATFORM_WIN32_NT 2
5065 #define VER_MINORVERSION 0x00000001
5066 #define VER_MAJORVERSION 0x00000002
5067 #define VER_BUILDNUMBER 0x00000004
5068 #define VER_PLATFORMID 0x00000008
5069 #define VER_SERVICEPACKMINOR 0x00000010
5070 #define VER_SERVICEPACKMAJOR 0x00000020
5071 #define VER_SUITENAME 0x00000040
5072 #define VER_PRODUCT_TYPE 0x00000080
5074 #define VER_NT_WORKSTATION 1
5075 #define VER_NT_DOMAIN_CONTROLLER 2
5076 #define VER_NT_SERVER 3
5078 #define VER_SUITE_SMALLBUSINESS 0x00000001
5079 #define VER_SUITE_ENTERPRISE 0x00000002
5080 #define VER_SUITE_BACKOFFICE 0x00000004
5081 #define VER_SUITE_COMMUNICATIONS 0x00000008
5082 #define VER_SUITE_TERMINAL 0x00000010
5083 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
5084 #define VER_SUITE_EMBEDDEDNT 0x00000040
5085 #define VER_SUITE_DATACENTER 0x00000080
5086 #define VER_SUITE_SINGLEUSERTS 0x00000100
5087 #define VER_SUITE_PERSONAL 0x00000200
5088 #define VER_SUITE_BLADE 0x00000400
5089 #define VER_SUITE_EMBEDDED_RESTRICTED 0x00000800
5090 #define VER_SUITE_SECURITY_APPLIANCE 0x00001000
5091 #define VER_SUITE_STORAGE_SERVER 0x00002000
5092 #define VER_SUITE_COMPUTE_SERVER 0x00004000
5093 #define VER_SUITE_WH_SERVER 0x00008000
5095 #define VER_EQUAL 1
5096 #define VER_GREATER 2
5097 #define VER_GREATER_EQUAL 3
5098 #define VER_LESS 4
5099 #define VER_LESS_EQUAL 5
5100 #define VER_AND 6
5101 #define VER_OR 7
5103 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
5104 DWORD dwFlags;
5105 DWORD ulFormatVersion;
5106 DWORD ulAssemblyCount;
5107 DWORD ulRootManifestPathType;
5108 DWORD ulRootManifestPathChars;
5109 DWORD ulRootConfigurationPathType;
5110 DWORD ulRootConfigurationPathChars;
5111 DWORD ulAppDirPathType;
5112 DWORD ulAppDirPathChars;
5113 PCWSTR lpRootManifestPath;
5114 PCWSTR lpRootConfigurationPath;
5115 PCWSTR lpAppDirPath;
5116 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
5118 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
5119 DWORD ulFlags;
5120 DWORD ulEncodedAssemblyIdentityLength;
5121 DWORD ulManifestPathType;
5122 DWORD ulManifestPathLength;
5123 LARGE_INTEGER liManifestLastWriteTime;
5124 DWORD ulPolicyPathType;
5125 DWORD ulPolicyPathLength;
5126 LARGE_INTEGER liPolicyLastWriteTime;
5127 DWORD ulMetadataSatelliteRosterIndex;
5128 DWORD ulManifestVersionMajor;
5129 DWORD ulManifestVersionMinor;
5130 DWORD ulPolicyVersionMajor;
5131 DWORD ulPolicyVersionMinor;
5132 DWORD ulAssemblyDirectoryNameLength;
5133 PCWSTR lpAssemblyEncodedAssemblyIdentity;
5134 PCWSTR lpAssemblyManifestPath;
5135 PCWSTR lpAssemblyPolicyPath;
5136 PCWSTR lpAssemblyDirectoryName;
5137 DWORD ulFileCount;
5138 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
5140 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
5141 DWORD ulAssemblyIndex;
5142 DWORD ulFileIndexInAssembly;
5143 } ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
5145 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
5147 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
5148 DWORD ulFlags;
5149 DWORD ulFilenameLength;
5150 DWORD ulPathLength;
5151 PCWSTR lpFileName;
5152 PCWSTR lpFilePath;
5153 } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
5155 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
5157 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
5158 ActivationContextBasicInformation = 1,
5159 ActivationContextDetailedInformation = 2,
5160 AssemblyDetailedInformationInActivationContext = 3,
5161 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
5162 MaxActivationContextInfoClass,
5164 AssemblyDetailedInformationInActivationContxt = 3,
5165 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
5166 } ACTIVATION_CONTEXT_INFO_CLASS;
5168 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
5169 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
5170 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
5171 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
5173 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
5174 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
5175 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
5176 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
5177 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
5178 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
5179 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
5180 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
5181 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
5183 typedef enum _JOBOBJECTINFOCLASS
5185 JobObjectBasicAccountingInformation = 1,
5186 JobObjectBasicLimitInformation,
5187 JobObjectBasicProcessIdList,
5188 JobObjectBasicUIRestrictions,
5189 JobObjectSecurityLimitInformation,
5190 JobObjectEndOfJobTimeInformation,
5191 JobObjectAssociateCompletionPortInformation,
5192 JobObjectBasicAndIoAccountingInformation,
5193 JobObjectExtendedLimitInformation,
5194 JobObjectJobSetInformation,
5195 MaxJobObjectInfoClass
5196 } JOBOBJECTINFOCLASS;
5198 typedef enum _LOGICAL_PROCESSOR_RELATIONSHIP
5200 RelationProcessorCore = 0,
5201 RelationNumaNode = 1,
5202 RelationCache = 2,
5203 RelationProcessorPackage = 3,
5204 RelationGroup = 4,
5205 RelationAll = 0xffff
5206 } LOGICAL_PROCESSOR_RELATIONSHIP;
5208 typedef enum _PROCESSOR_CACHE_TYPE
5210 CacheUnified,
5211 CacheInstruction,
5212 CacheData,
5213 CacheTrace
5214 } PROCESSOR_CACHE_TYPE;
5216 typedef struct _PROCESSOR_GROUP_INFO
5218 BYTE MaximumProcessorCount;
5219 BYTE ActiveProcessorCount;
5220 BYTE Reserved[38];
5221 KAFFINITY ActiveProcessorMask;
5222 } PROCESSOR_GROUP_INFO, *PPROCESSOR_GROUP_INFO;
5224 typedef struct _CACHE_DESCRIPTOR
5226 BYTE Level;
5227 BYTE Associativity;
5228 WORD LineSize;
5229 DWORD Size;
5230 PROCESSOR_CACHE_TYPE Type;
5231 } CACHE_DESCRIPTOR, *PCACHE_DESCRIPTOR;
5233 typedef struct _GROUP_AFFINITY
5235 KAFFINITY Mask;
5236 WORD Group;
5237 WORD Reserved[3];
5238 } GROUP_AFFINITY, *PGROUP_AFFINITY;
5240 typedef struct _PROCESSOR_RELATIONSHIP
5242 BYTE Flags;
5243 BYTE Reserved[21];
5244 WORD GroupCount;
5245 GROUP_AFFINITY GroupMask[ANYSIZE_ARRAY];
5246 } PROCESSOR_RELATIONSHIP, *PPROCESSOR_RELATIONSHIP;
5249 typedef struct _NUMA_NODE_RELATIONSHIP
5251 DWORD NodeNumber;
5252 BYTE Reserved[20];
5253 GROUP_AFFINITY GroupMask;
5254 } NUMA_NODE_RELATIONSHIP, *PNUMA_NODE_RELATIONSHIP;
5256 typedef struct _CACHE_RELATIONSHIP
5258 BYTE Level;
5259 BYTE Associativity;
5260 WORD LineSize;
5261 PROCESSOR_CACHE_TYPE Type;
5262 BYTE Reserved[20];
5263 GROUP_AFFINITY GroupMask;
5264 } CACHE_RELATIONSHIP, *PCACHE_RELATIONSHIP;
5266 typedef struct _GROUP_RELATIONSHIP
5268 WORD MaximumGroupCount;
5269 WORD ActiveGroupCount;
5270 BYTE Reserved[20];
5271 PROCESSOR_GROUP_INFO GroupInfo[ANYSIZE_ARRAY];
5272 } GROUP_RELATIONSHIP, *PGROUP_RELATIONSHIP;
5274 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION
5276 ULONG_PTR ProcessorMask;
5277 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5278 union
5280 struct
5282 BYTE Flags;
5283 } ProcessorCore;
5284 struct
5286 DWORD NodeNumber;
5287 } NumaNode;
5288 CACHE_DESCRIPTOR Cache;
5289 ULONGLONG Reserved[2];
5290 } DUMMYUNIONNAME;
5291 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;
5293 typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX
5295 LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
5296 DWORD Size;
5297 union
5299 PROCESSOR_RELATIONSHIP Processor;
5300 NUMA_NODE_RELATIONSHIP NumaNode;
5301 CACHE_RELATIONSHIP Cache;
5302 GROUP_RELATIONSHIP Group;
5303 } DUMMYUNIONNAME;
5304 } SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX;
5306 NTSYSAPI BOOLEAN NTAPI RtlGetProductInfo(DWORD,DWORD,DWORD,DWORD,PDWORD);
5308 #ifdef __cplusplus
5310 #endif
5312 #endif /* _WINNT_ */