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