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