Release 0.9.14.
[wine/multimedia.git] / include / winnt.h
blobd2c645230c88f99f7309cbbd68da985b4795d202
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>
26 #ifndef RC_INVOKED
27 #include <ctype.h>
28 #include <stddef.h>
29 #include <string.h>
30 #endif
32 #define NTAPI __stdcall
34 #if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(MIDL_PASS)
35 # if defined(_MSC_VER)
36 # define DECLSPEC_IMPORT __declspec(dllimport)
37 # elif defined(__MINGW32__)
38 # define DECLSPEC_IMPORT __attribute__((dllimport))
39 # else
40 # define DECLSPEC_IMPORT
41 # endif
42 #else
43 # define DECLSPEC_IMPORT
44 #endif
46 #ifndef DECLSPEC_NORETURN
47 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
48 # define DECLSPEC_NORETURN __declspec(noreturn)
49 # elif defined(__GNUC__)
50 # define DECLSPEC_NORETURN __attribute__((noreturn))
51 # else
52 # define DECLSPEC_NORETURN
53 # endif
54 #endif
56 #ifndef DECLSPEC_ALIGN
57 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
58 # define DECLSPEC_ALIGN(x) __declspec(align(x))
59 # elif defined(__GNUC__)
60 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
61 # else
62 # define DECLSPEC_ALIGN(x)
63 # endif
64 #endif
66 #ifndef DECLSPEC_CACHEALIGN
67 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
68 #endif
70 #ifndef DECLSPEC_UUID
71 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
72 # define DECLSPEC_UUID(x) __declspec(uuid(x))
73 # else
74 # define DECLSPEC_UUID(x)
75 # endif
76 #endif
78 #ifndef DECLSPEC_NOVTABLE
79 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
80 # define DECLSPEC_NOVTABLE __declspec(novtable)
81 # else
82 # define DECLSPEC_NOVTABLE
83 # endif
84 #endif
86 #ifndef DECLSPEC_SELECTANY
87 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
88 #define DECLSPEC_SELECTANY __declspec(selectany)
89 #else
90 #define DECLSPEC_SELECTANY
91 #endif
92 #endif
94 #ifndef NOP_FUNCTION
95 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
96 # define NOP_FUNCTION __noop
97 # else
98 # define NOP_FUNCTION (void)0
99 # endif
100 #endif
102 #ifndef DECLSPEC_ADDRSAFE
103 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
104 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
105 # else
106 # define DECLSPEC_ADDRSAFE
107 # endif
108 #endif
110 #ifndef FORCEINLINE
111 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
112 # define FORCEINLINE __forceinline
113 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
114 # define FORCEINLINE __attribute__((always_inline))
115 # else
116 # define FORCEINLINE inline
117 # endif
118 #endif
120 #ifndef DECLSPEC_DEPRECATED
121 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
122 # define DECLSPEC_DEPRECATED __declspec(deprecated)
123 # define DEPRECATE_SUPPORTED
124 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
125 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
126 # define DEPRECATE_SUPPORTED
127 # else
128 # define DECLSPEC_DEPRECATED
129 # undef DEPRECATE_SUPPORTED
130 # endif
131 #endif
133 /* a couple of useful Wine extensions */
135 #ifdef _MSC_VER
136 # define DECLSPEC_EXPORT __declspec(dllexport)
137 #elif defined(__MINGW32__)
138 # define DECLSPEC_EXPORT __attribute__((dllexport))
139 #elif defined(__GNUC__) && (__GNUC__ > 2)
140 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
141 #else
142 # define DECLSPEC_EXPORT
143 #endif
145 #if defined(__GNUC__) && (__GNUC__ > 2)
146 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
147 #else
148 # define DECLSPEC_HIDDEN
149 #endif
151 /* Anonymous union/struct handling */
153 #ifndef NONAMELESSSTRUCT
154 # ifdef __GNUC__
155 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
156 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
157 # define NONAMELESSSTRUCT
158 # endif
159 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
160 # define NONAMELESSSTRUCT
161 # endif
162 #endif /* NONAMELESSSTRUCT */
164 #ifndef NONAMELESSUNION
165 # ifdef __GNUC__
166 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
167 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
168 # define NONAMELESSUNION
169 # endif
170 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
171 # define NONAMELESSUNION
172 # endif
173 #endif /* NONAMELESSUNION */
175 #ifndef NONAMELESSSTRUCT
176 #define DUMMYSTRUCTNAME
177 #define DUMMYSTRUCTNAME1
178 #define DUMMYSTRUCTNAME2
179 #define DUMMYSTRUCTNAME3
180 #define DUMMYSTRUCTNAME4
181 #define DUMMYSTRUCTNAME5
182 #else /* !defined(NONAMELESSSTRUCT) */
183 #define DUMMYSTRUCTNAME s
184 #define DUMMYSTRUCTNAME1 s1
185 #define DUMMYSTRUCTNAME2 s2
186 #define DUMMYSTRUCTNAME3 s3
187 #define DUMMYSTRUCTNAME4 s4
188 #define DUMMYSTRUCTNAME5 s5
189 #endif /* !defined(NONAMELESSSTRUCT) */
191 #ifndef NONAMELESSUNION
192 #define DUMMYUNIONNAME
193 #define DUMMYUNIONNAME1
194 #define DUMMYUNIONNAME2
195 #define DUMMYUNIONNAME3
196 #define DUMMYUNIONNAME4
197 #define DUMMYUNIONNAME5
198 #define DUMMYUNIONNAME6
199 #define DUMMYUNIONNAME7
200 #define DUMMYUNIONNAME8
201 #else /* !defined(NONAMELESSUNION) */
202 #define DUMMYUNIONNAME u
203 #define DUMMYUNIONNAME1 u1
204 #define DUMMYUNIONNAME2 u2
205 #define DUMMYUNIONNAME3 u3
206 #define DUMMYUNIONNAME4 u4
207 #define DUMMYUNIONNAME5 u5
208 #define DUMMYUNIONNAME6 u6
209 #define DUMMYUNIONNAME7 u7
210 #define DUMMYUNIONNAME8 u8
211 #endif /* !defined(NONAMELESSUNION) */
213 /* C99 restrict support */
215 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
216 # if defined(_MSC_VER) && defined(_M_MRX000)
217 # define RESTRICTED_POINTER __restrict
218 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
219 # define RESTRICTED_POINTER __restrict
220 # else
221 # define RESTRICTED_POINTER
222 # endif
223 #else
224 # define RESTRICTED_POINTER
225 #endif
227 /* C99 unaligned support */
229 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
230 # define UNALIGNED __unaligned
231 # ifdef _WIN64
232 # define UNALIGNED64 __unaligned
233 # else
234 # define UNALIGNED64
235 # endif
236 #else
237 # define UNALIGNED
238 # define UNALIGNED64
239 #endif
241 /* Alignment macros */
243 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
244 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
245 #define MEMORY_ALLOCATION_ALIGNMENT 16
246 #else
247 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
248 #define MEMORY_ALLOCATION_ALIGNMENT 8
249 #endif
251 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
252 # define TYPE_ALIGNMENT(t) __alignof(t)
253 #elif defined(__GNUC__)
254 # define TYPE_ALIGNMENT(t) __alignof__(t)
255 #else
256 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
257 #endif
259 #ifdef _WIN64
260 # define PROBE_ALIGNMENT(_s) \
261 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
262 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
263 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
264 #else
265 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
266 #endif
268 /* Compile time assertion */
270 #if defined(_MSC_VER)
271 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
272 #elif defined(__GNUC__)
273 # define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1]
274 #endif
276 /* Eliminate Microsoft C/C++ compiler warning 4715 */
277 #if (_MSC_VER > 1200)
278 # define DEFAULT_UNREACHABLE default: __assume(0)
279 #else
280 # define DEFAULT_UNREACHABLE
281 #endif
283 /* Error Masks */
284 #define APPLICATION_ERROR_MASK 0x20000000
285 #define ERROR_SEVERITY_SUCCESS 0x00000000
286 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
287 #define ERROR_SEVERITY_WARNING 0x80000000
288 #define ERROR_SEVERITY_ERROR 0xC0000000
290 /* Microsoft's macros for declaring functions */
292 #ifdef __cplusplus
293 # define EXTERN_C extern "C"
294 #else
295 # define EXTERN_C extern
296 #endif
298 #define STDMETHODCALLTYPE __stdcall
299 #define STDMETHODVCALLTYPE __cdecl
300 #define STDAPICALLTYPE __stdcall
301 #define STDAPIVCALLTYPE __cdecl
303 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
304 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
305 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
306 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
307 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
308 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
309 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
310 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
312 /* Define the basic types */
313 #ifndef VOID
314 #define VOID void
315 #endif
316 typedef VOID *PVOID;
317 typedef VOID *PVOID64;
318 typedef BYTE BOOLEAN, *PBOOLEAN;
319 typedef char CHAR, *PCHAR;
320 typedef short SHORT, *PSHORT;
321 #if defined(_WIN64) && !defined(_MSC_VER)
322 typedef int LONG, *PLONG;
323 #else
324 typedef long LONG, *PLONG;
325 #endif
327 /* Some systems might have wchar_t, but we really need 16 bit characters */
328 #ifdef WINE_UNICODE_NATIVE
329 typedef wchar_t WCHAR, *PWCHAR;
330 #else
331 typedef unsigned short WCHAR, *PWCHAR;
332 #endif
334 /* 'Extended/Wide' numerical types */
335 #ifndef _ULONGLONG_
336 # define _ULONGLONG_
337 # ifdef _MSC_VER
338 typedef signed __int64 LONGLONG, *PLONGLONG;
339 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
340 # else
341 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
342 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
343 # endif
344 #endif
346 #ifndef _DWORDLONG_
347 # define _DWORDLONG_
348 # ifdef _MSC_VER
349 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
350 # else
351 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
352 # endif
353 #endif
355 /* ANSI string types */
356 typedef CHAR *PCH, *LPCH;
357 typedef const CHAR *PCCH, *LPCCH;
358 typedef CHAR *PSTR, *LPSTR, *NPSTR;
359 typedef const CHAR *PCSTR, *LPCSTR;
361 /* Unicode string types */
362 typedef WCHAR *PWCH, *LPWCH;
363 typedef const WCHAR *PCWCH, *LPCWCH;
364 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
365 typedef const WCHAR *PCWSTR, *LPCWSTR;
367 /* Neutral character and string types */
368 /* These are only defined for Winelib, i.e. _not_ defined for
369 * the emulator. The reason is they depend on the UNICODE
370 * macro which only exists in the user's code.
372 #ifndef __WINESRC__
373 # ifdef UNICODE
374 # ifndef _TCHAR_DEFINED
375 typedef WCHAR TCHAR, *PTCHAR;
376 # define _TCHAR_DEFINED
377 #endif
378 typedef LPWSTR PTSTR, LPTSTR;
379 typedef LPCWSTR PCTSTR, LPCTSTR;
380 # define __TEXT(string) L##string
381 # else /* UNICODE */
382 # ifndef _TCHAR_DEFINED
383 typedef CHAR TCHAR, *PTCHAR;
384 # define _TCHAR_DEFINED
385 # endif
386 typedef LPSTR PTSTR, LPTSTR;
387 typedef LPCSTR PCTSTR, LPCTSTR;
388 # define __TEXT(string) string
389 # endif /* UNICODE */
390 # define TEXT(quote) __TEXT(quote)
391 #endif /* __WINESRC__ */
393 /* Misc common WIN32 types */
394 typedef char CCHAR;
395 typedef LONG HRESULT;
396 typedef DWORD LCID, *PLCID;
397 typedef WORD LANGID;
398 typedef DWORD EXECUTION_STATE;
400 /* Handle type */
402 typedef void *HANDLE;
403 typedef HANDLE *PHANDLE, *LPHANDLE;
405 #ifdef STRICT
406 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
407 #else /*STRICT*/
408 #define DECLARE_HANDLE(a) typedef HANDLE a
409 #endif /*STRICT*/
411 typedef BYTE FCHAR;
412 typedef WORD FSHORT;
413 typedef DWORD FLONG;
415 /* Defines */
417 #ifndef WIN32_NO_STATUS
419 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
420 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
421 #define STATUS_USER_APC ((DWORD) 0x000000C0)
422 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
423 #define STATUS_PENDING ((DWORD) 0x00000103)
424 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
425 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
426 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
427 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
428 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
429 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
430 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
431 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
432 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
433 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
434 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
435 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
436 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
437 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
438 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
439 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
440 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
441 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
442 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
443 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
444 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
445 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
446 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
447 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
448 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
449 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
450 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
451 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
452 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
453 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
455 /* status values for ContinueDebugEvent */
456 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
457 #define DBG_CONTINUE ((DWORD) 0x00010002)
458 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
459 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
460 #define DBG_CONTROL_C ((DWORD) 0x40010005)
461 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
462 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
463 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
465 #endif /* WIN32_NO_STATUS */
467 /* Argument 1 passed to the DllEntryProc. */
468 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
469 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
470 #define DLL_THREAD_ATTACH 2 /* attach new thread */
471 #define DLL_THREAD_DETACH 3 /* detach thread */
472 #ifdef __WINESRC__
473 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
474 #endif
476 /* u.x.wProcessorArchitecture (NT) */
477 #define PROCESSOR_ARCHITECTURE_INTEL 0
478 #define PROCESSOR_ARCHITECTURE_MIPS 1
479 #define PROCESSOR_ARCHITECTURE_ALPHA 2
480 #define PROCESSOR_ARCHITECTURE_PPC 3
481 #define PROCESSOR_ARCHITECTURE_SHX 4
482 #define PROCESSOR_ARCHITECTURE_ARM 5
483 #define PROCESSOR_ARCHITECTURE_IA64 6
484 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
485 #define PROCESSOR_ARCHITECTURE_MSIL 8
486 #define PROCESSOR_ARCHITECTURE_AMD64 9
487 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
489 /* dwProcessorType */
490 #define PROCESSOR_INTEL_386 386
491 #define PROCESSOR_INTEL_486 486
492 #define PROCESSOR_INTEL_PENTIUM 586
493 #define PROCESSOR_INTEL_860 860
494 #define PROCESSOR_INTEL_IA64 2200
495 #define PROCESSOR_AMD_X8664 8664
496 #define PROCESSOR_MIPS_R2000 2000
497 #define PROCESSOR_MIPS_R3000 3000
498 #define PROCESSOR_MIPS_R4000 4000
499 #define PROCESSOR_ALPHA_21064 21064
500 #define PROCESSOR_PPC_601 601
501 #define PROCESSOR_PPC_603 603
502 #define PROCESSOR_PPC_604 604
503 #define PROCESSOR_PPC_620 620
504 #define PROCESSOR_HITACHI_SH3 10003
505 #define PROCESSOR_HITACHI_SH3E 10004
506 #define PROCESSOR_HITACHI_SH4 10005
507 #define PROCESSOR_MOTOROLA_821 821
508 #define PROCESSOR_SHx_SH3 103
509 #define PROCESSOR_SHx_SH4 104
510 #define PROCESSOR_STRONGARM 2577
511 #define PROCESSOR_ARM720 1824 /* 0x720 */
512 #define PROCESSOR_ARM820 2080 /* 0x820 */
513 #define PROCESSOR_ARM920 2336 /* 0x920 */
514 #define PROCESSOR_ARM_7TDMI 70001
516 #define MAXIMUM_PROCESSORS 32
517 typedef struct _MEMORY_BASIC_INFORMATION
519 LPVOID BaseAddress;
520 LPVOID AllocationBase;
521 DWORD AllocationProtect;
522 SIZE_T RegionSize;
523 DWORD State;
524 DWORD Protect;
525 DWORD Type;
526 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
528 #define PAGE_NOACCESS 0x01
529 #define PAGE_READONLY 0x02
530 #define PAGE_READWRITE 0x04
531 #define PAGE_WRITECOPY 0x08
532 #define PAGE_EXECUTE 0x10
533 #define PAGE_EXECUTE_READ 0x20
534 #define PAGE_EXECUTE_READWRITE 0x40
535 #define PAGE_EXECUTE_WRITECOPY 0x80
536 #define PAGE_GUARD 0x100
537 #define PAGE_NOCACHE 0x200
539 #define MEM_COMMIT 0x00001000
540 #define MEM_RESERVE 0x00002000
541 #define MEM_DECOMMIT 0x00004000
542 #define MEM_RELEASE 0x00008000
543 #define MEM_FREE 0x00010000
544 #define MEM_PRIVATE 0x00020000
545 #define MEM_MAPPED 0x00040000
546 #define MEM_RESET 0x00080000
547 #define MEM_TOP_DOWN 0x00100000
548 #define MEM_PHYSICAL 0x00400000
549 #ifdef __WINESRC__
550 #define MEM_SYSTEM 0x80000000
551 #endif
553 #define SEC_FILE 0x00800000
554 #define SEC_IMAGE 0x01000000
555 #define SEC_RESERVE 0x04000000
556 #define SEC_COMMIT 0x08000000
557 #define SEC_NOCACHE 0x10000000
558 #define MEM_IMAGE SEC_IMAGE
561 #define MINCHAR 0x80
562 #define MAXCHAR 0x7f
563 #define MINSHORT 0x8000
564 #define MAXSHORT 0x7fff
565 #define MINLONG 0x80000000
566 #define MAXLONG 0x7fffffff
567 #define MAXBYTE 0xff
568 #define MAXWORD 0xffff
569 #define MAXDWORD 0xffffffff
571 #define FIELD_OFFSET(type, field) \
572 ((LONG)(INT_PTR)&(((type *)0)->field))
574 #define CONTAINING_RECORD(address, type, field) \
575 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
577 /* Types */
579 typedef struct _LIST_ENTRY {
580 struct _LIST_ENTRY *Flink;
581 struct _LIST_ENTRY *Blink;
582 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
584 typedef struct _SINGLE_LIST_ENTRY {
585 struct _SINGLE_LIST_ENTRY *Next;
586 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
588 /* Heap flags */
590 #define HEAP_NO_SERIALIZE 0x00000001
591 #define HEAP_GROWABLE 0x00000002
592 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
593 #define HEAP_ZERO_MEMORY 0x00000008
594 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
595 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
596 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
597 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
598 #define HEAP_CREATE_ALIGN_16 0x00010000
599 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
601 /* This flag allows it to create heaps shared by all processes under win95,
602 FIXME: correct name */
603 #define HEAP_SHARED 0x04000000
605 /* Processor feature flags. */
606 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
607 #define PF_FLOATING_POINT_EMULATED 1
608 #define PF_COMPARE_EXCHANGE_DOUBLE 2
609 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
610 #define PF_PPC_MOVEMEM_64BIT_OK 4
611 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
612 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
613 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
614 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
615 #define PF_PAE_ENABLED 9
616 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
617 #define PF_NX_ENABLED 12
620 /* Execution state flags */
621 #define ES_SYSTEM_REQUIRED 0x00000001
622 #define ES_DISPLAY_REQUIRED 0x00000002
623 #define ES_USER_PRESENT 0x00000004
624 #define ES_CONTINUOUS 0x80000000
626 /* The Win32 register context */
628 /* CONTEXT is the CPU-dependent context; it should be used */
629 /* wherever a platform-specific context is needed (e.g. exception */
630 /* handling, Win32 register functions). */
632 /* CONTEXT86 is the i386-specific context; it should be used */
633 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
634 /* Win16 register functions), so that this code can be compiled */
635 /* on all platforms. */
637 #define SIZE_OF_80387_REGISTERS 80
639 typedef struct _FLOATING_SAVE_AREA
641 DWORD ControlWord;
642 DWORD StatusWord;
643 DWORD TagWord;
644 DWORD ErrorOffset;
645 DWORD ErrorSelector;
646 DWORD DataOffset;
647 DWORD DataSelector;
648 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
649 DWORD Cr0NpxState;
650 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
652 #define MAXIMUM_SUPPORTED_EXTENSION 512
654 typedef struct _CONTEXT86
656 DWORD ContextFlags;
658 /* These are selected by CONTEXT_DEBUG_REGISTERS */
659 DWORD Dr0;
660 DWORD Dr1;
661 DWORD Dr2;
662 DWORD Dr3;
663 DWORD Dr6;
664 DWORD Dr7;
666 /* These are selected by CONTEXT_FLOATING_POINT */
667 FLOATING_SAVE_AREA FloatSave;
669 /* These are selected by CONTEXT_SEGMENTS */
670 DWORD SegGs;
671 DWORD SegFs;
672 DWORD SegEs;
673 DWORD SegDs;
675 /* These are selected by CONTEXT_INTEGER */
676 DWORD Edi;
677 DWORD Esi;
678 DWORD Ebx;
679 DWORD Edx;
680 DWORD Ecx;
681 DWORD Eax;
683 /* These are selected by CONTEXT_CONTROL */
684 DWORD Ebp;
685 DWORD Eip;
686 DWORD SegCs;
687 DWORD EFlags;
688 DWORD Esp;
689 DWORD SegSs;
691 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
692 } CONTEXT86;
694 #define CONTEXT_X86 0x00010000
695 #define CONTEXT_i386 CONTEXT_X86
696 #define CONTEXT_i486 CONTEXT_X86
698 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
699 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
700 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
701 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
702 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
703 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
705 /* i386 context definitions */
706 #ifdef __i386__
708 #define CONTEXT_CONTROL CONTEXT86_CONTROL
709 #define CONTEXT_INTEGER CONTEXT86_INTEGER
710 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
711 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
712 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
713 #define CONTEXT_FULL CONTEXT86_FULL
715 typedef CONTEXT86 CONTEXT;
717 #endif /* __i386__ */
719 typedef struct _LDT_ENTRY {
720 WORD LimitLow;
721 WORD BaseLow;
722 union {
723 struct {
724 BYTE BaseMid;
725 BYTE Flags1;
726 BYTE Flags2;
727 BYTE BaseHi;
728 } Bytes;
729 struct {
730 unsigned BaseMid: 8;
731 unsigned Type : 5;
732 unsigned Dpl : 2;
733 unsigned Pres : 1;
734 unsigned LimitHi : 4;
735 unsigned Sys : 1;
736 unsigned Reserved_0 : 1;
737 unsigned Default_Big : 1;
738 unsigned Granularity : 1;
739 unsigned BaseHi : 8;
740 } Bits;
741 } HighWord;
742 } LDT_ENTRY, *PLDT_ENTRY;
744 /* x86-64 context definitions */
745 #if defined(__x86_64__)
747 #define CONTEXT_AMD64 0x00100000
749 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
750 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
751 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
752 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
753 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
754 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
755 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
757 typedef struct DECLSPEC_ALIGN(16) _M128A {
758 ULONGLONG Low;
759 LONGLONG High;
760 } M128A, *PM128A;
762 typedef struct _XMM_SAVE_AREA32 {
763 WORD ControlWord;
764 WORD StatusWord;
765 BYTE TagWord;
766 BYTE Reserved1;
767 WORD ErrorOpcode;
768 DWORD ErrorOffset;
769 WORD ErrorSelector;
770 WORD Reserved2;
771 DWORD DataOffset;
772 WORD DataSelector;
773 WORD Reserved3;
774 DWORD MxCsr;
775 DWORD MxCsr_Mask;
776 M128A FloatRegisters[8];
777 M128A XmmRegisters[16];
778 BYTE Reserved4[96];
779 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
781 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
782 DWORD64 P1Home;
783 DWORD64 P2Home;
784 DWORD64 P3Home;
785 DWORD64 P4Home;
786 DWORD64 P5Home;
787 DWORD64 P6Home;
789 /* Control flags */
790 DWORD ContextFlags;
791 DWORD MxCsr;
793 /* Segment */
794 WORD SegCs;
795 WORD SegDs;
796 WORD SegEs;
797 WORD SegFs;
798 WORD SegGs;
799 WORD SegSs;
800 DWORD EFlags;
802 /* Debug */
803 DWORD64 Dr0;
804 DWORD64 Dr1;
805 DWORD64 Dr2;
806 DWORD64 Dr3;
807 DWORD64 Dr6;
808 DWORD64 Dr7;
810 /* Integer */
811 DWORD64 Rax;
812 DWORD64 Rcx;
813 DWORD64 Rdx;
814 DWORD64 Rbx;
815 DWORD64 Rsp;
816 DWORD64 Rbp;
817 DWORD64 Rsi;
818 DWORD64 Rdi;
819 DWORD64 R8;
820 DWORD64 R9;
821 DWORD64 R10;
822 DWORD64 R11;
823 DWORD64 R12;
824 DWORD64 R13;
825 DWORD64 R14;
826 DWORD64 R15;
828 /* Counter */
829 DWORD64 Rip;
831 /* Floating point */
832 union {
833 XMM_SAVE_AREA32 FltSave;
834 struct {
835 M128A Header[2];
836 M128A Legacy[8];
837 M128A Xmm0;
838 M128A Xmm1;
839 M128A Xmm2;
840 M128A Xmm3;
841 M128A Xmm4;
842 M128A Xmm5;
843 M128A Xmm6;
844 M128A Xmm7;
845 M128A Xmm8;
846 M128A Xmm9;
847 M128A Xmm10;
848 M128A Xmm11;
849 M128A Xmm12;
850 M128A Xmm13;
851 M128A Xmm14;
852 M128A Xmm15;
853 } DUMMYSTRUCTNAME;
854 } DUMMYUNIONNAME;
856 /* Vector */
857 M128A VectorRegister[26];
858 DWORD64 VectorControl;
860 /* Debug control */
861 DWORD64 DebugControl;
862 DWORD64 LastBranchToRip;
863 DWORD64 LastBranchFromRip;
864 DWORD64 LastExceptionToRip;
865 DWORD64 LastExceptionFromRip;
866 } CONTEXT;
868 #endif /* __x86_64__ */
870 /* Alpha context definitions */
871 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
873 #define CONTEXT_ALPHA 0x00020000
875 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
876 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
877 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
878 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
880 typedef struct _CONTEXT
882 /* selected by CONTEXT_FLOATING_POINT */
883 ULONGLONG FltF0;
884 ULONGLONG FltF1;
885 ULONGLONG FltF2;
886 ULONGLONG FltF3;
887 ULONGLONG FltF4;
888 ULONGLONG FltF5;
889 ULONGLONG FltF6;
890 ULONGLONG FltF7;
891 ULONGLONG FltF8;
892 ULONGLONG FltF9;
893 ULONGLONG FltF10;
894 ULONGLONG FltF11;
895 ULONGLONG FltF12;
896 ULONGLONG FltF13;
897 ULONGLONG FltF14;
898 ULONGLONG FltF15;
899 ULONGLONG FltF16;
900 ULONGLONG FltF17;
901 ULONGLONG FltF18;
902 ULONGLONG FltF19;
903 ULONGLONG FltF20;
904 ULONGLONG FltF21;
905 ULONGLONG FltF22;
906 ULONGLONG FltF23;
907 ULONGLONG FltF24;
908 ULONGLONG FltF25;
909 ULONGLONG FltF26;
910 ULONGLONG FltF27;
911 ULONGLONG FltF28;
912 ULONGLONG FltF29;
913 ULONGLONG FltF30;
914 ULONGLONG FltF31;
916 /* selected by CONTEXT_INTEGER */
917 ULONGLONG IntV0;
918 ULONGLONG IntT0;
919 ULONGLONG IntT1;
920 ULONGLONG IntT2;
921 ULONGLONG IntT3;
922 ULONGLONG IntT4;
923 ULONGLONG IntT5;
924 ULONGLONG IntT6;
925 ULONGLONG IntT7;
926 ULONGLONG IntS0;
927 ULONGLONG IntS1;
928 ULONGLONG IntS2;
929 ULONGLONG IntS3;
930 ULONGLONG IntS4;
931 ULONGLONG IntS5;
932 ULONGLONG IntFp;
933 ULONGLONG IntA0;
934 ULONGLONG IntA1;
935 ULONGLONG IntA2;
936 ULONGLONG IntA3;
937 ULONGLONG IntA4;
938 ULONGLONG IntA5;
939 ULONGLONG IntT8;
940 ULONGLONG IntT9;
941 ULONGLONG IntT10;
942 ULONGLONG IntT11;
943 ULONGLONG IntRa;
944 ULONGLONG IntT12;
945 ULONGLONG IntAt;
946 ULONGLONG IntGp;
947 ULONGLONG IntSp;
948 ULONGLONG IntZero;
950 /* selected by CONTEXT_FLOATING_POINT */
951 ULONGLONG Fpcr;
952 ULONGLONG SoftFpcr;
954 /* selected by CONTEXT_CONTROL */
955 ULONGLONG Fir;
956 DWORD Psr;
957 DWORD ContextFlags;
958 DWORD Fill[4];
959 } CONTEXT;
961 #define _QUAD_PSR_OFFSET HighSoftFpcr
962 #define _QUAD_FLAGS_OFFSET HighFir
964 #endif /* _ALPHA_ */
966 #ifdef __arm__
968 /* The following flags control the contents of the CONTEXT structure. */
970 #define CONTEXT_ARM 0x0000040
971 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
972 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
974 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
976 typedef struct _CONTEXT {
977 /* The flags values within this flag control the contents of
978 a CONTEXT record.
980 If the context record is used as an input parameter, then
981 for each portion of the context record controlled by a flag
982 whose value is set, it is assumed that that portion of the
983 context record contains valid context. If the context record
984 is being used to modify a thread's context, then only that
985 portion of the threads context will be modified.
987 If the context record is used as an IN OUT parameter to capture
988 the context of a thread, then only those portions of the thread's
989 context corresponding to set flags will be returned.
991 The context record is never used as an OUT only parameter. */
993 ULONG ContextFlags;
995 /* This section is specified/returned if the ContextFlags word contains
996 the flag CONTEXT_INTEGER. */
997 ULONG R0;
998 ULONG R1;
999 ULONG R2;
1000 ULONG R3;
1001 ULONG R4;
1002 ULONG R5;
1003 ULONG R6;
1004 ULONG R7;
1005 ULONG R8;
1006 ULONG R9;
1007 ULONG R10;
1008 ULONG R11;
1009 ULONG R12;
1011 ULONG Sp;
1012 ULONG Lr;
1013 ULONG Pc;
1014 ULONG Psr;
1015 } CONTEXT;
1017 #endif /* __arm__ */
1020 /* Mips context definitions */
1021 #ifdef _MIPS_
1023 #define CONTEXT_R4000 0x00010000
1025 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1026 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1027 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1029 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1031 typedef struct _CONTEXT
1033 DWORD Argument[4];
1034 /* These are selected by CONTEXT_FLOATING_POINT */
1035 DWORD FltF0;
1036 DWORD FltF1;
1037 DWORD FltF2;
1038 DWORD FltF3;
1039 DWORD FltF4;
1040 DWORD FltF5;
1041 DWORD FltF6;
1042 DWORD FltF7;
1043 DWORD FltF8;
1044 DWORD FltF9;
1045 DWORD FltF10;
1046 DWORD FltF11;
1047 DWORD FltF12;
1048 DWORD FltF13;
1049 DWORD FltF14;
1050 DWORD FltF15;
1051 DWORD FltF16;
1052 DWORD FltF17;
1053 DWORD FltF18;
1054 DWORD FltF19;
1055 DWORD FltF20;
1056 DWORD FltF21;
1057 DWORD FltF22;
1058 DWORD FltF23;
1059 DWORD FltF24;
1060 DWORD FltF25;
1061 DWORD FltF26;
1062 DWORD FltF27;
1063 DWORD FltF28;
1064 DWORD FltF29;
1065 DWORD FltF30;
1066 DWORD FltF31;
1068 /* These are selected by CONTEXT_INTEGER */
1069 DWORD IntZero;
1070 DWORD IntAt;
1071 DWORD IntV0;
1072 DWORD IntV1;
1073 DWORD IntA0;
1074 DWORD IntA1;
1075 DWORD IntA2;
1076 DWORD IntA3;
1077 DWORD IntT0;
1078 DWORD IntT1;
1079 DWORD IntT2;
1080 DWORD IntT3;
1081 DWORD IntT4;
1082 DWORD IntT5;
1083 DWORD IntT6;
1084 DWORD IntT7;
1085 DWORD IntS0;
1086 DWORD IntS1;
1087 DWORD IntS2;
1088 DWORD IntS3;
1089 DWORD IntS4;
1090 DWORD IntS5;
1091 DWORD IntS6;
1092 DWORD IntS7;
1093 DWORD IntT8;
1094 DWORD IntT9;
1095 DWORD IntK0;
1096 DWORD IntK1;
1097 DWORD IntGp;
1098 DWORD IntSp;
1099 DWORD IntS8;
1100 DWORD IntRa;
1101 DWORD IntLo;
1102 DWORD IntHi;
1104 /* These are selected by CONTEXT_FLOATING_POINT */
1105 DWORD Fsr;
1107 /* These are selected by CONTEXT_CONTROL */
1108 DWORD Fir;
1109 DWORD Psr;
1111 DWORD ContextFlags;
1112 DWORD Fill[2];
1113 } CONTEXT;
1115 #endif /* _MIPS_ */
1117 /* PowerPC context definitions */
1118 #ifdef __powerpc__
1120 #define CONTEXT_CONTROL 0x0001
1121 #define CONTEXT_FLOATING_POINT 0x0002
1122 #define CONTEXT_INTEGER 0x0004
1123 #define CONTEXT_DEBUG_REGISTERS 0x0008
1124 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1126 typedef struct
1128 /* These are selected by CONTEXT_FLOATING_POINT */
1129 double Fpr0;
1130 double Fpr1;
1131 double Fpr2;
1132 double Fpr3;
1133 double Fpr4;
1134 double Fpr5;
1135 double Fpr6;
1136 double Fpr7;
1137 double Fpr8;
1138 double Fpr9;
1139 double Fpr10;
1140 double Fpr11;
1141 double Fpr12;
1142 double Fpr13;
1143 double Fpr14;
1144 double Fpr15;
1145 double Fpr16;
1146 double Fpr17;
1147 double Fpr18;
1148 double Fpr19;
1149 double Fpr20;
1150 double Fpr21;
1151 double Fpr22;
1152 double Fpr23;
1153 double Fpr24;
1154 double Fpr25;
1155 double Fpr26;
1156 double Fpr27;
1157 double Fpr28;
1158 double Fpr29;
1159 double Fpr30;
1160 double Fpr31;
1161 double Fpscr;
1163 /* These are selected by CONTEXT_INTEGER */
1164 DWORD Gpr0;
1165 DWORD Gpr1;
1166 DWORD Gpr2;
1167 DWORD Gpr3;
1168 DWORD Gpr4;
1169 DWORD Gpr5;
1170 DWORD Gpr6;
1171 DWORD Gpr7;
1172 DWORD Gpr8;
1173 DWORD Gpr9;
1174 DWORD Gpr10;
1175 DWORD Gpr11;
1176 DWORD Gpr12;
1177 DWORD Gpr13;
1178 DWORD Gpr14;
1179 DWORD Gpr15;
1180 DWORD Gpr16;
1181 DWORD Gpr17;
1182 DWORD Gpr18;
1183 DWORD Gpr19;
1184 DWORD Gpr20;
1185 DWORD Gpr21;
1186 DWORD Gpr22;
1187 DWORD Gpr23;
1188 DWORD Gpr24;
1189 DWORD Gpr25;
1190 DWORD Gpr26;
1191 DWORD Gpr27;
1192 DWORD Gpr28;
1193 DWORD Gpr29;
1194 DWORD Gpr30;
1195 DWORD Gpr31;
1197 DWORD Cr;
1198 DWORD Xer;
1200 /* These are selected by CONTEXT_CONTROL */
1201 DWORD Msr;
1202 DWORD Iar; /* Instruction Address Register , aka PC ... */
1203 DWORD Lr;
1204 DWORD Ctr;
1206 DWORD ContextFlags;
1208 DWORD Dar; /* Fault registers for coredump */
1209 DWORD Dsisr;
1210 DWORD Trap; /* number of powerpc exception taken */
1212 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1213 DWORD Dr0;
1214 DWORD Dr1;
1215 DWORD Dr2;
1216 DWORD Dr3;
1217 DWORD Dr4;
1218 DWORD Dr5;
1219 DWORD Dr6;
1220 DWORD Dr7;
1221 } CONTEXT;
1223 typedef struct _STACK_FRAME_HEADER
1225 DWORD BackChain;
1226 DWORD GlueSaved1;
1227 DWORD GlueSaved2;
1228 DWORD Reserved1;
1229 DWORD Spare1;
1230 DWORD Spare2;
1232 DWORD Parameter0;
1233 DWORD Parameter1;
1234 DWORD Parameter2;
1235 DWORD Parameter3;
1236 DWORD Parameter4;
1237 DWORD Parameter5;
1238 DWORD Parameter6;
1239 DWORD Parameter7;
1240 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1242 #endif /* __powerpc__ */
1244 #ifdef __sparc__
1247 * FIXME:
1249 * There is no official CONTEXT structure defined for the SPARC
1250 * architecture, so I just made one up.
1252 * This structure is valid only for 32-bit SPARC architectures,
1253 * not for 64-bit SPARC.
1255 * Note that this structure contains only the 'top-level' registers;
1256 * the rest of the register window chain is not visible.
1258 * The layout follows the Solaris 'prgregset_t' structure.
1262 #define CONTEXT_SPARC 0x10000000
1264 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1265 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1266 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1268 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1270 typedef struct _CONTEXT
1272 DWORD ContextFlags;
1274 /* These are selected by CONTEXT_INTEGER */
1275 DWORD g0;
1276 DWORD g1;
1277 DWORD g2;
1278 DWORD g3;
1279 DWORD g4;
1280 DWORD g5;
1281 DWORD g6;
1282 DWORD g7;
1283 DWORD o0;
1284 DWORD o1;
1285 DWORD o2;
1286 DWORD o3;
1287 DWORD o4;
1288 DWORD o5;
1289 DWORD o6;
1290 DWORD o7;
1291 DWORD l0;
1292 DWORD l1;
1293 DWORD l2;
1294 DWORD l3;
1295 DWORD l4;
1296 DWORD l5;
1297 DWORD l6;
1298 DWORD l7;
1299 DWORD i0;
1300 DWORD i1;
1301 DWORD i2;
1302 DWORD i3;
1303 DWORD i4;
1304 DWORD i5;
1305 DWORD i6;
1306 DWORD i7;
1308 /* These are selected by CONTEXT_CONTROL */
1309 DWORD psr;
1310 DWORD pc;
1311 DWORD npc;
1312 DWORD y;
1313 DWORD wim;
1314 DWORD tbr;
1316 /* FIXME: floating point registers missing */
1318 } CONTEXT;
1320 #endif /* __sparc__ */
1322 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1323 #error You need to define a CONTEXT for your CPU
1324 #endif
1326 typedef CONTEXT *PCONTEXT;
1329 * Language IDs
1332 #define MAKELCID(l, s) (MAKELONG(l, s))
1334 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1335 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1336 #define SUBLANGID(l) ((WORD)(l) >> 10)
1338 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1339 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1341 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1342 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1343 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1344 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1345 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1347 #define UNREFERENCED_PARAMETER(u) (u)
1348 #define DBG_UNREFERENCED_PARAMETER(u) (u)
1349 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (u)
1351 #define LANG_NEUTRAL 0x00
1352 #define LANG_INVARIANT 0x7f
1354 #define LANG_AFRIKAANS 0x36
1355 #define LANG_ALBANIAN 0x1c
1356 #define LANG_ALSATIAN 0x84
1357 #define LANG_AMHARIC 0x5e
1358 #define LANG_ARABIC 0x01
1359 #define LANG_ARMENIAN 0x2b
1360 #define LANG_ASSAMESE 0x4d
1361 #define LANG_AZERI 0x2c
1362 #define LANG_BASHKIR 0x6d
1363 #define LANG_BASQUE 0x2d
1364 #define LANG_BELARUSIAN 0x23
1365 #define LANG_BENGALI 0x45
1366 #define LANG_BOSNIAN 0x1a
1367 #define LANG_BOSNIAN_NEUTRAL 0x781a
1368 #define LANG_BRETON 0x7e
1369 #define LANG_BULGARIAN 0x02
1370 #define LANG_CATALAN 0x03
1371 #define LANG_CHINESE 0x04
1372 #define LANG_CHINESE_SIMPLIFIED 0x0004
1373 #define LANG_CHINESE_TRADITIONAL 0x7c04
1374 #define LANG_CORSICAN 0x83
1375 #define LANG_CROATIAN 0x1a
1376 #define LANG_CZECH 0x05
1377 #define LANG_DANISH 0x06
1378 #define LANG_DARI 0x8c
1379 #define LANG_DIVEHI 0x65
1380 #define LANG_DUTCH 0x13
1381 #define LANG_ENGLISH 0x09
1382 #define LANG_ESTONIAN 0x25
1383 #define LANG_FAEROESE 0x38
1384 #define LANG_FARSI LANG_PERSIAN
1385 #define LANG_FILIPINO 0x64
1386 #define LANG_FINNISH 0x0b
1387 #define LANG_FRENCH 0x0c
1388 #define LANG_FRISIAN 0x62
1389 #define LANG_GALICIAN 0x56
1390 #define LANG_GEORGIAN 0x37
1391 #define LANG_GERMAN 0x07
1392 #define LANG_GREEK 0x08
1393 #define LANG_GREENLANDIC 0x6f
1394 #define LANG_GUJARATI 0x47
1395 #define LANG_HAUSA 0x68
1396 #define LANG_HEBREW 0x0d
1397 #define LANG_HINDI 0x39
1398 #define LANG_HUNGARIAN 0x0e
1399 #define LANG_ICELANDIC 0x0f
1400 #define LANG_IGBO 0x70
1401 #define LANG_INDONESIAN 0x21
1402 #define LANG_INUKTITUT 0x5d
1403 #define LANG_IRISH 0x3c
1404 #define LANG_ITALIAN 0x10
1405 #define LANG_JAPANESE 0x11
1406 #define LANG_KANNADA 0x4b
1407 #define LANG_KASHMIRI 0x60
1408 #define LANG_KAZAK 0x3f
1409 #define LANG_KHMER 0x53
1410 #define LANG_KICHE 0x86
1411 #define LANG_KINYARWANDA 0x87
1412 #define LANG_KONKANI 0x57
1413 #define LANG_KOREAN 0x12
1414 #define LANG_KYRGYZ 0x40
1415 #define LANG_LAO 0x54
1416 #define LANG_LATVIAN 0x26
1417 #define LANG_LITHUANIAN 0x27
1418 #define LANG_LOWER_SORBIAN 0x2e
1419 #define LANG_LUXEMBOURGISH 0x6e
1420 #define LANG_MACEDONIAN 0x2f
1421 #define LANG_MALAY 0x3e
1422 #define LANG_MALAYALAM 0x4c
1423 #define LANG_MALTESE 0x3a
1424 #define LANG_MANIPURI 0x58
1425 #define LANG_MAORI 0x81
1426 #define LANG_MAPUDUNGUN 0x7a
1427 #define LANG_MARATHI 0x4e
1428 #define LANG_MOHAWK 0x7c
1429 #define LANG_MONGOLIAN 0x50
1430 #define LANG_NEPALI 0x61
1431 #define LANG_NORWEGIAN 0x14
1432 #define LANG_OCCITAN 0x82
1433 #define LANG_ORIYA 0x48
1434 #define LANG_PASHTO 0x63
1435 #define LANG_PERSIAN 0x29
1436 #define LANG_POLISH 0x15
1437 #define LANG_PORTUGUESE 0x16
1438 #define LANG_PUNJABI 0x46
1439 #define LANG_QUECHUA 0x6b
1440 #define LANG_ROMANIAN 0x18
1441 #define LANG_ROMANSH 0x17
1442 #define LANG_RUSSIAN 0x19
1443 #define LANG_SAMI 0x3b
1444 #define LANG_SANSKRIT 0x4f
1445 #define LANG_SERBIAN 0x1a
1446 #define LANG_SERBIAN_NEUTRAL 0x7c1a
1447 #define LANG_SINDHI 0x59
1448 #define LANG_SINHALESE 0x5b
1449 #define LANG_SLOVAK 0x1b
1450 #define LANG_SLOVENIAN 0x24
1451 #define LANG_SOTHO 0x6c
1452 #define LANG_SPANISH 0x0a
1453 #define LANG_SWAHILI 0x41
1454 #define LANG_SWEDISH 0x1d
1455 #define LANG_SYRIAC 0x5a
1456 #define LANG_TAJIK 0x28
1457 #define LANG_TAMAZIGHT 0x5f
1458 #define LANG_TAMIL 0x49
1459 #define LANG_TATAR 0x44
1460 #define LANG_TELUGU 0x4a
1461 #define LANG_THAI 0x1e
1462 #define LANG_TIBETAN 0x51
1463 #define LANG_TIGRIGNA 0x73
1464 #define LANG_TSWANA 0x32
1465 #define LANG_TURKISH 0x1f
1466 #define LANG_TURKMEN 0x42
1467 #define LANG_UIGHUR 0x80
1468 #define LANG_UKRAINIAN 0x22
1469 #define LANG_UPPER_SORBIAN 0x2e
1470 #define LANG_URDU 0x20
1471 #define LANG_UZBEK 0x43
1472 #define LANG_VIETNAMESE 0x2a
1473 #define LANG_WELSH 0x52
1474 #define LANG_WOLOF 0x88
1475 #define LANG_XHOSA 0x34
1476 #define LANG_YAKUT 0x85
1477 #define LANG_YI 0x78
1478 #define LANG_YORUBA 0x6a
1479 #define LANG_ZULU 0x35
1481 /* These are documented by the MSDN but are missing from the Windows header */
1482 #define LANG_MALAGASY 0x8d
1484 /* FIXME: these are not defined anywhere */
1485 #define LANG_SUTU 0x30
1486 #define LANG_TSONGA 0x31
1487 #define LANG_VENDA 0x33
1489 /* non standard; keep the number high enough (but < 0xff) */
1490 #define LANG_ESPERANTO 0x8f
1491 #define LANG_WALON 0x90
1492 #define LANG_CORNISH 0x91
1493 #define LANG_GAELIC 0x94
1495 /* Sublanguage definitions */
1496 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1497 #define SUBLANG_DEFAULT 0x01 /* user default */
1498 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1499 #define SUBLANG_CUSTOM_DEFAULT 0x03
1500 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1501 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1503 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1504 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1505 #define SUBLANG_ALSATIAN_FRANCE 0x01
1506 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1507 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1508 #define SUBLANG_ARABIC_IRAQ 0x02
1509 #define SUBLANG_ARABIC_EGYPT 0x03
1510 #define SUBLANG_ARABIC_LIBYA 0x04
1511 #define SUBLANG_ARABIC_ALGERIA 0x05
1512 #define SUBLANG_ARABIC_MOROCCO 0x06
1513 #define SUBLANG_ARABIC_TUNISIA 0x07
1514 #define SUBLANG_ARABIC_OMAN 0x08
1515 #define SUBLANG_ARABIC_YEMEN 0x09
1516 #define SUBLANG_ARABIC_SYRIA 0x0a
1517 #define SUBLANG_ARABIC_JORDAN 0x0b
1518 #define SUBLANG_ARABIC_LEBANON 0x0c
1519 #define SUBLANG_ARABIC_KUWAIT 0x0d
1520 #define SUBLANG_ARABIC_UAE 0x0e
1521 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1522 #define SUBLANG_ARABIC_QATAR 0x10
1523 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1524 #define SUBLANG_ASSAMESE_INDIA 0x01
1525 #define SUBLANG_AZERI_LATIN 0x01
1526 #define SUBLANG_AZERI_CYRILLIC 0x02
1527 #define SUBLANG_BASHKIR_RUSSIA 0x01
1528 #define SUBLANG_BASQUE_BASQUE 0x01
1529 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1530 #define SUBLANG_BENGALI_INDIA 0x01
1531 #define SUBLANG_BENGALI_BANGLADESH 0x02
1532 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1533 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1534 #define SUBLANG_BRETON_FRANCE 0x01
1535 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1536 #define SUBLANG_CATALAN_CATALAN 0x01
1537 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1538 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1539 #define SUBLANG_CHINESE_HONGKONG 0x03
1540 #define SUBLANG_CHINESE_SINGAPORE 0x04
1541 #define SUBLANG_CHINESE_MACAU 0x05
1542 #define SUBLANG_CORSICAN_FRANCE 0x01
1543 #define SUBLANG_CROATIAN_CROATIA 0x01
1544 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1545 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1546 #define SUBLANG_DANISH_DENMARK 0x01
1547 #define SUBLANG_DARI_AFGHANISTAN 0x01
1548 #define SUBLANG_DIVEHI_MALDIVES 0x01
1549 #define SUBLANG_DUTCH 0x01
1550 #define SUBLANG_DUTCH_BELGIAN 0x02
1551 #define SUBLANG_ENGLISH_US 0x01
1552 #define SUBLANG_ENGLISH_UK 0x02
1553 #define SUBLANG_ENGLISH_AUS 0x03
1554 #define SUBLANG_ENGLISH_CAN 0x04
1555 #define SUBLANG_ENGLISH_NZ 0x05
1556 #define SUBLANG_ENGLISH_EIRE 0x06
1557 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1558 #define SUBLANG_ENGLISH_JAMAICA 0x08
1559 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1560 #define SUBLANG_ENGLISH_BELIZE 0x0a
1561 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1562 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1563 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1564 #define SUBLANG_ENGLISH_INDIA 0x10
1565 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1566 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1567 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1568 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1569 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
1570 #define SUBLANG_FINNISH_FINLAND 0x01
1571 #define SUBLANG_FRENCH 0x01
1572 #define SUBLANG_FRENCH_BELGIAN 0x02
1573 #define SUBLANG_FRENCH_CANADIAN 0x03
1574 #define SUBLANG_FRENCH_SWISS 0x04
1575 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1576 #define SUBLANG_FRENCH_MONACO 0x06
1577 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
1578 #define SUBLANG_GALICIAN_GALICIAN 0x01
1579 #define SUBLANG_GEORGIAN_GEORGIA 0x01
1580 #define SUBLANG_GERMAN 0x01
1581 #define SUBLANG_GERMAN_SWISS 0x02
1582 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1583 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1584 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1585 #define SUBLANG_GREEK_GREECE 0x01
1586 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
1587 #define SUBLANG_GUJARATI_INDIA 0x01
1588 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
1589 #define SUBLANG_HEBREW_ISRAEL 0x01
1590 #define SUBLANG_HINDI_INDIA 0x01
1591 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
1592 #define SUBLANG_ICELANDIC_ICELAND 0x01
1593 #define SUBLANG_IGBO_NIGERIA 0x01
1594 #define SUBLANG_INDONESIAN_INDONESIA 0x01
1595 #define SUBLANG_INUKTITUT_CANADA 0x01
1596 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
1597 #define SUBLANG_IRISH_IRELAND 0x02
1598 #define SUBLANG_ITALIAN 0x01
1599 #define SUBLANG_ITALIAN_SWISS 0x02
1600 #define SUBLANG_JAPANESE_JAPAN 0x01
1601 #define SUBLANG_KANNADA_INDIA 0x01
1602 #define SUBLANG_KASHMIRI_SASIA 0x02
1603 #define SUBLANG_KASHMIRI_INDIA 0x02
1604 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
1605 #define SUBLANG_KHMER_CAMBODIA 0x01
1606 #define SUBLANG_KICHE_GUATEMALA 0x01
1607 #define SUBLANG_KINYARWANDA_RWANDA 0X01
1608 #define SUBLANG_KONKANI_INDIA 0x01
1609 #define SUBLANG_KOREAN 0x01
1610 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
1611 #define SUBLANG_LAO_LAO 0x01
1612 #define SUBLANG_LATVIAN_LATVIA 0x01
1613 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
1614 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
1615 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
1616 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
1617 #define SUBLANG_MALAY_MALAYSIA 0x01
1618 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1619 #define SUBLANG_MALAYALAM_INDIA 0x01
1620 #define SUBLANG_MALTESE_MALTA 0x01
1621 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1622 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1623 #define SUBLANG_MARATHI_INDIA 0x01
1624 #define SUBLANG_MOHAWK_MOHAWK 0x01
1625 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1626 #define SUBLANG_MONGOLIAN_PRC 0x02
1627 #define SUBLANG_NEPALI_INDIA 0x02
1628 #define SUBLANG_NEPALI_NEPAL 0x01
1629 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1630 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1631 #define SUBLANG_OCCITAN_FRANCE 0x01
1632 #define SUBLANG_ORIYA_INDIA 0x01
1633 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1634 #define SUBLANG_PERSIAN_IRAN 0x01
1635 #define SUBLANG_POLISH_POLAND 0x01
1636 #define SUBLANG_PORTUGUESE 0x02
1637 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1638 #define SUBLANG_PUNJABI_INDIA 0x01
1639 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1640 #define SUBLANG_QUECHUA_ECUADOR 0x02
1641 #define SUBLANG_QUECHUA_PERU 0x03
1642 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1643 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1644 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1645 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1646 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1647 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1648 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1649 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1650 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1651 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1652 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1653 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1654 #define SUBLANG_SANSKRIT_INDIA 0x01
1655 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1656 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1657 #define SUBLANG_SERBIAN_CROATIA 0x01
1658 #define SUBLANG_SERBIAN_LATIN 0x02
1659 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1660 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1661 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1662 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1663 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1664 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1665 #define SUBLANG_SPANISH 0x01
1666 #define SUBLANG_SPANISH_MEXICAN 0x02
1667 #define SUBLANG_SPANISH_MODERN 0x03
1668 #define SUBLANG_SPANISH_GUATEMALA 0x04
1669 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1670 #define SUBLANG_SPANISH_PANAMA 0x06
1671 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1672 #define SUBLANG_SPANISH_VENEZUELA 0x08
1673 #define SUBLANG_SPANISH_COLOMBIA 0x09
1674 #define SUBLANG_SPANISH_PERU 0x0a
1675 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1676 #define SUBLANG_SPANISH_ECUADOR 0x0c
1677 #define SUBLANG_SPANISH_CHILE 0x0d
1678 #define SUBLANG_SPANISH_URUGUAY 0x0e
1679 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1680 #define SUBLANG_SPANISH_BOLIVIA 0x10
1681 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1682 #define SUBLANG_SPANISH_HONDURAS 0x12
1683 #define SUBLANG_SPANISH_NICARAGUA 0x13
1684 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1685 #define SUBLANG_SPANISH_US 0x15
1686 #define SUBLANG_SWAHILI_KENYA 0x01
1687 #define SUBLANG_SWEDISH 0x01
1688 #define SUBLANG_SWEDISH_FINLAND 0x02
1689 #define SUBLANG_SYRIAC_SYRIA 0x01
1690 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1691 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1692 #define SUBLANG_TAMIL_INDIA 0x01
1693 #define SUBLANG_TATAR_RUSSIA 0x01
1694 #define SUBLANG_TELUGU_INDIA 0x01
1695 #define SUBLANG_THAI_THAILAND 0x01
1696 #define SUBLANG_TIBETAN_PRC 0x01
1697 #define SUBLANG_TIBETAN_BHUTAN 0x02
1698 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1699 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1700 #define SUBLANG_TURKISH_TURKEY 0x01
1701 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1702 #define SUBLANG_UIGHUR_PRC 0x01
1703 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1704 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1705 #define SUBLANG_URDU_PAKISTAN 0x01
1706 #define SUBLANG_URDU_INDIA 0x02
1707 #define SUBLANG_UZBEK_LATIN 0x01
1708 #define SUBLANG_UZBEK_CYRILLIC 0x02
1709 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1710 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1711 #define SUBLANG_WOLOF_SENEGAL 0x01
1712 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1713 #define SUBLANG_YAKUT_RUSSIA 0x01
1714 #define SUBLANG_YI_PRC 0x01
1715 #define SUBLANG_YORUBA_NIGERIA 0x01
1716 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1718 /* These are documented by the MSDN but are missing from the Windows header */
1719 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
1720 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
1721 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
1722 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
1723 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
1724 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
1725 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
1726 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
1728 /* FIXME: these are not defined anywhere */
1729 #define SUBLANG_DUTCH_SURINAM 0x03
1730 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
1731 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1732 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
1733 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1734 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
1735 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1736 #define SUBLANG_GAELIC 0x01
1737 #define SUBLANG_GAELIC_SCOTTISH 0x02
1738 #define SUBLANG_GAELIC_MANX 0x03
1742 * Sort definitions
1745 #define SORT_DEFAULT 0x0
1746 #define SORT_JAPANESE_XJIS 0x0
1747 #define SORT_JAPANESE_UNICODE 0x1
1748 #define SORT_CHINESE_BIG5 0x0
1749 #define SORT_CHINESE_UNICODE 0x1
1750 #define SORT_KOREAN_KSC 0x0
1751 #define SORT_KOREAN_UNICODE 0x1
1756 * Definitions for IsTextUnicode()
1759 #define IS_TEXT_UNICODE_ASCII16 0x0001
1760 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1761 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1762 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1763 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1764 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1765 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1766 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1767 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1768 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1769 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1770 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1771 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1772 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1773 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1774 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1776 #define MAXIMUM_WAIT_OBJECTS 64
1777 #define MAXIMUM_SUSPEND_COUNT 127
1779 #define WT_EXECUTEDEFAULT 0x00
1780 #define WT_EXECUTEINIOTHREAD 0x01
1781 #define WT_EXECUTEINUITHREAD 0x02
1782 #define WT_EXECUTEINWAITTHREAD 0x04
1783 #define WT_EXECUTEONLYONCE 0x08
1784 #define WT_EXECUTELONGFUNCTION 0x10
1785 #define WT_EXECUTEINTIMERTHREAD 0x20
1786 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
1787 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
1788 #define WT_EXECUTEINLONGTHREAD 0x10
1789 #define WT_EXECUTEDELETEWAIT 0x08
1793 * From OS/2 2.0 exception handling
1794 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1797 #define EH_NONCONTINUABLE 0x01
1798 #define EH_UNWINDING 0x02
1799 #define EH_EXIT_UNWIND 0x04
1800 #define EH_STACK_INVALID 0x08
1801 #define EH_NESTED_CALL 0x10
1803 #define EXCEPTION_CONTINUABLE 0
1804 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1807 * The exception record used by Win32 to give additional information
1808 * about exception to exception handlers.
1811 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1813 typedef struct _EXCEPTION_RECORD
1815 DWORD ExceptionCode;
1816 DWORD ExceptionFlags;
1817 struct _EXCEPTION_RECORD *ExceptionRecord;
1819 PVOID ExceptionAddress;
1820 DWORD NumberParameters;
1821 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1822 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1825 * The exception pointers structure passed to exception filters
1826 * in except() and the UnhandledExceptionFilter().
1829 typedef struct _EXCEPTION_POINTERS
1831 PEXCEPTION_RECORD ExceptionRecord;
1832 PCONTEXT ContextRecord;
1833 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1837 * The exception frame, used for registering exception handlers
1838 * Win32 cares only about this, but compilers generally emit
1839 * larger exception frames for their own use.
1842 struct _EXCEPTION_REGISTRATION_RECORD;
1844 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
1845 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
1847 typedef struct _EXCEPTION_REGISTRATION_RECORD
1849 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
1850 PEXCEPTION_HANDLER Handler;
1851 } EXCEPTION_REGISTRATION_RECORD;
1854 * function pointer to an exception filter
1857 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
1858 typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1859 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1861 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1862 LPTOP_LEVEL_EXCEPTION_FILTER
1863 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1865 typedef struct _NT_TIB
1867 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1868 PVOID StackBase;
1869 PVOID StackLimit;
1870 PVOID SubSystemTib;
1871 union {
1872 PVOID FiberData;
1873 DWORD Version;
1874 } DUMMYUNIONNAME;
1875 PVOID ArbitraryUserPointer;
1876 struct _NT_TIB *Self;
1877 } NT_TIB, *PNT_TIB;
1879 struct _TEB;
1881 #if defined(__i386__) && defined(__GNUC__)
1882 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1883 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1885 struct _TEB *teb;
1886 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1887 return teb;
1889 #elif defined(__i386__) && defined(_MSC_VER)
1890 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1892 struct _TEB *teb;
1893 __asm mov eax, fs:[0x18];
1894 __asm mov teb, eax;
1895 return teb;
1897 #else
1898 extern struct _TEB * WINAPI NtCurrentTeb(void);
1899 #endif
1901 #ifdef NONAMELESSUNION
1902 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
1903 #else
1904 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
1905 #endif
1906 #define GetFiberData() (*(void **)GetCurrentFiber())
1908 #define TLS_MINIMUM_AVAILABLE 64
1911 * File formats definitions
1914 #include <pshpack2.h>
1915 typedef struct _IMAGE_DOS_HEADER {
1916 WORD e_magic; /* 00: MZ Header signature */
1917 WORD e_cblp; /* 02: Bytes on last page of file */
1918 WORD e_cp; /* 04: Pages in file */
1919 WORD e_crlc; /* 06: Relocations */
1920 WORD e_cparhdr; /* 08: Size of header in paragraphs */
1921 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
1922 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
1923 WORD e_ss; /* 0e: Initial (relative) SS value */
1924 WORD e_sp; /* 10: Initial SP value */
1925 WORD e_csum; /* 12: Checksum */
1926 WORD e_ip; /* 14: Initial IP value */
1927 WORD e_cs; /* 16: Initial (relative) CS value */
1928 WORD e_lfarlc; /* 18: File address of relocation table */
1929 WORD e_ovno; /* 1a: Overlay number */
1930 WORD e_res[4]; /* 1c: Reserved words */
1931 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
1932 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
1933 WORD e_res2[10]; /* 28: Reserved words */
1934 DWORD e_lfanew; /* 3c: Offset to extended header */
1935 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
1936 #include <poppack.h>
1938 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1939 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1940 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1941 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1942 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1943 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1946 * This is the Windows executable (NE) header.
1947 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1949 #include <pshpack2.h>
1950 typedef struct
1952 WORD ne_magic; /* 00 NE signature 'NE' */
1953 BYTE ne_ver; /* 02 Linker version number */
1954 BYTE ne_rev; /* 03 Linker revision number */
1955 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
1956 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
1957 LONG ne_crc; /* 08 Checksum */
1958 WORD ne_flags; /* 0c Flags about segments in this file */
1959 WORD ne_autodata; /* 0e Automatic data segment number */
1960 WORD ne_heap; /* 10 Initial size of local heap */
1961 WORD ne_stack; /* 12 Initial size of stack */
1962 DWORD ne_csip; /* 14 Initial CS:IP */
1963 DWORD ne_sssp; /* 18 Initial SS:SP */
1964 WORD ne_cseg; /* 1c # of entries in segment table */
1965 WORD ne_cmod; /* 1e # of entries in module reference tab. */
1966 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
1967 WORD ne_segtab; /* 22 Offset to segment table */
1968 WORD ne_rsrctab; /* 24 Offset to resource table */
1969 WORD ne_restab; /* 26 Offset to resident-name table */
1970 WORD ne_modtab; /* 28 Offset to module reference table */
1971 WORD ne_imptab; /* 2a Offset to imported name table */
1972 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
1973 WORD ne_cmovent; /* 30 # of movable entry points */
1974 WORD ne_align; /* 32 Logical sector alignment shift count */
1975 WORD ne_cres; /* 34 # of resource segments */
1976 BYTE ne_exetyp; /* 36 Flags indicating target OS */
1977 BYTE ne_flagsothers; /* 37 Additional information flags */
1978 WORD ne_pretthunks; /* 38 Offset to return thunks */
1979 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
1980 WORD ne_swaparea; /* 3c Reserved by Microsoft */
1981 WORD ne_expver; /* 3e Expected Windows version number */
1982 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
1983 #include <poppack.h>
1985 #include <pshpack2.h>
1986 typedef struct _IMAGE_VXD_HEADER {
1987 WORD e32_magic;
1988 BYTE e32_border;
1989 BYTE e32_worder;
1990 DWORD e32_level;
1991 WORD e32_cpu;
1992 WORD e32_os;
1993 DWORD e32_ver;
1994 DWORD e32_mflags;
1995 DWORD e32_mpages;
1996 DWORD e32_startobj;
1997 DWORD e32_eip;
1998 DWORD e32_stackobj;
1999 DWORD e32_esp;
2000 DWORD e32_pagesize;
2001 DWORD e32_lastpagesize;
2002 DWORD e32_fixupsize;
2003 DWORD e32_fixupsum;
2004 DWORD e32_ldrsize;
2005 DWORD e32_ldrsum;
2006 DWORD e32_objtab;
2007 DWORD e32_objcnt;
2008 DWORD e32_objmap;
2009 DWORD e32_itermap;
2010 DWORD e32_rsrctab;
2011 DWORD e32_rsrccnt;
2012 DWORD e32_restab;
2013 DWORD e32_enttab;
2014 DWORD e32_dirtab;
2015 DWORD e32_dircnt;
2016 DWORD e32_fpagetab;
2017 DWORD e32_frectab;
2018 DWORD e32_impmod;
2019 DWORD e32_impmodcnt;
2020 DWORD e32_impproc;
2021 DWORD e32_pagesum;
2022 DWORD e32_datapage;
2023 DWORD e32_preload;
2024 DWORD e32_nrestab;
2025 DWORD e32_cbnrestab;
2026 DWORD e32_nressum;
2027 DWORD e32_autodata;
2028 DWORD e32_debuginfo;
2029 DWORD e32_debuglen;
2030 DWORD e32_instpreload;
2031 DWORD e32_instdemand;
2032 DWORD e32_heapsize;
2033 BYTE e32_res3[12];
2034 DWORD e32_winresoff;
2035 DWORD e32_winreslen;
2036 WORD e32_devid;
2037 WORD e32_ddkver;
2038 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2039 #include <poppack.h>
2041 /* These defines describe the meanings of the bits in the Characteristics
2042 field */
2044 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2045 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2046 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2047 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2048 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2049 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2050 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2051 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2052 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2053 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2054 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2055 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2056 #define IMAGE_FILE_SYSTEM 0x1000
2057 #define IMAGE_FILE_DLL 0x2000
2058 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2059 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2061 /* These are the settings of the Machine field. */
2062 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2063 #define IMAGE_FILE_MACHINE_I860 0x014d
2064 #define IMAGE_FILE_MACHINE_I386 0x014c
2065 #define IMAGE_FILE_MACHINE_R3000 0x0162
2066 #define IMAGE_FILE_MACHINE_R4000 0x0166
2067 #define IMAGE_FILE_MACHINE_R10000 0x0168
2068 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2069 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2070 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2071 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2072 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2073 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2074 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2075 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2076 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2077 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2078 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2079 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2080 #define IMAGE_FILE_MACHINE_IA64 0x0200
2081 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2082 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2083 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2084 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2085 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2086 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2087 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2088 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2089 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2090 #define IMAGE_FILE_MACHINE_M32R 0x9041
2091 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2093 #define IMAGE_SIZEOF_FILE_HEADER 20
2094 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2095 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2096 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2097 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2098 #define IMAGE_SIZEOF_SHORT_NAME 8
2099 #define IMAGE_SIZEOF_SECTION_HEADER 40
2100 #define IMAGE_SIZEOF_SYMBOL 18
2101 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2102 #define IMAGE_SIZEOF_RELOCATION 10
2103 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2104 #define IMAGE_SIZEOF_LINENUMBER 6
2105 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2107 /* Possible Magic values */
2108 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2109 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2110 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2112 #ifdef _WIN64
2113 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2114 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2115 #else
2116 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2117 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2118 #endif
2120 /* These are indexes into the DataDirectory array */
2121 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2122 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2123 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2124 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2125 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2126 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2127 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2128 #define IMAGE_FILE_DESCRIPTION_STRING 7
2129 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2130 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2131 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2133 /* Directory Entries, indices into the DataDirectory array */
2135 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2136 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2137 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2138 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2139 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2140 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2141 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2142 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2143 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2144 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2145 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2146 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2147 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2148 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2149 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2151 /* Subsystem Values */
2153 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2154 #define IMAGE_SUBSYSTEM_NATIVE 1
2155 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2156 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2157 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2158 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2159 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2160 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2161 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2162 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2163 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2164 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2165 #define IMAGE_SUBSYSTEM_XBOX 14
2167 /* DLL Characteristics */
2168 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2169 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2170 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2171 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2172 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2174 typedef struct _IMAGE_FILE_HEADER {
2175 WORD Machine;
2176 WORD NumberOfSections;
2177 DWORD TimeDateStamp;
2178 DWORD PointerToSymbolTable;
2179 DWORD NumberOfSymbols;
2180 WORD SizeOfOptionalHeader;
2181 WORD Characteristics;
2182 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2184 typedef struct _IMAGE_DATA_DIRECTORY {
2185 DWORD VirtualAddress;
2186 DWORD Size;
2187 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2189 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2191 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2192 WORD Magic; /* 0x20b */
2193 BYTE MajorLinkerVersion;
2194 BYTE MinorLinkerVersion;
2195 DWORD SizeOfCode;
2196 DWORD SizeOfInitializedData;
2197 DWORD SizeOfUninitializedData;
2198 DWORD AddressOfEntryPoint;
2199 DWORD BaseOfCode;
2200 ULONGLONG ImageBase;
2201 DWORD SectionAlignment;
2202 DWORD FileAlignment;
2203 WORD MajorOperatingSystemVersion;
2204 WORD MinorOperatingSystemVersion;
2205 WORD MajorImageVersion;
2206 WORD MinorImageVersion;
2207 WORD MajorSubsystemVersion;
2208 WORD MinorSubsystemVersion;
2209 DWORD Win32VersionValue;
2210 DWORD SizeOfImage;
2211 DWORD SizeOfHeaders;
2212 DWORD CheckSum;
2213 WORD Subsystem;
2214 WORD DllCharacteristics;
2215 ULONGLONG SizeOfStackReserve;
2216 ULONGLONG SizeOfStackCommit;
2217 ULONGLONG SizeOfHeapReserve;
2218 ULONGLONG SizeOfHeapCommit;
2219 DWORD LoaderFlags;
2220 DWORD NumberOfRvaAndSizes;
2221 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2222 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2224 typedef struct _IMAGE_NT_HEADERS64 {
2225 DWORD Signature;
2226 IMAGE_FILE_HEADER FileHeader;
2227 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2228 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2230 typedef struct _IMAGE_OPTIONAL_HEADER {
2232 /* Standard fields */
2234 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
2235 BYTE MajorLinkerVersion;
2236 BYTE MinorLinkerVersion;
2237 DWORD SizeOfCode;
2238 DWORD SizeOfInitializedData;
2239 DWORD SizeOfUninitializedData;
2240 DWORD AddressOfEntryPoint; /* 0x10 */
2241 DWORD BaseOfCode;
2242 DWORD BaseOfData;
2244 /* NT additional fields */
2246 DWORD ImageBase;
2247 DWORD SectionAlignment; /* 0x20 */
2248 DWORD FileAlignment;
2249 WORD MajorOperatingSystemVersion;
2250 WORD MinorOperatingSystemVersion;
2251 WORD MajorImageVersion;
2252 WORD MinorImageVersion;
2253 WORD MajorSubsystemVersion; /* 0x30 */
2254 WORD MinorSubsystemVersion;
2255 DWORD Win32VersionValue;
2256 DWORD SizeOfImage;
2257 DWORD SizeOfHeaders;
2258 DWORD CheckSum; /* 0x40 */
2259 WORD Subsystem;
2260 WORD DllCharacteristics;
2261 DWORD SizeOfStackReserve;
2262 DWORD SizeOfStackCommit;
2263 DWORD SizeOfHeapReserve; /* 0x50 */
2264 DWORD SizeOfHeapCommit;
2265 DWORD LoaderFlags;
2266 DWORD NumberOfRvaAndSizes;
2267 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2268 /* 0xE0 */
2269 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2271 typedef struct _IMAGE_NT_HEADERS {
2272 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2273 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2274 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
2275 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2277 #ifdef _WIN64
2278 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2279 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2280 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2281 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2282 #else
2283 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2284 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2285 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2286 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2287 #endif
2289 #define IMAGE_SIZEOF_SHORT_NAME 8
2291 typedef struct _IMAGE_SECTION_HEADER {
2292 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2293 union {
2294 DWORD PhysicalAddress;
2295 DWORD VirtualSize;
2296 } Misc;
2297 DWORD VirtualAddress;
2298 DWORD SizeOfRawData;
2299 DWORD PointerToRawData;
2300 DWORD PointerToRelocations;
2301 DWORD PointerToLinenumbers;
2302 WORD NumberOfRelocations;
2303 WORD NumberOfLinenumbers;
2304 DWORD Characteristics;
2305 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2307 #define IMAGE_SIZEOF_SECTION_HEADER 40
2309 #define IMAGE_FIRST_SECTION(ntheader) \
2310 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
2311 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
2313 /* These defines are for the Characteristics bitfield. */
2314 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2315 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2316 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2317 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2318 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2319 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2321 #define IMAGE_SCN_CNT_CODE 0x00000020
2322 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2323 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2325 #define IMAGE_SCN_LNK_OTHER 0x00000100
2326 #define IMAGE_SCN_LNK_INFO 0x00000200
2327 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2328 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2329 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2331 /* 0x00002000 - Reserved */
2332 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2333 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2335 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2336 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2337 #define IMAGE_SCN_MEM_16BIT 0x00020000
2338 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2339 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2341 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2342 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2343 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2344 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2345 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2346 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2347 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2348 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2349 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2350 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2351 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2352 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2353 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2354 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2355 /* 0x00F00000 - Unused */
2356 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2358 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2361 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2362 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2363 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2364 #define IMAGE_SCN_MEM_SHARED 0x10000000
2365 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2366 #define IMAGE_SCN_MEM_READ 0x40000000
2367 #define IMAGE_SCN_MEM_WRITE 0x80000000
2369 #include <pshpack2.h>
2371 typedef struct _IMAGE_SYMBOL {
2372 union {
2373 BYTE ShortName[8];
2374 struct {
2375 DWORD Short;
2376 DWORD Long;
2377 } Name;
2378 DWORD LongName[2];
2379 } N;
2380 DWORD Value;
2381 SHORT SectionNumber;
2382 WORD Type;
2383 BYTE StorageClass;
2384 BYTE NumberOfAuxSymbols;
2385 } IMAGE_SYMBOL;
2386 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
2388 #define IMAGE_SIZEOF_SYMBOL 18
2390 typedef struct _IMAGE_LINENUMBER {
2391 union {
2392 DWORD SymbolTableIndex;
2393 DWORD VirtualAddress;
2394 } Type;
2395 WORD Linenumber;
2396 } IMAGE_LINENUMBER;
2397 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
2399 #define IMAGE_SIZEOF_LINENUMBER 6
2401 typedef union _IMAGE_AUX_SYMBOL {
2402 struct {
2403 DWORD TagIndex;
2404 union {
2405 struct {
2406 WORD Linenumber;
2407 WORD Size;
2408 } LnSz;
2409 DWORD TotalSize;
2410 } Misc;
2411 union {
2412 struct {
2413 DWORD PointerToLinenumber;
2414 DWORD PointerToNextFunction;
2415 } Function;
2416 struct {
2417 WORD Dimension[4];
2418 } Array;
2419 } FcnAry;
2420 WORD TvIndex;
2421 } Sym;
2422 struct {
2423 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2424 } File;
2425 struct {
2426 DWORD Length;
2427 WORD NumberOfRelocations;
2428 WORD NumberOfLinenumbers;
2429 DWORD CheckSum;
2430 SHORT Number;
2431 BYTE Selection;
2432 } Section;
2433 } IMAGE_AUX_SYMBOL;
2434 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2436 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2438 #include <poppack.h>
2440 #define IMAGE_SYM_UNDEFINED (SHORT)0
2441 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2442 #define IMAGE_SYM_DEBUG (SHORT)-2
2444 #define IMAGE_SYM_TYPE_NULL 0x0000
2445 #define IMAGE_SYM_TYPE_VOID 0x0001
2446 #define IMAGE_SYM_TYPE_CHAR 0x0002
2447 #define IMAGE_SYM_TYPE_SHORT 0x0003
2448 #define IMAGE_SYM_TYPE_INT 0x0004
2449 #define IMAGE_SYM_TYPE_LONG 0x0005
2450 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2451 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2452 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2453 #define IMAGE_SYM_TYPE_UNION 0x0009
2454 #define IMAGE_SYM_TYPE_ENUM 0x000A
2455 #define IMAGE_SYM_TYPE_MOE 0x000B
2456 #define IMAGE_SYM_TYPE_BYTE 0x000C
2457 #define IMAGE_SYM_TYPE_WORD 0x000D
2458 #define IMAGE_SYM_TYPE_UINT 0x000E
2459 #define IMAGE_SYM_TYPE_DWORD 0x000F
2460 #define IMAGE_SYM_TYPE_PCODE 0x8000
2462 #define IMAGE_SYM_DTYPE_NULL 0
2463 #define IMAGE_SYM_DTYPE_POINTER 1
2464 #define IMAGE_SYM_DTYPE_FUNCTION 2
2465 #define IMAGE_SYM_DTYPE_ARRAY 3
2467 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2468 #define IMAGE_SYM_CLASS_NULL 0x0000
2469 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2470 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2471 #define IMAGE_SYM_CLASS_STATIC 0x0003
2472 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2473 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2474 #define IMAGE_SYM_CLASS_LABEL 0x0006
2475 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2476 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2477 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2478 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2479 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2480 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2481 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2482 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2483 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2484 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2485 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2486 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2488 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2489 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2490 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2491 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2492 #define IMAGE_SYM_CLASS_FILE 0x0067
2493 #define IMAGE_SYM_CLASS_SECTION 0x0068
2494 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2496 #define N_BTMASK 0x000F
2497 #define N_TMASK 0x0030
2498 #define N_TMASK1 0x00C0
2499 #define N_TMASK2 0x00F0
2500 #define N_BTSHFT 4
2501 #define N_TSHIFT 2
2503 #define BTYPE(x) ((x) & N_BTMASK)
2505 #ifndef ISPTR
2506 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2507 #endif
2509 #ifndef ISFCN
2510 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2511 #endif
2513 #ifndef ISARY
2514 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2515 #endif
2517 #ifndef ISTAG
2518 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2519 #endif
2521 #ifndef INCREF
2522 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2523 #endif
2524 #ifndef DECREF
2525 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2526 #endif
2528 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2529 #define IMAGE_COMDAT_SELECT_ANY 2
2530 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2531 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2532 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2533 #define IMAGE_COMDAT_SELECT_LARGEST 6
2534 #define IMAGE_COMDAT_SELECT_NEWEST 7
2536 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2537 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2538 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2540 /* Export module directory */
2542 typedef struct _IMAGE_EXPORT_DIRECTORY {
2543 DWORD Characteristics;
2544 DWORD TimeDateStamp;
2545 WORD MajorVersion;
2546 WORD MinorVersion;
2547 DWORD Name;
2548 DWORD Base;
2549 DWORD NumberOfFunctions;
2550 DWORD NumberOfNames;
2551 DWORD AddressOfFunctions;
2552 DWORD AddressOfNames;
2553 DWORD AddressOfNameOrdinals;
2554 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2556 /* Import name entry */
2557 typedef struct _IMAGE_IMPORT_BY_NAME {
2558 WORD Hint;
2559 BYTE Name[1];
2560 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2562 /* Import thunk */
2563 typedef struct _IMAGE_THUNK_DATA64 {
2564 union {
2565 ULONGLONG ForwarderString;
2566 ULONGLONG Function;
2567 ULONGLONG Ordinal;
2568 ULONGLONG AddressOfData;
2569 } u1;
2570 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
2572 typedef struct _IMAGE_THUNK_DATA32 {
2573 union {
2574 DWORD ForwarderString;
2575 DWORD Function;
2576 DWORD Ordinal;
2577 DWORD AddressOfData;
2578 } u1;
2579 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
2581 /* Import module directory */
2583 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2584 union {
2585 DWORD Characteristics; /* 0 for terminating null import descriptor */
2586 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
2587 } DUMMYUNIONNAME;
2588 DWORD TimeDateStamp; /* 0 if not bound,
2589 * -1 if bound, and real date\time stamp
2590 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2591 * (new BIND)
2592 * otherwise date/time stamp of DLL bound to
2593 * (Old BIND)
2595 DWORD ForwarderChain; /* -1 if no forwarders */
2596 DWORD Name;
2597 /* RVA to IAT (if bound this IAT has actual addresses) */
2598 DWORD FirstThunk;
2599 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2601 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
2602 #define IMAGE_ORDINAL_FLAG32 0x80000000
2603 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
2604 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
2605 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
2606 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
2608 #ifdef _WIN64
2609 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
2610 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
2611 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
2612 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
2613 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
2614 #else
2615 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
2616 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
2617 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
2618 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
2619 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
2620 #endif
2622 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2624 DWORD TimeDateStamp;
2625 WORD OffsetModuleName;
2626 WORD NumberOfModuleForwarderRefs;
2627 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2628 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2630 typedef struct _IMAGE_BOUND_FORWARDER_REF
2632 DWORD TimeDateStamp;
2633 WORD OffsetModuleName;
2634 WORD Reserved;
2635 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2637 typedef struct _IMAGE_BASE_RELOCATION
2639 DWORD VirtualAddress;
2640 DWORD SizeOfBlock;
2641 /* WORD TypeOffset[1]; */
2642 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2644 #include <pshpack2.h>
2646 typedef struct _IMAGE_RELOCATION
2648 union {
2649 DWORD VirtualAddress;
2650 DWORD RelocCount;
2651 } DUMMYUNIONNAME;
2652 DWORD SymbolTableIndex;
2653 WORD Type;
2654 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2656 #include <poppack.h>
2658 #define IMAGE_SIZEOF_RELOCATION 10
2660 /* generic relocation types */
2661 #define IMAGE_REL_BASED_ABSOLUTE 0
2662 #define IMAGE_REL_BASED_HIGH 1
2663 #define IMAGE_REL_BASED_LOW 2
2664 #define IMAGE_REL_BASED_HIGHLOW 3
2665 #define IMAGE_REL_BASED_HIGHADJ 4
2666 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2667 #define IMAGE_REL_BASED_SECTION 6
2668 #define IMAGE_REL_BASED_REL 7
2669 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2670 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2671 #define IMAGE_REL_BASED_DIR64 10
2672 #define IMAGE_REL_BASED_HIGH3ADJ 11
2674 /* I386 relocation types */
2675 #define IMAGE_REL_I386_ABSOLUTE 0
2676 #define IMAGE_REL_I386_DIR16 1
2677 #define IMAGE_REL_I386_REL16 2
2678 #define IMAGE_REL_I386_DIR32 6
2679 #define IMAGE_REL_I386_DIR32NB 7
2680 #define IMAGE_REL_I386_SEG12 9
2681 #define IMAGE_REL_I386_SECTION 10
2682 #define IMAGE_REL_I386_SECREL 11
2683 #define IMAGE_REL_I386_REL32 20
2685 /* MIPS relocation types */
2686 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2687 #define IMAGE_REL_MIPS_REFHALF 0x0001
2688 #define IMAGE_REL_MIPS_REFWORD 0x0002
2689 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2690 #define IMAGE_REL_MIPS_REFHI 0x0004
2691 #define IMAGE_REL_MIPS_REFLO 0x0005
2692 #define IMAGE_REL_MIPS_GPREL 0x0006
2693 #define IMAGE_REL_MIPS_LITERAL 0x0007
2694 #define IMAGE_REL_MIPS_SECTION 0x000A
2695 #define IMAGE_REL_MIPS_SECREL 0x000B
2696 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2697 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2698 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2699 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2700 #define IMAGE_REL_MIPS_PAIR 0x0025
2702 /* ALPHA relocation types */
2703 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2704 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2705 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2706 #define IMAGE_REL_ALPHA_GPREL 0x0003
2707 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2708 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2709 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2710 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2711 #define IMAGE_REL_ALPHA_HINT 0x0008
2712 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2713 #define IMAGE_REL_ALPHA_REFHI 0x000A
2714 #define IMAGE_REL_ALPHA_REFLO 0x000B
2715 #define IMAGE_REL_ALPHA_PAIR 0x000C
2716 #define IMAGE_REL_ALPHA_MATCH 0x000D
2717 #define IMAGE_REL_ALPHA_SECTION 0x000E
2718 #define IMAGE_REL_ALPHA_SECREL 0x000F
2719 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2720 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2721 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2722 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2723 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2724 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2725 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2726 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2728 /* PowerPC relocation types */
2729 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2730 #define IMAGE_REL_PPC_ADDR64 0x0001
2731 #define IMAGE_REL_PPC_ADDR 0x0002
2732 #define IMAGE_REL_PPC_ADDR24 0x0003
2733 #define IMAGE_REL_PPC_ADDR16 0x0004
2734 #define IMAGE_REL_PPC_ADDR14 0x0005
2735 #define IMAGE_REL_PPC_REL24 0x0006
2736 #define IMAGE_REL_PPC_REL14 0x0007
2737 #define IMAGE_REL_PPC_TOCREL16 0x0008
2738 #define IMAGE_REL_PPC_TOCREL14 0x0009
2739 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2740 #define IMAGE_REL_PPC_SECREL 0x000B
2741 #define IMAGE_REL_PPC_SECTION 0x000C
2742 #define IMAGE_REL_PPC_IFGLUE 0x000D
2743 #define IMAGE_REL_PPC_IMGLUE 0x000E
2744 #define IMAGE_REL_PPC_SECREL16 0x000F
2745 #define IMAGE_REL_PPC_REFHI 0x0010
2746 #define IMAGE_REL_PPC_REFLO 0x0011
2747 #define IMAGE_REL_PPC_PAIR 0x0012
2748 #define IMAGE_REL_PPC_SECRELLO 0x0013
2749 #define IMAGE_REL_PPC_SECRELHI 0x0014
2750 #define IMAGE_REL_PPC_GPREL 0x0015
2751 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2752 /* modifier bits */
2753 #define IMAGE_REL_PPC_NEG 0x0100
2754 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2755 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2756 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2758 /* SH3 ? relocation type */
2759 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2760 #define IMAGE_REL_SH3_DIRECT16 0x0001
2761 #define IMAGE_REL_SH3_DIRECT 0x0002
2762 #define IMAGE_REL_SH3_DIRECT8 0x0003
2763 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2764 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2765 #define IMAGE_REL_SH3_DIRECT4 0x0006
2766 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2767 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2768 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2769 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2770 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2771 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2772 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2773 #define IMAGE_REL_SH3_SECTION 0x000E
2774 #define IMAGE_REL_SH3_SECREL 0x000F
2775 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2777 /* ARM (Archimedes?) relocation types */
2778 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2779 #define IMAGE_REL_ARM_ADDR 0x0001
2780 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2781 #define IMAGE_REL_ARM_BRANCH24 0x0003
2782 #define IMAGE_REL_ARM_BRANCH11 0x0004
2783 #define IMAGE_REL_ARM_SECTION 0x000E
2784 #define IMAGE_REL_ARM_SECREL 0x000F
2786 /* IA64 relocation types */
2787 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2788 #define IMAGE_REL_IA64_IMM14 0x0001
2789 #define IMAGE_REL_IA64_IMM22 0x0002
2790 #define IMAGE_REL_IA64_IMM64 0x0003
2791 #define IMAGE_REL_IA64_DIR 0x0004
2792 #define IMAGE_REL_IA64_DIR64 0x0005
2793 #define IMAGE_REL_IA64_PCREL21B 0x0006
2794 #define IMAGE_REL_IA64_PCREL21M 0x0007
2795 #define IMAGE_REL_IA64_PCREL21F 0x0008
2796 #define IMAGE_REL_IA64_GPREL22 0x0009
2797 #define IMAGE_REL_IA64_LTOFF22 0x000A
2798 #define IMAGE_REL_IA64_SECTION 0x000B
2799 #define IMAGE_REL_IA64_SECREL22 0x000C
2800 #define IMAGE_REL_IA64_SECREL64I 0x000D
2801 #define IMAGE_REL_IA64_SECREL 0x000E
2802 #define IMAGE_REL_IA64_LTOFF64 0x000F
2803 #define IMAGE_REL_IA64_DIR32NB 0x0010
2804 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2805 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2806 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2807 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2808 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2809 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2810 #define IMAGE_REL_IA64_ADDEND 0x001F
2812 /* archive format */
2814 #define IMAGE_ARCHIVE_START_SIZE 8
2815 #define IMAGE_ARCHIVE_START "!<arch>\n"
2816 #define IMAGE_ARCHIVE_END "`\n"
2817 #define IMAGE_ARCHIVE_PAD "\n"
2818 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2819 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2821 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2823 BYTE Name[16];
2824 BYTE Date[12];
2825 BYTE UserID[6];
2826 BYTE GroupID[6];
2827 BYTE Mode[8];
2828 BYTE Size[10];
2829 BYTE EndHeader[2];
2830 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2832 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2835 * Resource directory stuff
2837 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2838 DWORD Characteristics;
2839 DWORD TimeDateStamp;
2840 WORD MajorVersion;
2841 WORD MinorVersion;
2842 WORD NumberOfNamedEntries;
2843 WORD NumberOfIdEntries;
2844 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2845 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2847 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2848 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2850 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2851 union {
2852 struct {
2853 #ifdef BITFIELDS_BIGENDIAN
2854 unsigned NameIsString:1;
2855 unsigned NameOffset:31;
2856 #else
2857 unsigned NameOffset:31;
2858 unsigned NameIsString:1;
2859 #endif
2860 } DUMMYSTRUCTNAME1;
2861 DWORD Name;
2862 struct {
2863 #ifdef WORDS_BIGENDIAN
2864 WORD __pad;
2865 WORD Id;
2866 #else
2867 WORD Id;
2868 WORD __pad;
2869 #endif
2870 } DUMMYSTRUCTNAME2;
2871 } DUMMYUNIONNAME1;
2872 union {
2873 DWORD OffsetToData;
2874 struct {
2875 #ifdef BITFIELDS_BIGENDIAN
2876 unsigned DataIsDirectory:1;
2877 unsigned OffsetToDirectory:31;
2878 #else
2879 unsigned OffsetToDirectory:31;
2880 unsigned DataIsDirectory:1;
2881 #endif
2882 } DUMMYSTRUCTNAME3;
2883 } DUMMYUNIONNAME2;
2884 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2887 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2888 WORD Length;
2889 CHAR NameString[ 1 ];
2890 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2892 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2893 WORD Length;
2894 WCHAR NameString[ 1 ];
2895 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2897 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2898 DWORD OffsetToData;
2899 DWORD Size;
2900 DWORD CodePage;
2901 DWORD Reserved;
2902 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2905 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
2906 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
2909 typedef struct _IMAGE_TLS_DIRECTORY64 {
2910 ULONGLONG StartAddressOfRawData;
2911 ULONGLONG EndAddressOfRawData;
2912 ULONGLONG AddressOfIndex;
2913 ULONGLONG AddressOfCallBacks;
2914 DWORD SizeOfZeroFill;
2915 DWORD Characteristics;
2916 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
2918 typedef struct _IMAGE_TLS_DIRECTORY32 {
2919 DWORD StartAddressOfRawData;
2920 DWORD EndAddressOfRawData;
2921 DWORD AddressOfIndex;
2922 DWORD AddressOfCallBacks;
2923 DWORD SizeOfZeroFill;
2924 DWORD Characteristics;
2925 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
2927 #ifdef _WIN64
2928 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
2929 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
2930 #else
2931 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
2932 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
2933 #endif
2935 typedef struct _IMAGE_DEBUG_DIRECTORY {
2936 DWORD Characteristics;
2937 DWORD TimeDateStamp;
2938 WORD MajorVersion;
2939 WORD MinorVersion;
2940 DWORD Type;
2941 DWORD SizeOfData;
2942 DWORD AddressOfRawData;
2943 DWORD PointerToRawData;
2944 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
2946 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2947 #define IMAGE_DEBUG_TYPE_COFF 1
2948 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2949 #define IMAGE_DEBUG_TYPE_FPO 3
2950 #define IMAGE_DEBUG_TYPE_MISC 4
2951 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2952 #define IMAGE_DEBUG_TYPE_FIXUP 6
2953 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2954 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2955 #define IMAGE_DEBUG_TYPE_BORLAND 9
2956 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2958 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2959 DWORD NumberOfSymbols;
2960 DWORD LvaToFirstSymbol;
2961 DWORD NumberOfLinenumbers;
2962 DWORD LvaToFirstLinenumber;
2963 DWORD RvaToFirstByteOfCode;
2964 DWORD RvaToLastByteOfCode;
2965 DWORD RvaToFirstByteOfData;
2966 DWORD RvaToLastByteOfData;
2967 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
2969 #define FRAME_FPO 0
2970 #define FRAME_TRAP 1
2971 #define FRAME_TSS 2
2972 #define FRAME_NONFPO 3
2974 typedef struct _FPO_DATA {
2975 DWORD ulOffStart;
2976 DWORD cbProcSize;
2977 DWORD cdwLocals;
2978 WORD cdwParams;
2979 WORD cbProlog : 8;
2980 WORD cbRegs : 3;
2981 WORD fHasSEH : 1;
2982 WORD fUseBP : 1;
2983 WORD reserved : 1;
2984 WORD cbFrame : 2;
2985 } FPO_DATA, *PFPO_DATA;
2987 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2988 DWORD Size;
2989 DWORD TimeDateStamp;
2990 WORD MajorVersion;
2991 WORD MinorVersion;
2992 DWORD GlobalFlagsClear;
2993 DWORD GlobalFlagsSet;
2994 DWORD CriticalSectionDefaultTimeout;
2995 DWORD DeCommitFreeBlockThreshold;
2996 DWORD DeCommitTotalFreeThreshold;
2997 PVOID LockPrefixTable;
2998 DWORD MaximumAllocationSize;
2999 DWORD VirtualMemoryThreshold;
3000 DWORD ProcessHeapFlags;
3001 DWORD ProcessAffinityMask;
3002 WORD CSDVersion;
3003 WORD Reserved1;
3004 PVOID EditList;
3005 DWORD SecurityCookie;
3006 DWORD SEHandlerTable;
3007 DWORD SEHandlerCount;
3008 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3010 typedef struct _IMAGE_FUNCTION_ENTRY {
3011 DWORD StartingAddress;
3012 DWORD EndingAddress;
3013 DWORD EndOfPrologue;
3014 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3016 #define IMAGE_DEBUG_MISC_EXENAME 1
3018 typedef struct _IMAGE_DEBUG_MISC {
3019 DWORD DataType;
3020 DWORD Length;
3021 BYTE Unicode;
3022 BYTE Reserved[ 3 ];
3023 BYTE Data[ 1 ];
3024 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3026 /* This is the structure that appears at the very start of a .DBG file. */
3028 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3029 WORD Signature;
3030 WORD Flags;
3031 WORD Machine;
3032 WORD Characteristics;
3033 DWORD TimeDateStamp;
3034 DWORD CheckSum;
3035 DWORD ImageBase;
3036 DWORD SizeOfImage;
3037 DWORD NumberOfSections;
3038 DWORD ExportedNamesSize;
3039 DWORD DebugDirectorySize;
3040 DWORD SectionAlignment;
3041 DWORD Reserved[ 2 ];
3042 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3044 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3047 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3048 WORD Length;
3049 WORD Flags;
3050 BYTE Text[1];
3051 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3052 #define MESSAGE_RESOURCE_UNICODE 0x0001
3054 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3055 DWORD LowId;
3056 DWORD HighId;
3057 DWORD OffsetToEntries;
3058 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3060 typedef struct tagMESSAGE_RESOURCE_DATA {
3061 DWORD NumberOfBlocks;
3062 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3063 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3066 * Here follows typedefs for security and tokens.
3070 * First a constant for the following typedefs.
3073 #define ANYSIZE_ARRAY 1
3075 /* FIXME: Orphan. What does it point to? */
3076 typedef PVOID PACCESS_TOKEN;
3077 typedef PVOID PSECURITY_DESCRIPTOR;
3078 typedef PVOID PSID;
3081 * TOKEN_INFORMATION_CLASS
3084 typedef enum _TOKEN_INFORMATION_CLASS {
3085 TokenUser = 1,
3086 TokenGroups,
3087 TokenPrivileges,
3088 TokenOwner,
3089 TokenPrimaryGroup,
3090 TokenDefaultDacl,
3091 TokenSource,
3092 TokenType,
3093 TokenImpersonationLevel,
3094 TokenStatistics,
3095 TokenRestrictedSids,
3096 TokenSessionId,
3097 TokenGroupsAndPrivileges,
3098 TokenSessionReference,
3099 TokenSandBoxInert
3100 } TOKEN_INFORMATION_CLASS;
3102 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3103 #define TOKEN_ADJUST_GROUPS 0x0040
3104 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3105 #define TOKEN_ADJUST_SESSIONID 0x0100
3106 #define TOKEN_ASSIGN_PRIMARY 0x0001
3107 #define TOKEN_DUPLICATE 0x0002
3108 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3109 #define TOKEN_IMPERSONATE 0x0004
3110 #define TOKEN_QUERY 0x0008
3111 #define TOKEN_QUERY_SOURCE 0x0010
3112 #define TOKEN_ADJUST_DEFAULT 0x0080
3113 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3114 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3115 TOKEN_ADJUST_PRIVILEGES | \
3116 TOKEN_ADJUST_GROUPS | \
3117 TOKEN_ADJUST_DEFAULT )
3118 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3119 TOKEN_ASSIGN_PRIMARY | \
3120 TOKEN_DUPLICATE | \
3121 TOKEN_IMPERSONATE | \
3122 TOKEN_QUERY | \
3123 TOKEN_QUERY_SOURCE | \
3124 TOKEN_ADJUST_PRIVILEGES | \
3125 TOKEN_ADJUST_GROUPS | \
3126 TOKEN_ADJUST_SESSIONID | \
3127 TOKEN_ADJUST_DEFAULT )
3129 #ifndef _SECURITY_DEFINED
3130 #define _SECURITY_DEFINED
3133 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3135 typedef struct _GENERIC_MAPPING {
3136 ACCESS_MASK GenericRead;
3137 ACCESS_MASK GenericWrite;
3138 ACCESS_MASK GenericExecute;
3139 ACCESS_MASK GenericAll;
3140 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3142 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3143 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3144 typedef struct {
3145 BYTE Value[6];
3146 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
3147 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3149 #ifndef SID_DEFINED
3150 #define SID_DEFINED
3151 typedef struct _SID {
3152 BYTE Revision;
3153 BYTE SubAuthorityCount;
3154 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3155 DWORD SubAuthority[1];
3156 } SID,*PISID;
3157 #endif /* !defined(SID_DEFINED) */
3159 #define SID_REVISION (1) /* Current revision */
3160 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3161 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3165 * ACL
3168 #define ACL_REVISION1 1
3169 #define ACL_REVISION2 2
3170 #define ACL_REVISION3 3
3171 #define ACL_REVISION4 4
3173 #define MIN_ACL_REVISION ACL_REVISION2
3174 #define MAX_ACL_REVISION ACL_REVISION4
3176 typedef struct _ACL {
3177 BYTE AclRevision;
3178 BYTE Sbz1;
3179 WORD AclSize;
3180 WORD AceCount;
3181 WORD Sbz2;
3182 } ACL, *PACL;
3184 typedef enum _ACL_INFORMATION_CLASS
3186 AclRevisionInformation = 1,
3187 AclSizeInformation
3188 } ACL_INFORMATION_CLASS;
3190 typedef struct _ACL_REVISION_INFORMATION
3192 DWORD AclRevision;
3193 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
3195 typedef struct _ACL_SIZE_INFORMATION
3197 DWORD AceCount;
3198 DWORD AclBytesInUse;
3199 DWORD AclBytesFree;
3200 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
3202 /* SECURITY_DESCRIPTOR */
3203 #define SECURITY_DESCRIPTOR_REVISION 1
3204 #define SECURITY_DESCRIPTOR_REVISION1 1
3208 * Privilege Names
3210 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3211 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3212 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3213 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3214 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3215 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3216 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3217 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3218 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3219 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3220 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3221 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3222 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3223 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3224 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3225 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3226 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3227 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3228 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3229 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3230 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3231 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3232 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3233 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3234 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3235 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3236 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3237 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3238 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3240 #define SE_GROUP_MANDATORY 0x00000001
3241 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3242 #define SE_GROUP_ENABLED 0x00000004
3243 #define SE_GROUP_OWNER 0x00000008
3244 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3245 #define SE_GROUP_LOGON_ID 0xC0000000
3246 #define SE_GROUP_RESOURCE 0x20000000
3248 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3249 #define SE_PRIVILEGE_ENABLED 0x00000002
3250 #define SE_PRIVILEGE_REMOVE 0x00000004
3251 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3253 #define PRIVILEGE_SET_ALL_NECESSARY 1
3255 #define SE_OWNER_DEFAULTED 0x00000001
3256 #define SE_GROUP_DEFAULTED 0x00000002
3257 #define SE_DACL_PRESENT 0x00000004
3258 #define SE_DACL_DEFAULTED 0x00000008
3259 #define SE_SACL_PRESENT 0x00000010
3260 #define SE_SACL_DEFAULTED 0x00000020
3261 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3262 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3263 #define SE_DACL_AUTO_INHERITED 0x00000400
3264 #define SE_SACL_AUTO_INHERITED 0x00000800
3265 #define SE_DACL_PROTECTED 0x00001000
3266 #define SE_SACL_PROTECTED 0x00002000
3267 #define SE_SELF_RELATIVE 0x00008000
3269 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
3270 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
3272 /* The security descriptor structure */
3273 typedef struct {
3274 BYTE Revision;
3275 BYTE Sbz1;
3276 SECURITY_DESCRIPTOR_CONTROL Control;
3277 DWORD Owner;
3278 DWORD Group;
3279 DWORD Sacl;
3280 DWORD Dacl;
3281 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3283 typedef struct {
3284 BYTE Revision;
3285 BYTE Sbz1;
3286 SECURITY_DESCRIPTOR_CONTROL Control;
3287 PSID Owner;
3288 PSID Group;
3289 PACL Sacl;
3290 PACL Dacl;
3291 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3293 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3295 #endif /* _SECURITY_DEFINED */
3298 * SID_AND_ATTRIBUTES
3301 typedef struct _SID_AND_ATTRIBUTES {
3302 PSID Sid;
3303 DWORD Attributes;
3304 } SID_AND_ATTRIBUTES;
3306 /* security entities */
3307 #define SECURITY_NULL_RID (0x00000000L)
3308 #define SECURITY_WORLD_RID (0x00000000L)
3309 #define SECURITY_LOCAL_RID (0X00000000L)
3311 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3313 /* S-1-1 */
3314 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3316 /* S-1-2 */
3317 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3319 /* S-1-3 */
3320 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3321 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
3322 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
3323 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
3324 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
3326 /* S-1-4 */
3327 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3329 /* S-1-5 */
3330 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3331 #define SECURITY_DIALUP_RID 0x00000001L
3332 #define SECURITY_NETWORK_RID 0x00000002L
3333 #define SECURITY_BATCH_RID 0x00000003L
3334 #define SECURITY_INTERACTIVE_RID 0x00000004L
3335 #define SECURITY_LOGON_IDS_RID 0x00000005L
3336 #define SECURITY_SERVICE_RID 0x00000006L
3337 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
3338 #define SECURITY_PROXY_RID 0x00000008L
3339 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
3340 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
3341 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
3342 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
3343 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
3344 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
3345 #define SECURITY_NT_NON_UNIQUE 0x00000015L
3346 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
3348 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
3349 #define DOMAIN_GROUP_RID_USERS 0x00000201L
3350 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
3352 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
3353 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
3354 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
3356 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3358 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
3361 * TOKEN_USER
3364 typedef struct _TOKEN_USER {
3365 SID_AND_ATTRIBUTES User;
3366 } TOKEN_USER, *PTOKEN_USER;
3369 * TOKEN_GROUPS
3372 typedef struct _TOKEN_GROUPS {
3373 DWORD GroupCount;
3374 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3375 } TOKEN_GROUPS, *PTOKEN_GROUPS;
3378 * LUID_AND_ATTRIBUTES
3381 typedef union _LARGE_INTEGER {
3382 struct {
3383 #ifdef WORDS_BIGENDIAN
3384 LONG HighPart;
3385 DWORD LowPart;
3386 #else
3387 DWORD LowPart;
3388 LONG HighPart;
3389 #endif
3390 } u;
3391 #ifndef NONAMELESSSTRUCT
3392 struct {
3393 #ifdef WORDS_BIGENDIAN
3394 LONG HighPart;
3395 DWORD LowPart;
3396 #else
3397 DWORD LowPart;
3398 LONG HighPart;
3399 #endif
3401 #endif
3402 LONGLONG QuadPart;
3403 } LARGE_INTEGER, *PLARGE_INTEGER;
3405 typedef union _ULARGE_INTEGER {
3406 struct {
3407 #ifdef WORDS_BIGENDIAN
3408 DWORD HighPart;
3409 DWORD LowPart;
3410 #else
3411 DWORD LowPart;
3412 DWORD HighPart;
3413 #endif
3414 } u;
3415 #ifndef NONAMELESSSTRUCT
3416 struct {
3417 #ifdef WORDS_BIGENDIAN
3418 DWORD HighPart;
3419 DWORD LowPart;
3420 #else
3421 DWORD LowPart;
3422 DWORD HighPart;
3423 #endif
3425 #endif
3426 ULONGLONG QuadPart;
3427 } ULARGE_INTEGER, *PULARGE_INTEGER;
3430 * Locally Unique Identifier
3433 typedef struct _LUID {
3434 DWORD LowPart;
3435 LONG HighPart;
3436 } LUID, *PLUID;
3438 #include <pshpack4.h>
3439 typedef struct _LUID_AND_ATTRIBUTES {
3440 LUID Luid;
3441 DWORD Attributes;
3442 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3443 #include <poppack.h>
3446 * PRIVILEGE_SET
3449 typedef struct _PRIVILEGE_SET {
3450 DWORD PrivilegeCount;
3451 DWORD Control;
3452 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3453 } PRIVILEGE_SET, *PPRIVILEGE_SET;
3456 * TOKEN_PRIVILEGES
3459 typedef struct _TOKEN_PRIVILEGES {
3460 DWORD PrivilegeCount;
3461 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3462 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
3465 * TOKEN_OWNER
3468 typedef struct _TOKEN_OWNER {
3469 PSID Owner;
3470 } TOKEN_OWNER, *PTOKEN_OWNER;
3473 * TOKEN_PRIMARY_GROUP
3476 typedef struct _TOKEN_PRIMARY_GROUP {
3477 PSID PrimaryGroup;
3478 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
3482 * TOKEN_DEFAULT_DACL
3485 typedef struct _TOKEN_DEFAULT_DACL {
3486 PACL DefaultDacl;
3487 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
3490 * TOKEN_SOURCEL
3493 #define TOKEN_SOURCE_LENGTH 8
3495 typedef struct _TOKEN_SOURCE {
3496 char SourceName[TOKEN_SOURCE_LENGTH];
3497 LUID SourceIdentifier;
3498 } TOKEN_SOURCE, *PTOKEN_SOURCE;
3501 * TOKEN_TYPE
3504 typedef enum tagTOKEN_TYPE {
3505 TokenPrimary = 1,
3506 TokenImpersonation
3507 } TOKEN_TYPE;
3510 * SECURITY_IMPERSONATION_LEVEL
3513 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3514 SecurityAnonymous,
3515 SecurityIdentification,
3516 SecurityImpersonation,
3517 SecurityDelegation
3518 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
3520 #define SECURITY_DYNAMIC_TRACKING (TRUE)
3521 #define SECURITY_STATIC_TRACKING (FALSE)
3523 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
3524 * PSECURITY_CONTEXT_TRACKING_MODE;
3526 * Quality of Service
3529 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3530 DWORD Length;
3531 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3532 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3533 BOOLEAN EffectiveOnly;
3534 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
3537 * TOKEN_STATISTICS
3540 #include <pshpack4.h>
3541 typedef struct _TOKEN_STATISTICS {
3542 LUID TokenId;
3543 LUID AuthenticationId;
3544 LARGE_INTEGER ExpirationTime;
3545 TOKEN_TYPE TokenType;
3546 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3547 DWORD DynamicCharged;
3548 DWORD DynamicAvailable;
3549 DWORD GroupCount;
3550 DWORD PrivilegeCount;
3551 LUID ModifiedId;
3552 } TOKEN_STATISTICS;
3553 #include <poppack.h>
3556 * ACLs of NT
3559 #define ACL_REVISION 2
3561 #define ACL_REVISION1 1
3562 #define ACL_REVISION2 2
3564 /* ACEs, directly starting after an ACL */
3565 typedef struct _ACE_HEADER {
3566 BYTE AceType;
3567 BYTE AceFlags;
3568 WORD AceSize;
3569 } ACE_HEADER,*PACE_HEADER;
3571 /* AceType */
3572 #define ACCESS_ALLOWED_ACE_TYPE 0
3573 #define ACCESS_DENIED_ACE_TYPE 1
3574 #define SYSTEM_AUDIT_ACE_TYPE 2
3575 #define SYSTEM_ALARM_ACE_TYPE 3
3577 /* inherit AceFlags */
3578 #define OBJECT_INHERIT_ACE 0x01
3579 #define CONTAINER_INHERIT_ACE 0x02
3580 #define NO_PROPAGATE_INHERIT_ACE 0x04
3581 #define INHERIT_ONLY_ACE 0x08
3582 #define INHERITED_ACE 0x10
3583 #define VALID_INHERIT_FLAGS 0x0F
3585 /* AceFlags mask for what events we (should) audit */
3586 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3587 #define FAILED_ACCESS_ACE_FLAG 0x80
3589 /* different ACEs depending on AceType
3590 * SidStart marks the begin of a SID
3591 * so the thing finally looks like this:
3592 * 0: ACE_HEADER
3593 * 4: ACCESS_MASK
3594 * 8... : SID
3596 typedef struct _ACCESS_ALLOWED_ACE {
3597 ACE_HEADER Header;
3598 DWORD Mask;
3599 DWORD SidStart;
3600 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
3602 typedef struct _ACCESS_DENIED_ACE {
3603 ACE_HEADER Header;
3604 DWORD Mask;
3605 DWORD SidStart;
3606 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
3608 typedef struct _SYSTEM_AUDIT_ACE {
3609 ACE_HEADER Header;
3610 DWORD Mask;
3611 DWORD SidStart;
3612 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
3614 typedef struct _SYSTEM_ALARM_ACE {
3615 ACE_HEADER Header;
3616 DWORD Mask;
3617 DWORD SidStart;
3618 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
3620 typedef enum tagSID_NAME_USE {
3621 SidTypeUser = 1,
3622 SidTypeGroup,
3623 SidTypeDomain,
3624 SidTypeAlias,
3625 SidTypeWellKnownGroup,
3626 SidTypeDeletedAccount,
3627 SidTypeInvalid,
3628 SidTypeUnknown
3629 } SID_NAME_USE,*PSID_NAME_USE;
3631 #define ACE_OBJECT_TYPE_PRESENT 0x1
3632 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
3634 /* Access rights */
3636 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3637 #undef DELETE
3638 #define DELETE 0x00010000
3639 #define READ_CONTROL 0x00020000
3640 #define WRITE_DAC 0x00040000
3641 #define WRITE_OWNER 0x00080000
3642 #define SYNCHRONIZE 0x00100000
3643 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3645 #define STANDARD_RIGHTS_READ READ_CONTROL
3646 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3647 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3649 #define STANDARD_RIGHTS_ALL 0x001f0000
3651 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3653 #define GENERIC_READ 0x80000000
3654 #define GENERIC_WRITE 0x40000000
3655 #define GENERIC_EXECUTE 0x20000000
3656 #define GENERIC_ALL 0x10000000
3658 #define MAXIMUM_ALLOWED 0x02000000
3659 #define ACCESS_SYSTEM_SECURITY 0x01000000
3661 #define EVENT_QUERY_STATE 0x0001
3662 #define EVENT_MODIFY_STATE 0x0002
3663 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3665 #define SEMAPHORE_MODIFY_STATE 0x0002
3666 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3668 #define MUTEX_MODIFY_STATE 0x0001
3669 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3671 #define TIMER_QUERY_STATE 0x0001
3672 #define TIMER_MODIFY_STATE 0x0002
3673 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3675 #define PROCESS_TERMINATE 0x0001
3676 #define PROCESS_CREATE_THREAD 0x0002
3677 #define PROCESS_VM_OPERATION 0x0008
3678 #define PROCESS_VM_READ 0x0010
3679 #define PROCESS_VM_WRITE 0x0020
3680 #define PROCESS_DUP_HANDLE 0x0040
3681 #define PROCESS_CREATE_PROCESS 0x0080
3682 #define PROCESS_SET_QUOTA 0x0100
3683 #define PROCESS_SET_INFORMATION 0x0200
3684 #define PROCESS_QUERY_INFORMATION 0x0400
3685 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3687 #define THREAD_TERMINATE 0x0001
3688 #define THREAD_SUSPEND_RESUME 0x0002
3689 #define THREAD_GET_CONTEXT 0x0008
3690 #define THREAD_SET_CONTEXT 0x0010
3691 #define THREAD_SET_INFORMATION 0x0020
3692 #define THREAD_QUERY_INFORMATION 0x0040
3693 #define THREAD_SET_THREAD_TOKEN 0x0080
3694 #define THREAD_IMPERSONATE 0x0100
3695 #define THREAD_DIRECT_IMPERSONATION 0x0200
3696 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3698 #define THREAD_BASE_PRIORITY_LOWRT 15
3699 #define THREAD_BASE_PRIORITY_MAX 2
3700 #define THREAD_BASE_PRIORITY_MIN -2
3701 #define THREAD_BASE_PRIORITY_IDLE -15
3703 #define SECTION_QUERY 0x0001
3704 #define SECTION_MAP_WRITE 0x0002
3705 #define SECTION_MAP_READ 0x0004
3706 #define SECTION_MAP_EXECUTE 0x0008
3707 #define SECTION_EXTEND_SIZE 0x0010
3708 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
3709 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3711 #define FILE_READ_DATA 0x0001 /* file & pipe */
3712 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3713 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3714 #define FILE_ADD_FILE 0x0002 /* directory */
3715 #define FILE_APPEND_DATA 0x0004 /* file */
3716 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3717 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3718 #define FILE_READ_EA 0x0008 /* file & directory */
3719 #define FILE_READ_PROPERTIES FILE_READ_EA
3720 #define FILE_WRITE_EA 0x0010 /* file & directory */
3721 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3722 #define FILE_EXECUTE 0x0020 /* file */
3723 #define FILE_TRAVERSE 0x0020 /* directory */
3724 #define FILE_DELETE_CHILD 0x0040 /* directory */
3725 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3726 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3727 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3729 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3730 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3731 SYNCHRONIZE)
3732 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3733 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3734 FILE_APPEND_DATA | SYNCHRONIZE)
3735 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3736 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3738 #define DUPLICATE_CLOSE_SOURCE 0x00000001
3739 #define DUPLICATE_SAME_ACCESS 0x00000002
3741 /* File attribute flags */
3742 #define FILE_SHARE_READ 0x00000001L
3743 #define FILE_SHARE_WRITE 0x00000002L
3744 #define FILE_SHARE_DELETE 0x00000004L
3746 #define FILE_ATTRIBUTE_READONLY 0x00000001
3747 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3748 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3749 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3750 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3751 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3752 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3753 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3754 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3755 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3756 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3757 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3758 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3760 /* File notification flags */
3761 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3762 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3763 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3764 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3765 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3766 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3767 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3768 #define FILE_NOTIFY_CHANGE_EA 0x00000080
3769 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3770 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
3771 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
3772 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
3774 #define FILE_ACTION_ADDED 0x00000001
3775 #define FILE_ACTION_REMOVED 0x00000002
3776 #define FILE_ACTION_MODIFIED 0x00000003
3777 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3778 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3779 #define FILE_ACTION_ADDED_STREAM 0x00000006
3780 #define FILE_ACTION_REMOVED_STREAM 0x00000007
3781 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
3783 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3784 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3785 #define FILE_UNICODE_ON_DISK 0x00000004
3786 #define FILE_PERSISTENT_ACLS 0x00000008
3787 #define FILE_FILE_COMPRESSION 0x00000010
3788 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3789 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
3790 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
3791 #define FILE_NAMED_STREAMS 0x00040000
3792 #define FILE_READ_ONLY_VOLUME 0x00080000
3794 /* File alignments (NT) */
3795 #define FILE_BYTE_ALIGNMENT 0x00000000
3796 #define FILE_WORD_ALIGNMENT 0x00000001
3797 #define FILE_LONG_ALIGNMENT 0x00000003
3798 #define FILE_QUAD_ALIGNMENT 0x00000007
3799 #define FILE_OCTA_ALIGNMENT 0x0000000f
3800 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3801 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3802 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3803 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3804 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3806 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
3807 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
3809 #define REG_NONE 0 /* no type */
3810 #define REG_SZ 1 /* string type (ASCII) */
3811 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3812 #define REG_BINARY 3 /* binary format, callerspecific */
3813 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3814 #define REG_DWORD 4 /* DWORD in little endian format */
3815 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3816 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3817 #define REG_LINK 6 /* symbolic link (UNICODE) */
3818 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3819 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3820 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3821 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3822 #define REG_QWORD 11 /* QWORD in little endian format */
3823 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
3825 /* ----------------------------- begin power management --------------------- */
3827 typedef enum _LATENCY_TIME {
3828 LT_DONT_CARE,
3829 LT_LOWEST_LATENCY
3830 } LATENCY_TIME, *PLATENCY_TIME;
3832 #define DISCHARGE_POLICY_CRITICAL 0
3833 #define DISCHARGE_POLICY_LOW 1
3834 #define NUM_DISCHARGE_POLICIES 4
3836 #define PO_THROTTLE_NONE 0
3837 #define PO_THROTTLE_CONSTANT 1
3838 #define PO_THROTTLE_DEGRADE 2
3839 #define PO_THROTTLE_ADAPTIVE 3
3841 typedef enum _POWER_ACTION {
3842 PowerActionNone = 0,
3843 PowerActionReserved,
3844 PowerActionSleep,
3845 PowerActionHibernate,
3846 PowerActionShutdown,
3847 PowerActionShutdownReset,
3848 PowerActionShutdownOff,
3849 PowerActionWarmEject
3850 } POWER_ACTION,
3851 *PPOWER_ACTION;
3853 typedef enum _SYSTEM_POWER_STATE {
3854 PowerSystemUnspecified = 0,
3855 PowerSystemWorking = 1,
3856 PowerSystemSleeping1 = 2,
3857 PowerSystemSleeping2 = 3,
3858 PowerSystemSleeping3 = 4,
3859 PowerSystemHibernate = 5,
3860 PowerSystemShutdown = 6,
3861 PowerSystemMaximum = 7
3862 } SYSTEM_POWER_STATE,
3863 *PSYSTEM_POWER_STATE;
3865 typedef enum _DEVICE_POWER_STATE {
3866 PowerDeviceUnspecified,
3867 PowerDeviceD0,
3868 PowerDeviceD1,
3869 PowerDeviceD2,
3870 PowerDeviceD3,
3871 PowerDeviceMaximum
3872 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3874 typedef enum _POWER_INFORMATION_LEVEL {
3875 SystemPowerPolicyAc,
3876 SystemPowerPolicyDc,
3877 VerifySystemPolicyAc,
3878 VerifySystemPolicyDc,
3879 SystemPowerCapabilities,
3880 SystemBatteryState,
3881 SystemPowerStateHandler,
3882 ProcessorStateHandler,
3883 SystemPowerPolicyCurrent,
3884 AdministratorPowerPolicy,
3885 SystemReserveHiberFile,
3886 ProcessorInformation,
3887 SystemPowerInformation,
3888 ProcessorStateHandler2,
3889 LastWakeTime,
3890 LastSleepTime,
3891 SystemExecutionState,
3892 SystemPowerStateNotifyHandler,
3893 ProcessorPowerPolicyAc,
3894 ProcessorPowerPolicyDc,
3895 VerifyProcessorPowerPolicyAc,
3896 VerifyProcessorPowerPolicyDc,
3897 ProcessorPowerPolicyCurrent
3898 } POWER_INFORMATION_LEVEL;
3900 typedef struct _ADMINISTRATOR_POWER_POLICY {
3901 SYSTEM_POWER_STATE MinSleep;
3902 SYSTEM_POWER_STATE MaxSleep;
3903 ULONG MinVideoTimeout;
3904 ULONG MaxVideoTimeout;
3905 ULONG MinSpindownTimeout;
3906 ULONG MaxSpindownTimeout;
3907 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
3909 typedef struct {
3910 ULONG Granularity;
3911 ULONG Capacity;
3912 } BATTERY_REPORTING_SCALE,
3913 *PBATTERY_REPORTING_SCALE;
3915 typedef struct {
3916 POWER_ACTION Action;
3917 ULONG Flags;
3918 ULONG EventCode;
3919 } POWER_ACTION_POLICY,
3920 *PPOWER_ACTION_POLICY;
3922 typedef struct _PROCESSOR_POWER_INFORMATION {
3923 ULONG Number;
3924 ULONG MaxMhz;
3925 ULONG CurrentMhz;
3926 ULONG MhzLimit;
3927 ULONG MaxIdleState;
3928 ULONG CurrentIdleState;
3929 } PROCESSOR_POWER_INFORMATION,
3930 *PPROCESSOR_POWER_INFORMATION;
3932 typedef struct _PROCESSOR_POWER_POLICY_INFO {
3933 ULONG TimeCheck;
3934 ULONG DemoteLimit;
3935 ULONG PromoteLimit;
3936 UCHAR DemotePercent;
3937 UCHAR PromotePercent;
3938 UCHAR Spare[2];
3939 ULONG AllowDemotion:1;
3940 ULONG AllowPromotion:1;
3941 ULONG Reserved:30;
3942 } PROCESSOR_POWER_POLICY_INFO,
3943 *PPROCESSOR_POWER_POLICY_INFO;
3945 typedef struct _PROCESSOR_POWER_POLICY {
3946 DWORD Revision;
3947 BYTE DynamicThrottle;
3948 BYTE Spare[3];
3949 DWORD DisableCStates:1;
3950 DWORD Reserved:31;
3951 DWORD PolicyCount;
3952 PROCESSOR_POWER_POLICY_INFO Policy[3];
3953 } PROCESSOR_POWER_POLICY,
3954 *PPROCESSOR_POWER_POLICY;
3956 typedef struct {
3957 BOOLEAN AcOnLine;
3958 BOOLEAN BatteryPresent;
3959 BOOLEAN Charging;
3960 BOOLEAN Discharging;
3961 BOOLEAN Spare1[4];
3962 ULONG MaxCapacity;
3963 ULONG RemainingCapacity;
3964 ULONG Rate;
3965 ULONG EstimatedTime;
3966 ULONG DefaultAlert1;
3967 ULONG DefaultAlert2;
3968 } SYSTEM_BATTERY_STATE,
3969 *PSYSTEM_BATTERY_STATE;
3971 typedef struct {
3972 BOOLEAN PowerButtonPresent;
3973 BOOLEAN SleepButtonPresent;
3974 BOOLEAN LidPresent;
3975 BOOLEAN SystemS1;
3976 BOOLEAN SystemS2;
3977 BOOLEAN SystemS3;
3978 BOOLEAN SystemS4;
3979 BOOLEAN SystemS5;
3980 BOOLEAN HiberFilePresent;
3981 BOOLEAN FullWake;
3982 BOOLEAN VideoDimPresent;
3983 BOOLEAN ApmPresent;
3984 BOOLEAN UpsPresent;
3985 BOOLEAN ThermalControl;
3986 BOOLEAN ProcessorThrottle;
3987 UCHAR ProcessorMinThrottle;
3988 UCHAR ProcessorMaxThrottle;
3989 UCHAR spare2[4];
3990 BOOLEAN DiskSpinDown;
3991 UCHAR spare3[8];
3992 BOOLEAN SystemBatteriesPresent;
3993 BOOLEAN BatteriesAreShortTerm;
3994 BATTERY_REPORTING_SCALE BatteryScale[3];
3995 SYSTEM_POWER_STATE AcOnLineWake;
3996 SYSTEM_POWER_STATE SoftLidWake;
3997 SYSTEM_POWER_STATE RtcWake;
3998 SYSTEM_POWER_STATE MinDeviceWakeState;
3999 SYSTEM_POWER_STATE DefaultLowLatencyWake;
4000 } SYSTEM_POWER_CAPABILITIES,
4001 *PSYSTEM_POWER_CAPABILITIES;
4003 typedef struct _SYSTEM_POWER_INFORMATION {
4004 ULONG MaxIdlenessAllowed;
4005 ULONG Idleness;
4006 ULONG TimeRemaining;
4007 UCHAR CoolingMode;
4008 } SYSTEM_POWER_INFORMATION,
4009 *PSYSTEM_POWER_INFORMATION;
4011 typedef struct _SYSTEM_POWER_LEVEL {
4012 BOOLEAN Enable;
4013 UCHAR Spare[3];
4014 ULONG BatteryLevel;
4015 POWER_ACTION_POLICY PowerPolicy;
4016 SYSTEM_POWER_STATE MinSystemState;
4017 } SYSTEM_POWER_LEVEL,
4018 *PSYSTEM_POWER_LEVEL;
4020 typedef struct _SYSTEM_POWER_POLICY {
4021 ULONG Revision;
4022 POWER_ACTION_POLICY PowerButton;
4023 POWER_ACTION_POLICY SleepButton;
4024 POWER_ACTION_POLICY LidClose;
4025 SYSTEM_POWER_STATE LidOpenWake;
4026 ULONG Reserved;
4027 POWER_ACTION_POLICY Idle;
4028 ULONG IdleTimeout;
4029 UCHAR IdleSensitivity;
4030 UCHAR DynamicThrottle;
4031 UCHAR Spare2[2];
4032 SYSTEM_POWER_STATE MinSleep;
4033 SYSTEM_POWER_STATE MaxSleep;
4034 SYSTEM_POWER_STATE ReducedLatencySleep;
4035 ULONG WinLogonFlags;
4036 ULONG Spare3;
4037 ULONG DozeS4Timeout;
4038 ULONG BroadcastCapacityResolution;
4039 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
4040 ULONG VideoTimeout;
4041 BOOLEAN VideoDimDisplay;
4042 ULONG VideoReserved[3];
4043 ULONG SpindownTimeout;
4044 BOOLEAN OptimizeForPower;
4045 UCHAR FanThrottleTolerance;
4046 UCHAR ForcedThrottle;
4047 UCHAR MinThrottle;
4048 POWER_ACTION_POLICY OverThrottled;
4049 } SYSTEM_POWER_POLICY,
4050 *PSYSTEM_POWER_POLICY;
4052 typedef union _FILE_SEGMENT_ELEMENT {
4053 PVOID64 Buffer;
4054 ULONGLONG Alignment;
4055 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
4057 typedef struct _FILE_NOTIFY_INFORMATION {
4058 DWORD NextEntryOffset;
4059 DWORD Action;
4060 DWORD FileNameLength;
4061 WCHAR FileName[1];
4062 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
4064 /* ----------------------------- begin tape storage --------------------- */
4066 #define TAPE_FIXED_PARTITIONS 0
4067 #define TAPE_SELECT_PARTITIONS 1
4068 #define TAPE_INITIATOR_PARTITIONS 2
4069 #define TAPE_ERASE_SHORT 0
4070 #define TAPE_ERASE_LONG 1
4071 #define TAPE_LOAD 0
4072 #define TAPE_UNLOAD 1
4073 #define TAPE_TENSION 2
4074 #define TAPE_LOCK 3
4075 #define TAPE_UNLOCK 4
4076 #define TAPE_FORMAT 5
4077 #define TAPE_SETMARKS 0
4078 #define TAPE_FILEMARKS 1
4079 #define TAPE_SHORT_FILEMARKS 2
4080 #define TAPE_LONG_FILEMARKS 3
4081 #define TAPE_REWIND 0
4082 #define TAPE_ABSOLUTE_BLOCK 1
4083 #define TAPE_LOGICAL_BLOCK 2
4084 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4085 #define TAPE_SPACE_END_OF_DATA 4
4086 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4087 #define TAPE_SPACE_FILEMARKS 6
4088 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4089 #define TAPE_SPACE_SETMARKS 8
4090 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4092 typedef struct _TAPE_CREATE_PARTITION {
4093 DWORD Method;
4094 DWORD Count;
4095 DWORD Size;
4096 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
4098 typedef struct _TAPE_ERASE {
4099 DWORD Type;
4100 BOOLEAN Immediate;
4101 } TAPE_ERASE, *PTAPE_ERASE;
4103 typedef struct _TAPE_PREPARE {
4104 DWORD Operation;
4105 BOOLEAN Immediate;
4106 } TAPE_PREPARE, *PTAPE_PREPARE;
4108 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
4109 BOOLEAN ECC;
4110 BOOLEAN Compression;
4111 BOOLEAN DataPadding;
4112 BOOLEAN ReportSetmarks;
4113 ULONG EOTWarningZoneSize;
4114 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
4116 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
4117 ULONG BlockSize;
4118 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
4120 typedef struct _TAPE_WRITE_MARKS {
4121 DWORD Type;
4122 DWORD Count;
4123 BOOLEAN Immediate;
4124 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
4126 typedef struct _TAPE_GET_POSITION {
4127 ULONG Type;
4128 ULONG Partition;
4129 ULONG OffsetLow;
4130 ULONG OffsetHigh;
4131 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
4133 typedef struct _TAPE_SET_POSITION {
4134 ULONG Method;
4135 ULONG Partition;
4136 LARGE_INTEGER Offset;
4137 BOOLEAN Immediate;
4138 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
4140 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
4141 BOOLEAN ECC;
4142 BOOLEAN Compression;
4143 BOOLEAN DataPadding;
4144 BOOLEAN ReportSetmarks;
4145 DWORD DefaultBlockSize;
4146 DWORD MaximumBlockSize;
4147 DWORD MinimumBlockSize;
4148 DWORD MaximumPartitionCount;
4149 DWORD FeaturesLow;
4150 DWORD FeaturesHigh;
4151 DWORD EOTWarningZoneSize;
4152 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
4154 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
4155 LARGE_INTEGER Capacity;
4156 LARGE_INTEGER Remaining;
4157 DWORD BlockSize;
4158 DWORD PartitionCount;
4159 BOOLEAN WriteProtected;
4160 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
4162 /* ----------------------------- begin registry ----------------------------- */
4164 /* Registry security values */
4165 #define OWNER_SECURITY_INFORMATION 0x00000001
4166 #define GROUP_SECURITY_INFORMATION 0x00000002
4167 #define DACL_SECURITY_INFORMATION 0x00000004
4168 #define SACL_SECURITY_INFORMATION 0x00000008
4170 #define REG_OPTION_RESERVED 0x00000000
4171 #define REG_OPTION_NON_VOLATILE 0x00000000
4172 #define REG_OPTION_VOLATILE 0x00000001
4173 #define REG_OPTION_CREATE_LINK 0x00000002
4174 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4175 #define REG_OPTION_OPEN_LINK 0x00000008
4176 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4177 REG_OPTION_NON_VOLATILE| \
4178 REG_OPTION_VOLATILE| \
4179 REG_OPTION_CREATE_LINK| \
4180 REG_OPTION_BACKUP_RESTORE| \
4181 REG_OPTION_OPEN_LINK)
4184 #define REG_CREATED_NEW_KEY 0x00000001
4185 #define REG_OPENED_EXISTING_KEY 0x00000002
4187 /* For RegNotifyChangeKeyValue */
4188 #define REG_NOTIFY_CHANGE_NAME 0x01
4189 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4190 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4191 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4193 #define KEY_QUERY_VALUE 0x00000001
4194 #define KEY_SET_VALUE 0x00000002
4195 #define KEY_CREATE_SUB_KEY 0x00000004
4196 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4197 #define KEY_NOTIFY 0x00000010
4198 #define KEY_CREATE_LINK 0x00000020
4200 /* for RegKeyRestore flags */
4201 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4202 #define REG_REFRESH_HIVE 0x00000002
4203 #define REG_NO_LAZY_FLUSH 0x00000004
4204 #define REG_FORCE_RESTORE 0x00000008
4206 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4207 KEY_QUERY_VALUE| \
4208 KEY_ENUMERATE_SUB_KEYS| \
4209 KEY_NOTIFY) \
4210 & (~SYNCHRONIZE) \
4212 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4213 KEY_SET_VALUE| \
4214 KEY_CREATE_SUB_KEY) \
4215 & (~SYNCHRONIZE) \
4217 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4218 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4219 KEY_QUERY_VALUE| \
4220 KEY_SET_VALUE| \
4221 KEY_CREATE_SUB_KEY| \
4222 KEY_ENUMERATE_SUB_KEYS| \
4223 KEY_NOTIFY| \
4224 KEY_CREATE_LINK) \
4225 & (~SYNCHRONIZE) \
4227 /* ------------------------------ end registry ------------------------------ */
4230 #define EVENTLOG_SUCCESS 0x0000
4231 #define EVENTLOG_ERROR_TYPE 0x0001
4232 #define EVENTLOG_WARNING_TYPE 0x0002
4233 #define EVENTLOG_INFORMATION_TYPE 0x0004
4234 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4235 #define EVENTLOG_AUDIT_FAILURE 0x0010
4237 #define SERVICE_BOOT_START 0x00000000
4238 #define SERVICE_SYSTEM_START 0x00000001
4239 #define SERVICE_AUTO_START 0x00000002
4240 #define SERVICE_DEMAND_START 0x00000003
4241 #define SERVICE_DISABLED 0x00000004
4243 #define SERVICE_ERROR_IGNORE 0x00000000
4244 #define SERVICE_ERROR_NORMAL 0x00000001
4245 #define SERVICE_ERROR_SEVERE 0x00000002
4246 #define SERVICE_ERROR_CRITICAL 0x00000003
4248 /* Service types */
4249 #define SERVICE_KERNEL_DRIVER 0x00000001
4250 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4251 #define SERVICE_ADAPTER 0x00000004
4252 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4254 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4255 SERVICE_RECOGNIZER_DRIVER )
4257 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4258 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4259 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4261 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4263 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4264 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4267 typedef enum _CM_SERVICE_NODE_TYPE
4269 DriverType = SERVICE_KERNEL_DRIVER,
4270 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
4271 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
4272 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
4273 AdapterType = SERVICE_ADAPTER,
4274 RecognizerType = SERVICE_RECOGNIZER_DRIVER
4275 } SERVICE_NODE_TYPE;
4277 typedef enum _CM_SERVICE_LOAD_TYPE
4279 BootLoad = SERVICE_BOOT_START,
4280 SystemLoad = SERVICE_SYSTEM_START,
4281 AutoLoad = SERVICE_AUTO_START,
4282 DemandLoad = SERVICE_DEMAND_START,
4283 DisableLoad = SERVICE_DISABLED
4284 } SERVICE_LOAD_TYPE;
4286 typedef enum _CM_ERROR_CONTROL_TYPE
4288 IgnoreError = SERVICE_ERROR_IGNORE,
4289 NormalError = SERVICE_ERROR_NORMAL,
4290 SevereError = SERVICE_ERROR_SEVERE,
4291 CriticalError = SERVICE_ERROR_CRITICAL
4292 } SERVICE_ERROR_TYPE;
4296 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4297 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4298 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4299 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4300 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4302 #include <guiddef.h>
4304 typedef struct _OBJECT_TYPE_LIST {
4305 WORD Level;
4306 WORD Sbz;
4307 GUID *ObjectType;
4308 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
4310 typedef struct _RTL_CRITICAL_SECTION_DEBUG
4312 WORD Type;
4313 WORD CreatorBackTraceIndex;
4314 struct _RTL_CRITICAL_SECTION *CriticalSection;
4315 LIST_ENTRY ProcessLocksList;
4316 DWORD EntryCount;
4317 DWORD ContentionCount;
4318 #ifdef __WINESRC__ /* in Wine we store the name here */
4319 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
4320 #else
4321 DWORD Spare[ 2 ];
4322 #endif
4323 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
4325 typedef struct _RTL_CRITICAL_SECTION {
4326 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
4327 LONG LockCount;
4328 LONG RecursionCount;
4329 HANDLE OwningThread;
4330 HANDLE LockSemaphore;
4331 ULONG_PTR SpinCount;
4332 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
4334 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
4336 #include <pshpack8.h>
4337 typedef struct _IO_COUNTERS {
4338 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
4339 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
4340 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
4341 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
4342 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
4343 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
4344 } IO_COUNTERS, *PIO_COUNTERS;
4345 #include <poppack.h>
4347 typedef struct {
4348 DWORD dwOSVersionInfoSize;
4349 DWORD dwMajorVersion;
4350 DWORD dwMinorVersion;
4351 DWORD dwBuildNumber;
4352 DWORD dwPlatformId;
4353 CHAR szCSDVersion[128];
4354 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
4356 typedef struct {
4357 DWORD dwOSVersionInfoSize;
4358 DWORD dwMajorVersion;
4359 DWORD dwMinorVersion;
4360 DWORD dwBuildNumber;
4361 DWORD dwPlatformId;
4362 WCHAR szCSDVersion[128];
4363 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
4365 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
4366 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
4367 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
4369 typedef struct {
4370 DWORD dwOSVersionInfoSize;
4371 DWORD dwMajorVersion;
4372 DWORD dwMinorVersion;
4373 DWORD dwBuildNumber;
4374 DWORD dwPlatformId;
4375 CHAR szCSDVersion[128];
4376 WORD wServicePackMajor;
4377 WORD wServicePackMinor;
4378 WORD wSuiteMask;
4379 BYTE wProductType;
4380 BYTE wReserved;
4381 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
4383 typedef struct {
4384 DWORD dwOSVersionInfoSize;
4385 DWORD dwMajorVersion;
4386 DWORD dwMinorVersion;
4387 DWORD dwBuildNumber;
4388 DWORD dwPlatformId;
4389 WCHAR szCSDVersion[128];
4390 WORD wServicePackMajor;
4391 WORD wServicePackMinor;
4392 WORD wSuiteMask;
4393 BYTE wProductType;
4394 BYTE wReserved;
4395 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
4397 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
4398 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
4399 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
4401 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
4403 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
4405 #define VER_PLATFORM_WIN32s 0
4406 #define VER_PLATFORM_WIN32_WINDOWS 1
4407 #define VER_PLATFORM_WIN32_NT 2
4409 #define VER_MINORVERSION 0x00000001
4410 #define VER_MAJORVERSION 0x00000002
4411 #define VER_BUILDNUMBER 0x00000004
4412 #define VER_PLATFORMID 0x00000008
4413 #define VER_SERVICEPACKMINOR 0x00000010
4414 #define VER_SERVICEPACKMAJOR 0x00000020
4415 #define VER_SUITENAME 0x00000040
4416 #define VER_PRODUCT_TYPE 0x00000080
4418 #define VER_NT_WORKSTATION 1
4419 #define VER_NT_DOMAIN_CONTROLLER 2
4420 #define VER_NT_SERVER 3
4422 #define VER_SUITE_SMALLBUSINESS 0x00000001
4423 #define VER_SUITE_ENTERPRISE 0x00000002
4424 #define VER_SUITE_BACKOFFICE 0x00000004
4425 #define VER_SUITE_COMMUNICATIONS 0x00000008
4426 #define VER_SUITE_TERMINAL 0x00000010
4427 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
4428 #define VER_SUITE_EMBEDDEDNT 0x00000040
4429 #define VER_SUITE_DATACENTER 0x00000080
4430 #define VER_SUITE_SINGLEUSERTS 0x00000100
4431 #define VER_SUITE_PERSONAL 0x00000200
4432 #define VER_SUITE_BLADE 0x00000400
4434 #define VER_EQUAL 1
4435 #define VER_GREATER 2
4436 #define VER_GREATER_EQUAL 3
4437 #define VER_LESS 4
4438 #define VER_LESS_EQUAL 5
4439 #define VER_AND 6
4440 #define VER_OR 7
4442 #endif /* _WINNT_ */