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
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 */
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 */
56 # error You need gcc >= 2.7 to build Wine on a 386
57 # endif /* __GNUC__ */
66 #define pascal __stdcall
69 #define _pascal __stdcall
72 #define _stdcall __stdcall
75 #define _fastcall __stdcall
78 #define __fastcall __stdcall
81 #define __export __stdcall
87 #define _cdecl __cdecl
113 #define __declspec(x)
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
128 /* Macro for structure packing and more. */
131 #define WINE_PACKED __attribute__((packed))
132 #define WINE_UNUSED __attribute__((unused))
134 #define WINE_PACKED /* nothing */
135 #define WINE_UNUSED /* nothing */
138 #if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64)) && !defined(MIDL_PASS)
139 # define DECLSPEC_IMPORT __declspec(dllimport)
141 # define DECLSPEC_IMPORT
144 #ifndef DECLSPEC_NORETURN
145 # if (_MSVC_VER >= 1200) && !defined(MIDL_PASS)
146 # define DECLSPEC_NORETURN __declspec(noreturn)
147 # elif defined(__GNUC__)
148 # define DECLSPEC_NORETURN __attribute__((noreturn))
150 # define DECLSPEC_NORETURN
154 #ifndef DECLSPEC_ALIGN
155 # if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
156 # define DECLSPEC_ALIGN(x) __declspec(align(x))
157 # elif defined(__GNUC__)
158 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
160 # define DECLSPEC_ALIGN(x)
164 #ifndef DECLSPEC_CACHEALIGN
165 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
168 #ifndef DECLSPEC_UUID
169 # if (_MSC_VER >= 1100) && defined (__cplusplus)
170 # define DECLSPEC_UUID(x) __declspec(uuid(x))
172 # define DECLSPEC_UUID(x)
176 #ifndef DECLSPEC_NOVTABLE
177 # if (_MSC_VER >= 1100) && defined(__cplusplus)
178 # define DECLSPEC_NOVTABLE __declspec(novtable)
180 # define DECLSPEC_NOVTABLE
184 #ifndef DECLSPEC_SELECTANY
185 #if (_MSC_VER >= 1100)
186 #define DECLSPEC_SELECTANY __declspec(selectany)
188 #define DECLSPEC_SELECTANY
193 # if (_MSC_VER >= 1210)
194 # define NOP_FUNCTION __noop
196 # define NOP_FUNCTION (void)0
200 #ifndef DECLSPEC_ADDRSAFE
201 # if (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
202 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
204 # define DECLSPEC_ADDRSAFE
209 # if (_MSC_VER >= 1200)
210 # define FORCEINLINE __forceinline
211 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
212 # define FORCEINLINE __attribute__((always_inline))
214 # define FORCEINLINE inline
218 #ifndef DECLSPEC_DEPRECATED
219 # if (_MSC_VER >= 1300) && !defined(MIDL_PASS)
220 # define DECLSPEC_DEPRECATED __declspec(deprecated)
221 # define DEPRECATE_SUPPORTED
222 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
223 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
224 # define DEPRECATE_SUPPORTED
226 # define DECLSPEC_DEPRECATED
227 # undef DEPRECATE_SUPPORTED
231 /* Anonymous union/struct handling */
234 # define NONAMELESSSTRUCT
235 # define NONAMELESSUNION
237 /* Anonymous struct support starts with gcc/g++ 2.96 */
238 # if !defined(NONAMELESSSTRUCT) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ < 96)))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
239 # define NONAMELESSSTRUCT
241 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
242 # if !defined(NONAMELESSUNION) && (defined(__GNUC__) && ((__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus)))))) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
243 # define NONAMELESSUNION
247 #ifndef NONAMELESSSTRUCT
248 #define DUMMYSTRUCTNAME
249 #define DUMMYSTRUCTNAME1
250 #define DUMMYSTRUCTNAME2
251 #define DUMMYSTRUCTNAME3
252 #define DUMMYSTRUCTNAME4
253 #define DUMMYSTRUCTNAME5
254 #else /* !defined(NONAMELESSSTRUCT) */
255 #define DUMMYSTRUCTNAME s
256 #define DUMMYSTRUCTNAME1 s1
257 #define DUMMYSTRUCTNAME2 s2
258 #define DUMMYSTRUCTNAME3 s3
259 #define DUMMYSTRUCTNAME4 s4
260 #define DUMMYSTRUCTNAME5 s5
261 #endif /* !defined(NONAMELESSSTRUCT) */
263 #ifndef NONAMELESSUNION
264 #define DUMMYUNIONNAME
265 #define DUMMYUNIONNAME1
266 #define DUMMYUNIONNAME2
267 #define DUMMYUNIONNAME3
268 #define DUMMYUNIONNAME4
269 #define DUMMYUNIONNAME5
270 #define DUMMYUNIONNAME6
271 #define DUMMYUNIONNAME7
272 #define DUMMYUNIONNAME8
273 #else /* !defined(NONAMELESSUNION) */
274 #define DUMMYUNIONNAME u
275 #define DUMMYUNIONNAME1 u1
276 #define DUMMYUNIONNAME2 u2
277 #define DUMMYUNIONNAME3 u3
278 #define DUMMYUNIONNAME4 u4
279 #define DUMMYUNIONNAME5 u5
280 #define DUMMYUNIONNAME6 u6
281 #define DUMMYUNIONNAME7 u7
282 #define DUMMYUNIONNAME8 u8
283 #endif /* !defined(NONAMELESSUNION) */
286 /**** Parts of windef.h that are needed here *****/
288 /* Misc. constants. */
294 #define NULL ((void*)0)
320 #define APPLICATION_ERROR_MASK 0x20000000
321 #define ERROR_SEVERITY_SUCCESS 0x00000000
322 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
323 #define ERROR_SEVERITY_WARNING 0x80000000
324 #define ERROR_SEVERITY_ERROR 0xC0000000
326 /* Standard data types */
327 typedef const void *LPCVOID
;
328 typedef int BOOL
, *PBOOL
, *LPBOOL
;
329 typedef unsigned char BYTE
, *PBYTE
, *LPBYTE
;
330 typedef unsigned char UCHAR
, *PUCHAR
;
331 typedef unsigned short USHORT
, *PUSHORT
;
332 typedef unsigned short WORD
, *PWORD
, *LPWORD
;
333 typedef int INT
, *PINT
, *LPINT
;
334 typedef unsigned int UINT
, *PUINT
;
335 typedef unsigned long DWORD
, *PDWORD
, *LPDWORD
;
336 typedef unsigned long ULONG
, *PULONG
;
337 typedef float FLOAT
, *PFLOAT
;
338 typedef double DOUBLE
;
342 /**** winnt.h proper *****/
344 /* Microsoft's macros for declaring functions */
347 # define EXTERN_C extern "C"
349 # define EXTERN_C extern
353 #define STDMETHODCALLTYPE __stdcall
354 #define STDMETHODVCALLTYPE __cdecl
355 #define STDAPICALLTYPE __stdcall
356 #define STDAPIVCALLTYPE __cdecl
358 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
359 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
360 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
361 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
362 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
363 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
364 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
365 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
368 /* Define the basic types */
372 typedef VOID
*PVOID
, *LPVOID
;
373 typedef BYTE BOOLEAN
, *PBOOLEAN
;
374 typedef char CHAR
, *PCHAR
;
375 typedef short SHORT
, *PSHORT
;
376 typedef long LONG
, *PLONG
, *LPLONG
;
378 /* Some systems might have wchar_t, but we really need 16 bit characters */
379 #ifndef WINE_WCHAR_DEFINED
380 #ifdef WINE_UNICODE_NATIVE
381 typedef wchar_t WCHAR
, *PWCHAR
;
383 typedef unsigned short WCHAR
, *PWCHAR
;
385 #define WINE_WCHAR_DEFINED
388 /* 'Extended/Wide' numerical types */
391 typedef signed __int64 LONGLONG
, *PLONGLONG
;
392 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
397 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
400 /* ANSI string types */
401 typedef CHAR
*PCH
, *LPCH
;
402 typedef const CHAR
*PCCH
, *LPCCH
;
403 typedef CHAR
*PSTR
, *LPSTR
;
404 typedef const CHAR
*PCSTR
, *LPCSTR
;
406 /* Unicode string types */
407 typedef WCHAR
*PWCH
, *LPWCH
;
408 typedef const WCHAR
*PCWCH
, *LPCWCH
;
409 typedef WCHAR
*PWSTR
, *LPWSTR
;
410 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
412 /* Neutral character and string types */
413 /* These are only defined for Winelib, i.e. _not_ defined for
414 * the emulator. The reason is they depend on the UNICODE
415 * macro which only exists in the user's code.
418 # ifdef WINE_UNICODE_REWRITE
420 /* Use this if your compiler does not provide a 16bit wchar_t type.
421 * Note that you will need to specify -fwritable-strings or an option
423 * In C++ both WINE_UNICODE_TEXT('c') and WINE_UNICODE_TEXT("str") are
424 * supported, but only the string form can be supported in C.
426 EXTERN_C
unsigned short* wine_rewrite_s4tos2(const wchar_t* str4
);
428 inline WCHAR
* wine_unicode_text(const wchar_t* str4
)
430 return (WCHAR
*)wine_rewrite_s4tos2(str4
);
432 inline WCHAR
wine_unicode_text(wchar_t chr4
)
436 # define WINE_UNICODE_TEXT(x) wine_unicode_text(L##x)
437 # else /* __cplusplus */
438 # define WINE_UNICODE_TEXT(x) ((WCHAR*)wine_rewrite_s4tos2(L##x))
439 # endif /* __cplusplus */
441 # else /* WINE_UNICODE_REWRITE */
443 /* Define WINE_UNICODE_NATIVE if:
444 * - your compiler provides a 16bit wchar_t type, e.g. gcc >= 2.96 with
445 * -fshort-wchar option
446 * - or if you decide to use the native 32bit Unix wchar_t type. Be aware
447 * though that the Wine APIs only support 16bit WCHAR characters for
448 * binary compatibility reasons.
449 * - or define nothing at all if you don't use Unicode, and blissfully
450 * ignore the issue :-)
452 # define WINE_UNICODE_TEXT(string) L##string
454 # endif /* WINE_UNICODE_REWRITE */
457 typedef WCHAR TCHAR
, *PTCHAR
;
458 typedef LPWSTR PTSTR
, LPTSTR
;
459 typedef LPCWSTR PCTSTR
, LPCTSTR
;
460 # define __TEXT(string) WINE_UNICODE_TEXT(string)
462 typedef CHAR TCHAR
, *PTCHAR
;
463 typedef LPSTR PTSTR
, LPTSTR
;
464 typedef LPCSTR PCTSTR
, LPCTSTR
;
465 # define __TEXT(string) string
466 # endif /* UNICODE */
467 # define TEXT(quote) __TEXT(quote)
468 #endif /* __WINE__ */
470 /* Misc common WIN32 types */
472 typedef LONG HRESULT
;
473 typedef DWORD LCID
, *PLCID
;
475 typedef DWORD EXECUTION_STATE
;
479 /* FIXME: Wine does not compile with strict on, therefore strict
480 * handles are presently only usable on machines where sizeof(UINT) ==
481 * sizeof(void*). HANDLEs are supposed to be void* but a large amount
482 * of WINE code operates on HANDLES as if they are UINTs. So to WINE
483 * they exist as UINTs but to the Winelib user who turns on strict,
484 * they exist as void*. If there is a size difference between UINT and
485 * void* then things get ugly.
487 * Here is the plan to convert Wine to STRICT:
489 * Types will be converted one at a time by volunteers who will compile
490 * Wine with STRICT turned on. Handles that have not been converted yet
491 * will be declared with DECLARE_OLD_HANDLE. Converted handles are
492 * declared with DECLARE_HANDLE.
493 * See the bug report 90 for more details:
494 * http://wine.codeweavers.com/bugzilla/show_bug.cgi?id=90
497 * when compiling Wine we always treat HANDLE as an UINT. Then when
498 * we're ready we'll remove the '!defined(__WINE__)' (the equivalent
499 * of converting it from DECLARE_OLD_HANDLE to DECLARE_HANDLE).
501 #if defined(STRICT) && !defined(__WINE__)
502 typedef VOID
* HANDLE
;
503 #define DECLARE_OLD_HANDLE(a) \
504 typedef struct a##__ { int unused; } *a; \
505 typedef a *P##a, *LP##a
509 #define DECLARE_OLD_HANDLE(a) \
511 typedef a *P##a, *LP##a
513 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
516 #define DECLARE_HANDLE(a) \
517 typedef struct a##__ { int unused; } *a; \
518 typedef a *P##a, *LP##a
520 #define DECLARE_HANDLE(a) \
522 typedef a *P##a, *LP##a
527 /* Argument 1 passed to the DllEntryProc. */
528 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
529 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
530 #define DLL_THREAD_ATTACH 2 /* attach new thread */
531 #define DLL_THREAD_DETACH 3 /* detach thread */
534 /* u.x.wProcessorArchitecture (NT) */
535 #define PROCESSOR_ARCHITECTURE_INTEL 0
536 #define PROCESSOR_ARCHITECTURE_MIPS 1
537 #define PROCESSOR_ARCHITECTURE_ALPHA 2
538 #define PROCESSOR_ARCHITECTURE_PPC 3
539 #define PROCESSOR_ARCHITECTURE_SHX 4
540 #define PROCESSOR_ARCHITECTURE_ARM 5
541 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
543 /* dwProcessorType */
544 #define PROCESSOR_INTEL_386 386
545 #define PROCESSOR_INTEL_486 486
546 #define PROCESSOR_INTEL_PENTIUM 586
547 #define PROCESSOR_INTEL_860 860
548 #define PROCESSOR_MIPS_R2000 2000
549 #define PROCESSOR_MIPS_R3000 3000
550 #define PROCESSOR_MIPS_R4000 4000
551 #define PROCESSOR_ALPHA_21064 21064
552 #define PROCESSOR_PPC_601 601
553 #define PROCESSOR_PPC_603 603
554 #define PROCESSOR_PPC_604 604
555 #define PROCESSOR_PPC_620 620
556 #define PROCESSOR_HITACHI_SH3 10003
557 #define PROCESSOR_HITACHI_SH3E 10004
558 #define PROCESSOR_HITACHI_SH4 10005
559 #define PROCESSOR_MOTOROLA_821 821
560 #define PROCESSOR_SHx_SH3 103
561 #define PROCESSOR_SHx_SH4 104
562 #define PROCESSOR_STRONGARM 2577
563 #define PROCESSOR_ARM720 1824 /* 0x720 */
564 #define PROCESSOR_ARM820 2080 /* 0x820 */
565 #define PROCESSOR_ARM920 2336 /* 0x920 */
566 #define PROCESSOR_ARM_7TDMI 70001
568 #define MAXIMUM_PROCESSORS 32
569 typedef struct _MEMORY_BASIC_INFORMATION
572 LPVOID AllocationBase
;
573 DWORD AllocationProtect
;
578 } MEMORY_BASIC_INFORMATION
,*LPMEMORY_BASIC_INFORMATION
,*PMEMORY_BASIC_INFORMATION
;
580 #define PAGE_NOACCESS 0x01
581 #define PAGE_READONLY 0x02
582 #define PAGE_READWRITE 0x04
583 #define PAGE_WRITECOPY 0x08
584 #define PAGE_EXECUTE 0x10
585 #define PAGE_EXECUTE_READ 0x20
586 #define PAGE_EXECUTE_READWRITE 0x40
587 #define PAGE_EXECUTE_WRITECOPY 0x80
588 #define PAGE_GUARD 0x100
589 #define PAGE_NOCACHE 0x200
591 #define MEM_COMMIT 0x00001000
592 #define MEM_RESERVE 0x00002000
593 #define MEM_DECOMMIT 0x00004000
594 #define MEM_RELEASE 0x00008000
595 #define MEM_FREE 0x00010000
596 #define MEM_PRIVATE 0x00020000
597 #define MEM_MAPPED 0x00040000
598 #define MEM_RESET 0x00080000
599 #define MEM_TOP_DOWN 0x00100000
601 #define MEM_SYSTEM 0x80000000
604 #define SEC_FILE 0x00800000
605 #define SEC_IMAGE 0x01000000
606 #define SEC_RESERVE 0x04000000
607 #define SEC_COMMIT 0x08000000
608 #define SEC_NOCACHE 0x10000000
609 #define MEM_IMAGE SEC_IMAGE
614 #define MINSHORT 0x8000
615 #define MAXSHORT 0x7fff
616 #define MINLONG 0x80000000
617 #define MAXLONG 0x7fffffff
619 #define MAXWORD 0xffff
620 #define MAXDWORD 0xffffffff
622 #define FIELD_OFFSET(type, field) \
623 ((LONG)(INT)&(((type *)0)->field))
625 #define CONTAINING_RECORD(address, type, field) \
626 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
630 typedef struct _LIST_ENTRY
{
631 struct _LIST_ENTRY
*Flink
;
632 struct _LIST_ENTRY
*Blink
;
633 } LIST_ENTRY
, *PLIST_ENTRY
;
635 typedef struct _SINGLE_LIST_ENTRY
{
636 struct _SINGLE_LIST_ENTRY
*Next
;
637 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
641 #define HEAP_NO_SERIALIZE 0x00000001
642 #define HEAP_GROWABLE 0x00000002
643 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
644 #define HEAP_ZERO_MEMORY 0x00000008
645 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
646 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
647 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
648 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
649 #define HEAP_CREATE_ALIGN_16 0x00010000
650 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
652 /* This flag allows it to create heaps shared by all processes under win95,
653 FIXME: correct name */
654 #define HEAP_SHARED 0x04000000
656 /* Processor feature flags. */
657 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
658 #define PF_FLOATING_POINT_EMULATED 1
659 #define PF_COMPARE_EXCHANGE_DOUBLE 2
660 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
661 #define PF_PPC_MOVEMEM_64BIT_OK 4
662 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
663 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
664 #define PF_AMD3D_INSTRUCTIONS_AVAILABLE 7
665 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
668 /* Execution state flags */
669 #define ES_SYSTEM_REQUIRED 0x00000001
670 #define ES_DISPLAY_REQUIRED 0x00000002
671 #define ES_USER_PRESENT 0x00000004
672 #define ES_CONTINUOUS 0x80000000
674 /* The Win32 register context */
676 /* CONTEXT is the CPU-dependent context; it should be used */
677 /* wherever a platform-specific context is needed (e.g. exception */
678 /* handling, Win32 register functions). */
680 /* CONTEXT86 is the i386-specific context; it should be used */
681 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
682 /* Win16 register functions), so that this code can be compiled */
683 /* on all platforms. */
685 #define SIZE_OF_80387_REGISTERS 80
687 typedef struct _FLOATING_SAVE_AREA
696 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
698 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
700 #define MAXIMUM_SUPPORTED_EXTENSION 512
702 typedef struct _CONTEXT86
706 /* These are selected by CONTEXT_DEBUG_REGISTERS */
714 /* These are selected by CONTEXT_FLOATING_POINT */
715 FLOATING_SAVE_AREA FloatSave
;
717 /* These are selected by CONTEXT_SEGMENTS */
723 /* These are selected by CONTEXT_INTEGER */
731 /* These are selected by CONTEXT_CONTROL */
739 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
742 #define CONTEXT_X86 0x00010000
743 #define CONTEXT_i386 CONTEXT_X86
744 #define CONTEXT_i486 CONTEXT_X86
746 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
747 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
748 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
749 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
750 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
751 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
753 /* i386 context definitions */
756 #define CONTEXT_CONTROL CONTEXT86_CONTROL
757 #define CONTEXT_INTEGER CONTEXT86_INTEGER
758 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
759 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
760 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
761 #define CONTEXT_FULL CONTEXT86_FULL
763 typedef CONTEXT86 CONTEXT
;
765 #endif /* __i386__ */
767 /* Alpha context definitions */
770 #define CONTEXT_ALPHA 0x00020000
772 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
773 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
774 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
775 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
777 typedef struct _CONTEXT
779 /* selected by CONTEXT_FLOATING_POINT */
813 /* selected by CONTEXT_INTEGER */
847 /* selected by CONTEXT_FLOATING_POINT */
851 /* selected by CONTEXT_CONTROL */
858 #define _QUAD_PSR_OFFSET HighSoftFpcr
859 #define _QUAD_FLAGS_OFFSET HighFir
863 /* Mips context definitions */
866 #define CONTEXT_R4000 0x00010000
868 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
869 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
870 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
872 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
874 typedef struct _CONTEXT
877 /* These are selected by CONTEXT_FLOATING_POINT */
911 /* These are selected by CONTEXT_INTEGER */
947 /* These are selected by CONTEXT_FLOATING_POINT */
950 /* These are selected by CONTEXT_CONTROL */
960 /* PowerPC context definitions */
963 #define CONTEXT_CONTROL 0x0001
964 #define CONTEXT_FLOATING_POINT 0x0002
965 #define CONTEXT_INTEGER 0x0004
966 #define CONTEXT_DEBUG_REGISTERS 0x0008
967 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
971 /* These are selected by CONTEXT_FLOATING_POINT */
1006 /* These are selected by CONTEXT_INTEGER */
1043 /* These are selected by CONTEXT_CONTROL */
1045 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1052 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1063 typedef struct _STACK_FRAME_HEADER
1080 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1082 #endif /* __PPC__ */
1089 * There is no official CONTEXT structure defined for the SPARC
1090 * architecture, so I just made one up.
1092 * This structure is valid only for 32-bit SPARC architectures,
1093 * not for 64-bit SPARC.
1095 * Note that this structure contains only the 'top-level' registers;
1096 * the rest of the register window chain is not visible.
1098 * The layout follows the Solaris 'prgregset_t' structure.
1102 #define CONTEXT_SPARC 0x10000000
1104 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1105 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1106 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1108 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1110 typedef struct _CONTEXT
1114 /* These are selected by CONTEXT_INTEGER */
1148 /* These are selected by CONTEXT_CONTROL */
1156 /* FIXME: floating point registers missing */
1160 #endif /* __sparc__ */
1162 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1163 #error You need to define a CONTEXT for your CPU
1166 typedef CONTEXT
*PCONTEXT
;
1170 /* Macros to retrieve the current context */
1174 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
1175 __ASM_GLOBAL_FUNC( name, \
1176 "call " __ASM_NAME("__wine_call_from_32_regs") "\n\t" \
1177 ".long " __ASM_NAME(#fn) "\n\t" \
1178 ".byte " #args ", " #args )
1179 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1180 extern void WINAPI name(void); \
1181 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
1182 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1183 extern void WINAPI name( t1 a1 ); \
1184 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
1185 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1186 extern void WINAPI name( t1 a1, t2 a2 ); \
1187 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
1188 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1189 extern void WINAPI name( t1 a1, t2 a2, t3 a3 ); \
1190 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
1191 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1192 extern void WINAPI name( t1 a1, t2 a2, t3 a3, t4 a4 ); \
1193 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
1195 #endif /* __i386__ */
1200 static DWORD
__builtin_return_address(int p_iDepth
)
1205 asm("mov %fp, %l0");
1207 asm("sub %i0, 1, %i0");
1210 asm("ld [%l0+56], %l0");
1212 asm("ld [%l0+60], %i0");
1216 /* FIXME: use getcontext() to retrieve full context */
1217 #define _GET_CONTEXT \
1219 do { memset(&context, 0, sizeof(CONTEXT)); \
1220 context.ContextFlags = CONTEXT_CONTROL; \
1221 context.pc = (DWORD)__builtin_return_address(0); \
1224 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1225 void WINAPI name ( void ) \
1226 { _GET_CONTEXT; fn( &context ); }
1227 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1228 void WINAPI name ( t1 a1 ) \
1229 { _GET_CONTEXT; fn( a1, &context ); }
1230 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1231 void WINAPI name ( t1 a1, t2 a2 ) \
1232 { _GET_CONTEXT; fn( a1, a2, &context ); }
1233 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1234 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
1235 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
1236 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1237 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
1238 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
1240 #endif /* __sparc__ */
1244 /* FIXME: use getcontext() to retrieve full context */
1245 #define _GET_CONTEXT \
1247 do { memset(&context, 0, sizeof(CONTEXT)); \
1248 context.ContextFlags = CONTEXT_CONTROL; \
1251 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
1252 void WINAPI name ( void ) \
1253 { _GET_CONTEXT; fn( &context ); }
1254 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
1255 void WINAPI name ( t1 a1 ) \
1256 { _GET_CONTEXT; fn( a1, &context ); }
1257 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
1258 void WINAPI name ( t1 a1, t2 a2 ) \
1259 { _GET_CONTEXT; fn( a1, a2, &context ); }
1260 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
1261 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
1262 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
1263 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
1264 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
1265 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
1267 #endif /* __PPC__ */
1270 #ifndef DEFINE_REGS_ENTRYPOINT_0
1271 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
1274 #endif /* __WINE__ */
1282 #define MAKELCID(l, s) (MAKELONG(l, s))
1284 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1285 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1286 #define SUBLANGID(l) ((WORD)(l) >> 10)
1288 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1289 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1291 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1292 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1293 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1294 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1295 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1297 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x28,
1298 * 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x3a, 0x3b, 0x3c
1300 #define LANG_NEUTRAL 0x00
1301 #define LANG_INVARIANT 0x7f
1303 #define LANG_AFRIKAANS 0x36
1304 #define LANG_ALBANIAN 0x1c
1305 #define LANG_ARABIC 0x01
1306 #define LANG_ARMENIAN 0x2b
1307 #define LANG_ASSAMESE 0x4d
1308 #define LANG_AZERI 0x2c
1309 #define LANG_BASQUE 0x2d
1310 #define LANG_BELARUSIAN 0x23
1311 #define LANG_BENGALI 0x45
1312 #define LANG_BULGARIAN 0x02
1313 #define LANG_CATALAN 0x03
1314 #define LANG_CHINESE 0x04
1315 #define LANG_CROATIAN 0x1a
1316 #define LANG_CZECH 0x05
1317 #define LANG_DANISH 0x06
1318 #define LANG_DIVEHI 0x65
1319 #define LANG_DUTCH 0x13
1320 #define LANG_ENGLISH 0x09
1321 #define LANG_ESTONIAN 0x25
1322 #define LANG_FAEROESE 0x38
1323 #define LANG_FARSI 0x29
1324 #define LANG_FINNISH 0x0b
1325 #define LANG_FRENCH 0x0c
1326 #define LANG_GALICIAN 0x56
1327 #define LANG_GEORGIAN 0x37
1328 #define LANG_GERMAN 0x07
1329 #define LANG_GREEK 0x08
1330 #define LANG_GUJARATI 0x47
1331 #define LANG_HEBREW 0x0d
1332 #define LANG_HINDI 0x39
1333 #define LANG_HUNGARIAN 0x0e
1334 #define LANG_ICELANDIC 0x0f
1335 #define LANG_INDONESIAN 0x21
1336 #define LANG_ITALIAN 0x10
1337 #define LANG_JAPANESE 0x11
1338 #define LANG_KANNADA 0x4b
1339 #define LANG_KASHMIRI 0x60
1340 #define LANG_KAZAK 0x3f
1341 #define LANG_KONKANI 0x57
1342 #define LANG_KOREAN 0x12
1343 #define LANG_KYRGYZ 0x40
1344 #define LANG_LATVIAN 0x26
1345 #define LANG_LITHUANIAN 0x27
1346 #define LANG_MACEDONIAN 0x2f
1347 #define LANG_MALAY 0x3e
1348 #define LANG_MALAYALAM 0x4c
1349 #define LANG_MANIPURI 0x58
1350 #define LANG_MARATHI 0x4e
1351 #define LANG_MONGOLIAN 0x50
1352 #define LANG_NEPALI 0x61
1353 #define LANG_NORWEGIAN 0x14
1354 #define LANG_ORIYA 0x48
1355 #define LANG_POLISH 0x15
1356 #define LANG_PORTUGUESE 0x16
1357 #define LANG_PUNJABI 0x46
1358 #define LANG_ROMANIAN 0x18
1359 #define LANG_RUSSIAN 0x19
1360 #define LANG_SANSKRIT 0x4f
1361 #define LANG_SERBIAN 0x1a
1362 #define LANG_SINDHI 0x59
1363 #define LANG_SLOVAK 0x1b
1364 #define LANG_SLOVENIAN 0x24
1365 #define LANG_SPANISH 0x0a
1366 #define LANG_SWAHILI 0x41
1367 #define LANG_SWEDISH 0x1d
1368 #define LANG_SYRIAC 0x5a
1369 #define LANG_TAMIL 0x49
1370 #define LANG_TATAR 0x44
1371 #define LANG_TELUGU 0x4a
1372 #define LANG_THAI 0x1e
1373 #define LANG_TURKISH 0x1f
1374 #define LANG_UKRAINIAN 0x22
1375 #define LANG_URDU 0x20
1376 #define LANG_UZBEK 0x43
1377 #define LANG_VIETNAMESE 0x2a
1379 /* FIXME: these are not in the Windows header */
1380 #define LANG_GAELIC 0x3c
1381 #define LANG_MALTESE 0x3a
1382 #define LANG_MAORI 0x28
1383 #define LANG_RHAETO_ROMANCE 0x17
1384 #define LANG_SAAMI 0x3b
1385 #define LANG_SORBIAN 0x2e
1386 #define LANG_SUTU 0x30
1387 #define LANG_TSONGA 0x31
1388 #define LANG_TSWANA 0x32
1389 #define LANG_VENDA 0x33
1390 #define LANG_XHOSA 0x34
1391 #define LANG_ZULU 0x35
1393 /* non standard; keep the number high enough (but < 0xff) */
1394 #define LANG_ESPERANTO 0x8f
1395 #define LANG_WALON 0x90
1396 #define LANG_CORNISH 0x91
1397 #define LANG_WELSH 0x92
1398 #define LANG_BRETON 0x93
1400 /* Sublanguage definitions */
1401 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1402 #define SUBLANG_DEFAULT 0x01 /* user default */
1403 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1405 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1406 #define SUBLANG_ARABIC_IRAQ 0x02
1407 #define SUBLANG_ARABIC_EGYPT 0x03
1408 #define SUBLANG_ARABIC_LIBYA 0x04
1409 #define SUBLANG_ARABIC_ALGERIA 0x05
1410 #define SUBLANG_ARABIC_MOROCCO 0x06
1411 #define SUBLANG_ARABIC_TUNISIA 0x07
1412 #define SUBLANG_ARABIC_OMAN 0x08
1413 #define SUBLANG_ARABIC_YEMEN 0x09
1414 #define SUBLANG_ARABIC_SYRIA 0x0a
1415 #define SUBLANG_ARABIC_JORDAN 0x0b
1416 #define SUBLANG_ARABIC_LEBANON 0x0c
1417 #define SUBLANG_ARABIC_KUWAIT 0x0d
1418 #define SUBLANG_ARABIC_UAE 0x0e
1419 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1420 #define SUBLANG_ARABIC_QATAR 0x10
1421 #define SUBLANG_AZERI_LATIN 0x01
1422 #define SUBLANG_AZERI_CYRILLIC 0x02
1423 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1424 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1425 #define SUBLANG_CHINESE_HONGKONG 0x03
1426 #define SUBLANG_CHINESE_SINGAPORE 0x04
1427 #define SUBLANG_CHINESE_MACAU 0x05
1428 #define SUBLANG_DUTCH 0x01
1429 #define SUBLANG_DUTCH_BELGIAN 0x02
1430 #define SUBLANG_ENGLISH_US 0x01
1431 #define SUBLANG_ENGLISH_UK 0x02
1432 #define SUBLANG_ENGLISH_AUS 0x03
1433 #define SUBLANG_ENGLISH_CAN 0x04
1434 #define SUBLANG_ENGLISH_NZ 0x05
1435 #define SUBLANG_ENGLISH_EIRE 0x06
1436 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1437 #define SUBLANG_ENGLISH_JAMAICA 0x08
1438 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1439 #define SUBLANG_ENGLISH_BELIZE 0x0a
1440 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1441 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1442 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1443 #define SUBLANG_FRENCH 0x01
1444 #define SUBLANG_FRENCH_BELGIAN 0x02
1445 #define SUBLANG_FRENCH_CANADIAN 0x03
1446 #define SUBLANG_FRENCH_SWISS 0x04
1447 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1448 #define SUBLANG_FRENCH_MONACO 0x06
1449 #define SUBLANG_GERMAN 0x01
1450 #define SUBLANG_GERMAN_SWISS 0x02
1451 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1452 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1453 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1454 #define SUBLANG_ITALIAN 0x01
1455 #define SUBLANG_ITALIAN_SWISS 0x02
1456 #define SUBLANG_KASHMIRI_SASIA 0x02
1457 #define SUBLANG_KASHMIRI_INDIA 0x02
1458 #define SUBLANG_KOREAN 0x01
1459 #define SUBLANG_LITHUANIAN 0x01
1460 #define SUBLANG_MALAY_MALAYSIA 0x01
1461 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1462 #define SUBLANG_NEPALI_INDIA 0x02
1463 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1464 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1465 #define SUBLANG_PORTUGUESE 0x02
1466 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1467 #define SUBLANG_SERBIAN_LATIN 0x02
1468 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1469 #define SUBLANG_SPANISH 0x01
1470 #define SUBLANG_SPANISH_MEXICAN 0x02
1471 #define SUBLANG_SPANISH_MODERN 0x03
1472 #define SUBLANG_SPANISH_GUATEMALA 0x04
1473 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1474 #define SUBLANG_SPANISH_PANAMA 0x06
1475 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1476 #define SUBLANG_SPANISH_VENEZUELA 0x08
1477 #define SUBLANG_SPANISH_COLOMBIA 0x09
1478 #define SUBLANG_SPANISH_PERU 0x0a
1479 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1480 #define SUBLANG_SPANISH_ECUADOR 0x0c
1481 #define SUBLANG_SPANISH_CHILE 0x0d
1482 #define SUBLANG_SPANISH_URUGUAY 0x0e
1483 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1484 #define SUBLANG_SPANISH_BOLIVIA 0x10
1485 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1486 #define SUBLANG_SPANISH_HONDURAS 0x12
1487 #define SUBLANG_SPANISH_NICARAGUA 0x13
1488 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1489 #define SUBLANG_SWEDISH 0x01
1490 #define SUBLANG_SWEDISH_FINLAND 0x02
1491 #define SUBLANG_URDU_PAKISTAN 0x01
1492 #define SUBLANG_URDU_INDIA 0x02
1493 #define SUBLANG_UZBEK_LATIN 0x01
1494 #define SUBLANG_UZBEK_CYRILLIC 0x02
1496 /* FIXME: these are not in the Windows header */
1497 #define SUBLANG_DUTCH_SURINAM 0x03
1498 #define SUBLANG_ROMANIAN 0x01
1499 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1500 #define SUBLANG_RUSSIAN 0x01
1501 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1502 #define SUBLANG_CROATIAN 0x01
1503 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1504 #define SUBLANG_GAELIC 0x01
1505 #define SUBLANG_GAELIC_SCOTTISH 0x02
1506 #define SUBLANG_GAELIC_MANX 0x03
1513 #define SORT_DEFAULT 0x0
1514 #define SORT_JAPANESE_XJIS 0x0
1515 #define SORT_JAPANESE_UNICODE 0x1
1516 #define SORT_CHINESE_BIG5 0x0
1517 #define SORT_CHINESE_UNICODE 0x1
1518 #define SORT_KOREAN_KSC 0x0
1519 #define SORT_KOREAN_UNICODE 0x1
1524 * Definitions for IsTextUnicode()
1527 #define IS_TEXT_UNICODE_ASCII16 0x0001
1528 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1529 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1530 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1531 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1532 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1533 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1534 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1535 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1536 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1537 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1538 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1539 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1540 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1541 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1542 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1544 #include "ntstatus.h"
1546 #define MAXIMUM_WAIT_OBJECTS 64
1547 #define MAXIMUM_SUSPEND_COUNT 127
1551 * From OS/2 2.0 exception handling
1552 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1555 #define EH_NONCONTINUABLE 0x01
1556 #define EH_UNWINDING 0x02
1557 #define EH_EXIT_UNWIND 0x04
1558 #define EH_STACK_INVALID 0x08
1559 #define EH_NESTED_CALL 0x10
1561 #define EXCEPTION_CONTINUABLE 0
1562 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1565 * The exception record used by Win32 to give additional information
1566 * about exception to exception handlers.
1569 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1571 typedef struct __EXCEPTION_RECORD
1573 DWORD ExceptionCode
;
1574 DWORD ExceptionFlags
;
1575 struct __EXCEPTION_RECORD
*ExceptionRecord
;
1577 LPVOID ExceptionAddress
;
1578 DWORD NumberParameters
;
1579 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
1580 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
1583 * The exception pointers structure passed to exception filters
1584 * in except() and the UnhandledExceptionFilter().
1587 typedef struct _EXCEPTION_POINTERS
1589 PEXCEPTION_RECORD ExceptionRecord
;
1590 PCONTEXT ContextRecord
;
1591 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
1595 * The exception frame, used for registering exception handlers
1596 * Win32 cares only about this, but compilers generally emit
1597 * larger exception frames for their own use.
1600 struct __EXCEPTION_FRAME
;
1602 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct __EXCEPTION_FRAME
*,
1603 PCONTEXT
,struct __EXCEPTION_FRAME
**);
1605 typedef struct __EXCEPTION_FRAME
1607 struct __EXCEPTION_FRAME
*Prev
;
1608 PEXCEPTION_HANDLER Handler
;
1609 } EXCEPTION_FRAME
, *PEXCEPTION_FRAME
;
1612 * function pointer to a exception filter
1615 typedef LONG (CALLBACK
*PTOP_LEVEL_EXCEPTION_FILTER
)(PEXCEPTION_POINTERS ExceptionInfo
);
1616 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
;
1618 DWORD WINAPI
UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers
);
1619 LPTOP_LEVEL_EXCEPTION_FILTER
1620 WINAPI
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter
);
1622 /* status values for ContinueDebugEvent */
1623 #define DBG_CONTINUE 0x00010002
1624 #define DBG_TERMINATE_THREAD 0x40010003
1625 #define DBG_TERMINATE_PROCESS 0x40010004
1626 #define DBG_CONTROL_C 0x40010005
1627 #define DBG_CONTROL_BREAK 0x40010008
1628 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1630 typedef struct _NT_TIB
1632 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
1640 PVOID ArbitraryUserPointer
;
1641 struct _NT_TIB
*Self
;
1646 #if defined(__i386__) && defined(__GNUC__)
1647 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
1648 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1651 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
1654 #elif defined(__i386__) && defined(_MSC_VER)
1655 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1658 __asm mov eax
, fs
:[0x18];
1662 #elif defined(__powerpc__)
1663 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
1664 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1667 __asm__("\tmr %0, 2" : "=r" (teb
));
1671 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
1676 * File formats definitions
1679 typedef struct _IMAGE_DOS_HEADER
{
1680 WORD e_magic
; /* 00: MZ Header signature */
1681 WORD e_cblp
; /* 02: Bytes on last page of file */
1682 WORD e_cp
; /* 04: Pages in file */
1683 WORD e_crlc
; /* 06: Relocations */
1684 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
1685 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
1686 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
1687 WORD e_ss
; /* 0e: Initial (relative) SS value */
1688 WORD e_sp
; /* 10: Initial SP value */
1689 WORD e_csum
; /* 12: Checksum */
1690 WORD e_ip
; /* 14: Initial IP value */
1691 WORD e_cs
; /* 16: Initial (relative) CS value */
1692 WORD e_lfarlc
; /* 18: File address of relocation table */
1693 WORD e_ovno
; /* 1a: Overlay number */
1694 WORD e_res
[4]; /* 1c: Reserved words */
1695 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
1696 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
1697 WORD e_res2
[10]; /* 28: Reserved words */
1698 DWORD e_lfanew
; /* 3c: Offset to extended header */
1699 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
1701 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1702 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1703 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1704 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1705 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1706 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1709 * This is the Windows executable (NE) header.
1710 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1714 WORD ne_magic
; /* 00 NE signature 'NE' */
1715 BYTE ne_ver
; /* 02 Linker version number */
1716 BYTE ne_rev
; /* 03 Linker revision number */
1717 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
1718 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
1719 LONG ne_crc
; /* 08 Checksum */
1720 WORD ne_flags
; /* 0c Flags about segments in this file */
1721 WORD ne_autodata
; /* 0e Automatic data segment number */
1722 WORD ne_heap
; /* 10 Initial size of local heap */
1723 WORD ne_stack
; /* 12 Initial size of stack */
1724 DWORD ne_csip
; /* 14 Initial CS:IP */
1725 DWORD ne_sssp
; /* 18 Initial SS:SP */
1726 WORD ne_cseg
; /* 1c # of entries in segment table */
1727 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
1728 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
1729 WORD ne_segtab
; /* 22 Offset to segment table */
1730 WORD ne_rsrctab
; /* 24 Offset to resource table */
1731 WORD ne_restab
; /* 26 Offset to resident-name table */
1732 WORD ne_modtab
; /* 28 Offset to module reference table */
1733 WORD ne_imptab
; /* 2a Offset to imported name table */
1734 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
1735 WORD ne_cmovent
; /* 30 # of movable entry points */
1736 WORD ne_align
; /* 32 Logical sector alignment shift count */
1737 WORD ne_cres
; /* 34 # of resource segments */
1738 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
1739 BYTE ne_flagsothers
; /* 37 Additional information flags */
1740 WORD fastload_offset
; /* 38 Offset to fast load area (should be ne_pretthunks)*/
1741 WORD fastload_length
; /* 3a Length of fast load area (should be ne_psegrefbytes) */
1742 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
1743 WORD ne_expver
; /* 3e Expected Windows version number */
1744 } IMAGE_OS2_HEADER
,*PIMAGE_OS2_HEADER
;
1746 typedef struct _IMAGE_VXD_HEADER
{
1761 DWORD e32_lastpagesize
;
1762 DWORD e32_fixupsize
;
1779 DWORD e32_impmodcnt
;
1785 DWORD e32_cbnrestab
;
1788 DWORD e32_debuginfo
;
1790 DWORD e32_instpreload
;
1791 DWORD e32_instdemand
;
1794 DWORD e32_winresoff
;
1795 DWORD e32_winreslen
;
1798 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
1801 /* These defines describe the meanings of the bits in the Characteristics
1804 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1805 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1806 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1807 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1808 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
1809 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
1810 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1811 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1812 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1813 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1814 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
1815 #define IMAGE_FILE_SYSTEM 0x1000
1816 #define IMAGE_FILE_DLL 0x2000
1817 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
1818 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1820 /* These are the settings of the Machine field. */
1821 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1822 #define IMAGE_FILE_MACHINE_I860 0x14d
1823 #define IMAGE_FILE_MACHINE_I386 0x14c
1824 #define IMAGE_FILE_MACHINE_R3000 0x162
1825 #define IMAGE_FILE_MACHINE_R4000 0x166
1826 #define IMAGE_FILE_MACHINE_R10000 0x168
1827 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1828 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
1830 #define IMAGE_SIZEOF_FILE_HEADER 20
1832 /* Possible Magic values */
1833 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1834 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1836 /* These are indexes into the DataDirectory array */
1837 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1838 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1839 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1840 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1841 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1842 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1843 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1844 #define IMAGE_FILE_DESCRIPTION_STRING 7
1845 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1846 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1847 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1849 /* Directory Entries, indices into the DataDirectory array */
1851 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1852 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1853 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1854 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1855 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1856 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1857 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1858 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1859 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1860 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1861 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1862 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1863 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1864 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1865 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1867 /* Subsystem Values */
1869 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1870 #define IMAGE_SUBSYSTEM_NATIVE 1
1871 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1872 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
1873 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1874 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1876 typedef struct _IMAGE_FILE_HEADER
{
1878 WORD NumberOfSections
;
1879 DWORD TimeDateStamp
;
1880 DWORD PointerToSymbolTable
;
1881 DWORD NumberOfSymbols
;
1882 WORD SizeOfOptionalHeader
;
1883 WORD Characteristics
;
1884 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
1886 typedef struct _IMAGE_DATA_DIRECTORY
{
1887 DWORD VirtualAddress
;
1889 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
1891 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1893 typedef struct _IMAGE_OPTIONAL_HEADER
{
1895 /* Standard fields */
1897 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
1898 BYTE MajorLinkerVersion
;
1899 BYTE MinorLinkerVersion
;
1901 DWORD SizeOfInitializedData
;
1902 DWORD SizeOfUninitializedData
;
1903 DWORD AddressOfEntryPoint
; /* 0x10 */
1907 /* NT additional fields */
1910 DWORD SectionAlignment
; /* 0x20 */
1911 DWORD FileAlignment
;
1912 WORD MajorOperatingSystemVersion
;
1913 WORD MinorOperatingSystemVersion
;
1914 WORD MajorImageVersion
;
1915 WORD MinorImageVersion
;
1916 WORD MajorSubsystemVersion
; /* 0x30 */
1917 WORD MinorSubsystemVersion
;
1918 DWORD Win32VersionValue
;
1920 DWORD SizeOfHeaders
;
1921 DWORD CheckSum
; /* 0x40 */
1923 WORD DllCharacteristics
;
1924 DWORD SizeOfStackReserve
;
1925 DWORD SizeOfStackCommit
;
1926 DWORD SizeOfHeapReserve
; /* 0x50 */
1927 DWORD SizeOfHeapCommit
;
1929 DWORD NumberOfRvaAndSizes
;
1930 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
1932 } IMAGE_OPTIONAL_HEADER
, *PIMAGE_OPTIONAL_HEADER
;
1934 typedef struct _IMAGE_NT_HEADERS
{
1935 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
1936 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
1937 IMAGE_OPTIONAL_HEADER OptionalHeader
; /* 0x18 */
1938 } IMAGE_NT_HEADERS
, *PIMAGE_NT_HEADERS
;
1940 #define IMAGE_SIZEOF_SHORT_NAME 8
1942 typedef struct _IMAGE_SECTION_HEADER
{
1943 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
1945 DWORD PhysicalAddress
;
1948 DWORD VirtualAddress
;
1949 DWORD SizeOfRawData
;
1950 DWORD PointerToRawData
;
1951 DWORD PointerToRelocations
;
1952 DWORD PointerToLinenumbers
;
1953 WORD NumberOfRelocations
;
1954 WORD NumberOfLinenumbers
;
1955 DWORD Characteristics
;
1956 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
1958 #define IMAGE_SIZEOF_SECTION_HEADER 40
1960 #define IMAGE_FIRST_SECTION(ntheader) \
1961 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1962 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1964 /* These defines are for the Characteristics bitfield. */
1965 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1966 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1967 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1968 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1969 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
1970 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1972 #define IMAGE_SCN_CNT_CODE 0x00000020
1973 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1974 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1976 #define IMAGE_SCN_LNK_OTHER 0x00000100
1977 #define IMAGE_SCN_LNK_INFO 0x00000200
1978 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1979 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1980 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1982 /* 0x00002000 - Reserved */
1983 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1984 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1986 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1987 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1988 #define IMAGE_SCN_MEM_16BIT 0x00020000
1989 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1990 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1992 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1993 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1994 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1995 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1996 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1997 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1998 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1999 /* 0x00800000 - Unused */
2001 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2004 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2005 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2006 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2007 #define IMAGE_SCN_MEM_SHARED 0x10000000
2008 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2009 #define IMAGE_SCN_MEM_READ 0x40000000
2010 #define IMAGE_SCN_MEM_WRITE 0x80000000
2012 #include "pshpack2.h"
2014 typedef struct _IMAGE_SYMBOL
{
2024 SHORT SectionNumber
;
2027 BYTE NumberOfAuxSymbols
;
2029 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
2031 #define IMAGE_SIZEOF_SYMBOL 18
2033 typedef struct _IMAGE_LINENUMBER
{
2035 DWORD SymbolTableIndex
;
2036 DWORD VirtualAddress
;
2040 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
2042 #define IMAGE_SIZEOF_LINENUMBER 6
2044 typedef union _IMAGE_AUX_SYMBOL
{
2056 DWORD PointerToLinenumber
;
2057 DWORD PointerToNextFunction
;
2066 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2070 WORD NumberOfRelocations
;
2071 WORD NumberOfLinenumbers
;
2077 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2079 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2081 #include "poppack.h"
2083 #define IMAGE_SYM_UNDEFINED (SHORT)0
2084 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2085 #define IMAGE_SYM_DEBUG (SHORT)-2
2087 #define IMAGE_SYM_TYPE_NULL 0x0000
2088 #define IMAGE_SYM_TYPE_VOID 0x0001
2089 #define IMAGE_SYM_TYPE_CHAR 0x0002
2090 #define IMAGE_SYM_TYPE_SHORT 0x0003
2091 #define IMAGE_SYM_TYPE_INT 0x0004
2092 #define IMAGE_SYM_TYPE_LONG 0x0005
2093 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2094 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2095 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2096 #define IMAGE_SYM_TYPE_UNION 0x0009
2097 #define IMAGE_SYM_TYPE_ENUM 0x000A
2098 #define IMAGE_SYM_TYPE_MOE 0x000B
2099 #define IMAGE_SYM_TYPE_BYTE 0x000C
2100 #define IMAGE_SYM_TYPE_WORD 0x000D
2101 #define IMAGE_SYM_TYPE_UINT 0x000E
2102 #define IMAGE_SYM_TYPE_DWORD 0x000F
2103 #define IMAGE_SYM_TYPE_PCODE 0x8000
2105 #define IMAGE_SYM_DTYPE_NULL 0
2106 #define IMAGE_SYM_DTYPE_POINTER 1
2107 #define IMAGE_SYM_DTYPE_FUNCTION 2
2108 #define IMAGE_SYM_DTYPE_ARRAY 3
2110 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2111 #define IMAGE_SYM_CLASS_NULL 0x0000
2112 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2113 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2114 #define IMAGE_SYM_CLASS_STATIC 0x0003
2115 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2116 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2117 #define IMAGE_SYM_CLASS_LABEL 0x0006
2118 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2119 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2120 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2121 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2122 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2123 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2124 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2125 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2126 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2127 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2128 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2129 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2131 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2132 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2133 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2134 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2135 #define IMAGE_SYM_CLASS_FILE 0x0067
2136 #define IMAGE_SYM_CLASS_SECTION 0x0068
2137 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2139 #define N_BTMASK 0x000F
2140 #define N_TMASK 0x0030
2141 #define N_TMASK1 0x00C0
2142 #define N_TMASK2 0x00F0
2146 #define BTYPE(x) ((x) & N_BTMASK)
2149 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2153 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2157 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2161 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2165 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2168 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2171 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2172 #define IMAGE_COMDAT_SELECT_ANY 2
2173 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2174 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2175 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2176 #define IMAGE_COMDAT_SELECT_LARGEST 6
2177 #define IMAGE_COMDAT_SELECT_NEWEST 7
2179 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2180 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2181 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2183 /* Export module directory */
2185 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2186 DWORD Characteristics
;
2187 DWORD TimeDateStamp
;
2192 DWORD NumberOfFunctions
;
2193 DWORD NumberOfNames
;
2194 DWORD AddressOfFunctions
;
2195 DWORD AddressOfNames
;
2196 DWORD AddressOfNameOrdinals
;
2197 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
2199 /* Import name entry */
2200 typedef struct _IMAGE_IMPORT_BY_NAME
{
2203 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
2206 typedef struct _IMAGE_THUNK_DATA
{
2208 LPBYTE ForwarderString
;
2211 PIMAGE_IMPORT_BY_NAME AddressOfData
;
2213 } IMAGE_THUNK_DATA
,*PIMAGE_THUNK_DATA
;
2215 /* Import module directory */
2217 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
2219 DWORD Characteristics
; /* 0 for terminating null import descriptor */
2220 PIMAGE_THUNK_DATA OriginalFirstThunk
; /* RVA to original unbound IAT */
2222 DWORD TimeDateStamp
; /* 0 if not bound,
2223 * -1 if bound, and real date\time stamp
2224 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2226 * otherwise date/time stamp of DLL bound to
2229 DWORD ForwarderChain
; /* -1 if no forwarders */
2231 /* RVA to IAT (if bound this IAT has actual addresses) */
2232 PIMAGE_THUNK_DATA FirstThunk
;
2233 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
2235 #define IMAGE_ORDINAL_FLAG 0x80000000
2236 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
2237 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
2239 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2241 DWORD TimeDateStamp
;
2242 WORD OffsetModuleName
;
2243 WORD NumberOfModuleForwarderRefs
;
2244 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2245 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
2247 typedef struct _IMAGE_BOUND_FORWARDER_REF
2249 DWORD TimeDateStamp
;
2250 WORD OffsetModuleName
;
2252 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
2254 #include "pshpack2.h"
2256 typedef struct _IMAGE_BASE_RELOCATION
2258 DWORD VirtualAddress
;
2260 /* WORD TypeOffset[1]; */
2261 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
2263 typedef struct _IMAGE_RELOCATION
2266 DWORD VirtualAddress
;
2269 DWORD SymbolTableIndex
;
2272 typedef IMAGE_RELOCATION
*PIMAGE_RELOCATION
;
2274 #include "poppack.h"
2276 #define IMAGE_SIZEOF_RELOCATION 10
2278 /* generic relocation types */
2279 #define IMAGE_REL_BASED_ABSOLUTE 0
2280 #define IMAGE_REL_BASED_HIGH 1
2281 #define IMAGE_REL_BASED_LOW 2
2282 #define IMAGE_REL_BASED_HIGHLOW 3
2283 #define IMAGE_REL_BASED_HIGHADJ 4
2284 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2285 #define IMAGE_REL_BASED_SECTION 6
2286 #define IMAGE_REL_BASED_REL 7
2287 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2288 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2289 #define IMAGE_REL_BASED_DIR64 10
2290 #define IMAGE_REL_BASED_HIGH3ADJ 11
2292 /* I386 relocation types */
2293 #define IMAGE_REL_I386_ABSOLUTE 0
2294 #define IMAGE_REL_I386_DIR16 1
2295 #define IMAGE_REL_I386_REL16 2
2296 #define IMAGE_REL_I386_DIR32 6
2297 #define IMAGE_REL_I386_DIR32NB 7
2298 #define IMAGE_REL_I386_SEG12 9
2299 #define IMAGE_REL_I386_SECTION 10
2300 #define IMAGE_REL_I386_SECREL 11
2301 #define IMAGE_REL_I386_REL32 20
2303 /* MIPS relocation types */
2304 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2305 #define IMAGE_REL_MIPS_REFHALF 0x0001
2306 #define IMAGE_REL_MIPS_REFWORD 0x0002
2307 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2308 #define IMAGE_REL_MIPS_REFHI 0x0004
2309 #define IMAGE_REL_MIPS_REFLO 0x0005
2310 #define IMAGE_REL_MIPS_GPREL 0x0006
2311 #define IMAGE_REL_MIPS_LITERAL 0x0007
2312 #define IMAGE_REL_MIPS_SECTION 0x000A
2313 #define IMAGE_REL_MIPS_SECREL 0x000B
2314 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2315 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2316 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2317 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2318 #define IMAGE_REL_MIPS_PAIR 0x0025
2320 /* ALPHA relocation types */
2321 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2322 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2323 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2324 #define IMAGE_REL_ALPHA_GPREL 0x0003
2325 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2326 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2327 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2328 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2329 #define IMAGE_REL_ALPHA_HINT 0x0008
2330 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2331 #define IMAGE_REL_ALPHA_REFHI 0x000A
2332 #define IMAGE_REL_ALPHA_REFLO 0x000B
2333 #define IMAGE_REL_ALPHA_PAIR 0x000C
2334 #define IMAGE_REL_ALPHA_MATCH 0x000D
2335 #define IMAGE_REL_ALPHA_SECTION 0x000E
2336 #define IMAGE_REL_ALPHA_SECREL 0x000F
2337 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2338 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2339 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2340 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2341 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2342 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2343 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2344 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2346 /* PowerPC relocation types */
2347 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2348 #define IMAGE_REL_PPC_ADDR64 0x0001
2349 #define IMAGE_REL_PPC_ADDR 0x0002
2350 #define IMAGE_REL_PPC_ADDR24 0x0003
2351 #define IMAGE_REL_PPC_ADDR16 0x0004
2352 #define IMAGE_REL_PPC_ADDR14 0x0005
2353 #define IMAGE_REL_PPC_REL24 0x0006
2354 #define IMAGE_REL_PPC_REL14 0x0007
2355 #define IMAGE_REL_PPC_TOCREL16 0x0008
2356 #define IMAGE_REL_PPC_TOCREL14 0x0009
2357 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2358 #define IMAGE_REL_PPC_SECREL 0x000B
2359 #define IMAGE_REL_PPC_SECTION 0x000C
2360 #define IMAGE_REL_PPC_IFGLUE 0x000D
2361 #define IMAGE_REL_PPC_IMGLUE 0x000E
2362 #define IMAGE_REL_PPC_SECREL16 0x000F
2363 #define IMAGE_REL_PPC_REFHI 0x0010
2364 #define IMAGE_REL_PPC_REFLO 0x0011
2365 #define IMAGE_REL_PPC_PAIR 0x0012
2366 #define IMAGE_REL_PPC_SECRELLO 0x0013
2367 #define IMAGE_REL_PPC_SECRELHI 0x0014
2368 #define IMAGE_REL_PPC_GPREL 0x0015
2369 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2371 #define IMAGE_REL_PPC_NEG 0x0100
2372 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2373 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2374 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2376 /* SH3 ? relocation type */
2377 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2378 #define IMAGE_REL_SH3_DIRECT16 0x0001
2379 #define IMAGE_REL_SH3_DIRECT 0x0002
2380 #define IMAGE_REL_SH3_DIRECT8 0x0003
2381 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2382 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2383 #define IMAGE_REL_SH3_DIRECT4 0x0006
2384 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2385 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2386 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2387 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2388 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2389 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2390 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2391 #define IMAGE_REL_SH3_SECTION 0x000E
2392 #define IMAGE_REL_SH3_SECREL 0x000F
2393 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2395 /* ARM (Archimedes?) relocation types */
2396 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2397 #define IMAGE_REL_ARM_ADDR 0x0001
2398 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2399 #define IMAGE_REL_ARM_BRANCH24 0x0003
2400 #define IMAGE_REL_ARM_BRANCH11 0x0004
2401 #define IMAGE_REL_ARM_SECTION 0x000E
2402 #define IMAGE_REL_ARM_SECREL 0x000F
2404 /* IA64 relocation types */
2405 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2406 #define IMAGE_REL_IA64_IMM14 0x0001
2407 #define IMAGE_REL_IA64_IMM22 0x0002
2408 #define IMAGE_REL_IA64_IMM64 0x0003
2409 #define IMAGE_REL_IA64_DIR 0x0004
2410 #define IMAGE_REL_IA64_DIR64 0x0005
2411 #define IMAGE_REL_IA64_PCREL21B 0x0006
2412 #define IMAGE_REL_IA64_PCREL21M 0x0007
2413 #define IMAGE_REL_IA64_PCREL21F 0x0008
2414 #define IMAGE_REL_IA64_GPREL22 0x0009
2415 #define IMAGE_REL_IA64_LTOFF22 0x000A
2416 #define IMAGE_REL_IA64_SECTION 0x000B
2417 #define IMAGE_REL_IA64_SECREL22 0x000C
2418 #define IMAGE_REL_IA64_SECREL64I 0x000D
2419 #define IMAGE_REL_IA64_SECREL 0x000E
2420 #define IMAGE_REL_IA64_LTOFF64 0x000F
2421 #define IMAGE_REL_IA64_DIR32NB 0x0010
2422 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2423 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2424 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2425 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2426 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2427 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2428 #define IMAGE_REL_IA64_ADDEND 0x001F
2430 /* archive format */
2432 #define IMAGE_ARCHIVE_START_SIZE 8
2433 #define IMAGE_ARCHIVE_START "!<arch>\n"
2434 #define IMAGE_ARCHIVE_END "`\n"
2435 #define IMAGE_ARCHIVE_PAD "\n"
2436 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2437 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2439 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2448 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
2450 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2453 * Resource directory stuff
2455 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
2456 DWORD Characteristics
;
2457 DWORD TimeDateStamp
;
2460 WORD NumberOfNamedEntries
;
2461 WORD NumberOfIdEntries
;
2462 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2463 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
2465 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2466 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2468 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
2471 #ifdef BITFIELDS_BIGENDIAN
2472 unsigned NameIsString
:1;
2473 unsigned NameOffset
:31;
2475 unsigned NameOffset
:31;
2476 unsigned NameIsString
:1;
2481 #ifdef WORDS_BIGENDIAN
2493 #ifdef BITFIELDS_BIGENDIAN
2494 unsigned DataIsDirectory
:1;
2495 unsigned OffsetToDirectory
:31;
2497 unsigned OffsetToDirectory
:31;
2498 unsigned DataIsDirectory
:1;
2502 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
2505 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
2507 CHAR NameString
[ 1 ];
2508 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
2510 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
2512 WCHAR NameString
[ 1 ];
2513 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
2515 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
2519 DWORD ResourceHandle
;
2520 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
2523 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
2524 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
2527 typedef struct _IMAGE_TLS_DIRECTORY
{
2528 DWORD StartAddressOfRawData
;
2529 DWORD EndAddressOfRawData
;
2530 LPDWORD AddressOfIndex
;
2531 PIMAGE_TLS_CALLBACK
*AddressOfCallBacks
;
2532 DWORD SizeOfZeroFill
;
2533 DWORD Characteristics
;
2534 } IMAGE_TLS_DIRECTORY
,*PIMAGE_TLS_DIRECTORY
;
2536 typedef struct _IMAGE_DEBUG_DIRECTORY
{
2537 DWORD Characteristics
;
2538 DWORD TimeDateStamp
;
2543 DWORD AddressOfRawData
;
2544 DWORD PointerToRawData
;
2545 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
2547 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2548 #define IMAGE_DEBUG_TYPE_COFF 1
2549 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2550 #define IMAGE_DEBUG_TYPE_FPO 3
2551 #define IMAGE_DEBUG_TYPE_MISC 4
2552 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2553 #define IMAGE_DEBUG_TYPE_FIXUP 6
2554 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2555 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2556 #define IMAGE_DEBUG_TYPE_BORLAND 9
2557 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2559 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
2560 DWORD NumberOfSymbols
;
2561 DWORD LvaToFirstSymbol
;
2562 DWORD NumberOfLinenumbers
;
2563 DWORD LvaToFirstLinenumber
;
2564 DWORD RvaToFirstByteOfCode
;
2565 DWORD RvaToLastByteOfCode
;
2566 DWORD RvaToFirstByteOfData
;
2567 DWORD RvaToLastByteOfData
;
2568 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
2571 #define FRAME_TRAP 1
2573 #define FRAME_NONFPO 3
2575 typedef struct _FPO_DATA
{
2580 unsigned cbProlog
: 8;
2581 unsigned cbRegs
: 3;
2582 unsigned fHasSEH
: 1;
2583 unsigned fUseBP
: 1;
2584 unsigned reserved
: 1;
2585 unsigned cbFrame
: 2;
2586 } FPO_DATA
, *PFPO_DATA
;
2588 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
2589 DWORD Characteristics
;
2590 DWORD TimeDateStamp
;
2593 DWORD GlobalFlagsClear
;
2594 DWORD GlobalFlagsSet
;
2595 DWORD CriticalSectionDefaultTimeout
;
2596 DWORD DeCommitFreeBlockThreshold
;
2597 DWORD DeCommitTotalFreeThreshold
;
2598 PVOID LockPrefixTable
;
2599 DWORD MaximumAllocationSize
;
2600 DWORD VirtualMemoryThreshold
;
2601 DWORD ProcessHeapFlags
;
2602 DWORD ProcessAffinityMask
;
2607 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
2609 typedef struct _IMAGE_FUNCTION_ENTRY
{
2610 DWORD StartingAddress
;
2611 DWORD EndingAddress
;
2612 DWORD EndOfPrologue
;
2613 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
2615 #define IMAGE_DEBUG_MISC_EXENAME 1
2617 typedef struct _IMAGE_DEBUG_MISC
{
2623 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
2625 /* This is the structure that appears at the very start of a .DBG file. */
2627 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
2631 WORD Characteristics
;
2632 DWORD TimeDateStamp
;
2636 DWORD NumberOfSections
;
2637 DWORD ExportedNamesSize
;
2638 DWORD DebugDirectorySize
;
2639 DWORD SectionAlignment
;
2640 DWORD Reserved
[ 2 ];
2641 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
2643 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2646 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
2650 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
2651 #define MESSAGE_RESOURCE_UNICODE 0x0001
2653 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
2656 DWORD OffsetToEntries
;
2657 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
2659 typedef struct tagMESSAGE_RESOURCE_DATA
{
2660 DWORD NumberOfBlocks
;
2661 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
2662 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
2665 * Here follows typedefs for security and tokens.
2669 * First a constant for the following typdefs.
2672 #define ANYSIZE_ARRAY 1
2674 /* FIXME: Orphan. What does it point to? */
2675 typedef PVOID PACCESS_TOKEN
;
2678 * TOKEN_INFORMATION_CLASS
2681 typedef enum _TOKEN_INFORMATION_CLASS
{
2690 TokenImpersonationLevel
,
2692 TokenRestrictedSids
,
2694 TokenGroupsAndPrivileges
,
2695 TokenSessionReference
,
2697 } TOKEN_INFORMATION_CLASS
;
2699 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
2700 #define TOKEN_ADJUST_GROUPS 0x0040
2701 #define TOKEN_ADJUST_PRIVILEGES 0x0020
2702 #define TOKEN_ADJUST_SESSIONID 0x0100
2703 #define TOKEN_ASSIGN_PRIMARY 0x0001
2704 #define TOKEN_DUPLICATE 0x0002
2705 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
2706 #define TOKEN_IMPERSONATE 0x0004
2707 #define TOKEN_QUERY 0x0008
2708 #define TOKEN_QUERY_SOURCE 0x0010
2709 #define TOKEN_ADJUST_DEFAULT 0x0080
2710 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
2711 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
2712 TOKEN_ADJUST_PRIVILEGES | \
2713 TOKEN_ADJUST_GROUPS | \
2714 TOKEN_ADJUST_DEFAULT )
2715 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2716 TOKEN_ASSIGN_PRIMARY | \
2718 TOKEN_IMPERSONATE | \
2720 TOKEN_QUERY_SOURCE | \
2721 TOKEN_ADJUST_PRIVILEGES | \
2722 TOKEN_ADJUST_GROUPS | \
2723 TOKEN_ADJUST_SESSIONID | \
2724 TOKEN_ADJUST_DEFAULT )
2726 #ifndef _SECURITY_DEFINED
2727 #define _SECURITY_DEFINED
2730 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
2732 typedef struct _GENERIC_MAPPING
{
2733 ACCESS_MASK GenericRead
;
2734 ACCESS_MASK GenericWrite
;
2735 ACCESS_MASK GenericExecute
;
2736 ACCESS_MASK GenericAll
;
2737 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
2739 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2740 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2743 } SID_IDENTIFIER_AUTHORITY
,*PSID_IDENTIFIER_AUTHORITY
,*LPSID_IDENTIFIER_AUTHORITY
;
2744 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2748 typedef struct _SID
{
2750 BYTE SubAuthorityCount
;
2751 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
2752 DWORD SubAuthority
[1];
2754 #endif /* !defined(SID_DEFINED) */
2756 #define SID_REVISION (1) /* Current revision */
2757 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2758 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2765 #define ACL_REVISION1 1
2766 #define ACL_REVISION2 2
2767 #define ACL_REVISION3 3
2768 #define ACL_REVISION4 4
2770 #define MIN_ACL_REVISION ACL_REVISION2
2771 #define MAX_ACL_REVISION ACL_REVISION4
2773 typedef struct _ACL
{
2781 /* SECURITY_DESCRIPTOR */
2782 #define SECURITY_DESCRIPTOR_REVISION 1
2783 #define SECURITY_DESCRIPTOR_REVISION1 1
2786 #define SE_OWNER_DEFAULTED 0x0001
2787 #define SE_GROUP_DEFAULTED 0x0002
2788 #define SE_DACL_PRESENT 0x0004
2789 #define SE_DACL_DEFAULTED 0x0008
2790 #define SE_SACL_PRESENT 0x0010
2791 #define SE_SACL_DEFAULTED 0x0020
2792 #define SE_SELF_RELATIVE 0x8000
2794 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
2795 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
2797 /* The security descriptor structure */
2801 SECURITY_DESCRIPTOR_CONTROL Control
;
2806 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
2811 SECURITY_DESCRIPTOR_CONTROL Control
;
2816 } SECURITY_DESCRIPTOR
, *PSECURITY_DESCRIPTOR
;
2818 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2820 #endif /* _SECURITY_DEFINED */
2823 * SID_AND_ATTRIBUTES
2826 typedef struct _SID_AND_ATTRIBUTES
{
2829 } SID_AND_ATTRIBUTES
;
2831 /* security entities */
2832 #define SECURITY_NULL_RID (0x00000000L)
2833 #define SECURITY_WORLD_RID (0x00000000L)
2834 #define SECURITY_LOCAL_RID (0X00000000L)
2836 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2839 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2842 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2845 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2846 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2847 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2848 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2849 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2852 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2855 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2856 #define SECURITY_DIALUP_RID 0x00000001L
2857 #define SECURITY_NETWORK_RID 0x00000002L
2858 #define SECURITY_BATCH_RID 0x00000003L
2859 #define SECURITY_INTERACTIVE_RID 0x00000004L
2860 #define SECURITY_LOGON_IDS_RID 0x00000005L
2861 #define SECURITY_SERVICE_RID 0x00000006L
2862 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2863 #define SECURITY_PROXY_RID 0x00000008L
2864 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2865 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2866 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2867 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2868 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2869 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2870 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2871 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2873 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2874 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2875 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2877 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2878 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2879 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2881 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2883 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2889 typedef struct _TOKEN_USER
{
2890 SID_AND_ATTRIBUTES User
;
2897 typedef struct _TOKEN_GROUPS
{
2899 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
2903 * LUID_AND_ATTRIBUTES
2906 typedef union _LARGE_INTEGER
{
2908 #ifdef WORDS_BIGENDIAN
2917 } LARGE_INTEGER
, *LPLARGE_INTEGER
, *PLARGE_INTEGER
;
2919 typedef union _ULARGE_INTEGER
{
2921 #ifdef WORDS_BIGENDIAN
2930 } ULARGE_INTEGER
, *LPULARGE_INTEGER
, *PULARGE_INTEGER
;
2933 * Locally Unique Identifier
2936 typedef struct _LUID
{
2941 #include "pshpack4.h"
2942 typedef struct _LUID_AND_ATTRIBUTES
{
2945 } LUID_AND_ATTRIBUTES
;
2946 #include "poppack.h"
2952 typedef struct _PRIVILEGE_SET
{
2953 DWORD PrivilegeCount
;
2955 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
2956 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
2962 typedef struct _TOKEN_PRIVILEGES
{
2963 DWORD PrivilegeCount
;
2964 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
2965 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
2971 typedef struct _TOKEN_OWNER
{
2976 * TOKEN_PRIMARY_GROUP
2979 typedef struct _TOKEN_PRIMARY_GROUP
{
2981 } TOKEN_PRIMARY_GROUP
;
2985 * TOKEN_DEFAULT_DACL
2988 typedef struct _TOKEN_DEFAULT_DACL
{
2990 } TOKEN_DEFAULT_DACL
;
2996 typedef struct _TOKEN_SOURCE
{
2998 LUID SourceIdentifier
;
3005 typedef enum tagTOKEN_TYPE
{
3011 * SECURITY_IMPERSONATION_LEVEL
3014 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
3016 SecurityIdentification
,
3017 SecurityImpersonation
,
3019 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
3022 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
3023 * PSECURITY_CONTEXT_TRACKING_MODE
;
3025 * Quality of Service
3028 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
3030 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
3031 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
3032 BOOLEAN EffectiveOnly
;
3033 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
3039 typedef struct _TOKEN_STATISTICS
{
3041 LUID AuthenticationId
;
3042 LARGE_INTEGER ExpirationTime
;
3043 TOKEN_TYPE TokenType
;
3044 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
3045 DWORD DynamicCharged
;
3046 DWORD DynamicAvailable
;
3048 DWORD PrivilegeCount
;
3056 #define ACL_REVISION 2
3058 #define ACL_REVISION1 1
3059 #define ACL_REVISION2 2
3061 /* ACEs, directly starting after an ACL */
3062 typedef struct _ACE_HEADER
{
3066 } ACE_HEADER
,*PACE_HEADER
;
3069 #define ACCESS_ALLOWED_ACE_TYPE 0
3070 #define ACCESS_DENIED_ACE_TYPE 1
3071 #define SYSTEM_AUDIT_ACE_TYPE 2
3072 #define SYSTEM_ALARM_ACE_TYPE 3
3074 /* inherit AceFlags */
3075 #define OBJECT_INHERIT_ACE 0x01
3076 #define CONTAINER_INHERIT_ACE 0x02
3077 #define NO_PROPAGATE_INHERIT_ACE 0x04
3078 #define INHERIT_ONLY_ACE 0x08
3079 #define VALID_INHERIT_FLAGS 0x0F
3081 /* AceFlags mask for what events we (should) audit */
3082 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3083 #define FAILED_ACCESS_ACE_FLAG 0x80
3085 /* different ACEs depending on AceType
3086 * SidStart marks the begin of a SID
3087 * so the thing finally looks like this:
3092 typedef struct _ACCESS_ALLOWED_ACE
{
3096 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
3098 typedef struct _ACCESS_DENIED_ACE
{
3102 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
3104 typedef struct _SYSTEM_AUDIT_ACE
{
3108 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
3110 typedef struct _SYSTEM_ALARM_ACE
{
3114 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
3116 typedef enum tagSID_NAME_USE
{
3121 SidTypeWellKnownGroup
,
3122 SidTypeDeletedAccount
,
3125 } SID_NAME_USE
,*PSID_NAME_USE
;
3129 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3131 #define DELETE 0x00010000
3132 #define READ_CONTROL 0x00020000
3133 #define WRITE_DAC 0x00040000
3134 #define WRITE_OWNER 0x00080000
3135 #define SYNCHRONIZE 0x00100000
3136 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3138 #define STANDARD_RIGHTS_READ READ_CONTROL
3139 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3140 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3142 #define STANDARD_RIGHTS_ALL 0x001f0000
3144 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3146 #define GENERIC_READ 0x80000000
3147 #define GENERIC_WRITE 0x40000000
3148 #define GENERIC_EXECUTE 0x20000000
3149 #define GENERIC_ALL 0x10000000
3151 #define MAXIMUM_ALLOWED 0x02000000
3152 #define ACCESS_SYSTEM_SECURITY 0x01000000
3154 #define EVENT_MODIFY_STATE 0x0002
3155 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3157 #define SEMAPHORE_MODIFY_STATE 0x0002
3158 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3160 #define MUTEX_MODIFY_STATE 0x0001
3161 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3163 #define TIMER_QUERY_STATE 0x0001
3164 #define TIMER_MODIFY_STATE 0x0002
3165 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3167 #define PROCESS_TERMINATE 0x0001
3168 #define PROCESS_CREATE_THREAD 0x0002
3169 #define PROCESS_VM_OPERATION 0x0008
3170 #define PROCESS_VM_READ 0x0010
3171 #define PROCESS_VM_WRITE 0x0020
3172 #define PROCESS_DUP_HANDLE 0x0040
3173 #define PROCESS_CREATE_PROCESS 0x0080
3174 #define PROCESS_SET_QUOTA 0x0100
3175 #define PROCESS_SET_INFORMATION 0x0200
3176 #define PROCESS_QUERY_INFORMATION 0x0400
3177 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3179 #define THREAD_TERMINATE 0x0001
3180 #define THREAD_SUSPEND_RESUME 0x0002
3181 #define THREAD_GET_CONTEXT 0x0008
3182 #define THREAD_SET_CONTEXT 0x0010
3183 #define THREAD_SET_INFORMATION 0x0020
3184 #define THREAD_QUERY_INFORMATION 0x0040
3185 #define THREAD_SET_THREAD_TOKEN 0x0080
3186 #define THREAD_IMPERSONATE 0x0100
3187 #define THREAD_DIRECT_IMPERSONATION 0x0200
3188 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3190 #define THREAD_BASE_PRIORITY_LOWRT 15
3191 #define THREAD_BASE_PRIORITY_MAX 2
3192 #define THREAD_BASE_PRIORITY_MIN -2
3193 #define THREAD_BASE_PRIORITY_IDLE -15
3195 #define SECTION_QUERY 0x0001
3196 #define SECTION_MAP_WRITE 0x0002
3197 #define SECTION_MAP_READ 0x0004
3198 #define SECTION_MAP_EXECUTE 0x0008
3199 #define SECTION_EXTEND_SIZE 0x0010
3200 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3202 #define FILE_READ_DATA 0x0001 /* file & pipe */
3203 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3204 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3205 #define FILE_ADD_FILE 0x0002 /* directory */
3206 #define FILE_APPEND_DATA 0x0004 /* file */
3207 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3208 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3209 #define FILE_READ_EA 0x0008 /* file & directory */
3210 #define FILE_READ_PROPERTIES FILE_READ_EA
3211 #define FILE_WRITE_EA 0x0010 /* file & directory */
3212 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3213 #define FILE_EXECUTE 0x0020 /* file */
3214 #define FILE_TRAVERSE 0x0020 /* directory */
3215 #define FILE_DELETE_CHILD 0x0040 /* directory */
3216 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3217 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3218 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3220 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3221 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3223 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3224 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3225 FILE_APPEND_DATA | SYNCHRONIZE)
3226 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3227 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3230 /* File attribute flags */
3231 #define FILE_SHARE_READ 0x00000001L
3232 #define FILE_SHARE_WRITE 0x00000002L
3233 #define FILE_SHARE_DELETE 0x00000004L
3234 #define FILE_ATTRIBUTE_READONLY 0x00000001L
3235 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
3236 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
3237 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
3238 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
3239 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
3240 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
3241 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
3242 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
3243 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
3244 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
3245 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
3246 #define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
3248 /* File notification flags */
3249 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3250 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3251 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3252 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3253 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3254 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3255 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3256 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3258 #define FILE_ACTION_ADDED 0x00000001
3259 #define FILE_ACTION_REMOVED 0x00000002
3260 #define FILE_ACTION_MODIFIED 0x00000003
3261 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3262 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3265 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3266 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3267 #define FILE_UNICODE_ON_DISK 0x00000004
3268 #define FILE_PERSISTENT_ACLS 0x00000008
3269 #define FILE_FILE_COMPRESSION 0x00000010
3270 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3272 /* File alignments (NT) */
3273 #define FILE_BYTE_ALIGNMENT 0x00000000
3274 #define FILE_WORD_ALIGNMENT 0x00000001
3275 #define FILE_LONG_ALIGNMENT 0x00000003
3276 #define FILE_QUAD_ALIGNMENT 0x00000007
3277 #define FILE_OCTA_ALIGNMENT 0x0000000f
3278 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3279 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3280 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3281 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3282 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3284 #define REG_NONE 0 /* no type */
3285 #define REG_SZ 1 /* string type (ASCII) */
3286 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3287 #define REG_BINARY 3 /* binary format, callerspecific */
3288 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3289 #define REG_DWORD 4 /* DWORD in little endian format */
3290 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3291 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3292 #define REG_LINK 6 /* symbolic link (UNICODE) */
3293 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3294 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3295 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3296 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3298 /* ----------------------------- begin registry ----------------------------- */
3300 /* Registry security values */
3301 #define OWNER_SECURITY_INFORMATION 0x00000001
3302 #define GROUP_SECURITY_INFORMATION 0x00000002
3303 #define DACL_SECURITY_INFORMATION 0x00000004
3304 #define SACL_SECURITY_INFORMATION 0x00000008
3306 #define REG_OPTION_RESERVED 0x00000000
3307 #define REG_OPTION_NON_VOLATILE 0x00000000
3308 #define REG_OPTION_VOLATILE 0x00000001
3309 #define REG_OPTION_CREATE_LINK 0x00000002
3310 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
3311 #define REG_OPTION_OPEN_LINK 0x00000008
3312 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
3313 REG_OPTION_NON_VOLATILE| \
3314 REG_OPTION_VOLATILE| \
3315 REG_OPTION_CREATE_LINK| \
3316 REG_OPTION_BACKUP_RESTORE| \
3317 REG_OPTION_OPEN_LINK)
3320 #define REG_CREATED_NEW_KEY 0x00000001
3321 #define REG_OPENED_EXISTING_KEY 0x00000002
3323 /* For RegNotifyChangeKeyValue */
3324 #define REG_NOTIFY_CHANGE_NAME 0x1
3326 #define KEY_QUERY_VALUE 0x00000001
3327 #define KEY_SET_VALUE 0x00000002
3328 #define KEY_CREATE_SUB_KEY 0x00000004
3329 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3330 #define KEY_NOTIFY 0x00000010
3331 #define KEY_CREATE_LINK 0x00000020
3333 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3335 KEY_ENUMERATE_SUB_KEYS| \
3339 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3341 KEY_CREATE_SUB_KEY) \
3344 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
3345 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3348 KEY_CREATE_SUB_KEY| \
3349 KEY_ENUMERATE_SUB_KEYS| \
3354 /* ------------------------------ end registry ------------------------------ */
3357 #define EVENTLOG_SUCCESS 0x0000
3358 #define EVENTLOG_ERROR_TYPE 0x0001
3359 #define EVENTLOG_WARNING_TYPE 0x0002
3360 #define EVENTLOG_INFORMATION_TYPE 0x0004
3361 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3362 #define EVENTLOG_AUDIT_FAILURE 0x0010
3364 #define SERVICE_BOOT_START 0x00000000
3365 #define SERVICE_SYSTEM_START 0x00000001
3366 #define SERVICE_AUTO_START 0x00000002
3367 #define SERVICE_DEMAND_START 0x00000003
3368 #define SERVICE_DISABLED 0x00000004
3370 #define SERVICE_ERROR_IGNORE 0x00000000
3371 #define SERVICE_ERROR_NORMAL 0x00000001
3372 #define SERVICE_ERROR_SEVERE 0x00000002
3373 #define SERVICE_ERROR_CRITICAL 0x00000003
3376 #define SERVICE_KERNEL_DRIVER 0x00000001
3377 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3378 #define SERVICE_ADAPTER 0x00000004
3379 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3381 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3382 SERVICE_RECOGNIZER_DRIVER )
3384 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3385 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3386 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3388 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3390 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3391 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3394 typedef enum _CM_SERVICE_NODE_TYPE
3396 DriverType
= SERVICE_KERNEL_DRIVER
,
3397 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
3398 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
3399 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
3400 AdapterType
= SERVICE_ADAPTER
,
3401 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
3402 } SERVICE_NODE_TYPE
;
3404 typedef enum _CM_SERVICE_LOAD_TYPE
3406 BootLoad
= SERVICE_BOOT_START
,
3407 SystemLoad
= SERVICE_SYSTEM_START
,
3408 AutoLoad
= SERVICE_AUTO_START
,
3409 DemandLoad
= SERVICE_DEMAND_START
,
3410 DisableLoad
= SERVICE_DISABLED
3411 } SERVICE_LOAD_TYPE
;
3413 typedef enum _CM_ERROR_CONTROL_TYPE
3415 IgnoreError
= SERVICE_ERROR_IGNORE
,
3416 NormalError
= SERVICE_ERROR_NORMAL
,
3417 SevereError
= SERVICE_ERROR_SEVERE
,
3418 CriticalError
= SERVICE_ERROR_CRITICAL
3419 } SERVICE_ERROR_TYPE
;
3423 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3424 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3425 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3426 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3427 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3429 #include "guiddef.h"
3431 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3434 WORD CreatorBackTraceIndex
;
3435 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
3436 LIST_ENTRY ProcessLocksList
;
3438 DWORD ContentionCount
;
3440 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
3442 typedef struct _RTL_CRITICAL_SECTION
{
3443 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
3445 LONG RecursionCount
;
3446 HANDLE OwningThread
;
3447 HANDLE LockSemaphore
;
3448 ULONG_PTR SpinCount
;
3449 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
3451 #endif /* __WINE_WINNT_H */