2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
19 /* Argument 1 passed to the DllEntryProc. */
20 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
21 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
22 #define DLL_THREAD_ATTACH 2 /* attach new thread */
23 #define DLL_THREAD_DETACH 3 /* detach thread */
26 /* u.x.wProcessorArchitecture (NT) */
27 #define PROCESSOR_ARCHITECTURE_INTEL 0
28 #define PROCESSOR_ARCHITECTURE_MIPS 1
29 #define PROCESSOR_ARCHITECTURE_ALPHA 2
30 #define PROCESSOR_ARCHITECTURE_PPC 3
31 #define PROCESSOR_ARCHITECTURE_SHX 4
32 #define PROCESSOR_ARCHITECTURE_ARM 5
33 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
36 #define PROCESSOR_INTEL_386 386
37 #define PROCESSOR_INTEL_486 486
38 #define PROCESSOR_INTEL_PENTIUM 586
39 #define PROCESSOR_INTEL_860 860
40 #define PROCESSOR_MIPS_R2000 2000
41 #define PROCESSOR_MIPS_R3000 3000
42 #define PROCESSOR_MIPS_R4000 4000
43 #define PROCESSOR_ALPHA_21064 21064
44 #define PROCESSOR_PPC_601 601
45 #define PROCESSOR_PPC_603 603
46 #define PROCESSOR_PPC_604 604
47 #define PROCESSOR_PPC_620 620
48 #define PROCESSOR_HITACHI_SH3 10003
49 #define PROCESSOR_HITACHI_SH3E 10004
50 #define PROCESSOR_HITACHI_SH4 10005
51 #define PROCESSOR_MOTOROLA_821 821
52 #define PROCESSOR_SHx_SH3 103
53 #define PROCESSOR_SHx_SH4 104
54 #define PROCESSOR_STRONGARM 2577
55 #define PROCESSOR_ARM720 1824 /* 0x720 */
56 #define PROCESSOR_ARM820 2080 /* 0x820 */
57 #define PROCESSOR_ARM920 2336 /* 0x920 */
58 #define PROCESSOR_ARM_7TDMI 70001
60 typedef struct _MEMORY_BASIC_INFORMATION
63 LPVOID AllocationBase
;
64 DWORD AllocationProtect
;
69 } MEMORY_BASIC_INFORMATION
,*LPMEMORY_BASIC_INFORMATION
,*PMEMORY_BASIC_INFORMATION
;
71 #define PAGE_NOACCESS 0x01
72 #define PAGE_READONLY 0x02
73 #define PAGE_READWRITE 0x04
74 #define PAGE_WRITECOPY 0x08
75 #define PAGE_EXECUTE 0x10
76 #define PAGE_EXECUTE_READ 0x20
77 #define PAGE_EXECUTE_READWRITE 0x40
78 #define PAGE_EXECUTE_WRITECOPY 0x80
79 #define PAGE_GUARD 0x100
80 #define PAGE_NOCACHE 0x200
82 #define MEM_COMMIT 0x00001000
83 #define MEM_RESERVE 0x00002000
84 #define MEM_DECOMMIT 0x00004000
85 #define MEM_RELEASE 0x00008000
86 #define MEM_FREE 0x00010000
87 #define MEM_PRIVATE 0x00020000
88 #define MEM_MAPPED 0x00040000
89 #define MEM_RESET 0x00080000
90 #define MEM_TOP_DOWN 0x00100000
92 #define MEM_SYSTEM 0x80000000
95 #define SEC_FILE 0x00800000
96 #define SEC_IMAGE 0x01000000
97 #define SEC_RESERVE 0x04000000
98 #define SEC_COMMIT 0x08000000
99 #define SEC_NOCACHE 0x10000000
100 #define MEM_IMAGE SEC_IMAGE
103 #define ANYSIZE_ARRAY 1
107 #define MINSHORT 0x8000
108 #define MAXSHORT 0x7fff
109 #define MINLONG 0x80000000
110 #define MAXLONG 0x7fffffff
112 #define MAXWORD 0xffff
113 #define MAXDWORD 0xffffffff
115 #define FIELD_OFFSET(type, field) \
116 ((LONG)(INT)&(((type *)0)->field))
118 #define CONTAINING_RECORD(address, type, field) \
119 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
123 /* TCHAR data types definitions for Winelib. */
124 /* These types are _not_ defined for the emulator, because they */
125 /* depend on the UNICODE macro that only exists in user's code. */
129 typedef WCHAR TCHAR
, *PTCHAR
;
130 typedef LPWSTR PTSTR
, LPTSTR
;
131 typedef LPCWSTR PCTSTR
, LPCTSTR
;
132 #define __TEXT(string) L##string /*probably wrong */
134 typedef char TCHAR
, *PTCHAR
;
135 typedef LPSTR PTSTR
, LPTSTR
;
136 typedef LPCSTR PCTSTR
, LPCTSTR
;
137 #define __TEXT(string) string
138 # endif /* UNICODE */
139 #endif /* __WINE__ */
140 #define TEXT(quote) __TEXT(quote)
142 typedef BYTE BOOLEAN
;
143 typedef BOOLEAN
*PBOOLEAN
;
145 typedef struct _LIST_ENTRY
{
146 struct _LIST_ENTRY
*Flink
;
147 struct _LIST_ENTRY
*Blink
;
148 } LIST_ENTRY
, *PLIST_ENTRY
;
150 typedef struct _SINGLE_LIST_ENTRY
{
151 struct _SINGLE_LIST_ENTRY
*Next
;
152 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
156 #define HEAP_NO_SERIALIZE 0x00000001
157 #define HEAP_GROWABLE 0x00000002
158 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
159 #define HEAP_ZERO_MEMORY 0x00000008
160 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
161 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
162 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
163 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
164 #define HEAP_CREATE_ALIGN_16 0x00010000
165 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
166 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
167 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
168 #define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
169 #define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */
171 /* Processor feature flags. */
172 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
173 #define PF_FLOATING_POINT_EMULATED 1
174 #define PF_COMPARE_EXCHANGE_DOUBLE 2
175 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
176 #define PF_PPC_MOVEMEM_64BIT_OK 4
177 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
180 /* The Win32 register context */
182 /* CONTEXT is the CPU-dependent context; it should be used */
183 /* wherever a platform-specific context is needed (e.g. exception */
184 /* handling, Win32 register functions). */
186 /* CONTEXT86 is the i386-specific context; it should be used */
187 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
188 /* Win16 register functions), so that this code can be compiled */
189 /* on all platforms. */
191 #define SIZE_OF_80387_REGISTERS 80
193 typedef struct _FLOATING_SAVE_AREA
202 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
204 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
206 typedef struct _CONTEXT86
210 /* These are selected by CONTEXT_DEBUG_REGISTERS */
218 /* These are selected by CONTEXT_FLOATING_POINT */
219 FLOATING_SAVE_AREA FloatSave
;
221 /* These are selected by CONTEXT_SEGMENTS */
227 /* These are selected by CONTEXT_INTEGER */
235 /* These are selected by CONTEXT_CONTROL */
244 #define CONTEXT_X86 0x00010000
245 #define CONTEXT_i386 CONTEXT_X86
246 #define CONTEXT_i486 CONTEXT_X86
248 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
249 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
250 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
251 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
252 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
253 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
255 /* i386 context definitions */
258 #define CONTEXT_CONTROL CONTEXT86_CONTROL
259 #define CONTEXT_INTEGER CONTEXT86_INTEGER
260 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
261 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
262 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
263 #define CONTEXT_FULL CONTEXT86_FULL
265 typedef CONTEXT86 CONTEXT
;
267 #endif /* __i386__ */
269 /* Alpha context definitions */
272 #define CONTEXT_ALPHA 0x00020000
274 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
275 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
276 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
277 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
279 typedef struct _CONTEXT
281 /* selected by CONTEXT_FLOATING_POINT */
315 /* selected by CONTEXT_INTEGER */
349 /* selected by CONTEXT_FLOATING_POINT */
353 /* selected by CONTEXT_CONTROL */
360 #define _QUAD_PSR_OFFSET HighSoftFpcr
361 #define _QUAD_FLAGS_OFFSET HighFir
365 /* Mips context definitions */
368 #define CONTEXT_R4000 0x00010000
370 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
371 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
372 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
374 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
376 typedef struct _CONTEXT
379 /* These are selected by CONTEXT_FLOATING_POINT */
413 /* These are selected by CONTEXT_INTEGER */
449 /* These are selected by CONTEXT_FLOATING_POINT */
452 /* These are selected by CONTEXT_CONTROL */
462 /* PowerPC context definitions */
465 #define CONTEXT_CONTROL 0x0001
466 #define CONTEXT_FLOATING_POINT 0x0002
467 #define CONTEXT_INTEGER 0x0004
468 #define CONTEXT_DEBUG_REGISTERS 0x0008
469 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
473 /* These are selected by CONTEXT_FLOATING_POINT */
508 /* These are selected by CONTEXT_INTEGER */
545 /* These are selected by CONTEXT_CONTROL */
554 /* These are selected by CONTEXT_DEBUG_REGISTERS */
565 typedef struct _STACK_FRAME_HEADER
582 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
591 * There is no official CONTEXT structure defined for the SPARC
592 * architecture, so I just made one up.
594 * This structure is valid only for 32-bit SPARC architectures,
595 * not for 64-bit SPARC.
597 * Note that this structure contains only the 'top-level' registers;
598 * the rest of the register window chain is not visible.
600 * The layout follows the Solaris 'prgregset_t' structure.
604 #define CONTEXT_SPARC 0x10000000
606 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
607 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
608 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
610 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
612 typedef struct _CONTEXT
616 /* These are selected by CONTEXT_INTEGER */
650 /* These are selected by CONTEXT_CONTROL */
658 /* FIXME: floating point registers missing */
662 #endif /* __sparc__ */
664 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
665 #error You need to define a CONTEXT for your CPU
668 typedef CONTEXT
*PCONTEXT
;
669 typedef HANDLE
*PHANDLE
;
673 /* Macros for easier access to i386 context registers */
675 #define EAX_reg(context) ((context)->Eax)
676 #define EBX_reg(context) ((context)->Ebx)
677 #define ECX_reg(context) ((context)->Ecx)
678 #define EDX_reg(context) ((context)->Edx)
679 #define ESI_reg(context) ((context)->Esi)
680 #define EDI_reg(context) ((context)->Edi)
681 #define EBP_reg(context) ((context)->Ebp)
683 #define CS_reg(context) ((context)->SegCs)
684 #define DS_reg(context) ((context)->SegDs)
685 #define ES_reg(context) ((context)->SegEs)
686 #define FS_reg(context) ((context)->SegFs)
687 #define GS_reg(context) ((context)->SegGs)
688 #define SS_reg(context) ((context)->SegSs)
690 #define EFL_reg(context) ((context)->EFlags)
691 #define EIP_reg(context) ((context)->Eip)
692 #define ESP_reg(context) ((context)->Esp)
694 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
695 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
696 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
697 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
698 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
699 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
700 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
702 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
703 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
704 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
705 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
706 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
707 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
708 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
709 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
711 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
712 #define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
713 #define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
714 #define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
716 #define ISV86(context) (EFL_reg(context) & 0x00020000)
717 #define V86BASE(context) ((context)->Dr7) /* ugly */
720 /* Macros to retrieve the current context */
724 #ifdef NEED_UNDERSCORE_PREFIX
725 # define __ASM_NAME(name) "_" name
727 # define __ASM_NAME(name) name
731 # define __ASM_GLOBAL_FUNC(name,code) \
732 __asm__( ".align 4\n\t" \
733 ".globl " __ASM_NAME(#name) "\n\t" \
734 ".type " __ASM_NAME(#name) ",@function\n" \
735 __ASM_NAME(#name) ":\n\t" \
738 # define __ASM_GLOBAL_FUNC(name,code) \
739 void __asm_dummy_##name(void) { \
740 asm( ".align 4\n\t" \
741 ".globl " __ASM_NAME(#name) "\n\t" \
742 ".type " __ASM_NAME(#name) ",@function\n" \
743 __ASM_NAME(#name) ":\n\t" \
746 #endif /* __GNUC__ */
748 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
749 __ASM_GLOBAL_FUNC( name, \
750 "call " __ASM_NAME("CALL32_Regs") "\n\t" \
751 ".long " __ASM_NAME(#fn) "\n\t" \
752 ".byte " #args ", " #args )
753 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
754 extern void WINAPI name(void); \
755 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
756 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
757 extern void WINAPI name( t1 a1 ); \
758 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
759 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
760 extern void WINAPI name( t1 a1, t2 a2 ); \
761 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
762 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
763 extern void WINAPI name( t1 a1, t2 a2, t3 a3 ); \
764 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
765 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
766 extern void WINAPI name( t1 a1, t2 a2, t3 a3, t4 a4 ); \
767 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
769 #endif /* __i386__ */
772 /* FIXME: use getcontext() to retrieve full context */
773 #define _GET_CONTEXT \
775 do { memset(&context, 0, sizeof(CONTEXT)); \
776 context.ContextFlags = CONTEXT_CONTROL; \
777 context.pc = (DWORD)__builtin_return_address(0); \
780 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
781 void WINAPI name ( void ) \
782 { _GET_CONTEXT; fn( &context ); }
783 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
784 void WINAPI name ( t1 a1 ) \
785 { _GET_CONTEXT; fn( a1, &context ); }
786 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
787 void WINAPI name ( t1 a1, t2 a2 ) \
788 { _GET_CONTEXT; fn( a1, a2, &context ); }
789 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
790 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
791 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
792 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
793 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
794 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
796 #endif /* __sparc__ */
798 #ifndef DEFINE_REGS_ENTRYPOINT_0
799 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
803 # define GET_IP(context) ((LPVOID)(context)->Eip)
806 # define GET_IP(context) ((LPVOID)(context)->pc)
809 #if !defined(GET_IP) && !defined(RC_INVOKED)
810 # error You must define GET_IP for this CPU
813 /* Constructor functions */
816 # define DECL_GLOBAL_CONSTRUCTOR(func) \
817 static void func(void) __attribute__((constructor)); \
818 static void func(void)
821 # define DECL_GLOBAL_CONSTRUCTOR(func) \
822 static void __dummy_init_##func(void) { \
823 asm(".section .init,\"ax\"\n\t" \
824 "call " #func "\n\t" \
826 static void func(void)
827 # else /* __i386__ */
828 # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
830 #endif /* __GNUC__ */
832 #endif /* __WINE__ */
838 #define STATUS_SUCCESS 0x00000000
839 #define STATUS_WAIT_0 0x00000000
840 #define STATUS_ABANDONED_WAIT_0 0x00000080
841 #define STATUS_USER_APC 0x000000C0
842 #define STATUS_TIMEOUT 0x00000102
843 #define STATUS_PENDING 0x00000103
845 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
846 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
847 #define STATUS_BREAKPOINT 0x80000003
848 #define STATUS_SINGLE_STEP 0x80000004
849 #define STATUS_BUFFER_OVERFLOW 0x80000005
850 #define STATUS_NO_MORE_FILES 0x80000006
851 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
853 #define STATUS_HANDLES_CLOSED 0x8000000A
854 #define STATUS_NO_INHERITANCE 0x8000000B
855 #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
856 #define STATUS_PARTIAL_COPY 0x8000000D
857 #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
858 #define STATUS_DEVICE_POWERED_OFF 0x8000000F
859 #define STATUS_DEVICE_OFF_LINE 0x80000010
860 #define STATUS_DEVICE_BUSY 0x80000011
861 #define STATUS_NO_MORE_EAS 0x80000012
862 #define STATUS_INVALID_EA_NAME 0x80000013
863 #define STATUS_EA_LIST_INCONSISTENT 0x80000014
864 #define STATUS_INVALID_EA_FLAG 0x80000015
865 #define STATUS_VERIFY_REQUIRED 0x80000016
866 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017
867 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
868 #define STATUS_NO_MORE_ENTRIES 0x8000001A
869 #define STATUS_FILEMARK_DETECTED 0x8000001B
870 #define STATUS_MEDIA_CHANGED 0x8000001C
871 #define STATUS_BUS_RESET 0x8000001D
872 #define STATUS_END_OF_MEDIA 0x8000001E
873 #define STATUS_BEGINNING_OF_MEDIA 0x8000001F
874 #define STATUS_MEDIA_CHECK 0x80000020
875 #define STATUS_SETMARK_DETECTED 0x80000021
876 #define STATUS_NO_DATA_DETECTED 0x80000022
877 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
878 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
879 #define STATUS_ALREADY_DISCONNECTED 0x80000025
880 #define STATUS_LONGJUMP 0x80000026
882 #define STATUS_UNSUCCESSFUL 0xC0000001
883 #define STATUS_NOT_IMPLEMENTED 0xC0000002
884 #define STATUS_INVALID_INFO_CLASS 0xC0000003
885 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
886 #define STATUS_ACCESS_VIOLATION 0xC0000005
887 #define STATUS_IN_PAGE_ERROR 0xC0000006
888 #define STATUS_PAGEFILE_QUOTA 0xC0000007
889 #define STATUS_INVALID_HANDLE 0xC0000008
890 #define STATUS_BAD_INITIAL_STACK 0xC0000009
891 #define STATUS_BAD_INITIAL_PC 0xC000000A
892 #define STATUS_INVALID_CID 0xC000000B
893 #define STATUS_TIMER_NOT_CANCELED 0xC000000C
894 #define STATUS_INVALID_PARAMETER 0xC000000D
895 #define STATUS_NO_SUCH_DEVICE 0xC000000E
896 #define STATUS_NO_SUCH_FILE 0xC000000F
897 #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
898 #define STATUS_END_OF_FILE 0xC0000011
899 #define STATUS_WRONG_VOLUME 0xC0000012
900 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
901 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
902 #define STATUS_NONEXISTENT_SECTOR 0xC0000015
903 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
904 #define STATUS_NO_MEMORY 0xC0000017
905 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018
906 #define STATUS_NOT_MAPPED_VIEW 0xC0000019
907 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A
908 #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
909 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
910 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
911 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
912 #define STATUS_INVALID_VIEW_SIZE 0xC000001F
913 #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
914 #define STATUS_ALREADY_COMMITTED 0xC0000021
915 #define STATUS_ACCESS_DENIED 0xC0000022
916 #define STATUS_BUFFER_TOO_SMALL 0xC0000023
917 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
918 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
919 #define STATUS_INVALID_DISPOSITION 0xC0000026
920 #define STATUS_UNWIND 0xC0000027
921 #define STATUS_BAD_STACK 0xC0000028
922 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029
923 #define STATUS_NOT_LOCKED 0xC000002A
924 #define STATUS_PARITY_ERROR 0xC000002B
925 #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
926 #define STATUS_NOT_COMMITTED 0xC000002D
927 #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
928 #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
929 #define STATUS_INVALID_PARAMETER_MIX 0xC0000030
930 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031
931 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032
932 #define STATUS_OBJECT_NAME_INVALID 0xC0000033
933 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
934 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035
935 #define STATUS_PORT_DISCONNECTED 0xC0000037
936 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
937 #define STATUS_OBJECT_PATH_INVALID 0xC0000039
938 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
939 #define STATUS_PATH_SYNTAX_BAD 0xC000003B
940 #define STATUS_DATA_OVERRUN 0xC000003C
941 #define STATUS_DATA_LATE_ERROR 0xC000003D
942 #define STATUS_DATA_ERROR 0xC000003E
943 #define STATUS_CRC_ERROR 0xC000003F
944 #define STATUS_SECTION_TOO_BIG 0xC0000040
945 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
946 #define STATUS_INVALID_PORT_HANDLE 0xC0000042
947 #define STATUS_SHARING_VIOLATION 0xC0000043
948 #define STATUS_QUOTA_EXCEEDED 0xC0000044
949 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
950 #define STATUS_MUTANT_NOT_OWNED 0xC0000046
951 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
952 #define STATUS_PORT_ALREADY_SET 0xC0000048
953 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
954 #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
955 #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
956 #define STATUS_UNKNOWN_REVISION 0xC0000058
957 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079
958 #define STATUS_DISK_FULL 0xC000007F
959 #define STATUS_SECTION_NOT_EXTENDED 0xC0000087
960 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
961 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
962 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
963 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
964 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
965 #define STATUS_FLOAT_OVERFLOW 0xC0000091
966 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
967 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
968 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
969 #define STATUS_INTEGER_OVERFLOW 0xC0000095
970 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
971 #define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
972 #define STATUS_INVALID_PARAMETER_2 0xC00000F0
973 #define STATUS_STACK_OVERFLOW 0xC00000FD
974 #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
975 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
976 #define STATUS_CONTROL_C_EXIT 0xC000013A
977 #define STATUS_PIPE_BROKEN 0xC000014B
978 #define STATUS_NOT_REGISTRY_FILE 0xC000015C
979 #define STATUS_PARTITION_FAILURE 0xC0000172
980 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
981 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
982 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
983 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
984 #define STATUS_EOM_OVERFLOW 0xC0000177
985 #define STATUS_NO_MEDIA 0xC0000178
986 #define STATUS_NO_SUCH_MEMBER 0xC000017A
987 #define STATUS_INVALID_MEMBER 0xC000017B
988 #define STATUS_KEY_DELETED 0xC000017C
989 #define STATUS_NO_LOG_SPACE 0xC000017D
990 #define STATUS_TOO_MANY_SIDS 0xC000017E
991 #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
992 #define STATUS_KEY_HAS_CHILDREN 0xC0000180
993 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
994 #define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
995 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
996 #define STATUS_INVALID_DEVICE_STATE 0xC0000184
997 #define STATUS_IO_DEVICE_ERROR 0xC0000185
998 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
999 #define STATUS_BACKUP_CONTROLLER 0xC0000187
1000 #define STATUS_LOG_FILE_FULL 0xC0000188
1001 #define STATUS_TOO_LATE 0xC0000189
1002 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
1003 #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
1004 #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
1005 #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
1006 #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
1007 #define STATUS_EVENTLOG_CANT_START 0xC000018F
1008 #define STATUS_TRUST_FAILURE 0xC0000190
1009 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
1010 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192
1011 #define STATUS_ACCOUNT_EXPIRED 0xC0000193
1012 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194
1013 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
1014 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
1015 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
1016 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
1017 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
1018 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
1019 #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
1020 #define STATUS_FS_DRIVER_REQUIRED 0xC000019C
1022 #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
1024 #define MAXIMUM_WAIT_OBJECTS 64
1025 #define MAXIMUM_SUSPEND_COUNT 127
1029 * Return values from the actual exception handlers
1032 #define ExceptionContinueExecution 0
1033 #define ExceptionContinueSearch 1
1034 #define ExceptionNestedException 2
1035 #define ExceptionCollidedUnwind 3
1038 * Return values from filters in except() and from UnhandledExceptionFilter
1041 #define EXCEPTION_EXECUTE_HANDLER 1
1042 #define EXCEPTION_CONTINUE_SEARCH 0
1043 #define EXCEPTION_CONTINUE_EXECUTION -1
1046 * From OS/2 2.0 exception handling
1047 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1050 #define EH_NONCONTINUABLE 0x01
1051 #define EH_UNWINDING 0x02
1052 #define EH_EXIT_UNWIND 0x04
1053 #define EH_STACK_INVALID 0x08
1054 #define EH_NESTED_CALL 0x10
1056 #define EXCEPTION_CONTINUABLE 0
1057 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1060 * The exception record used by Win32 to give additional information
1061 * about exception to exception handlers.
1064 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1066 typedef struct __EXCEPTION_RECORD
1068 DWORD ExceptionCode
;
1069 DWORD ExceptionFlags
;
1070 struct __EXCEPTION_RECORD
*ExceptionRecord
;
1072 LPVOID ExceptionAddress
;
1073 DWORD NumberParameters
;
1074 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
1075 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
1078 * The exception pointers structure passed to exception filters
1079 * in except() and the UnhandledExceptionFilter().
1082 typedef struct _EXCEPTION_POINTERS
1084 PEXCEPTION_RECORD ExceptionRecord
;
1085 PCONTEXT ContextRecord
;
1086 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
1090 * The exception frame, used for registering exception handlers
1091 * Win32 cares only about this, but compilers generally emit
1092 * larger exception frames for their own use.
1095 struct __EXCEPTION_FRAME
;
1097 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct __EXCEPTION_FRAME
*,
1098 PCONTEXT
,struct __EXCEPTION_FRAME
**);
1100 typedef struct __EXCEPTION_FRAME
1102 struct __EXCEPTION_FRAME
*Prev
;
1103 PEXCEPTION_HANDLER Handler
;
1104 } EXCEPTION_FRAME
, *PEXCEPTION_FRAME
;
1106 #include "poppack.h"
1109 * function pointer to a exception filter
1112 typedef LONG (CALLBACK
*PTOP_LEVEL_EXCEPTION_FILTER
)(PEXCEPTION_POINTERS ExceptionInfo
);
1113 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
;
1115 DWORD WINAPI
UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers
);
1116 LPTOP_LEVEL_EXCEPTION_FILTER
1117 WINAPI
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter
);
1119 /* status values for ContinueDebugEvent */
1120 #define DBG_CONTINUE 0x00010002
1121 #define DBG_TERMINATE_THREAD 0x40010003
1122 #define DBG_TERMINATE_PROCESS 0x40010004
1123 #define DBG_CONTROL_C 0x40010005
1124 #define DBG_CONTROL_BREAK 0x40010008
1125 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1127 typedef struct _NT_TIB
1129 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
1137 PVOID ArbitraryUserPointer
;
1138 struct _NT_TIB
*Self
;
1143 #if defined(__i386__) && defined(__GNUC__)
1144 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
1145 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1148 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
1152 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
1157 * File formats definitions
1160 typedef struct _IMAGE_DOS_HEADER
{
1161 WORD e_magic
; /* 00: MZ Header signature */
1162 WORD e_cblp
; /* 02: Bytes on last page of file */
1163 WORD e_cp
; /* 04: Pages in file */
1164 WORD e_crlc
; /* 06: Relocations */
1165 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
1166 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
1167 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
1168 WORD e_ss
; /* 0e: Initial (relative) SS value */
1169 WORD e_sp
; /* 10: Initial SP value */
1170 WORD e_csum
; /* 12: Checksum */
1171 WORD e_ip
; /* 14: Initial IP value */
1172 WORD e_cs
; /* 16: Initial (relative) CS value */
1173 WORD e_lfarlc
; /* 18: File address of relocation table */
1174 WORD e_ovno
; /* 1a: Overlay number */
1175 WORD e_res
[4]; /* 1c: Reserved words */
1176 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
1177 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
1178 WORD e_res2
[10]; /* 28: Reserved words */
1179 DWORD e_lfanew
; /* 3c: Offset to extended header */
1180 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
1182 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1183 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1184 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1185 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1186 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1187 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1190 * This is the Windows executable (NE) header.
1191 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1195 WORD ne_magic
; /* 00 NE signature 'NE' */
1196 BYTE ne_ver
; /* 02 Linker version number */
1197 BYTE ne_rev
; /* 03 Linker revision number */
1198 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
1199 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
1200 LONG ne_crc
; /* 08 Checksum */
1201 WORD ne_flags
; /* 0c Flags about segments in this file */
1202 WORD ne_autodata
; /* 0e Automatic data segment number */
1203 WORD ne_heap
; /* 10 Initial size of local heap */
1204 WORD ne_stack
; /* 12 Initial size of stack */
1205 DWORD ne_csip
; /* 14 Initial CS:IP */
1206 DWORD ne_sssp
; /* 18 Initial SS:SP */
1207 WORD ne_cseg
; /* 1c # of entries in segment table */
1208 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
1209 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
1210 WORD ne_segtab
; /* 22 Offset to segment table */
1211 WORD ne_rsrctab
; /* 24 Offset to resource table */
1212 WORD ne_restab
; /* 26 Offset to resident-name table */
1213 WORD ne_modtab
; /* 28 Offset to module reference table */
1214 WORD ne_imptab
; /* 2a Offset to imported name table */
1215 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
1216 WORD ne_cmovent
; /* 30 # of movable entry points */
1217 WORD ne_align
; /* 32 Logical sector alignment shift count */
1218 WORD ne_cres
; /* 34 # of resource segments */
1219 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
1220 BYTE ne_flagsothers
; /* 37 Additional information flags */
1221 WORD fastload_offset
; /* 38 Offset to fast load area (should be ne_pretthunks)*/
1222 WORD fastload_length
; /* 3a Length of fast load area (should be ne_psegrefbytes) */
1223 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
1224 WORD ne_expver
; /* 3e Expected Windows version number */
1225 } IMAGE_OS2_HEADER
,*PIMAGE_OS2_HEADER
;
1227 typedef struct _IMAGE_VXD_HEADER
{
1242 DWORD e32_lastpagesize
;
1243 DWORD e32_fixupsize
;
1260 DWORD e32_impmodcnt
;
1266 DWORD e32_cbnrestab
;
1269 DWORD e32_debuginfo
;
1271 DWORD e32_instpreload
;
1272 DWORD e32_instdemand
;
1275 DWORD e32_winresoff
;
1276 DWORD e32_winreslen
;
1279 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
1282 /* These defines describe the meanings of the bits in the Characteristics
1285 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1286 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1287 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1288 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1289 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1290 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1291 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1292 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1293 #define IMAGE_FILE_SYSTEM 0x1000
1294 #define IMAGE_FILE_DLL 0x2000
1295 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1297 /* These are the settings of the Machine field. */
1298 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1299 #define IMAGE_FILE_MACHINE_I860 0x14d
1300 #define IMAGE_FILE_MACHINE_I386 0x14c
1301 #define IMAGE_FILE_MACHINE_R3000 0x162
1302 #define IMAGE_FILE_MACHINE_R4000 0x166
1303 #define IMAGE_FILE_MACHINE_R10000 0x168
1304 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1305 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
1307 #define IMAGE_SIZEOF_FILE_HEADER 20
1309 /* Possible Magic values */
1310 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1311 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1313 /* These are indexes into the DataDirectory array */
1314 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1315 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1316 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1317 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1318 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1319 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1320 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1321 #define IMAGE_FILE_DESCRIPTION_STRING 7
1322 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1323 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1324 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1326 /* Directory Entries, indices into the DataDirectory array */
1328 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1329 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1330 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1331 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1332 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1333 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1334 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1335 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1336 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1337 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1338 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1339 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1340 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1341 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1342 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1344 /* Subsystem Values */
1346 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1347 #define IMAGE_SUBSYSTEM_NATIVE 1
1348 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1349 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
1350 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1351 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1353 typedef struct _IMAGE_FILE_HEADER
{
1355 WORD NumberOfSections
;
1356 DWORD TimeDateStamp
;
1357 DWORD PointerToSymbolTable
;
1358 DWORD NumberOfSymbols
;
1359 WORD SizeOfOptionalHeader
;
1360 WORD Characteristics
;
1361 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
1363 typedef struct _IMAGE_DATA_DIRECTORY
{
1364 DWORD VirtualAddress
;
1366 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
1368 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1370 typedef struct _IMAGE_OPTIONAL_HEADER
{
1372 /* Standard fields */
1375 BYTE MajorLinkerVersion
;
1376 BYTE MinorLinkerVersion
;
1378 DWORD SizeOfInitializedData
;
1379 DWORD SizeOfUninitializedData
;
1380 DWORD AddressOfEntryPoint
;
1384 /* NT additional fields */
1387 DWORD SectionAlignment
;
1388 DWORD FileAlignment
;
1389 WORD MajorOperatingSystemVersion
;
1390 WORD MinorOperatingSystemVersion
;
1391 WORD MajorImageVersion
;
1392 WORD MinorImageVersion
;
1393 WORD MajorSubsystemVersion
;
1394 WORD MinorSubsystemVersion
;
1395 DWORD Win32VersionValue
;
1397 DWORD SizeOfHeaders
;
1400 WORD DllCharacteristics
;
1401 DWORD SizeOfStackReserve
;
1402 DWORD SizeOfStackCommit
;
1403 DWORD SizeOfHeapReserve
;
1404 DWORD SizeOfHeapCommit
;
1406 DWORD NumberOfRvaAndSizes
;
1407 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
1408 } IMAGE_OPTIONAL_HEADER
, *PIMAGE_OPTIONAL_HEADER
;
1410 typedef struct _IMAGE_NT_HEADERS
{
1412 IMAGE_FILE_HEADER FileHeader
;
1413 IMAGE_OPTIONAL_HEADER OptionalHeader
;
1414 } IMAGE_NT_HEADERS
, *PIMAGE_NT_HEADERS
;
1416 #define IMAGE_SIZEOF_SHORT_NAME 8
1418 typedef struct _IMAGE_SECTION_HEADER
{
1419 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
1421 DWORD PhysicalAddress
;
1424 DWORD VirtualAddress
;
1425 DWORD SizeOfRawData
;
1426 DWORD PointerToRawData
;
1427 DWORD PointerToRelocations
;
1428 DWORD PointerToLinenumbers
;
1429 WORD NumberOfRelocations
;
1430 WORD NumberOfLinenumbers
;
1431 DWORD Characteristics
;
1432 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
1434 #define IMAGE_SIZEOF_SECTION_HEADER 40
1436 #define IMAGE_FIRST_SECTION(ntheader) \
1437 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1438 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1440 /* These defines are for the Characteristics bitfield. */
1441 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1442 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1443 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1444 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1445 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
1446 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1448 #define IMAGE_SCN_CNT_CODE 0x00000020
1449 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1450 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1452 #define IMAGE_SCN_LNK_OTHER 0x00000100
1453 #define IMAGE_SCN_LNK_INFO 0x00000200
1454 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1455 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1456 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1458 /* 0x00002000 - Reserved */
1459 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1460 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1462 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1463 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1464 #define IMAGE_SCN_MEM_16BIT 0x00020000
1465 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1466 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1468 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1469 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1470 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1471 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1472 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1473 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1474 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1475 /* 0x00800000 - Unused */
1477 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1480 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1481 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1482 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1483 #define IMAGE_SCN_MEM_SHARED 0x10000000
1484 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1485 #define IMAGE_SCN_MEM_READ 0x40000000
1486 #define IMAGE_SCN_MEM_WRITE 0x80000000
1488 #include "pshpack2.h"
1490 typedef struct _IMAGE_SYMBOL
{
1500 SHORT SectionNumber
;
1503 BYTE NumberOfAuxSymbols
;
1505 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
1507 #define IMAGE_SIZEOF_SYMBOL 18
1509 typedef struct _IMAGE_LINENUMBER
{
1511 DWORD SymbolTableIndex
;
1512 DWORD VirtualAddress
;
1516 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
1518 #define IMAGE_SIZEOF_LINENUMBER 6
1520 typedef union _IMAGE_AUX_SYMBOL
{
1532 DWORD PointerToLinenumber
;
1533 DWORD PointerToNextFunction
;
1542 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
1546 WORD NumberOfRelocations
;
1547 WORD NumberOfLinenumbers
;
1553 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
1555 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1557 #include "poppack.h"
1559 #define IMAGE_SYM_UNDEFINED (SHORT)0
1560 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
1561 #define IMAGE_SYM_DEBUG (SHORT)-2
1563 #define IMAGE_SYM_TYPE_NULL 0x0000
1564 #define IMAGE_SYM_TYPE_VOID 0x0001
1565 #define IMAGE_SYM_TYPE_CHAR 0x0002
1566 #define IMAGE_SYM_TYPE_SHORT 0x0003
1567 #define IMAGE_SYM_TYPE_INT 0x0004
1568 #define IMAGE_SYM_TYPE_LONG 0x0005
1569 #define IMAGE_SYM_TYPE_FLOAT 0x0006
1570 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
1571 #define IMAGE_SYM_TYPE_STRUCT 0x0008
1572 #define IMAGE_SYM_TYPE_UNION 0x0009
1573 #define IMAGE_SYM_TYPE_ENUM 0x000A
1574 #define IMAGE_SYM_TYPE_MOE 0x000B
1575 #define IMAGE_SYM_TYPE_BYTE 0x000C
1576 #define IMAGE_SYM_TYPE_WORD 0x000D
1577 #define IMAGE_SYM_TYPE_UINT 0x000E
1578 #define IMAGE_SYM_TYPE_DWORD 0x000F
1579 #define IMAGE_SYM_TYPE_PCODE 0x8000
1581 #define IMAGE_SYM_DTYPE_NULL 0
1582 #define IMAGE_SYM_DTYPE_POINTER 1
1583 #define IMAGE_SYM_DTYPE_FUNCTION 2
1584 #define IMAGE_SYM_DTYPE_ARRAY 3
1586 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
1587 #define IMAGE_SYM_CLASS_NULL 0x0000
1588 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
1589 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
1590 #define IMAGE_SYM_CLASS_STATIC 0x0003
1591 #define IMAGE_SYM_CLASS_REGISTER 0x0004
1592 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
1593 #define IMAGE_SYM_CLASS_LABEL 0x0006
1594 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
1595 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
1596 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
1597 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
1598 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
1599 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
1600 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
1601 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
1602 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
1603 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
1604 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
1605 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
1607 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
1608 #define IMAGE_SYM_CLASS_BLOCK 0x0064
1609 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
1610 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
1611 #define IMAGE_SYM_CLASS_FILE 0x0067
1612 #define IMAGE_SYM_CLASS_SECTION 0x0068
1613 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
1615 #define N_BTMASK 0x000F
1616 #define N_TMASK 0x0030
1617 #define N_TMASK1 0x00C0
1618 #define N_TMASK2 0x00F0
1622 #define BTYPE(x) ((x) & N_BTMASK)
1625 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
1629 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
1633 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
1637 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
1641 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1644 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1647 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1648 #define IMAGE_COMDAT_SELECT_ANY 2
1649 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1650 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1651 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1652 #define IMAGE_COMDAT_SELECT_LARGEST 6
1653 #define IMAGE_COMDAT_SELECT_NEWEST 7
1655 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1656 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1657 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1659 /* Export module directory */
1661 typedef struct _IMAGE_EXPORT_DIRECTORY
{
1662 DWORD Characteristics
;
1663 DWORD TimeDateStamp
;
1668 DWORD NumberOfFunctions
;
1669 DWORD NumberOfNames
;
1670 DWORD AddressOfFunctions
;
1671 DWORD AddressOfNames
;
1672 DWORD AddressOfNameOrdinals
;
1673 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
1675 /* Import name entry */
1676 typedef struct _IMAGE_IMPORT_BY_NAME
{
1679 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
1682 typedef struct _IMAGE_THUNK_DATA
{
1684 LPBYTE ForwarderString
;
1687 PIMAGE_IMPORT_BY_NAME AddressOfData
;
1689 } IMAGE_THUNK_DATA
,*PIMAGE_THUNK_DATA
;
1691 /* Import module directory */
1693 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
1695 DWORD Characteristics
; /* 0 for terminating null import descriptor */
1696 PIMAGE_THUNK_DATA OriginalFirstThunk
; /* RVA to original unbound IAT */
1698 DWORD TimeDateStamp
; /* 0 if not bound,
1699 * -1 if bound, and real date\time stamp
1700 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
1702 * otherwise date/time stamp of DLL bound to
1705 DWORD ForwarderChain
; /* -1 if no forwarders */
1707 /* RVA to IAT (if bound this IAT has actual addresses) */
1708 PIMAGE_THUNK_DATA FirstThunk
;
1709 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
1711 #define IMAGE_ORDINAL_FLAG 0x80000000
1712 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
1713 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
1715 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
1717 DWORD TimeDateStamp
;
1718 WORD OffsetModuleName
;
1719 WORD NumberOfModuleForwarderRefs
;
1720 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
1721 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
1723 typedef struct _IMAGE_BOUND_FORWARDER_REF
1725 DWORD TimeDateStamp
;
1726 WORD OffsetModuleName
;
1728 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
1730 typedef struct _IMAGE_BASE_RELOCATION
1732 DWORD VirtualAddress
;
1735 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
1737 typedef struct _IMAGE_RELOCATION
1740 DWORD VirtualAddress
;
1743 DWORD SymbolTableIndex
;
1746 typedef IMAGE_RELOCATION
*PIMAGE_RELOCATION
;
1748 #define IMAGE_SIZEOF_RELOCATION 10
1750 /* generic relocation types */
1751 #define IMAGE_REL_BASED_ABSOLUTE 0
1752 #define IMAGE_REL_BASED_HIGH 1
1753 #define IMAGE_REL_BASED_LOW 2
1754 #define IMAGE_REL_BASED_HIGHLOW 3
1755 #define IMAGE_REL_BASED_HIGHADJ 4
1756 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1757 #define IMAGE_REL_BASED_SECTION 6
1758 #define IMAGE_REL_BASED_REL 7
1759 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
1760 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
1761 #define IMAGE_REL_BASED_DIR64 10
1762 #define IMAGE_REL_BASED_HIGH3ADJ 11
1764 /* I386 relocation types */
1765 #define IMAGE_REL_I386_ABSOLUTE 0
1766 #define IMAGE_REL_I386_DIR16 1
1767 #define IMAGE_REL_I386_REL16 2
1768 #define IMAGE_REL_I386_DIR32 6
1769 #define IMAGE_REL_I386_DIR32NB 7
1770 #define IMAGE_REL_I386_SEG12 9
1771 #define IMAGE_REL_I386_SECTION 10
1772 #define IMAGE_REL_I386_SECREL 11
1773 #define IMAGE_REL_I386_REL32 20
1775 /* MIPS relocation types */
1776 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
1777 #define IMAGE_REL_MIPS_REFHALF 0x0001
1778 #define IMAGE_REL_MIPS_REFWORD 0x0002
1779 #define IMAGE_REL_MIPS_JMPADDR 0x0003
1780 #define IMAGE_REL_MIPS_REFHI 0x0004
1781 #define IMAGE_REL_MIPS_REFLO 0x0005
1782 #define IMAGE_REL_MIPS_GPREL 0x0006
1783 #define IMAGE_REL_MIPS_LITERAL 0x0007
1784 #define IMAGE_REL_MIPS_SECTION 0x000A
1785 #define IMAGE_REL_MIPS_SECREL 0x000B
1786 #define IMAGE_REL_MIPS_SECRELLO 0x000C
1787 #define IMAGE_REL_MIPS_SECRELHI 0x000D
1788 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
1789 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
1790 #define IMAGE_REL_MIPS_PAIR 0x0025
1792 /* ALPHA relocation types */
1793 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
1794 #define IMAGE_REL_ALPHA_REFLONG 0x0001
1795 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
1796 #define IMAGE_REL_ALPHA_GPREL 0x0003
1797 #define IMAGE_REL_ALPHA_LITERAL 0x0004
1798 #define IMAGE_REL_ALPHA_LITUSE 0x0005
1799 #define IMAGE_REL_ALPHA_GPDISP 0x0006
1800 #define IMAGE_REL_ALPHA_BRADDR 0x0007
1801 #define IMAGE_REL_ALPHA_HINT 0x0008
1802 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
1803 #define IMAGE_REL_ALPHA_REFHI 0x000A
1804 #define IMAGE_REL_ALPHA_REFLO 0x000B
1805 #define IMAGE_REL_ALPHA_PAIR 0x000C
1806 #define IMAGE_REL_ALPHA_MATCH 0x000D
1807 #define IMAGE_REL_ALPHA_SECTION 0x000E
1808 #define IMAGE_REL_ALPHA_SECREL 0x000F
1809 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
1810 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
1811 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
1812 #define IMAGE_REL_ALPHA_REFQ3 0x0013
1813 #define IMAGE_REL_ALPHA_REFQ2 0x0014
1814 #define IMAGE_REL_ALPHA_REFQ1 0x0015
1815 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
1816 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
1818 /* PowerPC relocation types */
1819 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
1820 #define IMAGE_REL_PPC_ADDR64 0x0001
1821 #define IMAGE_REL_PPC_ADDR 0x0002
1822 #define IMAGE_REL_PPC_ADDR24 0x0003
1823 #define IMAGE_REL_PPC_ADDR16 0x0004
1824 #define IMAGE_REL_PPC_ADDR14 0x0005
1825 #define IMAGE_REL_PPC_REL24 0x0006
1826 #define IMAGE_REL_PPC_REL14 0x0007
1827 #define IMAGE_REL_PPC_TOCREL16 0x0008
1828 #define IMAGE_REL_PPC_TOCREL14 0x0009
1829 #define IMAGE_REL_PPC_ADDR32NB 0x000A
1830 #define IMAGE_REL_PPC_SECREL 0x000B
1831 #define IMAGE_REL_PPC_SECTION 0x000C
1832 #define IMAGE_REL_PPC_IFGLUE 0x000D
1833 #define IMAGE_REL_PPC_IMGLUE 0x000E
1834 #define IMAGE_REL_PPC_SECREL16 0x000F
1835 #define IMAGE_REL_PPC_REFHI 0x0010
1836 #define IMAGE_REL_PPC_REFLO 0x0011
1837 #define IMAGE_REL_PPC_PAIR 0x0012
1838 #define IMAGE_REL_PPC_SECRELLO 0x0013
1839 #define IMAGE_REL_PPC_SECRELHI 0x0014
1840 #define IMAGE_REL_PPC_GPREL 0x0015
1841 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
1843 #define IMAGE_REL_PPC_NEG 0x0100
1844 #define IMAGE_REL_PPC_BRTAKEN 0x0200
1845 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
1846 #define IMAGE_REL_PPC_TOCDEFN 0x0800
1848 /* SH3 ? relocation type */
1849 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
1850 #define IMAGE_REL_SH3_DIRECT16 0x0001
1851 #define IMAGE_REL_SH3_DIRECT 0x0002
1852 #define IMAGE_REL_SH3_DIRECT8 0x0003
1853 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
1854 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
1855 #define IMAGE_REL_SH3_DIRECT4 0x0006
1856 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
1857 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
1858 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
1859 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
1860 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
1861 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
1862 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
1863 #define IMAGE_REL_SH3_SECTION 0x000E
1864 #define IMAGE_REL_SH3_SECREL 0x000F
1865 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
1867 /* ARM (Archimedes?) relocation types */
1868 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
1869 #define IMAGE_REL_ARM_ADDR 0x0001
1870 #define IMAGE_REL_ARM_ADDR32NB 0x0002
1871 #define IMAGE_REL_ARM_BRANCH24 0x0003
1872 #define IMAGE_REL_ARM_BRANCH11 0x0004
1873 #define IMAGE_REL_ARM_SECTION 0x000E
1874 #define IMAGE_REL_ARM_SECREL 0x000F
1876 /* IA64 relocation types */
1877 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
1878 #define IMAGE_REL_IA64_IMM14 0x0001
1879 #define IMAGE_REL_IA64_IMM22 0x0002
1880 #define IMAGE_REL_IA64_IMM64 0x0003
1881 #define IMAGE_REL_IA64_DIR 0x0004
1882 #define IMAGE_REL_IA64_DIR64 0x0005
1883 #define IMAGE_REL_IA64_PCREL21B 0x0006
1884 #define IMAGE_REL_IA64_PCREL21M 0x0007
1885 #define IMAGE_REL_IA64_PCREL21F 0x0008
1886 #define IMAGE_REL_IA64_GPREL22 0x0009
1887 #define IMAGE_REL_IA64_LTOFF22 0x000A
1888 #define IMAGE_REL_IA64_SECTION 0x000B
1889 #define IMAGE_REL_IA64_SECREL22 0x000C
1890 #define IMAGE_REL_IA64_SECREL64I 0x000D
1891 #define IMAGE_REL_IA64_SECREL 0x000E
1892 #define IMAGE_REL_IA64_LTOFF64 0x000F
1893 #define IMAGE_REL_IA64_DIR32NB 0x0010
1894 #define IMAGE_REL_IA64_RESERVED_11 0x0011
1895 #define IMAGE_REL_IA64_RESERVED_12 0x0012
1896 #define IMAGE_REL_IA64_RESERVED_13 0x0013
1897 #define IMAGE_REL_IA64_RESERVED_14 0x0014
1898 #define IMAGE_REL_IA64_RESERVED_15 0x0015
1899 #define IMAGE_REL_IA64_RESERVED_16 0x0016
1900 #define IMAGE_REL_IA64_ADDEND 0x001F
1902 /* archive format */
1904 #define IMAGE_ARCHIVE_START_SIZE 8
1905 #define IMAGE_ARCHIVE_START "!<arch>\n"
1906 #define IMAGE_ARCHIVE_END "`\n"
1907 #define IMAGE_ARCHIVE_PAD "\n"
1908 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1909 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1911 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
1920 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
1922 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1925 * Resource directory stuff
1927 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
1928 DWORD Characteristics
;
1929 DWORD TimeDateStamp
;
1932 WORD NumberOfNamedEntries
;
1933 WORD NumberOfIdEntries
;
1934 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
1935 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
1937 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1938 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1940 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
1943 unsigned NameOffset
:31;
1944 unsigned NameIsString
:1;
1952 unsigned OffsetToDirectory
:31;
1953 unsigned DataIsDirectory
:1;
1956 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
1959 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
1961 CHAR NameString
[ 1 ];
1962 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
1964 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
1966 WCHAR NameString
[ 1 ];
1967 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
1969 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
1973 DWORD ResourceHandle
;
1974 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
1977 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
1978 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
1981 typedef struct _IMAGE_TLS_DIRECTORY
{
1982 DWORD StartAddressOfRawData
;
1983 DWORD EndAddressOfRawData
;
1984 LPDWORD AddressOfIndex
;
1985 PIMAGE_TLS_CALLBACK
*AddressOfCallBacks
;
1986 DWORD SizeOfZeroFill
;
1987 DWORD Characteristics
;
1988 } IMAGE_TLS_DIRECTORY
,*PIMAGE_TLS_DIRECTORY
;
1990 typedef struct _IMAGE_DEBUG_DIRECTORY
{
1991 DWORD Characteristics
;
1992 DWORD TimeDateStamp
;
1997 DWORD AddressOfRawData
;
1998 DWORD PointerToRawData
;
1999 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
2001 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2002 #define IMAGE_DEBUG_TYPE_COFF 1
2003 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2004 #define IMAGE_DEBUG_TYPE_FPO 3
2005 #define IMAGE_DEBUG_TYPE_MISC 4
2006 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2007 #define IMAGE_DEBUG_TYPE_FIXUP 6
2008 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2009 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2010 #define IMAGE_DEBUG_TYPE_BORLAND 9
2011 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2013 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
2014 DWORD NumberOfSymbols
;
2015 DWORD LvaToFirstSymbol
;
2016 DWORD NumberOfLinenumbers
;
2017 DWORD LvaToFirstLinenumber
;
2018 DWORD RvaToFirstByteOfCode
;
2019 DWORD RvaToLastByteOfCode
;
2020 DWORD RvaToFirstByteOfData
;
2021 DWORD RvaToLastByteOfData
;
2022 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
2025 #define FRAME_TRAP 1
2027 #define FRAME_NONFPO 3
2029 typedef struct _FPO_DATA
{
2034 unsigned cbProlog
: 8;
2035 unsigned cbRegs
: 3;
2036 unsigned fHasSEH
: 1;
2037 unsigned fUseBP
: 1;
2038 unsigned reserved
: 1;
2039 unsigned cbFrame
: 2;
2040 } FPO_DATA
, *PFPO_DATA
;
2042 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
2043 DWORD Characteristics
;
2044 DWORD TimeDateStamp
;
2047 DWORD GlobalFlagsClear
;
2048 DWORD GlobalFlagsSet
;
2049 DWORD CriticalSectionDefaultTimeout
;
2050 DWORD DeCommitFreeBlockThreshold
;
2051 DWORD DeCommitTotalFreeThreshold
;
2052 PVOID LockPrefixTable
;
2053 DWORD MaximumAllocationSize
;
2054 DWORD VirtualMemoryThreshold
;
2055 DWORD ProcessHeapFlags
;
2056 DWORD ProcessAffinityMask
;
2061 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
2063 typedef struct _IMAGE_FUNCTION_ENTRY
{
2064 DWORD StartingAddress
;
2065 DWORD EndingAddress
;
2066 DWORD EndOfPrologue
;
2067 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
2069 /* This is the structure that appears at the very start of a .DBG file. */
2071 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
2075 WORD Characteristics
;
2076 DWORD TimeDateStamp
;
2080 DWORD NumberOfSections
;
2081 DWORD ExportedNamesSize
;
2082 DWORD DebugDirectorySize
;
2083 DWORD SectionAlignment
;
2084 DWORD Reserved
[ 2 ];
2085 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
2087 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2090 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
2094 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
2095 #define MESSAGE_RESOURCE_UNICODE 0x0001
2097 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
2100 DWORD OffsetToEntries
;
2101 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
2103 typedef struct tagMESSAGE_RESOURCE_DATA
{
2104 DWORD NumberOfBlocks
;
2105 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
2106 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
2109 * Here follows typedefs for security and tokens.
2113 * First a constant for the following typdefs.
2116 #define ANYSIZE_ARRAY 1
2118 /* FIXME: Orphan. What does it point to? */
2119 typedef PVOID PACCESS_TOKEN
;
2122 * TOKEN_INFORMATION_CLASS
2125 typedef enum _TOKEN_INFORMATION_CLASS
{
2134 TokenImpersonationLevel
,
2136 } TOKEN_INFORMATION_CLASS
;
2138 #ifndef _SECURITY_DEFINED
2139 #define _SECURITY_DEFINED
2141 #include "pshpack1.h"
2143 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
2145 typedef struct _GENERIC_MAPPING
{
2146 ACCESS_MASK GenericRead
;
2147 ACCESS_MASK GenericWrite
;
2148 ACCESS_MASK GenericExecute
;
2149 ACCESS_MASK GenericAll
;
2150 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
2152 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2153 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2156 } SID_IDENTIFIER_AUTHORITY
,*PSID_IDENTIFIER_AUTHORITY
,*LPSID_IDENTIFIER_AUTHORITY
;
2157 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2161 typedef struct _SID
{
2163 BYTE SubAuthorityCount
;
2164 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
2165 DWORD SubAuthority
[1];
2167 #endif /* !defined(SID_DEFINED) */
2169 #define SID_REVISION (1) /* Current revision */
2170 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2171 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2178 #define ACL_REVISION1 1
2179 #define ACL_REVISION2 2
2180 #define ACL_REVISION3 3
2181 #define ACL_REVISION4 4
2183 #define MIN_ACL_REVISION ACL_REVISION2
2184 #define MAX_ACL_REVISION ACL_REVISION4
2186 typedef struct _ACL
{
2194 /* SECURITY_DESCRIPTOR */
2195 #define SECURITY_DESCRIPTOR_REVISION 1
2196 #define SECURITY_DESCRIPTOR_REVISION1 1
2199 #define SE_OWNER_DEFAULTED 0x0001
2200 #define SE_GROUP_DEFAULTED 0x0002
2201 #define SE_DACL_PRESENT 0x0004
2202 #define SE_DACL_DEFAULTED 0x0008
2203 #define SE_SACL_PRESENT 0x0010
2204 #define SE_SACL_DEFAULTED 0x0020
2205 #define SE_SELF_RELATIVE 0x8000
2207 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
2208 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
2210 /* The security descriptor structure */
2214 SECURITY_DESCRIPTOR_CONTROL Control
;
2219 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
2224 SECURITY_DESCRIPTOR_CONTROL Control
;
2229 } SECURITY_DESCRIPTOR
, *PSECURITY_DESCRIPTOR
;
2231 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2233 #include "poppack.h"
2235 #endif /* _SECURITY_DEFINED */
2237 #include "pshpack1.h"
2240 * SID_AND_ATTRIBUTES
2243 typedef struct _SID_AND_ATTRIBUTES
{
2246 } SID_AND_ATTRIBUTES
;
2248 /* security entities */
2249 #define SECURITY_NULL_RID (0x00000000L)
2250 #define SECURITY_WORLD_RID (0x00000000L)
2251 #define SECURITY_LOCAL_RID (0X00000000L)
2253 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2256 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2259 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2262 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2263 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2264 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2265 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2266 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2269 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2272 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2273 #define SECURITY_DIALUP_RID 0x00000001L
2274 #define SECURITY_NETWORK_RID 0x00000002L
2275 #define SECURITY_BATCH_RID 0x00000003L
2276 #define SECURITY_INTERACTIVE_RID 0x00000004L
2277 #define SECURITY_LOGON_IDS_RID 0x00000005L
2278 #define SECURITY_SERVICE_RID 0x00000006L
2279 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2280 #define SECURITY_PROXY_RID 0x00000008L
2281 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2282 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2283 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2284 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2285 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2286 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2287 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2288 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2290 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2291 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2292 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2294 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2295 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2296 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2298 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2300 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2306 typedef struct _TOKEN_USER
{
2307 SID_AND_ATTRIBUTES User
;
2314 typedef struct _TOKEN_GROUPS
{
2316 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
2320 * LUID_AND_ATTRIBUTES
2323 typedef union _LARGE_INTEGER
{
2329 } LARGE_INTEGER
, *LPLARGE_INTEGER
, *PLARGE_INTEGER
;
2331 typedef union _ULARGE_INTEGER
{
2337 } ULARGE_INTEGER
, *LPULARGE_INTEGER
, *PULARGE_INTEGER
;
2340 * Locally Unique Identifier
2343 typedef LARGE_INTEGER LUID
,*PLUID
;
2345 typedef struct _LUID_AND_ATTRIBUTES
{
2348 } LUID_AND_ATTRIBUTES
;
2354 typedef struct _PRIVILEGE_SET
{
2355 DWORD PrivilegeCount
;
2357 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
2358 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
2364 typedef struct _TOKEN_PRIVILEGES
{
2365 DWORD PrivilegeCount
;
2366 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
2367 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
2373 typedef struct _TOKEN_OWNER
{
2378 * TOKEN_PRIMARY_GROUP
2381 typedef struct _TOKEN_PRIMARY_GROUP
{
2383 } TOKEN_PRIMARY_GROUP
;
2387 * TOKEN_DEFAULT_DACL
2390 typedef struct _TOKEN_DEFAULT_DACL
{
2392 } TOKEN_DEFAULT_DACL
;
2398 typedef struct _TOKEN_SOURCE
{
2400 LUID SourceIdentifier
;
2407 typedef enum tagTOKEN_TYPE
{
2413 * SECURITY_IMPERSONATION_LEVEL
2416 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
2418 SecurityIdentification
,
2419 SecurityImpersonation
,
2421 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
2424 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
2425 * PSECURITY_CONTEXT_TRACKING_MODE
;
2427 * Quality of Service
2430 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
2432 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
2433 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
2435 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
2441 typedef struct _TOKEN_STATISTICS
{
2443 LUID AuthenticationId
;
2444 LARGE_INTEGER ExpirationTime
;
2445 TOKEN_TYPE TokenType
;
2446 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
2447 DWORD DynamicCharged
;
2448 DWORD DynamicAvailable
;
2450 DWORD PrivilegeCount
;
2458 #define ACL_REVISION 2
2460 #define ACL_REVISION1 1
2461 #define ACL_REVISION2 2
2463 /* ACEs, directly starting after an ACL */
2464 typedef struct _ACE_HEADER
{
2468 } ACE_HEADER
,*PACE_HEADER
;
2471 #define ACCESS_ALLOWED_ACE_TYPE 0
2472 #define ACCESS_DENIED_ACE_TYPE 1
2473 #define SYSTEM_AUDIT_ACE_TYPE 2
2474 #define SYSTEM_ALARM_ACE_TYPE 3
2476 /* inherit AceFlags */
2477 #define OBJECT_INHERIT_ACE 0x01
2478 #define CONTAINER_INHERIT_ACE 0x02
2479 #define NO_PROPAGATE_INHERIT_ACE 0x04
2480 #define INHERIT_ONLY_ACE 0x08
2481 #define VALID_INHERIT_FLAGS 0x0F
2483 /* AceFlags mask for what events we (should) audit */
2484 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
2485 #define FAILED_ACCESS_ACE_FLAG 0x80
2487 /* different ACEs depending on AceType
2488 * SidStart marks the begin of a SID
2489 * so the thing finally looks like this:
2494 typedef struct _ACCESS_ALLOWED_ACE
{
2498 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
2500 typedef struct _ACCESS_DENIED_ACE
{
2504 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
2506 typedef struct _SYSTEM_AUDIT_ACE
{
2510 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
2512 typedef struct _SYSTEM_ALARM_ACE
{
2516 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
2518 typedef enum tagSID_NAME_USE
{
2523 SidTypeWellKnownGroup
,
2524 SidTypeDeletedAccount
,
2527 } SID_NAME_USE
,*PSID_NAME_USE
;
2531 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
2533 #define DELETE 0x00010000
2534 #define READ_CONTROL 0x00020000
2535 #define WRITE_DAC 0x00040000
2536 #define WRITE_OWNER 0x00080000
2537 #define SYNCHRONIZE 0x00100000
2538 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
2540 #define STANDARD_RIGHTS_READ READ_CONTROL
2541 #define STANDARD_RIGHTS_WRITE READ_CONTROL
2542 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
2544 #define STANDARD_RIGHTS_ALL 0x001f0000
2546 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
2548 #define GENERIC_READ 0x80000000
2549 #define GENERIC_WRITE 0x40000000
2550 #define GENERIC_EXECUTE 0x20000000
2551 #define GENERIC_ALL 0x10000000
2553 #define MAXIMUM_ALLOWED 0x02000000
2554 #define ACCESS_SYSTEM_SECURITY 0x01000000
2556 #define EVENT_MODIFY_STATE 0x0002
2557 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2559 #define SEMAPHORE_MODIFY_STATE 0x0002
2560 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2562 #define MUTEX_MODIFY_STATE 0x0001
2563 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
2565 #define PROCESS_TERMINATE 0x0001
2566 #define PROCESS_CREATE_THREAD 0x0002
2567 #define PROCESS_VM_OPERATION 0x0008
2568 #define PROCESS_VM_READ 0x0010
2569 #define PROCESS_VM_WRITE 0x0020
2570 #define PROCESS_DUP_HANDLE 0x0040
2571 #define PROCESS_CREATE_PROCESS 0x0080
2572 #define PROCESS_SET_QUOTA 0x0100
2573 #define PROCESS_SET_INFORMATION 0x0200
2574 #define PROCESS_QUERY_INFORMATION 0x0400
2575 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
2577 #define THREAD_TERMINATE 0x0001
2578 #define THREAD_SUSPEND_RESUME 0x0002
2579 #define THREAD_GET_CONTEXT 0x0008
2580 #define THREAD_SET_CONTEXT 0x0010
2581 #define THREAD_SET_INFORMATION 0x0020
2582 #define THREAD_QUERY_INFORMATION 0x0040
2583 #define THREAD_SET_THREAD_TOKEN 0x0080
2584 #define THREAD_IMPERSONATE 0x0100
2585 #define THREAD_DIRECT_IMPERSONATION 0x0200
2586 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
2588 #define THREAD_BASE_PRIORITY_LOWRT 15
2589 #define THREAD_BASE_PRIORITY_MAX 2
2590 #define THREAD_BASE_PRIORITY_MIN -2
2591 #define THREAD_BASE_PRIORITY_IDLE -15
2593 #define FILE_READ_DATA 0x0001 /* file & pipe */
2594 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
2595 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
2596 #define FILE_ADD_FILE 0x0002 /* directory */
2597 #define FILE_APPEND_DATA 0x0004 /* file */
2598 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
2599 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
2600 #define FILE_READ_EA 0x0008 /* file & directory */
2601 #define FILE_READ_PROPERTIES FILE_READ_EA
2602 #define FILE_WRITE_EA 0x0010 /* file & directory */
2603 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
2604 #define FILE_EXECUTE 0x0020 /* file */
2605 #define FILE_TRAVERSE 0x0020 /* directory */
2606 #define FILE_DELETE_CHILD 0x0040 /* directory */
2607 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
2608 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
2609 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
2611 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
2612 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
2614 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
2615 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
2616 FILE_APPEND_DATA | SYNCHRONIZE)
2617 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
2618 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
2621 /* File attribute flags */
2622 #define FILE_SHARE_READ 0x00000001L
2623 #define FILE_SHARE_WRITE 0x00000002L
2624 #define FILE_SHARE_DELETE 0x00000004L
2625 #define FILE_ATTRIBUTE_READONLY 0x00000001L
2626 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
2627 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
2628 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
2629 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
2630 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
2631 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
2632 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
2633 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
2634 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
2635 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
2636 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
2638 /* File notification flags */
2639 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
2640 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
2641 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
2642 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
2643 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
2644 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
2645 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
2646 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
2648 #define FILE_ACTION_ADDED 0x00000001
2649 #define FILE_ACTION_REMOVED 0x00000002
2650 #define FILE_ACTION_MODIFIED 0x00000003
2651 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
2652 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
2655 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
2656 #define FILE_CASE_PRESERVED_NAMES 0x00000002
2657 #define FILE_UNICODE_ON_DISK 0x00000004
2658 #define FILE_PERSISTENT_ACLS 0x00000008
2659 #define FILE_FILE_COMPRESSION 0x00000010
2660 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
2662 /* File alignments (NT) */
2663 #define FILE_BYTE_ALIGNMENT 0x00000000
2664 #define FILE_WORD_ALIGNMENT 0x00000001
2665 #define FILE_LONG_ALIGNMENT 0x00000003
2666 #define FILE_QUAD_ALIGNMENT 0x00000007
2667 #define FILE_OCTA_ALIGNMENT 0x0000000f
2668 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
2669 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
2670 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
2671 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
2672 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
2674 #define REG_NONE 0 /* no type */
2675 #define REG_SZ 1 /* string type (ASCII) */
2676 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
2677 #define REG_BINARY 3 /* binary format, callerspecific */
2678 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
2679 #define REG_DWORD 4 /* DWORD in little endian format */
2680 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
2681 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
2682 #define REG_LINK 6 /* symbolic link (UNICODE) */
2683 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
2684 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
2685 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
2686 #define REG_RESOURCE_REQUIREMENTS_LIST 10
2688 /* ----------------------------- begin registry ----------------------------- */
2690 /* Registry security values */
2691 #define OWNER_SECURITY_INFORMATION 0x00000001
2692 #define GROUP_SECURITY_INFORMATION 0x00000002
2693 #define DACL_SECURITY_INFORMATION 0x00000004
2694 #define SACL_SECURITY_INFORMATION 0x00000008
2696 #define REG_OPTION_RESERVED 0x00000000
2697 #define REG_OPTION_NON_VOLATILE 0x00000000
2698 #define REG_OPTION_VOLATILE 0x00000001
2699 #define REG_OPTION_CREATE_LINK 0x00000002
2700 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
2701 #define REG_OPTION_OPEN_LINK 0x00000008
2702 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
2703 REG_OPTION_NON_VOLATILE| \
2704 REG_OPTION_VOLATILE| \
2705 REG_OPTION_CREATE_LINK| \
2706 REG_OPTION_BACKUP_RESTORE| \
2707 REG_OPTION_OPEN_LINK)
2710 #define REG_CREATED_NEW_KEY 0x00000001
2711 #define REG_OPENED_EXISTING_KEY 0x00000002
2713 /* For RegNotifyChangeKeyValue */
2714 #define REG_NOTIFY_CHANGE_NAME 0x1
2716 #define KEY_QUERY_VALUE 0x00000001
2717 #define KEY_SET_VALUE 0x00000002
2718 #define KEY_CREATE_SUB_KEY 0x00000004
2719 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
2720 #define KEY_NOTIFY 0x00000010
2721 #define KEY_CREATE_LINK 0x00000020
2723 #define KEY_READ ((STANDARD_RIGHTS_READ| \
2725 KEY_ENUMERATE_SUB_KEYS| \
2729 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
2731 KEY_CREATE_SUB_KEY) \
2734 #define KEY_EXECUTE ((KEY_READ) \
2737 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
2740 KEY_CREATE_SUB_KEY| \
2741 KEY_ENUMERATE_SUB_KEYS| \
2746 /* ------------------------------ end registry ------------------------------ */
2749 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
2750 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
2751 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
2752 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
2753 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
2755 #include "poppack.h"
2757 #endif /* __WINE_WINNT_H */