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