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