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 #define ANYSIZE_ARRAY 1
64 #define MINSHORT 0x8000
65 #define MAXSHORT 0x7fff
66 #define MINLONG 0x80000000
67 #define MAXLONG 0x7fffffff
69 #define MAXWORD 0xffff
70 #define MAXDWORD 0xffffffff
72 #define FIELD_OFFSET(type, field) \
73 ((LONG)(INT)&(((type *)0)->field))
75 #define CONTAINING_RECORD(address, type, field) \
76 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
80 /* TCHAR data types definitions for Winelib. */
81 /* These types are _not_ defined for the emulator, because they */
82 /* depend on the UNICODE macro that only exists in user's code. */
86 typedef WCHAR TCHAR
, *PTCHAR
;
87 typedef LPWSTR PTSTR
, LPTSTR
;
88 typedef LPCWSTR PCTSTR
, LPCTSTR
;
89 #define __TEXT(string) L##string /*probably wrong */
91 typedef char TCHAR
, *PTCHAR
;
92 typedef LPSTR PTSTR
, LPTSTR
;
93 typedef LPCSTR PCTSTR
, LPCTSTR
;
94 #define __TEXT(string) string
97 #define TEXT(quote) __TEXT(quote)
100 typedef BOOLEAN
*PBOOLEAN
;
102 typedef struct _LIST_ENTRY
{
103 struct _LIST_ENTRY
*Flink
;
104 struct _LIST_ENTRY
*Blink
;
105 } LIST_ENTRY
, *PLIST_ENTRY
;
107 typedef struct _SINGLE_LIST_ENTRY
{
108 struct _SINGLE_LIST_ENTRY
*Next
;
109 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
113 #define HEAP_NO_SERIALIZE 0x00000001
114 #define HEAP_GROWABLE 0x00000002
115 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
116 #define HEAP_ZERO_MEMORY 0x00000008
117 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
118 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
119 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
120 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
121 #define HEAP_CREATE_ALIGN_16 0x00010000
122 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
123 #define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
124 #define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
125 #define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
126 #define HEAP_WINE_SHARED 0x08000000 /* Not a Win32 flag */
128 /* Processor feature flags. */
129 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
130 #define PF_FLOATING_POINT_EMULATED 1
131 #define PF_COMPARE_EXCHANGE_DOUBLE 2
132 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
133 #define PF_PPC_MOVEMEM_64BIT_OK 4
134 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
137 /* The Win32 register context */
139 /* CONTEXT is the CPU-dependent context; it should be used */
140 /* wherever a platform-specific context is needed (e.g. exception */
141 /* handling, Win32 register functions). */
143 /* CONTEXT86 is the i386-specific context; it should be used */
144 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
145 /* Win16 register functions), so that this code can be compiled */
146 /* on all platforms. */
148 #define SIZE_OF_80387_REGISTERS 80
150 typedef struct _FLOATING_SAVE_AREA
159 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
161 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
163 typedef struct _CONTEXT86
167 /* These are selected by CONTEXT_DEBUG_REGISTERS */
175 /* These are selected by CONTEXT_FLOATING_POINT */
176 FLOATING_SAVE_AREA FloatSave
;
178 /* These are selected by CONTEXT_SEGMENTS */
184 /* These are selected by CONTEXT_INTEGER */
192 /* These are selected by CONTEXT_CONTROL */
201 #define CONTEXT_X86 0x00010000
202 #define CONTEXT_i386 CONTEXT_X86
203 #define CONTEXT_i486 CONTEXT_X86
205 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
206 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
207 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
208 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
209 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
210 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
212 /* i386 context definitions */
215 #define CONTEXT_CONTROL CONTEXT86_CONTROL
216 #define CONTEXT_INTEGER CONTEXT86_INTEGER
217 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
218 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
219 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
220 #define CONTEXT_FULL CONTEXT86_FULL
222 typedef CONTEXT86 CONTEXT
;
224 #endif /* __i386__ */
226 /* Alpha context definitions */
229 #define CONTEXT_ALPHA 0x00020000
231 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
232 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
233 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
234 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
236 typedef struct _CONTEXT
238 /* selected by CONTEXT_FLOATING_POINT */
272 /* selected by CONTEXT_INTEGER */
306 /* selected by CONTEXT_FLOATING_POINT */
310 /* selected by CONTEXT_CONTROL */
317 #define _QUAD_PSR_OFFSET HighSoftFpcr
318 #define _QUAD_FLAGS_OFFSET HighFir
322 /* Mips context definitions */
325 #define CONTEXT_R4000 0x00010000
327 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
328 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
329 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
331 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
333 typedef struct _CONTEXT
336 /* These are selected by CONTEXT_FLOATING_POINT */
370 /* These are selected by CONTEXT_INTEGER */
406 /* These are selected by CONTEXT_FLOATING_POINT */
409 /* These are selected by CONTEXT_CONTROL */
419 /* PowerPC context definitions */
422 #define CONTEXT_CONTROL 0x0001
423 #define CONTEXT_FLOATING_POINT 0x0002
424 #define CONTEXT_INTEGER 0x0004
425 #define CONTEXT_DEBUG_REGISTERS 0x0008
426 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
430 /* These are selected by CONTEXT_FLOATING_POINT */
465 /* These are selected by CONTEXT_INTEGER */
502 /* These are selected by CONTEXT_CONTROL */
511 /* These are selected by CONTEXT_DEBUG_REGISTERS */
522 typedef struct _STACK_FRAME_HEADER
539 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
548 * There is no official CONTEXT structure defined for the SPARC
549 * architecture, so I just made one up.
551 * This structure is valid only for 32-bit SPARC architectures,
552 * not for 64-bit SPARC.
554 * Note that this structure contains only the 'top-level' registers;
555 * the rest of the register window chain is not visible.
557 * The layout follows the Solaris 'prgregset_t' structure.
561 #define CONTEXT_SPARC 0x10000000
563 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
564 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
565 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
567 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
569 typedef struct _CONTEXT
573 /* These are selected by CONTEXT_INTEGER */
607 /* These are selected by CONTEXT_CONTROL */
615 /* FIXME: floating point registers missing */
619 #endif /* __sparc__ */
621 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
622 #error You need to define a CONTEXT for your CPU
625 typedef CONTEXT
*PCONTEXT
;
626 typedef HANDLE
*PHANDLE
;
630 /* Macros for easier access to i386 context registers */
632 #define EAX_reg(context) ((context)->Eax)
633 #define EBX_reg(context) ((context)->Ebx)
634 #define ECX_reg(context) ((context)->Ecx)
635 #define EDX_reg(context) ((context)->Edx)
636 #define ESI_reg(context) ((context)->Esi)
637 #define EDI_reg(context) ((context)->Edi)
638 #define EBP_reg(context) ((context)->Ebp)
640 #define CS_reg(context) ((context)->SegCs)
641 #define DS_reg(context) ((context)->SegDs)
642 #define ES_reg(context) ((context)->SegEs)
643 #define FS_reg(context) ((context)->SegFs)
644 #define GS_reg(context) ((context)->SegGs)
645 #define SS_reg(context) ((context)->SegSs)
647 #define EFL_reg(context) ((context)->EFlags)
648 #define EIP_reg(context) ((context)->Eip)
649 #define ESP_reg(context) ((context)->Esp)
651 #define AX_reg(context) (*(WORD*)&EAX_reg(context))
652 #define BX_reg(context) (*(WORD*)&EBX_reg(context))
653 #define CX_reg(context) (*(WORD*)&ECX_reg(context))
654 #define DX_reg(context) (*(WORD*)&EDX_reg(context))
655 #define SI_reg(context) (*(WORD*)&ESI_reg(context))
656 #define DI_reg(context) (*(WORD*)&EDI_reg(context))
657 #define BP_reg(context) (*(WORD*)&EBP_reg(context))
659 #define AL_reg(context) (*(BYTE*)&EAX_reg(context))
660 #define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
661 #define BL_reg(context) (*(BYTE*)&EBX_reg(context))
662 #define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
663 #define CL_reg(context) (*(BYTE*)&ECX_reg(context))
664 #define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
665 #define DL_reg(context) (*(BYTE*)&EDX_reg(context))
666 #define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
668 #define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
669 #define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
670 #define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
671 #define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
673 #define ISV86(context) (EFL_reg(context) & 0x00020000)
674 #define V86BASE(context) ((context)->Dr7) /* ugly */
677 /* Macros to retrieve the current context */
681 #ifdef NEED_UNDERSCORE_PREFIX
682 # define __ASM_NAME(name) "_" name
684 # define __ASM_NAME(name) name
688 # define __ASM_GLOBAL_FUNC(name,code) \
689 __asm__( ".align 4\n\t" \
690 ".globl " __ASM_NAME(#name) "\n\t" \
691 ".type " __ASM_NAME(#name) ",@function\n" \
692 __ASM_NAME(#name) ":\n\t" \
695 # define __ASM_GLOBAL_FUNC(name,code) \
696 void __asm_dummy_##name(void) { \
697 asm( ".align 4\n\t" \
698 ".globl " __ASM_NAME(#name) "\n\t" \
699 ".type " __ASM_NAME(#name) ",@function\n" \
700 __ASM_NAME(#name) ":\n\t" \
703 #endif /* __GNUC__ */
705 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
706 __ASM_GLOBAL_FUNC( name, \
707 "call " __ASM_NAME("CALL32_Regs") "\n\t" \
708 ".long " __ASM_NAME(#fn) "\n\t" \
709 ".byte " #args ", " #args )
710 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
711 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
712 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
713 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
714 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
715 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
716 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
717 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
718 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
719 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
721 #endif /* __i386__ */
724 /* FIXME: use getcontext() to retrieve full context */
725 #define _GET_CONTEXT \
727 do { memset(&context, 0, sizeof(CONTEXT)); \
728 context.ContextFlags = CONTEXT_CONTROL; \
729 context.pc = (DWORD)__builtin_return_address(0); \
732 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
733 void WINAPI name ( void ) \
734 { _GET_CONTEXT; fn( &context ); }
735 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
736 void WINAPI name ( t1 a1 ) \
737 { _GET_CONTEXT; fn( a1, &context ); }
738 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
739 void WINAPI name ( t1 a1, t2 a2 ) \
740 { _GET_CONTEXT; fn( a1, a2, &context ); }
741 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
742 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
743 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
744 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
745 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
746 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
748 #endif /* __sparc__ */
750 #ifndef DEFINE_REGS_ENTRYPOINT_0
751 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
755 # define GET_IP(context) ((LPVOID)(context)->Eip)
758 # define GET_IP(context) ((LPVOID)(context)->pc)
761 #if !defined(GET_IP) && !defined(RC_INVOKED)
762 # error You must define GET_IP for this CPU
765 #endif /* __WINE__ */
771 #define STATUS_SUCCESS 0x00000000
772 #define STATUS_WAIT_0 0x00000000
773 #define STATUS_ABANDONED_WAIT_0 0x00000080
774 #define STATUS_USER_APC 0x000000C0
775 #define STATUS_TIMEOUT 0x00000102
776 #define STATUS_PENDING 0x00000103
778 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
779 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
780 #define STATUS_BREAKPOINT 0x80000003
781 #define STATUS_SINGLE_STEP 0x80000004
782 #define STATUS_BUFFER_OVERFLOW 0x80000005
783 #define STATUS_NO_MORE_FILES 0x80000006
784 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
786 #define STATUS_HANDLES_CLOSED 0x8000000A
787 #define STATUS_NO_INHERITANCE 0x8000000B
788 #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
789 #define STATUS_PARTIAL_COPY 0x8000000D
790 #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
791 #define STATUS_DEVICE_POWERED_OFF 0x8000000F
792 #define STATUS_DEVICE_OFF_LINE 0x80000010
793 #define STATUS_DEVICE_BUSY 0x80000011
794 #define STATUS_NO_MORE_EAS 0x80000012
795 #define STATUS_INVALID_EA_NAME 0x80000013
796 #define STATUS_EA_LIST_INCONSISTENT 0x80000014
797 #define STATUS_INVALID_EA_FLAG 0x80000015
798 #define STATUS_VERIFY_REQUIRED 0x80000016
799 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017
800 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
801 #define STATUS_NO_MORE_ENTRIES 0x8000001A
802 #define STATUS_FILEMARK_DETECTED 0x8000001B
803 #define STATUS_MEDIA_CHANGED 0x8000001C
804 #define STATUS_BUS_RESET 0x8000001D
805 #define STATUS_END_OF_MEDIA 0x8000001E
806 #define STATUS_BEGINNING_OF_MEDIA 0x8000001F
807 #define STATUS_MEDIA_CHECK 0x80000020
808 #define STATUS_SETMARK_DETECTED 0x80000021
809 #define STATUS_NO_DATA_DETECTED 0x80000022
810 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
811 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
812 #define STATUS_ALREADY_DISCONNECTED 0x80000025
813 #define STATUS_LONGJUMP 0x80000026
815 #define STATUS_UNSUCCESSFUL 0xC0000001
816 #define STATUS_NOT_IMPLEMENTED 0xC0000002
817 #define STATUS_INVALID_INFO_CLASS 0xC0000003
818 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
819 #define STATUS_ACCESS_VIOLATION 0xC0000005
820 #define STATUS_IN_PAGE_ERROR 0xC0000006
821 #define STATUS_PAGEFILE_QUOTA 0xC0000007
822 #define STATUS_INVALID_HANDLE 0xC0000008
823 #define STATUS_BAD_INITIAL_STACK 0xC0000009
824 #define STATUS_BAD_INITIAL_PC 0xC000000A
825 #define STATUS_INVALID_CID 0xC000000B
826 #define STATUS_TIMER_NOT_CANCELED 0xC000000C
827 #define STATUS_INVALID_PARAMETER 0xC000000D
828 #define STATUS_NO_SUCH_DEVICE 0xC000000E
829 #define STATUS_NO_SUCH_FILE 0xC000000F
830 #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
831 #define STATUS_END_OF_FILE 0xC0000011
832 #define STATUS_WRONG_VOLUME 0xC0000012
833 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
834 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
835 #define STATUS_NONEXISTENT_SECTOR 0xC0000015
836 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
837 #define STATUS_NO_MEMORY 0xC0000017
838 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018
839 #define STATUS_NOT_MAPPED_VIEW 0xC0000019
840 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A
841 #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
842 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
843 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
844 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
845 #define STATUS_INVALID_VIEW_SIZE 0xC000001F
846 #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
847 #define STATUS_ALREADY_COMMITTED 0xC0000021
848 #define STATUS_ACCESS_DENIED 0xC0000022
849 #define STATUS_BUFFER_TOO_SMALL 0xC0000023
850 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
851 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
852 #define STATUS_INVALID_DISPOSITION 0xC0000026
853 #define STATUS_UNWIND 0xC0000027
854 #define STATUS_BAD_STACK 0xC0000028
855 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029
856 #define STATUS_NOT_LOCKED 0xC000002A
857 #define STATUS_PARITY_ERROR 0xC000002B
858 #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
859 #define STATUS_NOT_COMMITTED 0xC000002D
860 #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
861 #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
862 #define STATUS_INVALID_PARAMETER_MIX 0xC0000030
863 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031
864 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032
865 #define STATUS_OBJECT_NAME_INVALID 0xC0000033
866 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
867 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035
868 #define STATUS_PORT_DISCONNECTED 0xC0000037
869 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
870 #define STATUS_OBJECT_PATH_INVALID 0xC0000039
871 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
872 #define STATUS_PATH_SYNTAX_BAD 0xC000003B
873 #define STATUS_DATA_OVERRUN 0xC000003C
874 #define STATUS_DATA_LATE_ERROR 0xC000003D
875 #define STATUS_DATA_ERROR 0xC000003E
876 #define STATUS_CRC_ERROR 0xC000003F
877 #define STATUS_SECTION_TOO_BIG 0xC0000040
878 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
879 #define STATUS_INVALID_PORT_HANDLE 0xC0000042
880 #define STATUS_SHARING_VIOLATION 0xC0000043
881 #define STATUS_QUOTA_EXCEEDED 0xC0000044
882 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
883 #define STATUS_MUTANT_NOT_OWNED 0xC0000046
884 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
885 #define STATUS_PORT_ALREADY_SET 0xC0000048
886 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
887 #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
888 #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
889 #define STATUS_UNKNOWN_REVISION 0xC0000058
890 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079
891 #define STATUS_DISK_FULL 0xC000007F
892 #define STATUS_SECTION_NOT_EXTENDED 0xC0000087
893 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
894 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
895 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
896 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
897 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
898 #define STATUS_FLOAT_OVERFLOW 0xC0000091
899 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
900 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
901 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
902 #define STATUS_INTEGER_OVERFLOW 0xC0000095
903 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
904 #define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
905 #define STATUS_INVALID_PARAMETER_2 0xC00000F0
906 #define STATUS_STACK_OVERFLOW 0xC00000FD
907 #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
908 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
909 #define STATUS_CONTROL_C_EXIT 0xC000013A
910 #define STATUS_PIPE_BROKEN 0xC000014B
911 #define STATUS_NOT_REGISTRY_FILE 0xC000015C
912 #define STATUS_PARTITION_FAILURE 0xC0000172
913 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
914 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
915 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
916 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
917 #define STATUS_EOM_OVERFLOW 0xC0000177
918 #define STATUS_NO_MEDIA 0xC0000178
919 #define STATUS_NO_SUCH_MEMBER 0xC000017A
920 #define STATUS_INVALID_MEMBER 0xC000017B
921 #define STATUS_KEY_DELETED 0xC000017C
922 #define STATUS_NO_LOG_SPACE 0xC000017D
923 #define STATUS_TOO_MANY_SIDS 0xC000017E
924 #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
925 #define STATUS_KEY_HAS_CHILDREN 0xC0000180
926 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
927 #define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
928 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
929 #define STATUS_INVALID_DEVICE_STATE 0xC0000184
930 #define STATUS_IO_DEVICE_ERROR 0xC0000185
931 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
932 #define STATUS_BACKUP_CONTROLLER 0xC0000187
933 #define STATUS_LOG_FILE_FULL 0xC0000188
934 #define STATUS_TOO_LATE 0xC0000189
935 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
936 #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
937 #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
938 #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
939 #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
940 #define STATUS_EVENTLOG_CANT_START 0xC000018F
941 #define STATUS_TRUST_FAILURE 0xC0000190
942 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
943 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192
944 #define STATUS_ACCOUNT_EXPIRED 0xC0000193
945 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194
946 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
947 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
948 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
949 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
950 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
951 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
952 #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
953 #define STATUS_FS_DRIVER_REQUIRED 0xC000019C
955 #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
957 #define MAXIMUM_WAIT_OBJECTS 64
958 #define MAXIMUM_SUSPEND_COUNT 127
962 * Return values from the actual exception handlers
965 #define ExceptionContinueExecution 0
966 #define ExceptionContinueSearch 1
967 #define ExceptionNestedException 2
968 #define ExceptionCollidedUnwind 3
971 * Return values from filters in except() and from UnhandledExceptionFilter
974 #define EXCEPTION_EXECUTE_HANDLER 1
975 #define EXCEPTION_CONTINUE_SEARCH 0
976 #define EXCEPTION_CONTINUE_EXECUTION -1
979 * From OS/2 2.0 exception handling
980 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
983 #define EH_NONCONTINUABLE 0x01
984 #define EH_UNWINDING 0x02
985 #define EH_EXIT_UNWIND 0x04
986 #define EH_STACK_INVALID 0x08
987 #define EH_NESTED_CALL 0x10
989 #define EXCEPTION_CONTINUABLE 0
990 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
993 * The exception record used by Win32 to give additional information
994 * about exception to exception handlers.
997 #define EXCEPTION_MAXIMUM_PARAMETERS 15
999 typedef struct __EXCEPTION_RECORD
1001 DWORD ExceptionCode
;
1002 DWORD ExceptionFlags
;
1003 struct __EXCEPTION_RECORD
*ExceptionRecord
;
1005 LPVOID ExceptionAddress
;
1006 DWORD NumberParameters
;
1007 DWORD ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
1008 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
1011 * The exception pointers structure passed to exception filters
1012 * in except() and the UnhandledExceptionFilter().
1015 typedef struct _EXCEPTION_POINTERS
1017 PEXCEPTION_RECORD ExceptionRecord
;
1018 PCONTEXT ContextRecord
;
1019 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
1023 * The exception frame, used for registering exception handlers
1024 * Win32 cares only about this, but compilers generally emit
1025 * larger exception frames for their own use.
1028 struct __EXCEPTION_FRAME
;
1030 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct __EXCEPTION_FRAME
*,
1031 PCONTEXT
,struct __EXCEPTION_FRAME
**);
1033 typedef struct __EXCEPTION_FRAME
1035 struct __EXCEPTION_FRAME
*Prev
;
1036 PEXCEPTION_HANDLER Handler
;
1037 } EXCEPTION_FRAME
, *PEXCEPTION_FRAME
;
1039 #include "poppack.h"
1042 * function pointer to a exception filter
1045 typedef LONG (CALLBACK
*PTOP_LEVEL_EXCEPTION_FILTER
)(PEXCEPTION_POINTERS ExceptionInfo
);
1046 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
;
1048 DWORD WINAPI
UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers
);
1049 LPTOP_LEVEL_EXCEPTION_FILTER
1050 WINAPI
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter
);
1052 /* status values for ContinueDebugEvent */
1053 #define DBG_CONTINUE 0x00010002
1054 #define DBG_TERMINATE_THREAD 0x40010003
1055 #define DBG_TERMINATE_PROCESS 0x40010004
1056 #define DBG_CONTROL_C 0x40010005
1057 #define DBG_CONTROL_BREAK 0x40010008
1058 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1060 typedef struct _NT_TIB
1062 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
1070 PVOID ArbitraryUserPointer
;
1071 struct _NT_TIB
*Self
;
1076 #if defined(__i386__) && defined(__GNUC__)
1077 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
1078 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1081 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
1085 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
1090 * File formats definitions
1093 typedef struct _IMAGE_DOS_HEADER
{
1094 WORD e_magic
; /* 00: MZ Header signature */
1095 WORD e_cblp
; /* 02: Bytes on last page of file */
1096 WORD e_cp
; /* 04: Pages in file */
1097 WORD e_crlc
; /* 06: Relocations */
1098 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
1099 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
1100 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
1101 WORD e_ss
; /* 0e: Initial (relative) SS value */
1102 WORD e_sp
; /* 10: Initial SP value */
1103 WORD e_csum
; /* 12: Checksum */
1104 WORD e_ip
; /* 14: Initial IP value */
1105 WORD e_cs
; /* 16: Initial (relative) CS value */
1106 WORD e_lfarlc
; /* 18: File address of relocation table */
1107 WORD e_ovno
; /* 1a: Overlay number */
1108 WORD e_res
[4]; /* 1c: Reserved words */
1109 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
1110 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
1111 WORD e_res2
[10]; /* 28: Reserved words */
1112 DWORD e_lfanew
; /* 3c: Offset to extended header */
1113 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
1115 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1116 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1117 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1118 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1119 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1120 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1123 * This is the Windows executable (NE) header.
1124 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1128 WORD ne_magic
; /* 00 NE signature 'NE' */
1129 BYTE ne_ver
; /* 02 Linker version number */
1130 BYTE ne_rev
; /* 03 Linker revision number */
1131 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
1132 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
1133 LONG ne_crc
; /* 08 Checksum */
1134 WORD ne_flags
; /* 0c Flags about segments in this file */
1135 WORD ne_autodata
; /* 0e Automatic data segment number */
1136 WORD ne_heap
; /* 10 Initial size of local heap */
1137 WORD ne_stack
; /* 12 Initial size of stack */
1138 DWORD ne_csip
; /* 14 Initial CS:IP */
1139 DWORD ne_sssp
; /* 18 Initial SS:SP */
1140 WORD ne_cseg
; /* 1c # of entries in segment table */
1141 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
1142 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
1143 WORD ne_segtab
; /* 22 Offset to segment table */
1144 WORD ne_rsrctab
; /* 24 Offset to resource table */
1145 WORD ne_restab
; /* 26 Offset to resident-name table */
1146 WORD ne_modtab
; /* 28 Offset to module reference table */
1147 WORD ne_imptab
; /* 2a Offset to imported name table */
1148 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
1149 WORD ne_cmovent
; /* 30 # of movable entry points */
1150 WORD ne_align
; /* 32 Logical sector alignment shift count */
1151 WORD ne_cres
; /* 34 # of resource segments */
1152 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
1153 BYTE ne_flagsothers
; /* 37 Additional information flags */
1154 WORD fastload_offset
; /* 38 Offset to fast load area (should be ne_pretthunks)*/
1155 WORD fastload_length
; /* 3a Length of fast load area (should be ne_psegrefbytes) */
1156 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
1157 WORD ne_expver
; /* 3e Expected Windows version number */
1158 } IMAGE_OS2_HEADER
,*PIMAGE_OS2_HEADER
;
1160 typedef struct _IMAGE_VXD_HEADER
{
1175 DWORD e32_lastpagesize
;
1176 DWORD e32_fixupsize
;
1193 DWORD e32_impmodcnt
;
1199 DWORD e32_cbnrestab
;
1202 DWORD e32_debuginfo
;
1204 DWORD e32_instpreload
;
1205 DWORD e32_instdemand
;
1208 DWORD e32_winresoff
;
1209 DWORD e32_winreslen
;
1212 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
1215 /* These defines describe the meanings of the bits in the Characteristics
1218 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1219 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1220 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1221 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1222 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1223 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1224 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1225 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1226 #define IMAGE_FILE_SYSTEM 0x1000
1227 #define IMAGE_FILE_DLL 0x2000
1228 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1230 /* These are the settings of the Machine field. */
1231 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1232 #define IMAGE_FILE_MACHINE_I860 0x14d
1233 #define IMAGE_FILE_MACHINE_I386 0x14c
1234 #define IMAGE_FILE_MACHINE_R3000 0x162
1235 #define IMAGE_FILE_MACHINE_R4000 0x166
1236 #define IMAGE_FILE_MACHINE_R10000 0x168
1237 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1238 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
1240 #define IMAGE_SIZEOF_FILE_HEADER 20
1242 /* Possible Magic values */
1243 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1244 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1246 /* These are indexes into the DataDirectory array */
1247 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1248 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1249 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1250 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1251 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1252 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1253 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1254 #define IMAGE_FILE_DESCRIPTION_STRING 7
1255 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1256 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1257 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1259 /* Directory Entries, indices into the DataDirectory array */
1261 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1262 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1263 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1264 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1265 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1266 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1267 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1268 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1269 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1270 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1271 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1272 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1273 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1274 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1275 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1277 /* Subsystem Values */
1279 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1280 #define IMAGE_SUBSYSTEM_NATIVE 1
1281 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1282 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
1283 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1284 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1286 typedef struct _IMAGE_FILE_HEADER
{
1288 WORD NumberOfSections
;
1289 DWORD TimeDateStamp
;
1290 DWORD PointerToSymbolTable
;
1291 DWORD NumberOfSymbols
;
1292 WORD SizeOfOptionalHeader
;
1293 WORD Characteristics
;
1294 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
1296 typedef struct _IMAGE_DATA_DIRECTORY
{
1297 DWORD VirtualAddress
;
1299 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
1301 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1303 typedef struct _IMAGE_OPTIONAL_HEADER
{
1305 /* Standard fields */
1308 BYTE MajorLinkerVersion
;
1309 BYTE MinorLinkerVersion
;
1311 DWORD SizeOfInitializedData
;
1312 DWORD SizeOfUninitializedData
;
1313 DWORD AddressOfEntryPoint
;
1317 /* NT additional fields */
1320 DWORD SectionAlignment
;
1321 DWORD FileAlignment
;
1322 WORD MajorOperatingSystemVersion
;
1323 WORD MinorOperatingSystemVersion
;
1324 WORD MajorImageVersion
;
1325 WORD MinorImageVersion
;
1326 WORD MajorSubsystemVersion
;
1327 WORD MinorSubsystemVersion
;
1328 DWORD Win32VersionValue
;
1330 DWORD SizeOfHeaders
;
1333 WORD DllCharacteristics
;
1334 DWORD SizeOfStackReserve
;
1335 DWORD SizeOfStackCommit
;
1336 DWORD SizeOfHeapReserve
;
1337 DWORD SizeOfHeapCommit
;
1339 DWORD NumberOfRvaAndSizes
;
1340 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
];
1341 } IMAGE_OPTIONAL_HEADER
, *PIMAGE_OPTIONAL_HEADER
;
1343 typedef struct _IMAGE_NT_HEADERS
{
1345 IMAGE_FILE_HEADER FileHeader
;
1346 IMAGE_OPTIONAL_HEADER OptionalHeader
;
1347 } IMAGE_NT_HEADERS
, *PIMAGE_NT_HEADERS
;
1349 #define IMAGE_SIZEOF_SHORT_NAME 8
1351 typedef struct _IMAGE_SECTION_HEADER
{
1352 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
1354 DWORD PhysicalAddress
;
1357 DWORD VirtualAddress
;
1358 DWORD SizeOfRawData
;
1359 DWORD PointerToRawData
;
1360 DWORD PointerToRelocations
;
1361 DWORD PointerToLinenumbers
;
1362 WORD NumberOfRelocations
;
1363 WORD NumberOfLinenumbers
;
1364 DWORD Characteristics
;
1365 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
1367 #define IMAGE_SIZEOF_SECTION_HEADER 40
1369 #define IMAGE_FIRST_SECTION(ntheader) \
1370 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1371 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1373 /* These defines are for the Characteristics bitfield. */
1374 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1375 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1376 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1377 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1378 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
1379 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1381 #define IMAGE_SCN_CNT_CODE 0x00000020
1382 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1383 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1385 #define IMAGE_SCN_LNK_OTHER 0x00000100
1386 #define IMAGE_SCN_LNK_INFO 0x00000200
1387 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1388 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1389 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1391 /* 0x00002000 - Reserved */
1392 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1393 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1395 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1396 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1397 #define IMAGE_SCN_MEM_16BIT 0x00020000
1398 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1399 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1401 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1402 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1403 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1404 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1405 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1406 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1407 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1408 /* 0x00800000 - Unused */
1410 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1413 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1414 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1415 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1416 #define IMAGE_SCN_MEM_SHARED 0x10000000
1417 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1418 #define IMAGE_SCN_MEM_READ 0x40000000
1419 #define IMAGE_SCN_MEM_WRITE 0x80000000
1421 #include "pshpack2.h"
1423 typedef struct _IMAGE_SYMBOL
{
1433 SHORT SectionNumber
;
1436 BYTE NumberOfAuxSymbols
;
1438 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
1440 #define IMAGE_SIZEOF_SYMBOL 18
1442 typedef struct _IMAGE_LINENUMBER
{
1444 DWORD SymbolTableIndex
;
1445 DWORD VirtualAddress
;
1449 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
1451 #define IMAGE_SIZEOF_LINENUMBER 6
1453 typedef union _IMAGE_AUX_SYMBOL
{
1465 DWORD PointerToLinenumber
;
1466 DWORD PointerToNextFunction
;
1475 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
1479 WORD NumberOfRelocations
;
1480 WORD NumberOfLinenumbers
;
1486 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
1488 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1490 #include "poppack.h"
1492 #define IMAGE_SYM_UNDEFINED (SHORT)0
1493 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
1494 #define IMAGE_SYM_DEBUG (SHORT)-2
1496 #define IMAGE_SYM_TYPE_NULL 0x0000
1497 #define IMAGE_SYM_TYPE_VOID 0x0001
1498 #define IMAGE_SYM_TYPE_CHAR 0x0002
1499 #define IMAGE_SYM_TYPE_SHORT 0x0003
1500 #define IMAGE_SYM_TYPE_INT 0x0004
1501 #define IMAGE_SYM_TYPE_LONG 0x0005
1502 #define IMAGE_SYM_TYPE_FLOAT 0x0006
1503 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
1504 #define IMAGE_SYM_TYPE_STRUCT 0x0008
1505 #define IMAGE_SYM_TYPE_UNION 0x0009
1506 #define IMAGE_SYM_TYPE_ENUM 0x000A
1507 #define IMAGE_SYM_TYPE_MOE 0x000B
1508 #define IMAGE_SYM_TYPE_BYTE 0x000C
1509 #define IMAGE_SYM_TYPE_WORD 0x000D
1510 #define IMAGE_SYM_TYPE_UINT 0x000E
1511 #define IMAGE_SYM_TYPE_DWORD 0x000F
1512 #define IMAGE_SYM_TYPE_PCODE 0x8000
1514 #define IMAGE_SYM_DTYPE_NULL 0
1515 #define IMAGE_SYM_DTYPE_POINTER 1
1516 #define IMAGE_SYM_DTYPE_FUNCTION 2
1517 #define IMAGE_SYM_DTYPE_ARRAY 3
1519 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
1520 #define IMAGE_SYM_CLASS_NULL 0x0000
1521 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
1522 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
1523 #define IMAGE_SYM_CLASS_STATIC 0x0003
1524 #define IMAGE_SYM_CLASS_REGISTER 0x0004
1525 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
1526 #define IMAGE_SYM_CLASS_LABEL 0x0006
1527 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
1528 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
1529 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
1530 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
1531 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
1532 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
1533 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
1534 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
1535 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
1536 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
1537 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
1538 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
1540 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
1541 #define IMAGE_SYM_CLASS_BLOCK 0x0064
1542 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
1543 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
1544 #define IMAGE_SYM_CLASS_FILE 0x0067
1545 #define IMAGE_SYM_CLASS_SECTION 0x0068
1546 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
1548 #define N_BTMASK 0x000F
1549 #define N_TMASK 0x0030
1550 #define N_TMASK1 0x00C0
1551 #define N_TMASK2 0x00F0
1555 #define BTYPE(x) ((x) & N_BTMASK)
1558 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
1562 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
1566 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
1570 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
1574 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1577 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1580 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1581 #define IMAGE_COMDAT_SELECT_ANY 2
1582 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1583 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1584 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1585 #define IMAGE_COMDAT_SELECT_LARGEST 6
1586 #define IMAGE_COMDAT_SELECT_NEWEST 7
1588 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1589 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1590 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1592 /* Export module directory */
1594 typedef struct _IMAGE_EXPORT_DIRECTORY
{
1595 DWORD Characteristics
;
1596 DWORD TimeDateStamp
;
1601 DWORD NumberOfFunctions
;
1602 DWORD NumberOfNames
;
1603 LPDWORD
*AddressOfFunctions
;
1604 LPDWORD
*AddressOfNames
;
1605 LPWORD
*AddressOfNameOrdinals
;
1606 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
1608 /* Import name entry */
1609 typedef struct _IMAGE_IMPORT_BY_NAME
{
1612 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
1615 typedef struct _IMAGE_THUNK_DATA
{
1617 LPBYTE ForwarderString
;
1620 PIMAGE_IMPORT_BY_NAME AddressOfData
;
1622 } IMAGE_THUNK_DATA
,*PIMAGE_THUNK_DATA
;
1624 /* Import module directory */
1626 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
1628 DWORD Characteristics
; /* 0 for terminating null import descriptor */
1629 PIMAGE_THUNK_DATA OriginalFirstThunk
; /* RVA to original unbound IAT */
1631 DWORD TimeDateStamp
; /* 0 if not bound,
1632 * -1 if bound, and real date\time stamp
1633 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
1635 * otherwise date/time stamp of DLL bound to
1638 DWORD ForwarderChain
; /* -1 if no forwarders */
1640 /* RVA to IAT (if bound this IAT has actual addresses) */
1641 PIMAGE_THUNK_DATA FirstThunk
;
1642 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
1644 #define IMAGE_ORDINAL_FLAG 0x80000000
1645 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
1646 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
1648 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
1650 DWORD TimeDateStamp
;
1651 WORD OffsetModuleName
;
1652 WORD NumberOfModuleForwarderRefs
;
1653 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
1654 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
1656 typedef struct _IMAGE_BOUND_FORWARDER_REF
1658 DWORD TimeDateStamp
;
1659 WORD OffsetModuleName
;
1661 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
1663 typedef struct _IMAGE_BASE_RELOCATION
1665 DWORD VirtualAddress
;
1668 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
1670 typedef struct _IMAGE_RELOCATION
1673 DWORD VirtualAddress
;
1676 DWORD SymbolTableIndex
;
1679 typedef IMAGE_RELOCATION
*PIMAGE_RELOCATION
;
1681 #define IMAGE_SIZEOF_RELOCATION 10
1683 /* generic relocation types */
1684 #define IMAGE_REL_BASED_ABSOLUTE 0
1685 #define IMAGE_REL_BASED_HIGH 1
1686 #define IMAGE_REL_BASED_LOW 2
1687 #define IMAGE_REL_BASED_HIGHLOW 3
1688 #define IMAGE_REL_BASED_HIGHADJ 4
1689 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
1690 #define IMAGE_REL_BASED_SECTION 6
1691 #define IMAGE_REL_BASED_REL 7
1692 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
1693 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
1694 #define IMAGE_REL_BASED_DIR64 10
1695 #define IMAGE_REL_BASED_HIGH3ADJ 11
1697 /* I386 relocation types */
1698 #define IMAGE_REL_I386_ABSOLUTE 0
1699 #define IMAGE_REL_I386_DIR16 1
1700 #define IMAGE_REL_I386_REL16 2
1701 #define IMAGE_REL_I386_DIR32 6
1702 #define IMAGE_REL_I386_DIR32NB 7
1703 #define IMAGE_REL_I386_SEG12 9
1704 #define IMAGE_REL_I386_SECTION 10
1705 #define IMAGE_REL_I386_SECREL 11
1706 #define IMAGE_REL_I386_REL32 20
1708 /* MIPS relocation types */
1709 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
1710 #define IMAGE_REL_MIPS_REFHALF 0x0001
1711 #define IMAGE_REL_MIPS_REFWORD 0x0002
1712 #define IMAGE_REL_MIPS_JMPADDR 0x0003
1713 #define IMAGE_REL_MIPS_REFHI 0x0004
1714 #define IMAGE_REL_MIPS_REFLO 0x0005
1715 #define IMAGE_REL_MIPS_GPREL 0x0006
1716 #define IMAGE_REL_MIPS_LITERAL 0x0007
1717 #define IMAGE_REL_MIPS_SECTION 0x000A
1718 #define IMAGE_REL_MIPS_SECREL 0x000B
1719 #define IMAGE_REL_MIPS_SECRELLO 0x000C
1720 #define IMAGE_REL_MIPS_SECRELHI 0x000D
1721 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
1722 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
1723 #define IMAGE_REL_MIPS_PAIR 0x0025
1725 /* ALPHA relocation types */
1726 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
1727 #define IMAGE_REL_ALPHA_REFLONG 0x0001
1728 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
1729 #define IMAGE_REL_ALPHA_GPREL 0x0003
1730 #define IMAGE_REL_ALPHA_LITERAL 0x0004
1731 #define IMAGE_REL_ALPHA_LITUSE 0x0005
1732 #define IMAGE_REL_ALPHA_GPDISP 0x0006
1733 #define IMAGE_REL_ALPHA_BRADDR 0x0007
1734 #define IMAGE_REL_ALPHA_HINT 0x0008
1735 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
1736 #define IMAGE_REL_ALPHA_REFHI 0x000A
1737 #define IMAGE_REL_ALPHA_REFLO 0x000B
1738 #define IMAGE_REL_ALPHA_PAIR 0x000C
1739 #define IMAGE_REL_ALPHA_MATCH 0x000D
1740 #define IMAGE_REL_ALPHA_SECTION 0x000E
1741 #define IMAGE_REL_ALPHA_SECREL 0x000F
1742 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
1743 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
1744 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
1745 #define IMAGE_REL_ALPHA_REFQ3 0x0013
1746 #define IMAGE_REL_ALPHA_REFQ2 0x0014
1747 #define IMAGE_REL_ALPHA_REFQ1 0x0015
1748 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
1749 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
1751 /* PowerPC relocation types */
1752 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
1753 #define IMAGE_REL_PPC_ADDR64 0x0001
1754 #define IMAGE_REL_PPC_ADDR 0x0002
1755 #define IMAGE_REL_PPC_ADDR24 0x0003
1756 #define IMAGE_REL_PPC_ADDR16 0x0004
1757 #define IMAGE_REL_PPC_ADDR14 0x0005
1758 #define IMAGE_REL_PPC_REL24 0x0006
1759 #define IMAGE_REL_PPC_REL14 0x0007
1760 #define IMAGE_REL_PPC_TOCREL16 0x0008
1761 #define IMAGE_REL_PPC_TOCREL14 0x0009
1762 #define IMAGE_REL_PPC_ADDR32NB 0x000A
1763 #define IMAGE_REL_PPC_SECREL 0x000B
1764 #define IMAGE_REL_PPC_SECTION 0x000C
1765 #define IMAGE_REL_PPC_IFGLUE 0x000D
1766 #define IMAGE_REL_PPC_IMGLUE 0x000E
1767 #define IMAGE_REL_PPC_SECREL16 0x000F
1768 #define IMAGE_REL_PPC_REFHI 0x0010
1769 #define IMAGE_REL_PPC_REFLO 0x0011
1770 #define IMAGE_REL_PPC_PAIR 0x0012
1771 #define IMAGE_REL_PPC_SECRELLO 0x0013
1772 #define IMAGE_REL_PPC_SECRELHI 0x0014
1773 #define IMAGE_REL_PPC_GPREL 0x0015
1774 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
1776 #define IMAGE_REL_PPC_NEG 0x0100
1777 #define IMAGE_REL_PPC_BRTAKEN 0x0200
1778 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
1779 #define IMAGE_REL_PPC_TOCDEFN 0x0800
1781 /* SH3 ? relocation type */
1782 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
1783 #define IMAGE_REL_SH3_DIRECT16 0x0001
1784 #define IMAGE_REL_SH3_DIRECT 0x0002
1785 #define IMAGE_REL_SH3_DIRECT8 0x0003
1786 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
1787 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
1788 #define IMAGE_REL_SH3_DIRECT4 0x0006
1789 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
1790 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
1791 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
1792 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
1793 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
1794 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
1795 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
1796 #define IMAGE_REL_SH3_SECTION 0x000E
1797 #define IMAGE_REL_SH3_SECREL 0x000F
1798 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
1800 /* ARM (Archimedes?) relocation types */
1801 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
1802 #define IMAGE_REL_ARM_ADDR 0x0001
1803 #define IMAGE_REL_ARM_ADDR32NB 0x0002
1804 #define IMAGE_REL_ARM_BRANCH24 0x0003
1805 #define IMAGE_REL_ARM_BRANCH11 0x0004
1806 #define IMAGE_REL_ARM_SECTION 0x000E
1807 #define IMAGE_REL_ARM_SECREL 0x000F
1809 /* IA64 relocation types */
1810 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
1811 #define IMAGE_REL_IA64_IMM14 0x0001
1812 #define IMAGE_REL_IA64_IMM22 0x0002
1813 #define IMAGE_REL_IA64_IMM64 0x0003
1814 #define IMAGE_REL_IA64_DIR 0x0004
1815 #define IMAGE_REL_IA64_DIR64 0x0005
1816 #define IMAGE_REL_IA64_PCREL21B 0x0006
1817 #define IMAGE_REL_IA64_PCREL21M 0x0007
1818 #define IMAGE_REL_IA64_PCREL21F 0x0008
1819 #define IMAGE_REL_IA64_GPREL22 0x0009
1820 #define IMAGE_REL_IA64_LTOFF22 0x000A
1821 #define IMAGE_REL_IA64_SECTION 0x000B
1822 #define IMAGE_REL_IA64_SECREL22 0x000C
1823 #define IMAGE_REL_IA64_SECREL64I 0x000D
1824 #define IMAGE_REL_IA64_SECREL 0x000E
1825 #define IMAGE_REL_IA64_LTOFF64 0x000F
1826 #define IMAGE_REL_IA64_DIR32NB 0x0010
1827 #define IMAGE_REL_IA64_RESERVED_11 0x0011
1828 #define IMAGE_REL_IA64_RESERVED_12 0x0012
1829 #define IMAGE_REL_IA64_RESERVED_13 0x0013
1830 #define IMAGE_REL_IA64_RESERVED_14 0x0014
1831 #define IMAGE_REL_IA64_RESERVED_15 0x0015
1832 #define IMAGE_REL_IA64_RESERVED_16 0x0016
1833 #define IMAGE_REL_IA64_ADDEND 0x001F
1835 /* archive format */
1837 #define IMAGE_ARCHIVE_START_SIZE 8
1838 #define IMAGE_ARCHIVE_START "!<arch>\n"
1839 #define IMAGE_ARCHIVE_END "`\n"
1840 #define IMAGE_ARCHIVE_PAD "\n"
1841 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
1842 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
1844 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
1853 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
1855 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1858 * Resource directory stuff
1860 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
1861 DWORD Characteristics
;
1862 DWORD TimeDateStamp
;
1865 WORD NumberOfNamedEntries
;
1866 WORD NumberOfIdEntries
;
1867 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
1868 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
1870 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
1871 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
1873 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
1876 unsigned NameOffset
:31;
1877 unsigned NameIsString
:1;
1885 unsigned OffsetToDirectory
:31;
1886 unsigned DataIsDirectory
:1;
1889 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
1892 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
1894 CHAR NameString
[ 1 ];
1895 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
1897 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
1899 WCHAR NameString
[ 1 ];
1900 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
1902 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
1906 DWORD ResourceHandle
;
1907 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
1910 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
1911 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
1914 typedef struct _IMAGE_TLS_DIRECTORY
{
1915 DWORD StartAddressOfRawData
;
1916 DWORD EndAddressOfRawData
;
1917 LPDWORD AddressOfIndex
;
1918 PIMAGE_TLS_CALLBACK
*AddressOfCallBacks
;
1919 DWORD SizeOfZeroFill
;
1920 DWORD Characteristics
;
1921 } IMAGE_TLS_DIRECTORY
,*PIMAGE_TLS_DIRECTORY
;
1923 typedef struct _IMAGE_DEBUG_DIRECTORY
{
1924 DWORD Characteristics
;
1925 DWORD TimeDateStamp
;
1930 DWORD AddressOfRawData
;
1931 DWORD PointerToRawData
;
1932 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
1934 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
1935 #define IMAGE_DEBUG_TYPE_COFF 1
1936 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
1937 #define IMAGE_DEBUG_TYPE_FPO 3
1938 #define IMAGE_DEBUG_TYPE_MISC 4
1939 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
1940 #define IMAGE_DEBUG_TYPE_FIXUP 6
1941 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
1942 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
1943 #define IMAGE_DEBUG_TYPE_BORLAND 9
1944 #define IMAGE_DEBUG_TYPE_RESERVED10 10
1946 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
1947 DWORD NumberOfSymbols
;
1948 DWORD LvaToFirstSymbol
;
1949 DWORD NumberOfLinenumbers
;
1950 DWORD LvaToFirstLinenumber
;
1951 DWORD RvaToFirstByteOfCode
;
1952 DWORD RvaToLastByteOfCode
;
1953 DWORD RvaToFirstByteOfData
;
1954 DWORD RvaToLastByteOfData
;
1955 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
1958 #define FRAME_TRAP 1
1960 #define FRAME_NONFPO 3
1962 typedef struct _FPO_DATA
{
1967 unsigned cbProlog
: 8;
1968 unsigned cbRegs
: 3;
1969 unsigned fHasSEH
: 1;
1970 unsigned fUseBP
: 1;
1971 unsigned reserved
: 1;
1972 unsigned cbFrame
: 2;
1973 } FPO_DATA
, *PFPO_DATA
;
1975 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
1976 DWORD Characteristics
;
1977 DWORD TimeDateStamp
;
1980 DWORD GlobalFlagsClear
;
1981 DWORD GlobalFlagsSet
;
1982 DWORD CriticalSectionDefaultTimeout
;
1983 DWORD DeCommitFreeBlockThreshold
;
1984 DWORD DeCommitTotalFreeThreshold
;
1985 PVOID LockPrefixTable
;
1986 DWORD MaximumAllocationSize
;
1987 DWORD VirtualMemoryThreshold
;
1988 DWORD ProcessHeapFlags
;
1989 DWORD ProcessAffinityMask
;
1994 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
1996 typedef struct _IMAGE_FUNCTION_ENTRY
{
1997 DWORD StartingAddress
;
1998 DWORD EndingAddress
;
1999 DWORD EndOfPrologue
;
2000 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
2002 /* This is the structure that appears at the very start of a .DBG file. */
2004 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
2008 WORD Characteristics
;
2009 DWORD TimeDateStamp
;
2013 DWORD NumberOfSections
;
2014 DWORD ExportedNamesSize
;
2015 DWORD DebugDirectorySize
;
2016 DWORD SectionAlignment
;
2017 DWORD Reserved
[ 2 ];
2018 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
2020 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2023 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
2027 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
2028 #define MESSAGE_RESOURCE_UNICODE 0x0001
2030 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
2033 DWORD OffsetToEntries
;
2034 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
2036 typedef struct tagMESSAGE_RESOURCE_DATA
{
2037 DWORD NumberOfBlocks
;
2038 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
2039 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
2042 * Here follows typedefs for security and tokens.
2046 * First a constant for the following typdefs.
2049 #define ANYSIZE_ARRAY 1
2051 /* FIXME: Orphan. What does it point to? */
2052 typedef PVOID PACCESS_TOKEN
;
2055 * TOKEN_INFORMATION_CLASS
2058 typedef enum _TOKEN_INFORMATION_CLASS
{
2067 TokenImpersonationLevel
,
2069 } TOKEN_INFORMATION_CLASS
;
2071 #ifndef _SECURITY_DEFINED
2072 #define _SECURITY_DEFINED
2074 #include "pshpack1.h"
2076 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
2078 typedef struct _GENERIC_MAPPING
{
2079 ACCESS_MASK GenericRead
;
2080 ACCESS_MASK GenericWrite
;
2081 ACCESS_MASK GenericExecute
;
2082 ACCESS_MASK GenericAll
;
2083 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
2085 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2086 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2089 } SID_IDENTIFIER_AUTHORITY
,*PSID_IDENTIFIER_AUTHORITY
,*LPSID_IDENTIFIER_AUTHORITY
;
2090 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2094 typedef struct _SID
{
2096 BYTE SubAuthorityCount
;
2097 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
2098 DWORD SubAuthority
[1];
2100 #endif /* !defined(SID_DEFINED) */
2102 #define SID_REVISION (1) /* Current revision */
2103 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2104 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2111 #define ACL_REVISION1 1
2112 #define ACL_REVISION2 2
2113 #define ACL_REVISION3 3
2114 #define ACL_REVISION4 4
2116 #define MIN_ACL_REVISION ACL_REVISION2
2117 #define MAX_ACL_REVISION ACL_REVISION4
2119 typedef struct _ACL
{
2127 /* SECURITY_DESCRIPTOR */
2128 #define SECURITY_DESCRIPTOR_REVISION 1
2129 #define SECURITY_DESCRIPTOR_REVISION1 1
2132 #define SE_OWNER_DEFAULTED 0x0001
2133 #define SE_GROUP_DEFAULTED 0x0002
2134 #define SE_DACL_PRESENT 0x0004
2135 #define SE_DACL_DEFAULTED 0x0008
2136 #define SE_SACL_PRESENT 0x0010
2137 #define SE_SACL_DEFAULTED 0x0020
2138 #define SE_SELF_RELATIVE 0x8000
2140 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
2141 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
2143 /* The security descriptor structure */
2147 SECURITY_DESCRIPTOR_CONTROL Control
;
2152 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
2157 SECURITY_DESCRIPTOR_CONTROL Control
;
2162 } SECURITY_DESCRIPTOR
, *PSECURITY_DESCRIPTOR
;
2164 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2166 #include "poppack.h"
2168 #endif /* _SECURITY_DEFINED */
2170 #include "pshpack1.h"
2173 * SID_AND_ATTRIBUTES
2176 typedef struct _SID_AND_ATTRIBUTES
{
2179 } SID_AND_ATTRIBUTES
;
2181 /* security entities */
2182 #define SECURITY_NULL_RID (0x00000000L)
2183 #define SECURITY_WORLD_RID (0x00000000L)
2184 #define SECURITY_LOCAL_RID (0X00000000L)
2186 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2189 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2192 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2195 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2196 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2197 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2198 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2199 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2202 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2205 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2206 #define SECURITY_DIALUP_RID 0x00000001L
2207 #define SECURITY_NETWORK_RID 0x00000002L
2208 #define SECURITY_BATCH_RID 0x00000003L
2209 #define SECURITY_INTERACTIVE_RID 0x00000004L
2210 #define SECURITY_LOGON_IDS_RID 0x00000005L
2211 #define SECURITY_SERVICE_RID 0x00000006L
2212 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2213 #define SECURITY_PROXY_RID 0x00000008L
2214 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2215 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2216 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2217 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2218 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2219 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2220 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2221 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2223 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2224 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2225 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2227 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2228 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2229 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2231 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2233 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2239 typedef struct _TOKEN_USER
{
2240 SID_AND_ATTRIBUTES User
;
2247 typedef struct _TOKEN_GROUPS
{
2249 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
2253 * LUID_AND_ATTRIBUTES
2256 typedef union _LARGE_INTEGER
{
2262 } LARGE_INTEGER
, *LPLARGE_INTEGER
, *PLARGE_INTEGER
;
2264 typedef union _ULARGE_INTEGER
{
2270 } ULARGE_INTEGER
, *LPULARGE_INTEGER
, *PULARGE_INTEGER
;
2273 * Locally Unique Identifier
2276 typedef LARGE_INTEGER LUID
,*PLUID
;
2278 typedef struct _LUID_AND_ATTRIBUTES
{
2281 } LUID_AND_ATTRIBUTES
;
2287 typedef struct _PRIVILEGE_SET
{
2288 DWORD PrivilegeCount
;
2290 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
2291 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
2297 typedef struct _TOKEN_PRIVILEGES
{
2298 DWORD PrivilegeCount
;
2299 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
2300 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
2306 typedef struct _TOKEN_OWNER
{
2311 * TOKEN_PRIMARY_GROUP
2314 typedef struct _TOKEN_PRIMARY_GROUP
{
2316 } TOKEN_PRIMARY_GROUP
;
2320 * TOKEN_DEFAULT_DACL
2323 typedef struct _TOKEN_DEFAULT_DACL
{
2325 } TOKEN_DEFAULT_DACL
;
2331 typedef struct _TOKEN_SOURCE
{
2333 LUID SourceIdentifier
;
2340 typedef enum tagTOKEN_TYPE
{
2346 * SECURITY_IMPERSONATION_LEVEL
2349 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
2351 SecurityIdentification
,
2352 SecurityImpersonation
,
2354 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
2357 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
2358 * PSECURITY_CONTEXT_TRACKING_MODE
;
2360 * Quality of Service
2363 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
2365 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
2366 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
2368 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
2374 typedef struct _TOKEN_STATISTICS
{
2376 LUID AuthenticationId
;
2377 LARGE_INTEGER ExpirationTime
;
2378 TOKEN_TYPE TokenType
;
2379 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
2380 DWORD DynamicCharged
;
2381 DWORD DynamicAvailable
;
2383 DWORD PrivilegeCount
;
2391 #define ACL_REVISION 2
2393 #define ACL_REVISION1 1
2394 #define ACL_REVISION2 2
2396 /* ACEs, directly starting after an ACL */
2397 typedef struct _ACE_HEADER
{
2401 } ACE_HEADER
,*PACE_HEADER
;
2404 #define ACCESS_ALLOWED_ACE_TYPE 0
2405 #define ACCESS_DENIED_ACE_TYPE 1
2406 #define SYSTEM_AUDIT_ACE_TYPE 2
2407 #define SYSTEM_ALARM_ACE_TYPE 3
2409 /* inherit AceFlags */
2410 #define OBJECT_INHERIT_ACE 0x01
2411 #define CONTAINER_INHERIT_ACE 0x02
2412 #define NO_PROPAGATE_INHERIT_ACE 0x04
2413 #define INHERIT_ONLY_ACE 0x08
2414 #define VALID_INHERIT_FLAGS 0x0F
2416 /* AceFlags mask for what events we (should) audit */
2417 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
2418 #define FAILED_ACCESS_ACE_FLAG 0x80
2420 /* different ACEs depending on AceType
2421 * SidStart marks the begin of a SID
2422 * so the thing finally looks like this:
2427 typedef struct _ACCESS_ALLOWED_ACE
{
2431 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
2433 typedef struct _ACCESS_DENIED_ACE
{
2437 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
2439 typedef struct _SYSTEM_AUDIT_ACE
{
2443 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
2445 typedef struct _SYSTEM_ALARM_ACE
{
2449 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
2451 typedef enum tagSID_NAME_USE
{
2456 SidTypeWellKnownGroup
,
2457 SidTypeDeletedAccount
,
2460 } SID_NAME_USE
,*PSID_NAME_USE
;
2464 #define DELETE 0x00010000
2465 #define READ_CONTROL 0x00020000
2466 #define WRITE_DAC 0x00040000
2467 #define WRITE_OWNER 0x00080000
2468 #define SYNCHRONIZE 0x00100000
2469 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
2471 #define STANDARD_RIGHTS_READ READ_CONTROL
2472 #define STANDARD_RIGHTS_WRITE READ_CONTROL
2473 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
2475 #define STANDARD_RIGHTS_ALL 0x001f0000
2477 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
2479 #define GENERIC_READ 0x80000000
2480 #define GENERIC_WRITE 0x40000000
2481 #define GENERIC_EXECUTE 0x20000000
2482 #define GENERIC_ALL 0x10000000
2484 #define MAXIMUM_ALLOWED 0x02000000
2485 #define ACCESS_SYSTEM_SECURITY 0x01000000
2487 #define EVENT_MODIFY_STATE 0x0002
2488 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2490 #define SEMAPHORE_MODIFY_STATE 0x0002
2491 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2493 #define MUTEX_MODIFY_STATE 0x0001
2494 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
2496 #define PROCESS_TERMINATE 0x0001
2497 #define PROCESS_CREATE_THREAD 0x0002
2498 #define PROCESS_VM_OPERATION 0x0008
2499 #define PROCESS_VM_READ 0x0010
2500 #define PROCESS_VM_WRITE 0x0020
2501 #define PROCESS_DUP_HANDLE 0x0040
2502 #define PROCESS_CREATE_PROCESS 0x0080
2503 #define PROCESS_SET_QUOTA 0x0100
2504 #define PROCESS_SET_INFORMATION 0x0200
2505 #define PROCESS_QUERY_INFORMATION 0x0400
2506 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
2508 #define THREAD_TERMINATE 0x0001
2509 #define THREAD_SUSPEND_RESUME 0x0002
2510 #define THREAD_GET_CONTEXT 0x0008
2511 #define THREAD_SET_CONTEXT 0x0010
2512 #define THREAD_SET_INFORMATION 0x0020
2513 #define THREAD_QUERY_INFORMATION 0x0040
2514 #define THREAD_SET_THREAD_TOKEN 0x0080
2515 #define THREAD_IMPERSONATE 0x0100
2516 #define THREAD_DIRECT_IMPERSONATION 0x0200
2517 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
2519 #define THREAD_BASE_PRIORITY_LOWRT 15
2520 #define THREAD_BASE_PRIORITY_MAX 2
2521 #define THREAD_BASE_PRIORITY_MIN -2
2522 #define THREAD_BASE_PRIORITY_IDLE -15
2524 #define FILE_READ_DATA 0x0001 /* file & pipe */
2525 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
2526 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
2527 #define FILE_ADD_FILE 0x0002 /* directory */
2528 #define FILE_APPEND_DATA 0x0004 /* file */
2529 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
2530 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
2531 #define FILE_READ_EA 0x0008 /* file & directory */
2532 #define FILE_READ_PROPERTIES FILE_READ_EA
2533 #define FILE_WRITE_EA 0x0010 /* file & directory */
2534 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
2535 #define FILE_EXECUTE 0x0020 /* file */
2536 #define FILE_TRAVERSE 0x0020 /* directory */
2537 #define FILE_DELETE_CHILD 0x0040 /* directory */
2538 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
2539 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
2540 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
2542 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
2543 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
2545 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
2546 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
2547 FILE_APPEND_DATA | SYNCHRONIZE)
2548 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
2549 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
2552 /* File attribute flags
2554 #define FILE_SHARE_READ 0x00000001L
2555 #define FILE_SHARE_WRITE 0x00000002L
2556 #define FILE_SHARE_DELETE 0x00000004L
2557 #define FILE_ATTRIBUTE_READONLY 0x00000001L
2558 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
2559 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
2560 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
2561 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
2562 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
2563 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
2564 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
2565 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
2566 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
2567 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
2568 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
2570 /* File alignments (NT) */
2571 #define FILE_BYTE_ALIGNMENT 0x00000000
2572 #define FILE_WORD_ALIGNMENT 0x00000001
2573 #define FILE_LONG_ALIGNMENT 0x00000003
2574 #define FILE_QUAD_ALIGNMENT 0x00000007
2575 #define FILE_OCTA_ALIGNMENT 0x0000000f
2576 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
2577 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
2578 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
2579 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
2580 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
2582 #define REG_NONE 0 /* no type */
2583 #define REG_SZ 1 /* string type (ASCII) */
2584 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
2585 #define REG_BINARY 3 /* binary format, callerspecific */
2586 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
2587 #define REG_DWORD 4 /* DWORD in little endian format */
2588 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
2589 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
2590 #define REG_LINK 6 /* symbolic link (UNICODE) */
2591 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
2592 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
2593 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
2594 #define REG_RESOURCE_REQUIREMENTS_LIST 10
2596 /* ----------------------------- begin registry ----------------------------- */
2598 /* Registry security values */
2599 #define OWNER_SECURITY_INFORMATION 0x00000001
2600 #define GROUP_SECURITY_INFORMATION 0x00000002
2601 #define DACL_SECURITY_INFORMATION 0x00000004
2602 #define SACL_SECURITY_INFORMATION 0x00000008
2604 #define REG_OPTION_RESERVED 0x00000000
2605 #define REG_OPTION_NON_VOLATILE 0x00000000
2606 #define REG_OPTION_VOLATILE 0x00000001
2607 #define REG_OPTION_CREATE_LINK 0x00000002
2608 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
2609 #define REG_OPTION_OPEN_LINK 0x00000008
2610 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
2611 REG_OPTION_NON_VOLATILE| \
2612 REG_OPTION_VOLATILE| \
2613 REG_OPTION_CREATE_LINK| \
2614 REG_OPTION_BACKUP_RESTORE| \
2615 REG_OPTION_OPEN_LINK)
2618 #define REG_CREATED_NEW_KEY 0x00000001
2619 #define REG_OPENED_EXISTING_KEY 0x00000002
2621 /* For RegNotifyChangeKeyValue */
2622 #define REG_NOTIFY_CHANGE_NAME 0x1
2624 #define KEY_QUERY_VALUE 0x00000001
2625 #define KEY_SET_VALUE 0x00000002
2626 #define KEY_CREATE_SUB_KEY 0x00000004
2627 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
2628 #define KEY_NOTIFY 0x00000010
2629 #define KEY_CREATE_LINK 0x00000020
2631 #define KEY_READ ((STANDARD_RIGHTS_READ| \
2633 KEY_ENUMERATE_SUB_KEYS| \
2637 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
2639 KEY_CREATE_SUB_KEY) \
2642 #define KEY_EXECUTE ((KEY_READ) \
2645 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
2648 KEY_CREATE_SUB_KEY| \
2649 KEY_ENUMERATE_SUB_KEYS| \
2654 /* ------------------------------ end registry ------------------------------ */
2657 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
2658 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
2659 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
2660 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
2661 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
2663 #include "poppack.h"
2665 #endif /* __WINE_WINNT_H */