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