VirtualBox

source: vbox/trunk/src/VBox/Devices/Graphics/shaderlib/wine/include/winnt.h@ 53206

Last change on this file since 53206 was 53206, checked in by vboxsync, 10 years ago

Devices/vmsvga: header fixes

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

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette