2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #define NTAPI __stdcall
34 #if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(MIDL_PASS)
35 # if defined(_MSC_VER)
36 # define DECLSPEC_IMPORT __declspec(dllimport)
37 # elif defined(__MINGW32__)
38 # define DECLSPEC_IMPORT __attribute__((dllimport))
40 # define DECLSPEC_IMPORT
43 # define DECLSPEC_IMPORT
46 #ifndef DECLSPEC_NORETURN
47 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
48 # define DECLSPEC_NORETURN __declspec(noreturn)
49 # elif defined(__GNUC__)
50 # define DECLSPEC_NORETURN __attribute__((noreturn))
52 # define DECLSPEC_NORETURN
56 #ifndef DECLSPEC_ALIGN
57 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
58 # define DECLSPEC_ALIGN(x) __declspec(align(x))
59 # elif defined(__GNUC__)
60 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
62 # define DECLSPEC_ALIGN(x)
66 #ifndef DECLSPEC_CACHEALIGN
67 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
71 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
72 # define DECLSPEC_UUID(x) __declspec(uuid(x))
74 # define DECLSPEC_UUID(x)
78 #ifndef DECLSPEC_NOVTABLE
79 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
80 # define DECLSPEC_NOVTABLE __declspec(novtable)
82 # define DECLSPEC_NOVTABLE
86 #ifndef DECLSPEC_SELECTANY
87 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
88 #define DECLSPEC_SELECTANY __declspec(selectany)
90 #define DECLSPEC_SELECTANY
95 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
96 # define NOP_FUNCTION __noop
98 # define NOP_FUNCTION (void)0
102 #ifndef DECLSPEC_ADDRSAFE
103 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
104 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
106 # define DECLSPEC_ADDRSAFE
111 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
112 # define FORCEINLINE __forceinline
113 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
114 # define FORCEINLINE __attribute__((always_inline))
116 # define FORCEINLINE inline
120 #ifndef DECLSPEC_DEPRECATED
121 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
122 # define DECLSPEC_DEPRECATED __declspec(deprecated)
123 # define DEPRECATE_SUPPORTED
124 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
125 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
126 # define DEPRECATE_SUPPORTED
128 # define DECLSPEC_DEPRECATED
129 # undef DEPRECATE_SUPPORTED
133 /* Anonymous union/struct handling */
135 #ifndef NONAMELESSSTRUCT
137 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
138 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
139 # define NONAMELESSSTRUCT
141 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
142 # define NONAMELESSSTRUCT
144 #endif /* NONAMELESSSTRUCT */
146 #ifndef NONAMELESSUNION
148 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
149 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
150 # define NONAMELESSUNION
152 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
153 # define NONAMELESSUNION
155 #endif /* NONAMELESSUNION */
157 #ifndef NONAMELESSSTRUCT
158 #define DUMMYSTRUCTNAME
159 #define DUMMYSTRUCTNAME1
160 #define DUMMYSTRUCTNAME2
161 #define DUMMYSTRUCTNAME3
162 #define DUMMYSTRUCTNAME4
163 #define DUMMYSTRUCTNAME5
164 #else /* !defined(NONAMELESSSTRUCT) */
165 #define DUMMYSTRUCTNAME s
166 #define DUMMYSTRUCTNAME1 s1
167 #define DUMMYSTRUCTNAME2 s2
168 #define DUMMYSTRUCTNAME3 s3
169 #define DUMMYSTRUCTNAME4 s4
170 #define DUMMYSTRUCTNAME5 s5
171 #endif /* !defined(NONAMELESSSTRUCT) */
173 #ifndef NONAMELESSUNION
174 #define DUMMYUNIONNAME
175 #define DUMMYUNIONNAME1
176 #define DUMMYUNIONNAME2
177 #define DUMMYUNIONNAME3
178 #define DUMMYUNIONNAME4
179 #define DUMMYUNIONNAME5
180 #define DUMMYUNIONNAME6
181 #define DUMMYUNIONNAME7
182 #define DUMMYUNIONNAME8
183 #else /* !defined(NONAMELESSUNION) */
184 #define DUMMYUNIONNAME u
185 #define DUMMYUNIONNAME1 u1
186 #define DUMMYUNIONNAME2 u2
187 #define DUMMYUNIONNAME3 u3
188 #define DUMMYUNIONNAME4 u4
189 #define DUMMYUNIONNAME5 u5
190 #define DUMMYUNIONNAME6 u6
191 #define DUMMYUNIONNAME7 u7
192 #define DUMMYUNIONNAME8 u8
193 #endif /* !defined(NONAMELESSUNION) */
195 /* C99 restrict support */
197 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
198 # if defined(_MSC_VER) && defined(_M_MRX000)
199 # define RESTRICTED_POINTER __restrict
200 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
201 # define RESTRICTED_POINTER __restrict
203 # define RESTRICTED_POINTER
206 # define RESTRICTED_POINTER
209 /* C99 unaligned support */
211 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
212 # define UNALIGNED __unaligned
214 # define UNALIGNED64 __unaligned
223 /* Alignment macros */
225 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
226 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
227 #define MEMORY_ALLOCATION_ALIGNMENT 16
229 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
230 #define MEMORY_ALLOCATION_ALIGNMENT 8
233 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
234 # define TYPE_ALIGNMENT(t) __alignof(t)
235 #elif defined(__GNUC__)
236 # define TYPE_ALIGNMENT(t) __alignof__(t)
238 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
242 # define PROBE_ALIGNMENT(_s) \
243 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
244 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
245 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
247 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
250 /* Compile time assertion */
252 #if defined(_MSC_VER)
253 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
254 #elif defined(__GNUC__)
255 # define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1]
258 /* Eliminate Microsoft C/C++ compiler warning 4715 */
259 #if (_MSC_VER > 1200)
260 # define DEFAULT_UNREACHABLE default: __assume(0)
262 # define DEFAULT_UNREACHABLE
266 #define APPLICATION_ERROR_MASK 0x20000000
267 #define ERROR_SEVERITY_SUCCESS 0x00000000
268 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
269 #define ERROR_SEVERITY_WARNING 0x80000000
270 #define ERROR_SEVERITY_ERROR 0xC0000000
272 /* Microsoft's macros for declaring functions */
275 # define EXTERN_C extern "C"
277 # define EXTERN_C extern
280 #define STDMETHODCALLTYPE __stdcall
281 #define STDMETHODVCALLTYPE __cdecl
282 #define STDAPICALLTYPE __stdcall
283 #define STDAPIVCALLTYPE __cdecl
285 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
286 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
287 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
288 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
289 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
290 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
291 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
292 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
294 /* Define the basic types */
299 typedef BYTE BOOLEAN
, *PBOOLEAN
;
300 typedef char CHAR
, *PCHAR
;
301 typedef short SHORT
, *PSHORT
;
302 typedef long LONG
, *PLONG
;
304 /* Some systems might have wchar_t, but we really need 16 bit characters */
305 #ifdef WINE_UNICODE_NATIVE
306 typedef wchar_t WCHAR
, *PWCHAR
;
308 typedef unsigned short WCHAR
, *PWCHAR
;
311 /* 'Extended/Wide' numerical types */
315 typedef signed __int64 LONGLONG
, *PLONGLONG
;
316 typedef unsigned __int64 ULONGLONG
, *PULONGLONG
;
318 typedef signed __int64
DECLSPEC_ALIGN(8) LONGLONG
, *PLONGLONG
;
319 typedef unsigned __int64
DECLSPEC_ALIGN(8) ULONGLONG
, *PULONGLONG
;
326 typedef ULONGLONG DWORDLONG
, *PDWORDLONG
;
328 typedef ULONGLONG
DECLSPEC_ALIGN(8) DWORDLONG
, *PDWORDLONG
;
332 /* ANSI string types */
333 typedef CHAR
*PCH
, *LPCH
;
334 typedef const CHAR
*PCCH
, *LPCCH
;
335 typedef CHAR
*PSTR
, *LPSTR
, *NPSTR
;
336 typedef const CHAR
*PCSTR
, *LPCSTR
;
338 /* Unicode string types */
339 typedef WCHAR
*PWCH
, *LPWCH
;
340 typedef const WCHAR
*PCWCH
, *LPCWCH
;
341 typedef WCHAR
*PWSTR
, *LPWSTR
, *NWPSTR
;
342 typedef const WCHAR
*PCWSTR
, *LPCWSTR
;
344 /* Neutral character and string types */
345 /* These are only defined for Winelib, i.e. _not_ defined for
346 * the emulator. The reason is they depend on the UNICODE
347 * macro which only exists in the user's code.
351 # ifndef _TCHAR_DEFINED
352 typedef WCHAR TCHAR
, *PTCHAR
;
353 # define _TCHAR_DEFINED
355 typedef LPWSTR PTSTR
, LPTSTR
;
356 typedef LPCWSTR PCTSTR
, LPCTSTR
;
357 # define __TEXT(string) L##string
359 # ifndef _TCHAR_DEFINED
360 typedef CHAR TCHAR
, *PTCHAR
;
361 # define _TCHAR_DEFINED
363 typedef LPSTR PTSTR
, LPTSTR
;
364 typedef LPCSTR PCTSTR
, LPCTSTR
;
365 # define __TEXT(string) string
366 # endif /* UNICODE */
367 # define TEXT(quote) __TEXT(quote)
368 #endif /* __WINESRC__ */
370 /* Misc common WIN32 types */
372 typedef LONG HRESULT
;
373 typedef DWORD LCID
, *PLCID
;
375 typedef DWORD EXECUTION_STATE
;
379 typedef void *HANDLE
;
380 typedef HANDLE
*PHANDLE
, *LPHANDLE
;
383 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
385 #define DECLARE_HANDLE(a) typedef HANDLE a
390 #ifndef WIN32_NO_STATUS
392 #define STATUS_WAIT_0 0x00000000
393 #define STATUS_ABANDONED_WAIT_0 0x00000080
394 #define STATUS_USER_APC 0x000000C0
395 #define STATUS_TIMEOUT 0x00000102
396 #define STATUS_PENDING 0x00000103
397 #define STATUS_SEGMENT_NOTIFICATION 0x40000005
398 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
399 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
400 #define STATUS_BREAKPOINT 0x80000003
401 #define STATUS_SINGLE_STEP 0x80000004
402 #define STATUS_ACCESS_VIOLATION 0xC0000005
403 #define STATUS_IN_PAGE_ERROR 0xC0000006
404 #define STATUS_INVALID_HANDLE 0xC0000008
405 #define STATUS_NO_MEMORY 0xC0000017
406 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
407 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
408 #define STATUS_INVALID_DISPOSITION 0xC0000026
409 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
410 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
411 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
412 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
413 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
414 #define STATUS_FLOAT_OVERFLOW 0xC0000091
415 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
416 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
417 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
418 #define STATUS_INTEGER_OVERFLOW 0xC0000095
419 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
420 #define STATUS_STACK_OVERFLOW 0xC00000FD
421 #define STATUS_CONTROL_C_EXIT 0xC000013A
422 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
423 #define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
424 #define STATUS_REG_NAT_CONSUMPTION 0xC00002C9
425 #define STATUS_SXS_EARLY_DEACTIVATION 0xC015000F
426 #define STATUS_SXS_INVALID_DEACTIVATION 0xC0150010
428 /* status values for ContinueDebugEvent */
429 #define DBG_EXCEPTION_HANDLED 0x00010001
430 #define DBG_CONTINUE 0x00010002
431 #define DBG_TERMINATE_THREAD 0x40010003
432 #define DBG_TERMINATE_PROCESS 0x40010004
433 #define DBG_CONTROL_C 0x40010005
434 #define DBG_CONTROL_BREAK 0x40010008
435 #define DBG_COMMAND_EXCEPTION 0x40010009
436 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
438 #endif /* WIN32_NO_STATUS */
440 /* Argument 1 passed to the DllEntryProc. */
441 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
442 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
443 #define DLL_THREAD_ATTACH 2 /* attach new thread */
444 #define DLL_THREAD_DETACH 3 /* detach thread */
447 /* u.x.wProcessorArchitecture (NT) */
448 #define PROCESSOR_ARCHITECTURE_INTEL 0
449 #define PROCESSOR_ARCHITECTURE_MIPS 1
450 #define PROCESSOR_ARCHITECTURE_ALPHA 2
451 #define PROCESSOR_ARCHITECTURE_PPC 3
452 #define PROCESSOR_ARCHITECTURE_SHX 4
453 #define PROCESSOR_ARCHITECTURE_ARM 5
454 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
456 /* dwProcessorType */
457 #define PROCESSOR_INTEL_386 386
458 #define PROCESSOR_INTEL_486 486
459 #define PROCESSOR_INTEL_PENTIUM 586
460 #define PROCESSOR_INTEL_860 860
461 #define PROCESSOR_MIPS_R2000 2000
462 #define PROCESSOR_MIPS_R3000 3000
463 #define PROCESSOR_MIPS_R4000 4000
464 #define PROCESSOR_ALPHA_21064 21064
465 #define PROCESSOR_PPC_601 601
466 #define PROCESSOR_PPC_603 603
467 #define PROCESSOR_PPC_604 604
468 #define PROCESSOR_PPC_620 620
469 #define PROCESSOR_HITACHI_SH3 10003
470 #define PROCESSOR_HITACHI_SH3E 10004
471 #define PROCESSOR_HITACHI_SH4 10005
472 #define PROCESSOR_MOTOROLA_821 821
473 #define PROCESSOR_SHx_SH3 103
474 #define PROCESSOR_SHx_SH4 104
475 #define PROCESSOR_STRONGARM 2577
476 #define PROCESSOR_ARM720 1824 /* 0x720 */
477 #define PROCESSOR_ARM820 2080 /* 0x820 */
478 #define PROCESSOR_ARM920 2336 /* 0x920 */
479 #define PROCESSOR_ARM_7TDMI 70001
481 #define MAXIMUM_PROCESSORS 32
482 typedef struct _MEMORY_BASIC_INFORMATION
485 LPVOID AllocationBase
;
486 DWORD AllocationProtect
;
491 } MEMORY_BASIC_INFORMATION
, *PMEMORY_BASIC_INFORMATION
;
493 #define PAGE_NOACCESS 0x01
494 #define PAGE_READONLY 0x02
495 #define PAGE_READWRITE 0x04
496 #define PAGE_WRITECOPY 0x08
497 #define PAGE_EXECUTE 0x10
498 #define PAGE_EXECUTE_READ 0x20
499 #define PAGE_EXECUTE_READWRITE 0x40
500 #define PAGE_EXECUTE_WRITECOPY 0x80
501 #define PAGE_GUARD 0x100
502 #define PAGE_NOCACHE 0x200
504 #define MEM_COMMIT 0x00001000
505 #define MEM_RESERVE 0x00002000
506 #define MEM_DECOMMIT 0x00004000
507 #define MEM_RELEASE 0x00008000
508 #define MEM_FREE 0x00010000
509 #define MEM_PRIVATE 0x00020000
510 #define MEM_MAPPED 0x00040000
511 #define MEM_RESET 0x00080000
512 #define MEM_TOP_DOWN 0x00100000
513 #define MEM_PHYSICAL 0x00400000
515 #define MEM_SYSTEM 0x80000000
518 #define SEC_FILE 0x00800000
519 #define SEC_IMAGE 0x01000000
520 #define SEC_RESERVE 0x04000000
521 #define SEC_COMMIT 0x08000000
522 #define SEC_NOCACHE 0x10000000
523 #define MEM_IMAGE SEC_IMAGE
528 #define MINSHORT 0x8000
529 #define MAXSHORT 0x7fff
530 #define MINLONG 0x80000000
531 #define MAXLONG 0x7fffffff
533 #define MAXWORD 0xffff
534 #define MAXDWORD 0xffffffff
536 #define FIELD_OFFSET(type, field) \
537 ((LONG)(INT)&(((type *)0)->field))
539 #define CONTAINING_RECORD(address, type, field) \
540 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
544 typedef struct _LIST_ENTRY
{
545 struct _LIST_ENTRY
*Flink
;
546 struct _LIST_ENTRY
*Blink
;
547 } LIST_ENTRY
, *PLIST_ENTRY
, * RESTRICTED_POINTER PRLIST_ENTRY
;
549 typedef struct _SINGLE_LIST_ENTRY
{
550 struct _SINGLE_LIST_ENTRY
*Next
;
551 } SINGLE_LIST_ENTRY
, *PSINGLE_LIST_ENTRY
;
555 #define HEAP_NO_SERIALIZE 0x00000001
556 #define HEAP_GROWABLE 0x00000002
557 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
558 #define HEAP_ZERO_MEMORY 0x00000008
559 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
560 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
561 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
562 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
563 #define HEAP_CREATE_ALIGN_16 0x00010000
564 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
566 /* This flag allows it to create heaps shared by all processes under win95,
567 FIXME: correct name */
568 #define HEAP_SHARED 0x04000000
570 /* Processor feature flags. */
571 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
572 #define PF_FLOATING_POINT_EMULATED 1
573 #define PF_COMPARE_EXCHANGE_DOUBLE 2
574 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
575 #define PF_PPC_MOVEMEM_64BIT_OK 4
576 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
577 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
578 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
579 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
580 #define PF_PAE_ENABLED 9
581 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
582 #define PF_NX_ENABLED 12
585 /* Execution state flags */
586 #define ES_SYSTEM_REQUIRED 0x00000001
587 #define ES_DISPLAY_REQUIRED 0x00000002
588 #define ES_USER_PRESENT 0x00000004
589 #define ES_CONTINUOUS 0x80000000
591 /* The Win32 register context */
593 /* CONTEXT is the CPU-dependent context; it should be used */
594 /* wherever a platform-specific context is needed (e.g. exception */
595 /* handling, Win32 register functions). */
597 /* CONTEXT86 is the i386-specific context; it should be used */
598 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
599 /* Win16 register functions), so that this code can be compiled */
600 /* on all platforms. */
602 #define SIZE_OF_80387_REGISTERS 80
604 typedef struct _FLOATING_SAVE_AREA
613 BYTE RegisterArea
[SIZE_OF_80387_REGISTERS
];
615 } FLOATING_SAVE_AREA
, *PFLOATING_SAVE_AREA
;
617 #define MAXIMUM_SUPPORTED_EXTENSION 512
619 typedef struct _CONTEXT86
623 /* These are selected by CONTEXT_DEBUG_REGISTERS */
631 /* These are selected by CONTEXT_FLOATING_POINT */
632 FLOATING_SAVE_AREA FloatSave
;
634 /* These are selected by CONTEXT_SEGMENTS */
640 /* These are selected by CONTEXT_INTEGER */
648 /* These are selected by CONTEXT_CONTROL */
656 BYTE ExtendedRegisters
[MAXIMUM_SUPPORTED_EXTENSION
];
659 #define CONTEXT_X86 0x00010000
660 #define CONTEXT_i386 CONTEXT_X86
661 #define CONTEXT_i486 CONTEXT_X86
663 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
664 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
665 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
666 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
667 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
668 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
670 /* i386 context definitions */
673 #define CONTEXT_CONTROL CONTEXT86_CONTROL
674 #define CONTEXT_INTEGER CONTEXT86_INTEGER
675 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
676 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
677 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
678 #define CONTEXT_FULL CONTEXT86_FULL
680 typedef CONTEXT86 CONTEXT
;
682 #endif /* __i386__ */
684 typedef struct _LDT_ENTRY
{
699 unsigned LimitHi
: 4;
701 unsigned Reserved_0
: 1;
702 unsigned Default_Big
: 1;
703 unsigned Granularity
: 1;
707 } LDT_ENTRY
, *PLDT_ENTRY
;
709 /* Alpha context definitions */
710 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
712 #define CONTEXT_ALPHA 0x00020000
714 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
715 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
716 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
717 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
719 typedef struct _CONTEXT
721 /* selected by CONTEXT_FLOATING_POINT */
755 /* selected by CONTEXT_INTEGER */
789 /* selected by CONTEXT_FLOATING_POINT */
793 /* selected by CONTEXT_CONTROL */
800 #define _QUAD_PSR_OFFSET HighSoftFpcr
801 #define _QUAD_FLAGS_OFFSET HighFir
807 /* The following flags control the contents of the CONTEXT structure. */
809 #define CONTEXT_ARM 0x0000040
810 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
811 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
813 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
815 typedef struct _CONTEXT
{
816 /* The flags values within this flag control the contents of
819 If the context record is used as an input parameter, then
820 for each portion of the context record controlled by a flag
821 whose value is set, it is assumed that that portion of the
822 context record contains valid context. If the context record
823 is being used to modify a thread's context, then only that
824 portion of the threads context will be modified.
826 If the context record is used as an IN OUT parameter to capture
827 the context of a thread, then only those portions of the thread's
828 context corresponding to set flags will be returned.
830 The context record is never used as an OUT only parameter. */
834 /* This section is specified/returned if the ContextFlags word contains
835 the flag CONTEXT_INTEGER. */
859 /* Mips context definitions */
862 #define CONTEXT_R4000 0x00010000
864 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
865 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
866 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
868 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
870 typedef struct _CONTEXT
873 /* These are selected by CONTEXT_FLOATING_POINT */
907 /* These are selected by CONTEXT_INTEGER */
943 /* These are selected by CONTEXT_FLOATING_POINT */
946 /* These are selected by CONTEXT_CONTROL */
956 /* PowerPC context definitions */
959 #define CONTEXT_CONTROL 0x0001
960 #define CONTEXT_FLOATING_POINT 0x0002
961 #define CONTEXT_INTEGER 0x0004
962 #define CONTEXT_DEBUG_REGISTERS 0x0008
963 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
967 /* These are selected by CONTEXT_FLOATING_POINT */
1002 /* These are selected by CONTEXT_INTEGER */
1039 /* These are selected by CONTEXT_CONTROL */
1041 DWORD Iar
; /* Instruction Address Register , aka PC ... */
1047 DWORD Dar
; /* Fault registers for coredump */
1049 DWORD Trap
; /* number of powerpc exception taken */
1051 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1062 typedef struct _STACK_FRAME_HEADER
1079 } STACK_FRAME_HEADER
,*PSTACK_FRAME_HEADER
;
1081 #endif /* __powerpc__ */
1088 * There is no official CONTEXT structure defined for the SPARC
1089 * architecture, so I just made one up.
1091 * This structure is valid only for 32-bit SPARC architectures,
1092 * not for 64-bit SPARC.
1094 * Note that this structure contains only the 'top-level' registers;
1095 * the rest of the register window chain is not visible.
1097 * The layout follows the Solaris 'prgregset_t' structure.
1101 #define CONTEXT_SPARC 0x10000000
1103 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1104 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1105 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1107 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1109 typedef struct _CONTEXT
1113 /* These are selected by CONTEXT_INTEGER */
1147 /* These are selected by CONTEXT_CONTROL */
1155 /* FIXME: floating point registers missing */
1159 #endif /* __sparc__ */
1161 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1162 #error You need to define a CONTEXT for your CPU
1165 typedef CONTEXT
*PCONTEXT
;
1171 #define MAKELCID(l, s) (MAKELONG(l, s))
1173 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1174 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1175 #define SUBLANGID(l) ((WORD)(l) >> 10)
1177 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1178 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1180 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1181 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1182 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1183 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1184 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1186 #define UNREFERENCED_PARAMETER(u) (u)
1187 #define DBG_UNREFERENCED_PARAMETER(u) (u)
1188 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (u)
1190 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x28,
1191 * 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x3a, 0x3b, 0x3c
1193 #define LANG_NEUTRAL 0x00
1194 #define LANG_INVARIANT 0x7f
1196 #define LANG_AFRIKAANS 0x36
1197 #define LANG_ALBANIAN 0x1c
1198 #define LANG_ARABIC 0x01
1199 #define LANG_ARMENIAN 0x2b
1200 #define LANG_ASSAMESE 0x4d
1201 #define LANG_AZERI 0x2c
1202 #define LANG_BASQUE 0x2d
1203 #define LANG_BELARUSIAN 0x23
1204 #define LANG_BENGALI 0x45
1205 #define LANG_BULGARIAN 0x02
1206 #define LANG_CATALAN 0x03
1207 #define LANG_CHINESE 0x04
1208 #define LANG_CROATIAN 0x1a
1209 #define LANG_CZECH 0x05
1210 #define LANG_DANISH 0x06
1211 #define LANG_DIVEHI 0x65
1212 #define LANG_DUTCH 0x13
1213 #define LANG_ENGLISH 0x09
1214 #define LANG_ESTONIAN 0x25
1215 #define LANG_FAEROESE 0x38
1216 #define LANG_FARSI 0x29
1217 #define LANG_FINNISH 0x0b
1218 #define LANG_FRENCH 0x0c
1219 #define LANG_GALICIAN 0x56
1220 #define LANG_GEORGIAN 0x37
1221 #define LANG_GERMAN 0x07
1222 #define LANG_GREEK 0x08
1223 #define LANG_GUJARATI 0x47
1224 #define LANG_HEBREW 0x0d
1225 #define LANG_HINDI 0x39
1226 #define LANG_HUNGARIAN 0x0e
1227 #define LANG_ICELANDIC 0x0f
1228 #define LANG_INDONESIAN 0x21
1229 #define LANG_ITALIAN 0x10
1230 #define LANG_JAPANESE 0x11
1231 #define LANG_KANNADA 0x4b
1232 #define LANG_KASHMIRI 0x60
1233 #define LANG_KAZAK 0x3f
1234 #define LANG_KONKANI 0x57
1235 #define LANG_KOREAN 0x12
1236 #define LANG_KYRGYZ 0x40
1237 #define LANG_LATVIAN 0x26
1238 #define LANG_LITHUANIAN 0x27
1239 #define LANG_MACEDONIAN 0x2f
1240 #define LANG_MALAY 0x3e
1241 #define LANG_MALAYALAM 0x4c
1242 #define LANG_MANIPURI 0x58
1243 #define LANG_MARATHI 0x4e
1244 #define LANG_MONGOLIAN 0x50
1245 #define LANG_NEPALI 0x61
1246 #define LANG_NORWEGIAN 0x14
1247 #define LANG_ORIYA 0x48
1248 #define LANG_POLISH 0x15
1249 #define LANG_PORTUGUESE 0x16
1250 #define LANG_PUNJABI 0x46
1251 #define LANG_ROMANIAN 0x18
1252 #define LANG_RUSSIAN 0x19
1253 #define LANG_SANSKRIT 0x4f
1254 #define LANG_SERBIAN 0x1a
1255 #define LANG_SINDHI 0x59
1256 #define LANG_SLOVAK 0x1b
1257 #define LANG_SLOVENIAN 0x24
1258 #define LANG_SPANISH 0x0a
1259 #define LANG_SWAHILI 0x41
1260 #define LANG_SWEDISH 0x1d
1261 #define LANG_SYRIAC 0x5a
1262 #define LANG_TAMIL 0x49
1263 #define LANG_TATAR 0x44
1264 #define LANG_TELUGU 0x4a
1265 #define LANG_THAI 0x1e
1266 #define LANG_TURKISH 0x1f
1267 #define LANG_UKRAINIAN 0x22
1268 #define LANG_URDU 0x20
1269 #define LANG_UZBEK 0x43
1270 #define LANG_VIETNAMESE 0x2a
1272 /* FIXME: these are not in the Windows header */
1273 #define LANG_GAELIC 0x3c
1274 #define LANG_MALTESE 0x3a
1275 #define LANG_MAORI 0x28
1276 #define LANG_RHAETO_ROMANCE 0x17
1277 #define LANG_SAAMI 0x3b
1278 #define LANG_SORBIAN 0x2e
1279 #define LANG_SUTU 0x30
1280 #define LANG_TSONGA 0x31
1281 #define LANG_TSWANA 0x32
1282 #define LANG_VENDA 0x33
1283 #define LANG_XHOSA 0x34
1284 #define LANG_ZULU 0x35
1286 /* non standard; keep the number high enough (but < 0xff) */
1287 #define LANG_ESPERANTO 0x8f
1288 #define LANG_WALON 0x90
1289 #define LANG_CORNISH 0x91
1290 #define LANG_WELSH 0x92
1291 #define LANG_BRETON 0x93
1293 /* Sublanguage definitions */
1294 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1295 #define SUBLANG_DEFAULT 0x01 /* user default */
1296 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1298 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1299 #define SUBLANG_ARABIC_IRAQ 0x02
1300 #define SUBLANG_ARABIC_EGYPT 0x03
1301 #define SUBLANG_ARABIC_LIBYA 0x04
1302 #define SUBLANG_ARABIC_ALGERIA 0x05
1303 #define SUBLANG_ARABIC_MOROCCO 0x06
1304 #define SUBLANG_ARABIC_TUNISIA 0x07
1305 #define SUBLANG_ARABIC_OMAN 0x08
1306 #define SUBLANG_ARABIC_YEMEN 0x09
1307 #define SUBLANG_ARABIC_SYRIA 0x0a
1308 #define SUBLANG_ARABIC_JORDAN 0x0b
1309 #define SUBLANG_ARABIC_LEBANON 0x0c
1310 #define SUBLANG_ARABIC_KUWAIT 0x0d
1311 #define SUBLANG_ARABIC_UAE 0x0e
1312 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1313 #define SUBLANG_ARABIC_QATAR 0x10
1314 #define SUBLANG_AZERI_LATIN 0x01
1315 #define SUBLANG_AZERI_CYRILLIC 0x02
1316 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1317 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1318 #define SUBLANG_CHINESE_HONGKONG 0x03
1319 #define SUBLANG_CHINESE_SINGAPORE 0x04
1320 #define SUBLANG_CHINESE_MACAU 0x05
1321 #define SUBLANG_DUTCH 0x01
1322 #define SUBLANG_DUTCH_BELGIAN 0x02
1323 #define SUBLANG_ENGLISH_US 0x01
1324 #define SUBLANG_ENGLISH_UK 0x02
1325 #define SUBLANG_ENGLISH_AUS 0x03
1326 #define SUBLANG_ENGLISH_CAN 0x04
1327 #define SUBLANG_ENGLISH_NZ 0x05
1328 #define SUBLANG_ENGLISH_EIRE 0x06
1329 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1330 #define SUBLANG_ENGLISH_JAMAICA 0x08
1331 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1332 #define SUBLANG_ENGLISH_BELIZE 0x0a
1333 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1334 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1335 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1336 #define SUBLANG_FRENCH 0x01
1337 #define SUBLANG_FRENCH_BELGIAN 0x02
1338 #define SUBLANG_FRENCH_CANADIAN 0x03
1339 #define SUBLANG_FRENCH_SWISS 0x04
1340 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1341 #define SUBLANG_FRENCH_MONACO 0x06
1342 #define SUBLANG_GERMAN 0x01
1343 #define SUBLANG_GERMAN_SWISS 0x02
1344 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1345 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1346 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1347 #define SUBLANG_ITALIAN 0x01
1348 #define SUBLANG_ITALIAN_SWISS 0x02
1349 #define SUBLANG_KASHMIRI_SASIA 0x02
1350 #define SUBLANG_KASHMIRI_INDIA 0x02
1351 #define SUBLANG_KOREAN 0x01
1352 #define SUBLANG_LITHUANIAN 0x01
1353 #define SUBLANG_MALAY_MALAYSIA 0x01
1354 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1355 #define SUBLANG_NEPALI_INDIA 0x02
1356 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1357 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1358 #define SUBLANG_PORTUGUESE 0x02
1359 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1360 #define SUBLANG_SERBIAN_LATIN 0x02
1361 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1362 #define SUBLANG_SPANISH 0x01
1363 #define SUBLANG_SPANISH_MEXICAN 0x02
1364 #define SUBLANG_SPANISH_MODERN 0x03
1365 #define SUBLANG_SPANISH_GUATEMALA 0x04
1366 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1367 #define SUBLANG_SPANISH_PANAMA 0x06
1368 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1369 #define SUBLANG_SPANISH_VENEZUELA 0x08
1370 #define SUBLANG_SPANISH_COLOMBIA 0x09
1371 #define SUBLANG_SPANISH_PERU 0x0a
1372 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1373 #define SUBLANG_SPANISH_ECUADOR 0x0c
1374 #define SUBLANG_SPANISH_CHILE 0x0d
1375 #define SUBLANG_SPANISH_URUGUAY 0x0e
1376 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1377 #define SUBLANG_SPANISH_BOLIVIA 0x10
1378 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1379 #define SUBLANG_SPANISH_HONDURAS 0x12
1380 #define SUBLANG_SPANISH_NICARAGUA 0x13
1381 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1382 #define SUBLANG_SWEDISH 0x01
1383 #define SUBLANG_SWEDISH_FINLAND 0x02
1384 #define SUBLANG_URDU_PAKISTAN 0x01
1385 #define SUBLANG_URDU_INDIA 0x02
1386 #define SUBLANG_UZBEK_LATIN 0x01
1387 #define SUBLANG_UZBEK_CYRILLIC 0x02
1389 /* FIXME: these are not in the Windows header */
1390 #define SUBLANG_DUTCH_SURINAM 0x03
1391 #define SUBLANG_ROMANIAN 0x01
1392 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1393 #define SUBLANG_RUSSIAN 0x01
1394 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1395 #define SUBLANG_CROATIAN 0x01
1396 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1397 #define SUBLANG_GAELIC 0x01
1398 #define SUBLANG_GAELIC_SCOTTISH 0x02
1399 #define SUBLANG_GAELIC_MANX 0x03
1406 #define SORT_DEFAULT 0x0
1407 #define SORT_JAPANESE_XJIS 0x0
1408 #define SORT_JAPANESE_UNICODE 0x1
1409 #define SORT_CHINESE_BIG5 0x0
1410 #define SORT_CHINESE_UNICODE 0x1
1411 #define SORT_KOREAN_KSC 0x0
1412 #define SORT_KOREAN_UNICODE 0x1
1417 * Definitions for IsTextUnicode()
1420 #define IS_TEXT_UNICODE_ASCII16 0x0001
1421 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1422 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1423 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1424 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1425 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1426 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1427 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1428 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1429 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1430 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1431 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1432 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1433 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1434 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1435 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1437 #define MAXIMUM_WAIT_OBJECTS 64
1438 #define MAXIMUM_SUSPEND_COUNT 127
1442 * From OS/2 2.0 exception handling
1443 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1446 #define EH_NONCONTINUABLE 0x01
1447 #define EH_UNWINDING 0x02
1448 #define EH_EXIT_UNWIND 0x04
1449 #define EH_STACK_INVALID 0x08
1450 #define EH_NESTED_CALL 0x10
1452 #define EXCEPTION_CONTINUABLE 0
1453 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1456 * The exception record used by Win32 to give additional information
1457 * about exception to exception handlers.
1460 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1462 typedef struct _EXCEPTION_RECORD
1464 DWORD ExceptionCode
;
1465 DWORD ExceptionFlags
;
1466 struct _EXCEPTION_RECORD
*ExceptionRecord
;
1468 PVOID ExceptionAddress
;
1469 DWORD NumberParameters
;
1470 ULONG_PTR ExceptionInformation
[EXCEPTION_MAXIMUM_PARAMETERS
];
1471 } EXCEPTION_RECORD
, *PEXCEPTION_RECORD
;
1474 * The exception pointers structure passed to exception filters
1475 * in except() and the UnhandledExceptionFilter().
1478 typedef struct _EXCEPTION_POINTERS
1480 PEXCEPTION_RECORD ExceptionRecord
;
1481 PCONTEXT ContextRecord
;
1482 } EXCEPTION_POINTERS
, *PEXCEPTION_POINTERS
;
1486 * The exception frame, used for registering exception handlers
1487 * Win32 cares only about this, but compilers generally emit
1488 * larger exception frames for their own use.
1491 struct _EXCEPTION_REGISTRATION_RECORD
;
1493 typedef DWORD (*PEXCEPTION_HANDLER
)(PEXCEPTION_RECORD
,struct _EXCEPTION_REGISTRATION_RECORD
*,
1494 PCONTEXT
,struct _EXCEPTION_REGISTRATION_RECORD
**);
1496 typedef struct _EXCEPTION_REGISTRATION_RECORD
1498 struct _EXCEPTION_REGISTRATION_RECORD
*Prev
;
1499 PEXCEPTION_HANDLER Handler
;
1500 } EXCEPTION_REGISTRATION_RECORD
;
1503 * function pointer to an exception filter
1506 typedef LONG (CALLBACK
*PVECTORED_EXCEPTION_HANDLER
)(PEXCEPTION_POINTERS ExceptionInfo
);
1507 typedef LONG (CALLBACK
*PTOP_LEVEL_EXCEPTION_FILTER
)(PEXCEPTION_POINTERS ExceptionInfo
);
1508 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER
;
1510 DWORD WINAPI
UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers
);
1511 LPTOP_LEVEL_EXCEPTION_FILTER
1512 WINAPI
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter
);
1514 typedef struct _NT_TIB
1516 struct _EXCEPTION_REGISTRATION_RECORD
*ExceptionList
;
1524 PVOID ArbitraryUserPointer
;
1525 struct _NT_TIB
*Self
;
1530 #if defined(__i386__) && defined(__GNUC__)
1531 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void);
1532 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1535 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb
));
1538 #elif defined(__i386__) && defined(_MSC_VER)
1539 extern inline struct _TEB
* WINAPI
NtCurrentTeb(void)
1542 __asm mov eax
, fs
:[0x18];
1547 extern struct _TEB
* WINAPI
NtCurrentTeb(void);
1550 #ifdef NONAMELESSUNION
1551 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
1553 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
1555 #define GetFiberData() (*(void **)GetCurrentFiber())
1557 #define TLS_MINIMUM_AVAILABLE 64
1560 * File formats definitions
1563 #include <pshpack2.h>
1564 typedef struct _IMAGE_DOS_HEADER
{
1565 WORD e_magic
; /* 00: MZ Header signature */
1566 WORD e_cblp
; /* 02: Bytes on last page of file */
1567 WORD e_cp
; /* 04: Pages in file */
1568 WORD e_crlc
; /* 06: Relocations */
1569 WORD e_cparhdr
; /* 08: Size of header in paragraphs */
1570 WORD e_minalloc
; /* 0a: Minimum extra paragraphs needed */
1571 WORD e_maxalloc
; /* 0c: Maximum extra paragraphs needed */
1572 WORD e_ss
; /* 0e: Initial (relative) SS value */
1573 WORD e_sp
; /* 10: Initial SP value */
1574 WORD e_csum
; /* 12: Checksum */
1575 WORD e_ip
; /* 14: Initial IP value */
1576 WORD e_cs
; /* 16: Initial (relative) CS value */
1577 WORD e_lfarlc
; /* 18: File address of relocation table */
1578 WORD e_ovno
; /* 1a: Overlay number */
1579 WORD e_res
[4]; /* 1c: Reserved words */
1580 WORD e_oemid
; /* 24: OEM identifier (for e_oeminfo) */
1581 WORD e_oeminfo
; /* 26: OEM information; e_oemid specific */
1582 WORD e_res2
[10]; /* 28: Reserved words */
1583 DWORD e_lfanew
; /* 3c: Offset to extended header */
1584 } IMAGE_DOS_HEADER
, *PIMAGE_DOS_HEADER
;
1585 #include <poppack.h>
1587 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1588 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1589 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1590 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1591 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1592 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1595 * This is the Windows executable (NE) header.
1596 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1598 #include <pshpack2.h>
1601 WORD ne_magic
; /* 00 NE signature 'NE' */
1602 BYTE ne_ver
; /* 02 Linker version number */
1603 BYTE ne_rev
; /* 03 Linker revision number */
1604 WORD ne_enttab
; /* 04 Offset to entry table relative to NE */
1605 WORD ne_cbenttab
; /* 06 Length of entry table in bytes */
1606 LONG ne_crc
; /* 08 Checksum */
1607 WORD ne_flags
; /* 0c Flags about segments in this file */
1608 WORD ne_autodata
; /* 0e Automatic data segment number */
1609 WORD ne_heap
; /* 10 Initial size of local heap */
1610 WORD ne_stack
; /* 12 Initial size of stack */
1611 DWORD ne_csip
; /* 14 Initial CS:IP */
1612 DWORD ne_sssp
; /* 18 Initial SS:SP */
1613 WORD ne_cseg
; /* 1c # of entries in segment table */
1614 WORD ne_cmod
; /* 1e # of entries in module reference tab. */
1615 WORD ne_cbnrestab
; /* 20 Length of nonresident-name table */
1616 WORD ne_segtab
; /* 22 Offset to segment table */
1617 WORD ne_rsrctab
; /* 24 Offset to resource table */
1618 WORD ne_restab
; /* 26 Offset to resident-name table */
1619 WORD ne_modtab
; /* 28 Offset to module reference table */
1620 WORD ne_imptab
; /* 2a Offset to imported name table */
1621 DWORD ne_nrestab
; /* 2c Offset to nonresident-name table */
1622 WORD ne_cmovent
; /* 30 # of movable entry points */
1623 WORD ne_align
; /* 32 Logical sector alignment shift count */
1624 WORD ne_cres
; /* 34 # of resource segments */
1625 BYTE ne_exetyp
; /* 36 Flags indicating target OS */
1626 BYTE ne_flagsothers
; /* 37 Additional information flags */
1627 WORD ne_pretthunks
; /* 38 Offset to return thunks */
1628 WORD ne_psegrefbytes
; /* 3a Offset to segment ref. bytes */
1629 WORD ne_swaparea
; /* 3c Reserved by Microsoft */
1630 WORD ne_expver
; /* 3e Expected Windows version number */
1631 } IMAGE_OS2_HEADER
, *PIMAGE_OS2_HEADER
;
1632 #include <poppack.h>
1634 #include <pshpack2.h>
1635 typedef struct _IMAGE_VXD_HEADER
{
1650 DWORD e32_lastpagesize
;
1651 DWORD e32_fixupsize
;
1668 DWORD e32_impmodcnt
;
1674 DWORD e32_cbnrestab
;
1677 DWORD e32_debuginfo
;
1679 DWORD e32_instpreload
;
1680 DWORD e32_instdemand
;
1683 DWORD e32_winresoff
;
1684 DWORD e32_winreslen
;
1687 } IMAGE_VXD_HEADER
, *PIMAGE_VXD_HEADER
;
1688 #include <poppack.h>
1690 /* These defines describe the meanings of the bits in the Characteristics
1693 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1694 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1695 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1696 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1697 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
1698 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
1699 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1700 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1701 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1702 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1703 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
1704 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
1705 #define IMAGE_FILE_SYSTEM 0x1000
1706 #define IMAGE_FILE_DLL 0x2000
1707 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
1708 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1710 /* These are the settings of the Machine field. */
1711 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1712 #define IMAGE_FILE_MACHINE_I860 0x014d
1713 #define IMAGE_FILE_MACHINE_I386 0x014c
1714 #define IMAGE_FILE_MACHINE_R3000 0x0162
1715 #define IMAGE_FILE_MACHINE_R4000 0x0166
1716 #define IMAGE_FILE_MACHINE_R10000 0x0168
1717 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
1718 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
1719 #define IMAGE_FILE_MACHINE_SH3 0x01a2
1720 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
1721 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1722 #define IMAGE_FILE_MACHINE_SH4 0x01a6
1723 #define IMAGE_FILE_MACHINE_SH5 0x01a8
1724 #define IMAGE_FILE_MACHINE_ARM 0x01c0
1725 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
1726 #define IMAGE_FILE_MACHINE_AM33 0x01d3
1727 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
1728 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
1729 #define IMAGE_FILE_MACHINE_IA64 0x0200
1730 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
1731 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1732 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
1733 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
1734 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1735 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1736 #define IMAGE_FILE_MACHINE_CEF 0x0cef
1737 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
1738 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1739 #define IMAGE_FILE_MACHINE_M32R 0x9041
1740 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
1742 #define IMAGE_SIZEOF_FILE_HEADER 20
1743 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1744 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1745 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1746 #define IMAGE_SIZEOF_SHORT_NAME 8
1747 #define IMAGE_SIZEOF_SECTION_HEADER 40
1748 #define IMAGE_SIZEOF_SYMBOL 18
1749 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1750 #define IMAGE_SIZEOF_RELOCATION 10
1751 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1752 #define IMAGE_SIZEOF_LINENUMBER 6
1753 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1755 /* Possible Magic values */
1756 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1757 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1759 /* These are indexes into the DataDirectory array */
1760 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1761 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1762 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1763 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1764 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1765 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1766 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1767 #define IMAGE_FILE_DESCRIPTION_STRING 7
1768 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1769 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1770 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1772 /* Directory Entries, indices into the DataDirectory array */
1774 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1775 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1776 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1777 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1778 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1779 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1780 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1781 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1782 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1783 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1784 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1785 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1786 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1787 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1788 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1790 /* Subsystem Values */
1792 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1793 #define IMAGE_SUBSYSTEM_NATIVE 1
1794 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1795 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
1796 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1797 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1798 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
1799 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
1800 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1801 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1802 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1803 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1804 #define IMAGE_SUBSYSTEM_XBOX 14
1806 typedef struct _IMAGE_FILE_HEADER
{
1808 WORD NumberOfSections
;
1809 DWORD TimeDateStamp
;
1810 DWORD PointerToSymbolTable
;
1811 DWORD NumberOfSymbols
;
1812 WORD SizeOfOptionalHeader
;
1813 WORD Characteristics
;
1814 } IMAGE_FILE_HEADER
, *PIMAGE_FILE_HEADER
;
1816 typedef struct _IMAGE_DATA_DIRECTORY
{
1817 DWORD VirtualAddress
;
1819 } IMAGE_DATA_DIRECTORY
, *PIMAGE_DATA_DIRECTORY
;
1821 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1823 typedef struct _IMAGE_OPTIONAL_HEADER
{
1825 /* Standard fields */
1827 WORD Magic
; /* 0x10b or 0x107 */ /* 0x00 */
1828 BYTE MajorLinkerVersion
;
1829 BYTE MinorLinkerVersion
;
1831 DWORD SizeOfInitializedData
;
1832 DWORD SizeOfUninitializedData
;
1833 DWORD AddressOfEntryPoint
; /* 0x10 */
1837 /* NT additional fields */
1840 DWORD SectionAlignment
; /* 0x20 */
1841 DWORD FileAlignment
;
1842 WORD MajorOperatingSystemVersion
;
1843 WORD MinorOperatingSystemVersion
;
1844 WORD MajorImageVersion
;
1845 WORD MinorImageVersion
;
1846 WORD MajorSubsystemVersion
; /* 0x30 */
1847 WORD MinorSubsystemVersion
;
1848 DWORD Win32VersionValue
;
1850 DWORD SizeOfHeaders
;
1851 DWORD CheckSum
; /* 0x40 */
1853 WORD DllCharacteristics
;
1854 DWORD SizeOfStackReserve
;
1855 DWORD SizeOfStackCommit
;
1856 DWORD SizeOfHeapReserve
; /* 0x50 */
1857 DWORD SizeOfHeapCommit
;
1859 DWORD NumberOfRvaAndSizes
;
1860 IMAGE_DATA_DIRECTORY DataDirectory
[IMAGE_NUMBEROF_DIRECTORY_ENTRIES
]; /* 0x60 */
1862 } IMAGE_OPTIONAL_HEADER
, *PIMAGE_OPTIONAL_HEADER
;
1864 typedef struct _IMAGE_NT_HEADERS
{
1865 DWORD Signature
; /* "PE"\0\0 */ /* 0x00 */
1866 IMAGE_FILE_HEADER FileHeader
; /* 0x04 */
1867 IMAGE_OPTIONAL_HEADER OptionalHeader
; /* 0x18 */
1868 } IMAGE_NT_HEADERS
, *PIMAGE_NT_HEADERS
;
1870 #define IMAGE_SIZEOF_SHORT_NAME 8
1872 typedef struct _IMAGE_SECTION_HEADER
{
1873 BYTE Name
[IMAGE_SIZEOF_SHORT_NAME
];
1875 DWORD PhysicalAddress
;
1878 DWORD VirtualAddress
;
1879 DWORD SizeOfRawData
;
1880 DWORD PointerToRawData
;
1881 DWORD PointerToRelocations
;
1882 DWORD PointerToLinenumbers
;
1883 WORD NumberOfRelocations
;
1884 WORD NumberOfLinenumbers
;
1885 DWORD Characteristics
;
1886 } IMAGE_SECTION_HEADER
, *PIMAGE_SECTION_HEADER
;
1888 #define IMAGE_SIZEOF_SECTION_HEADER 40
1890 #define IMAGE_FIRST_SECTION(ntheader) \
1891 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1892 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1894 /* These defines are for the Characteristics bitfield. */
1895 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1896 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1897 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1898 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1899 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
1900 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1902 #define IMAGE_SCN_CNT_CODE 0x00000020
1903 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1904 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1906 #define IMAGE_SCN_LNK_OTHER 0x00000100
1907 #define IMAGE_SCN_LNK_INFO 0x00000200
1908 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1909 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1910 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1912 /* 0x00002000 - Reserved */
1913 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1914 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1916 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1917 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1918 #define IMAGE_SCN_MEM_16BIT 0x00020000
1919 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1920 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1922 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1923 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1924 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1925 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1926 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1927 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1928 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1929 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
1930 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
1931 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
1932 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
1933 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
1934 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
1935 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
1936 /* 0x00F00000 - Unused */
1937 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
1939 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1942 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1943 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1944 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1945 #define IMAGE_SCN_MEM_SHARED 0x10000000
1946 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1947 #define IMAGE_SCN_MEM_READ 0x40000000
1948 #define IMAGE_SCN_MEM_WRITE 0x80000000
1950 #include <pshpack2.h>
1952 typedef struct _IMAGE_SYMBOL
{
1962 SHORT SectionNumber
;
1965 BYTE NumberOfAuxSymbols
;
1967 typedef IMAGE_SYMBOL
*PIMAGE_SYMBOL
;
1969 #define IMAGE_SIZEOF_SYMBOL 18
1971 typedef struct _IMAGE_LINENUMBER
{
1973 DWORD SymbolTableIndex
;
1974 DWORD VirtualAddress
;
1978 typedef IMAGE_LINENUMBER
*PIMAGE_LINENUMBER
;
1980 #define IMAGE_SIZEOF_LINENUMBER 6
1982 typedef union _IMAGE_AUX_SYMBOL
{
1994 DWORD PointerToLinenumber
;
1995 DWORD PointerToNextFunction
;
2004 BYTE Name
[IMAGE_SIZEOF_SYMBOL
];
2008 WORD NumberOfRelocations
;
2009 WORD NumberOfLinenumbers
;
2015 typedef IMAGE_AUX_SYMBOL
*PIMAGE_AUX_SYMBOL
;
2017 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2019 #include <poppack.h>
2021 #define IMAGE_SYM_UNDEFINED (SHORT)0
2022 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2023 #define IMAGE_SYM_DEBUG (SHORT)-2
2025 #define IMAGE_SYM_TYPE_NULL 0x0000
2026 #define IMAGE_SYM_TYPE_VOID 0x0001
2027 #define IMAGE_SYM_TYPE_CHAR 0x0002
2028 #define IMAGE_SYM_TYPE_SHORT 0x0003
2029 #define IMAGE_SYM_TYPE_INT 0x0004
2030 #define IMAGE_SYM_TYPE_LONG 0x0005
2031 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2032 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2033 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2034 #define IMAGE_SYM_TYPE_UNION 0x0009
2035 #define IMAGE_SYM_TYPE_ENUM 0x000A
2036 #define IMAGE_SYM_TYPE_MOE 0x000B
2037 #define IMAGE_SYM_TYPE_BYTE 0x000C
2038 #define IMAGE_SYM_TYPE_WORD 0x000D
2039 #define IMAGE_SYM_TYPE_UINT 0x000E
2040 #define IMAGE_SYM_TYPE_DWORD 0x000F
2041 #define IMAGE_SYM_TYPE_PCODE 0x8000
2043 #define IMAGE_SYM_DTYPE_NULL 0
2044 #define IMAGE_SYM_DTYPE_POINTER 1
2045 #define IMAGE_SYM_DTYPE_FUNCTION 2
2046 #define IMAGE_SYM_DTYPE_ARRAY 3
2048 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2049 #define IMAGE_SYM_CLASS_NULL 0x0000
2050 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2051 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2052 #define IMAGE_SYM_CLASS_STATIC 0x0003
2053 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2054 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2055 #define IMAGE_SYM_CLASS_LABEL 0x0006
2056 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2057 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2058 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2059 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2060 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2061 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2062 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2063 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2064 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2065 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2066 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2067 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2069 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2070 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2071 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2072 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2073 #define IMAGE_SYM_CLASS_FILE 0x0067
2074 #define IMAGE_SYM_CLASS_SECTION 0x0068
2075 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2077 #define N_BTMASK 0x000F
2078 #define N_TMASK 0x0030
2079 #define N_TMASK1 0x00C0
2080 #define N_TMASK2 0x00F0
2084 #define BTYPE(x) ((x) & N_BTMASK)
2087 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2091 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2095 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2099 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2103 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2106 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2109 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2110 #define IMAGE_COMDAT_SELECT_ANY 2
2111 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2112 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2113 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2114 #define IMAGE_COMDAT_SELECT_LARGEST 6
2115 #define IMAGE_COMDAT_SELECT_NEWEST 7
2117 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2118 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2119 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2121 /* Export module directory */
2123 typedef struct _IMAGE_EXPORT_DIRECTORY
{
2124 DWORD Characteristics
;
2125 DWORD TimeDateStamp
;
2130 DWORD NumberOfFunctions
;
2131 DWORD NumberOfNames
;
2132 DWORD AddressOfFunctions
;
2133 DWORD AddressOfNames
;
2134 DWORD AddressOfNameOrdinals
;
2135 } IMAGE_EXPORT_DIRECTORY
,*PIMAGE_EXPORT_DIRECTORY
;
2137 /* Import name entry */
2138 typedef struct _IMAGE_IMPORT_BY_NAME
{
2141 } IMAGE_IMPORT_BY_NAME
,*PIMAGE_IMPORT_BY_NAME
;
2144 typedef struct _IMAGE_THUNK_DATA
{
2146 LPBYTE ForwarderString
;
2149 PIMAGE_IMPORT_BY_NAME AddressOfData
;
2151 } IMAGE_THUNK_DATA
,*PIMAGE_THUNK_DATA
;
2153 /* Import module directory */
2155 typedef struct _IMAGE_IMPORT_DESCRIPTOR
{
2157 DWORD Characteristics
; /* 0 for terminating null import descriptor */
2158 PIMAGE_THUNK_DATA OriginalFirstThunk
; /* RVA to original unbound IAT */
2160 DWORD TimeDateStamp
; /* 0 if not bound,
2161 * -1 if bound, and real date\time stamp
2162 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2164 * otherwise date/time stamp of DLL bound to
2167 DWORD ForwarderChain
; /* -1 if no forwarders */
2169 /* RVA to IAT (if bound this IAT has actual addresses) */
2170 PIMAGE_THUNK_DATA FirstThunk
;
2171 } IMAGE_IMPORT_DESCRIPTOR
,*PIMAGE_IMPORT_DESCRIPTOR
;
2173 #define IMAGE_ORDINAL_FLAG 0x80000000
2174 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
2175 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
2177 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2179 DWORD TimeDateStamp
;
2180 WORD OffsetModuleName
;
2181 WORD NumberOfModuleForwarderRefs
;
2182 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2183 } IMAGE_BOUND_IMPORT_DESCRIPTOR
, *PIMAGE_BOUND_IMPORT_DESCRIPTOR
;
2185 typedef struct _IMAGE_BOUND_FORWARDER_REF
2187 DWORD TimeDateStamp
;
2188 WORD OffsetModuleName
;
2190 } IMAGE_BOUND_FORWARDER_REF
, *PIMAGE_BOUND_FORWARDER_REF
;
2192 typedef struct _IMAGE_BASE_RELOCATION
2194 DWORD VirtualAddress
;
2196 /* WORD TypeOffset[1]; */
2197 } IMAGE_BASE_RELOCATION
,*PIMAGE_BASE_RELOCATION
;
2199 #include <pshpack2.h>
2201 typedef struct _IMAGE_RELOCATION
2204 DWORD VirtualAddress
;
2207 DWORD SymbolTableIndex
;
2209 } IMAGE_RELOCATION
, *PIMAGE_RELOCATION
;
2211 #include <poppack.h>
2213 #define IMAGE_SIZEOF_RELOCATION 10
2215 /* generic relocation types */
2216 #define IMAGE_REL_BASED_ABSOLUTE 0
2217 #define IMAGE_REL_BASED_HIGH 1
2218 #define IMAGE_REL_BASED_LOW 2
2219 #define IMAGE_REL_BASED_HIGHLOW 3
2220 #define IMAGE_REL_BASED_HIGHADJ 4
2221 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2222 #define IMAGE_REL_BASED_SECTION 6
2223 #define IMAGE_REL_BASED_REL 7
2224 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2225 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2226 #define IMAGE_REL_BASED_DIR64 10
2227 #define IMAGE_REL_BASED_HIGH3ADJ 11
2229 /* I386 relocation types */
2230 #define IMAGE_REL_I386_ABSOLUTE 0
2231 #define IMAGE_REL_I386_DIR16 1
2232 #define IMAGE_REL_I386_REL16 2
2233 #define IMAGE_REL_I386_DIR32 6
2234 #define IMAGE_REL_I386_DIR32NB 7
2235 #define IMAGE_REL_I386_SEG12 9
2236 #define IMAGE_REL_I386_SECTION 10
2237 #define IMAGE_REL_I386_SECREL 11
2238 #define IMAGE_REL_I386_REL32 20
2240 /* MIPS relocation types */
2241 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2242 #define IMAGE_REL_MIPS_REFHALF 0x0001
2243 #define IMAGE_REL_MIPS_REFWORD 0x0002
2244 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2245 #define IMAGE_REL_MIPS_REFHI 0x0004
2246 #define IMAGE_REL_MIPS_REFLO 0x0005
2247 #define IMAGE_REL_MIPS_GPREL 0x0006
2248 #define IMAGE_REL_MIPS_LITERAL 0x0007
2249 #define IMAGE_REL_MIPS_SECTION 0x000A
2250 #define IMAGE_REL_MIPS_SECREL 0x000B
2251 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2252 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2253 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2254 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2255 #define IMAGE_REL_MIPS_PAIR 0x0025
2257 /* ALPHA relocation types */
2258 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2259 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2260 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2261 #define IMAGE_REL_ALPHA_GPREL 0x0003
2262 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2263 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2264 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2265 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2266 #define IMAGE_REL_ALPHA_HINT 0x0008
2267 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2268 #define IMAGE_REL_ALPHA_REFHI 0x000A
2269 #define IMAGE_REL_ALPHA_REFLO 0x000B
2270 #define IMAGE_REL_ALPHA_PAIR 0x000C
2271 #define IMAGE_REL_ALPHA_MATCH 0x000D
2272 #define IMAGE_REL_ALPHA_SECTION 0x000E
2273 #define IMAGE_REL_ALPHA_SECREL 0x000F
2274 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2275 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2276 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2277 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2278 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2279 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2280 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2281 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2283 /* PowerPC relocation types */
2284 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2285 #define IMAGE_REL_PPC_ADDR64 0x0001
2286 #define IMAGE_REL_PPC_ADDR 0x0002
2287 #define IMAGE_REL_PPC_ADDR24 0x0003
2288 #define IMAGE_REL_PPC_ADDR16 0x0004
2289 #define IMAGE_REL_PPC_ADDR14 0x0005
2290 #define IMAGE_REL_PPC_REL24 0x0006
2291 #define IMAGE_REL_PPC_REL14 0x0007
2292 #define IMAGE_REL_PPC_TOCREL16 0x0008
2293 #define IMAGE_REL_PPC_TOCREL14 0x0009
2294 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2295 #define IMAGE_REL_PPC_SECREL 0x000B
2296 #define IMAGE_REL_PPC_SECTION 0x000C
2297 #define IMAGE_REL_PPC_IFGLUE 0x000D
2298 #define IMAGE_REL_PPC_IMGLUE 0x000E
2299 #define IMAGE_REL_PPC_SECREL16 0x000F
2300 #define IMAGE_REL_PPC_REFHI 0x0010
2301 #define IMAGE_REL_PPC_REFLO 0x0011
2302 #define IMAGE_REL_PPC_PAIR 0x0012
2303 #define IMAGE_REL_PPC_SECRELLO 0x0013
2304 #define IMAGE_REL_PPC_SECRELHI 0x0014
2305 #define IMAGE_REL_PPC_GPREL 0x0015
2306 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2308 #define IMAGE_REL_PPC_NEG 0x0100
2309 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2310 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2311 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2313 /* SH3 ? relocation type */
2314 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2315 #define IMAGE_REL_SH3_DIRECT16 0x0001
2316 #define IMAGE_REL_SH3_DIRECT 0x0002
2317 #define IMAGE_REL_SH3_DIRECT8 0x0003
2318 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2319 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2320 #define IMAGE_REL_SH3_DIRECT4 0x0006
2321 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2322 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2323 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2324 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2325 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2326 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2327 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2328 #define IMAGE_REL_SH3_SECTION 0x000E
2329 #define IMAGE_REL_SH3_SECREL 0x000F
2330 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2332 /* ARM (Archimedes?) relocation types */
2333 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2334 #define IMAGE_REL_ARM_ADDR 0x0001
2335 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2336 #define IMAGE_REL_ARM_BRANCH24 0x0003
2337 #define IMAGE_REL_ARM_BRANCH11 0x0004
2338 #define IMAGE_REL_ARM_SECTION 0x000E
2339 #define IMAGE_REL_ARM_SECREL 0x000F
2341 /* IA64 relocation types */
2342 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2343 #define IMAGE_REL_IA64_IMM14 0x0001
2344 #define IMAGE_REL_IA64_IMM22 0x0002
2345 #define IMAGE_REL_IA64_IMM64 0x0003
2346 #define IMAGE_REL_IA64_DIR 0x0004
2347 #define IMAGE_REL_IA64_DIR64 0x0005
2348 #define IMAGE_REL_IA64_PCREL21B 0x0006
2349 #define IMAGE_REL_IA64_PCREL21M 0x0007
2350 #define IMAGE_REL_IA64_PCREL21F 0x0008
2351 #define IMAGE_REL_IA64_GPREL22 0x0009
2352 #define IMAGE_REL_IA64_LTOFF22 0x000A
2353 #define IMAGE_REL_IA64_SECTION 0x000B
2354 #define IMAGE_REL_IA64_SECREL22 0x000C
2355 #define IMAGE_REL_IA64_SECREL64I 0x000D
2356 #define IMAGE_REL_IA64_SECREL 0x000E
2357 #define IMAGE_REL_IA64_LTOFF64 0x000F
2358 #define IMAGE_REL_IA64_DIR32NB 0x0010
2359 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2360 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2361 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2362 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2363 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2364 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2365 #define IMAGE_REL_IA64_ADDEND 0x001F
2367 /* archive format */
2369 #define IMAGE_ARCHIVE_START_SIZE 8
2370 #define IMAGE_ARCHIVE_START "!<arch>\n"
2371 #define IMAGE_ARCHIVE_END "`\n"
2372 #define IMAGE_ARCHIVE_PAD "\n"
2373 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2374 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2376 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2385 } IMAGE_ARCHIVE_MEMBER_HEADER
, *PIMAGE_ARCHIVE_MEMBER_HEADER
;
2387 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2390 * Resource directory stuff
2392 typedef struct _IMAGE_RESOURCE_DIRECTORY
{
2393 DWORD Characteristics
;
2394 DWORD TimeDateStamp
;
2397 WORD NumberOfNamedEntries
;
2398 WORD NumberOfIdEntries
;
2399 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2400 } IMAGE_RESOURCE_DIRECTORY
,*PIMAGE_RESOURCE_DIRECTORY
;
2402 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2403 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2405 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY
{
2408 #ifdef BITFIELDS_BIGENDIAN
2409 unsigned NameIsString
:1;
2410 unsigned NameOffset
:31;
2412 unsigned NameOffset
:31;
2413 unsigned NameIsString
:1;
2418 #ifdef WORDS_BIGENDIAN
2430 #ifdef BITFIELDS_BIGENDIAN
2431 unsigned DataIsDirectory
:1;
2432 unsigned OffsetToDirectory
:31;
2434 unsigned OffsetToDirectory
:31;
2435 unsigned DataIsDirectory
:1;
2439 } IMAGE_RESOURCE_DIRECTORY_ENTRY
,*PIMAGE_RESOURCE_DIRECTORY_ENTRY
;
2442 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING
{
2444 CHAR NameString
[ 1 ];
2445 } IMAGE_RESOURCE_DIRECTORY_STRING
,*PIMAGE_RESOURCE_DIRECTORY_STRING
;
2447 typedef struct _IMAGE_RESOURCE_DIR_STRING_U
{
2449 WCHAR NameString
[ 1 ];
2450 } IMAGE_RESOURCE_DIR_STRING_U
,*PIMAGE_RESOURCE_DIR_STRING_U
;
2452 typedef struct _IMAGE_RESOURCE_DATA_ENTRY
{
2457 } IMAGE_RESOURCE_DATA_ENTRY
,*PIMAGE_RESOURCE_DATA_ENTRY
;
2460 typedef VOID (CALLBACK
*PIMAGE_TLS_CALLBACK
)(
2461 LPVOID DllHandle
,DWORD Reason
,LPVOID Reserved
2464 typedef struct _IMAGE_TLS_DIRECTORY
{
2465 DWORD StartAddressOfRawData
;
2466 DWORD EndAddressOfRawData
;
2467 LPDWORD AddressOfIndex
;
2468 PIMAGE_TLS_CALLBACK
*AddressOfCallBacks
;
2469 DWORD SizeOfZeroFill
;
2470 DWORD Characteristics
;
2471 } IMAGE_TLS_DIRECTORY
,*PIMAGE_TLS_DIRECTORY
;
2473 typedef struct _IMAGE_DEBUG_DIRECTORY
{
2474 DWORD Characteristics
;
2475 DWORD TimeDateStamp
;
2480 DWORD AddressOfRawData
;
2481 DWORD PointerToRawData
;
2482 } IMAGE_DEBUG_DIRECTORY
, *PIMAGE_DEBUG_DIRECTORY
;
2484 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2485 #define IMAGE_DEBUG_TYPE_COFF 1
2486 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2487 #define IMAGE_DEBUG_TYPE_FPO 3
2488 #define IMAGE_DEBUG_TYPE_MISC 4
2489 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2490 #define IMAGE_DEBUG_TYPE_FIXUP 6
2491 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2492 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2493 #define IMAGE_DEBUG_TYPE_BORLAND 9
2494 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2496 typedef struct _IMAGE_COFF_SYMBOLS_HEADER
{
2497 DWORD NumberOfSymbols
;
2498 DWORD LvaToFirstSymbol
;
2499 DWORD NumberOfLinenumbers
;
2500 DWORD LvaToFirstLinenumber
;
2501 DWORD RvaToFirstByteOfCode
;
2502 DWORD RvaToLastByteOfCode
;
2503 DWORD RvaToFirstByteOfData
;
2504 DWORD RvaToLastByteOfData
;
2505 } IMAGE_COFF_SYMBOLS_HEADER
, *PIMAGE_COFF_SYMBOLS_HEADER
;
2508 #define FRAME_TRAP 1
2510 #define FRAME_NONFPO 3
2512 typedef struct _FPO_DATA
{
2523 } FPO_DATA
, *PFPO_DATA
;
2525 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY
{
2527 DWORD TimeDateStamp
;
2530 DWORD GlobalFlagsClear
;
2531 DWORD GlobalFlagsSet
;
2532 DWORD CriticalSectionDefaultTimeout
;
2533 DWORD DeCommitFreeBlockThreshold
;
2534 DWORD DeCommitTotalFreeThreshold
;
2535 PVOID LockPrefixTable
;
2536 DWORD MaximumAllocationSize
;
2537 DWORD VirtualMemoryThreshold
;
2538 DWORD ProcessHeapFlags
;
2539 DWORD ProcessAffinityMask
;
2543 DWORD SecurityCookie
;
2544 DWORD SEHandlerTable
;
2545 DWORD SEHandlerCount
;
2546 } IMAGE_LOAD_CONFIG_DIRECTORY
, *PIMAGE_LOAD_CONFIG_DIRECTORY
;
2548 typedef struct _IMAGE_FUNCTION_ENTRY
{
2549 DWORD StartingAddress
;
2550 DWORD EndingAddress
;
2551 DWORD EndOfPrologue
;
2552 } IMAGE_FUNCTION_ENTRY
, *PIMAGE_FUNCTION_ENTRY
;
2554 #define IMAGE_DEBUG_MISC_EXENAME 1
2556 typedef struct _IMAGE_DEBUG_MISC
{
2562 } IMAGE_DEBUG_MISC
, *PIMAGE_DEBUG_MISC
;
2564 /* This is the structure that appears at the very start of a .DBG file. */
2566 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER
{
2570 WORD Characteristics
;
2571 DWORD TimeDateStamp
;
2575 DWORD NumberOfSections
;
2576 DWORD ExportedNamesSize
;
2577 DWORD DebugDirectorySize
;
2578 DWORD SectionAlignment
;
2579 DWORD Reserved
[ 2 ];
2580 } IMAGE_SEPARATE_DEBUG_HEADER
,*PIMAGE_SEPARATE_DEBUG_HEADER
;
2582 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2585 typedef struct tagMESSAGE_RESOURCE_ENTRY
{
2589 } MESSAGE_RESOURCE_ENTRY
,*PMESSAGE_RESOURCE_ENTRY
;
2590 #define MESSAGE_RESOURCE_UNICODE 0x0001
2592 typedef struct tagMESSAGE_RESOURCE_BLOCK
{
2595 DWORD OffsetToEntries
;
2596 } MESSAGE_RESOURCE_BLOCK
,*PMESSAGE_RESOURCE_BLOCK
;
2598 typedef struct tagMESSAGE_RESOURCE_DATA
{
2599 DWORD NumberOfBlocks
;
2600 MESSAGE_RESOURCE_BLOCK Blocks
[ 1 ];
2601 } MESSAGE_RESOURCE_DATA
,*PMESSAGE_RESOURCE_DATA
;
2604 * Here follows typedefs for security and tokens.
2608 * First a constant for the following typedefs.
2611 #define ANYSIZE_ARRAY 1
2613 /* FIXME: Orphan. What does it point to? */
2614 typedef PVOID PACCESS_TOKEN
;
2615 typedef PVOID PSECURITY_DESCRIPTOR
;
2619 * TOKEN_INFORMATION_CLASS
2622 typedef enum _TOKEN_INFORMATION_CLASS
{
2631 TokenImpersonationLevel
,
2633 TokenRestrictedSids
,
2635 TokenGroupsAndPrivileges
,
2636 TokenSessionReference
,
2638 } TOKEN_INFORMATION_CLASS
;
2640 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
2641 #define TOKEN_ADJUST_GROUPS 0x0040
2642 #define TOKEN_ADJUST_PRIVILEGES 0x0020
2643 #define TOKEN_ADJUST_SESSIONID 0x0100
2644 #define TOKEN_ASSIGN_PRIMARY 0x0001
2645 #define TOKEN_DUPLICATE 0x0002
2646 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
2647 #define TOKEN_IMPERSONATE 0x0004
2648 #define TOKEN_QUERY 0x0008
2649 #define TOKEN_QUERY_SOURCE 0x0010
2650 #define TOKEN_ADJUST_DEFAULT 0x0080
2651 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
2652 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
2653 TOKEN_ADJUST_PRIVILEGES | \
2654 TOKEN_ADJUST_GROUPS | \
2655 TOKEN_ADJUST_DEFAULT )
2656 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2657 TOKEN_ASSIGN_PRIMARY | \
2659 TOKEN_IMPERSONATE | \
2661 TOKEN_QUERY_SOURCE | \
2662 TOKEN_ADJUST_PRIVILEGES | \
2663 TOKEN_ADJUST_GROUPS | \
2664 TOKEN_ADJUST_SESSIONID | \
2665 TOKEN_ADJUST_DEFAULT )
2667 #ifndef _SECURITY_DEFINED
2668 #define _SECURITY_DEFINED
2671 typedef DWORD ACCESS_MASK
, *PACCESS_MASK
;
2673 typedef struct _GENERIC_MAPPING
{
2674 ACCESS_MASK GenericRead
;
2675 ACCESS_MASK GenericWrite
;
2676 ACCESS_MASK GenericExecute
;
2677 ACCESS_MASK GenericAll
;
2678 } GENERIC_MAPPING
, *PGENERIC_MAPPING
;
2680 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2681 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2684 } SID_IDENTIFIER_AUTHORITY
, *PSID_IDENTIFIER_AUTHORITY
;
2685 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2689 typedef struct _SID
{
2691 BYTE SubAuthorityCount
;
2692 SID_IDENTIFIER_AUTHORITY IdentifierAuthority
;
2693 DWORD SubAuthority
[1];
2695 #endif /* !defined(SID_DEFINED) */
2697 #define SID_REVISION (1) /* Current revision */
2698 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2699 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2706 #define ACL_REVISION1 1
2707 #define ACL_REVISION2 2
2708 #define ACL_REVISION3 3
2709 #define ACL_REVISION4 4
2711 #define MIN_ACL_REVISION ACL_REVISION2
2712 #define MAX_ACL_REVISION ACL_REVISION4
2714 typedef struct _ACL
{
2722 typedef enum _ACL_INFORMATION_CLASS
2724 AclRevisionInformation
= 1,
2726 } ACL_INFORMATION_CLASS
;
2728 typedef struct _ACL_REVISION_INFORMATION
2731 } ACL_REVISION_INFORMATION
, *PACL_REVISION_INFORMATION
;
2733 typedef struct _ACL_SIZE_INFORMATION
2736 DWORD AclBytesInUse
;
2738 } ACL_SIZE_INFORMATION
, *PACL_SIZE_INFORMATION
;
2740 /* SECURITY_DESCRIPTOR */
2741 #define SECURITY_DESCRIPTOR_REVISION 1
2742 #define SECURITY_DESCRIPTOR_REVISION1 1
2748 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
2749 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
2750 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
2751 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
2752 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
2753 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
2754 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
2755 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
2756 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
2757 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
2758 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
2759 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
2760 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
2761 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
2762 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
2763 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
2764 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
2765 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
2766 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
2767 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
2768 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
2769 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
2770 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
2771 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
2772 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
2773 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
2774 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
2775 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
2776 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
2778 #define SE_GROUP_MANDATORY 0x00000001
2779 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
2780 #define SE_GROUP_ENABLED 0x00000004
2781 #define SE_GROUP_OWNER 0x00000008
2782 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
2783 #define SE_GROUP_LOGON_ID 0xC0000000
2784 #define SE_GROUP_RESOURCE 0x20000000
2786 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
2787 #define SE_PRIVILEGE_ENABLED 0x00000002
2788 #define SE_PRIVILEGE_REMOVE 0x00000004
2789 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2791 #define PRIVILEGE_SET_ALL_NECESSARY 1
2793 #define SE_OWNER_DEFAULTED 0x00000001
2794 #define SE_GROUP_DEFAULTED 0x00000002
2795 #define SE_DACL_PRESENT 0x00000004
2796 #define SE_DACL_DEFAULTED 0x00000008
2797 #define SE_SACL_PRESENT 0x00000010
2798 #define SE_SACL_DEFAULTED 0x00000020
2799 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
2800 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
2801 #define SE_DACL_AUTO_INHERITED 0x00000400
2802 #define SE_SACL_AUTO_INHERITED 0x00000800
2803 #define SE_DACL_PROTECTED 0x00001000
2804 #define SE_SACL_PROTECTED 0x00002000
2805 #define SE_SELF_RELATIVE 0x00008000
2807 typedef DWORD SECURITY_INFORMATION
, *PSECURITY_INFORMATION
;
2808 typedef WORD SECURITY_DESCRIPTOR_CONTROL
, *PSECURITY_DESCRIPTOR_CONTROL
;
2810 /* The security descriptor structure */
2814 SECURITY_DESCRIPTOR_CONTROL Control
;
2819 } SECURITY_DESCRIPTOR_RELATIVE
, *PISECURITY_DESCRIPTOR_RELATIVE
;
2824 SECURITY_DESCRIPTOR_CONTROL Control
;
2829 } SECURITY_DESCRIPTOR
, *PISECURITY_DESCRIPTOR
;
2831 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2833 #endif /* _SECURITY_DEFINED */
2836 * SID_AND_ATTRIBUTES
2839 typedef struct _SID_AND_ATTRIBUTES
{
2842 } SID_AND_ATTRIBUTES
;
2844 /* security entities */
2845 #define SECURITY_NULL_RID (0x00000000L)
2846 #define SECURITY_WORLD_RID (0x00000000L)
2847 #define SECURITY_LOCAL_RID (0X00000000L)
2849 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2852 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2855 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2858 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2859 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2860 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2861 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2862 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2865 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2868 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2869 #define SECURITY_DIALUP_RID 0x00000001L
2870 #define SECURITY_NETWORK_RID 0x00000002L
2871 #define SECURITY_BATCH_RID 0x00000003L
2872 #define SECURITY_INTERACTIVE_RID 0x00000004L
2873 #define SECURITY_LOGON_IDS_RID 0x00000005L
2874 #define SECURITY_SERVICE_RID 0x00000006L
2875 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2876 #define SECURITY_PROXY_RID 0x00000008L
2877 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2878 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2879 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2880 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2881 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2882 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2883 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2884 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2886 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2887 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2888 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2890 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2891 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2892 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2894 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2896 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2902 typedef struct _TOKEN_USER
{
2903 SID_AND_ATTRIBUTES User
;
2904 } TOKEN_USER
, *PTOKEN_USER
;
2910 typedef struct _TOKEN_GROUPS
{
2912 SID_AND_ATTRIBUTES Groups
[ANYSIZE_ARRAY
];
2913 } TOKEN_GROUPS
, *PTOKEN_GROUPS
;
2916 * LUID_AND_ATTRIBUTES
2919 typedef union _LARGE_INTEGER
{
2921 #ifdef WORDS_BIGENDIAN
2929 #ifndef NONAMELESSSTRUCT
2931 #ifdef WORDS_BIGENDIAN
2941 } LARGE_INTEGER
, *PLARGE_INTEGER
;
2943 typedef union _ULARGE_INTEGER
{
2945 #ifdef WORDS_BIGENDIAN
2953 #ifndef NONAMELESSSTRUCT
2955 #ifdef WORDS_BIGENDIAN
2965 } ULARGE_INTEGER
, *PULARGE_INTEGER
;
2968 * Locally Unique Identifier
2971 typedef struct _LUID
{
2976 #include <pshpack4.h>
2977 typedef struct _LUID_AND_ATTRIBUTES
{
2980 } LUID_AND_ATTRIBUTES
, *PLUID_AND_ATTRIBUTES
;
2981 #include <poppack.h>
2987 typedef struct _PRIVILEGE_SET
{
2988 DWORD PrivilegeCount
;
2990 LUID_AND_ATTRIBUTES Privilege
[ANYSIZE_ARRAY
];
2991 } PRIVILEGE_SET
, *PPRIVILEGE_SET
;
2997 typedef struct _TOKEN_PRIVILEGES
{
2998 DWORD PrivilegeCount
;
2999 LUID_AND_ATTRIBUTES Privileges
[ANYSIZE_ARRAY
];
3000 } TOKEN_PRIVILEGES
, *PTOKEN_PRIVILEGES
;
3006 typedef struct _TOKEN_OWNER
{
3008 } TOKEN_OWNER
, *PTOKEN_OWNER
;
3011 * TOKEN_PRIMARY_GROUP
3014 typedef struct _TOKEN_PRIMARY_GROUP
{
3016 } TOKEN_PRIMARY_GROUP
;
3020 * TOKEN_DEFAULT_DACL
3023 typedef struct _TOKEN_DEFAULT_DACL
{
3025 } TOKEN_DEFAULT_DACL
;
3031 #define TOKEN_SOURCE_LENGTH 8
3033 typedef struct _TOKEN_SOURCE
{
3034 char SourceName
[TOKEN_SOURCE_LENGTH
];
3035 LUID SourceIdentifier
;
3042 typedef enum tagTOKEN_TYPE
{
3048 * SECURITY_IMPERSONATION_LEVEL
3051 typedef enum _SECURITY_IMPERSONATION_LEVEL
{
3053 SecurityIdentification
,
3054 SecurityImpersonation
,
3056 } SECURITY_IMPERSONATION_LEVEL
, *PSECURITY_IMPERSONATION_LEVEL
;
3059 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE
,
3060 * PSECURITY_CONTEXT_TRACKING_MODE
;
3062 * Quality of Service
3065 typedef struct _SECURITY_QUALITY_OF_SERVICE
{
3067 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
3068 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode
;
3069 BOOLEAN EffectiveOnly
;
3070 } SECURITY_QUALITY_OF_SERVICE
, *PSECURITY_QUALITY_OF_SERVICE
;
3076 #include <pshpack4.h>
3077 typedef struct _TOKEN_STATISTICS
{
3079 LUID AuthenticationId
;
3080 LARGE_INTEGER ExpirationTime
;
3081 TOKEN_TYPE TokenType
;
3082 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel
;
3083 DWORD DynamicCharged
;
3084 DWORD DynamicAvailable
;
3086 DWORD PrivilegeCount
;
3089 #include <poppack.h>
3095 #define ACL_REVISION 2
3097 #define ACL_REVISION1 1
3098 #define ACL_REVISION2 2
3100 /* ACEs, directly starting after an ACL */
3101 typedef struct _ACE_HEADER
{
3105 } ACE_HEADER
,*PACE_HEADER
;
3108 #define ACCESS_ALLOWED_ACE_TYPE 0
3109 #define ACCESS_DENIED_ACE_TYPE 1
3110 #define SYSTEM_AUDIT_ACE_TYPE 2
3111 #define SYSTEM_ALARM_ACE_TYPE 3
3113 /* inherit AceFlags */
3114 #define OBJECT_INHERIT_ACE 0x01
3115 #define CONTAINER_INHERIT_ACE 0x02
3116 #define NO_PROPAGATE_INHERIT_ACE 0x04
3117 #define INHERIT_ONLY_ACE 0x08
3118 #define INHERITED_ACE 0x10
3119 #define VALID_INHERIT_FLAGS 0x0F
3121 /* AceFlags mask for what events we (should) audit */
3122 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3123 #define FAILED_ACCESS_ACE_FLAG 0x80
3125 /* different ACEs depending on AceType
3126 * SidStart marks the begin of a SID
3127 * so the thing finally looks like this:
3132 typedef struct _ACCESS_ALLOWED_ACE
{
3136 } ACCESS_ALLOWED_ACE
,*PACCESS_ALLOWED_ACE
;
3138 typedef struct _ACCESS_DENIED_ACE
{
3142 } ACCESS_DENIED_ACE
,*PACCESS_DENIED_ACE
;
3144 typedef struct _SYSTEM_AUDIT_ACE
{
3148 } SYSTEM_AUDIT_ACE
,*PSYSTEM_AUDIT_ACE
;
3150 typedef struct _SYSTEM_ALARM_ACE
{
3154 } SYSTEM_ALARM_ACE
,*PSYSTEM_ALARM_ACE
;
3156 typedef enum tagSID_NAME_USE
{
3161 SidTypeWellKnownGroup
,
3162 SidTypeDeletedAccount
,
3165 } SID_NAME_USE
,*PSID_NAME_USE
;
3169 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3171 #define DELETE 0x00010000
3172 #define READ_CONTROL 0x00020000
3173 #define WRITE_DAC 0x00040000
3174 #define WRITE_OWNER 0x00080000
3175 #define SYNCHRONIZE 0x00100000
3176 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3178 #define STANDARD_RIGHTS_READ READ_CONTROL
3179 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3180 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3182 #define STANDARD_RIGHTS_ALL 0x001f0000
3184 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3186 #define GENERIC_READ 0x80000000
3187 #define GENERIC_WRITE 0x40000000
3188 #define GENERIC_EXECUTE 0x20000000
3189 #define GENERIC_ALL 0x10000000
3191 #define MAXIMUM_ALLOWED 0x02000000
3192 #define ACCESS_SYSTEM_SECURITY 0x01000000
3194 #define EVENT_QUERY_STATE 0x0001
3195 #define EVENT_MODIFY_STATE 0x0002
3196 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3198 #define SEMAPHORE_MODIFY_STATE 0x0002
3199 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3201 #define MUTEX_MODIFY_STATE 0x0001
3202 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3204 #define TIMER_QUERY_STATE 0x0001
3205 #define TIMER_MODIFY_STATE 0x0002
3206 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3208 #define PROCESS_TERMINATE 0x0001
3209 #define PROCESS_CREATE_THREAD 0x0002
3210 #define PROCESS_VM_OPERATION 0x0008
3211 #define PROCESS_VM_READ 0x0010
3212 #define PROCESS_VM_WRITE 0x0020
3213 #define PROCESS_DUP_HANDLE 0x0040
3214 #define PROCESS_CREATE_PROCESS 0x0080
3215 #define PROCESS_SET_QUOTA 0x0100
3216 #define PROCESS_SET_INFORMATION 0x0200
3217 #define PROCESS_QUERY_INFORMATION 0x0400
3218 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3220 #define THREAD_TERMINATE 0x0001
3221 #define THREAD_SUSPEND_RESUME 0x0002
3222 #define THREAD_GET_CONTEXT 0x0008
3223 #define THREAD_SET_CONTEXT 0x0010
3224 #define THREAD_SET_INFORMATION 0x0020
3225 #define THREAD_QUERY_INFORMATION 0x0040
3226 #define THREAD_SET_THREAD_TOKEN 0x0080
3227 #define THREAD_IMPERSONATE 0x0100
3228 #define THREAD_DIRECT_IMPERSONATION 0x0200
3229 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3231 #define THREAD_BASE_PRIORITY_LOWRT 15
3232 #define THREAD_BASE_PRIORITY_MAX 2
3233 #define THREAD_BASE_PRIORITY_MIN -2
3234 #define THREAD_BASE_PRIORITY_IDLE -15
3236 #define SECTION_QUERY 0x0001
3237 #define SECTION_MAP_WRITE 0x0002
3238 #define SECTION_MAP_READ 0x0004
3239 #define SECTION_MAP_EXECUTE 0x0008
3240 #define SECTION_EXTEND_SIZE 0x0010
3241 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
3242 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3244 #define FILE_READ_DATA 0x0001 /* file & pipe */
3245 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3246 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3247 #define FILE_ADD_FILE 0x0002 /* directory */
3248 #define FILE_APPEND_DATA 0x0004 /* file */
3249 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3250 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3251 #define FILE_READ_EA 0x0008 /* file & directory */
3252 #define FILE_READ_PROPERTIES FILE_READ_EA
3253 #define FILE_WRITE_EA 0x0010 /* file & directory */
3254 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3255 #define FILE_EXECUTE 0x0020 /* file */
3256 #define FILE_TRAVERSE 0x0020 /* directory */
3257 #define FILE_DELETE_CHILD 0x0040 /* directory */
3258 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3259 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3260 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3262 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3263 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3265 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3266 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3267 FILE_APPEND_DATA | SYNCHRONIZE)
3268 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3269 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3272 /* File attribute flags */
3273 #define FILE_SHARE_READ 0x00000001L
3274 #define FILE_SHARE_WRITE 0x00000002L
3275 #define FILE_SHARE_DELETE 0x00000004L
3277 #define FILE_ATTRIBUTE_READONLY 0x00000001
3278 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3279 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3280 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3281 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3282 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3283 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3284 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3285 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3286 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3287 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3288 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3289 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3291 /* File notification flags */
3292 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3293 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3294 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3295 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3296 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3297 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3298 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3299 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3301 #define FILE_ACTION_ADDED 0x00000001
3302 #define FILE_ACTION_REMOVED 0x00000002
3303 #define FILE_ACTION_MODIFIED 0x00000003
3304 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3305 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3308 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3309 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3310 #define FILE_UNICODE_ON_DISK 0x00000004
3311 #define FILE_PERSISTENT_ACLS 0x00000008
3312 #define FILE_FILE_COMPRESSION 0x00000010
3313 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3314 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
3315 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
3316 #define FILE_NAMED_STREAMS 0x00040000
3317 #define FILE_READ_ONLY_VOLUME 0x00080000
3319 /* File alignments (NT) */
3320 #define FILE_BYTE_ALIGNMENT 0x00000000
3321 #define FILE_WORD_ALIGNMENT 0x00000001
3322 #define FILE_LONG_ALIGNMENT 0x00000003
3323 #define FILE_QUAD_ALIGNMENT 0x00000007
3324 #define FILE_OCTA_ALIGNMENT 0x0000000f
3325 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3326 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3327 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3328 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3329 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3331 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
3332 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
3334 #define REG_NONE 0 /* no type */
3335 #define REG_SZ 1 /* string type (ASCII) */
3336 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3337 #define REG_BINARY 3 /* binary format, callerspecific */
3338 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3339 #define REG_DWORD 4 /* DWORD in little endian format */
3340 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3341 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3342 #define REG_LINK 6 /* symbolic link (UNICODE) */
3343 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3344 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3345 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3346 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3347 #define REG_QWORD 11 /* QWORD in little endian format */
3348 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
3350 /* ----------------------------- begin power management --------------------- */
3352 typedef enum _LATENCY_TIME
{
3355 } LATENCY_TIME
, *PLATENCY_TIME
;
3357 #define DISCHARGE_POLICY_CRITICAL 0
3358 #define DISCHARGE_POLICY_LOW 1
3359 #define NUM_DISCHARGE_POLICIES 4
3361 #define PO_THROTTLE_NONE 0
3362 #define PO_THROTTLE_CONSTANT 1
3363 #define PO_THROTTLE_DEGRADE 2
3364 #define PO_THROTTLE_ADAPTIVE 3
3366 typedef enum _POWER_ACTION
{
3367 PowerActionNone
= 0,
3368 PowerActionReserved
,
3370 PowerActionHibernate
,
3371 PowerActionShutdown
,
3372 PowerActionShutdownReset
,
3373 PowerActionShutdownOff
,
3374 PowerActionWarmEject
3378 typedef enum _SYSTEM_POWER_STATE
{
3379 PowerSystemUnspecified
= 0,
3380 PowerSystemWorking
= 1,
3381 PowerSystemSleeping1
= 2,
3382 PowerSystemSleeping2
= 3,
3383 PowerSystemSleeping3
= 4,
3384 PowerSystemHibernate
= 5,
3385 PowerSystemShutdown
= 6,
3386 PowerSystemMaximum
= 7
3387 } SYSTEM_POWER_STATE
,
3388 *PSYSTEM_POWER_STATE
;
3390 typedef enum _DEVICE_POWER_STATE
{
3391 PowerDeviceUnspecified
,
3397 } DEVICE_POWER_STATE
, *PDEVICE_POWER_STATE
;
3399 typedef enum _POWER_INFORMATION_LEVEL
{
3400 SystemPowerPolicyAc
,
3401 SystemPowerPolicyDc
,
3402 VerifySystemPolicyAc
,
3403 VerifySystemPolicyDc
,
3404 SystemPowerCapabilities
,
3406 SystemPowerStateHandler
,
3407 ProcessorStateHandler
,
3408 SystemPowerPolicyCurrent
,
3409 AdministratorPowerPolicy
,
3410 SystemReserveHiberFile
,
3411 ProcessorInformation
,
3412 SystemPowerInformation
,
3413 ProcessorStateHandler2
,
3416 SystemExecutionState
,
3417 SystemPowerStateNotifyHandler
,
3418 ProcessorPowerPolicyAc
,
3419 ProcessorPowerPolicyDc
,
3420 VerifyProcessorPowerPolicyAc
,
3421 VerifyProcessorPowerPolicyDc
,
3422 ProcessorPowerPolicyCurrent
3423 } POWER_INFORMATION_LEVEL
;
3425 typedef struct _ADMINISTRATOR_POWER_POLICY
{
3426 SYSTEM_POWER_STATE MinSleep
;
3427 SYSTEM_POWER_STATE MaxSleep
;
3428 ULONG MinVideoTimeout
;
3429 ULONG MaxVideoTimeout
;
3430 ULONG MinSpindownTimeout
;
3431 ULONG MaxSpindownTimeout
;
3432 } ADMINISTRATOR_POWER_POLICY
, *PADMINISTRATOR_POWER_POLICY
;
3437 } BATTERY_REPORTING_SCALE
,
3438 *PBATTERY_REPORTING_SCALE
;
3441 POWER_ACTION Action
;
3444 } POWER_ACTION_POLICY
,
3445 *PPOWER_ACTION_POLICY
;
3447 typedef struct _PROCESSOR_POWER_INFORMATION
{
3453 ULONG CurrentIdleState
;
3454 } PROCESSOR_POWER_INFORMATION
,
3455 *PPROCESSOR_POWER_INFORMATION
;
3457 typedef struct _PROCESSOR_POWER_POLICY_INFO
{
3461 UCHAR DemotePercent
;
3462 UCHAR PromotePercent
;
3464 ULONG AllowDemotion
:1;
3465 ULONG AllowPromotion
:1;
3467 } PROCESSOR_POWER_POLICY_INFO
,
3468 *PPROCESSOR_POWER_POLICY_INFO
;
3470 typedef struct _PROCESSOR_POWER_POLICY
{
3472 BYTE DynamicThrottle
;
3474 DWORD DisableCStates
:1;
3477 PROCESSOR_POWER_POLICY_INFO Policy
[3];
3478 } PROCESSOR_POWER_POLICY
,
3479 *PPROCESSOR_POWER_POLICY
;
3483 BOOLEAN BatteryPresent
;
3485 BOOLEAN Discharging
;
3488 ULONG RemainingCapacity
;
3490 ULONG EstimatedTime
;
3491 ULONG DefaultAlert1
;
3492 ULONG DefaultAlert2
;
3493 } SYSTEM_BATTERY_STATE
,
3494 *PSYSTEM_BATTERY_STATE
;
3497 BOOLEAN PowerButtonPresent
;
3498 BOOLEAN SleepButtonPresent
;
3505 BOOLEAN HiberFilePresent
;
3507 BOOLEAN VideoDimPresent
;
3510 BOOLEAN ThermalControl
;
3511 BOOLEAN ProcessorThrottle
;
3512 UCHAR ProcessorMinThrottle
;
3513 UCHAR ProcessorMaxThrottle
;
3515 BOOLEAN DiskSpinDown
;
3517 BOOLEAN SystemBatteriesPresent
;
3518 BOOLEAN BatteriesAreShortTerm
;
3519 BATTERY_REPORTING_SCALE BatteryScale
[3];
3520 SYSTEM_POWER_STATE AcOnLineWake
;
3521 SYSTEM_POWER_STATE SoftLidWake
;
3522 SYSTEM_POWER_STATE RtcWake
;
3523 SYSTEM_POWER_STATE MinDeviceWakeState
;
3524 SYSTEM_POWER_STATE DefaultLowLatencyWake
;
3525 } SYSTEM_POWER_CAPABILITIES
,
3526 *PSYSTEM_POWER_CAPABILITIES
;
3528 typedef struct _SYSTEM_POWER_INFORMATION
{
3529 ULONG MaxIdlenessAllowed
;
3531 ULONG TimeRemaining
;
3533 } SYSTEM_POWER_INFORMATION
,
3534 *PSYSTEM_POWER_INFORMATION
;
3536 typedef struct _SYSTEM_POWER_LEVEL
{
3540 POWER_ACTION_POLICY PowerPolicy
;
3541 SYSTEM_POWER_STATE MinSystemState
;
3542 } SYSTEM_POWER_LEVEL
,
3543 *PSYSTEM_POWER_LEVEL
;
3545 typedef struct _SYSTEM_POWER_POLICY
{
3547 POWER_ACTION_POLICY PowerButton
;
3548 POWER_ACTION_POLICY SleepButton
;
3549 POWER_ACTION_POLICY LidClose
;
3550 SYSTEM_POWER_STATE LidOpenWake
;
3552 POWER_ACTION_POLICY Idle
;
3554 UCHAR IdleSensitivity
;
3555 UCHAR DynamicThrottle
;
3557 SYSTEM_POWER_STATE MinSleep
;
3558 SYSTEM_POWER_STATE MaxSleep
;
3559 SYSTEM_POWER_STATE ReducedLatencySleep
;
3560 ULONG WinLogonFlags
;
3562 ULONG DozeS4Timeout
;
3563 ULONG BroadcastCapacityResolution
;
3564 SYSTEM_POWER_LEVEL DischargePolicy
[NUM_DISCHARGE_POLICIES
];
3566 BOOLEAN VideoDimDisplay
;
3567 ULONG VideoReserved
[3];
3568 ULONG SpindownTimeout
;
3569 BOOLEAN OptimizeForPower
;
3570 UCHAR FanThrottleTolerance
;
3571 UCHAR ForcedThrottle
;
3573 POWER_ACTION_POLICY OverThrottled
;
3574 } SYSTEM_POWER_POLICY
,
3575 *PSYSTEM_POWER_POLICY
;
3577 /* ----------------------------- begin registry ----------------------------- */
3579 /* Registry security values */
3580 #define OWNER_SECURITY_INFORMATION 0x00000001
3581 #define GROUP_SECURITY_INFORMATION 0x00000002
3582 #define DACL_SECURITY_INFORMATION 0x00000004
3583 #define SACL_SECURITY_INFORMATION 0x00000008
3585 #define REG_OPTION_RESERVED 0x00000000
3586 #define REG_OPTION_NON_VOLATILE 0x00000000
3587 #define REG_OPTION_VOLATILE 0x00000001
3588 #define REG_OPTION_CREATE_LINK 0x00000002
3589 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
3590 #define REG_OPTION_OPEN_LINK 0x00000008
3591 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
3592 REG_OPTION_NON_VOLATILE| \
3593 REG_OPTION_VOLATILE| \
3594 REG_OPTION_CREATE_LINK| \
3595 REG_OPTION_BACKUP_RESTORE| \
3596 REG_OPTION_OPEN_LINK)
3599 #define REG_CREATED_NEW_KEY 0x00000001
3600 #define REG_OPENED_EXISTING_KEY 0x00000002
3602 /* For RegNotifyChangeKeyValue */
3603 #define REG_NOTIFY_CHANGE_NAME 0x01
3604 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
3605 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
3606 #define REG_NOTIFY_CHANGE_SECURITY 0x08
3608 #define KEY_QUERY_VALUE 0x00000001
3609 #define KEY_SET_VALUE 0x00000002
3610 #define KEY_CREATE_SUB_KEY 0x00000004
3611 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3612 #define KEY_NOTIFY 0x00000010
3613 #define KEY_CREATE_LINK 0x00000020
3615 /* for RegKeyRestore flags */
3616 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
3617 #define REG_REFRESH_HIVE 0x00000002
3618 #define REG_NO_LAZY_FLUSH 0x00000004
3619 #define REG_FORCE_RESTORE 0x00000008
3621 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3623 KEY_ENUMERATE_SUB_KEYS| \
3627 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3629 KEY_CREATE_SUB_KEY) \
3632 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
3633 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3636 KEY_CREATE_SUB_KEY| \
3637 KEY_ENUMERATE_SUB_KEYS| \
3642 /* ------------------------------ end registry ------------------------------ */
3645 #define EVENTLOG_SUCCESS 0x0000
3646 #define EVENTLOG_ERROR_TYPE 0x0001
3647 #define EVENTLOG_WARNING_TYPE 0x0002
3648 #define EVENTLOG_INFORMATION_TYPE 0x0004
3649 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3650 #define EVENTLOG_AUDIT_FAILURE 0x0010
3652 #define SERVICE_BOOT_START 0x00000000
3653 #define SERVICE_SYSTEM_START 0x00000001
3654 #define SERVICE_AUTO_START 0x00000002
3655 #define SERVICE_DEMAND_START 0x00000003
3656 #define SERVICE_DISABLED 0x00000004
3658 #define SERVICE_ERROR_IGNORE 0x00000000
3659 #define SERVICE_ERROR_NORMAL 0x00000001
3660 #define SERVICE_ERROR_SEVERE 0x00000002
3661 #define SERVICE_ERROR_CRITICAL 0x00000003
3664 #define SERVICE_KERNEL_DRIVER 0x00000001
3665 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3666 #define SERVICE_ADAPTER 0x00000004
3667 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3669 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3670 SERVICE_RECOGNIZER_DRIVER )
3672 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3673 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3674 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3676 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3678 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3679 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3682 typedef enum _CM_SERVICE_NODE_TYPE
3684 DriverType
= SERVICE_KERNEL_DRIVER
,
3685 FileSystemType
= SERVICE_FILE_SYSTEM_DRIVER
,
3686 Win32ServiceOwnProcess
= SERVICE_WIN32_OWN_PROCESS
,
3687 Win32ServiceShareProcess
= SERVICE_WIN32_SHARE_PROCESS
,
3688 AdapterType
= SERVICE_ADAPTER
,
3689 RecognizerType
= SERVICE_RECOGNIZER_DRIVER
3690 } SERVICE_NODE_TYPE
;
3692 typedef enum _CM_SERVICE_LOAD_TYPE
3694 BootLoad
= SERVICE_BOOT_START
,
3695 SystemLoad
= SERVICE_SYSTEM_START
,
3696 AutoLoad
= SERVICE_AUTO_START
,
3697 DemandLoad
= SERVICE_DEMAND_START
,
3698 DisableLoad
= SERVICE_DISABLED
3699 } SERVICE_LOAD_TYPE
;
3701 typedef enum _CM_ERROR_CONTROL_TYPE
3703 IgnoreError
= SERVICE_ERROR_IGNORE
,
3704 NormalError
= SERVICE_ERROR_NORMAL
,
3705 SevereError
= SERVICE_ERROR_SEVERE
,
3706 CriticalError
= SERVICE_ERROR_CRITICAL
3707 } SERVICE_ERROR_TYPE
;
3711 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3712 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3713 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3714 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3715 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3717 #include <guiddef.h>
3719 typedef struct _OBJECT_TYPE_LIST
{
3723 } OBJECT_TYPE_LIST
, *POBJECT_TYPE_LIST
;
3725 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3728 WORD CreatorBackTraceIndex
;
3729 struct _RTL_CRITICAL_SECTION
*CriticalSection
;
3730 LIST_ENTRY ProcessLocksList
;
3732 DWORD ContentionCount
;
3734 } RTL_CRITICAL_SECTION_DEBUG
, *PRTL_CRITICAL_SECTION_DEBUG
, RTL_RESOURCE_DEBUG
, *PRTL_RESOURCE_DEBUG
;
3736 typedef struct _RTL_CRITICAL_SECTION
{
3737 PRTL_CRITICAL_SECTION_DEBUG DebugInfo
;
3739 LONG RecursionCount
;
3740 HANDLE OwningThread
;
3741 HANDLE LockSemaphore
;
3742 ULONG_PTR SpinCount
;
3743 } RTL_CRITICAL_SECTION
, *PRTL_CRITICAL_SECTION
;
3745 typedef VOID (NTAPI
* WAITORTIMERCALLBACKFUNC
) (PVOID
, BOOLEAN
);
3747 #include <pshpack8.h>
3748 typedef struct _IO_COUNTERS
{
3749 ULONGLONG
DECLSPEC_ALIGN(8) ReadOperationCount
;
3750 ULONGLONG
DECLSPEC_ALIGN(8) WriteOperationCount
;
3751 ULONGLONG
DECLSPEC_ALIGN(8) OtherOperationCount
;
3752 ULONGLONG
DECLSPEC_ALIGN(8) ReadTransferCount
;
3753 ULONGLONG
DECLSPEC_ALIGN(8) WriteTransferCount
;
3754 ULONGLONG
DECLSPEC_ALIGN(8) OtherTransferCount
;
3755 } IO_COUNTERS
, *PIO_COUNTERS
;
3756 #include <poppack.h>
3759 DWORD dwOSVersionInfoSize
;
3760 DWORD dwMajorVersion
;
3761 DWORD dwMinorVersion
;
3762 DWORD dwBuildNumber
;
3764 CHAR szCSDVersion
[128];
3765 } OSVERSIONINFOA
, *POSVERSIONINFOA
, *LPOSVERSIONINFOA
;
3768 DWORD dwOSVersionInfoSize
;
3769 DWORD dwMajorVersion
;
3770 DWORD dwMinorVersion
;
3771 DWORD dwBuildNumber
;
3773 WCHAR szCSDVersion
[128];
3774 } OSVERSIONINFOW
, *POSVERSIONINFOW
, *LPOSVERSIONINFOW
, RTL_OSVERSIONINFOW
, *PRTL_OSVERSIONINFOW
;
3776 DECL_WINELIB_TYPE_AW(OSVERSIONINFO
)
3777 DECL_WINELIB_TYPE_AW(POSVERSIONINFO
)
3778 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO
)
3781 DWORD dwOSVersionInfoSize
;
3782 DWORD dwMajorVersion
;
3783 DWORD dwMinorVersion
;
3784 DWORD dwBuildNumber
;
3786 CHAR szCSDVersion
[128];
3787 WORD wServicePackMajor
;
3788 WORD wServicePackMinor
;
3792 } OSVERSIONINFOEXA
, *POSVERSIONINFOEXA
, *LPOSVERSIONINFOEXA
;
3795 DWORD dwOSVersionInfoSize
;
3796 DWORD dwMajorVersion
;
3797 DWORD dwMinorVersion
;
3798 DWORD dwBuildNumber
;
3800 WCHAR szCSDVersion
[128];
3801 WORD wServicePackMajor
;
3802 WORD wServicePackMinor
;
3806 } OSVERSIONINFOEXW
, *POSVERSIONINFOEXW
, *LPOSVERSIONINFOEXW
, RTL_OSVERSIONINFOEXW
, *PRTL_OSVERSIONINFOEXW
;
3808 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX
)
3809 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX
)
3810 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX
)
3812 ULONGLONG WINAPI
VerSetConditionMask(ULONGLONG
,DWORD
,BYTE
);
3814 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
3816 #define VER_PLATFORM_WIN32s 0
3817 #define VER_PLATFORM_WIN32_WINDOWS 1
3818 #define VER_PLATFORM_WIN32_NT 2
3820 #define VER_MINORVERSION 0x00000001
3821 #define VER_MAJORVERSION 0x00000002
3822 #define VER_BUILDNUMBER 0x00000004
3823 #define VER_PLATFORMID 0x00000008
3824 #define VER_SERVICEPACKMINOR 0x00000010
3825 #define VER_SERVICEPACKMAJOR 0x00000020
3826 #define VER_SUITENAME 0x00000040
3827 #define VER_PRODUCT_TYPE 0x00000080
3829 #define VER_NT_WORKSTATION 1
3830 #define VER_NT_DOMAIN_CONTROLLER 2
3831 #define VER_NT_SERVER 3
3833 #define VER_SUITE_SMALLBUSINESS 0x00000001
3834 #define VER_SUITE_ENTERPRISE 0x00000002
3835 #define VER_SUITE_BACKOFFICE 0x00000004
3836 #define VER_SUITE_COMMUNICATIONS 0x00000008
3837 #define VER_SUITE_TERMINAL 0x00000010
3838 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
3839 #define VER_SUITE_EMBEDDEDNT 0x00000040
3840 #define VER_SUITE_DATACENTER 0x00000080
3841 #define VER_SUITE_SINGLEUSERTS 0x00000100
3842 #define VER_SUITE_PERSONAL 0x00000200
3843 #define VER_SUITE_BLADE 0x00000400
3846 #define VER_GREATER 2
3847 #define VER_GREATER_EQUAL 3
3849 #define VER_LESS_EQUAL 5
3853 #endif /* _WINNT_ */