- started infrastructure for proper multi-target support (active
[wine/dibdrv.git] / include / winnt.h
blobeccdaef74dd2d8adce8ac3097427d276f67fdbce
1 /*
2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 #ifndef _WINNT_
22 #define _WINNT_
24 #include <basetsd.h>
26 #ifndef RC_INVOKED
27 #include <ctype.h>
28 #include <stddef.h>
29 #include <string.h>
30 #endif
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))
39 # else
40 # define DECLSPEC_IMPORT
41 # endif
42 #else
43 # define DECLSPEC_IMPORT
44 #endif
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))
51 # else
52 # define DECLSPEC_NORETURN
53 # endif
54 #endif
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)))
61 # else
62 # define DECLSPEC_ALIGN(x)
63 # endif
64 #endif
66 #ifndef DECLSPEC_CACHEALIGN
67 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
68 #endif
70 #ifndef DECLSPEC_UUID
71 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
72 # define DECLSPEC_UUID(x) __declspec(uuid(x))
73 # else
74 # define DECLSPEC_UUID(x)
75 # endif
76 #endif
78 #ifndef DECLSPEC_NOVTABLE
79 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
80 # define DECLSPEC_NOVTABLE __declspec(novtable)
81 # else
82 # define DECLSPEC_NOVTABLE
83 # endif
84 #endif
86 #ifndef DECLSPEC_SELECTANY
87 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
88 #define DECLSPEC_SELECTANY __declspec(selectany)
89 #else
90 #define DECLSPEC_SELECTANY
91 #endif
92 #endif
94 #ifndef NOP_FUNCTION
95 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
96 # define NOP_FUNCTION __noop
97 # else
98 # define NOP_FUNCTION (void)0
99 # endif
100 #endif
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)
105 # else
106 # define DECLSPEC_ADDRSAFE
107 # endif
108 #endif
110 #ifndef FORCEINLINE
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))
115 # else
116 # define FORCEINLINE inline
117 # endif
118 #endif
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
127 # else
128 # define DECLSPEC_DEPRECATED
129 # undef DEPRECATE_SUPPORTED
130 # endif
131 #endif
133 /* Anonymous union/struct handling */
135 #ifndef NONAMELESSSTRUCT
136 # ifdef __GNUC__
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
140 # endif
141 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
142 # define NONAMELESSSTRUCT
143 # endif
144 #endif /* NONAMELESSSTRUCT */
146 #ifndef NONAMELESSUNION
147 # ifdef __GNUC__
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
151 # endif
152 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
153 # define NONAMELESSUNION
154 # endif
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
202 # else
203 # define RESTRICTED_POINTER
204 # endif
205 #else
206 # define RESTRICTED_POINTER
207 #endif
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
213 # ifdef _WIN64
214 # define UNALIGNED64 __unaligned
215 # else
216 # define UNALIGNED64
217 # endif
218 #else
219 # define UNALIGNED
220 # define UNALIGNED64
221 #endif
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
228 #else
229 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
230 #define MEMORY_ALLOCATION_ALIGNMENT 8
231 #endif
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)
237 #else
238 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
239 #endif
241 #ifdef _WIN64
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)
246 #else
247 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
248 #endif
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]
256 #endif
258 /* Eliminate Microsoft C/C++ compiler warning 4715 */
259 #if (_MSC_VER > 1200)
260 # define DEFAULT_UNREACHABLE default: __assume(0)
261 #else
262 # define DEFAULT_UNREACHABLE
263 #endif
265 /* Error Masks */
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 */
274 #ifdef __cplusplus
275 # define EXTERN_C extern "C"
276 #else
277 # define EXTERN_C extern
278 #endif
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 */
295 #ifndef VOID
296 #define VOID void
297 #endif
298 typedef VOID *PVOID;
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;
307 #else
308 typedef unsigned short WCHAR, *PWCHAR;
309 #endif
311 /* 'Extended/Wide' numerical types */
312 #ifndef _ULONGLONG_
313 # define _ULONGLONG_
314 # ifdef _MSC_VER
315 typedef signed __int64 LONGLONG, *PLONGLONG;
316 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
317 # else
318 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
319 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
320 # endif
321 #endif
323 #ifndef _DWORDLONG_
324 # define _DWORDLONG_
325 # ifdef _MSC_VER
326 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
327 # else
328 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
329 # endif
330 #endif
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.
349 #ifndef __WINESRC__
350 # ifdef UNICODE
351 # ifndef _TCHAR_DEFINED
352 typedef WCHAR TCHAR, *PTCHAR;
353 # define _TCHAR_DEFINED
354 #endif
355 typedef LPWSTR PTSTR, LPTSTR;
356 typedef LPCWSTR PCTSTR, LPCTSTR;
357 # define __TEXT(string) L##string
358 # else /* UNICODE */
359 # ifndef _TCHAR_DEFINED
360 typedef CHAR TCHAR, *PTCHAR;
361 # define _TCHAR_DEFINED
362 # endif
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 */
371 typedef char CCHAR;
372 typedef LONG HRESULT;
373 typedef DWORD LCID, *PLCID;
374 typedef WORD LANGID;
375 typedef DWORD EXECUTION_STATE;
377 /* Handle type */
379 typedef void *HANDLE;
380 typedef HANDLE *PHANDLE, *LPHANDLE;
382 #ifdef STRICT
383 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
384 #else /*STRICT*/
385 #define DECLARE_HANDLE(a) typedef HANDLE a
386 #endif /*STRICT*/
388 /* Defines */
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
484 LPVOID BaseAddress;
485 LPVOID AllocationBase;
486 DWORD AllocationProtect;
487 DWORD RegionSize;
488 DWORD State;
489 DWORD Protect;
490 DWORD Type;
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
514 #ifdef __WINESRC__
515 #define MEM_SYSTEM 0x80000000
516 #endif
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
526 #define MINCHAR 0x80
527 #define MAXCHAR 0x7f
528 #define MINSHORT 0x8000
529 #define MAXSHORT 0x7fff
530 #define MINLONG 0x80000000
531 #define MAXLONG 0x7fffffff
532 #define MAXBYTE 0xff
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)))
542 /* Types */
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;
553 /* Heap flags */
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
584 /* Execution state flags */
585 #define ES_SYSTEM_REQUIRED 0x00000001
586 #define ES_DISPLAY_REQUIRED 0x00000002
587 #define ES_USER_PRESENT 0x00000004
588 #define ES_CONTINUOUS 0x80000000
590 /* The Win32 register context */
592 /* CONTEXT is the CPU-dependent context; it should be used */
593 /* wherever a platform-specific context is needed (e.g. exception */
594 /* handling, Win32 register functions). */
596 /* CONTEXT86 is the i386-specific context; it should be used */
597 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
598 /* Win16 register functions), so that this code can be compiled */
599 /* on all platforms. */
601 #define SIZE_OF_80387_REGISTERS 80
603 typedef struct _FLOATING_SAVE_AREA
605 DWORD ControlWord;
606 DWORD StatusWord;
607 DWORD TagWord;
608 DWORD ErrorOffset;
609 DWORD ErrorSelector;
610 DWORD DataOffset;
611 DWORD DataSelector;
612 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
613 DWORD Cr0NpxState;
614 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
616 #define MAXIMUM_SUPPORTED_EXTENSION 512
618 typedef struct _CONTEXT86
620 DWORD ContextFlags;
622 /* These are selected by CONTEXT_DEBUG_REGISTERS */
623 DWORD Dr0;
624 DWORD Dr1;
625 DWORD Dr2;
626 DWORD Dr3;
627 DWORD Dr6;
628 DWORD Dr7;
630 /* These are selected by CONTEXT_FLOATING_POINT */
631 FLOATING_SAVE_AREA FloatSave;
633 /* These are selected by CONTEXT_SEGMENTS */
634 DWORD SegGs;
635 DWORD SegFs;
636 DWORD SegEs;
637 DWORD SegDs;
639 /* These are selected by CONTEXT_INTEGER */
640 DWORD Edi;
641 DWORD Esi;
642 DWORD Ebx;
643 DWORD Edx;
644 DWORD Ecx;
645 DWORD Eax;
647 /* These are selected by CONTEXT_CONTROL */
648 DWORD Ebp;
649 DWORD Eip;
650 DWORD SegCs;
651 DWORD EFlags;
652 DWORD Esp;
653 DWORD SegSs;
655 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
656 } CONTEXT86;
658 #define CONTEXT_X86 0x00010000
659 #define CONTEXT_i386 CONTEXT_X86
660 #define CONTEXT_i486 CONTEXT_X86
662 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
663 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
664 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
665 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
666 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
667 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
669 /* i386 context definitions */
670 #ifdef __i386__
672 #define CONTEXT_CONTROL CONTEXT86_CONTROL
673 #define CONTEXT_INTEGER CONTEXT86_INTEGER
674 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
675 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
676 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
677 #define CONTEXT_FULL CONTEXT86_FULL
679 typedef CONTEXT86 CONTEXT;
681 #endif /* __i386__ */
683 typedef struct _LDT_ENTRY {
684 WORD LimitLow;
685 WORD BaseLow;
686 union {
687 struct {
688 BYTE BaseMid;
689 BYTE Flags1;
690 BYTE Flags2;
691 BYTE BaseHi;
692 } Bytes;
693 struct {
694 unsigned BaseMid: 8;
695 unsigned Type : 5;
696 unsigned Dpl : 2;
697 unsigned Pres : 1;
698 unsigned LimitHi : 4;
699 unsigned Sys : 1;
700 unsigned Reserved_0 : 1;
701 unsigned Default_Big : 1;
702 unsigned Granularity : 1;
703 unsigned BaseHi : 8;
704 } Bits;
705 } HighWord;
706 } LDT_ENTRY, *PLDT_ENTRY;
708 /* Alpha context definitions */
709 #ifdef _ALPHA_
711 #define CONTEXT_ALPHA 0x00020000
713 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
714 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
715 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
716 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
718 typedef struct _CONTEXT
720 /* selected by CONTEXT_FLOATING_POINT */
721 ULONGLONG FltF0;
722 ULONGLONG FltF1;
723 ULONGLONG FltF2;
724 ULONGLONG FltF3;
725 ULONGLONG FltF4;
726 ULONGLONG FltF5;
727 ULONGLONG FltF6;
728 ULONGLONG FltF7;
729 ULONGLONG FltF8;
730 ULONGLONG FltF9;
731 ULONGLONG FltF10;
732 ULONGLONG FltF11;
733 ULONGLONG FltF12;
734 ULONGLONG FltF13;
735 ULONGLONG FltF14;
736 ULONGLONG FltF15;
737 ULONGLONG FltF16;
738 ULONGLONG FltF17;
739 ULONGLONG FltF18;
740 ULONGLONG FltF19;
741 ULONGLONG FltF20;
742 ULONGLONG FltF21;
743 ULONGLONG FltF22;
744 ULONGLONG FltF23;
745 ULONGLONG FltF24;
746 ULONGLONG FltF25;
747 ULONGLONG FltF26;
748 ULONGLONG FltF27;
749 ULONGLONG FltF28;
750 ULONGLONG FltF29;
751 ULONGLONG FltF30;
752 ULONGLONG FltF31;
754 /* selected by CONTEXT_INTEGER */
755 ULONGLONG IntV0;
756 ULONGLONG IntT0;
757 ULONGLONG IntT1;
758 ULONGLONG IntT2;
759 ULONGLONG IntT3;
760 ULONGLONG IntT4;
761 ULONGLONG IntT5;
762 ULONGLONG IntT6;
763 ULONGLONG IntT7;
764 ULONGLONG IntS0;
765 ULONGLONG IntS1;
766 ULONGLONG IntS2;
767 ULONGLONG IntS3;
768 ULONGLONG IntS4;
769 ULONGLONG IntS5;
770 ULONGLONG IntFp;
771 ULONGLONG IntA0;
772 ULONGLONG IntA1;
773 ULONGLONG IntA2;
774 ULONGLONG IntA3;
775 ULONGLONG IntA4;
776 ULONGLONG IntA5;
777 ULONGLONG IntT8;
778 ULONGLONG IntT9;
779 ULONGLONG IntT10;
780 ULONGLONG IntT11;
781 ULONGLONG IntRa;
782 ULONGLONG IntT12;
783 ULONGLONG IntAt;
784 ULONGLONG IntGp;
785 ULONGLONG IntSp;
786 ULONGLONG IntZero;
788 /* selected by CONTEXT_FLOATING_POINT */
789 ULONGLONG Fpcr;
790 ULONGLONG SoftFpcr;
792 /* selected by CONTEXT_CONTROL */
793 ULONGLONG Fir;
794 DWORD Psr;
795 DWORD ContextFlags;
796 DWORD Fill[4];
797 } CONTEXT;
799 #define _QUAD_PSR_OFFSET HighSoftFpcr
800 #define _QUAD_FLAGS_OFFSET HighFir
802 #endif /* _ALPHA_ */
804 /* Mips context definitions */
805 #ifdef _MIPS_
807 #define CONTEXT_R4000 0x00010000
809 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
810 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
811 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
813 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
815 typedef struct _CONTEXT
817 DWORD Argument[4];
818 /* These are selected by CONTEXT_FLOATING_POINT */
819 DWORD FltF0;
820 DWORD FltF1;
821 DWORD FltF2;
822 DWORD FltF3;
823 DWORD FltF4;
824 DWORD FltF5;
825 DWORD FltF6;
826 DWORD FltF7;
827 DWORD FltF8;
828 DWORD FltF9;
829 DWORD FltF10;
830 DWORD FltF11;
831 DWORD FltF12;
832 DWORD FltF13;
833 DWORD FltF14;
834 DWORD FltF15;
835 DWORD FltF16;
836 DWORD FltF17;
837 DWORD FltF18;
838 DWORD FltF19;
839 DWORD FltF20;
840 DWORD FltF21;
841 DWORD FltF22;
842 DWORD FltF23;
843 DWORD FltF24;
844 DWORD FltF25;
845 DWORD FltF26;
846 DWORD FltF27;
847 DWORD FltF28;
848 DWORD FltF29;
849 DWORD FltF30;
850 DWORD FltF31;
852 /* These are selected by CONTEXT_INTEGER */
853 DWORD IntZero;
854 DWORD IntAt;
855 DWORD IntV0;
856 DWORD IntV1;
857 DWORD IntA0;
858 DWORD IntA1;
859 DWORD IntA2;
860 DWORD IntA3;
861 DWORD IntT0;
862 DWORD IntT1;
863 DWORD IntT2;
864 DWORD IntT3;
865 DWORD IntT4;
866 DWORD IntT5;
867 DWORD IntT6;
868 DWORD IntT7;
869 DWORD IntS0;
870 DWORD IntS1;
871 DWORD IntS2;
872 DWORD IntS3;
873 DWORD IntS4;
874 DWORD IntS5;
875 DWORD IntS6;
876 DWORD IntS7;
877 DWORD IntT8;
878 DWORD IntT9;
879 DWORD IntK0;
880 DWORD IntK1;
881 DWORD IntGp;
882 DWORD IntSp;
883 DWORD IntS8;
884 DWORD IntRa;
885 DWORD IntLo;
886 DWORD IntHi;
888 /* These are selected by CONTEXT_FLOATING_POINT */
889 DWORD Fsr;
891 /* These are selected by CONTEXT_CONTROL */
892 DWORD Fir;
893 DWORD Psr;
895 DWORD ContextFlags;
896 DWORD Fill[2];
897 } CONTEXT;
899 #endif /* _MIPS_ */
901 /* PowerPC context definitions */
902 #ifdef __powerpc__
904 #define CONTEXT_CONTROL 0x0001
905 #define CONTEXT_FLOATING_POINT 0x0002
906 #define CONTEXT_INTEGER 0x0004
907 #define CONTEXT_DEBUG_REGISTERS 0x0008
908 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
910 typedef struct
912 /* These are selected by CONTEXT_FLOATING_POINT */
913 double Fpr0;
914 double Fpr1;
915 double Fpr2;
916 double Fpr3;
917 double Fpr4;
918 double Fpr5;
919 double Fpr6;
920 double Fpr7;
921 double Fpr8;
922 double Fpr9;
923 double Fpr10;
924 double Fpr11;
925 double Fpr12;
926 double Fpr13;
927 double Fpr14;
928 double Fpr15;
929 double Fpr16;
930 double Fpr17;
931 double Fpr18;
932 double Fpr19;
933 double Fpr20;
934 double Fpr21;
935 double Fpr22;
936 double Fpr23;
937 double Fpr24;
938 double Fpr25;
939 double Fpr26;
940 double Fpr27;
941 double Fpr28;
942 double Fpr29;
943 double Fpr30;
944 double Fpr31;
945 double Fpscr;
947 /* These are selected by CONTEXT_INTEGER */
948 DWORD Gpr0;
949 DWORD Gpr1;
950 DWORD Gpr2;
951 DWORD Gpr3;
952 DWORD Gpr4;
953 DWORD Gpr5;
954 DWORD Gpr6;
955 DWORD Gpr7;
956 DWORD Gpr8;
957 DWORD Gpr9;
958 DWORD Gpr10;
959 DWORD Gpr11;
960 DWORD Gpr12;
961 DWORD Gpr13;
962 DWORD Gpr14;
963 DWORD Gpr15;
964 DWORD Gpr16;
965 DWORD Gpr17;
966 DWORD Gpr18;
967 DWORD Gpr19;
968 DWORD Gpr20;
969 DWORD Gpr21;
970 DWORD Gpr22;
971 DWORD Gpr23;
972 DWORD Gpr24;
973 DWORD Gpr25;
974 DWORD Gpr26;
975 DWORD Gpr27;
976 DWORD Gpr28;
977 DWORD Gpr29;
978 DWORD Gpr30;
979 DWORD Gpr31;
981 DWORD Cr;
982 DWORD Xer;
984 /* These are selected by CONTEXT_CONTROL */
985 DWORD Msr;
986 DWORD Iar; /* Instruction Address Register , aka PC ... */
987 DWORD Lr;
988 DWORD Ctr;
990 DWORD ContextFlags;
992 DWORD Dar; /* Fault registers for coredump */
993 DWORD Dsisr;
994 DWORD Trap; /* number of powerpc exception taken */
996 /* These are selected by CONTEXT_DEBUG_REGISTERS */
997 DWORD Dr0;
998 DWORD Dr1;
999 DWORD Dr2;
1000 DWORD Dr3;
1001 DWORD Dr4;
1002 DWORD Dr5;
1003 DWORD Dr6;
1004 DWORD Dr7;
1005 } CONTEXT;
1007 typedef struct _STACK_FRAME_HEADER
1009 DWORD BackChain;
1010 DWORD GlueSaved1;
1011 DWORD GlueSaved2;
1012 DWORD Reserved1;
1013 DWORD Spare1;
1014 DWORD Spare2;
1016 DWORD Parameter0;
1017 DWORD Parameter1;
1018 DWORD Parameter2;
1019 DWORD Parameter3;
1020 DWORD Parameter4;
1021 DWORD Parameter5;
1022 DWORD Parameter6;
1023 DWORD Parameter7;
1024 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1026 #endif /* __powerpc__ */
1028 #ifdef __ALPHA__
1031 * FIXME:
1033 * I have no idea if any of this is right as I just ripped
1034 * it from mingw-win32api.
1038 #define CONTEXT_ALPHA 0x20000
1039 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1040 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1041 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1042 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1043 typedef struct _CONTEXT {
1044 ULONGLONG FltF0;
1045 ULONGLONG FltF1;
1046 ULONGLONG FltF2;
1047 ULONGLONG FltF3;
1048 ULONGLONG FltF4;
1049 ULONGLONG FltF5;
1050 ULONGLONG FltF6;
1051 ULONGLONG FltF7;
1052 ULONGLONG FltF8;
1053 ULONGLONG FltF9;
1054 ULONGLONG FltF10;
1055 ULONGLONG FltF11;
1056 ULONGLONG FltF12;
1057 ULONGLONG FltF13;
1058 ULONGLONG FltF14;
1059 ULONGLONG FltF15;
1060 ULONGLONG FltF16;
1061 ULONGLONG FltF17;
1062 ULONGLONG FltF18;
1063 ULONGLONG FltF19;
1064 ULONGLONG FltF20;
1065 ULONGLONG FltF21;
1066 ULONGLONG FltF22;
1067 ULONGLONG FltF23;
1068 ULONGLONG FltF24;
1069 ULONGLONG FltF25;
1070 ULONGLONG FltF26;
1071 ULONGLONG FltF27;
1072 ULONGLONG FltF28;
1073 ULONGLONG FltF29;
1074 ULONGLONG FltF30;
1075 ULONGLONG FltF31;
1076 ULONGLONG IntV0;
1077 ULONGLONG IntT0;
1078 ULONGLONG IntT1;
1079 ULONGLONG IntT2;
1080 ULONGLONG IntT3;
1081 ULONGLONG IntT4;
1082 ULONGLONG IntT5;
1083 ULONGLONG IntT6;
1084 ULONGLONG IntT7;
1085 ULONGLONG IntS0;
1086 ULONGLONG IntS1;
1087 ULONGLONG IntS2;
1088 ULONGLONG IntS3;
1089 ULONGLONG IntS4;
1090 ULONGLONG IntS5;
1091 ULONGLONG IntFp;
1092 ULONGLONG IntA0;
1093 ULONGLONG IntA1;
1094 ULONGLONG IntA2;
1095 ULONGLONG IntA3;
1096 ULONGLONG IntA4;
1097 ULONGLONG IntA5;
1098 ULONGLONG IntT8;
1099 ULONGLONG IntT9;
1100 ULONGLONG IntT10;
1101 ULONGLONG IntT11;
1102 ULONGLONG IntRa;
1103 ULONGLONG IntT12;
1104 ULONGLONG IntAt;
1105 ULONGLONG IntGp;
1106 ULONGLONG IntSp;
1107 ULONGLONG IntZero;
1108 ULONGLONG Fpcr;
1109 ULONGLONG SoftFpcr;
1110 ULONGLONG Fir;
1111 DWORD Psr;
1112 DWORD ContextFlags;
1113 DWORD Fill[4];
1114 } CONTEXT;
1116 #endif /* __ALPHA__ */
1118 #ifdef __sparc__
1121 * FIXME:
1123 * There is no official CONTEXT structure defined for the SPARC
1124 * architecture, so I just made one up.
1126 * This structure is valid only for 32-bit SPARC architectures,
1127 * not for 64-bit SPARC.
1129 * Note that this structure contains only the 'top-level' registers;
1130 * the rest of the register window chain is not visible.
1132 * The layout follows the Solaris 'prgregset_t' structure.
1136 #define CONTEXT_SPARC 0x10000000
1138 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1139 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1140 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1142 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1144 typedef struct _CONTEXT
1146 DWORD ContextFlags;
1148 /* These are selected by CONTEXT_INTEGER */
1149 DWORD g0;
1150 DWORD g1;
1151 DWORD g2;
1152 DWORD g3;
1153 DWORD g4;
1154 DWORD g5;
1155 DWORD g6;
1156 DWORD g7;
1157 DWORD o0;
1158 DWORD o1;
1159 DWORD o2;
1160 DWORD o3;
1161 DWORD o4;
1162 DWORD o5;
1163 DWORD o6;
1164 DWORD o7;
1165 DWORD l0;
1166 DWORD l1;
1167 DWORD l2;
1168 DWORD l3;
1169 DWORD l4;
1170 DWORD l5;
1171 DWORD l6;
1172 DWORD l7;
1173 DWORD i0;
1174 DWORD i1;
1175 DWORD i2;
1176 DWORD i3;
1177 DWORD i4;
1178 DWORD i5;
1179 DWORD i6;
1180 DWORD i7;
1182 /* These are selected by CONTEXT_CONTROL */
1183 DWORD psr;
1184 DWORD pc;
1185 DWORD npc;
1186 DWORD y;
1187 DWORD wim;
1188 DWORD tbr;
1190 /* FIXME: floating point registers missing */
1192 } CONTEXT;
1194 #endif /* __sparc__ */
1196 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1197 #error You need to define a CONTEXT for your CPU
1198 #endif
1200 typedef CONTEXT *PCONTEXT;
1203 * Language IDs
1206 #define MAKELCID(l, s) (MAKELONG(l, s))
1208 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1209 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1210 #define SUBLANGID(l) ((WORD)(l) >> 10)
1212 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1213 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1215 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1216 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1217 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1218 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1219 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1221 #define UNREFERENCED_PARAMETER(u) (u)
1222 #define DBG_UNREFERENCED_PARAMETER(u) (u)
1223 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (u)
1225 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x28,
1226 * 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x3a, 0x3b, 0x3c
1228 #define LANG_NEUTRAL 0x00
1229 #define LANG_INVARIANT 0x7f
1231 #define LANG_AFRIKAANS 0x36
1232 #define LANG_ALBANIAN 0x1c
1233 #define LANG_ARABIC 0x01
1234 #define LANG_ARMENIAN 0x2b
1235 #define LANG_ASSAMESE 0x4d
1236 #define LANG_AZERI 0x2c
1237 #define LANG_BASQUE 0x2d
1238 #define LANG_BELARUSIAN 0x23
1239 #define LANG_BENGALI 0x45
1240 #define LANG_BULGARIAN 0x02
1241 #define LANG_CATALAN 0x03
1242 #define LANG_CHINESE 0x04
1243 #define LANG_CROATIAN 0x1a
1244 #define LANG_CZECH 0x05
1245 #define LANG_DANISH 0x06
1246 #define LANG_DIVEHI 0x65
1247 #define LANG_DUTCH 0x13
1248 #define LANG_ENGLISH 0x09
1249 #define LANG_ESTONIAN 0x25
1250 #define LANG_FAEROESE 0x38
1251 #define LANG_FARSI 0x29
1252 #define LANG_FINNISH 0x0b
1253 #define LANG_FRENCH 0x0c
1254 #define LANG_GALICIAN 0x56
1255 #define LANG_GEORGIAN 0x37
1256 #define LANG_GERMAN 0x07
1257 #define LANG_GREEK 0x08
1258 #define LANG_GUJARATI 0x47
1259 #define LANG_HEBREW 0x0d
1260 #define LANG_HINDI 0x39
1261 #define LANG_HUNGARIAN 0x0e
1262 #define LANG_ICELANDIC 0x0f
1263 #define LANG_INDONESIAN 0x21
1264 #define LANG_ITALIAN 0x10
1265 #define LANG_JAPANESE 0x11
1266 #define LANG_KANNADA 0x4b
1267 #define LANG_KASHMIRI 0x60
1268 #define LANG_KAZAK 0x3f
1269 #define LANG_KONKANI 0x57
1270 #define LANG_KOREAN 0x12
1271 #define LANG_KYRGYZ 0x40
1272 #define LANG_LATVIAN 0x26
1273 #define LANG_LITHUANIAN 0x27
1274 #define LANG_MACEDONIAN 0x2f
1275 #define LANG_MALAY 0x3e
1276 #define LANG_MALAYALAM 0x4c
1277 #define LANG_MANIPURI 0x58
1278 #define LANG_MARATHI 0x4e
1279 #define LANG_MONGOLIAN 0x50
1280 #define LANG_NEPALI 0x61
1281 #define LANG_NORWEGIAN 0x14
1282 #define LANG_ORIYA 0x48
1283 #define LANG_POLISH 0x15
1284 #define LANG_PORTUGUESE 0x16
1285 #define LANG_PUNJABI 0x46
1286 #define LANG_ROMANIAN 0x18
1287 #define LANG_RUSSIAN 0x19
1288 #define LANG_SANSKRIT 0x4f
1289 #define LANG_SERBIAN 0x1a
1290 #define LANG_SINDHI 0x59
1291 #define LANG_SLOVAK 0x1b
1292 #define LANG_SLOVENIAN 0x24
1293 #define LANG_SPANISH 0x0a
1294 #define LANG_SWAHILI 0x41
1295 #define LANG_SWEDISH 0x1d
1296 #define LANG_SYRIAC 0x5a
1297 #define LANG_TAMIL 0x49
1298 #define LANG_TATAR 0x44
1299 #define LANG_TELUGU 0x4a
1300 #define LANG_THAI 0x1e
1301 #define LANG_TURKISH 0x1f
1302 #define LANG_UKRAINIAN 0x22
1303 #define LANG_URDU 0x20
1304 #define LANG_UZBEK 0x43
1305 #define LANG_VIETNAMESE 0x2a
1307 /* FIXME: these are not in the Windows header */
1308 #define LANG_GAELIC 0x3c
1309 #define LANG_MALTESE 0x3a
1310 #define LANG_MAORI 0x28
1311 #define LANG_RHAETO_ROMANCE 0x17
1312 #define LANG_SAAMI 0x3b
1313 #define LANG_SORBIAN 0x2e
1314 #define LANG_SUTU 0x30
1315 #define LANG_TSONGA 0x31
1316 #define LANG_TSWANA 0x32
1317 #define LANG_VENDA 0x33
1318 #define LANG_XHOSA 0x34
1319 #define LANG_ZULU 0x35
1321 /* non standard; keep the number high enough (but < 0xff) */
1322 #define LANG_ESPERANTO 0x8f
1323 #define LANG_WALON 0x90
1324 #define LANG_CORNISH 0x91
1325 #define LANG_WELSH 0x92
1326 #define LANG_BRETON 0x93
1328 /* Sublanguage definitions */
1329 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1330 #define SUBLANG_DEFAULT 0x01 /* user default */
1331 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1333 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1334 #define SUBLANG_ARABIC_IRAQ 0x02
1335 #define SUBLANG_ARABIC_EGYPT 0x03
1336 #define SUBLANG_ARABIC_LIBYA 0x04
1337 #define SUBLANG_ARABIC_ALGERIA 0x05
1338 #define SUBLANG_ARABIC_MOROCCO 0x06
1339 #define SUBLANG_ARABIC_TUNISIA 0x07
1340 #define SUBLANG_ARABIC_OMAN 0x08
1341 #define SUBLANG_ARABIC_YEMEN 0x09
1342 #define SUBLANG_ARABIC_SYRIA 0x0a
1343 #define SUBLANG_ARABIC_JORDAN 0x0b
1344 #define SUBLANG_ARABIC_LEBANON 0x0c
1345 #define SUBLANG_ARABIC_KUWAIT 0x0d
1346 #define SUBLANG_ARABIC_UAE 0x0e
1347 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1348 #define SUBLANG_ARABIC_QATAR 0x10
1349 #define SUBLANG_AZERI_LATIN 0x01
1350 #define SUBLANG_AZERI_CYRILLIC 0x02
1351 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1352 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1353 #define SUBLANG_CHINESE_HONGKONG 0x03
1354 #define SUBLANG_CHINESE_SINGAPORE 0x04
1355 #define SUBLANG_CHINESE_MACAU 0x05
1356 #define SUBLANG_DUTCH 0x01
1357 #define SUBLANG_DUTCH_BELGIAN 0x02
1358 #define SUBLANG_ENGLISH_US 0x01
1359 #define SUBLANG_ENGLISH_UK 0x02
1360 #define SUBLANG_ENGLISH_AUS 0x03
1361 #define SUBLANG_ENGLISH_CAN 0x04
1362 #define SUBLANG_ENGLISH_NZ 0x05
1363 #define SUBLANG_ENGLISH_EIRE 0x06
1364 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1365 #define SUBLANG_ENGLISH_JAMAICA 0x08
1366 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1367 #define SUBLANG_ENGLISH_BELIZE 0x0a
1368 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1369 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1370 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1371 #define SUBLANG_FRENCH 0x01
1372 #define SUBLANG_FRENCH_BELGIAN 0x02
1373 #define SUBLANG_FRENCH_CANADIAN 0x03
1374 #define SUBLANG_FRENCH_SWISS 0x04
1375 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1376 #define SUBLANG_FRENCH_MONACO 0x06
1377 #define SUBLANG_GERMAN 0x01
1378 #define SUBLANG_GERMAN_SWISS 0x02
1379 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1380 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1381 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1382 #define SUBLANG_ITALIAN 0x01
1383 #define SUBLANG_ITALIAN_SWISS 0x02
1384 #define SUBLANG_KASHMIRI_SASIA 0x02
1385 #define SUBLANG_KASHMIRI_INDIA 0x02
1386 #define SUBLANG_KOREAN 0x01
1387 #define SUBLANG_LITHUANIAN 0x01
1388 #define SUBLANG_MALAY_MALAYSIA 0x01
1389 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1390 #define SUBLANG_NEPALI_INDIA 0x02
1391 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1392 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1393 #define SUBLANG_PORTUGUESE 0x02
1394 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1395 #define SUBLANG_SERBIAN_LATIN 0x02
1396 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1397 #define SUBLANG_SPANISH 0x01
1398 #define SUBLANG_SPANISH_MEXICAN 0x02
1399 #define SUBLANG_SPANISH_MODERN 0x03
1400 #define SUBLANG_SPANISH_GUATEMALA 0x04
1401 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1402 #define SUBLANG_SPANISH_PANAMA 0x06
1403 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1404 #define SUBLANG_SPANISH_VENEZUELA 0x08
1405 #define SUBLANG_SPANISH_COLOMBIA 0x09
1406 #define SUBLANG_SPANISH_PERU 0x0a
1407 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1408 #define SUBLANG_SPANISH_ECUADOR 0x0c
1409 #define SUBLANG_SPANISH_CHILE 0x0d
1410 #define SUBLANG_SPANISH_URUGUAY 0x0e
1411 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1412 #define SUBLANG_SPANISH_BOLIVIA 0x10
1413 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1414 #define SUBLANG_SPANISH_HONDURAS 0x12
1415 #define SUBLANG_SPANISH_NICARAGUA 0x13
1416 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1417 #define SUBLANG_SWEDISH 0x01
1418 #define SUBLANG_SWEDISH_FINLAND 0x02
1419 #define SUBLANG_URDU_PAKISTAN 0x01
1420 #define SUBLANG_URDU_INDIA 0x02
1421 #define SUBLANG_UZBEK_LATIN 0x01
1422 #define SUBLANG_UZBEK_CYRILLIC 0x02
1424 /* FIXME: these are not in the Windows header */
1425 #define SUBLANG_DUTCH_SURINAM 0x03
1426 #define SUBLANG_ROMANIAN 0x01
1427 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1428 #define SUBLANG_RUSSIAN 0x01
1429 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1430 #define SUBLANG_CROATIAN 0x01
1431 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1432 #define SUBLANG_GAELIC 0x01
1433 #define SUBLANG_GAELIC_SCOTTISH 0x02
1434 #define SUBLANG_GAELIC_MANX 0x03
1438 * Sort definitions
1441 #define SORT_DEFAULT 0x0
1442 #define SORT_JAPANESE_XJIS 0x0
1443 #define SORT_JAPANESE_UNICODE 0x1
1444 #define SORT_CHINESE_BIG5 0x0
1445 #define SORT_CHINESE_UNICODE 0x1
1446 #define SORT_KOREAN_KSC 0x0
1447 #define SORT_KOREAN_UNICODE 0x1
1452 * Definitions for IsTextUnicode()
1455 #define IS_TEXT_UNICODE_ASCII16 0x0001
1456 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1457 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1458 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1459 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1460 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1461 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1462 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1463 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1464 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1465 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1466 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1467 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1468 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1469 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1470 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1472 #define MAXIMUM_WAIT_OBJECTS 64
1473 #define MAXIMUM_SUSPEND_COUNT 127
1477 * From OS/2 2.0 exception handling
1478 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1481 #define EH_NONCONTINUABLE 0x01
1482 #define EH_UNWINDING 0x02
1483 #define EH_EXIT_UNWIND 0x04
1484 #define EH_STACK_INVALID 0x08
1485 #define EH_NESTED_CALL 0x10
1487 #define EXCEPTION_CONTINUABLE 0
1488 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1491 * The exception record used by Win32 to give additional information
1492 * about exception to exception handlers.
1495 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1497 typedef struct _EXCEPTION_RECORD
1499 DWORD ExceptionCode;
1500 DWORD ExceptionFlags;
1501 struct _EXCEPTION_RECORD *ExceptionRecord;
1503 PVOID ExceptionAddress;
1504 DWORD NumberParameters;
1505 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1506 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1509 * The exception pointers structure passed to exception filters
1510 * in except() and the UnhandledExceptionFilter().
1513 typedef struct _EXCEPTION_POINTERS
1515 PEXCEPTION_RECORD ExceptionRecord;
1516 PCONTEXT ContextRecord;
1517 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1521 * The exception frame, used for registering exception handlers
1522 * Win32 cares only about this, but compilers generally emit
1523 * larger exception frames for their own use.
1526 struct _EXCEPTION_REGISTRATION_RECORD;
1528 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
1529 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
1531 typedef struct _EXCEPTION_REGISTRATION_RECORD
1533 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
1534 PEXCEPTION_HANDLER Handler;
1535 } EXCEPTION_REGISTRATION_RECORD;
1538 * function pointer to an exception filter
1541 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
1542 typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1543 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1545 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1546 LPTOP_LEVEL_EXCEPTION_FILTER
1547 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1549 typedef struct _NT_TIB
1551 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1552 PVOID StackBase;
1553 PVOID StackLimit;
1554 PVOID SubSystemTib;
1555 union {
1556 PVOID FiberData;
1557 DWORD Version;
1558 } DUMMYUNIONNAME;
1559 PVOID ArbitraryUserPointer;
1560 struct _NT_TIB *Self;
1561 } NT_TIB, *PNT_TIB;
1563 struct _TEB;
1565 #if defined(__i386__) && defined(__GNUC__)
1566 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1567 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1569 struct _TEB *teb;
1570 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1571 return teb;
1573 #elif defined(__i386__) && defined(_MSC_VER)
1574 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1576 struct _TEB *teb;
1577 __asm mov eax, fs:[0x18];
1578 __asm mov teb, eax;
1579 return teb;
1581 #else
1582 extern struct _TEB * WINAPI NtCurrentTeb(void);
1583 #endif
1585 #ifdef NONAMELESSUNION
1586 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
1587 #else
1588 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
1589 #endif
1590 #define GetFiberData() (*(void **)GetCurrentFiber())
1592 #define TLS_MINIMUM_AVAILABLE 64
1595 * File formats definitions
1598 #include <pshpack2.h>
1599 typedef struct _IMAGE_DOS_HEADER {
1600 WORD e_magic; /* 00: MZ Header signature */
1601 WORD e_cblp; /* 02: Bytes on last page of file */
1602 WORD e_cp; /* 04: Pages in file */
1603 WORD e_crlc; /* 06: Relocations */
1604 WORD e_cparhdr; /* 08: Size of header in paragraphs */
1605 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
1606 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
1607 WORD e_ss; /* 0e: Initial (relative) SS value */
1608 WORD e_sp; /* 10: Initial SP value */
1609 WORD e_csum; /* 12: Checksum */
1610 WORD e_ip; /* 14: Initial IP value */
1611 WORD e_cs; /* 16: Initial (relative) CS value */
1612 WORD e_lfarlc; /* 18: File address of relocation table */
1613 WORD e_ovno; /* 1a: Overlay number */
1614 WORD e_res[4]; /* 1c: Reserved words */
1615 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
1616 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
1617 WORD e_res2[10]; /* 28: Reserved words */
1618 DWORD e_lfanew; /* 3c: Offset to extended header */
1619 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
1620 #include <poppack.h>
1622 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1623 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1624 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1625 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1626 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1627 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1630 * This is the Windows executable (NE) header.
1631 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1633 #include <pshpack2.h>
1634 typedef struct
1636 WORD ne_magic; /* 00 NE signature 'NE' */
1637 BYTE ne_ver; /* 02 Linker version number */
1638 BYTE ne_rev; /* 03 Linker revision number */
1639 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
1640 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
1641 LONG ne_crc; /* 08 Checksum */
1642 WORD ne_flags; /* 0c Flags about segments in this file */
1643 WORD ne_autodata; /* 0e Automatic data segment number */
1644 WORD ne_heap; /* 10 Initial size of local heap */
1645 WORD ne_stack; /* 12 Initial size of stack */
1646 DWORD ne_csip; /* 14 Initial CS:IP */
1647 DWORD ne_sssp; /* 18 Initial SS:SP */
1648 WORD ne_cseg; /* 1c # of entries in segment table */
1649 WORD ne_cmod; /* 1e # of entries in module reference tab. */
1650 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
1651 WORD ne_segtab; /* 22 Offset to segment table */
1652 WORD ne_rsrctab; /* 24 Offset to resource table */
1653 WORD ne_restab; /* 26 Offset to resident-name table */
1654 WORD ne_modtab; /* 28 Offset to module reference table */
1655 WORD ne_imptab; /* 2a Offset to imported name table */
1656 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
1657 WORD ne_cmovent; /* 30 # of movable entry points */
1658 WORD ne_align; /* 32 Logical sector alignment shift count */
1659 WORD ne_cres; /* 34 # of resource segments */
1660 BYTE ne_exetyp; /* 36 Flags indicating target OS */
1661 BYTE ne_flagsothers; /* 37 Additional information flags */
1662 WORD ne_pretthunks; /* 38 Offset to return thunks */
1663 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
1664 WORD ne_swaparea; /* 3c Reserved by Microsoft */
1665 WORD ne_expver; /* 3e Expected Windows version number */
1666 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
1667 #include <poppack.h>
1669 #include <pshpack2.h>
1670 typedef struct _IMAGE_VXD_HEADER {
1671 WORD e32_magic;
1672 BYTE e32_border;
1673 BYTE e32_worder;
1674 DWORD e32_level;
1675 WORD e32_cpu;
1676 WORD e32_os;
1677 DWORD e32_ver;
1678 DWORD e32_mflags;
1679 DWORD e32_mpages;
1680 DWORD e32_startobj;
1681 DWORD e32_eip;
1682 DWORD e32_stackobj;
1683 DWORD e32_esp;
1684 DWORD e32_pagesize;
1685 DWORD e32_lastpagesize;
1686 DWORD e32_fixupsize;
1687 DWORD e32_fixupsum;
1688 DWORD e32_ldrsize;
1689 DWORD e32_ldrsum;
1690 DWORD e32_objtab;
1691 DWORD e32_objcnt;
1692 DWORD e32_objmap;
1693 DWORD e32_itermap;
1694 DWORD e32_rsrctab;
1695 DWORD e32_rsrccnt;
1696 DWORD e32_restab;
1697 DWORD e32_enttab;
1698 DWORD e32_dirtab;
1699 DWORD e32_dircnt;
1700 DWORD e32_fpagetab;
1701 DWORD e32_frectab;
1702 DWORD e32_impmod;
1703 DWORD e32_impmodcnt;
1704 DWORD e32_impproc;
1705 DWORD e32_pagesum;
1706 DWORD e32_datapage;
1707 DWORD e32_preload;
1708 DWORD e32_nrestab;
1709 DWORD e32_cbnrestab;
1710 DWORD e32_nressum;
1711 DWORD e32_autodata;
1712 DWORD e32_debuginfo;
1713 DWORD e32_debuglen;
1714 DWORD e32_instpreload;
1715 DWORD e32_instdemand;
1716 DWORD e32_heapsize;
1717 BYTE e32_res3[12];
1718 DWORD e32_winresoff;
1719 DWORD e32_winreslen;
1720 WORD e32_devid;
1721 WORD e32_ddkver;
1722 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
1723 #include <poppack.h>
1725 /* These defines describe the meanings of the bits in the Characteristics
1726 field */
1728 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1729 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1730 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1731 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1732 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
1733 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
1734 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1735 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1736 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1737 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1738 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
1739 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
1740 #define IMAGE_FILE_SYSTEM 0x1000
1741 #define IMAGE_FILE_DLL 0x2000
1742 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
1743 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1745 /* These are the settings of the Machine field. */
1746 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1747 #define IMAGE_FILE_MACHINE_I860 0x014d
1748 #define IMAGE_FILE_MACHINE_I386 0x014c
1749 #define IMAGE_FILE_MACHINE_R3000 0x0162
1750 #define IMAGE_FILE_MACHINE_R4000 0x0166
1751 #define IMAGE_FILE_MACHINE_R10000 0x0168
1752 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
1753 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
1754 #define IMAGE_FILE_MACHINE_SH3 0x01a2
1755 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
1756 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1757 #define IMAGE_FILE_MACHINE_SH4 0x01a6
1758 #define IMAGE_FILE_MACHINE_SH5 0x01a8
1759 #define IMAGE_FILE_MACHINE_ARM 0x01c0
1760 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
1761 #define IMAGE_FILE_MACHINE_AM33 0x01d3
1762 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
1763 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
1764 #define IMAGE_FILE_MACHINE_IA64 0x0200
1765 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
1766 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1767 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
1768 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
1769 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1770 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1771 #define IMAGE_FILE_MACHINE_CEF 0x0cef
1772 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
1773 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1774 #define IMAGE_FILE_MACHINE_M32R 0x9041
1775 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
1777 #define IMAGE_SIZEOF_FILE_HEADER 20
1778 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1779 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1780 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1781 #define IMAGE_SIZEOF_SHORT_NAME 8
1782 #define IMAGE_SIZEOF_SECTION_HEADER 40
1783 #define IMAGE_SIZEOF_SYMBOL 18
1784 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1785 #define IMAGE_SIZEOF_RELOCATION 10
1786 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1787 #define IMAGE_SIZEOF_LINENUMBER 6
1788 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1790 /* Possible Magic values */
1791 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1792 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1794 /* These are indexes into the DataDirectory array */
1795 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1796 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1797 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1798 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1799 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1800 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1801 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1802 #define IMAGE_FILE_DESCRIPTION_STRING 7
1803 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1804 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1805 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1807 /* Directory Entries, indices into the DataDirectory array */
1809 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1810 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1811 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1812 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1813 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1814 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1815 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1816 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1817 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1818 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1819 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1820 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1821 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1822 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1823 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1825 /* Subsystem Values */
1827 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1828 #define IMAGE_SUBSYSTEM_NATIVE 1
1829 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1830 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
1831 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1832 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1833 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
1834 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
1835 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1836 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1837 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1838 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1839 #define IMAGE_SUBSYSTEM_XBOX 14
1841 typedef struct _IMAGE_FILE_HEADER {
1842 WORD Machine;
1843 WORD NumberOfSections;
1844 DWORD TimeDateStamp;
1845 DWORD PointerToSymbolTable;
1846 DWORD NumberOfSymbols;
1847 WORD SizeOfOptionalHeader;
1848 WORD Characteristics;
1849 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
1851 typedef struct _IMAGE_DATA_DIRECTORY {
1852 DWORD VirtualAddress;
1853 DWORD Size;
1854 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
1856 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1858 typedef struct _IMAGE_OPTIONAL_HEADER {
1860 /* Standard fields */
1862 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
1863 BYTE MajorLinkerVersion;
1864 BYTE MinorLinkerVersion;
1865 DWORD SizeOfCode;
1866 DWORD SizeOfInitializedData;
1867 DWORD SizeOfUninitializedData;
1868 DWORD AddressOfEntryPoint; /* 0x10 */
1869 DWORD BaseOfCode;
1870 DWORD BaseOfData;
1872 /* NT additional fields */
1874 DWORD ImageBase;
1875 DWORD SectionAlignment; /* 0x20 */
1876 DWORD FileAlignment;
1877 WORD MajorOperatingSystemVersion;
1878 WORD MinorOperatingSystemVersion;
1879 WORD MajorImageVersion;
1880 WORD MinorImageVersion;
1881 WORD MajorSubsystemVersion; /* 0x30 */
1882 WORD MinorSubsystemVersion;
1883 DWORD Win32VersionValue;
1884 DWORD SizeOfImage;
1885 DWORD SizeOfHeaders;
1886 DWORD CheckSum; /* 0x40 */
1887 WORD Subsystem;
1888 WORD DllCharacteristics;
1889 DWORD SizeOfStackReserve;
1890 DWORD SizeOfStackCommit;
1891 DWORD SizeOfHeapReserve; /* 0x50 */
1892 DWORD SizeOfHeapCommit;
1893 DWORD LoaderFlags;
1894 DWORD NumberOfRvaAndSizes;
1895 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
1896 /* 0xE0 */
1897 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
1899 typedef struct _IMAGE_NT_HEADERS {
1900 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
1901 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
1902 IMAGE_OPTIONAL_HEADER OptionalHeader; /* 0x18 */
1903 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
1905 #define IMAGE_SIZEOF_SHORT_NAME 8
1907 typedef struct _IMAGE_SECTION_HEADER {
1908 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
1909 union {
1910 DWORD PhysicalAddress;
1911 DWORD VirtualSize;
1912 } Misc;
1913 DWORD VirtualAddress;
1914 DWORD SizeOfRawData;
1915 DWORD PointerToRawData;
1916 DWORD PointerToRelocations;
1917 DWORD PointerToLinenumbers;
1918 WORD NumberOfRelocations;
1919 WORD NumberOfLinenumbers;
1920 DWORD Characteristics;
1921 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
1923 #define IMAGE_SIZEOF_SECTION_HEADER 40
1925 #define IMAGE_FIRST_SECTION(ntheader) \
1926 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1927 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1929 /* These defines are for the Characteristics bitfield. */
1930 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1931 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1932 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1933 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1934 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
1935 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1937 #define IMAGE_SCN_CNT_CODE 0x00000020
1938 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1939 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1941 #define IMAGE_SCN_LNK_OTHER 0x00000100
1942 #define IMAGE_SCN_LNK_INFO 0x00000200
1943 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1944 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1945 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1947 /* 0x00002000 - Reserved */
1948 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1949 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1951 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1952 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1953 #define IMAGE_SCN_MEM_16BIT 0x00020000
1954 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1955 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1957 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1958 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1959 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1960 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1961 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1962 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1963 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1964 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
1965 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
1966 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
1967 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
1968 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
1969 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
1970 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
1971 /* 0x00F00000 - Unused */
1972 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
1974 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1977 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1978 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1979 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1980 #define IMAGE_SCN_MEM_SHARED 0x10000000
1981 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1982 #define IMAGE_SCN_MEM_READ 0x40000000
1983 #define IMAGE_SCN_MEM_WRITE 0x80000000
1985 #include <pshpack2.h>
1987 typedef struct _IMAGE_SYMBOL {
1988 union {
1989 BYTE ShortName[8];
1990 struct {
1991 DWORD Short;
1992 DWORD Long;
1993 } Name;
1994 DWORD LongName[2];
1995 } N;
1996 DWORD Value;
1997 SHORT SectionNumber;
1998 WORD Type;
1999 BYTE StorageClass;
2000 BYTE NumberOfAuxSymbols;
2001 } IMAGE_SYMBOL;
2002 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
2004 #define IMAGE_SIZEOF_SYMBOL 18
2006 typedef struct _IMAGE_LINENUMBER {
2007 union {
2008 DWORD SymbolTableIndex;
2009 DWORD VirtualAddress;
2010 } Type;
2011 WORD Linenumber;
2012 } IMAGE_LINENUMBER;
2013 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
2015 #define IMAGE_SIZEOF_LINENUMBER 6
2017 typedef union _IMAGE_AUX_SYMBOL {
2018 struct {
2019 DWORD TagIndex;
2020 union {
2021 struct {
2022 WORD Linenumber;
2023 WORD Size;
2024 } LnSz;
2025 DWORD TotalSize;
2026 } Misc;
2027 union {
2028 struct {
2029 DWORD PointerToLinenumber;
2030 DWORD PointerToNextFunction;
2031 } Function;
2032 struct {
2033 WORD Dimension[4];
2034 } Array;
2035 } FcnAry;
2036 WORD TvIndex;
2037 } Sym;
2038 struct {
2039 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2040 } File;
2041 struct {
2042 DWORD Length;
2043 WORD NumberOfRelocations;
2044 WORD NumberOfLinenumbers;
2045 DWORD CheckSum;
2046 SHORT Number;
2047 BYTE Selection;
2048 } Section;
2049 } IMAGE_AUX_SYMBOL;
2050 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2052 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2054 #include <poppack.h>
2056 #define IMAGE_SYM_UNDEFINED (SHORT)0
2057 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2058 #define IMAGE_SYM_DEBUG (SHORT)-2
2060 #define IMAGE_SYM_TYPE_NULL 0x0000
2061 #define IMAGE_SYM_TYPE_VOID 0x0001
2062 #define IMAGE_SYM_TYPE_CHAR 0x0002
2063 #define IMAGE_SYM_TYPE_SHORT 0x0003
2064 #define IMAGE_SYM_TYPE_INT 0x0004
2065 #define IMAGE_SYM_TYPE_LONG 0x0005
2066 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2067 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2068 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2069 #define IMAGE_SYM_TYPE_UNION 0x0009
2070 #define IMAGE_SYM_TYPE_ENUM 0x000A
2071 #define IMAGE_SYM_TYPE_MOE 0x000B
2072 #define IMAGE_SYM_TYPE_BYTE 0x000C
2073 #define IMAGE_SYM_TYPE_WORD 0x000D
2074 #define IMAGE_SYM_TYPE_UINT 0x000E
2075 #define IMAGE_SYM_TYPE_DWORD 0x000F
2076 #define IMAGE_SYM_TYPE_PCODE 0x8000
2078 #define IMAGE_SYM_DTYPE_NULL 0
2079 #define IMAGE_SYM_DTYPE_POINTER 1
2080 #define IMAGE_SYM_DTYPE_FUNCTION 2
2081 #define IMAGE_SYM_DTYPE_ARRAY 3
2083 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2084 #define IMAGE_SYM_CLASS_NULL 0x0000
2085 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2086 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2087 #define IMAGE_SYM_CLASS_STATIC 0x0003
2088 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2089 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2090 #define IMAGE_SYM_CLASS_LABEL 0x0006
2091 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2092 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2093 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2094 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2095 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2096 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2097 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2098 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2099 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2100 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2101 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2102 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2104 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2105 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2106 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2107 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2108 #define IMAGE_SYM_CLASS_FILE 0x0067
2109 #define IMAGE_SYM_CLASS_SECTION 0x0068
2110 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2112 #define N_BTMASK 0x000F
2113 #define N_TMASK 0x0030
2114 #define N_TMASK1 0x00C0
2115 #define N_TMASK2 0x00F0
2116 #define N_BTSHFT 4
2117 #define N_TSHIFT 2
2119 #define BTYPE(x) ((x) & N_BTMASK)
2121 #ifndef ISPTR
2122 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2123 #endif
2125 #ifndef ISFCN
2126 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2127 #endif
2129 #ifndef ISARY
2130 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2131 #endif
2133 #ifndef ISTAG
2134 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2135 #endif
2137 #ifndef INCREF
2138 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2139 #endif
2140 #ifndef DECREF
2141 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2142 #endif
2144 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2145 #define IMAGE_COMDAT_SELECT_ANY 2
2146 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2147 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2148 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2149 #define IMAGE_COMDAT_SELECT_LARGEST 6
2150 #define IMAGE_COMDAT_SELECT_NEWEST 7
2152 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2153 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2154 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2156 /* Export module directory */
2158 typedef struct _IMAGE_EXPORT_DIRECTORY {
2159 DWORD Characteristics;
2160 DWORD TimeDateStamp;
2161 WORD MajorVersion;
2162 WORD MinorVersion;
2163 DWORD Name;
2164 DWORD Base;
2165 DWORD NumberOfFunctions;
2166 DWORD NumberOfNames;
2167 DWORD AddressOfFunctions;
2168 DWORD AddressOfNames;
2169 DWORD AddressOfNameOrdinals;
2170 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2172 /* Import name entry */
2173 typedef struct _IMAGE_IMPORT_BY_NAME {
2174 WORD Hint;
2175 BYTE Name[1];
2176 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2178 /* Import thunk */
2179 typedef struct _IMAGE_THUNK_DATA {
2180 union {
2181 LPBYTE ForwarderString;
2182 PDWORD Function;
2183 DWORD Ordinal;
2184 PIMAGE_IMPORT_BY_NAME AddressOfData;
2185 } u1;
2186 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
2188 /* Import module directory */
2190 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2191 union {
2192 DWORD Characteristics; /* 0 for terminating null import descriptor */
2193 PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
2194 } DUMMYUNIONNAME;
2195 DWORD TimeDateStamp; /* 0 if not bound,
2196 * -1 if bound, and real date\time stamp
2197 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2198 * (new BIND)
2199 * otherwise date/time stamp of DLL bound to
2200 * (Old BIND)
2202 DWORD ForwarderChain; /* -1 if no forwarders */
2203 DWORD Name;
2204 /* RVA to IAT (if bound this IAT has actual addresses) */
2205 PIMAGE_THUNK_DATA FirstThunk;
2206 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2208 #define IMAGE_ORDINAL_FLAG 0x80000000
2209 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
2210 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
2212 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2214 DWORD TimeDateStamp;
2215 WORD OffsetModuleName;
2216 WORD NumberOfModuleForwarderRefs;
2217 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2218 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2220 typedef struct _IMAGE_BOUND_FORWARDER_REF
2222 DWORD TimeDateStamp;
2223 WORD OffsetModuleName;
2224 WORD Reserved;
2225 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2227 typedef struct _IMAGE_BASE_RELOCATION
2229 DWORD VirtualAddress;
2230 DWORD SizeOfBlock;
2231 /* WORD TypeOffset[1]; */
2232 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2234 #include <pshpack2.h>
2236 typedef struct _IMAGE_RELOCATION
2238 union {
2239 DWORD VirtualAddress;
2240 DWORD RelocCount;
2241 } DUMMYUNIONNAME;
2242 DWORD SymbolTableIndex;
2243 WORD Type;
2244 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2246 #include <poppack.h>
2248 #define IMAGE_SIZEOF_RELOCATION 10
2250 /* generic relocation types */
2251 #define IMAGE_REL_BASED_ABSOLUTE 0
2252 #define IMAGE_REL_BASED_HIGH 1
2253 #define IMAGE_REL_BASED_LOW 2
2254 #define IMAGE_REL_BASED_HIGHLOW 3
2255 #define IMAGE_REL_BASED_HIGHADJ 4
2256 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2257 #define IMAGE_REL_BASED_SECTION 6
2258 #define IMAGE_REL_BASED_REL 7
2259 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2260 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2261 #define IMAGE_REL_BASED_DIR64 10
2262 #define IMAGE_REL_BASED_HIGH3ADJ 11
2264 /* I386 relocation types */
2265 #define IMAGE_REL_I386_ABSOLUTE 0
2266 #define IMAGE_REL_I386_DIR16 1
2267 #define IMAGE_REL_I386_REL16 2
2268 #define IMAGE_REL_I386_DIR32 6
2269 #define IMAGE_REL_I386_DIR32NB 7
2270 #define IMAGE_REL_I386_SEG12 9
2271 #define IMAGE_REL_I386_SECTION 10
2272 #define IMAGE_REL_I386_SECREL 11
2273 #define IMAGE_REL_I386_REL32 20
2275 /* MIPS relocation types */
2276 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2277 #define IMAGE_REL_MIPS_REFHALF 0x0001
2278 #define IMAGE_REL_MIPS_REFWORD 0x0002
2279 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2280 #define IMAGE_REL_MIPS_REFHI 0x0004
2281 #define IMAGE_REL_MIPS_REFLO 0x0005
2282 #define IMAGE_REL_MIPS_GPREL 0x0006
2283 #define IMAGE_REL_MIPS_LITERAL 0x0007
2284 #define IMAGE_REL_MIPS_SECTION 0x000A
2285 #define IMAGE_REL_MIPS_SECREL 0x000B
2286 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2287 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2288 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2289 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2290 #define IMAGE_REL_MIPS_PAIR 0x0025
2292 /* ALPHA relocation types */
2293 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2294 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2295 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2296 #define IMAGE_REL_ALPHA_GPREL 0x0003
2297 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2298 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2299 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2300 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2301 #define IMAGE_REL_ALPHA_HINT 0x0008
2302 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2303 #define IMAGE_REL_ALPHA_REFHI 0x000A
2304 #define IMAGE_REL_ALPHA_REFLO 0x000B
2305 #define IMAGE_REL_ALPHA_PAIR 0x000C
2306 #define IMAGE_REL_ALPHA_MATCH 0x000D
2307 #define IMAGE_REL_ALPHA_SECTION 0x000E
2308 #define IMAGE_REL_ALPHA_SECREL 0x000F
2309 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2310 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2311 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2312 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2313 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2314 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2315 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2316 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2318 /* PowerPC relocation types */
2319 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2320 #define IMAGE_REL_PPC_ADDR64 0x0001
2321 #define IMAGE_REL_PPC_ADDR 0x0002
2322 #define IMAGE_REL_PPC_ADDR24 0x0003
2323 #define IMAGE_REL_PPC_ADDR16 0x0004
2324 #define IMAGE_REL_PPC_ADDR14 0x0005
2325 #define IMAGE_REL_PPC_REL24 0x0006
2326 #define IMAGE_REL_PPC_REL14 0x0007
2327 #define IMAGE_REL_PPC_TOCREL16 0x0008
2328 #define IMAGE_REL_PPC_TOCREL14 0x0009
2329 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2330 #define IMAGE_REL_PPC_SECREL 0x000B
2331 #define IMAGE_REL_PPC_SECTION 0x000C
2332 #define IMAGE_REL_PPC_IFGLUE 0x000D
2333 #define IMAGE_REL_PPC_IMGLUE 0x000E
2334 #define IMAGE_REL_PPC_SECREL16 0x000F
2335 #define IMAGE_REL_PPC_REFHI 0x0010
2336 #define IMAGE_REL_PPC_REFLO 0x0011
2337 #define IMAGE_REL_PPC_PAIR 0x0012
2338 #define IMAGE_REL_PPC_SECRELLO 0x0013
2339 #define IMAGE_REL_PPC_SECRELHI 0x0014
2340 #define IMAGE_REL_PPC_GPREL 0x0015
2341 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2342 /* modifier bits */
2343 #define IMAGE_REL_PPC_NEG 0x0100
2344 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2345 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2346 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2348 /* SH3 ? relocation type */
2349 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2350 #define IMAGE_REL_SH3_DIRECT16 0x0001
2351 #define IMAGE_REL_SH3_DIRECT 0x0002
2352 #define IMAGE_REL_SH3_DIRECT8 0x0003
2353 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2354 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2355 #define IMAGE_REL_SH3_DIRECT4 0x0006
2356 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2357 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2358 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2359 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2360 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2361 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2362 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2363 #define IMAGE_REL_SH3_SECTION 0x000E
2364 #define IMAGE_REL_SH3_SECREL 0x000F
2365 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2367 /* ARM (Archimedes?) relocation types */
2368 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2369 #define IMAGE_REL_ARM_ADDR 0x0001
2370 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2371 #define IMAGE_REL_ARM_BRANCH24 0x0003
2372 #define IMAGE_REL_ARM_BRANCH11 0x0004
2373 #define IMAGE_REL_ARM_SECTION 0x000E
2374 #define IMAGE_REL_ARM_SECREL 0x000F
2376 /* IA64 relocation types */
2377 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2378 #define IMAGE_REL_IA64_IMM14 0x0001
2379 #define IMAGE_REL_IA64_IMM22 0x0002
2380 #define IMAGE_REL_IA64_IMM64 0x0003
2381 #define IMAGE_REL_IA64_DIR 0x0004
2382 #define IMAGE_REL_IA64_DIR64 0x0005
2383 #define IMAGE_REL_IA64_PCREL21B 0x0006
2384 #define IMAGE_REL_IA64_PCREL21M 0x0007
2385 #define IMAGE_REL_IA64_PCREL21F 0x0008
2386 #define IMAGE_REL_IA64_GPREL22 0x0009
2387 #define IMAGE_REL_IA64_LTOFF22 0x000A
2388 #define IMAGE_REL_IA64_SECTION 0x000B
2389 #define IMAGE_REL_IA64_SECREL22 0x000C
2390 #define IMAGE_REL_IA64_SECREL64I 0x000D
2391 #define IMAGE_REL_IA64_SECREL 0x000E
2392 #define IMAGE_REL_IA64_LTOFF64 0x000F
2393 #define IMAGE_REL_IA64_DIR32NB 0x0010
2394 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2395 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2396 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2397 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2398 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2399 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2400 #define IMAGE_REL_IA64_ADDEND 0x001F
2402 /* archive format */
2404 #define IMAGE_ARCHIVE_START_SIZE 8
2405 #define IMAGE_ARCHIVE_START "!<arch>\n"
2406 #define IMAGE_ARCHIVE_END "`\n"
2407 #define IMAGE_ARCHIVE_PAD "\n"
2408 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2409 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2411 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2413 BYTE Name[16];
2414 BYTE Date[12];
2415 BYTE UserID[6];
2416 BYTE GroupID[6];
2417 BYTE Mode[8];
2418 BYTE Size[10];
2419 BYTE EndHeader[2];
2420 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2422 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2425 * Resource directory stuff
2427 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2428 DWORD Characteristics;
2429 DWORD TimeDateStamp;
2430 WORD MajorVersion;
2431 WORD MinorVersion;
2432 WORD NumberOfNamedEntries;
2433 WORD NumberOfIdEntries;
2434 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2435 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2437 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2438 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2440 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2441 union {
2442 struct {
2443 #ifdef BITFIELDS_BIGENDIAN
2444 unsigned NameIsString:1;
2445 unsigned NameOffset:31;
2446 #else
2447 unsigned NameOffset:31;
2448 unsigned NameIsString:1;
2449 #endif
2450 } DUMMYSTRUCTNAME1;
2451 DWORD Name;
2452 struct {
2453 #ifdef WORDS_BIGENDIAN
2454 WORD __pad;
2455 WORD Id;
2456 #else
2457 WORD Id;
2458 WORD __pad;
2459 #endif
2460 } DUMMYSTRUCTNAME2;
2461 } DUMMYUNIONNAME1;
2462 union {
2463 DWORD OffsetToData;
2464 struct {
2465 #ifdef BITFIELDS_BIGENDIAN
2466 unsigned DataIsDirectory:1;
2467 unsigned OffsetToDirectory:31;
2468 #else
2469 unsigned OffsetToDirectory:31;
2470 unsigned DataIsDirectory:1;
2471 #endif
2472 } DUMMYSTRUCTNAME3;
2473 } DUMMYUNIONNAME2;
2474 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2477 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2478 WORD Length;
2479 CHAR NameString[ 1 ];
2480 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2482 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2483 WORD Length;
2484 WCHAR NameString[ 1 ];
2485 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2487 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2488 DWORD OffsetToData;
2489 DWORD Size;
2490 DWORD CodePage;
2491 DWORD Reserved;
2492 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2495 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
2496 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
2499 typedef struct _IMAGE_TLS_DIRECTORY {
2500 DWORD StartAddressOfRawData;
2501 DWORD EndAddressOfRawData;
2502 LPDWORD AddressOfIndex;
2503 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2504 DWORD SizeOfZeroFill;
2505 DWORD Characteristics;
2506 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2508 typedef struct _IMAGE_DEBUG_DIRECTORY {
2509 DWORD Characteristics;
2510 DWORD TimeDateStamp;
2511 WORD MajorVersion;
2512 WORD MinorVersion;
2513 DWORD Type;
2514 DWORD SizeOfData;
2515 DWORD AddressOfRawData;
2516 DWORD PointerToRawData;
2517 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
2519 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2520 #define IMAGE_DEBUG_TYPE_COFF 1
2521 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2522 #define IMAGE_DEBUG_TYPE_FPO 3
2523 #define IMAGE_DEBUG_TYPE_MISC 4
2524 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2525 #define IMAGE_DEBUG_TYPE_FIXUP 6
2526 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2527 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2528 #define IMAGE_DEBUG_TYPE_BORLAND 9
2529 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2531 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2532 DWORD NumberOfSymbols;
2533 DWORD LvaToFirstSymbol;
2534 DWORD NumberOfLinenumbers;
2535 DWORD LvaToFirstLinenumber;
2536 DWORD RvaToFirstByteOfCode;
2537 DWORD RvaToLastByteOfCode;
2538 DWORD RvaToFirstByteOfData;
2539 DWORD RvaToLastByteOfData;
2540 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
2542 #define FRAME_FPO 0
2543 #define FRAME_TRAP 1
2544 #define FRAME_TSS 2
2545 #define FRAME_NONFPO 3
2547 typedef struct _FPO_DATA {
2548 DWORD ulOffStart;
2549 DWORD cbProcSize;
2550 DWORD cdwLocals;
2551 WORD cdwParams;
2552 WORD cbProlog : 8;
2553 WORD cbRegs : 3;
2554 WORD fHasSEH : 1;
2555 WORD fUseBP : 1;
2556 WORD reserved : 1;
2557 WORD cbFrame : 2;
2558 } FPO_DATA, *PFPO_DATA;
2560 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2561 DWORD Size;
2562 DWORD TimeDateStamp;
2563 WORD MajorVersion;
2564 WORD MinorVersion;
2565 DWORD GlobalFlagsClear;
2566 DWORD GlobalFlagsSet;
2567 DWORD CriticalSectionDefaultTimeout;
2568 DWORD DeCommitFreeBlockThreshold;
2569 DWORD DeCommitTotalFreeThreshold;
2570 PVOID LockPrefixTable;
2571 DWORD MaximumAllocationSize;
2572 DWORD VirtualMemoryThreshold;
2573 DWORD ProcessHeapFlags;
2574 DWORD ProcessAffinityMask;
2575 WORD CSDVersion;
2576 WORD Reserved1;
2577 PVOID EditList;
2578 DWORD SecurityCookie;
2579 DWORD SEHandlerTable;
2580 DWORD SEHandlerCount;
2581 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
2583 typedef struct _IMAGE_FUNCTION_ENTRY {
2584 DWORD StartingAddress;
2585 DWORD EndingAddress;
2586 DWORD EndOfPrologue;
2587 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
2589 #define IMAGE_DEBUG_MISC_EXENAME 1
2591 typedef struct _IMAGE_DEBUG_MISC {
2592 DWORD DataType;
2593 DWORD Length;
2594 BYTE Unicode;
2595 BYTE Reserved[ 3 ];
2596 BYTE Data[ 1 ];
2597 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
2599 /* This is the structure that appears at the very start of a .DBG file. */
2601 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
2602 WORD Signature;
2603 WORD Flags;
2604 WORD Machine;
2605 WORD Characteristics;
2606 DWORD TimeDateStamp;
2607 DWORD CheckSum;
2608 DWORD ImageBase;
2609 DWORD SizeOfImage;
2610 DWORD NumberOfSections;
2611 DWORD ExportedNamesSize;
2612 DWORD DebugDirectorySize;
2613 DWORD SectionAlignment;
2614 DWORD Reserved[ 2 ];
2615 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
2617 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2620 typedef struct tagMESSAGE_RESOURCE_ENTRY {
2621 WORD Length;
2622 WORD Flags;
2623 BYTE Text[1];
2624 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2625 #define MESSAGE_RESOURCE_UNICODE 0x0001
2627 typedef struct tagMESSAGE_RESOURCE_BLOCK {
2628 DWORD LowId;
2629 DWORD HighId;
2630 DWORD OffsetToEntries;
2631 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2633 typedef struct tagMESSAGE_RESOURCE_DATA {
2634 DWORD NumberOfBlocks;
2635 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
2636 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2639 * Here follows typedefs for security and tokens.
2643 * First a constant for the following typedefs.
2646 #define ANYSIZE_ARRAY 1
2648 /* FIXME: Orphan. What does it point to? */
2649 typedef PVOID PACCESS_TOKEN;
2650 typedef PVOID PSECURITY_DESCRIPTOR;
2651 typedef PVOID PSID;
2654 * TOKEN_INFORMATION_CLASS
2657 typedef enum _TOKEN_INFORMATION_CLASS {
2658 TokenUser = 1,
2659 TokenGroups,
2660 TokenPrivileges,
2661 TokenOwner,
2662 TokenPrimaryGroup,
2663 TokenDefaultDacl,
2664 TokenSource,
2665 TokenType,
2666 TokenImpersonationLevel,
2667 TokenStatistics,
2668 TokenRestrictedSids,
2669 TokenSessionId,
2670 TokenGroupsAndPrivileges,
2671 TokenSessionReference,
2672 TokenSandBoxInert
2673 } TOKEN_INFORMATION_CLASS;
2675 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
2676 #define TOKEN_ADJUST_GROUPS 0x0040
2677 #define TOKEN_ADJUST_PRIVILEGES 0x0020
2678 #define TOKEN_ADJUST_SESSIONID 0x0100
2679 #define TOKEN_ASSIGN_PRIMARY 0x0001
2680 #define TOKEN_DUPLICATE 0x0002
2681 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
2682 #define TOKEN_IMPERSONATE 0x0004
2683 #define TOKEN_QUERY 0x0008
2684 #define TOKEN_QUERY_SOURCE 0x0010
2685 #define TOKEN_ADJUST_DEFAULT 0x0080
2686 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
2687 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
2688 TOKEN_ADJUST_PRIVILEGES | \
2689 TOKEN_ADJUST_GROUPS | \
2690 TOKEN_ADJUST_DEFAULT )
2691 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2692 TOKEN_ASSIGN_PRIMARY | \
2693 TOKEN_DUPLICATE | \
2694 TOKEN_IMPERSONATE | \
2695 TOKEN_QUERY | \
2696 TOKEN_QUERY_SOURCE | \
2697 TOKEN_ADJUST_PRIVILEGES | \
2698 TOKEN_ADJUST_GROUPS | \
2699 TOKEN_ADJUST_SESSIONID | \
2700 TOKEN_ADJUST_DEFAULT )
2702 #ifndef _SECURITY_DEFINED
2703 #define _SECURITY_DEFINED
2706 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2708 typedef struct _GENERIC_MAPPING {
2709 ACCESS_MASK GenericRead;
2710 ACCESS_MASK GenericWrite;
2711 ACCESS_MASK GenericExecute;
2712 ACCESS_MASK GenericAll;
2713 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2715 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2716 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2717 typedef struct {
2718 BYTE Value[6];
2719 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
2720 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2722 #ifndef SID_DEFINED
2723 #define SID_DEFINED
2724 typedef struct _SID {
2725 BYTE Revision;
2726 BYTE SubAuthorityCount;
2727 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2728 DWORD SubAuthority[1];
2729 } SID,*PISID;
2730 #endif /* !defined(SID_DEFINED) */
2732 #define SID_REVISION (1) /* Current revision */
2733 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2734 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2738 * ACL
2741 #define ACL_REVISION1 1
2742 #define ACL_REVISION2 2
2743 #define ACL_REVISION3 3
2744 #define ACL_REVISION4 4
2746 #define MIN_ACL_REVISION ACL_REVISION2
2747 #define MAX_ACL_REVISION ACL_REVISION4
2749 typedef struct _ACL {
2750 BYTE AclRevision;
2751 BYTE Sbz1;
2752 WORD AclSize;
2753 WORD AceCount;
2754 WORD Sbz2;
2755 } ACL, *PACL;
2757 typedef enum _ACL_INFORMATION_CLASS
2759 AclRevisionInformation = 1,
2760 AclSizeInformation
2761 } ACL_INFORMATION_CLASS;
2763 typedef struct _ACL_REVISION_INFORMATION
2765 DWORD AclRevision;
2766 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
2768 typedef struct _ACL_SIZE_INFORMATION
2770 DWORD AceCount;
2771 DWORD AclBytesInUse;
2772 DWORD AclBytesFree;
2773 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
2775 /* SECURITY_DESCRIPTOR */
2776 #define SECURITY_DESCRIPTOR_REVISION 1
2777 #define SECURITY_DESCRIPTOR_REVISION1 1
2781 * Privilege Names
2783 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
2784 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
2785 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
2786 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
2787 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
2788 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
2789 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
2790 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
2791 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
2792 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
2793 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
2794 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
2795 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
2796 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
2797 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
2798 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
2799 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
2800 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
2801 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
2802 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
2803 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
2804 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
2805 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
2806 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
2807 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
2808 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
2809 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
2810 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
2811 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
2813 #define SE_GROUP_MANDATORY 0x00000001
2814 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
2815 #define SE_GROUP_ENABLED 0x00000004
2816 #define SE_GROUP_OWNER 0x00000008
2817 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
2818 #define SE_GROUP_LOGON_ID 0xC0000000
2819 #define SE_GROUP_RESOURCE 0x20000000
2821 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
2822 #define SE_PRIVILEGE_ENABLED 0x00000002
2823 #define SE_PRIVILEGE_REMOVE 0x00000004
2824 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2826 #define PRIVILEGE_SET_ALL_NECESSARY 1
2828 #define SE_OWNER_DEFAULTED 0x00000001
2829 #define SE_GROUP_DEFAULTED 0x00000002
2830 #define SE_DACL_PRESENT 0x00000004
2831 #define SE_DACL_DEFAULTED 0x00000008
2832 #define SE_SACL_PRESENT 0x00000010
2833 #define SE_SACL_DEFAULTED 0x00000020
2834 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
2835 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
2836 #define SE_DACL_AUTO_INHERITED 0x00000400
2837 #define SE_SACL_AUTO_INHERITED 0x00000800
2838 #define SE_DACL_PROTECTED 0x00001000
2839 #define SE_SACL_PROTECTED 0x00002000
2840 #define SE_SELF_RELATIVE 0x00008000
2842 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2843 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
2845 /* The security descriptor structure */
2846 typedef struct {
2847 BYTE Revision;
2848 BYTE Sbz1;
2849 SECURITY_DESCRIPTOR_CONTROL Control;
2850 DWORD Owner;
2851 DWORD Group;
2852 DWORD Sacl;
2853 DWORD Dacl;
2854 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2856 typedef struct {
2857 BYTE Revision;
2858 BYTE Sbz1;
2859 SECURITY_DESCRIPTOR_CONTROL Control;
2860 PSID Owner;
2861 PSID Group;
2862 PACL Sacl;
2863 PACL Dacl;
2864 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
2866 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2868 #endif /* _SECURITY_DEFINED */
2871 * SID_AND_ATTRIBUTES
2874 typedef struct _SID_AND_ATTRIBUTES {
2875 PSID Sid;
2876 DWORD Attributes;
2877 } SID_AND_ATTRIBUTES;
2879 /* security entities */
2880 #define SECURITY_NULL_RID (0x00000000L)
2881 #define SECURITY_WORLD_RID (0x00000000L)
2882 #define SECURITY_LOCAL_RID (0X00000000L)
2884 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2886 /* S-1-1 */
2887 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2889 /* S-1-2 */
2890 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2892 /* S-1-3 */
2893 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2894 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2895 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2896 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2897 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2899 /* S-1-4 */
2900 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2902 /* S-1-5 */
2903 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2904 #define SECURITY_DIALUP_RID 0x00000001L
2905 #define SECURITY_NETWORK_RID 0x00000002L
2906 #define SECURITY_BATCH_RID 0x00000003L
2907 #define SECURITY_INTERACTIVE_RID 0x00000004L
2908 #define SECURITY_LOGON_IDS_RID 0x00000005L
2909 #define SECURITY_SERVICE_RID 0x00000006L
2910 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2911 #define SECURITY_PROXY_RID 0x00000008L
2912 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2913 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2914 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2915 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2916 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2917 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2918 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2919 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2921 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2922 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2923 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2925 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2926 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2927 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2929 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2931 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2934 * TOKEN_USER
2937 typedef struct _TOKEN_USER {
2938 SID_AND_ATTRIBUTES User;
2939 } TOKEN_USER, *PTOKEN_USER;
2942 * TOKEN_GROUPS
2945 typedef struct _TOKEN_GROUPS {
2946 DWORD GroupCount;
2947 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2948 } TOKEN_GROUPS, *PTOKEN_GROUPS;
2951 * LUID_AND_ATTRIBUTES
2954 typedef union _LARGE_INTEGER {
2955 struct {
2956 #ifdef WORDS_BIGENDIAN
2957 LONG HighPart;
2958 DWORD LowPart;
2959 #else
2960 DWORD LowPart;
2961 LONG HighPart;
2962 #endif
2963 } u;
2964 #ifndef NONAMELESSSTRUCT
2965 struct {
2966 #ifdef WORDS_BIGENDIAN
2967 LONG HighPart;
2968 DWORD LowPart;
2969 #else
2970 DWORD LowPart;
2971 LONG HighPart;
2972 #endif
2974 #endif
2975 LONGLONG QuadPart;
2976 } LARGE_INTEGER, *PLARGE_INTEGER;
2978 typedef union _ULARGE_INTEGER {
2979 struct {
2980 #ifdef WORDS_BIGENDIAN
2981 DWORD HighPart;
2982 DWORD LowPart;
2983 #else
2984 DWORD LowPart;
2985 DWORD HighPart;
2986 #endif
2987 } u;
2988 #ifndef NONAMELESSSTRUCT
2989 struct {
2990 #ifdef WORDS_BIGENDIAN
2991 DWORD HighPart;
2992 DWORD LowPart;
2993 #else
2994 DWORD LowPart;
2995 DWORD HighPart;
2996 #endif
2998 #endif
2999 ULONGLONG QuadPart;
3000 } ULARGE_INTEGER, *PULARGE_INTEGER;
3003 * Locally Unique Identifier
3006 typedef struct _LUID {
3007 DWORD LowPart;
3008 LONG HighPart;
3009 } LUID, *PLUID;
3011 #include <pshpack4.h>
3012 typedef struct _LUID_AND_ATTRIBUTES {
3013 LUID Luid;
3014 DWORD Attributes;
3015 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3016 #include <poppack.h>
3019 * PRIVILEGE_SET
3022 typedef struct _PRIVILEGE_SET {
3023 DWORD PrivilegeCount;
3024 DWORD Control;
3025 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3026 } PRIVILEGE_SET, *PPRIVILEGE_SET;
3029 * TOKEN_PRIVILEGES
3032 typedef struct _TOKEN_PRIVILEGES {
3033 DWORD PrivilegeCount;
3034 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3035 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
3038 * TOKEN_OWNER
3041 typedef struct _TOKEN_OWNER {
3042 PSID Owner;
3043 } TOKEN_OWNER, *PTOKEN_OWNER;
3046 * TOKEN_PRIMARY_GROUP
3049 typedef struct _TOKEN_PRIMARY_GROUP {
3050 PSID PrimaryGroup;
3051 } TOKEN_PRIMARY_GROUP;
3055 * TOKEN_DEFAULT_DACL
3058 typedef struct _TOKEN_DEFAULT_DACL {
3059 PACL DefaultDacl;
3060 } TOKEN_DEFAULT_DACL;
3063 * TOKEN_SOURCEL
3066 #define TOKEN_SOURCE_LENGTH 8
3068 typedef struct _TOKEN_SOURCE {
3069 char SourceName[TOKEN_SOURCE_LENGTH];
3070 LUID SourceIdentifier;
3071 } TOKEN_SOURCE;
3074 * TOKEN_TYPE
3077 typedef enum tagTOKEN_TYPE {
3078 TokenPrimary = 1,
3079 TokenImpersonation
3080 } TOKEN_TYPE;
3083 * SECURITY_IMPERSONATION_LEVEL
3086 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3087 SecurityAnonymous,
3088 SecurityIdentification,
3089 SecurityImpersonation,
3090 SecurityDelegation
3091 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
3094 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
3095 * PSECURITY_CONTEXT_TRACKING_MODE;
3097 * Quality of Service
3100 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3101 DWORD Length;
3102 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3103 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3104 BOOLEAN EffectiveOnly;
3105 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
3108 * TOKEN_STATISTICS
3111 #include <pshpack4.h>
3112 typedef struct _TOKEN_STATISTICS {
3113 LUID TokenId;
3114 LUID AuthenticationId;
3115 LARGE_INTEGER ExpirationTime;
3116 TOKEN_TYPE TokenType;
3117 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3118 DWORD DynamicCharged;
3119 DWORD DynamicAvailable;
3120 DWORD GroupCount;
3121 DWORD PrivilegeCount;
3122 LUID ModifiedId;
3123 } TOKEN_STATISTICS;
3124 #include <poppack.h>
3127 * ACLs of NT
3130 #define ACL_REVISION 2
3132 #define ACL_REVISION1 1
3133 #define ACL_REVISION2 2
3135 /* ACEs, directly starting after an ACL */
3136 typedef struct _ACE_HEADER {
3137 BYTE AceType;
3138 BYTE AceFlags;
3139 WORD AceSize;
3140 } ACE_HEADER,*PACE_HEADER;
3142 /* AceType */
3143 #define ACCESS_ALLOWED_ACE_TYPE 0
3144 #define ACCESS_DENIED_ACE_TYPE 1
3145 #define SYSTEM_AUDIT_ACE_TYPE 2
3146 #define SYSTEM_ALARM_ACE_TYPE 3
3148 /* inherit AceFlags */
3149 #define OBJECT_INHERIT_ACE 0x01
3150 #define CONTAINER_INHERIT_ACE 0x02
3151 #define NO_PROPAGATE_INHERIT_ACE 0x04
3152 #define INHERIT_ONLY_ACE 0x08
3153 #define INHERITED_ACE 0x10
3154 #define VALID_INHERIT_FLAGS 0x0F
3156 /* AceFlags mask for what events we (should) audit */
3157 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3158 #define FAILED_ACCESS_ACE_FLAG 0x80
3160 /* different ACEs depending on AceType
3161 * SidStart marks the begin of a SID
3162 * so the thing finally looks like this:
3163 * 0: ACE_HEADER
3164 * 4: ACCESS_MASK
3165 * 8... : SID
3167 typedef struct _ACCESS_ALLOWED_ACE {
3168 ACE_HEADER Header;
3169 DWORD Mask;
3170 DWORD SidStart;
3171 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
3173 typedef struct _ACCESS_DENIED_ACE {
3174 ACE_HEADER Header;
3175 DWORD Mask;
3176 DWORD SidStart;
3177 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
3179 typedef struct _SYSTEM_AUDIT_ACE {
3180 ACE_HEADER Header;
3181 DWORD Mask;
3182 DWORD SidStart;
3183 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
3185 typedef struct _SYSTEM_ALARM_ACE {
3186 ACE_HEADER Header;
3187 DWORD Mask;
3188 DWORD SidStart;
3189 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
3191 typedef enum tagSID_NAME_USE {
3192 SidTypeUser = 1,
3193 SidTypeGroup,
3194 SidTypeDomain,
3195 SidTypeAlias,
3196 SidTypeWellKnownGroup,
3197 SidTypeDeletedAccount,
3198 SidTypeInvalid,
3199 SidTypeUnknown
3200 } SID_NAME_USE,*PSID_NAME_USE;
3202 /* Access rights */
3204 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3205 #undef DELETE
3206 #define DELETE 0x00010000
3207 #define READ_CONTROL 0x00020000
3208 #define WRITE_DAC 0x00040000
3209 #define WRITE_OWNER 0x00080000
3210 #define SYNCHRONIZE 0x00100000
3211 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3213 #define STANDARD_RIGHTS_READ READ_CONTROL
3214 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3215 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3217 #define STANDARD_RIGHTS_ALL 0x001f0000
3219 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3221 #define GENERIC_READ 0x80000000
3222 #define GENERIC_WRITE 0x40000000
3223 #define GENERIC_EXECUTE 0x20000000
3224 #define GENERIC_ALL 0x10000000
3226 #define MAXIMUM_ALLOWED 0x02000000
3227 #define ACCESS_SYSTEM_SECURITY 0x01000000
3229 #define EVENT_QUERY_STATE 0x0001
3230 #define EVENT_MODIFY_STATE 0x0002
3231 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3233 #define SEMAPHORE_MODIFY_STATE 0x0002
3234 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3236 #define MUTEX_MODIFY_STATE 0x0001
3237 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3239 #define TIMER_QUERY_STATE 0x0001
3240 #define TIMER_MODIFY_STATE 0x0002
3241 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3243 #define PROCESS_TERMINATE 0x0001
3244 #define PROCESS_CREATE_THREAD 0x0002
3245 #define PROCESS_VM_OPERATION 0x0008
3246 #define PROCESS_VM_READ 0x0010
3247 #define PROCESS_VM_WRITE 0x0020
3248 #define PROCESS_DUP_HANDLE 0x0040
3249 #define PROCESS_CREATE_PROCESS 0x0080
3250 #define PROCESS_SET_QUOTA 0x0100
3251 #define PROCESS_SET_INFORMATION 0x0200
3252 #define PROCESS_QUERY_INFORMATION 0x0400
3253 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3255 #define THREAD_TERMINATE 0x0001
3256 #define THREAD_SUSPEND_RESUME 0x0002
3257 #define THREAD_GET_CONTEXT 0x0008
3258 #define THREAD_SET_CONTEXT 0x0010
3259 #define THREAD_SET_INFORMATION 0x0020
3260 #define THREAD_QUERY_INFORMATION 0x0040
3261 #define THREAD_SET_THREAD_TOKEN 0x0080
3262 #define THREAD_IMPERSONATE 0x0100
3263 #define THREAD_DIRECT_IMPERSONATION 0x0200
3264 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3266 #define THREAD_BASE_PRIORITY_LOWRT 15
3267 #define THREAD_BASE_PRIORITY_MAX 2
3268 #define THREAD_BASE_PRIORITY_MIN -2
3269 #define THREAD_BASE_PRIORITY_IDLE -15
3271 #define SECTION_QUERY 0x0001
3272 #define SECTION_MAP_WRITE 0x0002
3273 #define SECTION_MAP_READ 0x0004
3274 #define SECTION_MAP_EXECUTE 0x0008
3275 #define SECTION_EXTEND_SIZE 0x0010
3276 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
3277 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3279 #define FILE_READ_DATA 0x0001 /* file & pipe */
3280 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3281 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3282 #define FILE_ADD_FILE 0x0002 /* directory */
3283 #define FILE_APPEND_DATA 0x0004 /* file */
3284 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3285 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3286 #define FILE_READ_EA 0x0008 /* file & directory */
3287 #define FILE_READ_PROPERTIES FILE_READ_EA
3288 #define FILE_WRITE_EA 0x0010 /* file & directory */
3289 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3290 #define FILE_EXECUTE 0x0020 /* file */
3291 #define FILE_TRAVERSE 0x0020 /* directory */
3292 #define FILE_DELETE_CHILD 0x0040 /* directory */
3293 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3294 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3295 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3297 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3298 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3299 SYNCHRONIZE)
3300 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3301 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3302 FILE_APPEND_DATA | SYNCHRONIZE)
3303 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3304 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3307 /* File attribute flags */
3308 #define FILE_SHARE_READ 0x00000001L
3309 #define FILE_SHARE_WRITE 0x00000002L
3310 #define FILE_SHARE_DELETE 0x00000004L
3312 #define FILE_ATTRIBUTE_READONLY 0x00000001
3313 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3314 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3315 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3316 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3317 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3318 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3319 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3320 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3321 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3322 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3323 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3324 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3326 /* File notification flags */
3327 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3328 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3329 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3330 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3331 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3332 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3333 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3334 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3336 #define FILE_ACTION_ADDED 0x00000001
3337 #define FILE_ACTION_REMOVED 0x00000002
3338 #define FILE_ACTION_MODIFIED 0x00000003
3339 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3340 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3343 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3344 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3345 #define FILE_UNICODE_ON_DISK 0x00000004
3346 #define FILE_PERSISTENT_ACLS 0x00000008
3347 #define FILE_FILE_COMPRESSION 0x00000010
3348 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3349 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
3350 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
3351 #define FILE_NAMED_STREAMS 0x00040000
3352 #define FILE_READ_ONLY_VOLUME 0x00080000
3354 /* File alignments (NT) */
3355 #define FILE_BYTE_ALIGNMENT 0x00000000
3356 #define FILE_WORD_ALIGNMENT 0x00000001
3357 #define FILE_LONG_ALIGNMENT 0x00000003
3358 #define FILE_QUAD_ALIGNMENT 0x00000007
3359 #define FILE_OCTA_ALIGNMENT 0x0000000f
3360 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3361 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3362 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3363 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3364 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3366 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
3367 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
3369 #define REG_NONE 0 /* no type */
3370 #define REG_SZ 1 /* string type (ASCII) */
3371 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3372 #define REG_BINARY 3 /* binary format, callerspecific */
3373 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3374 #define REG_DWORD 4 /* DWORD in little endian format */
3375 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3376 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3377 #define REG_LINK 6 /* symbolic link (UNICODE) */
3378 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3379 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3380 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3381 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3382 #define REG_QWORD 11 /* QWORD in little endian format */
3383 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
3385 /* ----------------------------- begin power management --------------------- */
3387 typedef enum _LATENCY_TIME {
3388 LT_DONT_CARE,
3389 LT_LOWEST_LATENCY
3390 } LATENCY_TIME, *PLATENCY_TIME;
3392 #define DISCHARGE_POLICY_CRITICAL 0
3393 #define DISCHARGE_POLICY_LOW 1
3394 #define NUM_DISCHARGE_POLICIES 4
3396 #define PO_THROTTLE_NONE 0
3397 #define PO_THROTTLE_CONSTANT 1
3398 #define PO_THROTTLE_DEGRADE 2
3399 #define PO_THROTTLE_ADAPTIVE 3
3401 typedef enum _POWER_ACTION {
3402 PowerActionNone = 0,
3403 PowerActionReserved,
3404 PowerActionSleep,
3405 PowerActionHibernate,
3406 PowerActionShutdown,
3407 PowerActionShutdownReset,
3408 PowerActionShutdownOff,
3409 PowerActionWarmEject
3410 } POWER_ACTION,
3411 *PPOWER_ACTION;
3413 typedef enum _SYSTEM_POWER_STATE {
3414 PowerSystemUnspecified = 0,
3415 PowerSystemWorking = 1,
3416 PowerSystemSleeping1 = 2,
3417 PowerSystemSleeping2 = 3,
3418 PowerSystemSleeping3 = 4,
3419 PowerSystemHibernate = 5,
3420 PowerSystemShutdown = 6,
3421 PowerSystemMaximum = 7
3422 } SYSTEM_POWER_STATE,
3423 *PSYSTEM_POWER_STATE;
3425 typedef enum _DEVICE_POWER_STATE {
3426 PowerDeviceUnspecified,
3427 PowerDeviceD0,
3428 PowerDeviceD1,
3429 PowerDeviceD2,
3430 PowerDeviceD3,
3431 PowerDeviceMaximum
3432 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
3434 typedef enum _POWER_INFORMATION_LEVEL {
3435 SystemPowerPolicyAc,
3436 SystemPowerPolicyDc,
3437 VerifySystemPolicyAc,
3438 VerifySystemPolicyDc,
3439 SystemPowerCapabilities,
3440 SystemBatteryState,
3441 SystemPowerStateHandler,
3442 ProcessorStateHandler,
3443 SystemPowerPolicyCurrent,
3444 AdministratorPowerPolicy,
3445 SystemReserveHiberFile,
3446 ProcessorInformation,
3447 SystemPowerInformation,
3448 ProcessorStateHandler2,
3449 LastWakeTime,
3450 LastSleepTime,
3451 SystemExecutionState,
3452 SystemPowerStateNotifyHandler,
3453 ProcessorPowerPolicyAc,
3454 ProcessorPowerPolicyDc,
3455 VerifyProcessorPowerPolicyAc,
3456 VerifyProcessorPowerPolicyDc,
3457 ProcessorPowerPolicyCurrent
3458 } POWER_INFORMATION_LEVEL;
3460 typedef struct _ADMINISTRATOR_POWER_POLICY {
3461 SYSTEM_POWER_STATE MinSleep;
3462 SYSTEM_POWER_STATE MaxSleep;
3463 ULONG MinVideoTimeout;
3464 ULONG MaxVideoTimeout;
3465 ULONG MinSpindownTimeout;
3466 ULONG MaxSpindownTimeout;
3467 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
3469 typedef struct {
3470 ULONG Granularity;
3471 ULONG Capacity;
3472 } BATTERY_REPORTING_SCALE,
3473 *PBATTERY_REPORTING_SCALE;
3475 typedef struct {
3476 POWER_ACTION Action;
3477 ULONG Flags;
3478 ULONG EventCode;
3479 } POWER_ACTION_POLICY,
3480 *PPOWER_ACTION_POLICY;
3482 typedef struct _PROCESSOR_POWER_INFORMATION {
3483 ULONG Number;
3484 ULONG MaxMhz;
3485 ULONG CurrentMhz;
3486 ULONG MhzLimit;
3487 ULONG MaxIdleState;
3488 ULONG CurrentIdleState;
3489 } PROCESSOR_POWER_INFORMATION,
3490 *PPROCESSOR_POWER_INFORMATION;
3492 typedef struct _PROCESSOR_POWER_POLICY_INFO {
3493 ULONG TimeCheck;
3494 ULONG DemoteLimit;
3495 ULONG PromoteLimit;
3496 UCHAR DemotePercent;
3497 UCHAR PromotePercent;
3498 UCHAR Spare[2];
3499 ULONG AllowDemotion:1;
3500 ULONG AllowPromotion:1;
3501 ULONG Reserved:30;
3502 } PROCESSOR_POWER_POLICY_INFO,
3503 *PPROCESSOR_POWER_POLICY_INFO;
3505 typedef struct _PROCESSOR_POWER_POLICY {
3506 DWORD Revision;
3507 BYTE DynamicThrottle;
3508 BYTE Spare[3];
3509 DWORD DisableCStates:1;
3510 DWORD Reserved:31;
3511 DWORD PolicyCount;
3512 PROCESSOR_POWER_POLICY_INFO Policy[3];
3513 } PROCESSOR_POWER_POLICY,
3514 *PPROCESSOR_POWER_POLICY;
3516 typedef struct {
3517 BOOLEAN AcOnLine;
3518 BOOLEAN BatteryPresent;
3519 BOOLEAN Charging;
3520 BOOLEAN Discharging;
3521 BOOLEAN Spare1[4];
3522 ULONG MaxCapacity;
3523 ULONG RemainingCapacity;
3524 ULONG Rate;
3525 ULONG EstimatedTime;
3526 ULONG DefaultAlert1;
3527 ULONG DefaultAlert2;
3528 } SYSTEM_BATTERY_STATE,
3529 *PSYSTEM_BATTERY_STATE;
3531 typedef struct {
3532 BOOLEAN PowerButtonPresent;
3533 BOOLEAN SleepButtonPresent;
3534 BOOLEAN LidPresent;
3535 BOOLEAN SystemS1;
3536 BOOLEAN SystemS2;
3537 BOOLEAN SystemS3;
3538 BOOLEAN SystemS4;
3539 BOOLEAN SystemS5;
3540 BOOLEAN HiberFilePresent;
3541 BOOLEAN FullWake;
3542 BOOLEAN VideoDimPresent;
3543 BOOLEAN ApmPresent;
3544 BOOLEAN UpsPresent;
3545 BOOLEAN ThermalControl;
3546 BOOLEAN ProcessorThrottle;
3547 UCHAR ProcessorMinThrottle;
3548 UCHAR ProcessorMaxThrottle;
3549 UCHAR spare2[4];
3550 BOOLEAN DiskSpinDown;
3551 UCHAR spare3[8];
3552 BOOLEAN SystemBatteriesPresent;
3553 BOOLEAN BatteriesAreShortTerm;
3554 BATTERY_REPORTING_SCALE BatteryScale[3];
3555 SYSTEM_POWER_STATE AcOnLineWake;
3556 SYSTEM_POWER_STATE SoftLidWake;
3557 SYSTEM_POWER_STATE RtcWake;
3558 SYSTEM_POWER_STATE MinDeviceWakeState;
3559 SYSTEM_POWER_STATE DefaultLowLatencyWake;
3560 } SYSTEM_POWER_CAPABILITIES,
3561 *PSYSTEM_POWER_CAPABILITIES;
3563 typedef struct _SYSTEM_POWER_INFORMATION {
3564 ULONG MaxIdlenessAllowed;
3565 ULONG Idleness;
3566 ULONG TimeRemaining;
3567 UCHAR CoolingMode;
3568 } SYSTEM_POWER_INFORMATION,
3569 *PSYSTEM_POWER_INFORMATION;
3571 typedef struct _SYSTEM_POWER_LEVEL {
3572 BOOLEAN Enable;
3573 UCHAR Spare[3];
3574 ULONG BatteryLevel;
3575 POWER_ACTION_POLICY PowerPolicy;
3576 SYSTEM_POWER_STATE MinSystemState;
3577 } SYSTEM_POWER_LEVEL,
3578 *PSYSTEM_POWER_LEVEL;
3580 typedef struct _SYSTEM_POWER_POLICY {
3581 ULONG Revision;
3582 POWER_ACTION_POLICY PowerButton;
3583 POWER_ACTION_POLICY SleepButton;
3584 POWER_ACTION_POLICY LidClose;
3585 SYSTEM_POWER_STATE LidOpenWake;
3586 ULONG Reserved;
3587 POWER_ACTION_POLICY Idle;
3588 ULONG IdleTimeout;
3589 UCHAR IdleSensitivity;
3590 UCHAR DynamicThrottle;
3591 UCHAR Spare2[2];
3592 SYSTEM_POWER_STATE MinSleep;
3593 SYSTEM_POWER_STATE MaxSleep;
3594 SYSTEM_POWER_STATE ReducedLatencySleep;
3595 ULONG WinLogonFlags;
3596 ULONG Spare3;
3597 ULONG DozeS4Timeout;
3598 ULONG BroadcastCapacityResolution;
3599 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
3600 ULONG VideoTimeout;
3601 BOOLEAN VideoDimDisplay;
3602 ULONG VideoReserved[3];
3603 ULONG SpindownTimeout;
3604 BOOLEAN OptimizeForPower;
3605 UCHAR FanThrottleTolerance;
3606 UCHAR ForcedThrottle;
3607 UCHAR MinThrottle;
3608 POWER_ACTION_POLICY OverThrottled;
3609 } SYSTEM_POWER_POLICY,
3610 *PSYSTEM_POWER_POLICY;
3612 /* ----------------------------- begin registry ----------------------------- */
3614 /* Registry security values */
3615 #define OWNER_SECURITY_INFORMATION 0x00000001
3616 #define GROUP_SECURITY_INFORMATION 0x00000002
3617 #define DACL_SECURITY_INFORMATION 0x00000004
3618 #define SACL_SECURITY_INFORMATION 0x00000008
3620 #define REG_OPTION_RESERVED 0x00000000
3621 #define REG_OPTION_NON_VOLATILE 0x00000000
3622 #define REG_OPTION_VOLATILE 0x00000001
3623 #define REG_OPTION_CREATE_LINK 0x00000002
3624 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
3625 #define REG_OPTION_OPEN_LINK 0x00000008
3626 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
3627 REG_OPTION_NON_VOLATILE| \
3628 REG_OPTION_VOLATILE| \
3629 REG_OPTION_CREATE_LINK| \
3630 REG_OPTION_BACKUP_RESTORE| \
3631 REG_OPTION_OPEN_LINK)
3634 #define REG_CREATED_NEW_KEY 0x00000001
3635 #define REG_OPENED_EXISTING_KEY 0x00000002
3637 /* For RegNotifyChangeKeyValue */
3638 #define REG_NOTIFY_CHANGE_NAME 0x01
3639 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
3640 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
3641 #define REG_NOTIFY_CHANGE_SECURITY 0x08
3643 #define KEY_QUERY_VALUE 0x00000001
3644 #define KEY_SET_VALUE 0x00000002
3645 #define KEY_CREATE_SUB_KEY 0x00000004
3646 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3647 #define KEY_NOTIFY 0x00000010
3648 #define KEY_CREATE_LINK 0x00000020
3650 /* for RegKeyRestore flags */
3651 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
3652 #define REG_REFRESH_HIVE 0x00000002
3653 #define REG_NO_LAZY_FLUSH 0x00000004
3654 #define REG_FORCE_RESTORE 0x00000008
3656 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3657 KEY_QUERY_VALUE| \
3658 KEY_ENUMERATE_SUB_KEYS| \
3659 KEY_NOTIFY) \
3660 & (~SYNCHRONIZE) \
3662 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3663 KEY_SET_VALUE| \
3664 KEY_CREATE_SUB_KEY) \
3665 & (~SYNCHRONIZE) \
3667 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
3668 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3669 KEY_QUERY_VALUE| \
3670 KEY_SET_VALUE| \
3671 KEY_CREATE_SUB_KEY| \
3672 KEY_ENUMERATE_SUB_KEYS| \
3673 KEY_NOTIFY| \
3674 KEY_CREATE_LINK) \
3675 & (~SYNCHRONIZE) \
3677 /* ------------------------------ end registry ------------------------------ */
3680 #define EVENTLOG_SUCCESS 0x0000
3681 #define EVENTLOG_ERROR_TYPE 0x0001
3682 #define EVENTLOG_WARNING_TYPE 0x0002
3683 #define EVENTLOG_INFORMATION_TYPE 0x0004
3684 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3685 #define EVENTLOG_AUDIT_FAILURE 0x0010
3687 #define SERVICE_BOOT_START 0x00000000
3688 #define SERVICE_SYSTEM_START 0x00000001
3689 #define SERVICE_AUTO_START 0x00000002
3690 #define SERVICE_DEMAND_START 0x00000003
3691 #define SERVICE_DISABLED 0x00000004
3693 #define SERVICE_ERROR_IGNORE 0x00000000
3694 #define SERVICE_ERROR_NORMAL 0x00000001
3695 #define SERVICE_ERROR_SEVERE 0x00000002
3696 #define SERVICE_ERROR_CRITICAL 0x00000003
3698 /* Service types */
3699 #define SERVICE_KERNEL_DRIVER 0x00000001
3700 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3701 #define SERVICE_ADAPTER 0x00000004
3702 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3704 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3705 SERVICE_RECOGNIZER_DRIVER )
3707 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3708 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3709 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3711 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3713 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3714 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3717 typedef enum _CM_SERVICE_NODE_TYPE
3719 DriverType = SERVICE_KERNEL_DRIVER,
3720 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3721 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3722 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3723 AdapterType = SERVICE_ADAPTER,
3724 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3725 } SERVICE_NODE_TYPE;
3727 typedef enum _CM_SERVICE_LOAD_TYPE
3729 BootLoad = SERVICE_BOOT_START,
3730 SystemLoad = SERVICE_SYSTEM_START,
3731 AutoLoad = SERVICE_AUTO_START,
3732 DemandLoad = SERVICE_DEMAND_START,
3733 DisableLoad = SERVICE_DISABLED
3734 } SERVICE_LOAD_TYPE;
3736 typedef enum _CM_ERROR_CONTROL_TYPE
3738 IgnoreError = SERVICE_ERROR_IGNORE,
3739 NormalError = SERVICE_ERROR_NORMAL,
3740 SevereError = SERVICE_ERROR_SEVERE,
3741 CriticalError = SERVICE_ERROR_CRITICAL
3742 } SERVICE_ERROR_TYPE;
3746 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3747 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3748 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3749 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3750 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3752 #include <guiddef.h>
3754 typedef struct _OBJECT_TYPE_LIST {
3755 WORD Level;
3756 WORD Sbz;
3757 GUID *ObjectType;
3758 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
3760 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3762 WORD Type;
3763 WORD CreatorBackTraceIndex;
3764 struct _RTL_CRITICAL_SECTION *CriticalSection;
3765 LIST_ENTRY ProcessLocksList;
3766 DWORD EntryCount;
3767 DWORD ContentionCount;
3768 DWORD Spare[ 2 ];
3769 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
3771 typedef struct _RTL_CRITICAL_SECTION {
3772 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3773 LONG LockCount;
3774 LONG RecursionCount;
3775 HANDLE OwningThread;
3776 HANDLE LockSemaphore;
3777 ULONG_PTR SpinCount;
3778 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
3780 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
3782 #include <pshpack8.h>
3783 typedef struct _IO_COUNTERS {
3784 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
3785 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
3786 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
3787 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
3788 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
3789 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
3790 } IO_COUNTERS, *PIO_COUNTERS;
3791 #include <poppack.h>
3793 typedef struct {
3794 DWORD dwOSVersionInfoSize;
3795 DWORD dwMajorVersion;
3796 DWORD dwMinorVersion;
3797 DWORD dwBuildNumber;
3798 DWORD dwPlatformId;
3799 CHAR szCSDVersion[128];
3800 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
3802 typedef struct {
3803 DWORD dwOSVersionInfoSize;
3804 DWORD dwMajorVersion;
3805 DWORD dwMinorVersion;
3806 DWORD dwBuildNumber;
3807 DWORD dwPlatformId;
3808 WCHAR szCSDVersion[128];
3809 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
3811 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
3812 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
3813 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
3815 typedef struct {
3816 DWORD dwOSVersionInfoSize;
3817 DWORD dwMajorVersion;
3818 DWORD dwMinorVersion;
3819 DWORD dwBuildNumber;
3820 DWORD dwPlatformId;
3821 CHAR szCSDVersion[128];
3822 WORD wServicePackMajor;
3823 WORD wServicePackMinor;
3824 WORD wSuiteMask;
3825 BYTE wProductType;
3826 BYTE wReserved;
3827 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
3829 typedef struct {
3830 DWORD dwOSVersionInfoSize;
3831 DWORD dwMajorVersion;
3832 DWORD dwMinorVersion;
3833 DWORD dwBuildNumber;
3834 DWORD dwPlatformId;
3835 WCHAR szCSDVersion[128];
3836 WORD wServicePackMajor;
3837 WORD wServicePackMinor;
3838 WORD wSuiteMask;
3839 BYTE wProductType;
3840 BYTE wReserved;
3841 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
3843 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
3844 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
3845 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
3847 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
3849 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
3851 #define VER_PLATFORM_WIN32s 0
3852 #define VER_PLATFORM_WIN32_WINDOWS 1
3853 #define VER_PLATFORM_WIN32_NT 2
3855 #define VER_MINORVERSION 0x00000001
3856 #define VER_MAJORVERSION 0x00000002
3857 #define VER_BUILDNUMBER 0x00000004
3858 #define VER_PLATFORMID 0x00000008
3859 #define VER_SERVICEPACKMINOR 0x00000010
3860 #define VER_SERVICEPACKMAJOR 0x00000020
3861 #define VER_SUITENAME 0x00000040
3862 #define VER_PRODUCT_TYPE 0x00000080
3864 #define VER_NT_WORKSTATION 1
3865 #define VER_NT_DOMAIN_CONTROLLER 2
3866 #define VER_NT_SERVER 3
3868 #define VER_SUITE_SMALLBUSINESS 0x00000001
3869 #define VER_SUITE_ENTERPRISE 0x00000002
3870 #define VER_SUITE_BACKOFFICE 0x00000004
3871 #define VER_SUITE_COMMUNICATIONS 0x00000008
3872 #define VER_SUITE_TERMINAL 0x00000010
3873 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
3874 #define VER_SUITE_EMBEDDEDNT 0x00000040
3875 #define VER_SUITE_DATACENTER 0x00000080
3876 #define VER_SUITE_SINGLEUSERTS 0x00000100
3877 #define VER_SUITE_PERSONAL 0x00000200
3878 #define VER_SUITE_BLADE 0x00000400
3880 #define VER_EQUAL 1
3881 #define VER_GREATER 2
3882 #define VER_GREATER_EQUAL 3
3883 #define VER_LESS 4
3884 #define VER_LESS_EQUAL 5
3885 #define VER_AND 6
3886 #define VER_OR 7
3888 #endif /* _WINNT_ */