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