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