libemf  1.0.9
winnt.h
1 /*
2  * Win32 definitions for Windows NT
3  *
4  * Copyright 1996 Alexandre Julliard
5  */
6 
7 #ifndef __WINE_WINNT_H
8 #define __WINE_WINNT_H
9 
10 #include "basetsd.h"
11 
12 #ifndef RC_INVOKED
13 #include <ctype.h>
14 #include <stddef.h>
15 #include <string.h>
16 #endif
17 
18 
19 /* On Windows winnt.h depends on a few windef.h types and macros and thus
20  * is not self-contained. Furthermore windef.h includes winnt.h so that it
21  * would be pointless to try to use winnt.h directly.
22  * But for Wine and Winelib I decided to make winnt.h self-contained by
23  * moving these definitions to winnt.h. It makes no difference to Winelib
24  * programs since they are not using winnt.h directly anyway, and it allows
25  * us to use winnt.h and get a minimal set of definitions.
26  */
27 
28 /**** Some Wine specific definitions *****/
29 
30 /* Architecture dependent settings. */
31 /* These are hardcoded to avoid dependencies on config.h in Winelib apps. */
32 #if defined(__i386__)
33 # undef WORDS_BIGENDIAN
34 # undef BITFIELDS_BIGENDIAN
35 # define ALLOW_UNALIGNED_ACCESS
36 #elif defined(__x86_64__)
37 # undef WORDS_BIGENDIAN
38 # undef BITFIELDS_BIGENDIAN
39 # define ALLOW_UNALIGNED_ACCESS
40 #elif defined(__alpha__)
41 # undef WORDS_BIGENDIAN
42 # undef BITFIELDS_BIGENDIAN
43 # undef ALLOW_UNALIGNED_ACCESS
44 #elif defined(__arm__)
45 # undef WORDS_BIGENDIAN
46 # undef BITFIELDS_BIGENDIAN
47 # undef ALLOW_UNALIGNED_ACCESS
48 #elif defined(__aarch64__)
49 # undef WORDS_BIGENDIAN
50 # undef BITFIELDS_BIGENDIAN
51 # undef ALLOW_UNALIGNED_ACCESS
52 #elif defined(__sparc__)
53 # define WORDS_BIGENDIAN
54 # define BITFIELDS_BIGENDIAN
55 # undef ALLOW_UNALIGNED_ACCESS
56 #elif defined(__PPC__)
57 # define WORDS_BIGENDIAN
58 # define BITFIELDS_BIGENDIAN
59 # undef ALLOW_UNALIGNED_ACCESS
60 #elif defined(__s390__)
61 # define WORDS_BIGENDIAN
62 # define BITFIELDS_BIGENDIAN
63 # undef ALLOW_UNALIGNED_ACCESS
64 #elif !defined(RC_INVOKED)
65 # error Unknown CPU architecture!
66 #endif
67 
68 
69 #ifndef DECLSPEC_ALIGN
70 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
71 # define DECLSPEC_ALIGN(x) __declspec(align(x))
72 # elif defined(__GNUC__)
73 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
74 # else
75 # define DECLSPEC_ALIGN(x)
76 # endif
77 #endif
78 
79 
80 /* Calling conventions definitions */
81 
82 #ifdef __i386__
83 # ifndef _X86_
84 # define _X86_
85 # endif
86 # if defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)))
87 # define __stdcall __attribute__((__stdcall__))
88 # define __cdecl __attribute__((__cdecl__))
89 # else
90 # error You need gcc >= 2.7 to build Wine on a 386
91 # endif /* __GNUC__ */
92 #else /* __i386__ */
93 # define __stdcall
94 # define __cdecl
95 #endif /* __i386__ */
96 
97 #ifndef __WINE__
98 #define pascal __stdcall
99 #define _pascal __stdcall
100 #ifndef _stdcall
101 #define _stdcall __stdcall
102 #endif
103 #ifndef _fastcall
104 #define _fastcall __stdcall
105 #endif
106 #ifndef __fastcall
107 #define __fastcall __stdcall
108 #endif
109 #define __export __stdcall
110 #define cdecl __cdecl
111 #ifndef _cdecl
112 #define _cdecl __cdecl
113 #endif
114 
115 #define near
116 #define far
117 #define _near
118 #define _far
119 #define NEAR
120 #define FAR
121 
122 #ifndef _declspec
123 #define _declspec(x)
124 #endif
125 #ifndef __declspec
126 #define __declspec(x)
127 #endif
128 #endif /* __WINE__ */
129 
130 #define CALLBACK __stdcall
131 #define WINAPI __stdcall
132 #define APIPRIVATE __stdcall
133 #define PASCAL __stdcall
134 #define CDECL __cdecl
135 #define _CDECL __cdecl
136 #define WINAPIV __cdecl
137 #define APIENTRY WINAPI
138 #define CONST const
139 
140 /* Macro for structure packing and more. */
141 
142 #ifdef __GNUC__
143 #define WINE_PACKED __attribute__((packed))
144 #define WINE_UNUSED __attribute__((unused))
145 #define WINE_NORETURN __attribute__((noreturn))
146 #else
147 #define WINE_PACKED /* nothing */
148 #define WINE_UNUSED /* nothing */
149 #define WINE_NORETURN /* nothing */
150 #endif
151 
152 /* Anonymous union/struct handling */
153 
154 #ifdef __WINE__
155 # define NONAMELESSSTRUCT
156 # define NONAMELESSUNION
157 #else
158 #if !defined(__cplusplus)
159 /* for c we can keep the anonymous version (to avoid compiler warnings) */
160 #define NONAMELESSSTRUCT
161 #define NONAMELESSUNION
162 #else
163 /* Anonymous struct support starts with gcc/g++ 2.96 */
164 # if !defined(NONAMELESSSTRUCT) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96)))
165 /* && !defined(__cplusplus) */
166 # define NONAMELESSSTRUCT
167 # endif
168 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
169 # if !defined(NONAMELESSUNION) && defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus)))))
170 # define NONAMELESSUNION
171 # endif
172 #endif
173 #endif
174 
175 #ifndef NONAMELESSSTRUCT
176 #define DUMMYSTRUCTNAME
177 #define DUMMYSTRUCTNAME1
178 #define DUMMYSTRUCTNAME2
179 #define DUMMYSTRUCTNAME3
180 #define DUMMYSTRUCTNAME4
181 #define DUMMYSTRUCTNAME5
182 #else /* !defined(NONAMELESSSTRUCT) */
183 #define DUMMYSTRUCTNAME s
184 #define DUMMYSTRUCTNAME1 s1
185 #define DUMMYSTRUCTNAME2 s2
186 #define DUMMYSTRUCTNAME3 s3
187 #define DUMMYSTRUCTNAME4 s4
188 #define DUMMYSTRUCTNAME5 s5
189 #endif /* !defined(NONAMELESSSTRUCT) */
190 
191 #ifndef NONAMELESSUNION
192 #define DUMMYUNIONNAME
193 #define DUMMYUNIONNAME1
194 #define DUMMYUNIONNAME2
195 #define DUMMYUNIONNAME3
196 #define DUMMYUNIONNAME4
197 #define DUMMYUNIONNAME5
198 #define DUMMYUNIONNAME6
199 #define DUMMYUNIONNAME7
200 #define DUMMYUNIONNAME8
201 #else /* !defined(NONAMELESSUNION) */
202 #define DUMMYUNIONNAME u
203 #define DUMMYUNIONNAME1 u1
204 #define DUMMYUNIONNAME2 u2
205 #define DUMMYUNIONNAME3 u3
206 #define DUMMYUNIONNAME4 u4
207 #define DUMMYUNIONNAME5 u5
208 #define DUMMYUNIONNAME6 u6
209 #define DUMMYUNIONNAME7 u7
210 #define DUMMYUNIONNAME8 u8
211 #endif /* !defined(NONAMELESSUNION) */
212 
213 
214 /**** Parts of windef.h that are needed here *****/
215 
216 /* Misc. constants. */
217 
218 #undef NULL
219 #ifdef __cplusplus
220 #define NULL 0
221 #else
222 #define NULL ((void*)0)
223 #endif
224 
225 #ifdef FALSE
226 #undef FALSE
227 #endif
228 #define FALSE 0
229 
230 #ifdef TRUE
231 #undef TRUE
232 #endif
233 #define TRUE 1
234 
235 #ifndef IN
236 #define IN
237 #endif
238 
239 #ifndef OUT
240 #define OUT
241 #endif
242 
243 #ifndef OPTIONAL
244 #define OPTIONAL
245 #endif
246 
247 /* Standard data types */
248 typedef const void *PCVOID, *LPCVOID;
249 typedef int BOOL, *PBOOL, *LPBOOL;
250 typedef unsigned char BYTE, *PBYTE, *LPBYTE;
251 typedef unsigned char UCHAR, *PUCHAR;
252 typedef unsigned short USHORT, *PUSHORT, *LPUSHORT;
253 typedef unsigned short WORD, *PWORD, *LPWORD;
254 typedef int INT, *PINT, *LPINT;
255 typedef unsigned int UINT, *PUINT, *LPUINT;
256 /* Not sure this is correct. Probably should depend on the compiler, too. */
257 #if defined( __LP64__) || defined(__alpha__)
258 typedef unsigned int DWORD, *PDWORD, *LPDWORD;
259 typedef unsigned int ULONG, *PULONG, *LPULONG;
260 #else
261 typedef unsigned long DWORD, *PDWORD, *LPDWORD;
262 typedef unsigned long ULONG, *PULONG, *LPULONG;
263 #endif
264 typedef float FLOAT, *PFLOAT, *LPFLOAT;
265 typedef double DOUBLE, *PDOUBLE, *LPDOUBLE;
266 typedef double DATE;
267 
268 
269 /**** winnt.h proper *****/
270 
271 /* Microsoft's macros for declaring functions */
272 
273 #ifdef __cplusplus
274 # define EXTERN_C extern "C"
275 #else
276 # define EXTERN_C extern
277 #endif
278 
279 #ifndef __WINE__
280 #define STDMETHODCALLTYPE __stdcall
281 #define STDMETHODVCALLTYPE __cdecl
282 #define STDAPICALLTYPE __stdcall
283 #define STDAPIVCALLTYPE __cdecl
284 
285 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
286 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
287 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
288 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
289 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
290 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
291 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
292 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
293 #endif
294 
295 /* Define the basic types */
296 #ifndef VOID
297 #define VOID void
298 #endif
299 typedef VOID *PVOID, *LPVOID;
300 typedef BYTE BOOLEAN, *PBOOLEAN;
301 typedef char CHAR, *PCHAR;
302 typedef short SHORT, *PSHORT;
303 #if defined(__LP64__) || defined(__alpha__)
304 typedef int LONG, *PLONG, *LPLONG;
305 #else
306 typedef long LONG, *PLONG, *LPLONG;
307 #endif
308 
309 /* Some systems might have wchar_t, but we really need 16 bit characters */
310 #ifndef WINE_WCHAR_DEFINED
311 #ifdef WINE_UNICODE_NATIVE
312 typedef wchar_t WCHAR, *PWCHAR;
313 #else
314 typedef unsigned short WCHAR, *PWCHAR;
315 #endif
316 #define WINE_WCHAR_DEFINED
317 #endif
318 
319 /* 'Extended/Wide' numerical types */
320 #ifndef _ULONGLONG_
321 #define _ULONGLONG_
322 typedef __int64 LONGLONG, *PLONGLONG;
323 typedef __uint64 ULONGLONG, *PULONGLONG;
324 #endif
325 
326 #ifndef _DWORDLONG_
327 #define _DWORDLONG_
328 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
329 #endif
330 
331 /* ANSI string types */
332 typedef CHAR *PCH, *LPCH;
333 typedef const CHAR *PCCH, *LPCCH;
334 typedef CHAR *PSTR, *LPSTR;
335 typedef const CHAR *PCSTR, *LPCSTR;
336 
337 /* Unicode string types */
338 typedef WCHAR *PWCH, *LPWCH;
339 typedef const WCHAR *PCWCH, *LPCWCH;
340 typedef WCHAR *PWSTR, *LPWSTR;
341 typedef const WCHAR *PCWSTR, *LPCWSTR;
342 
343 /* Neutral character and string types */
344 /* These are only defined for Winelib, i.e. _not_ defined for
345  * the emulator. The reason is they depend on the UNICODE
346  * macro which only exists in the user's code.
347  */
348 #ifndef __WINE__
349 # ifdef WINE_UNICODE_REWRITE
350 
351 /* Use this if your compiler does not provide a 16bit wchar_t type.
352  * Note that you will need to specify -fwritable-strings or an option
353  * to this effect.
354  * In C++ both WINE_UNICODE_TEXT('c') and WINE_UNICODE_TEXT("str") are
355  * supported, but only the string form can be supported in C.
356  */
357 EXTERN_C unsigned short* wine_rewrite_s4tos2(const wchar_t* str4);
358 # ifdef __cplusplus
359 inline WCHAR* wine_unicode_text(const wchar_t* str4)
360 {
361  return (WCHAR*)wine_rewrite_s4tos2(str4);
362 }
363 inline WCHAR wine_unicode_text(wchar_t chr4)
364 {
365  return (WCHAR)chr4;
366 }
367 # define WINE_UNICODE_TEXT(x) wine_unicode_text(L##x)
368 # else /* __cplusplus */
369 # define WINE_UNICODE_TEXT(x) ((WCHAR*)wine_rewrite_s4tos2(L##x))
370 # endif /* __cplusplus */
371 
372 # else /* WINE_UNICODE_REWRITE */
373 
374 /* Define WINE_UNICODE_NATIVE if:
375  * - your compiler provides a 16bit wchar_t type, e.g. gcc >= 2.96 with
376  * -fshort-wchar option
377  * - or if you decide to use the native 32bit Unix wchar_t type. Be aware
378  * though that the Wine APIs only support 16bit WCHAR characters for
379  * binary compatibility reasons.
380  * - or define nothing at all if you don't use Unicode, and blissfully
381  * ignore the issue :-)
382  */
383 # define WINE_UNICODE_TEXT(string) L##string
384 
385 # endif /* WINE_UNICODE_REWRITE */
386 
387 # ifdef UNICODE
388 typedef WCHAR TCHAR, *PTCHAR;
389 typedef LPWSTR PTSTR, LPTSTR;
390 typedef LPCWSTR PCTSTR, LPCTSTR;
391 # define __TEXT(string) WINE_UNICODE_TEXT(string)
392 # else /* UNICODE */
393 typedef CHAR TCHAR, *PTCHAR;
394 typedef LPSTR PTSTR, LPTSTR;
395 typedef LPCSTR PCTSTR, LPCTSTR;
396 # define __TEXT(string) string
397 # endif /* UNICODE */
398 # define TEXT(quote) __TEXT(quote)
399 #endif /* __WINE__ */
400 
401 /* Misc common WIN32 types */
402 typedef LONG HRESULT;
403 typedef DWORD LCID, *PLCID;
404 typedef WORD LANGID;
405 typedef DWORD EXECUTION_STATE;
406 
407 /* Handle type */
408 
409 /* FIXME: Wine does not compile with strict on, therefore strict
410  * handles are presently only usable on machines where sizeof(UINT) ==
411  * sizeof(void*). HANDLEs are supposed to be void* but a large amount
412  * of WINE code operates on HANDLES as if they are UINTs. So to WINE
413  * they exist as UINTs but to the Winelib user who turns on strict,
414  * they exist as void*. If there is a size difference between UINT and
415  * void* then things get ugly.
416  *
417  * Here is the plan to convert Wine to STRICT:
418  *
419  * Types will be converted one at a time by volunteers who will compile
420  * Wine with STRICT turned on. Handles that have not been converted yet
421  * will be declared with DECLARE_OLD_HANDLE. Converted handles are
422  * declared with DECLARE_HANDLE.
423  * See the bug report 90 for more details:
424  * http://wine.codeweavers.com/bugzilla/show_bug.cgi?id=90
425  */
426 /*
427  * when compiling Wine we always treat HANDLE as an UINT. Then when
428  * we're ready we'll remove the '!defined(__WINE__)' (the equivalent
429  * of converting it from DECLARE_OLD_HANDLE to DECLARE_HANDLE).
430  */
431 #if defined(STRICT) && !defined(__WINE__)
432 typedef VOID* HANDLE;
433 #define DECLARE_OLD_HANDLE(a) \
434  typedef struct a##__ { int unused; } *a; \
435  typedef a *P##a, *LP##a
436 
437 #else
438 typedef UINT HANDLE;
439 #define DECLARE_OLD_HANDLE(a) \
440  typedef HANDLE a; \
441  typedef a *P##a, *LP##a
442 #endif
443 typedef HANDLE *PHANDLE, *LPHANDLE;
444 
445 #ifdef STRICT
446 #define DECLARE_HANDLE(a) \
447  typedef struct a##__ { int unused; } *a; \
448  typedef a *P##a, *LP##a
449 #else /*STRICT*/
450 #define DECLARE_HANDLE(a) \
451  typedef HANDLE a; \
452  typedef a *P##a, *LP##a
453 #endif /*STRICT*/
454 
455 /* Defines */
456 
457 /* Argument 1 passed to the DllEntryProc. */
458 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
459 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
460 #define DLL_THREAD_ATTACH 2 /* attach new thread */
461 #define DLL_THREAD_DETACH 3 /* detach thread */
462 
463 
464 /* u.x.wProcessorArchitecture (NT) */
465 #define PROCESSOR_ARCHITECTURE_INTEL 0
466 #define PROCESSOR_ARCHITECTURE_MIPS 1
467 #define PROCESSOR_ARCHITECTURE_ALPHA 2
468 #define PROCESSOR_ARCHITECTURE_PPC 3
469 #define PROCESSOR_ARCHITECTURE_SHX 4
470 #define PROCESSOR_ARCHITECTURE_ARM 5
471 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
472 
473 /* dwProcessorType */
474 #define PROCESSOR_INTEL_386 386
475 #define PROCESSOR_INTEL_486 486
476 #define PROCESSOR_INTEL_PENTIUM 586
477 #define PROCESSOR_INTEL_860 860
478 #define PROCESSOR_MIPS_R2000 2000
479 #define PROCESSOR_MIPS_R3000 3000
480 #define PROCESSOR_MIPS_R4000 4000
481 #define PROCESSOR_ALPHA_21064 21064
482 #define PROCESSOR_PPC_601 601
483 #define PROCESSOR_PPC_603 603
484 #define PROCESSOR_PPC_604 604
485 #define PROCESSOR_PPC_620 620
486 #define PROCESSOR_HITACHI_SH3 10003
487 #define PROCESSOR_HITACHI_SH3E 10004
488 #define PROCESSOR_HITACHI_SH4 10005
489 #define PROCESSOR_MOTOROLA_821 821
490 #define PROCESSOR_SHx_SH3 103
491 #define PROCESSOR_SHx_SH4 104
492 #define PROCESSOR_STRONGARM 2577
493 #define PROCESSOR_ARM720 1824 /* 0x720 */
494 #define PROCESSOR_ARM820 2080 /* 0x820 */
495 #define PROCESSOR_ARM920 2336 /* 0x920 */
496 #define PROCESSOR_ARM_7TDMI 70001
497 
498 typedef struct _MEMORY_BASIC_INFORMATION
499 {
500  LPVOID BaseAddress;
501  LPVOID AllocationBase;
502  DWORD AllocationProtect;
503  DWORD RegionSize;
504  DWORD State;
505  DWORD Protect;
506  DWORD Type;
507 } MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
508 
509 #define PAGE_NOACCESS 0x01
510 #define PAGE_READONLY 0x02
511 #define PAGE_READWRITE 0x04
512 #define PAGE_WRITECOPY 0x08
513 #define PAGE_EXECUTE 0x10
514 #define PAGE_EXECUTE_READ 0x20
515 #define PAGE_EXECUTE_READWRITE 0x40
516 #define PAGE_EXECUTE_WRITECOPY 0x80
517 #define PAGE_GUARD 0x100
518 #define PAGE_NOCACHE 0x200
519 
520 #define MEM_COMMIT 0x00001000
521 #define MEM_RESERVE 0x00002000
522 #define MEM_DECOMMIT 0x00004000
523 #define MEM_RELEASE 0x00008000
524 #define MEM_FREE 0x00010000
525 #define MEM_PRIVATE 0x00020000
526 #define MEM_MAPPED 0x00040000
527 #define MEM_RESET 0x00080000
528 #define MEM_TOP_DOWN 0x00100000
529 #ifdef __WINE__
530 #define MEM_SYSTEM 0x80000000
531 #endif
532 
533 #define SEC_FILE 0x00800000
534 #define SEC_IMAGE 0x01000000
535 #define SEC_RESERVE 0x04000000
536 #define SEC_COMMIT 0x08000000
537 #define SEC_NOCACHE 0x10000000
538 #define MEM_IMAGE SEC_IMAGE
539 
540 
541 #define MINCHAR 0x80
542 #define MAXCHAR 0x7f
543 #define MINSHORT 0x8000
544 #define MAXSHORT 0x7fff
545 #define MINLONG 0x80000000
546 #define MAXLONG 0x7fffffff
547 #define MAXBYTE 0xff
548 #define MAXWORD 0xffff
549 #define MAXDWORD 0xffffffff
550 
551 #define FIELD_OFFSET(type, field) \
552  ((LONG)(INT)&(((type *)0)->field))
553 
554 #define CONTAINING_RECORD(address, type, field) \
555  ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
556 
557 /* Types */
558 
559 typedef struct _LIST_ENTRY {
560  struct _LIST_ENTRY *Flink;
561  struct _LIST_ENTRY *Blink;
562 } LIST_ENTRY, *PLIST_ENTRY;
563 
564 typedef struct _SINGLE_LIST_ENTRY {
565  struct _SINGLE_LIST_ENTRY *Next;
566 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
567 
568 /* Heap flags */
569 
570 #define HEAP_NO_SERIALIZE 0x00000001
571 #define HEAP_GROWABLE 0x00000002
572 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
573 #define HEAP_ZERO_MEMORY 0x00000008
574 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
575 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
576 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
577 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
578 #define HEAP_CREATE_ALIGN_16 0x00010000
579 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
580 
581 /* This flag allows it to create heaps shared by all processes under win95,
582  FIXME: correct name */
583 #define HEAP_SHARED 0x04000000
584 
585 /* Processor feature flags. */
586 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
587 #define PF_FLOATING_POINT_EMULATED 1
588 #define PF_COMPARE_EXCHANGE_DOUBLE 2
589 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
590 #define PF_PPC_MOVEMEM_64BIT_OK 4
591 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
592 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
593 #define PF_AMD3D_INSTRUCTIONS_AVAILABLE 7
594 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
595 
596 
597 /* Execution state flags */
598 #define ES_SYSTEM_REQUIRED 0x00000001
599 #define ES_DISPLAY_REQUIRED 0x00000002
600 #define ES_USER_PRESENT 0x00000004
601 #define ES_CONTINUOUS 0x80000000
602 
603 /* The Win32 register context */
604 
605 /* CONTEXT is the CPU-dependent context; it should be used */
606 /* wherever a platform-specific context is needed (e.g. exception */
607 /* handling, Win32 register functions). */
608 
609 /* CONTEXT86 is the i386-specific context; it should be used */
610 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
611 /* Win16 register functions), so that this code can be compiled */
612 /* on all platforms. */
613 
614 #define SIZE_OF_80387_REGISTERS 80
615 
616 typedef struct _FLOATING_SAVE_AREA
617 {
618  DWORD ControlWord;
619  DWORD StatusWord;
620  DWORD TagWord;
621  DWORD ErrorOffset;
622  DWORD ErrorSelector;
623  DWORD DataOffset;
624  DWORD DataSelector;
625  BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
626  DWORD Cr0NpxState;
627 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
628 
629 #define MAXIMUM_SUPPORTED_EXTENSION 512
630 
631 typedef struct _CONTEXT86
632 {
633  DWORD ContextFlags;
634 
635  /* These are selected by CONTEXT_DEBUG_REGISTERS */
636  DWORD Dr0;
637  DWORD Dr1;
638  DWORD Dr2;
639  DWORD Dr3;
640  DWORD Dr6;
641  DWORD Dr7;
642 
643  /* These are selected by CONTEXT_FLOATING_POINT */
644  FLOATING_SAVE_AREA FloatSave;
645 
646  /* These are selected by CONTEXT_SEGMENTS */
647  DWORD SegGs;
648  DWORD SegFs;
649  DWORD SegEs;
650  DWORD SegDs;
651 
652  /* These are selected by CONTEXT_INTEGER */
653  DWORD Edi;
654  DWORD Esi;
655  DWORD Ebx;
656  DWORD Edx;
657  DWORD Ecx;
658  DWORD Eax;
659 
660  /* These are selected by CONTEXT_CONTROL */
661  DWORD Ebp;
662  DWORD Eip;
663  DWORD SegCs;
664  DWORD EFlags;
665  DWORD Esp;
666  DWORD SegSs;
667 
668  BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
669 } CONTEXT86;
670 
671 #define CONTEXT_X86 0x00010000
672 #define CONTEXT_i386 CONTEXT_X86
673 #define CONTEXT_i486 CONTEXT_X86
674 
675 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
676 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
677 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
678 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
679 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
680 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
681 
682 /* i386 context definitions */
683 #ifdef __i386__
684 
685 #define CONTEXT_CONTROL CONTEXT86_CONTROL
686 #define CONTEXT_INTEGER CONTEXT86_INTEGER
687 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
688 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
689 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
690 #define CONTEXT_FULL CONTEXT86_FULL
691 
692 typedef CONTEXT86 CONTEXT;
693 
694 #endif /* __i386__ */
695 
696 /* x86-64 context definitions */
697 #if defined(__x86_64__)
698 
699 #define CONTEXT_AMD64 0x00100000
700 
701 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
702 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
703 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
704 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
705 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
706 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
707 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
708 
709 #define EXCEPTION_READ_FAULT 0
710 #define EXCEPTION_WRITE_FAULT 1
711 #define EXCEPTION_EXECUTE_FAULT 8
712 
713 typedef struct DECLSPEC_ALIGN(16) _M128A {
714  ULONGLONG Low;
715  LONGLONG High;
716 } M128A, *PM128A;
717 
718 typedef struct _XMM_SAVE_AREA32 {
719  WORD ControlWord; /* 000 */
720  WORD StatusWord; /* 002 */
721  BYTE TagWord; /* 004 */
722  BYTE Reserved1; /* 005 */
723  WORD ErrorOpcode; /* 006 */
724  DWORD ErrorOffset; /* 008 */
725  WORD ErrorSelector; /* 00c */
726  WORD Reserved2; /* 00e */
727  DWORD DataOffset; /* 010 */
728  WORD DataSelector; /* 014 */
729  WORD Reserved3; /* 016 */
730  DWORD MxCsr; /* 018 */
731  DWORD MxCsr_Mask; /* 01c */
732  M128A FloatRegisters[8]; /* 020 */
733  M128A XmmRegisters[16]; /* 0a0 */
734  BYTE Reserved4[96]; /* 1a0 */
735 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
736 
737 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
738  DWORD64 P1Home; /* 000 */
739  DWORD64 P2Home; /* 008 */
740  DWORD64 P3Home; /* 010 */
741  DWORD64 P4Home; /* 018 */
742  DWORD64 P5Home; /* 020 */
743  DWORD64 P6Home; /* 028 */
744 
745  /* Control flags */
746  DWORD ContextFlags; /* 030 */
747  DWORD MxCsr; /* 034 */
748 
749  /* Segment */
750  WORD SegCs; /* 038 */
751  WORD SegDs; /* 03a */
752  WORD SegEs; /* 03c */
753  WORD SegFs; /* 03e */
754  WORD SegGs; /* 040 */
755  WORD SegSs; /* 042 */
756  DWORD EFlags; /* 044 */
757 
758  /* Debug */
759  DWORD64 Dr0; /* 048 */
760  DWORD64 Dr1; /* 050 */
761  DWORD64 Dr2; /* 058 */
762  DWORD64 Dr3; /* 060 */
763  DWORD64 Dr6; /* 068 */
764  DWORD64 Dr7; /* 070 */
765 
766  /* Integer */
767  DWORD64 Rax; /* 078 */
768  DWORD64 Rcx; /* 080 */
769  DWORD64 Rdx; /* 088 */
770  DWORD64 Rbx; /* 090 */
771  DWORD64 Rsp; /* 098 */
772  DWORD64 Rbp; /* 0a0 */
773  DWORD64 Rsi; /* 0a8 */
774  DWORD64 Rdi; /* 0b0 */
775  DWORD64 R8; /* 0b8 */
776  DWORD64 R9; /* 0c0 */
777  DWORD64 R10; /* 0c8 */
778  DWORD64 R11; /* 0d0 */
779  DWORD64 R12; /* 0d8 */
780  DWORD64 R13; /* 0e0 */
781  DWORD64 R14; /* 0e8 */
782  DWORD64 R15; /* 0f0 */
783 
784  /* Counter */
785  DWORD64 Rip; /* 0f8 */
786 
787  /* Floating point */
788  union {
789  XMM_SAVE_AREA32 FltSave; /* 100 */
790  struct {
791  M128A Header[2]; /* 100 */
792  M128A Legacy[8]; /* 120 */
793  M128A Xmm0; /* 1a0 */
794  M128A Xmm1; /* 1b0 */
795  M128A Xmm2; /* 1c0 */
796  M128A Xmm3; /* 1d0 */
797  M128A Xmm4; /* 1e0 */
798  M128A Xmm5; /* 1f0 */
799  M128A Xmm6; /* 200 */
800  M128A Xmm7; /* 210 */
801  M128A Xmm8; /* 220 */
802  M128A Xmm9; /* 230 */
803  M128A Xmm10; /* 240 */
804  M128A Xmm11; /* 250 */
805  M128A Xmm12; /* 260 */
806  M128A Xmm13; /* 270 */
807  M128A Xmm14; /* 280 */
808  M128A Xmm15; /* 290 */
809  } DUMMYSTRUCTNAME;
810  } DUMMYUNIONNAME;
811 
812  /* Vector */
813  M128A VectorRegister[26]; /* 300 */
814  DWORD64 VectorControl; /* 4a0 */
815 
816  /* Debug control */
817  DWORD64 DebugControl; /* 4a8 */
818  DWORD64 LastBranchToRip; /* 4b0 */
819  DWORD64 LastBranchFromRip; /* 4b8 */
820  DWORD64 LastExceptionToRip; /* 4c0 */
821  DWORD64 LastExceptionFromRip; /* 4c8 */
822 } CONTEXT;
823 
824 typedef struct _RUNTIME_FUNCTION
825 {
826  DWORD BeginAddress;
827  DWORD EndAddress;
828  DWORD UnwindData;
829 } RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
830 
831 #define UNWIND_HISTORY_TABLE_SIZE 12
832 
833 typedef struct _UNWIND_HISTORY_TABLE_ENTRY
834 {
835  ULONG64 ImageBase;
836  PRUNTIME_FUNCTION FunctionEntry;
837 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
838 
839 #define UNWIND_HISTORY_TABLE_NONE 0
840 #define UNWIND_HISTORY_TABLE_GLOBAL 1
841 #define UNWIND_HISTORY_TABLE_LOCAL 2
842 
843 typedef struct _UNWIND_HISTORY_TABLE
844 {
845  ULONG Count;
846  UCHAR Search;
847  ULONG64 LowAddress;
848  ULONG64 HighAddress;
849  UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
850 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
851 
852 typedef struct _KNONVOLATILE_CONTEXT_POINTERS
853 {
854  union
855  {
856  PM128A FloatingContext[16];
857  struct
858  {
859  PM128A Xmm0;
860  PM128A Xmm1;
861  PM128A Xmm2;
862  PM128A Xmm3;
863  PM128A Xmm4;
864  PM128A Xmm5;
865  PM128A Xmm6;
866  PM128A Xmm7;
867  PM128A Xmm8;
868  PM128A Xmm9;
869  PM128A Xmm10;
870  PM128A Xmm11;
871  PM128A Xmm12;
872  PM128A Xmm13;
873  PM128A Xmm14;
874  PM128A Xmm15;
875  } DUMMYSTRUCTNAME1;
876  } DUMMYUNIONNAME1;
877 
878  union
879  {
880  PULONG64 IntegerContext[16];
881  struct
882  {
883  PULONG64 Rax;
884  PULONG64 Rcx;
885  PULONG64 Rdx;
886  PULONG64 Rbx;
887  PULONG64 Rsp;
888  PULONG64 Rbp;
889  PULONG64 Rsi;
890  PULONG64 Rdi;
891  PULONG64 R8;
892  PULONG64 R9;
893  PULONG64 R10;
894  PULONG64 R11;
895  PULONG64 R12;
896  PULONG64 R13;
897  PULONG64 R14;
898  PULONG64 R15;
899  } DUMMYSTRUCTNAME2;
900  } DUMMYUNIONNAME2;
901 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS;
902 
903 BOOLEAN CDECL RtlAddFunctionTable(RUNTIME_FUNCTION*,DWORD,DWORD64);
904 BOOLEAN CDECL RtlDeleteFunctionTable(RUNTIME_FUNCTION*);
905 PRUNTIME_FUNCTION WINAPI RtlLookupFunctionEntry(DWORD64,DWORD64*,UNWIND_HISTORY_TABLE*);
906 PVOID WINAPI RtlVirtualUnwind(ULONG,ULONG64,ULONG64,RUNTIME_FUNCTION*,CONTEXT*,PVOID*,ULONG64*,KNONVOLATILE_CONTEXT_POINTERS*);
907 
908 #define UNW_FLAG_NHANDLER 0
909 #define UNW_FLAG_EHANDLER 1
910 #define UNW_FLAG_UHANDLER 2
911 #define UNW_FLAG_CHAININFO 4
912 
913 #endif /* __x86_64__ */
914 
915 /* Alpha context definitions */
916 #if defined(__alpha__)
917 
918 #define CONTEXT_ALPHA 0x00020000
919 
920 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
921 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
922 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
923 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
924 
925 typedef struct _CONTEXT
926 {
927  /* selected by CONTEXT_FLOATING_POINT */
928  ULONGLONG FltF0;
929  ULONGLONG FltF1;
930  ULONGLONG FltF2;
931  ULONGLONG FltF3;
932  ULONGLONG FltF4;
933  ULONGLONG FltF5;
934  ULONGLONG FltF6;
935  ULONGLONG FltF7;
936  ULONGLONG FltF8;
937  ULONGLONG FltF9;
938  ULONGLONG FltF10;
939  ULONGLONG FltF11;
940  ULONGLONG FltF12;
941  ULONGLONG FltF13;
942  ULONGLONG FltF14;
943  ULONGLONG FltF15;
944  ULONGLONG FltF16;
945  ULONGLONG FltF17;
946  ULONGLONG FltF18;
947  ULONGLONG FltF19;
948  ULONGLONG FltF20;
949  ULONGLONG FltF21;
950  ULONGLONG FltF22;
951  ULONGLONG FltF23;
952  ULONGLONG FltF24;
953  ULONGLONG FltF25;
954  ULONGLONG FltF26;
955  ULONGLONG FltF27;
956  ULONGLONG FltF28;
957  ULONGLONG FltF29;
958  ULONGLONG FltF30;
959  ULONGLONG FltF31;
960 
961  /* selected by CONTEXT_INTEGER */
962  ULONGLONG IntV0;
963  ULONGLONG IntT0;
964  ULONGLONG IntT1;
965  ULONGLONG IntT2;
966  ULONGLONG IntT3;
967  ULONGLONG IntT4;
968  ULONGLONG IntT5;
969  ULONGLONG IntT6;
970  ULONGLONG IntT7;
971  ULONGLONG IntS0;
972  ULONGLONG IntS1;
973  ULONGLONG IntS2;
974  ULONGLONG IntS3;
975  ULONGLONG IntS4;
976  ULONGLONG IntS5;
977  ULONGLONG IntFp;
978  ULONGLONG IntA0;
979  ULONGLONG IntA1;
980  ULONGLONG IntA2;
981  ULONGLONG IntA3;
982  ULONGLONG IntA4;
983  ULONGLONG IntA5;
984  ULONGLONG IntT8;
985  ULONGLONG IntT9;
986  ULONGLONG IntT10;
987  ULONGLONG IntT11;
988  ULONGLONG IntRa;
989  ULONGLONG IntT12;
990  ULONGLONG IntAt;
991  ULONGLONG IntGp;
992  ULONGLONG IntSp;
993  ULONGLONG IntZero;
994 
995  /* selected by CONTEXT_FLOATING_POINT */
996  ULONGLONG Fpcr;
997  ULONGLONG SoftFpcr;
998 
999  /* selected by CONTEXT_CONTROL */
1000  ULONGLONG Fir;
1001  DWORD Psr;
1002  DWORD ContextFlags;
1003  DWORD Fill[4];
1004 } CONTEXT;
1005 
1006 #define _QUAD_PSR_OFFSET HighSoftFpcr
1007 #define _QUAD_FLAGS_OFFSET HighFir
1008 
1009 #endif /* _ALPHA_ */
1010 
1011 /* Mips context definitions */
1012 #ifdef _MIPS_
1013 
1014 #define CONTEXT_R4000 0x00010000
1015 
1016 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1017 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1018 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1019 
1020 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1021 
1022 typedef struct _CONTEXT
1023 {
1024  DWORD Argument[4];
1025  /* These are selected by CONTEXT_FLOATING_POINT */
1026  DWORD FltF0;
1027  DWORD FltF1;
1028  DWORD FltF2;
1029  DWORD FltF3;
1030  DWORD FltF4;
1031  DWORD FltF5;
1032  DWORD FltF6;
1033  DWORD FltF7;
1034  DWORD FltF8;
1035  DWORD FltF9;
1036  DWORD FltF10;
1037  DWORD FltF11;
1038  DWORD FltF12;
1039  DWORD FltF13;
1040  DWORD FltF14;
1041  DWORD FltF15;
1042  DWORD FltF16;
1043  DWORD FltF17;
1044  DWORD FltF18;
1045  DWORD FltF19;
1046  DWORD FltF20;
1047  DWORD FltF21;
1048  DWORD FltF22;
1049  DWORD FltF23;
1050  DWORD FltF24;
1051  DWORD FltF25;
1052  DWORD FltF26;
1053  DWORD FltF27;
1054  DWORD FltF28;
1055  DWORD FltF29;
1056  DWORD FltF30;
1057  DWORD FltF31;
1058 
1059  /* These are selected by CONTEXT_INTEGER */
1060  DWORD IntZero;
1061  DWORD IntAt;
1062  DWORD IntV0;
1063  DWORD IntV1;
1064  DWORD IntA0;
1065  DWORD IntA1;
1066  DWORD IntA2;
1067  DWORD IntA3;
1068  DWORD IntT0;
1069  DWORD IntT1;
1070  DWORD IntT2;
1071  DWORD IntT3;
1072  DWORD IntT4;
1073  DWORD IntT5;
1074  DWORD IntT6;
1075  DWORD IntT7;
1076  DWORD IntS0;
1077  DWORD IntS1;
1078  DWORD IntS2;
1079  DWORD IntS3;
1080  DWORD IntS4;
1081  DWORD IntS5;
1082  DWORD IntS6;
1083  DWORD IntS7;
1084  DWORD IntT8;
1085  DWORD IntT9;
1086  DWORD IntK0;
1087  DWORD IntK1;
1088  DWORD IntGp;
1089  DWORD IntSp;
1090  DWORD IntS8;
1091  DWORD IntRa;
1092  DWORD IntLo;
1093  DWORD IntHi;
1094 
1095  /* These are selected by CONTEXT_FLOATING_POINT */
1096  DWORD Fsr;
1097 
1098  /* These are selected by CONTEXT_CONTROL */
1099  DWORD Fir;
1100  DWORD Psr;
1101 
1102  DWORD ContextFlags;
1103  DWORD Fill[2];
1104 } CONTEXT;
1105 
1106 #endif /* _MIPS_ */
1107 
1108 /* PowerPC context definitions */
1109 #ifdef __PPC__
1110 
1111 #define CONTEXT_CONTROL 0x0001
1112 #define CONTEXT_FLOATING_POINT 0x0002
1113 #define CONTEXT_INTEGER 0x0004
1114 #define CONTEXT_DEBUG_REGISTERS 0x0008
1115 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1116 
1117 typedef struct
1118 {
1119  /* These are selected by CONTEXT_FLOATING_POINT */
1120  double Fpr0;
1121  double Fpr1;
1122  double Fpr2;
1123  double Fpr3;
1124  double Fpr4;
1125  double Fpr5;
1126  double Fpr6;
1127  double Fpr7;
1128  double Fpr8;
1129  double Fpr9;
1130  double Fpr10;
1131  double Fpr11;
1132  double Fpr12;
1133  double Fpr13;
1134  double Fpr14;
1135  double Fpr15;
1136  double Fpr16;
1137  double Fpr17;
1138  double Fpr18;
1139  double Fpr19;
1140  double Fpr20;
1141  double Fpr21;
1142  double Fpr22;
1143  double Fpr23;
1144  double Fpr24;
1145  double Fpr25;
1146  double Fpr26;
1147  double Fpr27;
1148  double Fpr28;
1149  double Fpr29;
1150  double Fpr30;
1151  double Fpr31;
1152  double Fpscr;
1153 
1154  /* These are selected by CONTEXT_INTEGER */
1155  DWORD Gpr0;
1156  DWORD Gpr1;
1157  DWORD Gpr2;
1158  DWORD Gpr3;
1159  DWORD Gpr4;
1160  DWORD Gpr5;
1161  DWORD Gpr6;
1162  DWORD Gpr7;
1163  DWORD Gpr8;
1164  DWORD Gpr9;
1165  DWORD Gpr10;
1166  DWORD Gpr11;
1167  DWORD Gpr12;
1168  DWORD Gpr13;
1169  DWORD Gpr14;
1170  DWORD Gpr15;
1171  DWORD Gpr16;
1172  DWORD Gpr17;
1173  DWORD Gpr18;
1174  DWORD Gpr19;
1175  DWORD Gpr20;
1176  DWORD Gpr21;
1177  DWORD Gpr22;
1178  DWORD Gpr23;
1179  DWORD Gpr24;
1180  DWORD Gpr25;
1181  DWORD Gpr26;
1182  DWORD Gpr27;
1183  DWORD Gpr28;
1184  DWORD Gpr29;
1185  DWORD Gpr30;
1186  DWORD Gpr31;
1187 
1188  DWORD Cr;
1189  DWORD Xer;
1190 
1191  /* These are selected by CONTEXT_CONTROL */
1192  DWORD Msr;
1193  DWORD Iar;
1194  DWORD Lr;
1195  DWORD Ctr;
1196 
1197  DWORD ContextFlags;
1198  DWORD Fill[3];
1199 
1200  /* These are selected by CONTEXT_DEBUG_REGISTERS */
1201  DWORD Dr0;
1202  DWORD Dr1;
1203  DWORD Dr2;
1204  DWORD Dr3;
1205  DWORD Dr4;
1206  DWORD Dr5;
1207  DWORD Dr6;
1208  DWORD Dr7;
1209 } CONTEXT;
1210 
1211 typedef struct _STACK_FRAME_HEADER
1212 {
1213  DWORD BackChain;
1214  DWORD GlueSaved1;
1215  DWORD GlueSaved2;
1216  DWORD Reserved1;
1217  DWORD Spare1;
1218  DWORD Spare2;
1219 
1220  DWORD Parameter0;
1221  DWORD Parameter1;
1222  DWORD Parameter2;
1223  DWORD Parameter3;
1224  DWORD Parameter4;
1225  DWORD Parameter5;
1226  DWORD Parameter6;
1227  DWORD Parameter7;
1228 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1229 
1230 #endif /* __PPC__ */
1231 
1232 #ifdef __sparc__
1233 
1234 /*
1235  * FIXME:
1236  *
1237  * There is no official CONTEXT structure defined for the SPARC
1238  * architecture, so I just made one up.
1239  *
1240  * This structure is valid only for 32-bit SPARC architectures,
1241  * not for 64-bit SPARC.
1242  *
1243  * Note that this structure contains only the 'top-level' registers;
1244  * the rest of the register window chain is not visible.
1245  *
1246  * The layout follows the Solaris 'prgregset_t' structure.
1247  *
1248  */
1249 
1250 #define CONTEXT_SPARC 0x10000000
1251 
1252 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1253 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1254 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1255 
1256 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1257 
1258 typedef struct _CONTEXT
1259 {
1260  DWORD ContextFlags;
1261 
1262  /* These are selected by CONTEXT_INTEGER */
1263  DWORD g0;
1264  DWORD g1;
1265  DWORD g2;
1266  DWORD g3;
1267  DWORD g4;
1268  DWORD g5;
1269  DWORD g6;
1270  DWORD g7;
1271  DWORD o0;
1272  DWORD o1;
1273  DWORD o2;
1274  DWORD o3;
1275  DWORD o4;
1276  DWORD o5;
1277  DWORD o6;
1278  DWORD o7;
1279  DWORD l0;
1280  DWORD l1;
1281  DWORD l2;
1282  DWORD l3;
1283  DWORD l4;
1284  DWORD l5;
1285  DWORD l6;
1286  DWORD l7;
1287  DWORD i0;
1288  DWORD i1;
1289  DWORD i2;
1290  DWORD i3;
1291  DWORD i4;
1292  DWORD i5;
1293  DWORD i6;
1294  DWORD i7;
1295 
1296  /* These are selected by CONTEXT_CONTROL */
1297  DWORD psr;
1298  DWORD pc;
1299  DWORD npc;
1300  DWORD y;
1301  DWORD wim;
1302  DWORD tbr;
1303 
1304  /* FIXME: floating point registers missing */
1305 
1306 } CONTEXT;
1307 
1308 #endif /* __sparc__ */
1309 
1310 #ifdef __s390__
1311 
1312 /*
1313  * FIXME:
1314  *
1315  * There is no official CONTEXT structure defined for the S390
1316  * architecture, so I just made one up.
1317  *
1318  * Note that this structure contains only the 'top-level' registers;
1319  * the rest of the register window chain is not visible.
1320  *
1321  * The layout is based on the sparc one.
1322  *
1323  */
1324 
1325 #define CONTEXT_S390C 0x20000000
1326 
1327 #define CONTEXT_CONTROL (CONTEXT_S390 | 0x00000001)
1328 #define CONTEXT_FLOATING_POINT (CONTEXT_S390 | 0x00000002)
1329 #define CONTEXT_INTEGER (CONTEXT_S390 | 0x00000004)
1330 
1331 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1332 
1333 typedef struct _CONTEXT
1334 {
1335  DWORD ContextFlags;
1336 
1337  /* These are selected by CONTEXT_INTEGER */
1338  DWORD r0;
1339  DWORD r1;
1340  DWORD r2;
1341  DWORD r3;
1342  DWORD r4;
1343  DWORD r5;
1344  DWORD r6;
1345  DWORD r7;
1346  DWORD r8;
1347  DWORD r9;
1348  DWORD r10;
1349  DWORD r11;
1350  DWORD r12;
1351  DWORD r13;
1352  DWORD r14;
1353  DWORD r15;
1354 
1355  /* FIXME: this section is fictional (copied from sparc) */
1356  DWORD psr;
1357  DWORD pc;
1358  DWORD npc;
1359  DWORD y;
1360  DWORD wim;
1361  DWORD tbr;
1362 
1363  /* FIXME: floating point registers missing */
1364 
1365 } CONTEXT;
1366 
1367 #endif /* __s390__ */
1368 
1369 #ifdef __arm__
1370 
1371 /* These definitions are taken directly from wine
1372  * http://source.winehq.org/git/wine.git/blob_plain/HEAD:/include/winnt.h */
1373 
1374 /* The following flags control the contents of the CONTEXT structure. */
1375 
1376 #define CONTEXT_ARM 0x0200000
1377 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001)
1378 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002)
1379 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004)
1380 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008)
1381 
1382 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1383 
1384 #define EXCEPTION_READ_FAULT 0
1385 #define EXCEPTION_WRITE_FAULT 1
1386 #define EXCEPTION_EXECUTE_FAULT 8
1387 
1388 typedef struct _CONTEXT {
1389 /* The flags values within this flag control the contents of
1390  * a CONTEXT record.
1391  *
1392  * If the context record is used as an input parameter, then
1393  * for each portion of the context record controlled by a flag
1394  * whose value is set, it is assumed that that portion of the
1395  * context record contains valid context. If the context record
1396  * is being used to modify a thread's context, then only that
1397  * portion of the threads context will be modified.
1398  *
1399  * If the context record is used as an IN OUT parameter to capture
1400  * the context of a thread, then only those portions of the thread's
1401  * context corresponding to set flags will be returned.
1402  *
1403  * The context record is never used as an OUT only parameter. */
1404 
1405 ULONG ContextFlags;
1406 
1407 /* This section is specified/returned if the ContextFlags word contains
1408  * the flag CONTEXT_INTEGER. */
1409 ULONG R0;
1410 ULONG R1;
1411 ULONG R2;
1412 ULONG R3;
1413 ULONG R4;
1414 ULONG R5;
1415 ULONG R6;
1416 ULONG R7;
1417 ULONG R8;
1418 ULONG R9;
1419 ULONG R10;
1420 ULONG Fp;
1421 ULONG Ip;
1422 
1423 /* These are selected by CONTEXT_CONTROL */
1424 ULONG Sp;
1425 ULONG Lr;
1426 ULONG Pc;
1427 ULONG Cpsr;
1428 } CONTEXT;
1429 
1430 #endif /* __arm__ */
1431 
1432 #ifdef __aarch64__
1433 /*
1434  * FIXME:
1435  *
1436  * There is not yet an official CONTEXT structure defined for the AArch64
1437  * architecture, so I just made one up.
1438  *
1439  */
1440 
1441 /* These definitions are taken directly from wine
1442  * http://source.winehq.org/git/wine.git/blob_plain/HEAD:/include/winnt.h */
1443 
1444 #define CONTEXT_ARM64 0x2000000
1445 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x00000001)
1446 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x00000002)
1447 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x00000004)
1448 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x00000008)
1449 
1450 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1451 
1452 #define EXCEPTION_READ_FAULT 0
1453 #define EXCEPTION_WRITE_FAULT 1
1454 #define EXCEPTION_EXECUTE_FAULT 8
1455 
1456 typedef struct _CONTEXT {
1457  ULONG ContextFlags;
1458 
1459  /* This section is specified/returned if the ContextFlags word contains
1460  the flag CONTEXT_INTEGER. */
1461  ULONGLONG X0;
1462  ULONGLONG X1;
1463  ULONGLONG X2;
1464  ULONGLONG X3;
1465  ULONGLONG X4;
1466  ULONGLONG X5;
1467  ULONGLONG X6;
1468  ULONGLONG X7;
1469  ULONGLONG X8;
1470  ULONGLONG X9;
1471  ULONGLONG X10;
1472  ULONGLONG X11;
1473  ULONGLONG X12;
1474  ULONGLONG X13;
1475  ULONGLONG X14;
1476  ULONGLONG X15;
1477  ULONGLONG X16;
1478  ULONGLONG X17;
1479  ULONGLONG X18;
1480  ULONGLONG X19;
1481  ULONGLONG X20;
1482  ULONGLONG X21;
1483  ULONGLONG X22;
1484  ULONGLONG X23;
1485  ULONGLONG X24;
1486  ULONGLONG X25;
1487  ULONGLONG X26;
1488  ULONGLONG X27;
1489  ULONGLONG X28;
1490  ULONGLONG X29;
1491  ULONGLONG X30;
1492 
1493  /* These are selected by CONTEXT_CONTROL */
1494  ULONGLONG Sp;
1495  ULONGLONG Pc;
1496  ULONGLONG PState;
1497 
1498  /* These are selected by CONTEXT_FLOATING_POINT */
1499  /* FIXME */
1500 } CONTEXT;
1501 
1502 #endif /* __aarch64__ */
1503 
1504 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1505 #error You need to define a CONTEXT for your CPU
1506 #endif
1507 
1508 typedef CONTEXT *PCONTEXT;
1509 
1510 #ifdef __WINE__
1511 
1512 /* Macros for easier access to i386 context registers */
1513 
1514 #define AX_reg(context) (*(WORD*)&(context)->Eax)
1515 #define BX_reg(context) (*(WORD*)&(context)->Ebx)
1516 #define CX_reg(context) (*(WORD*)&(context)->Ecx)
1517 #define DX_reg(context) (*(WORD*)&(context)->Edx)
1518 #define SI_reg(context) (*(WORD*)&(context)->Esi)
1519 #define DI_reg(context) (*(WORD*)&(context)->Edi)
1520 #define BP_reg(context) (*(WORD*)&(context)->Ebp)
1521 
1522 #define AL_reg(context) (*(BYTE*)&(context)->Eax)
1523 #define AH_reg(context) (*((BYTE*)&(context)->Eax + 1))
1524 #define BL_reg(context) (*(BYTE*)&(context)->Ebx)
1525 #define BH_reg(context) (*((BYTE*)&(context)->Ebx + 1))
1526 #define CL_reg(context) (*(BYTE*)&(context)->Ecx)
1527 #define CH_reg(context) (*((BYTE*)&(context)->Ecx + 1))
1528 #define DL_reg(context) (*(BYTE*)&(context)->Edx)
1529 #define DH_reg(context) (*((BYTE*)&(context)->Edx + 1))
1530 
1531 #define SET_CFLAG(context) ((context)->EFlags |= 0x0001)
1532 #define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
1533 #define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
1534 #define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
1535 #define ISV86(context) ((context)->EFlags & 0x00020000)
1536 
1537 
1538 /* Macros to retrieve the current context */
1539 
1540 #ifdef NEED_UNDERSCORE_PREFIX
1541 # define __ASM_NAME(name) "_" name
1542 #else
1543 # define __ASM_NAME(name) name
1544 #endif
1545 
1546 #ifdef NEED_TYPE_IN_DEF
1547 # define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
1548 #else
1549 # define __ASM_FUNC(name) ".type " __ASM_NAME(name) ",@function"
1550 #endif
1551 
1552 #ifdef __GNUC__
1553 # define __ASM_GLOBAL_FUNC(name,code) \
1554  __asm__( ".align 4\n\t" \
1555  ".globl " __ASM_NAME(#name) "\n\t" \
1556  __ASM_FUNC(#name) "\n" \
1557  __ASM_NAME(#name) ":\n\t" \
1558  code );
1559 #else /* __GNUC__ */
1560 # define __ASM_GLOBAL_FUNC(name,code) \
1561  void __asm_dummy_##name(void) { \
1562  asm( ".align 4\n\t" \
1563  ".globl " __ASM_NAME(#name) "\n\t" \
1564  __ASM_FUNC(#name) "\n" \
1565  __ASM_NAME(#name) ":\n\t" \
1566  code ); \
1567  }
1568 #endif /* __GNUC__ */
1569 
1570 #ifdef __i386__
1571 
1572 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
1573  __ASM_GLOBAL_FUNC( name, \
1574  "call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
1575  ".long " __ASM_NAME(#fn) "\n\t" \
1576  ".byte " #args ", " #args )
1577 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1578  extern void WINAPI name(void); \
1579  _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
1580 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1581  extern void WINAPI name( t1 a1 ); \
1582  _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
1583 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1584  extern void WINAPI name( t1 a1, t2 a2 ); \
1585  _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
1586 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1587  extern void WINAPI name( t1 a1, t2 a2, t3 a3 ); \
1588  _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
1589 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1590  extern void WINAPI name( t1 a1, t2 a2, t3 a3, t4 a4 ); \
1591  _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
1592 
1593 #endif /* __i386__ */
1594 
1595 #ifdef __sparc__
1596 /* FIXME: use getcontext() to retrieve full context */
1597 #define _GET_CONTEXT \
1598  CONTEXT context; \
1599  do { memset(&context, 0, sizeof(CONTEXT)); \
1600  context.ContextFlags = CONTEXT_CONTROL; \
1601  context.pc = (DWORD)__builtin_return_address(0); \
1602  } while (0)
1603 
1604 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1605  void WINAPI name ( void ) \
1606  { _GET_CONTEXT; fn( &context ); }
1607 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1608  void WINAPI name ( t1 a1 ) \
1609  { _GET_CONTEXT; fn( a1, &context ); }
1610 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1611  void WINAPI name ( t1 a1, t2 a2 ) \
1612  { _GET_CONTEXT; fn( a1, a2, &context ); }
1613 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1614  void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
1615  { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
1616 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1617  void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
1618  { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
1619 
1620 #endif /* __sparc__ */
1621 
1622 #ifdef __s390__
1623 /* FIXME: use getcontext() to retrieve full context */
1624 #define _GET_CONTEXT \
1625  CONTEXT context; \
1626  do { memset(&context, 0, sizeof(CONTEXT)); \
1627  context.ContextFlags = CONTEXT_CONTROL; \
1628  context.pc = (DWORD)__builtin_return_address(0); \
1629  } while (0)
1630 
1631 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1632  void WINAPI name ( void ) \
1633  { _GET_CONTEXT; fn( &context ); }
1634 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1635  void WINAPI name ( t1 a1 ) \
1636  { _GET_CONTEXT; fn( a1, &context ); }
1637 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1638  void WINAPI name ( t1 a1, t2 a2 ) \
1639  { _GET_CONTEXT; fn( a1, a2, &context ); }
1640 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1641  void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
1642  { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
1643 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1644  void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
1645  { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
1646 
1647 #endif /* __s390__ */
1648 
1649 #ifdef __PPC__
1650 
1651 /* FIXME: use getcontext() to retrieve full context */
1652 #define _GET_CONTEXT \
1653  CONTEXT context; \
1654  do { memset(&context, 0, sizeof(CONTEXT)); \
1655  context.ContextFlags = CONTEXT_CONTROL; \
1656  } while (0)
1657 
1658 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1659  void WINAPI name ( void ) \
1660  { _GET_CONTEXT; fn( &context ); }
1661 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1662  void WINAPI name ( t1 a1 ) \
1663  { _GET_CONTEXT; fn( a1, &context ); }
1664 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1665  void WINAPI name ( t1 a1, t2 a2 ) \
1666  { _GET_CONTEXT; fn( a1, a2, &context ); }
1667 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1668  void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
1669  { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
1670 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1671  void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
1672  { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
1673 
1674 #endif /* __PPC__ */
1675 
1676 
1677 #ifndef DEFINE_REGS_ENTRYPOINT_0
1678 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
1679 #endif
1680 
1681 /* Constructor functions */
1682 
1683 #ifdef __GNUC__
1684 # define DECL_GLOBAL_CONSTRUCTOR(func) \
1685  static void func(void) __attribute__((constructor)); \
1686  static void func(void)
1687 #else /* __GNUC__ */
1688 # ifdef __i386__
1689 # define DECL_GLOBAL_CONSTRUCTOR(func) \
1690  static void __dummy_init_##func(void) { \
1691  asm(".section .init,\"ax\"\n\t" \
1692  "call " #func "\n\t" \
1693  ".previous"); } \
1694  static void func(void)
1695 # else /* __i386__ */
1696 # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
1697 # endif
1698 #endif /* __GNUC__ */
1699 
1700 /* Segment register access */
1701 
1702 #ifdef __i386__
1703 # ifdef __GNUC__
1704 # define __DEFINE_GET_SEG(seg) \
1705  extern inline unsigned short __get_##seg(void) \
1706  { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
1707 # define __DEFINE_SET_SEG(seg) \
1708  extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
1709 # else /* __GNUC__ */
1710 # define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void);
1711 # define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int);
1712 # endif /* __GNUC__ */
1713 #else /* __i386__ */
1714 # define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; }
1715 # define __DEFINE_SET_SEG(seg) /* nothing */
1716 #endif /* __i386__ */
1717 
1718 __DEFINE_GET_SEG(cs)
1719 __DEFINE_GET_SEG(ds)
1720 __DEFINE_GET_SEG(es)
1721 __DEFINE_GET_SEG(fs)
1722 __DEFINE_GET_SEG(gs)
1723 __DEFINE_GET_SEG(ss)
1724 __DEFINE_SET_SEG(fs)
1725 __DEFINE_SET_SEG(gs)
1726 #undef __DEFINE_GET_SEG
1727 #undef __DEFINE_SET_SEG
1728 
1729 #endif /* __WINE__ */
1730 
1731 
1732 
1733 /*
1734  * Language IDs
1735  */
1736 
1737 #define MAKELCID(l, s) (MAKELONG(l, s))
1738 
1739 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1740 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1741 #define SUBLANGID(l) ((WORD)(l) >> 10)
1742 
1743 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1744 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1745 
1746 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1747 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1748 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1749 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1750 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1751 
1752 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x20, 0x28,
1753  * 0x2a, 0x2b, 0x2c, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
1754  * 0x37, 0x39, 0x3a, 0x3b, 0x3c, 0x3e, 0x3f, 0x41, 0x43, 0x44,
1755  * 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e,
1756  * 0x4f, 0x57
1757  */
1758 #define LANG_NEUTRAL 0x00
1759 #define LANG_AFRIKAANS 0x36
1760 #define LANG_ALBANIAN 0x1c
1761 #define LANG_ARABIC 0x01
1762 #define LANG_ARMENIAN 0x2b
1763 #define LANG_ASSAMESE 0x4d
1764 #define LANG_AZERI 0x2c
1765 #define LANG_BASQUE 0x2d
1766 #define LANG_BENGALI 0x45
1767 #define LANG_BULGARIAN 0x02
1768 #define LANG_BYELORUSSIAN 0x23
1769 #define LANG_CATALAN 0x03
1770 #define LANG_CHINESE 0x04
1771 #define LANG_SERBO_CROATIAN 0x1a
1772 #define LANG_CROATIAN LANG_SERBO_CROATIAN
1773 #define LANG_SERBIAN LANG_SERBO_CROATIAN
1774 #define LANG_CZECH 0x05
1775 #define LANG_DANISH 0x06
1776 #define LANG_DUTCH 0x13
1777 #define LANG_ENGLISH 0x09
1778 #define LANG_ESTONIAN 0x25
1779 #define LANG_FAEROESE 0x38
1780 #define LANG_FARSI 0x29
1781 #define LANG_FINNISH 0x0b
1782 #define LANG_FRENCH 0x0c
1783 #define LANG_GAELIC 0x3c
1784 #define LANG_GEORGIAN 0x37
1785 #define LANG_GERMAN 0x07
1786 #define LANG_GREEK 0x08
1787 #define LANG_GUJARATI 0x47
1788 #define LANG_HEBREW 0x0D
1789 #define LANG_HINDI 0x39
1790 #define LANG_HUNGARIAN 0x0e
1791 #define LANG_ICELANDIC 0x0f
1792 #define LANG_INDONESIAN 0x21
1793 #define LANG_ITALIAN 0x10
1794 #define LANG_JAPANESE 0x11
1795 #define LANG_KANNADA 0x4b
1796 #define LANG_KAZAKH 0x3f
1797 #define LANG_KONKANI 0x57
1798 #define LANG_KOREAN 0x12
1799 #define LANG_LATVIAN 0x26
1800 #define LANG_LITHUANIAN 0x27
1801 #define LANG_MACEDONIAN 0x2f
1802 #define LANG_MALAY 0x3e
1803 #define LANG_MALAYALAM 0x4c
1804 #define LANG_MALTESE 0x3a
1805 #define LANG_MAORI 0x28
1806 #define LANG_MARATHI 0x4e
1807 #define LANG_NORWEGIAN 0x14
1808 #define LANG_ORIYA 0x48
1809 #define LANG_POLISH 0x15
1810 #define LANG_PORTUGUESE 0x16
1811 #define LANG_PUNJABI 0x46
1812 #define LANG_RHAETO_ROMANCE 0x17
1813 #define LANG_ROMANIAN 0x18
1814 #define LANG_RUSSIAN 0x19
1815 #define LANG_SAAMI 0x3b
1816 #define LANG_SANSKRIT 0x4f
1817 #define LANG_SLOVAK 0x1b
1818 #define LANG_SLOVENIAN 0x24
1819 #define LANG_SORBIAN 0x2e
1820 #define LANG_SPANISH 0x0a
1821 #define LANG_SUTU 0x30
1822 #define LANG_SWAHILI 0x41
1823 #define LANG_SWEDISH 0x1d
1824 #define LANG_TAMIL 0x49
1825 #define LANG_TATAR 0x44
1826 #define LANG_TELUGU 0x4a
1827 #define LANG_THAI 0x1e
1828 #define LANG_TSONGA 0x31
1829 #define LANG_TSWANA 0x32
1830 #define LANG_TURKISH 0x1f
1831 #define LANG_UKRAINIAN 0x22
1832 #define LANG_URDU 0x20
1833 #define LANG_UZBEK 0x43
1834 #define LANG_VENDA 0x33
1835 #define LANG_VIETNAMESE 0x2a
1836 #define LANG_XHOSA 0x34
1837 #define LANG_ZULU 0x35
1838 /* non standard; keep the number high enough (but < 0xff) */
1839 #define LANG_ESPERANTO 0x8f
1840 #define LANG_WALON 0x90
1841 #define LANG_CORNISH 0x91
1842 #define LANG_WELSH 0x92
1843 #define LANG_BRETON 0x93
1844 
1845 /* Sublanguage definitions */
1846 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1847 #define SUBLANG_DEFAULT 0x01 /* user default */
1848 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1849 
1850 #define SUBLANG_ARABIC 0x01
1851 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1852 #define SUBLANG_ARABIC_IRAQ 0x02
1853 #define SUBLANG_ARABIC_EGYPT 0x03
1854 #define SUBLANG_ARABIC_LIBYA 0x04
1855 #define SUBLANG_ARABIC_ALGERIA 0x05
1856 #define SUBLANG_ARABIC_MOROCCO 0x06
1857 #define SUBLANG_ARABIC_TUNISIA 0x07
1858 #define SUBLANG_ARABIC_OMAN 0x08
1859 #define SUBLANG_ARABIC_YEMEN 0x09
1860 #define SUBLANG_ARABIC_SYRIA 0x0a
1861 #define SUBLANG_ARABIC_JORDAN 0x0b
1862 #define SUBLANG_ARABIC_LEBANON 0x0c
1863 #define SUBLANG_ARABIC_KUWAIT 0x0d
1864 #define SUBLANG_ARABIC_UAE 0x0e
1865 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1866 #define SUBLANG_ARABIC_QATAR 0x10
1867 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1868 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1869 #define SUBLANG_CHINESE_HONGKONG 0x03
1870 #define SUBLANG_CHINESE_SINGAPORE 0x04
1871 #define SUBLANG_CHINESE_MACAU 0x05
1872 #define SUBLANG_DUTCH 0x01
1873 #define SUBLANG_DUTCH_BELGIAN 0x02
1874 #define SUBLANG_DUTCH_SURINAM 0x03
1875 #define SUBLANG_ENGLISH_US 0x01
1876 #define SUBLANG_ENGLISH_UK 0x02
1877 #define SUBLANG_ENGLISH_AUS 0x03
1878 #define SUBLANG_ENGLISH_CAN 0x04
1879 #define SUBLANG_ENGLISH_NZ 0x05
1880 #define SUBLANG_ENGLISH_EIRE 0x06
1881 #define SUBLANG_ENGLISH_SAFRICA 0x07
1882 #define SUBLANG_ENGLISH_JAMAICA 0x08
1883 #define SUBLANG_ENGLISH_CARRIBEAN 0x09
1884 #define SUBLANG_ENGLISH_BELIZE 0x0a
1885 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1886 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1887 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1888 #define SUBLANG_FRENCH 0x01
1889 #define SUBLANG_FRENCH_BELGIAN 0x02
1890 #define SUBLANG_FRENCH_CANADIAN 0x03
1891 #define SUBLANG_FRENCH_SWISS 0x04
1892 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1893 #define SUBLANG_FRENCH_MONACO 0x06
1894 #define SUBLANG_GERMAN 0x01
1895 #define SUBLANG_GERMAN_SWISS 0x02
1896 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1897 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1898 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1899 #define SUBLANG_ITALIAN 0x01
1900 #define SUBLANG_ITALIAN_SWISS 0x02
1901 #define SUBLANG_KOREAN 0x01
1902 #define SUBLANG_KOREAN_JOHAB 0x02
1903 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1904 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1905 #define SUBLANG_PORTUGUESE 0x02
1906 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1907 #define SUBLANG_SPANISH 0x01
1908 #define SUBLANG_SPANISH_MEXICAN 0x02
1909 #define SUBLANG_SPANISH_MODERN 0x03
1910 #define SUBLANG_SPANISH_GUATEMALA 0x04
1911 #define SUBLANG_SPANISH_COSTARICA 0x05
1912 #define SUBLANG_SPANISH_PANAMA 0x06
1913 #define SUBLANG_SPANISH_DOMINICAN 0x07
1914 #define SUBLANG_SPANISH_VENEZUELA 0x08
1915 #define SUBLANG_SPANISH_COLOMBIA 0x09
1916 #define SUBLANG_SPANISH_PERU 0x0a
1917 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1918 #define SUBLANG_SPANISH_ECUADOR 0x0c
1919 #define SUBLANG_SPANISH_CHILE 0x0d
1920 #define SUBLANG_SPANISH_URUGUAY 0x0e
1921 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1922 #define SUBLANG_SPANISH_BOLIVIA 0x10
1923 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1924 #define SUBLANG_SPANISH_HONDURAS 0x12
1925 #define SUBLANG_SPANISH_NICARAGUA 0x13
1926 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1927 /* FIXME: I don't know the symbolic names for those */
1928 #define SUBLANG_ROMANIAN 0x01
1929 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1930 #define SUBLANG_RUSSIAN 0x01
1931 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1932 #define SUBLANG_CROATIAN 0x01
1933 #define SUBLANG_SERBIAN 0x02
1934 #define SUBLANG_SERBIAN_LATIN 0x03
1935 #define SUBLANG_SWEDISH 0x01
1936 #define SUBLANG_SWEDISH_FINLAND 0x02
1937 #define SUBLANG_LITHUANIAN 0x01
1938 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1939 #define SUBLANG_AZERI 0x01
1940 #define SUBLANG_AZERI_CYRILLIC 0x02
1941 #define SUBLANG_GAELIC 0x01
1942 #define SUBLANG_GAELIC_SCOTTISH 0x02
1943 #define SUBLANG_GAELIC_MANX 0x03
1944 #define SUBLANG_MALAY 0x01
1945 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1946 #define SUBLANG_UZBEK 0x01
1947 #define SUBLANG_UZBEK_CYRILLIC 0x02
1948 #define SUBLANG_URDU_PAKISTAN 0x01
1949 
1950 
1951 
1952 /*
1953  * Sort definitions
1954  */
1955 
1956 #define SORT_DEFAULT 0x0
1957 #define SORT_JAPANESE_XJIS 0x0
1958 #define SORT_JAPANESE_UNICODE 0x1
1959 #define SORT_CHINESE_BIG5 0x0
1960 #define SORT_CHINESE_UNICODE 0x1
1961 #define SORT_KOREAN_KSC 0x0
1962 #define SORT_KOREAN_UNICODE 0x1
1963 
1964 
1965 
1966 /*
1967  * Definitions for IsTextUnicode()
1968  */
1969 
1970 #define IS_TEXT_UNICODE_ASCII16 0x0001
1971 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1972 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1973 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1974 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1975 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1976 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1977 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1978 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1979 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1980 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1981 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1982 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1983 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1984 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1985 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1986 
1987 
1988 
1989 /*
1990  * Exception codes
1991  */
1992 
1993 #define STATUS_SUCCESS 0x00000000
1994 #define STATUS_WAIT_0 0x00000000
1995 #define STATUS_ABANDONED_WAIT_0 0x00000080
1996 #define STATUS_ABANDONED_WAIT_63 0x000000BF
1997 #define STATUS_USER_APC 0x000000C0
1998 #define STATUS_ALERTED 0x00000101
1999 #define STATUS_TIMEOUT 0x00000102
2000 #define STATUS_PENDING 0x00000103
2001 #define STATUS_REPARSE 0x00000104
2002 #define STATUS_MORE_ENTRIES 0x00000105
2003 #define STATUS_NOT_ALL_ASSIGNED 0x00000106
2004 #define STATUS_SOME_NOT_MAPPED 0x00000107
2005 #define STATUS_OPLOCK_BREAK_IN_PROGRESS 0x00000108
2006 #define STATUS_VOLUME_MOUNTED 0x00000109
2007 #define STATUS_RXACT_COMMITTED 0x0000010A
2008 #define STATUS_NOTIFY_CLEANUP 0x0000010B
2009 #define STATUS_NOTIFY_ENUM_DIR 0x0000010C
2010 #define STATUS_NO_QUOTAS_FOR_ACCOUNT 0x0000010D
2011 #define STATUS_PRIMARY_TRANSPORT_CONNECT_FAILED 0x0000010E
2012 #define STATUS_PAGE_FAULT_TRANSITION 0x00000110
2013 #define STATUS_PAGE_FAULT_DEMAND_ZERO 0x00000111
2014 #define STATUS_PAGE_FAULT_COPY_ON_WRITE 0x00000112
2015 #define STATUS_PAGE_FAULT_GUARD_PAGE 0x00000113
2016 #define STATUS_PAGE_FAULT_PAGING_FILE 0x00000114
2017 #define STATUS_CACHE_PAGE_LOCKED 0x00000115
2018 #define STATUS_CRASH_DUMP 0x00000116
2019 #define STATUS_BUFFER_ALL_ZEROS 0x00000117
2020 #define STATUS_REPARSE_OBJECT 0x00000118
2021 
2022 #define STATUS_THREAD_WAS_SUSPENDED 0x40000001
2023 #define STATUS_WORKING_SET_LIMIT_RANGE 0x40000002
2024 #define STATUS_IMAGE_NOT_AT_BASE 0x40000003
2025 #define STATUS_RXACT_STATE_CREATED 0x40000004
2026 #define STATUS_SEGMENT_NOTIFICATION 0x40000005
2027 #define STATUS_LOCAL_USER_SESSION_KEY 0x40000006
2028 #define STATUS_BAD_CURRENT_DIRECTORY 0x40000007
2029 #define STATUS_SERIAL_MORE_WRITES 0x40000008
2030 #define STATUS_REGISTRY_RECOVERED 0x40000009
2031 #define STATUS_FT_READ_RECOVERY_FROM_BACKUP 0x4000000A
2032 #define STATUS_FT_WRITE_RECOVERY 0x4000000B
2033 #define STATUS_SERIAL_COUNTER_TIMEOUT 0x4000000C
2034 #define STATUS_NULL_LM_PASSWORD 0x4000000D
2035 #define STATUS_IMAGE_MACHINE_TYPE_MISMATCH 0x4000000E
2036 #define STATUS_RECEIVE_PARTIAL 0x4000000F
2037 #define STATUS_RECEIVE_EXPEDITED 0x40000010
2038 #define STATUS_RECEIVE_PARTIAL_EXPEDITED 0x40000011
2039 #define STATUS_EVENT_DONE 0x40000012
2040 #define STATUS_EVENT_PENDING 0x40000013
2041 #define STATUS_CHECKING_FILE_SYSTEM 0x40000014
2042 #define STATUS_FATAL_APP_EXIT 0x40000015
2043 #define STATUS_PREDEFINED_HANDLE 0x40000016
2044 #define STATUS_WAS_UNLOCKED 0x40000017
2045 #define STATUS_SERVICE_NOTIFICATION 0x40000018
2046 #define STATUS_WAS_LOCKED 0x40000019
2047 #define STATUS_LOG_HARD_ERROR 0x4000001A
2048 #define STATUS_ALREADY_WIN32 0x4000001B
2049 #define STATUS_WX86_UNSIMULATE 0x4000001C
2050 #define STATUS_WX86_CONTINUE 0x4000001D
2051 #define STATUS_WX86_SINGLE_STEP 0x4000001E
2052 #define STATUS_WX86_BREAKPOINT 0x4000001F
2053 #define STATUS_WX86_EXCEPTION_CONTINUE 0x40000020
2054 #define STATUS_WX86_EXCEPTION_LASTCHANCE 0x40000021
2055 #define STATUS_WX86_EXCEPTION_CHAIN 0x40000022
2056 #define STATUS_IMAGE_MACHINE_TYPE_MISMATCH_EXE 0x40000023
2057 #define STATUS_NO_YIELD_PERFORMED 0x40000024
2058 #define STATUS_TIMER_RESUME_IGNORED 0x40000025
2059 
2060 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
2061 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
2062 #define STATUS_BREAKPOINT 0x80000003
2063 #define STATUS_SINGLE_STEP 0x80000004
2064 #define STATUS_BUFFER_OVERFLOW 0x80000005
2065 #define STATUS_NO_MORE_FILES 0x80000006
2066 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
2067 
2068 #define STATUS_HANDLES_CLOSED 0x8000000A
2069 #define STATUS_NO_INHERITANCE 0x8000000B
2070 #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
2071 #define STATUS_PARTIAL_COPY 0x8000000D
2072 #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
2073 #define STATUS_DEVICE_POWERED_OFF 0x8000000F
2074 #define STATUS_DEVICE_OFF_LINE 0x80000010
2075 #define STATUS_DEVICE_BUSY 0x80000011
2076 #define STATUS_NO_MORE_EAS 0x80000012
2077 #define STATUS_INVALID_EA_NAME 0x80000013
2078 #define STATUS_EA_LIST_INCONSISTENT 0x80000014
2079 #define STATUS_INVALID_EA_FLAG 0x80000015
2080 #define STATUS_VERIFY_REQUIRED 0x80000016
2081 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017
2082 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
2083 #define STATUS_NO_MORE_ENTRIES 0x8000001A
2084 #define STATUS_FILEMARK_DETECTED 0x8000001B
2085 #define STATUS_MEDIA_CHANGED 0x8000001C
2086 #define STATUS_BUS_RESET 0x8000001D
2087 #define STATUS_END_OF_MEDIA 0x8000001E
2088 #define STATUS_BEGINNING_OF_MEDIA 0x8000001F
2089 #define STATUS_MEDIA_CHECK 0x80000020
2090 #define STATUS_SETMARK_DETECTED 0x80000021
2091 #define STATUS_NO_DATA_DETECTED 0x80000022
2092 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
2093 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
2094 #define STATUS_ALREADY_DISCONNECTED 0x80000025
2095 #define STATUS_LONGJUMP 0x80000026
2096 
2097 #define STATUS_UNSUCCESSFUL 0xC0000001
2098 #define STATUS_NOT_IMPLEMENTED 0xC0000002
2099 #define STATUS_INVALID_INFO_CLASS 0xC0000003
2100 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
2101 #define STATUS_ACCESS_VIOLATION 0xC0000005
2102 #define STATUS_IN_PAGE_ERROR 0xC0000006
2103 #define STATUS_PAGEFILE_QUOTA 0xC0000007
2104 #define STATUS_INVALID_HANDLE 0xC0000008
2105 #define STATUS_BAD_INITIAL_STACK 0xC0000009
2106 #define STATUS_BAD_INITIAL_PC 0xC000000A
2107 #define STATUS_INVALID_CID 0xC000000B
2108 #define STATUS_TIMER_NOT_CANCELED 0xC000000C
2109 #define STATUS_INVALID_PARAMETER 0xC000000D
2110 #define STATUS_NO_SUCH_DEVICE 0xC000000E
2111 #define STATUS_NO_SUCH_FILE 0xC000000F
2112 #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
2113 #define STATUS_END_OF_FILE 0xC0000011
2114 #define STATUS_WRONG_VOLUME 0xC0000012
2115 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
2116 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
2117 #define STATUS_NONEXISTENT_SECTOR 0xC0000015
2118 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
2119 #define STATUS_NO_MEMORY 0xC0000017
2120 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018
2121 #define STATUS_NOT_MAPPED_VIEW 0xC0000019
2122 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A
2123 #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
2124 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
2125 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
2126 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
2127 #define STATUS_INVALID_VIEW_SIZE 0xC000001F
2128 #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
2129 #define STATUS_ALREADY_COMMITTED 0xC0000021
2130 #define STATUS_ACCESS_DENIED 0xC0000022
2131 #define STATUS_BUFFER_TOO_SMALL 0xC0000023
2132 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
2133 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
2134 #define STATUS_INVALID_DISPOSITION 0xC0000026
2135 #define STATUS_UNWIND 0xC0000027
2136 #define STATUS_BAD_STACK 0xC0000028
2137 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029
2138 #define STATUS_NOT_LOCKED 0xC000002A
2139 #define STATUS_PARITY_ERROR 0xC000002B
2140 #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
2141 #define STATUS_NOT_COMMITTED 0xC000002D
2142 #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
2143 #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
2144 #define STATUS_INVALID_PARAMETER_MIX 0xC0000030
2145 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031
2146 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032
2147 #define STATUS_OBJECT_NAME_INVALID 0xC0000033
2148 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
2149 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035
2150 #define STATUS_PORT_DISCONNECTED 0xC0000037
2151 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
2152 #define STATUS_OBJECT_PATH_INVALID 0xC0000039
2153 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
2154 #define STATUS_PATH_SYNTAX_BAD 0xC000003B
2155 #define STATUS_DATA_OVERRUN 0xC000003C
2156 #define STATUS_DATA_LATE_ERROR 0xC000003D
2157 #define STATUS_DATA_ERROR 0xC000003E
2158 #define STATUS_CRC_ERROR 0xC000003F
2159 #define STATUS_SECTION_TOO_BIG 0xC0000040
2160 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
2161 #define STATUS_INVALID_PORT_HANDLE 0xC0000042
2162 #define STATUS_SHARING_VIOLATION 0xC0000043
2163 #define STATUS_QUOTA_EXCEEDED 0xC0000044
2164 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
2165 #define STATUS_MUTANT_NOT_OWNED 0xC0000046
2166 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
2167 #define STATUS_PORT_ALREADY_SET 0xC0000048
2168 #define STATUS_SECTION_NOT_IMAGE 0xC0000049
2169 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
2170 #define STATUS_THREAD_IS_TERMINATING 0xC000004B
2171 #define STATUS_BAD_WORKING_SET_LIMIT 0xC000004C
2172 #define STATUS_INCOMPATIBLE_FILE_MAP 0xC000004D
2173 #define STATUS_SECTION_PROTECTION 0xC000004E
2174 #define STATUS_EAS_NOT_SUPPORTED 0xC000004F
2175 #define STATUS_EA_TOO_LARGE 0xC0000050
2176 #define STATUS_NONEXISTENT_EA_ENTRY 0xC0000051
2177 #define STATUS_NO_EAS_ON_FILE 0xC0000052
2178 #define STATUS_EA_CORRUPT_ERROR 0xC0000053
2179 #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
2180 #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
2181 #define STATUS_DELETE_PENDING 0xC0000056
2182 #define STATUS_CTL_FILE_NOT_SUPPORTED 0xC0000057
2183 #define STATUS_UNKNOWN_REVISION 0xC0000058
2184 #define STATUS_REVISION_MISMATCH 0xC0000059
2185 #define STATUS_INVALID_OWNER 0xC000005A
2186 #define STATUS_INVALID_PRIMARY_GROUP 0xC000005B
2187 #define STATUS_NO_IMPERSONATION_TOKEN 0xC000005C
2188 #define STATUS_CANT_DISABLE_MANDATORY 0xC000005D
2189 #define STATUS_NO_LOGON_SERVERS 0xC000005E
2190 #define STATUS_NO_SUCH_LOGON_SESSION 0xC000005F
2191 #define STATUS_NO_SUCH_PRIVILEGE 0xC0000060
2192 #define STATUS_PRIVILEGE_NOT_HELD 0xC0000061
2193 #define STATUS_INVALID_ACCOUNT_NAME 0xC0000062
2194 #define STATUS_USER_EXISTS 0xC0000063
2195 #define STATUS_NO_SUCH_USER 0xC0000064
2196 #define STATUS_GROUP_EXISTS 0xC0000065
2197 #define STATUS_NO_SUCH_GROUP 0xC0000066
2198 #define STATUS_MEMBER_IN_GROUP 0xC0000067
2199 #define STATUS_MEMBER_NOT_IN_GROUP 0xC0000068
2200 #define STATUS_LAST_ADMIN 0xC0000069
2201 #define STATUS_WRONG_PASSWORD 0xC000006A
2202 #define STATUS_ILL_FORMED_PASSWORD 0xC000006B
2203 #define STATUS_PASSWORD_RESTRICTION 0xC000006C
2204 #define STATUS_LOGON_FAILURE 0xC000006D
2205 #define STATUS_ACCOUNT_RESTRICTION 0xC000006E
2206 #define STATUS_INVALID_LOGON_HOURS 0xC000006F
2207 #define STATUS_INVALID_WORKSTATION 0xC0000070
2208 #define STATUS_PASSWORD_EXPIRED 0xC0000071
2209 #define STATUS_ACCOUNT_DISABLED 0xC0000072
2210 #define STATUS_NONE_MAPPED 0xC0000073
2211 #define STATUS_TOO_MANY_LUIDS_REQUESTED 0xC0000074
2212 #define STATUS_LUIDS_EXHAUSTED 0xC0000075
2213 #define STATUS_INVALID_SUB_AUTHORITY 0xC0000076
2214 #define STATUS_INVALID_ACL 0xC0000077
2215 #define STATUS_INVALID_SID 0xC0000078
2216 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079
2217 #define STATUS_PROCEDURE_NOT_FOUND 0xC000007A
2218 #define STATUS_INVALID_IMAGE_FORMAT 0xC000007B
2219 #define STATUS_NO_TOKEN 0xC000007C
2220 #define STATUS_BAD_INHERITANCE_ACL 0xC000007D
2221 #define STATUS_RANGE_NOT_LOCKED 0xC000007E
2222 #define STATUS_DISK_FULL 0xC000007F
2223 #define STATUS_SERVER_DISABLED 0xC0000080
2224 #define STATUS_SERVER_NOT_DISABLED 0xC0000081
2225 #define STATUS_TOO_MANY_GUIDS_REQUESTED 0xC0000082
2226 #define STATUS_GUIDS_EXHAUSTED 0xC0000083
2227 #define STATUS_INVALID_ID_AUTHORITY 0xC0000084
2228 #define STATUS_AGENTS_EXHAUSTED 0xC0000085
2229 #define STATUS_INVALID_VOLUME_LABEL 0xC0000086
2230 #define STATUS_SECTION_NOT_EXTENDED 0xC0000087
2231 #define STATUS_NOT_MAPPED_DATA 0xC0000088
2232 #define STATUS_RESOURCE_DATA_NOT_FOUND 0xC0000089
2233 #define STATUS_RESOURCE_TYPE_NOT_FOUND 0xC000008A
2234 #define STATUS_RESOURCE_NAME_NOT_FOUND 0xC000008B
2235 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
2236 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
2237 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
2238 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
2239 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
2240 #define STATUS_FLOAT_OVERFLOW 0xC0000091
2241 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
2242 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
2243 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
2244 #define STATUS_INTEGER_OVERFLOW 0xC0000095
2245 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
2246 #define STATUS_TOO_MANY_PAGING_FILES 0xC0000097
2247 #define STATUS_FILE_INVALID 0xC0000098
2248 #define STATUS_ALLOTTED_SPACE_EXCEEDED 0xC0000099
2249 #define STATUS_INSUFFICIENT_RESOURCES 0xC000009A
2250 #define STATUS_DFS_EXIT_PATH_FOUND 0xC000009B
2251 #define STATUS_DEVICE_DATA_ERROR 0xC000009C
2252 #define STATUS_DEVICE_NOT_CONNECTED 0xC000009D
2253 #define STATUS_DEVICE_POWER_FAILURE 0xC000009E
2254 #define STATUS_FREE_VM_NOT_AT_BASE 0xC000009F
2255 #define STATUS_MEMORY_NOT_ALLOCATED 0xC00000A0
2256 #define STATUS_WORKING_SET_QUOTA 0xC00000A1
2257 #define STATUS_MEDIA_WRITE_PROTECTED 0xC00000A2
2258 #define STATUS_DEVICE_NOT_READY 0xC00000A3
2259 #define STATUS_INVALID_GROUP_ATTRIBUTES 0xC00000A4
2260 #define STATUS_BAD_IMPERSONATION_LEVEL 0xC00000A5
2261 #define STATUS_CANT_OPEN_ANONYMOUS 0xC00000A6
2262 #define STATUS_BAD_VALIDATION_CLASS 0xC00000A7
2263 #define STATUS_BAD_TOKEN_TYPE 0xC00000A8
2264 #define STATUS_BAD_MASTER_BOOT_RECORD 0xC00000A9
2265 #define STATUS_INSTRUCTION_MISALIGNMENT 0xC00000AA
2266 #define STATUS_INSTANCE_NOT_AVAILABLE 0xC00000AB
2267 #define STATUS_PIPE_NOT_AVAILABLE 0xC00000AC
2268 #define STATUS_INVALID_PIPE_STATE 0xC00000AD
2269 #define STATUS_PIPE_BUSY 0xC00000AE
2270 #define STATUS_ILLEGAL_FUNCTION 0xC00000AF
2271 #define STATUS_PIPE_DISCONNECTED 0xC00000B0
2272 #define STATUS_PIPE_CLOSING 0xC00000B1
2273 #define STATUS_PIPE_CONNECTED 0xC00000B2
2274 #define STATUS_PIPE_LISTENING 0xC00000B3
2275 #define STATUS_INVALID_READ_MODE 0xC00000B4
2276 #define STATUS_IO_TIMEOUT 0xC00000B5
2277 #define STATUS_FILE_FORCED_CLOSED 0xC00000B6
2278 #define STATUS_PROFILING_NOT_STARTED 0xC00000B7
2279 #define STATUS_PROFILING_NOT_STOPPED 0xC00000B8
2280 #define STATUS_COULD_NOT_INTERPRET 0xC00000B9
2281 #define STATUS_FILE_IS_A_DIRECTORY 0xC00000BA
2282 #define STATUS_NOT_SUPPORTED 0xC00000BB
2283 #define STATUS_REMOTE_NOT_LISTENING 0xC00000BC
2284 #define STATUS_DUPLICATE_NAME 0xC00000BD
2285 #define STATUS_BAD_NETWORK_PATH 0xC00000BE
2286 #define STATUS_NETWORK_BUSY 0xC00000BF
2287 #define STATUS_DEVICE_DOES_NOT_EXIST 0xC00000C0
2288 #define STATUS_TOO_MANY_COMMANDS 0xC00000C1
2289 #define STATUS_ADAPTER_HARDWARE_ERROR 0xC00000C2
2290 #define STATUS_INVALID_NETWORK_RESPONSE 0xC00000C3
2291 #define STATUS_UNEXPECTED_NETWORK_ERROR 0xC00000C4
2292 #define STATUS_BAD_REMOTE_ADAPTER 0xC00000C5
2293 #define STATUS_PRINT_QUEUE_FULL 0xC00000C6
2294 #define STATUS_NO_SPOOL_SPACE 0xC00000C7
2295 #define STATUS_PRINT_CANCELLED 0xC00000C8
2296 #define STATUS_NETWORK_NAME_DELETED 0xC00000C9
2297 #define STATUS_NETWORK_ACCESS_DENIED 0xC00000CA
2298 #define STATUS_BAD_DEVICE_TYPE 0xC00000CB
2299 #define STATUS_BAD_NETWORK_NAME 0xC00000CC
2300 #define STATUS_TOO_MANY_NAMES 0xC00000CD
2301 #define STATUS_TOO_MANY_SESSIONS 0xC00000CE
2302 #define STATUS_SHARING_PAUSED 0xC00000CF
2303 #define STATUS_REQUEST_NOT_ACCEPTED 0xC00000D0
2304 #define STATUS_REDIRECTOR_PAUSED 0xC00000D1
2305 #define STATUS_NET_WRITE_FAULT 0xC00000D2
2306 #define STATUS_PROFILING_AT_LIMIT 0xC00000D3
2307 #define STATUS_NOT_SAME_DEVICE 0xC00000D4
2308 #define STATUS_FILE_RENAMED 0xC00000D5
2309 #define STATUS_VIRTUAL_CIRCUIT_CLOSED 0xC00000D6
2310 #define STATUS_NO_SECURITY_ON_OBJECT 0xC00000D7
2311 #define STATUS_CANT_WAIT 0xC00000D8
2312 #define STATUS_PIPE_EMPTY 0xC00000D9
2313 #define STATUS_CANT_ACCESS_DOMAIN_INFO 0xC00000DA
2314 #define STATUS_CANT_TERMINATE_SELF 0xC00000DB
2315 #define STATUS_INVALID_SERVER_STATE 0xC00000DC
2316 #define STATUS_INVALID_DOMAIN_STATE 0xC00000DD
2317 #define STATUS_INVALID_DOMAIN_ROLE 0xC00000DE
2318 #define STATUS_NO_SUCH_DOMAIN 0xC00000DF
2319 #define STATUS_DOMAIN_EXISTS 0xC00000E0
2320 #define STATUS_DOMAIN_LIMIT_EXCEEDED 0xC00000E1
2321 #define STATUS_OPLOCK_NOT_GRANTED 0xC00000E2
2322 #define STATUS_INVALID_OPLOCK_PROTOCOL 0xC00000E3
2323 #define STATUS_INTERNAL_DB_CORRUPTION 0xC00000E4
2324 #define STATUS_INTERNAL_ERROR 0xC00000E5
2325 #define STATUS_GENERIC_NOT_MAPPED 0xC00000E6
2326 #define STATUS_BAD_DESCRIPTOR_FORMAT 0xC00000E7
2327 #define STATUS_INVALID_USER_BUFFER 0xC00000E8
2328 #define STATUS_UNEXPECTED_IO_ERROR 0xC00000E9
2329 #define STATUS_UNEXPECTED_MM_CREATE_ERR 0xC00000EA
2330 #define STATUS_UNEXPECTED_MM_MAP_ERROR 0xC00000EB
2331 #define STATUS_UNEXPECTED_MM_EXTEND_ERR 0xC00000EC
2332 #define STATUS_NOT_LOGON_PROCESS 0xC00000ED
2333 #define STATUS_LOGON_SESSION_EXISTS 0xC00000EE
2334 #define STATUS_INVALID_PARAMETER_1 0xC00000EF
2335 #define STATUS_INVALID_PARAMETER_2 0xC00000F0
2336 #define STATUS_INVALID_PARAMETER_3 0xC00000F1
2337 #define STATUS_INVALID_PARAMETER_4 0xC00000F2
2338 #define STATUS_INVALID_PARAMETER_5 0xC00000F3
2339 #define STATUS_INVALID_PARAMETER_6 0xC00000F4
2340 #define STATUS_INVALID_PARAMETER_7 0xC00000F5
2341 #define STATUS_INVALID_PARAMETER_8 0xC00000F6
2342 #define STATUS_INVALID_PARAMETER_9 0xC00000F7
2343 #define STATUS_INVALID_PARAMETER_10 0xC00000F8
2344 #define STATUS_INVALID_PARAMETER_11 0xC00000F9
2345 #define STATUS_INVALID_PARAMETER_12 0xC00000FA
2346 #define STATUS_REDIRECTOR_NOT_STARTED 0xC00000FB
2347 #define STATUS_REDIRECTOR_STARTED 0xC00000FC
2348 #define STATUS_STACK_OVERFLOW 0xC00000FD
2349 #define STATUS_BAD_FUNCTION_TABLE 0xC00000FF
2350 #define STATUS_VARIABLE_NOT_FOUND 0xC0000100
2351 #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
2352 #define STATUS_FILE_CORRUPT_ERROR 0xC0000102
2353 #define STATUS_NOT_A_DIRECTORY 0xC0000103
2354 #define STATUS_BAD_LOGON_SESSION_STATE 0xC0000104
2355 #define STATUS_LOGON_SESSION_COLLISION 0xC0000105
2356 #define STATUS_NAME_TOO_LONG 0xC0000106
2357 #define STATUS_FILES_OPEN 0xC0000107
2358 #define STATUS_CONNECTION_IN_USE 0xC0000108
2359 #define STATUS_MESSAGE_NOT_FOUND 0xC0000109
2360 #define STATUS_PROCESS_IS_TERMINATING 0xC000010A
2361 #define STATUS_INVALID_LOGON_TYPE 0xC000010B
2362 #define STATUS_NO_GUID_TRANSLATION 0xC000010C
2363 #define STATUS_CANNOT_IMPERSONATE 0xC000010D
2364 #define STATUS_IMAGE_ALREADY_LOADED 0xC000010E
2365 #define STATUS_ABIOS_NOT_PRESENT 0xC000010F
2366 #define STATUS_ABIOS_LID_NOT_EXIST 0xC0000110
2367 #define STATUS_ABIOS_LID_ALREADY_OWNED 0xC0000111
2368 #define STATUS_ABIOS_NOT_LID_OWNER 0xC0000112
2369 #define STATUS_ABIOS_INVALID_COMMAND 0xC0000113
2370 #define STATUS_ABIOS_INVALID_LID 0xC0000114
2371 #define STATUS_ABIOS_SELECTOR_NOT_AVAILABLE 0xC0000115
2372 #define STATUS_ABIOS_INVALID_SELECTOR 0xC0000116
2373 #define STATUS_NO_LDT 0xC0000117
2374 #define STATUS_INVALID_LDT_SIZE 0xC0000118
2375 #define STATUS_INVALID_LDT_OFFSET 0xC0000119
2376 #define STATUS_INVALID_LDT_DESCRIPTOR 0xC000011A
2377 #define STATUS_INVALID_IMAGE_NE_FORMAT 0xC000011B
2378 #define STATUS_RXACT_INVALID_STATE 0xC000011C
2379 #define STATUS_RXACT_COMMIT_FAILURE 0xC000011D
2380 #define STATUS_MAPPED_FILE_SIZE_ZERO 0xC000011E
2381 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
2382 #define STATUS_CANCELLED 0xC0000120
2383 #define STATUS_CANNOT_DELETE 0xC0000121
2384 #define STATUS_INVALID_COMPUTER_NAME 0xC0000122
2385 #define STATUS_FILE_DELETED 0xC0000123
2386 #define STATUS_SPECIAL_ACCOUNT 0xC0000124
2387 #define STATUS_SPECIAL_GROUP 0xC0000125
2388 #define STATUS_SPECIAL_USER 0xC0000126
2389 #define STATUS_MEMBERS_PRIMARY_GROUP 0xC0000127
2390 #define STATUS_FILE_CLOSED 0xC0000128
2391 #define STATUS_TOO_MANY_THREADS 0xC0000129
2392 #define STATUS_THREAD_NOT_IN_PROCESS 0xC000012A
2393 #define STATUS_TOKEN_ALREADY_IN_USE 0xC000012B
2394 #define STATUS_PAGEFILE_QUOTA_EXCEEDED 0xC000012C
2395 #define STATUS_COMMITMENT_LIMIT 0xC000012D
2396 #define STATUS_INVALID_IMAGE_LE_FORMAT 0xC000012E
2397 #define STATUS_INVALID_IMAGE_NOT_MZ 0xC000012F
2398 #define STATUS_INVALID_IMAGE_PROTECT 0xC0000130
2399 #define STATUS_INVALID_IMAGE_WIN_16 0xC0000131
2400 #define STATUS_LOGON_SERVER_CONFLICT 0xC0000132
2401 #define STATUS_TIME_DIFFERENCE_AT_DC 0xC0000133
2402 #define STATUS_SYNCHRONIZATION_REQUIRED 0xC0000134
2403 #define STATUS_DLL_NOT_FOUND 0xC0000135
2404 #define STATUS_OPEN_FAILED 0xC0000136
2405 #define STATUS_IO_PRIVILEGE_FAILED 0xC0000137
2406 #define STATUS_ORDINAL_NOT_FOUND 0xC0000138
2407 #define STATUS_ENTRYPOINT_NOT_FOUND 0xC0000139
2408 #define STATUS_CONTROL_C_EXIT 0xC000013A
2409 #define STATUS_LOCAL_DISCONNECT 0xC000013B
2410 #define STATUS_REMOTE_DISCONNECT 0xC000013C
2411 #define STATUS_REMOTE_RESOURCES 0xC000013D
2412 #define STATUS_LINK_FAILED 0xC000013E
2413 #define STATUS_LINK_TIMEOUT 0xC000013F
2414 #define STATUS_INVALID_CONNECTION 0xC0000140
2415 #define STATUS_INVALID_ADDRESS 0xC0000141
2416 #define STATUS_DLL_INIT_FAILED 0xC0000142
2417 #define STATUS_MISSING_SYSTEMFILE 0xC0000143
2418 #define STATUS_UNHANDLED_EXCEPTION 0xC0000144
2419 #define STATUS_APP_INIT_FAILURE 0xC0000145
2420 #define STATUS_PAGEFILE_CREATE_FAILED 0xC0000146
2421 #define STATUS_NO_PAGEFILE 0xC0000147
2422 #define STATUS_INVALID_LEVEL 0xC0000148
2423 #define STATUS_WRONG_PASSWORD_CORE 0xC0000149
2424 #define STATUS_ILLEGAL_FLOAT_CONTEXT 0xC000014A
2425 #define STATUS_PIPE_BROKEN 0xC000014B
2426 #define STATUS_REGISTRY_CORRUPT 0xC000014C
2427 #define STATUS_REGISTRY_IO_FAILED 0xC000014D
2428 #define STATUS_NO_EVENT_PAIR 0xC000014E
2429 #define STATUS_UNRECOGNIZED_VOLUME 0xC000014F
2430 #define STATUS_SERIAL_NO_DEVICE_INITED 0xC0000150
2431 #define STATUS_NO_SUCH_ALIAS 0xC0000151
2432 #define STATUS_MEMBER_NOT_IN_ALIAS 0xC0000152
2433 #define STATUS_MEMBER_IN_ALIAS 0xC0000153
2434 #define STATUS_ALIAS_EXISTS 0xC0000154
2435 #define STATUS_LOGON_NOT_GRANTED 0xC0000155
2436 #define STATUS_TOO_MANY_SECRETS 0xC0000156
2437 #define STATUS_SECRET_TOO_LONG 0xC0000157
2438 #define STATUS_INTERNAL_DB_ERROR 0xC0000158
2439 #define STATUS_FULLSCREEN_MODE 0xC0000159
2440 #define STATUS_TOO_MANY_CONTEXT_IDS 0xC000015A
2441 #define STATUS_LOGON_TYPE_NOT_GRANTED 0xC000015B
2442 #define STATUS_NOT_REGISTRY_FILE 0xC000015C
2443 #define STATUS_NT_CROSS_ENCRYPTION_REQUIRED 0xC000015D
2444 #define STATUS_DOMAIN_CTRLR_CONFIG_ERROR 0xC000015E
2445 #define STATUS_FT_MISSING_MEMBER 0xC000015F
2446 #define STATUS_ILL_FORMED_SERVICE_ENTRY 0xC0000160
2447 #define STATUS_ILLEGAL_CHARACTER 0xC0000161
2448 #define STATUS_UNMAPPABLE_CHARACTER 0xC0000162
2449 #define STATUS_UNDEFINED_CHARACTER 0xC0000163
2450 #define STATUS_FLOPPY_VOLUME 0xC0000164
2451 #define STATUS_FLOPPY_ID_MARK_NOT_FOUND 0xC0000165
2452 #define STATUS_FLOPPY_WRONG_CYLINDER 0xC0000166
2453 #define STATUS_FLOPPY_UNKNOWN_ERROR 0xC0000167
2454 #define STATUS_FLOPPY_BAD_REGISTERS 0xC0000168
2455 #define STATUS_DISK_RECALIBRATE_FAILED 0xC0000169
2456 #define STATUS_DISK_OPERATION_FAILED 0xC000016A
2457 #define STATUS_DISK_RESET_FAILED 0xC000016B
2458 #define STATUS_SHARED_IRQ_BUSY 0xC000016C
2459 #define STATUS_FT_ORPHANING 0xC000016D
2460 #define STATUS_BIOS_FAILED_TO_CONNECT_INTERRUPT 0xC000016E
2461 
2462 #define STATUS_PARTITION_FAILURE 0xC0000172
2463 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
2464 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
2465 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
2466 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
2467 #define STATUS_EOM_OVERFLOW 0xC0000177
2468 #define STATUS_NO_MEDIA 0xC0000178
2469 #define STATUS_NO_SUCH_MEMBER 0xC000017A
2470 #define STATUS_INVALID_MEMBER 0xC000017B
2471 #define STATUS_KEY_DELETED 0xC000017C
2472 #define STATUS_NO_LOG_SPACE 0xC000017D
2473 #define STATUS_TOO_MANY_SIDS 0xC000017E
2474 #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
2475 #define STATUS_KEY_HAS_CHILDREN 0xC0000180
2476 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
2477 #define STATUS_DEVICE_CONFIGURATION_ERROR 0xC0000182
2478 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
2479 #define STATUS_INVALID_DEVICE_STATE 0xC0000184
2480 #define STATUS_IO_DEVICE_ERROR 0xC0000185
2481 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
2482 #define STATUS_BACKUP_CONTROLLER 0xC0000187
2483 #define STATUS_LOG_FILE_FULL 0xC0000188
2484 #define STATUS_TOO_LATE 0xC0000189
2485 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
2486 #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
2487 #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
2488 #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
2489 #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
2490 #define STATUS_EVENTLOG_CANT_START 0xC000018F
2491 #define STATUS_TRUST_FAILURE 0xC0000190
2492 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
2493 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192
2494 #define STATUS_ACCOUNT_EXPIRED 0xC0000193
2495 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194
2496 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
2497 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
2498 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
2499 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
2500 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
2501 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
2502 #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
2503 #define STATUS_FS_DRIVER_REQUIRED 0xC000019C
2504 
2505 #define STATUS_NO_USER_SESSION_KEY 0xC0000202
2506 #define STATUS_USER_SESSION_DELETED 0xC0000203
2507 #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
2508 #define STATUS_INSUFF_SERVER_RESOURCES 0xC0000205
2509 #define STATUS_INVALID_BUFFER_SIZE 0xC0000206
2510 #define STATUS_INVALID_ADDRESS_COMPONENT 0xC0000207
2511 #define STATUS_INVALID_ADDRESS_WILDCARD 0xC0000208
2512 #define STATUS_TOO_MANY_ADDRESSES 0xC0000209
2513 #define STATUS_ADDRESS_ALREADY_EXISTS 0xC000020A
2514 #define STATUS_ADDRESS_CLOSED 0xC000020B
2515 #define STATUS_CONNECTION_DISCONNECTED 0xC000020C
2516 #define STATUS_CONNECTION_RESET 0xC000020D
2517 #define STATUS_TOO_MANY_NODES 0xC000020E
2518 #define STATUS_TRANSACTION_ABORTED 0xC000020F
2519 #define STATUS_TRANSACTION_TIMED_OUT 0xC0000210
2520 #define STATUS_TRANSACTION_NO_RELEASE 0xC0000211
2521 #define STATUS_TRANSACTION_NO_MATCH 0xC0000212
2522 #define STATUS_TRANSACTION_RESPONDED 0xC0000213
2523 #define STATUS_TRANSACTION_INVALID_ID 0xC0000214
2524 #define STATUS_TRANSACTION_INVALID_TYPE 0xC0000215
2525 #define STATUS_NOT_SERVER_SESSION 0xC0000216
2526 #define STATUS_NOT_CLIENT_SESSION 0xC0000217
2527 #define STATUS_CANNOT_LOAD_REGISTRY_FILE 0xC0000218
2528 #define STATUS_DEBUG_ATTACH_FAILED 0xC0000219
2529 #define STATUS_SYSTEM_PROCESS_TERMINATED 0xC000021A
2530 #define STATUS_DATA_NOT_ACCEPTED 0xC000021B
2531 #define STATUS_NO_BROWSER_SERVERS_FOUND 0xC000021C
2532 #define STATUS_VDM_HARD_ERROR 0xC000021D
2533 #define STATUS_DRIVER_CANCEL_TIMEOUT 0xC000021E
2534 #define STATUS_REPLY_MESSAGE_MISMATCH 0xC000021F
2535 #define STATUS_MAPPED_ALIGNMENT 0xC0000220
2536 #define STATUS_IMAGE_CHECKSUM_MISMATCH 0xC0000221
2537 #define STATUS_LOST_WRITEBEHIND_DATA 0xC0000222
2538 #define STATUS_CLIENT_SERVER_PARAMETERS_INVALID 0xC0000223
2539 #define STATUS_PASSWORD_MUST_CHANGE 0xC0000224
2540 #define STATUS_NOT_FOUND 0xC0000225
2541 #define STATUS_NOT_TINY_STREAM 0xC0000226
2542 #define STATUS_RECOVERY_FAILURE 0xC0000227
2543 #define STATUS_STACK_OVERFLOW_READ 0xC0000228
2544 #define STATUS_FAIL_CHECK 0xC0000229
2545 #define STATUS_DUPLICATE_OBJECTID 0xC000022A
2546 #define STATUS_OBJECTID_EXISTS 0xC000022B
2547 #define STATUS_CONVERT_TO_LARGE 0xC000022C
2548 #define STATUS_RETRY 0xC000022D
2549 #define STATUS_FOUND_OUT_OF_SCOPE 0xC000022E
2550 #define STATUS_ALLOCATE_BUCKET 0xC000022F
2551 #define STATUS_PROPSET_NOT_FOUND 0xC0000230
2552 #define STATUS_MARSHALL_OVERFLOW 0xC0000231
2553 #define STATUS_INVALID_VARIANT 0xC0000232
2554 #define STATUS_DOMAIN_CONTROLLER_NOT_FOUND 0xC0000233
2555 #define STATUS_ACCOUNT_LOCKED_OUT 0xC0000234
2556 #define STATUS_HANDLE_NOT_CLOSABLE 0xC0000235
2557 #define STATUS_CONNECTION_REFUSED 0xC0000236
2558 #define STATUS_GRACEFUL_DISCONNECT 0xC0000237
2559 #define STATUS_ADDRESS_ALREADY_ASSOCIATED 0xC0000238
2560 #define STATUS_ADDRESS_NOT_ASSOCIATED 0xC0000239
2561 #define STATUS_CONNECTION_INVALID 0xC000023A
2562 #define STATUS_CONNECTION_ACTIVE 0xC000023B
2563 #define STATUS_NETWORK_UNREACHABLE 0xC000023C
2564 #define STATUS_HOST_UNREACHABLE 0xC000023D
2565 #define STATUS_PROTOCOL_UNREACHABLE 0xC000023E
2566 #define STATUS_PORT_UNREACHABLE 0xC000023F
2567 #define STATUS_REQUEST_ABORTED 0xC0000240
2568 #define STATUS_CONNECTION_ABORTED 0xC0000241
2569 #define STATUS_BAD_COMPRESSION_BUFFER 0xC0000242
2570 #define STATUS_USER_MAPPED_FILE 0xC0000243
2571 #define STATUS_AUDIT_FAILED 0xC0000244
2572 #define STATUS_TIMER_RESOLUTION_NOT_SET 0xC0000245
2573 #define STATUS_CONNECTION_COUNT_LIMIT 0xC0000246
2574 #define STATUS_LOGIN_TIME_RESTRICTION 0xC0000247
2575 #define STATUS_LOGIN_WKSTA_RESTRICTION 0xC0000248
2576 #define STATUS_IMAGE_MP_UP_MISMATCH 0xC0000249
2577 #define STATUS_INSUFFICIENT_LOGON_INFO 0xC0000250
2578 #define STATUS_BAD_DLL_ENTRYPOINT 0xC0000251
2579 #define STATUS_BAD_SERVICE_ENTRYPOINT 0xC0000252
2580 #define STATUS_LPC_REPLY_LOST 0xC0000253
2581 #define STATUS_IP_ADDRESS_CONFLICT1 0xC0000254
2582 #define STATUS_IP_ADDRESS_CONFLICT2 0xC0000255
2583 #define STATUS_REGISTRY_QUOTA_LIMIT 0xC0000256
2584 #define STATUS_PATH_NOT_COVERED 0xC0000257
2585 #define STATUS_NO_CALLBACK_ACTIVE 0xC0000258
2586 #define STATUS_LICENSE_QUOTA_EXCEEDED 0xC0000259
2587 #define STATUS_PWD_TOO_SHORT 0xC000025A
2588 #define STATUS_PWD_TOO_RECENT 0xC000025B
2589 #define STATUS_PWD_HISTORY_CONFLICT 0xC000025C
2590 #define STATUS_PLUGPLAY_NO_DEVICE 0xC000025E
2591 #define STATUS_UNSUPPORTED_COMPRESSION 0xC000025F
2592 #define STATUS_INVALID_HW_PROFILE 0xC0000260
2593 #define STATUS_INVALID_PLUGPLAY_DEVICE_PATH 0xC0000261
2594 #define STATUS_DRIVER_ORDINAL_NOT_FOUND 0xC0000262
2595 #define STATUS_DRIVER_ENTRYPOINT_NOT_FOUND 0xC0000263
2596 #define STATUS_RESOURCE_NOT_OWNED 0xC0000264
2597 #define STATUS_TOO_MANY_LINKS 0xC0000265
2598 #define STATUS_QUOTA_LIST_INCONSISTENT 0xC0000266
2599 #define STATUS_FILE_IS_OFFLINE 0xC0000267
2600 #define STATUS_EVALUATION_EXPIRATION 0xC0000268
2601 #define STATUS_ILLEGAL_DLL_RELOCATION 0xC0000269
2602 #define STATUS_LICENSE_VIOLATION 0xC000026A
2603 #define STATUS_DLL_INIT_FAILED_LOGOFF 0xC000026B
2604 #define STATUS_DRIVER_UNABLE_TO_LOAD 0xC000026C
2605 #define STATUS_DFS_UNAVAILABLE 0xC000026D
2606 #define STATUS_VOLUME_DISMOUNTED 0xC000026E
2607 #define STATUS_WX86_INTERNAL_ERROR 0xC000026F
2608 #define STATUS_WX86_FLOAT_STACK_CHECK 0xC0000270
2609 #define STATUS_WOW_ASSERTION 0xC0009898
2610 #define RPC_NT_INVALID_STRING_BINDING 0xC0020001
2611 #define RPC_NT_WRONG_KIND_OF_BINDING 0xC0020002
2612 #define RPC_NT_INVALID_BINDING 0xC0020003
2613 #define RPC_NT_PROTSEQ_NOT_SUPPORTED 0xC0020004
2614 #define RPC_NT_INVALID_RPC_PROTSEQ 0xC0020005
2615 #define RPC_NT_INVALID_STRING_UUID 0xC0020006
2616 #define RPC_NT_INVALID_ENDPOINT_FORMAT 0xC0020007
2617 #define RPC_NT_INVALID_NET_ADDR 0xC0020008
2618 #define RPC_NT_NO_ENDPOINT_FOUND 0xC0020009
2619 #define RPC_NT_INVALID_TIMEOUT 0xC002000A
2620 #define RPC_NT_OBJECT_NOT_FOUND 0xC002000B
2621 #define RPC_NT_ALREADY_REGISTERED 0xC002000C
2622 #define RPC_NT_TYPE_ALREADY_REGISTERED 0xC002000D
2623 #define RPC_NT_ALREADY_LISTENING 0xC002000E
2624 #define RPC_NT_NO_PROTSEQS_REGISTERED 0xC002000F
2625 #define RPC_NT_NOT_LISTENING 0xC0020010
2626 #define RPC_NT_UNKNOWN_MGR_TYPE 0xC0020011
2627 #define RPC_NT_UNKNOWN_IF 0xC0020012
2628 #define RPC_NT_NO_BINDINGS 0xC0020013
2629 #define RPC_NT_NO_PROTSEQS 0xC0020014
2630 #define RPC_NT_CANT_CREATE_ENDPOINT 0xC0020015
2631 #define RPC_NT_OUT_OF_RESOURCES 0xC0020016
2632 #define RPC_NT_SERVER_UNAVAILABLE 0xC0020017
2633 #define RPC_NT_SERVER_TOO_BUSY 0xC0020018
2634 #define RPC_NT_INVALID_NETWORK_OPTIONS 0xC0020019
2635 #define RPC_NT_NO_CALL_ACTIVE 0xC002001A
2636 #define RPC_NT_CALL_FAILED 0xC002001B
2637 #define RPC_NT_CALL_FAILED_DNE 0xC002001C
2638 #define RPC_NT_PROTOCOL_ERROR 0xC002001D
2639 #define RPC_NT_UNSUPPORTED_TRANS_SYN 0xC002001F
2640 #define RPC_NT_UNSUPPORTED_TYPE 0xC0020021
2641 #define RPC_NT_INVALID_TAG 0xC0020022
2642 #define RPC_NT_INVALID_BOUND 0xC0020023
2643 #define RPC_NT_NO_ENTRY_NAME 0xC0020024
2644 #define RPC_NT_INVALID_NAME_SYNTAX 0xC0020025
2645 #define RPC_NT_UNSUPPORTED_NAME_SYNTAX 0xC0020026
2646 #define RPC_NT_UUID_NO_ADDRESS 0xC0020028
2647 #define RPC_NT_DUPLICATE_ENDPOINT 0xC0020029
2648 #define RPC_NT_UNKNOWN_AUTHN_TYPE 0xC002002A
2649 #define RPC_NT_MAX_CALLS_TOO_SMALL 0xC002002B
2650 #define RPC_NT_STRING_TOO_LONG 0xC002002C
2651 #define RPC_NT_PROTSEQ_NOT_FOUND 0xC002002D
2652 #define RPC_NT_PROCNUM_OUT_OF_RANGE 0xC002002E
2653 #define RPC_NT_BINDING_HAS_NO_AUTH 0xC002002F
2654 #define RPC_NT_UNKNOWN_AUTHN_SERVICE 0xC0020030
2655 #define RPC_NT_UNKNOWN_AUTHN_LEVEL 0xC0020031
2656 #define RPC_NT_INVALID_AUTH_IDENTITY 0xC0020032
2657 #define RPC_NT_UNKNOWN_AUTHZ_SERVICE 0xC0020033
2658 #define EPT_NT_INVALID_ENTRY 0xC0020034
2659 #define EPT_NT_CANT_PERFORM_OP 0xC0020035
2660 #define EPT_NT_NOT_REGISTERED 0xC0020036
2661 #define RPC_NT_NOTHING_TO_EXPORT 0xC0020037
2662 #define RPC_NT_INCOMPLETE_NAME 0xC0020038
2663 #define RPC_NT_INVALID_VERS_OPTION 0xC0020039
2664 #define RPC_NT_NO_MORE_MEMBERS 0xC002003A
2665 #define RPC_NT_NOT_ALL_OBJS_UNEXPORTED 0xC002003B
2666 #define RPC_NT_INTERFACE_NOT_FOUND 0xC002003C
2667 #define RPC_NT_ENTRY_ALREADY_EXISTS 0xC002003D
2668 #define RPC_NT_ENTRY_NOT_FOUND 0xC002003E
2669 #define RPC_NT_NAME_SERVICE_UNAVAILABLE 0xC002003F
2670 #define RPC_NT_INVALID_NAF_ID 0xC0020040
2671 #define RPC_NT_CANNOT_SUPPORT 0xC0020041
2672 #define RPC_NT_NO_CONTEXT_AVAILABLE 0xC0020042
2673 #define RPC_NT_INTERNAL_ERROR 0xC0020043
2674 #define RPC_NT_ZERO_DIVIDE 0xC0020044
2675 #define RPC_NT_ADDRESS_ERROR 0xC0020045
2676 #define RPC_NT_FP_DIV_ZERO 0xC0020046
2677 #define RPC_NT_FP_UNDERFLOW 0xC0020047
2678 #define RPC_NT_FP_OVERFLOW 0xC0020048
2679 #define RPC_NT_NO_MORE_ENTRIES 0xC0030001
2680 #define RPC_NT_SS_CHAR_TRANS_OPEN_FAIL 0xC0030002
2681 #define RPC_NT_SS_CHAR_TRANS_SHORT_FILE 0xC0030003
2682 #define RPC_NT_SS_IN_NULL_CONTEXT 0xC0030004
2683 #define RPC_NT_SS_CONTEXT_MISMATCH 0xC0030005
2684 #define RPC_NT_SS_CONTEXT_DAMAGED 0xC0030006
2685 #define RPC_NT_SS_HANDLES_MISMATCH 0xC0030007
2686 #define RPC_NT_SS_CANNOT_GET_CALL_HANDLE 0xC0030008
2687 #define RPC_NT_NULL_REF_POINTER 0xC0030009
2688 #define RPC_NT_ENUM_VALUE_OUT_OF_RANGE 0xC003000A
2689 #define RPC_NT_BYTE_COUNT_TOO_SMALL 0xC003000B
2690 #define RPC_NT_BAD_STUB_DATA 0xC003000C
2691 #define RPC_NT_CALL_IN_PROGRESS 0xC0020049
2692 #define RPC_NT_NO_MORE_BINDINGS 0xC002004A
2693 #define RPC_NT_GROUP_MEMBER_NOT_FOUND 0xC002004B
2694 #define EPT_NT_CANT_CREATE 0xC002004C
2695 #define RPC_NT_INVALID_OBJECT 0xC002004D
2696 #define RPC_NT_NO_INTERFACES 0xC002004F
2697 #define RPC_NT_CALL_CANCELLED 0xC0020050
2698 #define RPC_NT_BINDING_INCOMPLETE 0xC0020051
2699 #define RPC_NT_COMM_FAILURE 0xC0020052
2700 #define RPC_NT_UNSUPPORTED_AUTHN_LEVEL 0xC0020053
2701 #define RPC_NT_NO_PRINC_NAME 0xC0020054
2702 #define RPC_NT_NOT_RPC_ERROR 0xC0020055
2703 #define RPC_NT_UUID_LOCAL_ONLY 0x40020056
2704 #define RPC_NT_SEC_PKG_ERROR 0xC0020057
2705 #define RPC_NT_NOT_CANCELLED 0xC0020058
2706 #define RPC_NT_INVALID_ES_ACTION 0xC0030059
2707 #define RPC_NT_WRONG_ES_VERSION 0xC003005A
2708 #define RPC_NT_WRONG_STUB_VERSION 0xC003005B
2709 #define RPC_NT_INVALID_PIPE_OBJECT 0xC003005C
2710 #define RPC_NT_INVALID_PIPE_OPERATION 0xC003005D
2711 #define RPC_NT_WRONG_PIPE_VERSION 0xC003005E
2712 #define RPC_NT_SEND_INCOMPLETE 0x400200AF
2713 
2714 #define MAXIMUM_WAIT_OBJECTS 64
2715 #define MAXIMUM_SUSPEND_COUNT 127
2716 
2717 
2718 /*
2719  * Return values from the actual exception handlers
2720  */
2721 
2722 #define ExceptionContinueExecution 0
2723 #define ExceptionContinueSearch 1
2724 #define ExceptionNestedException 2
2725 #define ExceptionCollidedUnwind 3
2726 
2727 /*
2728  * Return values from filters in except() and from UnhandledExceptionFilter
2729  */
2730 
2731 #define EXCEPTION_EXECUTE_HANDLER 1
2732 #define EXCEPTION_CONTINUE_SEARCH 0
2733 #define EXCEPTION_CONTINUE_EXECUTION -1
2734 
2735 /*
2736  * From OS/2 2.0 exception handling
2737  * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
2738  */
2739 
2740 #define EH_NONCONTINUABLE 0x01
2741 #define EH_UNWINDING 0x02
2742 #define EH_EXIT_UNWIND 0x04
2743 #define EH_STACK_INVALID 0x08
2744 #define EH_NESTED_CALL 0x10
2745 
2746 #define EXCEPTION_CONTINUABLE 0
2747 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
2748 
2749 /*
2750  * The exception record used by Win32 to give additional information
2751  * about exception to exception handlers.
2752  */
2753 
2754 #define EXCEPTION_MAXIMUM_PARAMETERS 15
2755 
2756 typedef struct __EXCEPTION_RECORD
2757 {
2758  DWORD ExceptionCode;
2759  DWORD ExceptionFlags;
2760  struct __EXCEPTION_RECORD *ExceptionRecord;
2761 
2762  LPVOID ExceptionAddress;
2763  DWORD NumberParameters;
2764  DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
2765 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
2766 
2767 /*
2768  * The exception pointers structure passed to exception filters
2769  * in except() and the UnhandledExceptionFilter().
2770  */
2771 
2772 typedef struct _EXCEPTION_POINTERS
2773 {
2774  PEXCEPTION_RECORD ExceptionRecord;
2775  PCONTEXT ContextRecord;
2776 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
2777 
2778 
2779 /*
2780  * The exception frame, used for registering exception handlers
2781  * Win32 cares only about this, but compilers generally emit
2782  * larger exception frames for their own use.
2783  */
2784 
2785 struct __EXCEPTION_FRAME;
2786 
2787 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*,
2788  PCONTEXT,struct __EXCEPTION_FRAME **);
2789 
2790 typedef struct __EXCEPTION_FRAME
2791 {
2792  struct __EXCEPTION_FRAME *Prev;
2793  PEXCEPTION_HANDLER Handler;
2794 } EXCEPTION_FRAME, *PEXCEPTION_FRAME;
2795 
2796 /*
2797  * function pointer to a exception filter
2798  */
2799 
2800 typedef LONG CALLBACK (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
2801 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
2802 
2803 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
2804 LPTOP_LEVEL_EXCEPTION_FILTER
2805 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
2806 
2807 /* status values for ContinueDebugEvent */
2808 #define DBG_CONTINUE 0x00010002
2809 #define DBG_TERMINATE_THREAD 0x40010003
2810 #define DBG_TERMINATE_PROCESS 0x40010004
2811 #define DBG_CONTROL_C 0x40010005
2812 #define DBG_CONTROL_BREAK 0x40010008
2813 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
2814 
2815 typedef struct _NT_TIB
2816 {
2817  struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
2818  PVOID StackBase;
2819  PVOID StackLimit;
2820  PVOID SubSystemTib;
2821  union {
2822  PVOID FiberData;
2823  DWORD Version;
2824  } DUMMYUNIONNAME;
2825  PVOID ArbitraryUserPointer;
2826  struct _NT_TIB *Self;
2827 } NT_TIB, *PNT_TIB;
2828 
2829 struct _TEB;
2830 
2831 #if defined(__i386__) && defined(__GNUC__) && !defined(__CHECKER__)
2832 extern inline struct _TEB WINAPI *NtCurrentTeb(void);
2833 extern inline struct _TEB WINAPI *NtCurrentTeb(void)
2834 {
2835  struct _TEB *teb;
2836  __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
2837  return teb;
2838 }
2839 #else
2840 extern struct _TEB WINAPI *NtCurrentTeb(void);
2841 #endif
2842 
2843 
2844 /*
2845  * File formats definitions
2846  */
2847 
2848 typedef struct _IMAGE_DOS_HEADER {
2849  WORD e_magic; /* 00: MZ Header signature */
2850  WORD e_cblp; /* 02: Bytes on last page of file */
2851  WORD e_cp; /* 04: Pages in file */
2852  WORD e_crlc; /* 06: Relocations */
2853  WORD e_cparhdr; /* 08: Size of header in paragraphs */
2854  WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2855  WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2856  WORD e_ss; /* 0e: Initial (relative) SS value */
2857  WORD e_sp; /* 10: Initial SP value */
2858  WORD e_csum; /* 12: Checksum */
2859  WORD e_ip; /* 14: Initial IP value */
2860  WORD e_cs; /* 16: Initial (relative) CS value */
2861  WORD e_lfarlc; /* 18: File address of relocation table */
2862  WORD e_ovno; /* 1a: Overlay number */
2863  WORD e_res[4]; /* 1c: Reserved words */
2864  WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2865  WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2866  WORD e_res2[10]; /* 28: Reserved words */
2867  DWORD e_lfanew; /* 3c: Offset to extended header */
2868 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2869 
2870 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2871 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2872 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2873 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2874 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2875 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2876 
2877 /*
2878  * This is the Windows executable (NE) header.
2879  * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2880  */
2881 typedef struct
2882 {
2883  WORD ne_magic; /* 00 NE signature 'NE' */
2884  BYTE ne_ver; /* 02 Linker version number */
2885  BYTE ne_rev; /* 03 Linker revision number */
2886  WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2887  WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2888  LONG ne_crc; /* 08 Checksum */
2889  WORD ne_flags; /* 0c Flags about segments in this file */
2890  WORD ne_autodata; /* 0e Automatic data segment number */
2891  WORD ne_heap; /* 10 Initial size of local heap */
2892  WORD ne_stack; /* 12 Initial size of stack */
2893  DWORD ne_csip; /* 14 Initial CS:IP */
2894  DWORD ne_sssp; /* 18 Initial SS:SP */
2895  WORD ne_cseg; /* 1c # of entries in segment table */
2896  WORD ne_cmod; /* 1e # of entries in module reference tab. */
2897  WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2898  WORD ne_segtab; /* 22 Offset to segment table */
2899  WORD ne_rsrctab; /* 24 Offset to resource table */
2900  WORD ne_restab; /* 26 Offset to resident-name table */
2901  WORD ne_modtab; /* 28 Offset to module reference table */
2902  WORD ne_imptab; /* 2a Offset to imported name table */
2903  DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2904  WORD ne_cmovent; /* 30 # of movable entry points */
2905  WORD ne_align; /* 32 Logical sector alignment shift count */
2906  WORD ne_cres; /* 34 # of resource segments */
2907  BYTE ne_exetyp; /* 36 Flags indicating target OS */
2908  BYTE ne_flagsothers; /* 37 Additional information flags */
2909  WORD fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/
2910  WORD fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */
2911  WORD ne_swaparea; /* 3c Reserved by Microsoft */
2912  WORD ne_expver; /* 3e Expected Windows version number */
2913 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
2914 
2915 typedef struct _IMAGE_VXD_HEADER {
2916  WORD e32_magic;
2917  BYTE e32_border;
2918  BYTE e32_worder;
2919  DWORD e32_level;
2920  WORD e32_cpu;
2921  WORD e32_os;
2922  DWORD e32_ver;
2923  DWORD e32_mflags;
2924  DWORD e32_mpages;
2925  DWORD e32_startobj;
2926  DWORD e32_eip;
2927  DWORD e32_stackobj;
2928  DWORD e32_esp;
2929  DWORD e32_pagesize;
2930  DWORD e32_lastpagesize;
2931  DWORD e32_fixupsize;
2932  DWORD e32_fixupsum;
2933  DWORD e32_ldrsize;
2934  DWORD e32_ldrsum;
2935  DWORD e32_objtab;
2936  DWORD e32_objcnt;
2937  DWORD e32_objmap;
2938  DWORD e32_itermap;
2939  DWORD e32_rsrctab;
2940  DWORD e32_rsrccnt;
2941  DWORD e32_restab;
2942  DWORD e32_enttab;
2943  DWORD e32_dirtab;
2944  DWORD e32_dircnt;
2945  DWORD e32_fpagetab;
2946  DWORD e32_frectab;
2947  DWORD e32_impmod;
2948  DWORD e32_impmodcnt;
2949  DWORD e32_impproc;
2950  DWORD e32_pagesum;
2951  DWORD e32_datapage;
2952  DWORD e32_preload;
2953  DWORD e32_nrestab;
2954  DWORD e32_cbnrestab;
2955  DWORD e32_nressum;
2956  DWORD e32_autodata;
2957  DWORD e32_debuginfo;
2958  DWORD e32_debuglen;
2959  DWORD e32_instpreload;
2960  DWORD e32_instdemand;
2961  DWORD e32_heapsize;
2962  BYTE e32_res3[12];
2963  DWORD e32_winresoff;
2964  DWORD e32_winreslen;
2965  WORD e32_devid;
2966  WORD e32_ddkver;
2967 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2968 
2969 
2970 /* These defines describe the meanings of the bits in the Characteristics
2971  field */
2972 
2973 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2974 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2975 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2976 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2977 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2978 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2979 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2980 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2981 #define IMAGE_FILE_SYSTEM 0x1000
2982 #define IMAGE_FILE_DLL 0x2000
2983 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2984 
2985 /* These are the settings of the Machine field. */
2986 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2987 #define IMAGE_FILE_MACHINE_I860 0x14d
2988 #define IMAGE_FILE_MACHINE_I386 0x14c
2989 #define IMAGE_FILE_MACHINE_R3000 0x162
2990 #define IMAGE_FILE_MACHINE_R4000 0x166
2991 #define IMAGE_FILE_MACHINE_R10000 0x168
2992 #define IMAGE_FILE_MACHINE_ALPHA 0x184
2993 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
2994 
2995 #define IMAGE_SIZEOF_FILE_HEADER 20
2996 
2997 /* Possible Magic values */
2998 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
2999 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
3000 
3001 /* These are indexes into the DataDirectory array */
3002 #define IMAGE_FILE_EXPORT_DIRECTORY 0
3003 #define IMAGE_FILE_IMPORT_DIRECTORY 1
3004 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
3005 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
3006 #define IMAGE_FILE_SECURITY_DIRECTORY 4
3007 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
3008 #define IMAGE_FILE_DEBUG_DIRECTORY 6
3009 #define IMAGE_FILE_DESCRIPTION_STRING 7
3010 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
3011 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
3012 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
3013 
3014 /* Directory Entries, indices into the DataDirectory array */
3015 
3016 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
3017 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
3018 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
3019 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
3020 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
3021 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
3022 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
3023 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
3024 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
3025 #define IMAGE_DIRECTORY_ENTRY_TLS 9
3026 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
3027 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
3028 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
3029 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
3030 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
3031 
3032 /* Subsystem Values */
3033 
3034 #define IMAGE_SUBSYSTEM_UNKNOWN 0
3035 #define IMAGE_SUBSYSTEM_NATIVE 1
3036 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
3037 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
3038 #define IMAGE_SUBSYSTEM_OS2_CUI 5
3039 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
3040 
3041 typedef struct _IMAGE_FILE_HEADER {
3042  WORD Machine;
3043  WORD NumberOfSections;
3044  DWORD TimeDateStamp;
3045  DWORD PointerToSymbolTable;
3046  DWORD NumberOfSymbols;
3047  WORD SizeOfOptionalHeader;
3048  WORD Characteristics;
3049 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
3050 
3051 typedef struct _IMAGE_DATA_DIRECTORY {
3052  DWORD VirtualAddress;
3053  DWORD Size;
3054 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
3055 
3056 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
3057 
3058 typedef struct _IMAGE_OPTIONAL_HEADER {
3059 
3060  /* Standard fields */
3061 
3062  WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
3063  BYTE MajorLinkerVersion;
3064  BYTE MinorLinkerVersion;
3065  DWORD SizeOfCode;
3066  DWORD SizeOfInitializedData;
3067  DWORD SizeOfUninitializedData;
3068  DWORD AddressOfEntryPoint; /* 0x10 */
3069  DWORD BaseOfCode;
3070  DWORD BaseOfData;
3071 
3072  /* NT additional fields */
3073 
3074  DWORD ImageBase;
3075  DWORD SectionAlignment; /* 0x20 */
3076  DWORD FileAlignment;
3077  WORD MajorOperatingSystemVersion;
3078  WORD MinorOperatingSystemVersion;
3079  WORD MajorImageVersion;
3080  WORD MinorImageVersion;
3081  WORD MajorSubsystemVersion; /* 0x30 */
3082  WORD MinorSubsystemVersion;
3083  DWORD Win32VersionValue;
3084  DWORD SizeOfImage;
3085  DWORD SizeOfHeaders;
3086  DWORD CheckSum; /* 0x40 */
3087  WORD Subsystem;
3088  WORD DllCharacteristics;
3089  DWORD SizeOfStackReserve;
3090  DWORD SizeOfStackCommit;
3091  DWORD SizeOfHeapReserve; /* 0x50 */
3092  DWORD SizeOfHeapCommit;
3093  DWORD LoaderFlags;
3094  DWORD NumberOfRvaAndSizes;
3095  IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
3096 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
3097 
3098 typedef struct _IMAGE_NT_HEADERS {
3099  DWORD Signature; /* "PE"\0\0 */
3100  IMAGE_FILE_HEADER FileHeader;
3101  IMAGE_OPTIONAL_HEADER OptionalHeader;
3102 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
3103 
3104 #define IMAGE_SIZEOF_SHORT_NAME 8
3105 
3106 typedef struct _IMAGE_SECTION_HEADER {
3107  BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
3108  union {
3109  DWORD PhysicalAddress;
3110  DWORD VirtualSize;
3111  } Misc;
3112  DWORD VirtualAddress;
3113  DWORD SizeOfRawData;
3114  DWORD PointerToRawData;
3115  DWORD PointerToRelocations;
3116  DWORD PointerToLinenumbers;
3117  WORD NumberOfRelocations;
3118  WORD NumberOfLinenumbers;
3119  DWORD Characteristics;
3120 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
3121 
3122 #define IMAGE_SIZEOF_SECTION_HEADER 40
3123 
3124 #define IMAGE_FIRST_SECTION(ntheader) \
3125  ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
3126  ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
3127 
3128 /* These defines are for the Characteristics bitfield. */
3129 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
3130 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
3131 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
3132 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
3133 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
3134 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
3135 
3136 #define IMAGE_SCN_CNT_CODE 0x00000020
3137 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
3138 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
3139 
3140 #define IMAGE_SCN_LNK_OTHER 0x00000100
3141 #define IMAGE_SCN_LNK_INFO 0x00000200
3142 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
3143 #define IMAGE_SCN_LNK_REMOVE 0x00000800
3144 #define IMAGE_SCN_LNK_COMDAT 0x00001000
3145 
3146 /* 0x00002000 - Reserved */
3147 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
3148 #define IMAGE_SCN_MEM_FARDATA 0x00008000
3149 
3150 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
3151 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
3152 #define IMAGE_SCN_MEM_16BIT 0x00020000
3153 #define IMAGE_SCN_MEM_LOCKED 0x00040000
3154 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
3155 
3156 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
3157 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
3158 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
3159 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
3160 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
3161 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
3162 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
3163 /* 0x00800000 - Unused */
3164 
3165 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
3166 
3167 
3168 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
3169 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
3170 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
3171 #define IMAGE_SCN_MEM_SHARED 0x10000000
3172 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
3173 #define IMAGE_SCN_MEM_READ 0x40000000
3174 #define IMAGE_SCN_MEM_WRITE 0x80000000
3175 
3176 #include "pshpack2.h"
3177 
3178 typedef struct _IMAGE_SYMBOL {
3179  union {
3180  BYTE ShortName[8];
3181  struct {
3182  DWORD Short;
3183  DWORD Long;
3184  } Name;
3185  DWORD LongName[2];
3186  } N;
3187  DWORD Value;
3188  SHORT SectionNumber;
3189  WORD Type;
3190  BYTE StorageClass;
3191  BYTE NumberOfAuxSymbols;
3192 } IMAGE_SYMBOL;
3193 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
3194 
3195 #define IMAGE_SIZEOF_SYMBOL 18
3196 
3197 typedef struct _IMAGE_LINENUMBER {
3198  union {
3199  DWORD SymbolTableIndex;
3200  DWORD VirtualAddress;
3201  } Type;
3202  WORD Linenumber;
3203 } IMAGE_LINENUMBER;
3204 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
3205 
3206 #define IMAGE_SIZEOF_LINENUMBER 6
3207 
3208 typedef union _IMAGE_AUX_SYMBOL {
3209  struct {
3210  DWORD TagIndex;
3211  union {
3212  struct {
3213  WORD Linenumber;
3214  WORD Size;
3215  } LnSz;
3216  DWORD TotalSize;
3217  } Misc;
3218  union {
3219  struct {
3220  DWORD PointerToLinenumber;
3221  DWORD PointerToNextFunction;
3222  } Function;
3223  struct {
3224  WORD Dimension[4];
3225  } Array;
3226  } FcnAry;
3227  WORD TvIndex;
3228  } Sym;
3229  struct {
3230  BYTE Name[IMAGE_SIZEOF_SYMBOL];
3231  } File;
3232  struct {
3233  DWORD Length;
3234  WORD NumberOfRelocations;
3235  WORD NumberOfLinenumbers;
3236  DWORD CheckSum;
3237  SHORT Number;
3238  BYTE Selection;
3239  } Section;
3240 } IMAGE_AUX_SYMBOL;
3241 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
3242 
3243 #define IMAGE_SIZEOF_AUX_SYMBOL 18
3244 
3245 #include "poppack.h"
3246 
3247 #define IMAGE_SYM_UNDEFINED (SHORT)0
3248 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
3249 #define IMAGE_SYM_DEBUG (SHORT)-2
3250 
3251 #define IMAGE_SYM_TYPE_NULL 0x0000
3252 #define IMAGE_SYM_TYPE_VOID 0x0001
3253 #define IMAGE_SYM_TYPE_CHAR 0x0002
3254 #define IMAGE_SYM_TYPE_SHORT 0x0003
3255 #define IMAGE_SYM_TYPE_INT 0x0004
3256 #define IMAGE_SYM_TYPE_LONG 0x0005
3257 #define IMAGE_SYM_TYPE_FLOAT 0x0006
3258 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
3259 #define IMAGE_SYM_TYPE_STRUCT 0x0008
3260 #define IMAGE_SYM_TYPE_UNION 0x0009
3261 #define IMAGE_SYM_TYPE_ENUM 0x000A
3262 #define IMAGE_SYM_TYPE_MOE 0x000B
3263 #define IMAGE_SYM_TYPE_BYTE 0x000C
3264 #define IMAGE_SYM_TYPE_WORD 0x000D
3265 #define IMAGE_SYM_TYPE_UINT 0x000E
3266 #define IMAGE_SYM_TYPE_DWORD 0x000F
3267 #define IMAGE_SYM_TYPE_PCODE 0x8000
3268 
3269 #define IMAGE_SYM_DTYPE_NULL 0
3270 #define IMAGE_SYM_DTYPE_POINTER 1
3271 #define IMAGE_SYM_DTYPE_FUNCTION 2
3272 #define IMAGE_SYM_DTYPE_ARRAY 3
3273 
3274 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
3275 #define IMAGE_SYM_CLASS_NULL 0x0000
3276 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
3277 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
3278 #define IMAGE_SYM_CLASS_STATIC 0x0003
3279 #define IMAGE_SYM_CLASS_REGISTER 0x0004
3280 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
3281 #define IMAGE_SYM_CLASS_LABEL 0x0006
3282 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
3283 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
3284 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
3285 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
3286 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
3287 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
3288 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
3289 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
3290 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
3291 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
3292 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
3293 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
3294 
3295 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
3296 #define IMAGE_SYM_CLASS_BLOCK 0x0064
3297 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
3298 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
3299 #define IMAGE_SYM_CLASS_FILE 0x0067
3300 #define IMAGE_SYM_CLASS_SECTION 0x0068
3301 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
3302 
3303 #define N_BTMASK 0x000F
3304 #define N_TMASK 0x0030
3305 #define N_TMASK1 0x00C0
3306 #define N_TMASK2 0x00F0
3307 #define N_BTSHFT 4
3308 #define N_TSHIFT 2
3309 
3310 #define BTYPE(x) ((x) & N_BTMASK)
3311 
3312 #ifndef ISPTR
3313 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
3314 #endif
3315 
3316 #ifndef ISFCN
3317 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
3318 #endif
3319 
3320 #ifndef ISARY
3321 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
3322 #endif
3323 
3324 #ifndef ISTAG
3325 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
3326 #endif
3327 
3328 #ifndef INCREF
3329 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
3330 #endif
3331 #ifndef DECREF
3332 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
3333 #endif
3334 
3335 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
3336 #define IMAGE_COMDAT_SELECT_ANY 2
3337 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
3338 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
3339 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
3340 #define IMAGE_COMDAT_SELECT_LARGEST 6
3341 #define IMAGE_COMDAT_SELECT_NEWEST 7
3342 
3343 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
3344 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
3345 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
3346 
3347 /* Export module directory */
3348 
3349 typedef struct _IMAGE_EXPORT_DIRECTORY {
3350  DWORD Characteristics;
3351  DWORD TimeDateStamp;
3352  WORD MajorVersion;
3353  WORD MinorVersion;
3354  DWORD Name;
3355  DWORD Base;
3356  DWORD NumberOfFunctions;
3357  DWORD NumberOfNames;
3358  DWORD AddressOfFunctions;
3359  DWORD AddressOfNames;
3360  DWORD AddressOfNameOrdinals;
3361 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
3362 
3363 /* Import name entry */
3364 typedef struct _IMAGE_IMPORT_BY_NAME {
3365  WORD Hint;
3366  BYTE Name[1];
3367 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
3368 
3369 /* Import thunk */
3370 typedef struct _IMAGE_THUNK_DATA {
3371  union {
3372  LPBYTE ForwarderString;
3373  PDWORD Function;
3374  DWORD Ordinal;
3375  PIMAGE_IMPORT_BY_NAME AddressOfData;
3376  } u1;
3377 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
3378 
3379 /* Import module directory */
3380 
3381 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
3382  union {
3383  DWORD Characteristics; /* 0 for terminating null import descriptor */
3384  PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
3385  } u;
3386  DWORD TimeDateStamp; /* 0 if not bound,
3387  * -1 if bound, and real date\time stamp
3388  * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
3389  * (new BIND)
3390  * otherwise date/time stamp of DLL bound to
3391  * (Old BIND)
3392  */
3393  DWORD ForwarderChain; /* -1 if no forwarders */
3394  DWORD Name;
3395  /* RVA to IAT (if bound this IAT has actual addresses) */
3396  PIMAGE_THUNK_DATA FirstThunk;
3397 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
3398 
3399 #define IMAGE_ORDINAL_FLAG 0x80000000
3400 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
3401 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
3402 
3403 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
3404 {
3405  DWORD TimeDateStamp;
3406  WORD OffsetModuleName;
3407  WORD NumberOfModuleForwarderRefs;
3408 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
3409 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
3410 
3411 typedef struct _IMAGE_BOUND_FORWARDER_REF
3412 {
3413  DWORD TimeDateStamp;
3414  WORD OffsetModuleName;
3415  WORD Reserved;
3416 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
3417 
3418 #include "pshpack2.h"
3419 
3420 typedef struct _IMAGE_BASE_RELOCATION
3421 {
3422  DWORD VirtualAddress;
3423  DWORD SizeOfBlock;
3424  /* WORD TypeOffset[1]; */
3425 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
3426 
3427 typedef struct _IMAGE_RELOCATION
3428 {
3429  union {
3430  DWORD VirtualAddress;
3431  DWORD RelocCount;
3432  } u;
3433  DWORD SymbolTableIndex;
3434  WORD Type;
3435 } IMAGE_RELOCATION;
3436 typedef IMAGE_RELOCATION *PIMAGE_RELOCATION;
3437 
3438 #include "poppack.h"
3439 
3440 #define IMAGE_SIZEOF_RELOCATION 10
3441 
3442 /* generic relocation types */
3443 #define IMAGE_REL_BASED_ABSOLUTE 0
3444 #define IMAGE_REL_BASED_HIGH 1
3445 #define IMAGE_REL_BASED_LOW 2
3446 #define IMAGE_REL_BASED_HIGHLOW 3
3447 #define IMAGE_REL_BASED_HIGHADJ 4
3448 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
3449 #define IMAGE_REL_BASED_SECTION 6
3450 #define IMAGE_REL_BASED_REL 7
3451 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
3452 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
3453 #define IMAGE_REL_BASED_DIR64 10
3454 #define IMAGE_REL_BASED_HIGH3ADJ 11
3455 
3456 /* I386 relocation types */
3457 #define IMAGE_REL_I386_ABSOLUTE 0
3458 #define IMAGE_REL_I386_DIR16 1
3459 #define IMAGE_REL_I386_REL16 2
3460 #define IMAGE_REL_I386_DIR32 6
3461 #define IMAGE_REL_I386_DIR32NB 7
3462 #define IMAGE_REL_I386_SEG12 9
3463 #define IMAGE_REL_I386_SECTION 10
3464 #define IMAGE_REL_I386_SECREL 11
3465 #define IMAGE_REL_I386_REL32 20
3466 
3467 /* MIPS relocation types */
3468 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
3469 #define IMAGE_REL_MIPS_REFHALF 0x0001
3470 #define IMAGE_REL_MIPS_REFWORD 0x0002
3471 #define IMAGE_REL_MIPS_JMPADDR 0x0003
3472 #define IMAGE_REL_MIPS_REFHI 0x0004
3473 #define IMAGE_REL_MIPS_REFLO 0x0005
3474 #define IMAGE_REL_MIPS_GPREL 0x0006
3475 #define IMAGE_REL_MIPS_LITERAL 0x0007
3476 #define IMAGE_REL_MIPS_SECTION 0x000A
3477 #define IMAGE_REL_MIPS_SECREL 0x000B
3478 #define IMAGE_REL_MIPS_SECRELLO 0x000C
3479 #define IMAGE_REL_MIPS_SECRELHI 0x000D
3480 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
3481 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
3482 #define IMAGE_REL_MIPS_PAIR 0x0025
3483 
3484 /* ALPHA relocation types */
3485 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
3486 #define IMAGE_REL_ALPHA_REFLONG 0x0001
3487 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
3488 #define IMAGE_REL_ALPHA_GPREL 0x0003
3489 #define IMAGE_REL_ALPHA_LITERAL 0x0004
3490 #define IMAGE_REL_ALPHA_LITUSE 0x0005
3491 #define IMAGE_REL_ALPHA_GPDISP 0x0006
3492 #define IMAGE_REL_ALPHA_BRADDR 0x0007
3493 #define IMAGE_REL_ALPHA_HINT 0x0008
3494 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
3495 #define IMAGE_REL_ALPHA_REFHI 0x000A
3496 #define IMAGE_REL_ALPHA_REFLO 0x000B
3497 #define IMAGE_REL_ALPHA_PAIR 0x000C
3498 #define IMAGE_REL_ALPHA_MATCH 0x000D
3499 #define IMAGE_REL_ALPHA_SECTION 0x000E
3500 #define IMAGE_REL_ALPHA_SECREL 0x000F
3501 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
3502 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
3503 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
3504 #define IMAGE_REL_ALPHA_REFQ3 0x0013
3505 #define IMAGE_REL_ALPHA_REFQ2 0x0014
3506 #define IMAGE_REL_ALPHA_REFQ1 0x0015
3507 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
3508 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
3509 
3510 /* PowerPC relocation types */
3511 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
3512 #define IMAGE_REL_PPC_ADDR64 0x0001
3513 #define IMAGE_REL_PPC_ADDR 0x0002
3514 #define IMAGE_REL_PPC_ADDR24 0x0003
3515 #define IMAGE_REL_PPC_ADDR16 0x0004
3516 #define IMAGE_REL_PPC_ADDR14 0x0005
3517 #define IMAGE_REL_PPC_REL24 0x0006
3518 #define IMAGE_REL_PPC_REL14 0x0007
3519 #define IMAGE_REL_PPC_TOCREL16 0x0008
3520 #define IMAGE_REL_PPC_TOCREL14 0x0009
3521 #define IMAGE_REL_PPC_ADDR32NB 0x000A
3522 #define IMAGE_REL_PPC_SECREL 0x000B
3523 #define IMAGE_REL_PPC_SECTION 0x000C
3524 #define IMAGE_REL_PPC_IFGLUE 0x000D
3525 #define IMAGE_REL_PPC_IMGLUE 0x000E
3526 #define IMAGE_REL_PPC_SECREL16 0x000F
3527 #define IMAGE_REL_PPC_REFHI 0x0010
3528 #define IMAGE_REL_PPC_REFLO 0x0011
3529 #define IMAGE_REL_PPC_PAIR 0x0012
3530 #define IMAGE_REL_PPC_SECRELLO 0x0013
3531 #define IMAGE_REL_PPC_SECRELHI 0x0014
3532 #define IMAGE_REL_PPC_GPREL 0x0015
3533 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
3534 /* modifier bits */
3535 #define IMAGE_REL_PPC_NEG 0x0100
3536 #define IMAGE_REL_PPC_BRTAKEN 0x0200
3537 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
3538 #define IMAGE_REL_PPC_TOCDEFN 0x0800
3539 
3540 /* SH3 ? relocation type */
3541 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
3542 #define IMAGE_REL_SH3_DIRECT16 0x0001
3543 #define IMAGE_REL_SH3_DIRECT 0x0002
3544 #define IMAGE_REL_SH3_DIRECT8 0x0003
3545 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
3546 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
3547 #define IMAGE_REL_SH3_DIRECT4 0x0006
3548 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
3549 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
3550 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
3551 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
3552 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
3553 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
3554 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
3555 #define IMAGE_REL_SH3_SECTION 0x000E
3556 #define IMAGE_REL_SH3_SECREL 0x000F
3557 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
3558 
3559 /* ARM (Archimedes?) relocation types */
3560 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
3561 #define IMAGE_REL_ARM_ADDR 0x0001
3562 #define IMAGE_REL_ARM_ADDR32NB 0x0002
3563 #define IMAGE_REL_ARM_BRANCH24 0x0003
3564 #define IMAGE_REL_ARM_BRANCH11 0x0004
3565 #define IMAGE_REL_ARM_SECTION 0x000E
3566 #define IMAGE_REL_ARM_SECREL 0x000F
3567 
3568 /* IA64 relocation types */
3569 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
3570 #define IMAGE_REL_IA64_IMM14 0x0001
3571 #define IMAGE_REL_IA64_IMM22 0x0002
3572 #define IMAGE_REL_IA64_IMM64 0x0003
3573 #define IMAGE_REL_IA64_DIR 0x0004
3574 #define IMAGE_REL_IA64_DIR64 0x0005
3575 #define IMAGE_REL_IA64_PCREL21B 0x0006
3576 #define IMAGE_REL_IA64_PCREL21M 0x0007
3577 #define IMAGE_REL_IA64_PCREL21F 0x0008
3578 #define IMAGE_REL_IA64_GPREL22 0x0009
3579 #define IMAGE_REL_IA64_LTOFF22 0x000A
3580 #define IMAGE_REL_IA64_SECTION 0x000B
3581 #define IMAGE_REL_IA64_SECREL22 0x000C
3582 #define IMAGE_REL_IA64_SECREL64I 0x000D
3583 #define IMAGE_REL_IA64_SECREL 0x000E
3584 #define IMAGE_REL_IA64_LTOFF64 0x000F
3585 #define IMAGE_REL_IA64_DIR32NB 0x0010
3586 #define IMAGE_REL_IA64_RESERVED_11 0x0011
3587 #define IMAGE_REL_IA64_RESERVED_12 0x0012
3588 #define IMAGE_REL_IA64_RESERVED_13 0x0013
3589 #define IMAGE_REL_IA64_RESERVED_14 0x0014
3590 #define IMAGE_REL_IA64_RESERVED_15 0x0015
3591 #define IMAGE_REL_IA64_RESERVED_16 0x0016
3592 #define IMAGE_REL_IA64_ADDEND 0x001F
3593 
3594 /* archive format */
3595 
3596 #define IMAGE_ARCHIVE_START_SIZE 8
3597 #define IMAGE_ARCHIVE_START "!<arch>\n"
3598 #define IMAGE_ARCHIVE_END "`\n"
3599 #define IMAGE_ARCHIVE_PAD "\n"
3600 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
3601 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
3602 
3603 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
3604 {
3605  BYTE Name[16];
3606  BYTE Date[12];
3607  BYTE UserID[6];
3608  BYTE GroupID[6];
3609  BYTE Mode[8];
3610  BYTE Size[10];
3611  BYTE EndHeader[2];
3612 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
3613 
3614 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
3615 
3616 /*
3617  * Resource directory stuff
3618  */
3619 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3620  DWORD Characteristics;
3621  DWORD TimeDateStamp;
3622  WORD MajorVersion;
3623  WORD MinorVersion;
3624  WORD NumberOfNamedEntries;
3625  WORD NumberOfIdEntries;
3626  /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3627 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3628 
3629 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3630 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3631 
3632 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3633  union u1 {
3634  struct fleegle {
3635 #ifdef BITFIELDS_BIGENDIAN
3636  unsigned NameIsString:1;
3637  unsigned NameOffset:31;
3638 #else
3639  unsigned NameOffset:31;
3640  unsigned NameIsString:1;
3641 #endif
3642  } DUMMYSTRUCTNAME1;
3643  DWORD Name;
3644  struct sneegle {
3645 #ifdef WORDS_BIGENDIAN
3646  WORD __pad;
3647  WORD Id;
3648 #else
3649  WORD Id;
3650  WORD __pad;
3651 #endif
3652  } DUMMYSTRUCTNAME2;
3653  } DUMMYUNIONNAME1;
3654  union u2 {
3655  DWORD OffsetToData;
3656  struct drooper {
3657 #ifdef BITFIELDS_BIGENDIAN
3658  unsigned DataIsDirectory:1;
3659  unsigned OffsetToDirectory:31;
3660 #else
3661  unsigned OffsetToDirectory:31;
3662  unsigned DataIsDirectory:1;
3663 #endif
3664  } DUMMYSTRUCTNAME3;
3665  } DUMMYUNIONNAME2;
3666 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3667 
3668 
3669 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3670  WORD Length;
3671  CHAR NameString[ 1 ];
3672 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3673 
3674 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3675  WORD Length;
3676  WCHAR NameString[ 1 ];
3677 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3678 
3679 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3680  DWORD OffsetToData;
3681  DWORD Size;
3682  DWORD CodePage;
3683  DWORD ResourceHandle;
3684 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3685 
3686 
3687 typedef VOID CALLBACK (*PIMAGE_TLS_CALLBACK)(
3688  LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3689 );
3690 
3691 typedef struct _IMAGE_TLS_DIRECTORY {
3692  DWORD StartAddressOfRawData;
3693  DWORD EndAddressOfRawData;
3694  LPDWORD AddressOfIndex;
3695  PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
3696  DWORD SizeOfZeroFill;
3697  DWORD Characteristics;
3698 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
3699 
3700 typedef struct _IMAGE_DEBUG_DIRECTORY {
3701  DWORD Characteristics;
3702  DWORD TimeDateStamp;
3703  WORD MajorVersion;
3704  WORD MinorVersion;
3705  DWORD Type;
3706  DWORD SizeOfData;
3707  DWORD AddressOfRawData;
3708  DWORD PointerToRawData;
3709 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3710 
3711 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3712 #define IMAGE_DEBUG_TYPE_COFF 1
3713 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3714 #define IMAGE_DEBUG_TYPE_FPO 3
3715 #define IMAGE_DEBUG_TYPE_MISC 4
3716 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3717 #define IMAGE_DEBUG_TYPE_FIXUP 6
3718 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3719 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3720 #define IMAGE_DEBUG_TYPE_BORLAND 9
3721 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3722 
3723 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3724  DWORD NumberOfSymbols;
3725  DWORD LvaToFirstSymbol;
3726  DWORD NumberOfLinenumbers;
3727  DWORD LvaToFirstLinenumber;
3728  DWORD RvaToFirstByteOfCode;
3729  DWORD RvaToLastByteOfCode;
3730  DWORD RvaToFirstByteOfData;
3731  DWORD RvaToLastByteOfData;
3732 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3733 
3734 #define FRAME_FPO 0
3735 #define FRAME_TRAP 1
3736 #define FRAME_TSS 2
3737 #define FRAME_NONFPO 3
3738 
3739 typedef struct _FPO_DATA {
3740  DWORD ulOffStart;
3741  DWORD cbProcSize;
3742  DWORD cdwLocals;
3743  WORD cdwParams;
3744  unsigned cbProlog : 8;
3745  unsigned cbRegs : 3;
3746  unsigned fHasSEH : 1;
3747  unsigned fUseBP : 1;
3748  unsigned reserved : 1;
3749  unsigned cbFrame : 2;
3750 } FPO_DATA, *PFPO_DATA;
3751 
3752 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
3753  DWORD Characteristics;
3754  DWORD TimeDateStamp;
3755  WORD MajorVersion;
3756  WORD MinorVersion;
3757  DWORD GlobalFlagsClear;
3758  DWORD GlobalFlagsSet;
3759  DWORD CriticalSectionDefaultTimeout;
3760  DWORD DeCommitFreeBlockThreshold;
3761  DWORD DeCommitTotalFreeThreshold;
3762  PVOID LockPrefixTable;
3763  DWORD MaximumAllocationSize;
3764  DWORD VirtualMemoryThreshold;
3765  DWORD ProcessHeapFlags;
3766  DWORD ProcessAffinityMask;
3767  WORD CSDVersion;
3768  WORD Reserved1;
3769  PVOID EditList;
3770  DWORD Reserved[1];
3771 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3772 
3773 typedef struct _IMAGE_FUNCTION_ENTRY {
3774  DWORD StartingAddress;
3775  DWORD EndingAddress;
3776  DWORD EndOfPrologue;
3777 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3778 
3779 #define IMAGE_DEBUG_MISC_EXENAME 1
3780 
3781 typedef struct _IMAGE_DEBUG_MISC {
3782  DWORD DataType;
3783  DWORD Length;
3784  BYTE Unicode;
3785  BYTE Reserved[ 3 ];
3786  BYTE Data[ 1 ];
3787 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3788 
3789 /* This is the structure that appears at the very start of a .DBG file. */
3790 
3791 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3792  WORD Signature;
3793  WORD Flags;
3794  WORD Machine;
3795  WORD Characteristics;
3796  DWORD TimeDateStamp;
3797  DWORD CheckSum;
3798  DWORD ImageBase;
3799  DWORD SizeOfImage;
3800  DWORD NumberOfSections;
3801  DWORD ExportedNamesSize;
3802  DWORD DebugDirectorySize;
3803  DWORD SectionAlignment;
3804  DWORD Reserved[ 2 ];
3805 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3806 
3807 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3808 
3809 
3810 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3811  WORD Length;
3812  WORD Flags;
3813  BYTE Text[1];
3814 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3815 #define MESSAGE_RESOURCE_UNICODE 0x0001
3816 
3817 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3818  DWORD LowId;
3819  DWORD HighId;
3820  DWORD OffsetToEntries;
3821 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3822 
3823 typedef struct tagMESSAGE_RESOURCE_DATA {
3824  DWORD NumberOfBlocks;
3825  MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3826 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3827 
3828 /*
3829  * Here follows typedefs for security and tokens.
3830  */
3831 
3832 /*
3833  * First a constant for the following typdefs.
3834  */
3835 
3836 #define ANYSIZE_ARRAY 1
3837 
3838 /* FIXME: Orphan. What does it point to? */
3839 typedef PVOID PACCESS_TOKEN;
3840 
3841 /*
3842  * TOKEN_INFORMATION_CLASS
3843  */
3844 
3845 typedef enum _TOKEN_INFORMATION_CLASS {
3846  TokenUser = 1,
3847  TokenGroups,
3848  TokenPrivileges,
3849  TokenOwner,
3850  TokenPrimaryGroup,
3851  TokenDefaultDacl,
3852  TokenSource,
3853  TokenType,
3854  TokenImpersonationLevel,
3855  TokenStatistics
3856 } TOKEN_INFORMATION_CLASS;
3857 
3858 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3859 #define TOKEN_ADJUST_GROUPS 0x0040
3860 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3861 #define TOKEN_ADJUST_SESSIONID 0x0100
3862 #define TOKEN_ASSIGN_PRIMARY 0x0001
3863 #define TOKEN_DUPLICATE 0x0002
3864 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3865 #define TOKEN_IMPERSONATE 0x0004
3866 #define TOKEN_QUERY 0x0008
3867 #define TOKEN_QUERY_SOURCE 0x0010
3868 #define TOKEN_ADJUST_DEFAULT 0x0080
3869 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3870 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3871  TOKEN_ADJUST_PRIVILEGES | \
3872  TOKEN_ADJUST_GROUPS | \
3873  TOKEN_ADJUST_DEFAULT )
3874 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3875  TOKEN_ASSIGN_PRIMARY | \
3876  TOKEN_DUPLICATE | \
3877  TOKEN_IMPERSONATE | \
3878  TOKEN_QUERY | \
3879  TOKEN_QUERY_SOURCE | \
3880  TOKEN_ADJUST_PRIVILEGES | \
3881  TOKEN_ADJUST_GROUPS | \
3882  TOKEN_ADJUST_SESSIONID | \
3883  TOKEN_ADJUST_DEFAULT )
3884 
3885 #ifndef _SECURITY_DEFINED
3886 #define _SECURITY_DEFINED
3887 
3888 
3889 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3890 
3891 typedef struct _GENERIC_MAPPING {
3892  ACCESS_MASK GenericRead;
3893  ACCESS_MASK GenericWrite;
3894  ACCESS_MASK GenericExecute;
3895  ACCESS_MASK GenericAll;
3896 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3897 
3898 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3899 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3900 typedef struct {
3901  BYTE Value[6];
3902 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
3903 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3904 
3905 #ifndef SID_DEFINED
3906 #define SID_DEFINED
3907 typedef struct _SID {
3908  BYTE Revision;
3909  BYTE SubAuthorityCount;
3910  SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3911  DWORD SubAuthority[1];
3912 } SID,*PSID;
3913 #endif /* !defined(SID_DEFINED) */
3914 
3915 #define SID_REVISION (1) /* Current revision */
3916 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3917 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3918 
3919 
3920 /*
3921  * ACL
3922  */
3923 
3924 #define ACL_REVISION1 1
3925 #define ACL_REVISION2 2
3926 #define ACL_REVISION3 3
3927 #define ACL_REVISION4 4
3928 
3929 #define MIN_ACL_REVISION ACL_REVISION2
3930 #define MAX_ACL_REVISION ACL_REVISION4
3931 
3932 typedef struct _ACL {
3933  BYTE AclRevision;
3934  BYTE Sbz1;
3935  WORD AclSize;
3936  WORD AceCount;
3937  WORD Sbz2;
3938 } ACL, *PACL;
3939 
3940 /* SECURITY_DESCRIPTOR */
3941 #define SECURITY_DESCRIPTOR_REVISION 1
3942 #define SECURITY_DESCRIPTOR_REVISION1 1
3943 
3944 
3945 #define SE_OWNER_DEFAULTED 0x0001
3946 #define SE_GROUP_DEFAULTED 0x0002
3947 #define SE_DACL_PRESENT 0x0004
3948 #define SE_DACL_DEFAULTED 0x0008
3949 #define SE_SACL_PRESENT 0x0010
3950 #define SE_SACL_DEFAULTED 0x0020
3951 #define SE_SELF_RELATIVE 0x8000
3952 
3953 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
3954 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
3955 
3956 /* The security descriptor structure */
3957 typedef struct {
3958  BYTE Revision;
3959  BYTE Sbz1;
3960  SECURITY_DESCRIPTOR_CONTROL Control;
3961  DWORD Owner;
3962  DWORD Group;
3963  DWORD Sacl;
3964  DWORD Dacl;
3965 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3966 
3967 typedef struct {
3968  BYTE Revision;
3969  BYTE Sbz1;
3970  SECURITY_DESCRIPTOR_CONTROL Control;
3971  PSID Owner;
3972  PSID Group;
3973  PACL Sacl;
3974  PACL Dacl;
3975 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
3976 
3977 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3978 
3979 #endif /* _SECURITY_DEFINED */
3980 
3981 /*
3982  * SID_AND_ATTRIBUTES
3983  */
3984 
3985 typedef struct _SID_AND_ATTRIBUTES {
3986  PSID Sid;
3987  DWORD Attributes;
3988 } SID_AND_ATTRIBUTES ;
3989 
3990 /* security entities */
3991 #define SECURITY_NULL_RID (0x00000000L)
3992 #define SECURITY_WORLD_RID (0x00000000L)
3993 #define SECURITY_LOCAL_RID (0X00000000L)
3994 
3995 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3996 
3997 /* S-1-1 */
3998 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3999 
4000 /* S-1-2 */
4001 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
4002 
4003 /* S-1-3 */
4004 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
4005 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
4006 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
4007 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
4008 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
4009 
4010 /* S-1-4 */
4011 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
4012 
4013 /* S-1-5 */
4014 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
4015 #define SECURITY_DIALUP_RID 0x00000001L
4016 #define SECURITY_NETWORK_RID 0x00000002L
4017 #define SECURITY_BATCH_RID 0x00000003L
4018 #define SECURITY_INTERACTIVE_RID 0x00000004L
4019 #define SECURITY_LOGON_IDS_RID 0x00000005L
4020 #define SECURITY_SERVICE_RID 0x00000006L
4021 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
4022 #define SECURITY_PROXY_RID 0x00000008L
4023 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
4024 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
4025 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
4026 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
4027 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
4028 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
4029 #define SECURITY_NT_NON_UNIQUE 0x00000015L
4030 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
4031 
4032 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
4033 #define DOMAIN_GROUP_RID_USERS 0x00000201L
4034 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
4035 
4036 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
4037 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
4038 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
4039 
4040 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
4041 
4042 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
4043 
4044 /*
4045  * TOKEN_USER
4046  */
4047 
4048 typedef struct _TOKEN_USER {
4049  SID_AND_ATTRIBUTES User;
4050 } TOKEN_USER;
4051 
4052 /*
4053  * TOKEN_GROUPS
4054  */
4055 
4056 typedef struct _TOKEN_GROUPS {
4057  DWORD GroupCount;
4058  SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
4059 } TOKEN_GROUPS;
4060 
4061 /*
4062  * LUID_AND_ATTRIBUTES
4063  */
4064 
4065 typedef union _LARGE_INTEGER {
4066  struct dorp {
4067  DWORD LowPart;
4068  LONG HighPart;
4069  } DUMMYSTRUCTNAME;
4070  LONGLONG QuadPart;
4071 } LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
4072 
4073 typedef union _ULARGE_INTEGER {
4074  struct banana {
4075  DWORD LowPart;
4076  DWORD HighPart;
4077  } DUMMYSTRUCTNAME;
4078  ULONGLONG QuadPart;
4079 } ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
4080 
4081 /*
4082  * Locally Unique Identifier
4083  */
4084 
4085 typedef struct _LUID {
4086  DWORD LowPart;
4087  LONG HighPart;
4088 } LUID, *PLUID;
4089 
4090 #include "pshpack4.h"
4091 typedef struct _LUID_AND_ATTRIBUTES {
4092  LUID Luid;
4093  DWORD Attributes;
4094 } LUID_AND_ATTRIBUTES;
4095 #include "poppack.h"
4096 
4097 /*
4098  * PRIVILEGE_SET
4099  */
4100 
4101 typedef struct _PRIVILEGE_SET {
4102  DWORD PrivilegeCount;
4103  DWORD Control;
4104  LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
4105 } PRIVILEGE_SET, *PPRIVILEGE_SET;
4106 
4107 /*
4108  * TOKEN_PRIVILEGES
4109  */
4110 
4111 typedef struct _TOKEN_PRIVILEGES {
4112  DWORD PrivilegeCount;
4113  LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
4114 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
4115 
4116 /*
4117  * TOKEN_OWNER
4118  */
4119 
4120 typedef struct _TOKEN_OWNER {
4121  PSID Owner;
4122 } TOKEN_OWNER;
4123 
4124 /*
4125  * TOKEN_PRIMARY_GROUP
4126  */
4127 
4128 typedef struct _TOKEN_PRIMARY_GROUP {
4129  PSID PrimaryGroup;
4130 } TOKEN_PRIMARY_GROUP;
4131 
4132 
4133 /*
4134  * TOKEN_DEFAULT_DACL
4135  */
4136 
4137 typedef struct _TOKEN_DEFAULT_DACL {
4138  PACL DefaultDacl;
4139 } TOKEN_DEFAULT_DACL;
4140 
4141 /*
4142  * TOKEN_SOURCEL
4143  */
4144 
4145 typedef struct _TOKEN_SOURCE {
4146  char Sourcename[8];
4147  LUID SourceIdentifier;
4148 } TOKEN_SOURCE;
4149 
4150 /*
4151  * TOKEN_TYPE
4152  */
4153 
4154 typedef enum tagTOKEN_TYPE {
4155  TokenPrimary = 1,
4156  TokenImpersonation
4157 } TOKEN_TYPE;
4158 
4159 /*
4160  * SECURITY_IMPERSONATION_LEVEL
4161  */
4162 
4163 typedef enum _SECURITY_IMPERSONATION_LEVEL {
4164  SecurityAnonymous,
4165  SecurityIdentification,
4166  SecurityImpersonation,
4167  SecurityDelegation
4168 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
4169 
4170 
4171 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
4172  * PSECURITY_CONTEXT_TRACKING_MODE;
4173 /*
4174  * Quality of Service
4175  */
4176 
4177 typedef struct _SECURITY_QUALITY_OF_SERVICE {
4178  DWORD Length;
4179  SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4180  SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
4181  BOOLEAN EffectiveOnly;
4182 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
4183 
4184 /*
4185  * TOKEN_STATISTICS
4186  */
4187 
4188 typedef struct _TOKEN_STATISTICS {
4189  LUID TokenId;
4190  LUID AuthenticationId;
4191  LARGE_INTEGER ExpirationTime;
4192  TOKEN_TYPE TokenType;
4193  SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
4194  DWORD DynamicCharged;
4195  DWORD DynamicAvailable;
4196  DWORD GroupCount;
4197  DWORD PrivilegeCount;
4198  LUID ModifiedId;
4199 } TOKEN_STATISTICS;
4200 
4201 /*
4202  * ACLs of NT
4203  */
4204 
4205 #define ACL_REVISION 2
4206 
4207 #define ACL_REVISION1 1
4208 #define ACL_REVISION2 2
4209 
4210 /* ACEs, directly starting after an ACL */
4211 typedef struct _ACE_HEADER {
4212  BYTE AceType;
4213  BYTE AceFlags;
4214  WORD AceSize;
4215 } ACE_HEADER,*PACE_HEADER;
4216 
4217 /* AceType */
4218 #define ACCESS_ALLOWED_ACE_TYPE 0
4219 #define ACCESS_DENIED_ACE_TYPE 1
4220 #define SYSTEM_AUDIT_ACE_TYPE 2
4221 #define SYSTEM_ALARM_ACE_TYPE 3
4222 
4223 /* inherit AceFlags */
4224 #define OBJECT_INHERIT_ACE 0x01
4225 #define CONTAINER_INHERIT_ACE 0x02
4226 #define NO_PROPAGATE_INHERIT_ACE 0x04
4227 #define INHERIT_ONLY_ACE 0x08
4228 #define VALID_INHERIT_FLAGS 0x0F
4229 
4230 /* AceFlags mask for what events we (should) audit */
4231 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
4232 #define FAILED_ACCESS_ACE_FLAG 0x80
4233 
4234 /* different ACEs depending on AceType
4235  * SidStart marks the begin of a SID
4236  * so the thing finally looks like this:
4237  * 0: ACE_HEADER
4238  * 4: ACCESS_MASK
4239  * 8... : SID
4240  */
4241 typedef struct _ACCESS_ALLOWED_ACE {
4242  ACE_HEADER Header;
4243  DWORD Mask;
4244  DWORD SidStart;
4245 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
4246 
4247 typedef struct _ACCESS_DENIED_ACE {
4248  ACE_HEADER Header;
4249  DWORD Mask;
4250  DWORD SidStart;
4251 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
4252 
4253 typedef struct _SYSTEM_AUDIT_ACE {
4254  ACE_HEADER Header;
4255  DWORD Mask;
4256  DWORD SidStart;
4257 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
4258 
4259 typedef struct _SYSTEM_ALARM_ACE {
4260  ACE_HEADER Header;
4261  DWORD Mask;
4262  DWORD SidStart;
4263 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
4264 
4265 typedef enum tagSID_NAME_USE {
4266  SidTypeUser = 1,
4267  SidTypeGroup,
4268  SidTypeDomain,
4269  SidTypeAlias,
4270  SidTypeWellKnownGroup,
4271  SidTypeDeletedAccount,
4272  SidTypeInvalid,
4273  SidTypeUnknown
4274 } SID_NAME_USE,*PSID_NAME_USE;
4275 
4276 /* Access rights */
4277 
4278 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
4279 #undef DELETE
4280 #define DELETE 0x00010000
4281 #define READ_CONTROL 0x00020000
4282 #define WRITE_DAC 0x00040000
4283 #define WRITE_OWNER 0x00080000
4284 #define SYNCHRONIZE 0x00100000
4285 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
4286 
4287 #define STANDARD_RIGHTS_READ READ_CONTROL
4288 #define STANDARD_RIGHTS_WRITE READ_CONTROL
4289 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
4290 
4291 #define STANDARD_RIGHTS_ALL 0x001f0000
4292 
4293 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
4294 
4295 #define GENERIC_READ 0x80000000
4296 #define GENERIC_WRITE 0x40000000
4297 #define GENERIC_EXECUTE 0x20000000
4298 #define GENERIC_ALL 0x10000000
4299 
4300 #define MAXIMUM_ALLOWED 0x02000000
4301 #define ACCESS_SYSTEM_SECURITY 0x01000000
4302 
4303 #define EVENT_MODIFY_STATE 0x0002
4304 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4305 
4306 #define SEMAPHORE_MODIFY_STATE 0x0002
4307 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4308 
4309 #define MUTEX_MODIFY_STATE 0x0001
4310 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4311 
4312 #define TIMER_QUERY_STATE 0x0001
4313 #define TIMER_MODIFY_STATE 0x0002
4314 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4315 
4316 #define PROCESS_TERMINATE 0x0001
4317 #define PROCESS_CREATE_THREAD 0x0002
4318 #define PROCESS_VM_OPERATION 0x0008
4319 #define PROCESS_VM_READ 0x0010
4320 #define PROCESS_VM_WRITE 0x0020
4321 #define PROCESS_DUP_HANDLE 0x0040
4322 #define PROCESS_CREATE_PROCESS 0x0080
4323 #define PROCESS_SET_QUOTA 0x0100
4324 #define PROCESS_SET_INFORMATION 0x0200
4325 #define PROCESS_QUERY_INFORMATION 0x0400
4326 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4327 
4328 #define THREAD_TERMINATE 0x0001
4329 #define THREAD_SUSPEND_RESUME 0x0002
4330 #define THREAD_GET_CONTEXT 0x0008
4331 #define THREAD_SET_CONTEXT 0x0010
4332 #define THREAD_SET_INFORMATION 0x0020
4333 #define THREAD_QUERY_INFORMATION 0x0040
4334 #define THREAD_SET_THREAD_TOKEN 0x0080
4335 #define THREAD_IMPERSONATE 0x0100
4336 #define THREAD_DIRECT_IMPERSONATION 0x0200
4337 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4338 
4339 #define THREAD_BASE_PRIORITY_LOWRT 15
4340 #define THREAD_BASE_PRIORITY_MAX 2
4341 #define THREAD_BASE_PRIORITY_MIN -2
4342 #define THREAD_BASE_PRIORITY_IDLE -15
4343 
4344 #define FILE_READ_DATA 0x0001 /* file & pipe */
4345 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4346 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4347 #define FILE_ADD_FILE 0x0002 /* directory */
4348 #define FILE_APPEND_DATA 0x0004 /* file */
4349 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4350 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4351 #define FILE_READ_EA 0x0008 /* file & directory */
4352 #define FILE_READ_PROPERTIES FILE_READ_EA
4353 #define FILE_WRITE_EA 0x0010 /* file & directory */
4354 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4355 #define FILE_EXECUTE 0x0020 /* file */
4356 #define FILE_TRAVERSE 0x0020 /* directory */
4357 #define FILE_DELETE_CHILD 0x0040 /* directory */
4358 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4359 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4360 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4361 
4362 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4363  FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4364  SYNCHRONIZE)
4365 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4366  FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4367  FILE_APPEND_DATA | SYNCHRONIZE)
4368 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4369  FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4370 
4371 
4372 /* File attribute flags */
4373 #define FILE_SHARE_READ 0x00000001L
4374 #define FILE_SHARE_WRITE 0x00000002L
4375 #define FILE_SHARE_DELETE 0x00000004L
4376 #define FILE_ATTRIBUTE_READONLY 0x00000001L
4377 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
4378 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
4379 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
4380 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
4381 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
4382 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
4383 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
4384 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
4385 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
4386 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
4387 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
4388 #define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
4389 
4390 /* File notification flags */
4391 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4392 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4393 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4394 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4395 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4396 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4397 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4398 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4399 
4400 #define FILE_ACTION_ADDED 0x00000001
4401 #define FILE_ACTION_REMOVED 0x00000002
4402 #define FILE_ACTION_MODIFIED 0x00000003
4403 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4404 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4405 
4406 
4407 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4408 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4409 #define FILE_UNICODE_ON_DISK 0x00000004
4410 #define FILE_PERSISTENT_ACLS 0x00000008
4411 #define FILE_FILE_COMPRESSION 0x00000010
4412 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4413 
4414 /* File alignments (NT) */
4415 #define FILE_BYTE_ALIGNMENT 0x00000000
4416 #define FILE_WORD_ALIGNMENT 0x00000001
4417 #define FILE_LONG_ALIGNMENT 0x00000003
4418 #define FILE_QUAD_ALIGNMENT 0x00000007
4419 #define FILE_OCTA_ALIGNMENT 0x0000000f
4420 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4421 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4422 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4423 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4424 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4425 
4426 #define REG_NONE 0 /* no type */
4427 #define REG_SZ 1 /* string type (ASCII) */
4428 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4429 #define REG_BINARY 3 /* binary format, callerspecific */
4430 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4431 #define REG_DWORD 4 /* DWORD in little endian format */
4432 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4433 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4434 #define REG_LINK 6 /* symbolic link (UNICODE) */
4435 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4436 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4437 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4438 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4439 
4440 /* ----------------------------- begin registry ----------------------------- */
4441 
4442 /* Registry security values */
4443 #define OWNER_SECURITY_INFORMATION 0x00000001
4444 #define GROUP_SECURITY_INFORMATION 0x00000002
4445 #define DACL_SECURITY_INFORMATION 0x00000004
4446 #define SACL_SECURITY_INFORMATION 0x00000008
4447 
4448 #define REG_OPTION_RESERVED 0x00000000
4449 #define REG_OPTION_NON_VOLATILE 0x00000000
4450 #define REG_OPTION_VOLATILE 0x00000001
4451 #define REG_OPTION_CREATE_LINK 0x00000002
4452 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4453 #define REG_OPTION_OPEN_LINK 0x00000008
4454 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4455  REG_OPTION_NON_VOLATILE| \
4456  REG_OPTION_VOLATILE| \
4457  REG_OPTION_CREATE_LINK| \
4458  REG_OPTION_BACKUP_RESTORE| \
4459  REG_OPTION_OPEN_LINK)
4460 
4461 
4462 #define REG_CREATED_NEW_KEY 0x00000001
4463 #define REG_OPENED_EXISTING_KEY 0x00000002
4464 
4465 /* For RegNotifyChangeKeyValue */
4466 #define REG_NOTIFY_CHANGE_NAME 0x1
4467 
4468 #define KEY_QUERY_VALUE 0x00000001
4469 #define KEY_SET_VALUE 0x00000002
4470 #define KEY_CREATE_SUB_KEY 0x00000004
4471 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4472 #define KEY_NOTIFY 0x00000010
4473 #define KEY_CREATE_LINK 0x00000020
4474 
4475 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4476  KEY_QUERY_VALUE| \
4477  KEY_ENUMERATE_SUB_KEYS| \
4478  KEY_NOTIFY) \
4479  & (~SYNCHRONIZE) \
4480  )
4481 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4482  KEY_SET_VALUE| \
4483  KEY_CREATE_SUB_KEY) \
4484  & (~SYNCHRONIZE) \
4485  )
4486 #define KEY_EXECUTE ((KEY_READ) \
4487  & (~SYNCHRONIZE)) \
4488  )
4489 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4490  KEY_QUERY_VALUE| \
4491  KEY_SET_VALUE| \
4492  KEY_CREATE_SUB_KEY| \
4493  KEY_ENUMERATE_SUB_KEYS| \
4494  KEY_NOTIFY| \
4495  KEY_CREATE_LINK) \
4496  & (~SYNCHRONIZE) \
4497  )
4498 /* ------------------------------ end registry ------------------------------ */
4499 
4500 
4501 #define EVENTLOG_SUCCESS 0x0000
4502 #define EVENTLOG_ERROR_TYPE 0x0001
4503 #define EVENTLOG_WARNING_TYPE 0x0002
4504 #define EVENTLOG_INFORMATION_TYPE 0x0004
4505 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4506 #define EVENTLOG_AUDIT_FAILURE 0x0010
4507 
4508 #define SERVICE_BOOT_START 0x00000000
4509 #define SERVICE_SYSTEM_START 0x00000001
4510 #define SERVICE_AUTO_START 0x00000002
4511 #define SERVICE_DEMAND_START 0x00000003
4512 #define SERVICE_DISABLED 0x00000004
4513 
4514 #define SERVICE_ERROR_IGNORE 0x00000000
4515 #define SERVICE_ERROR_NORMAL 0x00000001
4516 #define SERVICE_ERROR_SEVERE 0x00000002
4517 #define SERVICE_ERROR_CRITICAL 0x00000003
4518 
4519 /* Service types */
4520 #define SERVICE_KERNEL_DRIVER 0x00000001
4521 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4522 #define SERVICE_ADAPTER 0x00000004
4523 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4524 
4525 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4526  SERVICE_RECOGNIZER_DRIVER )
4527 
4528 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4529 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4530 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4531 
4532 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4533 
4534 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4535  SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4536 
4537 
4538 typedef enum _CM_SERVICE_NODE_TYPE
4539 {
4540  DriverType = SERVICE_KERNEL_DRIVER,
4541  FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
4542  Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
4543  Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
4544  AdapterType = SERVICE_ADAPTER,
4545  RecognizerType = SERVICE_RECOGNIZER_DRIVER
4546 } SERVICE_NODE_TYPE;
4547 
4548 typedef enum _CM_SERVICE_LOAD_TYPE
4549 {
4550  BootLoad = SERVICE_BOOT_START,
4551  SystemLoad = SERVICE_SYSTEM_START,
4552  AutoLoad = SERVICE_AUTO_START,
4553  DemandLoad = SERVICE_DEMAND_START,
4554  DisableLoad = SERVICE_DISABLED
4555 } SERVICE_LOAD_TYPE;
4556 
4557 typedef enum _CM_ERROR_CONTROL_TYPE
4558 {
4559  IgnoreError = SERVICE_ERROR_IGNORE,
4560  NormalError = SERVICE_ERROR_NORMAL,
4561  SevereError = SERVICE_ERROR_SEVERE,
4562  CriticalError = SERVICE_ERROR_CRITICAL
4563 } SERVICE_ERROR_TYPE;
4564 
4565 
4566 
4567 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4568 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4569 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4570 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4571 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4572 
4573 #include "guiddef.h"
4574 
4575 typedef struct _RTL_CRITICAL_SECTION_DEBUG
4576 {
4577  WORD Type;
4578  WORD CreatorBackTraceIndex;
4579  struct _RTL_CRITICAL_SECTION *CriticalSection;
4580  LIST_ENTRY ProcessLocksList;
4581  DWORD EntryCount;
4582  DWORD ContentionCount;
4583  DWORD Spare[ 2 ];
4584 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
4585 
4586 typedef struct _RTL_CRITICAL_SECTION {
4587  PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
4588  LONG LockCount;
4589  LONG RecursionCount;
4590  HANDLE OwningThread;
4591  HANDLE LockSemaphore;
4592  ULONG_PTR SpinCount;
4593 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
4594 
4595 #endif /* __WINE_WINNT_H */