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