Removed todo_wine from some tests that succeed now.
[wine/multimedia.git] / include / winnt.h
blob33166081c85f7e50404694a79bd43ea9b0bb359c
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 __WINE_WINNT_H
22 #define __WINE_WINNT_H
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 /* Macro for structure packing and more. */
36 #ifdef __GNUC__
37 #define WINE_UNUSED __attribute__((unused))
38 #else
39 #define WINE_UNUSED /* nothing */
40 #endif
42 #if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(MIDL_PASS)
43 # if defined(_MSC_VER)
44 # define DECLSPEC_IMPORT __declspec(dllimport)
45 # elif defined(__MINGW32__)
46 # define DECLSPEC_IMPORT __attribute__((dllimport))
47 # else
48 # define DECLSPEC_IMPORT
49 # endif
50 #else
51 # define DECLSPEC_IMPORT
52 #endif
54 #ifndef DECLSPEC_NORETURN
55 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
56 # define DECLSPEC_NORETURN __declspec(noreturn)
57 # elif defined(__GNUC__)
58 # define DECLSPEC_NORETURN __attribute__((noreturn))
59 # else
60 # define DECLSPEC_NORETURN
61 # endif
62 #endif
64 #ifndef DECLSPEC_ALIGN
65 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
66 # define DECLSPEC_ALIGN(x) __declspec(align(x))
67 # elif defined(__GNUC__)
68 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
69 # else
70 # define DECLSPEC_ALIGN(x)
71 # endif
72 #endif
74 #ifndef DECLSPEC_CACHEALIGN
75 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
76 #endif
78 #ifndef DECLSPEC_UUID
79 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
80 # define DECLSPEC_UUID(x) __declspec(uuid(x))
81 # else
82 # define DECLSPEC_UUID(x)
83 # endif
84 #endif
86 #ifndef DECLSPEC_NOVTABLE
87 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
88 # define DECLSPEC_NOVTABLE __declspec(novtable)
89 # else
90 # define DECLSPEC_NOVTABLE
91 # endif
92 #endif
94 #ifndef DECLSPEC_SELECTANY
95 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
96 #define DECLSPEC_SELECTANY __declspec(selectany)
97 #else
98 #define DECLSPEC_SELECTANY
99 #endif
100 #endif
102 #ifndef NOP_FUNCTION
103 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
104 # define NOP_FUNCTION __noop
105 # else
106 # define NOP_FUNCTION (void)0
107 # endif
108 #endif
110 #ifndef DECLSPEC_ADDRSAFE
111 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
112 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
113 # else
114 # define DECLSPEC_ADDRSAFE
115 # endif
116 #endif
118 #ifndef FORCEINLINE
119 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
120 # define FORCEINLINE __forceinline
121 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
122 # define FORCEINLINE __attribute__((always_inline))
123 # else
124 # define FORCEINLINE inline
125 # endif
126 #endif
128 #ifndef DECLSPEC_DEPRECATED
129 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
130 # define DECLSPEC_DEPRECATED __declspec(deprecated)
131 # define DEPRECATE_SUPPORTED
132 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
133 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
134 # define DEPRECATE_SUPPORTED
135 # else
136 # define DECLSPEC_DEPRECATED
137 # undef DEPRECATE_SUPPORTED
138 # endif
139 #endif
141 /* Anonymous union/struct handling */
143 #ifndef NONAMELESSSTRUCT
144 # ifdef __GNUC__
145 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
146 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
147 # define NONAMELESSSTRUCT
148 # endif
149 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
150 # define NONAMELESSSTRUCT
151 # endif
152 #endif /* NONAMELESSSTRUCT */
154 #ifndef NONAMELESSUNION
155 # ifdef __GNUC__
156 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
157 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
158 # define NONAMELESSUNION
159 # endif
160 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
161 # define NONAMELESSUNION
162 # endif
163 #endif /* NONAMELESSUNION */
165 #ifndef NONAMELESSSTRUCT
166 #define DUMMYSTRUCTNAME
167 #define DUMMYSTRUCTNAME1
168 #define DUMMYSTRUCTNAME2
169 #define DUMMYSTRUCTNAME3
170 #define DUMMYSTRUCTNAME4
171 #define DUMMYSTRUCTNAME5
172 #else /* !defined(NONAMELESSSTRUCT) */
173 #define DUMMYSTRUCTNAME s
174 #define DUMMYSTRUCTNAME1 s1
175 #define DUMMYSTRUCTNAME2 s2
176 #define DUMMYSTRUCTNAME3 s3
177 #define DUMMYSTRUCTNAME4 s4
178 #define DUMMYSTRUCTNAME5 s5
179 #endif /* !defined(NONAMELESSSTRUCT) */
181 #ifndef NONAMELESSUNION
182 #define DUMMYUNIONNAME
183 #define DUMMYUNIONNAME1
184 #define DUMMYUNIONNAME2
185 #define DUMMYUNIONNAME3
186 #define DUMMYUNIONNAME4
187 #define DUMMYUNIONNAME5
188 #define DUMMYUNIONNAME6
189 #define DUMMYUNIONNAME7
190 #define DUMMYUNIONNAME8
191 #else /* !defined(NONAMELESSUNION) */
192 #define DUMMYUNIONNAME u
193 #define DUMMYUNIONNAME1 u1
194 #define DUMMYUNIONNAME2 u2
195 #define DUMMYUNIONNAME3 u3
196 #define DUMMYUNIONNAME4 u4
197 #define DUMMYUNIONNAME5 u5
198 #define DUMMYUNIONNAME6 u6
199 #define DUMMYUNIONNAME7 u7
200 #define DUMMYUNIONNAME8 u8
201 #endif /* !defined(NONAMELESSUNION) */
203 /* C99 restrict support */
205 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
206 # if defined(_MSC_VER) && defined(_M_MRX000)
207 # define RESTRICTED_POINTER __restrict
208 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
209 # define RESTRICTED_POINTER __restrict
210 # else
211 # define RESTRICTED_POINTER
212 # endif
213 #else
214 # define RESTRICTED_POINTER
215 #endif
217 /* C99 unaligned support */
219 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
220 # define UNALIGNED __unaligned
221 # ifdef _WIN64
222 # define UNALIGNED64 __unaligned
223 # else
224 # define UNALIGNED64
225 # endif
226 #else
227 # define UNALIGNED
228 # define UNALIGNED64
229 #endif
231 /* Alignment macros */
233 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
234 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
235 #define MEMORY_ALLOCATION_ALIGNMENT 16
236 #else
237 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
238 #define MEMORY_ALLOCATION_ALIGNMENT 8
239 #endif
241 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
242 # define TYPE_ALIGNMENT(t) __alignof(t)
243 #elif defined(__GNUC__)
244 # define TYPE_ALIGNMENT(t) __alignof__(t)
245 #else
246 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
247 #endif
249 #ifdef _WIN64
250 # define PROBE_ALIGNMENT(_s) \
251 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
252 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
253 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
254 #else
255 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
256 #endif
258 /* Compile time assertion */
260 #if defined(_MSC_VER)
261 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
262 #elif defined(__GNUC__)
263 # define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1]
264 #endif
266 /* Eliminate Microsoft C/C++ compiler warning 4715 */
267 #if (_MSC_VER > 1200)
268 # define DEFAULT_UNREACHABLE default: __assume(0)
269 #else
270 # define DEFAULT_UNREACHABLE
271 #endif
273 /* Error Masks */
274 #define APPLICATION_ERROR_MASK 0x20000000
275 #define ERROR_SEVERITY_SUCCESS 0x00000000
276 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
277 #define ERROR_SEVERITY_WARNING 0x80000000
278 #define ERROR_SEVERITY_ERROR 0xC0000000
280 /* Microsoft's macros for declaring functions */
282 #ifdef __cplusplus
283 # define EXTERN_C extern "C"
284 #else
285 # define EXTERN_C extern
286 #endif
288 #define STDMETHODCALLTYPE __stdcall
289 #define STDMETHODVCALLTYPE __cdecl
290 #define STDAPICALLTYPE __stdcall
291 #define STDAPIVCALLTYPE __cdecl
293 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
294 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
295 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
296 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
297 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
298 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
299 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
300 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
302 /* Define the basic types */
303 #ifndef VOID
304 #define VOID void
305 #endif
306 typedef VOID *PVOID;
307 typedef BYTE BOOLEAN, *PBOOLEAN;
308 typedef char CHAR, *PCHAR;
309 typedef short SHORT, *PSHORT;
310 typedef long LONG, *PLONG;
312 /* Some systems might have wchar_t, but we really need 16 bit characters */
313 #ifdef WINE_UNICODE_NATIVE
314 typedef wchar_t WCHAR, *PWCHAR;
315 #else
316 typedef unsigned short WCHAR, *PWCHAR;
317 #endif
319 /* 'Extended/Wide' numerical types */
320 #ifndef _ULONGLONG_
321 #define _ULONGLONG_
322 typedef signed __int64 LONGLONG, *PLONGLONG;
323 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
324 #endif
326 #ifndef _DWORDLONG_
327 #define _DWORDLONG_
328 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
329 #endif
331 /* ANSI string types */
332 typedef CHAR *PCH, *LPCH;
333 typedef const CHAR *PCCH, *LPCCH;
334 typedef CHAR *PSTR, *LPSTR, *NPSTR;
335 typedef const CHAR *PCSTR, *LPCSTR;
337 /* Unicode string types */
338 typedef WCHAR *PWCH, *LPWCH;
339 typedef const WCHAR *PCWCH, *LPCWCH;
340 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
341 typedef const WCHAR *PCWSTR, *LPCWSTR;
343 /* Neutral character and string types */
344 /* These are only defined for Winelib, i.e. _not_ defined for
345 * the emulator. The reason is they depend on the UNICODE
346 * macro which only exists in the user's code.
348 #ifndef __WINESRC__
349 # ifdef UNICODE
350 # ifndef _TCHAR_DEFINED
351 typedef WCHAR TCHAR, *PTCHAR;
352 # define _TCHAR_DEFINED
353 #endif
354 typedef LPWSTR PTSTR, LPTSTR;
355 typedef LPCWSTR PCTSTR, LPCTSTR;
356 # define __TEXT(string) L##string
357 # else /* UNICODE */
358 # ifndef _TCHAR_DEFINED
359 typedef CHAR TCHAR, *PTCHAR;
360 # define _TCHAR_DEFINED
361 # endif
362 typedef LPSTR PTSTR, LPTSTR;
363 typedef LPCSTR PCTSTR, LPCTSTR;
364 # define __TEXT(string) string
365 # endif /* UNICODE */
366 # define TEXT(quote) __TEXT(quote)
367 #endif /* __WINESRC__ */
369 /* Misc common WIN32 types */
370 typedef char CCHAR;
371 typedef LONG HRESULT;
372 typedef DWORD LCID, *PLCID;
373 typedef WORD LANGID;
374 typedef DWORD EXECUTION_STATE;
376 /* Handle type */
378 typedef void *HANDLE;
379 typedef HANDLE *PHANDLE, *LPHANDLE;
381 #ifdef STRICT
382 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
383 #else /*STRICT*/
384 #define DECLARE_HANDLE(a) typedef HANDLE a
385 #endif /*STRICT*/
387 /* Defines */
389 #ifndef WIN32_NO_STATUS
391 #define STATUS_WAIT_0 0x00000000
392 #define STATUS_ABANDONED_WAIT_0 0x00000080
393 #define STATUS_USER_APC 0x000000C0
394 #define STATUS_TIMEOUT 0x00000102
395 #define STATUS_PENDING 0x00000103
396 #define STATUS_SEGMENT_NOTIFICATION 0x40000005
397 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
398 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
399 #define STATUS_BREAKPOINT 0x80000003
400 #define STATUS_SINGLE_STEP 0x80000004
401 #define STATUS_ACCESS_VIOLATION 0xC0000005
402 #define STATUS_IN_PAGE_ERROR 0xC0000006
403 #define STATUS_INVALID_HANDLE 0xC0000008
404 #define STATUS_NO_MEMORY 0xC0000017
405 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
406 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
407 #define STATUS_INVALID_DISPOSITION 0xC0000026
408 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
409 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
410 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
411 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
412 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
413 #define STATUS_FLOAT_OVERFLOW 0xC0000091
414 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
415 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
416 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
417 #define STATUS_INTEGER_OVERFLOW 0xC0000095
418 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
419 #define STATUS_STACK_OVERFLOW 0xC00000FD
420 #define STATUS_CONTROL_C_EXIT 0xC000013A
421 #define STATUS_FLOAT_MULTIPLE_FAULTS 0xC00002B4
422 #define STATUS_FLOAT_MULTIPLE_TRAPS 0xC00002B5
423 #define STATUS_REG_NAT_CONSUMPTION 0xC00002C9
424 #define STATUS_SXS_EARLY_DEACTIVATION 0xC015000F
425 #define STATUS_SXS_INVALID_DEACTIVATION 0xC0150010
427 /* status values for ContinueDebugEvent */
428 #define DBG_EXCEPTION_HANDLED 0x00010001
429 #define DBG_CONTINUE 0x00010002
430 #define DBG_TERMINATE_THREAD 0x40010003
431 #define DBG_TERMINATE_PROCESS 0x40010004
432 #define DBG_CONTROL_C 0x40010005
433 #define DBG_CONTROL_BREAK 0x40010008
434 #define DBG_COMMAND_EXCEPTION 0x40010009
435 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
437 #endif /* WIN32_NO_STATUS */
439 /* Argument 1 passed to the DllEntryProc. */
440 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
441 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
442 #define DLL_THREAD_ATTACH 2 /* attach new thread */
443 #define DLL_THREAD_DETACH 3 /* detach thread */
446 /* u.x.wProcessorArchitecture (NT) */
447 #define PROCESSOR_ARCHITECTURE_INTEL 0
448 #define PROCESSOR_ARCHITECTURE_MIPS 1
449 #define PROCESSOR_ARCHITECTURE_ALPHA 2
450 #define PROCESSOR_ARCHITECTURE_PPC 3
451 #define PROCESSOR_ARCHITECTURE_SHX 4
452 #define PROCESSOR_ARCHITECTURE_ARM 5
453 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
455 /* dwProcessorType */
456 #define PROCESSOR_INTEL_386 386
457 #define PROCESSOR_INTEL_486 486
458 #define PROCESSOR_INTEL_PENTIUM 586
459 #define PROCESSOR_INTEL_860 860
460 #define PROCESSOR_MIPS_R2000 2000
461 #define PROCESSOR_MIPS_R3000 3000
462 #define PROCESSOR_MIPS_R4000 4000
463 #define PROCESSOR_ALPHA_21064 21064
464 #define PROCESSOR_PPC_601 601
465 #define PROCESSOR_PPC_603 603
466 #define PROCESSOR_PPC_604 604
467 #define PROCESSOR_PPC_620 620
468 #define PROCESSOR_HITACHI_SH3 10003
469 #define PROCESSOR_HITACHI_SH3E 10004
470 #define PROCESSOR_HITACHI_SH4 10005
471 #define PROCESSOR_MOTOROLA_821 821
472 #define PROCESSOR_SHx_SH3 103
473 #define PROCESSOR_SHx_SH4 104
474 #define PROCESSOR_STRONGARM 2577
475 #define PROCESSOR_ARM720 1824 /* 0x720 */
476 #define PROCESSOR_ARM820 2080 /* 0x820 */
477 #define PROCESSOR_ARM920 2336 /* 0x920 */
478 #define PROCESSOR_ARM_7TDMI 70001
480 #define MAXIMUM_PROCESSORS 32
481 typedef struct _MEMORY_BASIC_INFORMATION
483 LPVOID BaseAddress;
484 LPVOID AllocationBase;
485 DWORD AllocationProtect;
486 DWORD RegionSize;
487 DWORD State;
488 DWORD Protect;
489 DWORD Type;
490 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
492 #define PAGE_NOACCESS 0x01
493 #define PAGE_READONLY 0x02
494 #define PAGE_READWRITE 0x04
495 #define PAGE_WRITECOPY 0x08
496 #define PAGE_EXECUTE 0x10
497 #define PAGE_EXECUTE_READ 0x20
498 #define PAGE_EXECUTE_READWRITE 0x40
499 #define PAGE_EXECUTE_WRITECOPY 0x80
500 #define PAGE_GUARD 0x100
501 #define PAGE_NOCACHE 0x200
503 #define MEM_COMMIT 0x00001000
504 #define MEM_RESERVE 0x00002000
505 #define MEM_DECOMMIT 0x00004000
506 #define MEM_RELEASE 0x00008000
507 #define MEM_FREE 0x00010000
508 #define MEM_PRIVATE 0x00020000
509 #define MEM_MAPPED 0x00040000
510 #define MEM_RESET 0x00080000
511 #define MEM_TOP_DOWN 0x00100000
512 #ifdef __WINESRC__
513 #define MEM_SYSTEM 0x80000000
514 #endif
516 #define SEC_FILE 0x00800000
517 #define SEC_IMAGE 0x01000000
518 #define SEC_RESERVE 0x04000000
519 #define SEC_COMMIT 0x08000000
520 #define SEC_NOCACHE 0x10000000
521 #define MEM_IMAGE SEC_IMAGE
524 #define MINCHAR 0x80
525 #define MAXCHAR 0x7f
526 #define MINSHORT 0x8000
527 #define MAXSHORT 0x7fff
528 #define MINLONG 0x80000000
529 #define MAXLONG 0x7fffffff
530 #define MAXBYTE 0xff
531 #define MAXWORD 0xffff
532 #define MAXDWORD 0xffffffff
534 #define FIELD_OFFSET(type, field) \
535 ((LONG)(INT)&(((type *)0)->field))
537 #define CONTAINING_RECORD(address, type, field) \
538 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
540 /* Types */
542 typedef struct _LIST_ENTRY {
543 struct _LIST_ENTRY *Flink;
544 struct _LIST_ENTRY *Blink;
545 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
547 typedef struct _SINGLE_LIST_ENTRY {
548 struct _SINGLE_LIST_ENTRY *Next;
549 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
551 /* Heap flags */
553 #define HEAP_NO_SERIALIZE 0x00000001
554 #define HEAP_GROWABLE 0x00000002
555 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
556 #define HEAP_ZERO_MEMORY 0x00000008
557 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
558 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
559 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
560 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
561 #define HEAP_CREATE_ALIGN_16 0x00010000
562 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
564 /* This flag allows it to create heaps shared by all processes under win95,
565 FIXME: correct name */
566 #define HEAP_SHARED 0x04000000
568 /* Processor feature flags. */
569 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
570 #define PF_FLOATING_POINT_EMULATED 1
571 #define PF_COMPARE_EXCHANGE_DOUBLE 2
572 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
573 #define PF_PPC_MOVEMEM_64BIT_OK 4
574 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
575 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
576 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
577 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
578 #define PF_PAE_ENABLED 9
579 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
582 /* Execution state flags */
583 #define ES_SYSTEM_REQUIRED 0x00000001
584 #define ES_DISPLAY_REQUIRED 0x00000002
585 #define ES_USER_PRESENT 0x00000004
586 #define ES_CONTINUOUS 0x80000000
588 /* The Win32 register context */
590 /* CONTEXT is the CPU-dependent context; it should be used */
591 /* wherever a platform-specific context is needed (e.g. exception */
592 /* handling, Win32 register functions). */
594 /* CONTEXT86 is the i386-specific context; it should be used */
595 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
596 /* Win16 register functions), so that this code can be compiled */
597 /* on all platforms. */
599 #define SIZE_OF_80387_REGISTERS 80
601 typedef struct _FLOATING_SAVE_AREA
603 DWORD ControlWord;
604 DWORD StatusWord;
605 DWORD TagWord;
606 DWORD ErrorOffset;
607 DWORD ErrorSelector;
608 DWORD DataOffset;
609 DWORD DataSelector;
610 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
611 DWORD Cr0NpxState;
612 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
614 #define MAXIMUM_SUPPORTED_EXTENSION 512
616 typedef struct _CONTEXT86
618 DWORD ContextFlags;
620 /* These are selected by CONTEXT_DEBUG_REGISTERS */
621 DWORD Dr0;
622 DWORD Dr1;
623 DWORD Dr2;
624 DWORD Dr3;
625 DWORD Dr6;
626 DWORD Dr7;
628 /* These are selected by CONTEXT_FLOATING_POINT */
629 FLOATING_SAVE_AREA FloatSave;
631 /* These are selected by CONTEXT_SEGMENTS */
632 DWORD SegGs;
633 DWORD SegFs;
634 DWORD SegEs;
635 DWORD SegDs;
637 /* These are selected by CONTEXT_INTEGER */
638 DWORD Edi;
639 DWORD Esi;
640 DWORD Ebx;
641 DWORD Edx;
642 DWORD Ecx;
643 DWORD Eax;
645 /* These are selected by CONTEXT_CONTROL */
646 DWORD Ebp;
647 DWORD Eip;
648 DWORD SegCs;
649 DWORD EFlags;
650 DWORD Esp;
651 DWORD SegSs;
653 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
654 } CONTEXT86;
656 #define CONTEXT_X86 0x00010000
657 #define CONTEXT_i386 CONTEXT_X86
658 #define CONTEXT_i486 CONTEXT_X86
660 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
661 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
662 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
663 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
664 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
665 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
667 /* i386 context definitions */
668 #ifdef __i386__
670 #define CONTEXT_CONTROL CONTEXT86_CONTROL
671 #define CONTEXT_INTEGER CONTEXT86_INTEGER
672 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
673 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
674 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
675 #define CONTEXT_FULL CONTEXT86_FULL
677 typedef CONTEXT86 CONTEXT;
679 #endif /* __i386__ */
681 /* Alpha context definitions */
682 #ifdef _ALPHA_
684 #define CONTEXT_ALPHA 0x00020000
686 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
687 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
688 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
689 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
691 typedef struct _CONTEXT
693 /* selected by CONTEXT_FLOATING_POINT */
694 ULONGLONG FltF0;
695 ULONGLONG FltF1;
696 ULONGLONG FltF2;
697 ULONGLONG FltF3;
698 ULONGLONG FltF4;
699 ULONGLONG FltF5;
700 ULONGLONG FltF6;
701 ULONGLONG FltF7;
702 ULONGLONG FltF8;
703 ULONGLONG FltF9;
704 ULONGLONG FltF10;
705 ULONGLONG FltF11;
706 ULONGLONG FltF12;
707 ULONGLONG FltF13;
708 ULONGLONG FltF14;
709 ULONGLONG FltF15;
710 ULONGLONG FltF16;
711 ULONGLONG FltF17;
712 ULONGLONG FltF18;
713 ULONGLONG FltF19;
714 ULONGLONG FltF20;
715 ULONGLONG FltF21;
716 ULONGLONG FltF22;
717 ULONGLONG FltF23;
718 ULONGLONG FltF24;
719 ULONGLONG FltF25;
720 ULONGLONG FltF26;
721 ULONGLONG FltF27;
722 ULONGLONG FltF28;
723 ULONGLONG FltF29;
724 ULONGLONG FltF30;
725 ULONGLONG FltF31;
727 /* selected by CONTEXT_INTEGER */
728 ULONGLONG IntV0;
729 ULONGLONG IntT0;
730 ULONGLONG IntT1;
731 ULONGLONG IntT2;
732 ULONGLONG IntT3;
733 ULONGLONG IntT4;
734 ULONGLONG IntT5;
735 ULONGLONG IntT6;
736 ULONGLONG IntT7;
737 ULONGLONG IntS0;
738 ULONGLONG IntS1;
739 ULONGLONG IntS2;
740 ULONGLONG IntS3;
741 ULONGLONG IntS4;
742 ULONGLONG IntS5;
743 ULONGLONG IntFp;
744 ULONGLONG IntA0;
745 ULONGLONG IntA1;
746 ULONGLONG IntA2;
747 ULONGLONG IntA3;
748 ULONGLONG IntA4;
749 ULONGLONG IntA5;
750 ULONGLONG IntT8;
751 ULONGLONG IntT9;
752 ULONGLONG IntT10;
753 ULONGLONG IntT11;
754 ULONGLONG IntRa;
755 ULONGLONG IntT12;
756 ULONGLONG IntAt;
757 ULONGLONG IntGp;
758 ULONGLONG IntSp;
759 ULONGLONG IntZero;
761 /* selected by CONTEXT_FLOATING_POINT */
762 ULONGLONG Fpcr;
763 ULONGLONG SoftFpcr;
765 /* selected by CONTEXT_CONTROL */
766 ULONGLONG Fir;
767 DWORD Psr;
768 DWORD ContextFlags;
769 DWORD Fill[4];
770 } CONTEXT;
772 #define _QUAD_PSR_OFFSET HighSoftFpcr
773 #define _QUAD_FLAGS_OFFSET HighFir
775 #endif /* _ALPHA_ */
777 /* Mips context definitions */
778 #ifdef _MIPS_
780 #define CONTEXT_R4000 0x00010000
782 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
783 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
784 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
786 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
788 typedef struct _CONTEXT
790 DWORD Argument[4];
791 /* These are selected by CONTEXT_FLOATING_POINT */
792 DWORD FltF0;
793 DWORD FltF1;
794 DWORD FltF2;
795 DWORD FltF3;
796 DWORD FltF4;
797 DWORD FltF5;
798 DWORD FltF6;
799 DWORD FltF7;
800 DWORD FltF8;
801 DWORD FltF9;
802 DWORD FltF10;
803 DWORD FltF11;
804 DWORD FltF12;
805 DWORD FltF13;
806 DWORD FltF14;
807 DWORD FltF15;
808 DWORD FltF16;
809 DWORD FltF17;
810 DWORD FltF18;
811 DWORD FltF19;
812 DWORD FltF20;
813 DWORD FltF21;
814 DWORD FltF22;
815 DWORD FltF23;
816 DWORD FltF24;
817 DWORD FltF25;
818 DWORD FltF26;
819 DWORD FltF27;
820 DWORD FltF28;
821 DWORD FltF29;
822 DWORD FltF30;
823 DWORD FltF31;
825 /* These are selected by CONTEXT_INTEGER */
826 DWORD IntZero;
827 DWORD IntAt;
828 DWORD IntV0;
829 DWORD IntV1;
830 DWORD IntA0;
831 DWORD IntA1;
832 DWORD IntA2;
833 DWORD IntA3;
834 DWORD IntT0;
835 DWORD IntT1;
836 DWORD IntT2;
837 DWORD IntT3;
838 DWORD IntT4;
839 DWORD IntT5;
840 DWORD IntT6;
841 DWORD IntT7;
842 DWORD IntS0;
843 DWORD IntS1;
844 DWORD IntS2;
845 DWORD IntS3;
846 DWORD IntS4;
847 DWORD IntS5;
848 DWORD IntS6;
849 DWORD IntS7;
850 DWORD IntT8;
851 DWORD IntT9;
852 DWORD IntK0;
853 DWORD IntK1;
854 DWORD IntGp;
855 DWORD IntSp;
856 DWORD IntS8;
857 DWORD IntRa;
858 DWORD IntLo;
859 DWORD IntHi;
861 /* These are selected by CONTEXT_FLOATING_POINT */
862 DWORD Fsr;
864 /* These are selected by CONTEXT_CONTROL */
865 DWORD Fir;
866 DWORD Psr;
868 DWORD ContextFlags;
869 DWORD Fill[2];
870 } CONTEXT;
872 #endif /* _MIPS_ */
874 /* PowerPC context definitions */
875 #ifdef __powerpc__
877 #define CONTEXT_CONTROL 0x0001
878 #define CONTEXT_FLOATING_POINT 0x0002
879 #define CONTEXT_INTEGER 0x0004
880 #define CONTEXT_DEBUG_REGISTERS 0x0008
881 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
883 typedef struct
885 /* These are selected by CONTEXT_FLOATING_POINT */
886 double Fpr0;
887 double Fpr1;
888 double Fpr2;
889 double Fpr3;
890 double Fpr4;
891 double Fpr5;
892 double Fpr6;
893 double Fpr7;
894 double Fpr8;
895 double Fpr9;
896 double Fpr10;
897 double Fpr11;
898 double Fpr12;
899 double Fpr13;
900 double Fpr14;
901 double Fpr15;
902 double Fpr16;
903 double Fpr17;
904 double Fpr18;
905 double Fpr19;
906 double Fpr20;
907 double Fpr21;
908 double Fpr22;
909 double Fpr23;
910 double Fpr24;
911 double Fpr25;
912 double Fpr26;
913 double Fpr27;
914 double Fpr28;
915 double Fpr29;
916 double Fpr30;
917 double Fpr31;
918 double Fpscr;
920 /* These are selected by CONTEXT_INTEGER */
921 DWORD Gpr0;
922 DWORD Gpr1;
923 DWORD Gpr2;
924 DWORD Gpr3;
925 DWORD Gpr4;
926 DWORD Gpr5;
927 DWORD Gpr6;
928 DWORD Gpr7;
929 DWORD Gpr8;
930 DWORD Gpr9;
931 DWORD Gpr10;
932 DWORD Gpr11;
933 DWORD Gpr12;
934 DWORD Gpr13;
935 DWORD Gpr14;
936 DWORD Gpr15;
937 DWORD Gpr16;
938 DWORD Gpr17;
939 DWORD Gpr18;
940 DWORD Gpr19;
941 DWORD Gpr20;
942 DWORD Gpr21;
943 DWORD Gpr22;
944 DWORD Gpr23;
945 DWORD Gpr24;
946 DWORD Gpr25;
947 DWORD Gpr26;
948 DWORD Gpr27;
949 DWORD Gpr28;
950 DWORD Gpr29;
951 DWORD Gpr30;
952 DWORD Gpr31;
954 DWORD Cr;
955 DWORD Xer;
957 /* These are selected by CONTEXT_CONTROL */
958 DWORD Msr;
959 DWORD Iar; /* Instruction Address Register , aka PC ... */
960 DWORD Lr;
961 DWORD Ctr;
963 DWORD ContextFlags;
965 DWORD Dar; /* Fault registers for coredump */
966 DWORD Dsisr;
967 DWORD Trap; /* number of powerpc exception taken */
969 /* These are selected by CONTEXT_DEBUG_REGISTERS */
970 DWORD Dr0;
971 DWORD Dr1;
972 DWORD Dr2;
973 DWORD Dr3;
974 DWORD Dr4;
975 DWORD Dr5;
976 DWORD Dr6;
977 DWORD Dr7;
978 } CONTEXT;
980 typedef struct _STACK_FRAME_HEADER
982 DWORD BackChain;
983 DWORD GlueSaved1;
984 DWORD GlueSaved2;
985 DWORD Reserved1;
986 DWORD Spare1;
987 DWORD Spare2;
989 DWORD Parameter0;
990 DWORD Parameter1;
991 DWORD Parameter2;
992 DWORD Parameter3;
993 DWORD Parameter4;
994 DWORD Parameter5;
995 DWORD Parameter6;
996 DWORD Parameter7;
997 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
999 #endif /* __powerpc__ */
1001 #ifdef __ALPHA__
1004 * FIXME:
1006 * I have no idea if any of this is right as I just ripped
1007 * it from mingw-win32api.
1011 #define CONTEXT_ALPHA 0x20000
1012 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L)
1013 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L)
1014 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L)
1015 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER)
1016 typedef struct _CONTEXT {
1017 ULONGLONG FltF0;
1018 ULONGLONG FltF1;
1019 ULONGLONG FltF2;
1020 ULONGLONG FltF3;
1021 ULONGLONG FltF4;
1022 ULONGLONG FltF5;
1023 ULONGLONG FltF6;
1024 ULONGLONG FltF7;
1025 ULONGLONG FltF8;
1026 ULONGLONG FltF9;
1027 ULONGLONG FltF10;
1028 ULONGLONG FltF11;
1029 ULONGLONG FltF12;
1030 ULONGLONG FltF13;
1031 ULONGLONG FltF14;
1032 ULONGLONG FltF15;
1033 ULONGLONG FltF16;
1034 ULONGLONG FltF17;
1035 ULONGLONG FltF18;
1036 ULONGLONG FltF19;
1037 ULONGLONG FltF20;
1038 ULONGLONG FltF21;
1039 ULONGLONG FltF22;
1040 ULONGLONG FltF23;
1041 ULONGLONG FltF24;
1042 ULONGLONG FltF25;
1043 ULONGLONG FltF26;
1044 ULONGLONG FltF27;
1045 ULONGLONG FltF28;
1046 ULONGLONG FltF29;
1047 ULONGLONG FltF30;
1048 ULONGLONG FltF31;
1049 ULONGLONG IntV0;
1050 ULONGLONG IntT0;
1051 ULONGLONG IntT1;
1052 ULONGLONG IntT2;
1053 ULONGLONG IntT3;
1054 ULONGLONG IntT4;
1055 ULONGLONG IntT5;
1056 ULONGLONG IntT6;
1057 ULONGLONG IntT7;
1058 ULONGLONG IntS0;
1059 ULONGLONG IntS1;
1060 ULONGLONG IntS2;
1061 ULONGLONG IntS3;
1062 ULONGLONG IntS4;
1063 ULONGLONG IntS5;
1064 ULONGLONG IntFp;
1065 ULONGLONG IntA0;
1066 ULONGLONG IntA1;
1067 ULONGLONG IntA2;
1068 ULONGLONG IntA3;
1069 ULONGLONG IntA4;
1070 ULONGLONG IntA5;
1071 ULONGLONG IntT8;
1072 ULONGLONG IntT9;
1073 ULONGLONG IntT10;
1074 ULONGLONG IntT11;
1075 ULONGLONG IntRa;
1076 ULONGLONG IntT12;
1077 ULONGLONG IntAt;
1078 ULONGLONG IntGp;
1079 ULONGLONG IntSp;
1080 ULONGLONG IntZero;
1081 ULONGLONG Fpcr;
1082 ULONGLONG SoftFpcr;
1083 ULONGLONG Fir;
1084 DWORD Psr;
1085 DWORD ContextFlags;
1086 DWORD Fill[4];
1087 } CONTEXT;
1089 #endif /* __ALPHA__ */
1091 #ifdef __sparc__
1094 * FIXME:
1096 * There is no official CONTEXT structure defined for the SPARC
1097 * architecture, so I just made one up.
1099 * This structure is valid only for 32-bit SPARC architectures,
1100 * not for 64-bit SPARC.
1102 * Note that this structure contains only the 'top-level' registers;
1103 * the rest of the register window chain is not visible.
1105 * The layout follows the Solaris 'prgregset_t' structure.
1109 #define CONTEXT_SPARC 0x10000000
1111 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1112 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1113 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1115 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1117 typedef struct _CONTEXT
1119 DWORD ContextFlags;
1121 /* These are selected by CONTEXT_INTEGER */
1122 DWORD g0;
1123 DWORD g1;
1124 DWORD g2;
1125 DWORD g3;
1126 DWORD g4;
1127 DWORD g5;
1128 DWORD g6;
1129 DWORD g7;
1130 DWORD o0;
1131 DWORD o1;
1132 DWORD o2;
1133 DWORD o3;
1134 DWORD o4;
1135 DWORD o5;
1136 DWORD o6;
1137 DWORD o7;
1138 DWORD l0;
1139 DWORD l1;
1140 DWORD l2;
1141 DWORD l3;
1142 DWORD l4;
1143 DWORD l5;
1144 DWORD l6;
1145 DWORD l7;
1146 DWORD i0;
1147 DWORD i1;
1148 DWORD i2;
1149 DWORD i3;
1150 DWORD i4;
1151 DWORD i5;
1152 DWORD i6;
1153 DWORD i7;
1155 /* These are selected by CONTEXT_CONTROL */
1156 DWORD psr;
1157 DWORD pc;
1158 DWORD npc;
1159 DWORD y;
1160 DWORD wim;
1161 DWORD tbr;
1163 /* FIXME: floating point registers missing */
1165 } CONTEXT;
1167 #endif /* __sparc__ */
1169 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1170 #error You need to define a CONTEXT for your CPU
1171 #endif
1173 typedef CONTEXT *PCONTEXT;
1176 * Language IDs
1179 #define MAKELCID(l, s) (MAKELONG(l, s))
1181 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1182 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1183 #define SUBLANGID(l) ((WORD)(l) >> 10)
1185 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1186 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1188 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1189 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1190 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1191 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1192 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1194 #define UNREFERENCED_PARAMETER(u) (u)
1195 #define DBG_UNREFERENCED_PARAMETER(u) (u)
1196 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (u)
1198 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x28,
1199 * 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x3a, 0x3b, 0x3c
1201 #define LANG_NEUTRAL 0x00
1202 #define LANG_INVARIANT 0x7f
1204 #define LANG_AFRIKAANS 0x36
1205 #define LANG_ALBANIAN 0x1c
1206 #define LANG_ARABIC 0x01
1207 #define LANG_ARMENIAN 0x2b
1208 #define LANG_ASSAMESE 0x4d
1209 #define LANG_AZERI 0x2c
1210 #define LANG_BASQUE 0x2d
1211 #define LANG_BELARUSIAN 0x23
1212 #define LANG_BENGALI 0x45
1213 #define LANG_BULGARIAN 0x02
1214 #define LANG_CATALAN 0x03
1215 #define LANG_CHINESE 0x04
1216 #define LANG_CROATIAN 0x1a
1217 #define LANG_CZECH 0x05
1218 #define LANG_DANISH 0x06
1219 #define LANG_DIVEHI 0x65
1220 #define LANG_DUTCH 0x13
1221 #define LANG_ENGLISH 0x09
1222 #define LANG_ESTONIAN 0x25
1223 #define LANG_FAEROESE 0x38
1224 #define LANG_FARSI 0x29
1225 #define LANG_FINNISH 0x0b
1226 #define LANG_FRENCH 0x0c
1227 #define LANG_GALICIAN 0x56
1228 #define LANG_GEORGIAN 0x37
1229 #define LANG_GERMAN 0x07
1230 #define LANG_GREEK 0x08
1231 #define LANG_GUJARATI 0x47
1232 #define LANG_HEBREW 0x0d
1233 #define LANG_HINDI 0x39
1234 #define LANG_HUNGARIAN 0x0e
1235 #define LANG_ICELANDIC 0x0f
1236 #define LANG_INDONESIAN 0x21
1237 #define LANG_ITALIAN 0x10
1238 #define LANG_JAPANESE 0x11
1239 #define LANG_KANNADA 0x4b
1240 #define LANG_KASHMIRI 0x60
1241 #define LANG_KAZAK 0x3f
1242 #define LANG_KONKANI 0x57
1243 #define LANG_KOREAN 0x12
1244 #define LANG_KYRGYZ 0x40
1245 #define LANG_LATVIAN 0x26
1246 #define LANG_LITHUANIAN 0x27
1247 #define LANG_MACEDONIAN 0x2f
1248 #define LANG_MALAY 0x3e
1249 #define LANG_MALAYALAM 0x4c
1250 #define LANG_MANIPURI 0x58
1251 #define LANG_MARATHI 0x4e
1252 #define LANG_MONGOLIAN 0x50
1253 #define LANG_NEPALI 0x61
1254 #define LANG_NORWEGIAN 0x14
1255 #define LANG_ORIYA 0x48
1256 #define LANG_POLISH 0x15
1257 #define LANG_PORTUGUESE 0x16
1258 #define LANG_PUNJABI 0x46
1259 #define LANG_ROMANIAN 0x18
1260 #define LANG_RUSSIAN 0x19
1261 #define LANG_SANSKRIT 0x4f
1262 #define LANG_SERBIAN 0x1a
1263 #define LANG_SINDHI 0x59
1264 #define LANG_SLOVAK 0x1b
1265 #define LANG_SLOVENIAN 0x24
1266 #define LANG_SPANISH 0x0a
1267 #define LANG_SWAHILI 0x41
1268 #define LANG_SWEDISH 0x1d
1269 #define LANG_SYRIAC 0x5a
1270 #define LANG_TAMIL 0x49
1271 #define LANG_TATAR 0x44
1272 #define LANG_TELUGU 0x4a
1273 #define LANG_THAI 0x1e
1274 #define LANG_TURKISH 0x1f
1275 #define LANG_UKRAINIAN 0x22
1276 #define LANG_URDU 0x20
1277 #define LANG_UZBEK 0x43
1278 #define LANG_VIETNAMESE 0x2a
1280 /* FIXME: these are not in the Windows header */
1281 #define LANG_GAELIC 0x3c
1282 #define LANG_MALTESE 0x3a
1283 #define LANG_MAORI 0x28
1284 #define LANG_RHAETO_ROMANCE 0x17
1285 #define LANG_SAAMI 0x3b
1286 #define LANG_SORBIAN 0x2e
1287 #define LANG_SUTU 0x30
1288 #define LANG_TSONGA 0x31
1289 #define LANG_TSWANA 0x32
1290 #define LANG_VENDA 0x33
1291 #define LANG_XHOSA 0x34
1292 #define LANG_ZULU 0x35
1294 /* non standard; keep the number high enough (but < 0xff) */
1295 #define LANG_ESPERANTO 0x8f
1296 #define LANG_WALON 0x90
1297 #define LANG_CORNISH 0x91
1298 #define LANG_WELSH 0x92
1299 #define LANG_BRETON 0x93
1301 /* Sublanguage definitions */
1302 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1303 #define SUBLANG_DEFAULT 0x01 /* user default */
1304 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1306 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1307 #define SUBLANG_ARABIC_IRAQ 0x02
1308 #define SUBLANG_ARABIC_EGYPT 0x03
1309 #define SUBLANG_ARABIC_LIBYA 0x04
1310 #define SUBLANG_ARABIC_ALGERIA 0x05
1311 #define SUBLANG_ARABIC_MOROCCO 0x06
1312 #define SUBLANG_ARABIC_TUNISIA 0x07
1313 #define SUBLANG_ARABIC_OMAN 0x08
1314 #define SUBLANG_ARABIC_YEMEN 0x09
1315 #define SUBLANG_ARABIC_SYRIA 0x0a
1316 #define SUBLANG_ARABIC_JORDAN 0x0b
1317 #define SUBLANG_ARABIC_LEBANON 0x0c
1318 #define SUBLANG_ARABIC_KUWAIT 0x0d
1319 #define SUBLANG_ARABIC_UAE 0x0e
1320 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1321 #define SUBLANG_ARABIC_QATAR 0x10
1322 #define SUBLANG_AZERI_LATIN 0x01
1323 #define SUBLANG_AZERI_CYRILLIC 0x02
1324 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1325 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1326 #define SUBLANG_CHINESE_HONGKONG 0x03
1327 #define SUBLANG_CHINESE_SINGAPORE 0x04
1328 #define SUBLANG_CHINESE_MACAU 0x05
1329 #define SUBLANG_DUTCH 0x01
1330 #define SUBLANG_DUTCH_BELGIAN 0x02
1331 #define SUBLANG_ENGLISH_US 0x01
1332 #define SUBLANG_ENGLISH_UK 0x02
1333 #define SUBLANG_ENGLISH_AUS 0x03
1334 #define SUBLANG_ENGLISH_CAN 0x04
1335 #define SUBLANG_ENGLISH_NZ 0x05
1336 #define SUBLANG_ENGLISH_EIRE 0x06
1337 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1338 #define SUBLANG_ENGLISH_JAMAICA 0x08
1339 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1340 #define SUBLANG_ENGLISH_BELIZE 0x0a
1341 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1342 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1343 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1344 #define SUBLANG_FRENCH 0x01
1345 #define SUBLANG_FRENCH_BELGIAN 0x02
1346 #define SUBLANG_FRENCH_CANADIAN 0x03
1347 #define SUBLANG_FRENCH_SWISS 0x04
1348 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1349 #define SUBLANG_FRENCH_MONACO 0x06
1350 #define SUBLANG_GERMAN 0x01
1351 #define SUBLANG_GERMAN_SWISS 0x02
1352 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1353 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1354 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1355 #define SUBLANG_ITALIAN 0x01
1356 #define SUBLANG_ITALIAN_SWISS 0x02
1357 #define SUBLANG_KASHMIRI_SASIA 0x02
1358 #define SUBLANG_KASHMIRI_INDIA 0x02
1359 #define SUBLANG_KOREAN 0x01
1360 #define SUBLANG_LITHUANIAN 0x01
1361 #define SUBLANG_MALAY_MALAYSIA 0x01
1362 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1363 #define SUBLANG_NEPALI_INDIA 0x02
1364 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1365 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1366 #define SUBLANG_PORTUGUESE 0x02
1367 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1368 #define SUBLANG_SERBIAN_LATIN 0x02
1369 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1370 #define SUBLANG_SPANISH 0x01
1371 #define SUBLANG_SPANISH_MEXICAN 0x02
1372 #define SUBLANG_SPANISH_MODERN 0x03
1373 #define SUBLANG_SPANISH_GUATEMALA 0x04
1374 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1375 #define SUBLANG_SPANISH_PANAMA 0x06
1376 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1377 #define SUBLANG_SPANISH_VENEZUELA 0x08
1378 #define SUBLANG_SPANISH_COLOMBIA 0x09
1379 #define SUBLANG_SPANISH_PERU 0x0a
1380 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1381 #define SUBLANG_SPANISH_ECUADOR 0x0c
1382 #define SUBLANG_SPANISH_CHILE 0x0d
1383 #define SUBLANG_SPANISH_URUGUAY 0x0e
1384 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1385 #define SUBLANG_SPANISH_BOLIVIA 0x10
1386 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1387 #define SUBLANG_SPANISH_HONDURAS 0x12
1388 #define SUBLANG_SPANISH_NICARAGUA 0x13
1389 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1390 #define SUBLANG_SWEDISH 0x01
1391 #define SUBLANG_SWEDISH_FINLAND 0x02
1392 #define SUBLANG_URDU_PAKISTAN 0x01
1393 #define SUBLANG_URDU_INDIA 0x02
1394 #define SUBLANG_UZBEK_LATIN 0x01
1395 #define SUBLANG_UZBEK_CYRILLIC 0x02
1397 /* FIXME: these are not in the Windows header */
1398 #define SUBLANG_DUTCH_SURINAM 0x03
1399 #define SUBLANG_ROMANIAN 0x01
1400 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1401 #define SUBLANG_RUSSIAN 0x01
1402 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1403 #define SUBLANG_CROATIAN 0x01
1404 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1405 #define SUBLANG_GAELIC 0x01
1406 #define SUBLANG_GAELIC_SCOTTISH 0x02
1407 #define SUBLANG_GAELIC_MANX 0x03
1411 * Sort definitions
1414 #define SORT_DEFAULT 0x0
1415 #define SORT_JAPANESE_XJIS 0x0
1416 #define SORT_JAPANESE_UNICODE 0x1
1417 #define SORT_CHINESE_BIG5 0x0
1418 #define SORT_CHINESE_UNICODE 0x1
1419 #define SORT_KOREAN_KSC 0x0
1420 #define SORT_KOREAN_UNICODE 0x1
1425 * Definitions for IsTextUnicode()
1428 #define IS_TEXT_UNICODE_ASCII16 0x0001
1429 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1430 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1431 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1432 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1433 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1434 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1435 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1436 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1437 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1438 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1439 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1440 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1441 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1442 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1443 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1445 #define MAXIMUM_WAIT_OBJECTS 64
1446 #define MAXIMUM_SUSPEND_COUNT 127
1450 * From OS/2 2.0 exception handling
1451 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1454 #define EH_NONCONTINUABLE 0x01
1455 #define EH_UNWINDING 0x02
1456 #define EH_EXIT_UNWIND 0x04
1457 #define EH_STACK_INVALID 0x08
1458 #define EH_NESTED_CALL 0x10
1460 #define EXCEPTION_CONTINUABLE 0
1461 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1464 * The exception record used by Win32 to give additional information
1465 * about exception to exception handlers.
1468 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1470 typedef struct __EXCEPTION_RECORD
1472 DWORD ExceptionCode;
1473 DWORD ExceptionFlags;
1474 struct __EXCEPTION_RECORD *ExceptionRecord;
1476 LPVOID ExceptionAddress;
1477 DWORD NumberParameters;
1478 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1479 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1482 * The exception pointers structure passed to exception filters
1483 * in except() and the UnhandledExceptionFilter().
1486 typedef struct _EXCEPTION_POINTERS
1488 PEXCEPTION_RECORD ExceptionRecord;
1489 PCONTEXT ContextRecord;
1490 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1494 * The exception frame, used for registering exception handlers
1495 * Win32 cares only about this, but compilers generally emit
1496 * larger exception frames for their own use.
1499 struct _EXCEPTION_REGISTRATION_RECORD;
1501 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
1502 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
1504 typedef struct _EXCEPTION_REGISTRATION_RECORD
1506 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
1507 PEXCEPTION_HANDLER Handler;
1508 } EXCEPTION_REGISTRATION_RECORD, *PEXCEPTION_REGISTRATION_RECORD;
1511 * function pointer to a exception filter
1514 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
1515 typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1516 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1518 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1519 LPTOP_LEVEL_EXCEPTION_FILTER
1520 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1522 typedef struct _NT_TIB
1524 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1525 PVOID StackBase;
1526 PVOID StackLimit;
1527 PVOID SubSystemTib;
1528 union {
1529 PVOID FiberData;
1530 DWORD Version;
1531 } DUMMYUNIONNAME;
1532 PVOID ArbitraryUserPointer;
1533 struct _NT_TIB *Self;
1534 } NT_TIB, *PNT_TIB;
1536 struct _TEB;
1538 #if defined(__i386__) && defined(__GNUC__)
1539 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1540 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1542 struct _TEB *teb;
1543 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1544 return teb;
1546 #elif defined(__i386__) && defined(_MSC_VER)
1547 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1549 struct _TEB *teb;
1550 __asm mov eax, fs:[0x18];
1551 __asm mov teb, eax;
1552 return teb;
1554 #elif defined(__powerpc__)
1555 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1556 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1558 struct _TEB *teb;
1559 # ifdef __APPLE__
1560 __asm__("\tmr %0, r13" : "=r" (teb));
1561 # else
1562 __asm__("\tmr %0, 2" : "=r" (teb));
1563 # endif
1564 return teb;
1566 #else
1567 extern struct _TEB * WINAPI NtCurrentTeb(void);
1568 #endif
1570 #ifdef NONAMELESSUNION
1571 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
1572 #else
1573 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
1574 #endif
1575 #define GetFiberData() (*(void **)GetCurrentFiber())
1578 * File formats definitions
1581 #include <pshpack2.h>
1582 typedef struct _IMAGE_DOS_HEADER {
1583 WORD e_magic; /* 00: MZ Header signature */
1584 WORD e_cblp; /* 02: Bytes on last page of file */
1585 WORD e_cp; /* 04: Pages in file */
1586 WORD e_crlc; /* 06: Relocations */
1587 WORD e_cparhdr; /* 08: Size of header in paragraphs */
1588 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
1589 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
1590 WORD e_ss; /* 0e: Initial (relative) SS value */
1591 WORD e_sp; /* 10: Initial SP value */
1592 WORD e_csum; /* 12: Checksum */
1593 WORD e_ip; /* 14: Initial IP value */
1594 WORD e_cs; /* 16: Initial (relative) CS value */
1595 WORD e_lfarlc; /* 18: File address of relocation table */
1596 WORD e_ovno; /* 1a: Overlay number */
1597 WORD e_res[4]; /* 1c: Reserved words */
1598 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
1599 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
1600 WORD e_res2[10]; /* 28: Reserved words */
1601 DWORD e_lfanew; /* 3c: Offset to extended header */
1602 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
1603 #include <poppack.h>
1605 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1606 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1607 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1608 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1609 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1610 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1613 * This is the Windows executable (NE) header.
1614 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1616 #include <pshpack2.h>
1617 typedef struct
1619 WORD ne_magic; /* 00 NE signature 'NE' */
1620 BYTE ne_ver; /* 02 Linker version number */
1621 BYTE ne_rev; /* 03 Linker revision number */
1622 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
1623 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
1624 LONG ne_crc; /* 08 Checksum */
1625 WORD ne_flags; /* 0c Flags about segments in this file */
1626 WORD ne_autodata; /* 0e Automatic data segment number */
1627 WORD ne_heap; /* 10 Initial size of local heap */
1628 WORD ne_stack; /* 12 Initial size of stack */
1629 DWORD ne_csip; /* 14 Initial CS:IP */
1630 DWORD ne_sssp; /* 18 Initial SS:SP */
1631 WORD ne_cseg; /* 1c # of entries in segment table */
1632 WORD ne_cmod; /* 1e # of entries in module reference tab. */
1633 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
1634 WORD ne_segtab; /* 22 Offset to segment table */
1635 WORD ne_rsrctab; /* 24 Offset to resource table */
1636 WORD ne_restab; /* 26 Offset to resident-name table */
1637 WORD ne_modtab; /* 28 Offset to module reference table */
1638 WORD ne_imptab; /* 2a Offset to imported name table */
1639 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
1640 WORD ne_cmovent; /* 30 # of movable entry points */
1641 WORD ne_align; /* 32 Logical sector alignment shift count */
1642 WORD ne_cres; /* 34 # of resource segments */
1643 BYTE ne_exetyp; /* 36 Flags indicating target OS */
1644 BYTE ne_flagsothers; /* 37 Additional information flags */
1645 WORD ne_pretthunks; /* 38 Offset to return thunks */
1646 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
1647 WORD ne_swaparea; /* 3c Reserved by Microsoft */
1648 WORD ne_expver; /* 3e Expected Windows version number */
1649 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
1650 #include <poppack.h>
1652 #include <pshpack2.h>
1653 typedef struct _IMAGE_VXD_HEADER {
1654 WORD e32_magic;
1655 BYTE e32_border;
1656 BYTE e32_worder;
1657 DWORD e32_level;
1658 WORD e32_cpu;
1659 WORD e32_os;
1660 DWORD e32_ver;
1661 DWORD e32_mflags;
1662 DWORD e32_mpages;
1663 DWORD e32_startobj;
1664 DWORD e32_eip;
1665 DWORD e32_stackobj;
1666 DWORD e32_esp;
1667 DWORD e32_pagesize;
1668 DWORD e32_lastpagesize;
1669 DWORD e32_fixupsize;
1670 DWORD e32_fixupsum;
1671 DWORD e32_ldrsize;
1672 DWORD e32_ldrsum;
1673 DWORD e32_objtab;
1674 DWORD e32_objcnt;
1675 DWORD e32_objmap;
1676 DWORD e32_itermap;
1677 DWORD e32_rsrctab;
1678 DWORD e32_rsrccnt;
1679 DWORD e32_restab;
1680 DWORD e32_enttab;
1681 DWORD e32_dirtab;
1682 DWORD e32_dircnt;
1683 DWORD e32_fpagetab;
1684 DWORD e32_frectab;
1685 DWORD e32_impmod;
1686 DWORD e32_impmodcnt;
1687 DWORD e32_impproc;
1688 DWORD e32_pagesum;
1689 DWORD e32_datapage;
1690 DWORD e32_preload;
1691 DWORD e32_nrestab;
1692 DWORD e32_cbnrestab;
1693 DWORD e32_nressum;
1694 DWORD e32_autodata;
1695 DWORD e32_debuginfo;
1696 DWORD e32_debuglen;
1697 DWORD e32_instpreload;
1698 DWORD e32_instdemand;
1699 DWORD e32_heapsize;
1700 BYTE e32_res3[12];
1701 DWORD e32_winresoff;
1702 DWORD e32_winreslen;
1703 WORD e32_devid;
1704 WORD e32_ddkver;
1705 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
1706 #include <poppack.h>
1708 /* These defines describe the meanings of the bits in the Characteristics
1709 field */
1711 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1712 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1713 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1714 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1715 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
1716 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
1717 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1718 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1719 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1720 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1721 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
1722 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
1723 #define IMAGE_FILE_SYSTEM 0x1000
1724 #define IMAGE_FILE_DLL 0x2000
1725 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
1726 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1728 /* These are the settings of the Machine field. */
1729 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1730 #define IMAGE_FILE_MACHINE_I860 0x014d
1731 #define IMAGE_FILE_MACHINE_I386 0x014c
1732 #define IMAGE_FILE_MACHINE_R3000 0x0162
1733 #define IMAGE_FILE_MACHINE_R4000 0x0166
1734 #define IMAGE_FILE_MACHINE_R10000 0x0168
1735 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
1736 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
1737 #define IMAGE_FILE_MACHINE_SH3 0x01a2
1738 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
1739 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1740 #define IMAGE_FILE_MACHINE_SH4 0x01a6
1741 #define IMAGE_FILE_MACHINE_SH5 0x01a8
1742 #define IMAGE_FILE_MACHINE_ARM 0x01c0
1743 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
1744 #define IMAGE_FILE_MACHINE_AM33 0x01d3
1745 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
1746 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
1747 #define IMAGE_FILE_MACHINE_IA64 0x0200
1748 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
1749 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1750 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
1751 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
1752 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1753 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1754 #define IMAGE_FILE_MACHINE_CEF 0x0cef
1755 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
1756 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1757 #define IMAGE_FILE_MACHINE_M32R 0x9041
1758 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
1760 #define IMAGE_SIZEOF_FILE_HEADER 20
1761 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1762 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1763 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1764 #define IMAGE_SIZEOF_SHORT_NAME 8
1765 #define IMAGE_SIZEOF_SECTION_HEADER 40
1766 #define IMAGE_SIZEOF_SYMBOL 18
1767 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1768 #define IMAGE_SIZEOF_RELOCATION 10
1769 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1770 #define IMAGE_SIZEOF_LINENUMBER 6
1771 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1773 /* Possible Magic values */
1774 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1775 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1777 /* These are indexes into the DataDirectory array */
1778 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1779 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1780 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1781 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1782 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1783 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1784 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1785 #define IMAGE_FILE_DESCRIPTION_STRING 7
1786 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1787 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1788 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1790 /* Directory Entries, indices into the DataDirectory array */
1792 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1793 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1794 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1795 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1796 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1797 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1798 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1799 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1800 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1801 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1802 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1803 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1804 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1805 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1806 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1808 /* Subsystem Values */
1810 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1811 #define IMAGE_SUBSYSTEM_NATIVE 1
1812 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1813 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
1814 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1815 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1816 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
1817 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
1818 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1819 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1820 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1821 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1822 #define IMAGE_SUBSYSTEM_XBOX 14
1824 typedef struct _IMAGE_FILE_HEADER {
1825 WORD Machine;
1826 WORD NumberOfSections;
1827 DWORD TimeDateStamp;
1828 DWORD PointerToSymbolTable;
1829 DWORD NumberOfSymbols;
1830 WORD SizeOfOptionalHeader;
1831 WORD Characteristics;
1832 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
1834 typedef struct _IMAGE_DATA_DIRECTORY {
1835 DWORD VirtualAddress;
1836 DWORD Size;
1837 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
1839 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1841 typedef struct _IMAGE_OPTIONAL_HEADER {
1843 /* Standard fields */
1845 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
1846 BYTE MajorLinkerVersion;
1847 BYTE MinorLinkerVersion;
1848 DWORD SizeOfCode;
1849 DWORD SizeOfInitializedData;
1850 DWORD SizeOfUninitializedData;
1851 DWORD AddressOfEntryPoint; /* 0x10 */
1852 DWORD BaseOfCode;
1853 DWORD BaseOfData;
1855 /* NT additional fields */
1857 DWORD ImageBase;
1858 DWORD SectionAlignment; /* 0x20 */
1859 DWORD FileAlignment;
1860 WORD MajorOperatingSystemVersion;
1861 WORD MinorOperatingSystemVersion;
1862 WORD MajorImageVersion;
1863 WORD MinorImageVersion;
1864 WORD MajorSubsystemVersion; /* 0x30 */
1865 WORD MinorSubsystemVersion;
1866 DWORD Win32VersionValue;
1867 DWORD SizeOfImage;
1868 DWORD SizeOfHeaders;
1869 DWORD CheckSum; /* 0x40 */
1870 WORD Subsystem;
1871 WORD DllCharacteristics;
1872 DWORD SizeOfStackReserve;
1873 DWORD SizeOfStackCommit;
1874 DWORD SizeOfHeapReserve; /* 0x50 */
1875 DWORD SizeOfHeapCommit;
1876 DWORD LoaderFlags;
1877 DWORD NumberOfRvaAndSizes;
1878 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
1879 /* 0xE0 */
1880 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
1882 typedef struct _IMAGE_NT_HEADERS {
1883 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
1884 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
1885 IMAGE_OPTIONAL_HEADER OptionalHeader; /* 0x18 */
1886 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
1888 #define IMAGE_SIZEOF_SHORT_NAME 8
1890 typedef struct _IMAGE_SECTION_HEADER {
1891 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
1892 union {
1893 DWORD PhysicalAddress;
1894 DWORD VirtualSize;
1895 } Misc;
1896 DWORD VirtualAddress;
1897 DWORD SizeOfRawData;
1898 DWORD PointerToRawData;
1899 DWORD PointerToRelocations;
1900 DWORD PointerToLinenumbers;
1901 WORD NumberOfRelocations;
1902 WORD NumberOfLinenumbers;
1903 DWORD Characteristics;
1904 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
1906 #define IMAGE_SIZEOF_SECTION_HEADER 40
1908 #define IMAGE_FIRST_SECTION(ntheader) \
1909 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1910 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1912 /* These defines are for the Characteristics bitfield. */
1913 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1914 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1915 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1916 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1917 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
1918 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1920 #define IMAGE_SCN_CNT_CODE 0x00000020
1921 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1922 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1924 #define IMAGE_SCN_LNK_OTHER 0x00000100
1925 #define IMAGE_SCN_LNK_INFO 0x00000200
1926 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1927 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1928 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1930 /* 0x00002000 - Reserved */
1931 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1932 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1934 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1935 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1936 #define IMAGE_SCN_MEM_16BIT 0x00020000
1937 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1938 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1940 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1941 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1942 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1943 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1944 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1945 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1946 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1947 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
1948 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
1949 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
1950 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
1951 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
1952 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
1953 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
1954 /* 0x00F00000 - Unused */
1955 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
1957 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1960 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1961 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1962 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1963 #define IMAGE_SCN_MEM_SHARED 0x10000000
1964 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1965 #define IMAGE_SCN_MEM_READ 0x40000000
1966 #define IMAGE_SCN_MEM_WRITE 0x80000000
1968 #include <pshpack2.h>
1970 typedef struct _IMAGE_SYMBOL {
1971 union {
1972 BYTE ShortName[8];
1973 struct {
1974 DWORD Short;
1975 DWORD Long;
1976 } Name;
1977 DWORD LongName[2];
1978 } N;
1979 DWORD Value;
1980 SHORT SectionNumber;
1981 WORD Type;
1982 BYTE StorageClass;
1983 BYTE NumberOfAuxSymbols;
1984 } IMAGE_SYMBOL;
1985 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
1987 #define IMAGE_SIZEOF_SYMBOL 18
1989 typedef struct _IMAGE_LINENUMBER {
1990 union {
1991 DWORD SymbolTableIndex;
1992 DWORD VirtualAddress;
1993 } Type;
1994 WORD Linenumber;
1995 } IMAGE_LINENUMBER;
1996 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
1998 #define IMAGE_SIZEOF_LINENUMBER 6
2000 typedef union _IMAGE_AUX_SYMBOL {
2001 struct {
2002 DWORD TagIndex;
2003 union {
2004 struct {
2005 WORD Linenumber;
2006 WORD Size;
2007 } LnSz;
2008 DWORD TotalSize;
2009 } Misc;
2010 union {
2011 struct {
2012 DWORD PointerToLinenumber;
2013 DWORD PointerToNextFunction;
2014 } Function;
2015 struct {
2016 WORD Dimension[4];
2017 } Array;
2018 } FcnAry;
2019 WORD TvIndex;
2020 } Sym;
2021 struct {
2022 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2023 } File;
2024 struct {
2025 DWORD Length;
2026 WORD NumberOfRelocations;
2027 WORD NumberOfLinenumbers;
2028 DWORD CheckSum;
2029 SHORT Number;
2030 BYTE Selection;
2031 } Section;
2032 } IMAGE_AUX_SYMBOL;
2033 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2035 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2037 #include <poppack.h>
2039 #define IMAGE_SYM_UNDEFINED (SHORT)0
2040 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2041 #define IMAGE_SYM_DEBUG (SHORT)-2
2043 #define IMAGE_SYM_TYPE_NULL 0x0000
2044 #define IMAGE_SYM_TYPE_VOID 0x0001
2045 #define IMAGE_SYM_TYPE_CHAR 0x0002
2046 #define IMAGE_SYM_TYPE_SHORT 0x0003
2047 #define IMAGE_SYM_TYPE_INT 0x0004
2048 #define IMAGE_SYM_TYPE_LONG 0x0005
2049 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2050 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2051 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2052 #define IMAGE_SYM_TYPE_UNION 0x0009
2053 #define IMAGE_SYM_TYPE_ENUM 0x000A
2054 #define IMAGE_SYM_TYPE_MOE 0x000B
2055 #define IMAGE_SYM_TYPE_BYTE 0x000C
2056 #define IMAGE_SYM_TYPE_WORD 0x000D
2057 #define IMAGE_SYM_TYPE_UINT 0x000E
2058 #define IMAGE_SYM_TYPE_DWORD 0x000F
2059 #define IMAGE_SYM_TYPE_PCODE 0x8000
2061 #define IMAGE_SYM_DTYPE_NULL 0
2062 #define IMAGE_SYM_DTYPE_POINTER 1
2063 #define IMAGE_SYM_DTYPE_FUNCTION 2
2064 #define IMAGE_SYM_DTYPE_ARRAY 3
2066 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2067 #define IMAGE_SYM_CLASS_NULL 0x0000
2068 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2069 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2070 #define IMAGE_SYM_CLASS_STATIC 0x0003
2071 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2072 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2073 #define IMAGE_SYM_CLASS_LABEL 0x0006
2074 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2075 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2076 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2077 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2078 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2079 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2080 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2081 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2082 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2083 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2084 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2085 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2087 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2088 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2089 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2090 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2091 #define IMAGE_SYM_CLASS_FILE 0x0067
2092 #define IMAGE_SYM_CLASS_SECTION 0x0068
2093 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2095 #define N_BTMASK 0x000F
2096 #define N_TMASK 0x0030
2097 #define N_TMASK1 0x00C0
2098 #define N_TMASK2 0x00F0
2099 #define N_BTSHFT 4
2100 #define N_TSHIFT 2
2102 #define BTYPE(x) ((x) & N_BTMASK)
2104 #ifndef ISPTR
2105 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2106 #endif
2108 #ifndef ISFCN
2109 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2110 #endif
2112 #ifndef ISARY
2113 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2114 #endif
2116 #ifndef ISTAG
2117 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2118 #endif
2120 #ifndef INCREF
2121 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2122 #endif
2123 #ifndef DECREF
2124 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2125 #endif
2127 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2128 #define IMAGE_COMDAT_SELECT_ANY 2
2129 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2130 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2131 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2132 #define IMAGE_COMDAT_SELECT_LARGEST 6
2133 #define IMAGE_COMDAT_SELECT_NEWEST 7
2135 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2136 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2137 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2139 /* Export module directory */
2141 typedef struct _IMAGE_EXPORT_DIRECTORY {
2142 DWORD Characteristics;
2143 DWORD TimeDateStamp;
2144 WORD MajorVersion;
2145 WORD MinorVersion;
2146 DWORD Name;
2147 DWORD Base;
2148 DWORD NumberOfFunctions;
2149 DWORD NumberOfNames;
2150 DWORD AddressOfFunctions;
2151 DWORD AddressOfNames;
2152 DWORD AddressOfNameOrdinals;
2153 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2155 /* Import name entry */
2156 typedef struct _IMAGE_IMPORT_BY_NAME {
2157 WORD Hint;
2158 BYTE Name[1];
2159 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2161 /* Import thunk */
2162 typedef struct _IMAGE_THUNK_DATA {
2163 union {
2164 LPBYTE ForwarderString;
2165 PDWORD Function;
2166 DWORD Ordinal;
2167 PIMAGE_IMPORT_BY_NAME AddressOfData;
2168 } u1;
2169 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
2171 /* Import module directory */
2173 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2174 union {
2175 DWORD Characteristics; /* 0 for terminating null import descriptor */
2176 PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
2177 } u;
2178 DWORD TimeDateStamp; /* 0 if not bound,
2179 * -1 if bound, and real date\time stamp
2180 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2181 * (new BIND)
2182 * otherwise date/time stamp of DLL bound to
2183 * (Old BIND)
2185 DWORD ForwarderChain; /* -1 if no forwarders */
2186 DWORD Name;
2187 /* RVA to IAT (if bound this IAT has actual addresses) */
2188 PIMAGE_THUNK_DATA FirstThunk;
2189 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2191 #define IMAGE_ORDINAL_FLAG 0x80000000
2192 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
2193 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
2195 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2197 DWORD TimeDateStamp;
2198 WORD OffsetModuleName;
2199 WORD NumberOfModuleForwarderRefs;
2200 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2201 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2203 typedef struct _IMAGE_BOUND_FORWARDER_REF
2205 DWORD TimeDateStamp;
2206 WORD OffsetModuleName;
2207 WORD Reserved;
2208 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2210 typedef struct _IMAGE_BASE_RELOCATION
2212 DWORD VirtualAddress;
2213 DWORD SizeOfBlock;
2214 /* WORD TypeOffset[1]; */
2215 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2217 #include <pshpack2.h>
2219 typedef struct _IMAGE_RELOCATION
2221 union {
2222 DWORD VirtualAddress;
2223 DWORD RelocCount;
2224 } DUMMYUNIONNAME;
2225 DWORD SymbolTableIndex;
2226 WORD Type;
2227 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2229 #include <poppack.h>
2231 #define IMAGE_SIZEOF_RELOCATION 10
2233 /* generic relocation types */
2234 #define IMAGE_REL_BASED_ABSOLUTE 0
2235 #define IMAGE_REL_BASED_HIGH 1
2236 #define IMAGE_REL_BASED_LOW 2
2237 #define IMAGE_REL_BASED_HIGHLOW 3
2238 #define IMAGE_REL_BASED_HIGHADJ 4
2239 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2240 #define IMAGE_REL_BASED_SECTION 6
2241 #define IMAGE_REL_BASED_REL 7
2242 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2243 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2244 #define IMAGE_REL_BASED_DIR64 10
2245 #define IMAGE_REL_BASED_HIGH3ADJ 11
2247 /* I386 relocation types */
2248 #define IMAGE_REL_I386_ABSOLUTE 0
2249 #define IMAGE_REL_I386_DIR16 1
2250 #define IMAGE_REL_I386_REL16 2
2251 #define IMAGE_REL_I386_DIR32 6
2252 #define IMAGE_REL_I386_DIR32NB 7
2253 #define IMAGE_REL_I386_SEG12 9
2254 #define IMAGE_REL_I386_SECTION 10
2255 #define IMAGE_REL_I386_SECREL 11
2256 #define IMAGE_REL_I386_REL32 20
2258 /* MIPS relocation types */
2259 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2260 #define IMAGE_REL_MIPS_REFHALF 0x0001
2261 #define IMAGE_REL_MIPS_REFWORD 0x0002
2262 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2263 #define IMAGE_REL_MIPS_REFHI 0x0004
2264 #define IMAGE_REL_MIPS_REFLO 0x0005
2265 #define IMAGE_REL_MIPS_GPREL 0x0006
2266 #define IMAGE_REL_MIPS_LITERAL 0x0007
2267 #define IMAGE_REL_MIPS_SECTION 0x000A
2268 #define IMAGE_REL_MIPS_SECREL 0x000B
2269 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2270 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2271 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2272 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2273 #define IMAGE_REL_MIPS_PAIR 0x0025
2275 /* ALPHA relocation types */
2276 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2277 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2278 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2279 #define IMAGE_REL_ALPHA_GPREL 0x0003
2280 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2281 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2282 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2283 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2284 #define IMAGE_REL_ALPHA_HINT 0x0008
2285 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2286 #define IMAGE_REL_ALPHA_REFHI 0x000A
2287 #define IMAGE_REL_ALPHA_REFLO 0x000B
2288 #define IMAGE_REL_ALPHA_PAIR 0x000C
2289 #define IMAGE_REL_ALPHA_MATCH 0x000D
2290 #define IMAGE_REL_ALPHA_SECTION 0x000E
2291 #define IMAGE_REL_ALPHA_SECREL 0x000F
2292 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2293 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2294 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2295 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2296 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2297 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2298 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2299 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2301 /* PowerPC relocation types */
2302 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2303 #define IMAGE_REL_PPC_ADDR64 0x0001
2304 #define IMAGE_REL_PPC_ADDR 0x0002
2305 #define IMAGE_REL_PPC_ADDR24 0x0003
2306 #define IMAGE_REL_PPC_ADDR16 0x0004
2307 #define IMAGE_REL_PPC_ADDR14 0x0005
2308 #define IMAGE_REL_PPC_REL24 0x0006
2309 #define IMAGE_REL_PPC_REL14 0x0007
2310 #define IMAGE_REL_PPC_TOCREL16 0x0008
2311 #define IMAGE_REL_PPC_TOCREL14 0x0009
2312 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2313 #define IMAGE_REL_PPC_SECREL 0x000B
2314 #define IMAGE_REL_PPC_SECTION 0x000C
2315 #define IMAGE_REL_PPC_IFGLUE 0x000D
2316 #define IMAGE_REL_PPC_IMGLUE 0x000E
2317 #define IMAGE_REL_PPC_SECREL16 0x000F
2318 #define IMAGE_REL_PPC_REFHI 0x0010
2319 #define IMAGE_REL_PPC_REFLO 0x0011
2320 #define IMAGE_REL_PPC_PAIR 0x0012
2321 #define IMAGE_REL_PPC_SECRELLO 0x0013
2322 #define IMAGE_REL_PPC_SECRELHI 0x0014
2323 #define IMAGE_REL_PPC_GPREL 0x0015
2324 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2325 /* modifier bits */
2326 #define IMAGE_REL_PPC_NEG 0x0100
2327 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2328 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2329 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2331 /* SH3 ? relocation type */
2332 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2333 #define IMAGE_REL_SH3_DIRECT16 0x0001
2334 #define IMAGE_REL_SH3_DIRECT 0x0002
2335 #define IMAGE_REL_SH3_DIRECT8 0x0003
2336 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2337 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2338 #define IMAGE_REL_SH3_DIRECT4 0x0006
2339 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2340 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2341 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2342 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2343 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2344 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2345 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2346 #define IMAGE_REL_SH3_SECTION 0x000E
2347 #define IMAGE_REL_SH3_SECREL 0x000F
2348 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2350 /* ARM (Archimedes?) relocation types */
2351 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2352 #define IMAGE_REL_ARM_ADDR 0x0001
2353 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2354 #define IMAGE_REL_ARM_BRANCH24 0x0003
2355 #define IMAGE_REL_ARM_BRANCH11 0x0004
2356 #define IMAGE_REL_ARM_SECTION 0x000E
2357 #define IMAGE_REL_ARM_SECREL 0x000F
2359 /* IA64 relocation types */
2360 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2361 #define IMAGE_REL_IA64_IMM14 0x0001
2362 #define IMAGE_REL_IA64_IMM22 0x0002
2363 #define IMAGE_REL_IA64_IMM64 0x0003
2364 #define IMAGE_REL_IA64_DIR 0x0004
2365 #define IMAGE_REL_IA64_DIR64 0x0005
2366 #define IMAGE_REL_IA64_PCREL21B 0x0006
2367 #define IMAGE_REL_IA64_PCREL21M 0x0007
2368 #define IMAGE_REL_IA64_PCREL21F 0x0008
2369 #define IMAGE_REL_IA64_GPREL22 0x0009
2370 #define IMAGE_REL_IA64_LTOFF22 0x000A
2371 #define IMAGE_REL_IA64_SECTION 0x000B
2372 #define IMAGE_REL_IA64_SECREL22 0x000C
2373 #define IMAGE_REL_IA64_SECREL64I 0x000D
2374 #define IMAGE_REL_IA64_SECREL 0x000E
2375 #define IMAGE_REL_IA64_LTOFF64 0x000F
2376 #define IMAGE_REL_IA64_DIR32NB 0x0010
2377 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2378 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2379 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2380 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2381 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2382 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2383 #define IMAGE_REL_IA64_ADDEND 0x001F
2385 /* archive format */
2387 #define IMAGE_ARCHIVE_START_SIZE 8
2388 #define IMAGE_ARCHIVE_START "!<arch>\n"
2389 #define IMAGE_ARCHIVE_END "`\n"
2390 #define IMAGE_ARCHIVE_PAD "\n"
2391 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2392 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2394 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2396 BYTE Name[16];
2397 BYTE Date[12];
2398 BYTE UserID[6];
2399 BYTE GroupID[6];
2400 BYTE Mode[8];
2401 BYTE Size[10];
2402 BYTE EndHeader[2];
2403 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2405 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2408 * Resource directory stuff
2410 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2411 DWORD Characteristics;
2412 DWORD TimeDateStamp;
2413 WORD MajorVersion;
2414 WORD MinorVersion;
2415 WORD NumberOfNamedEntries;
2416 WORD NumberOfIdEntries;
2417 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2418 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2420 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2421 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2423 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2424 union {
2425 struct {
2426 #ifdef BITFIELDS_BIGENDIAN
2427 unsigned NameIsString:1;
2428 unsigned NameOffset:31;
2429 #else
2430 unsigned NameOffset:31;
2431 unsigned NameIsString:1;
2432 #endif
2433 } DUMMYSTRUCTNAME1;
2434 DWORD Name;
2435 struct {
2436 #ifdef WORDS_BIGENDIAN
2437 WORD __pad;
2438 WORD Id;
2439 #else
2440 WORD Id;
2441 WORD __pad;
2442 #endif
2443 } DUMMYSTRUCTNAME2;
2444 } DUMMYUNIONNAME1;
2445 union {
2446 DWORD OffsetToData;
2447 struct {
2448 #ifdef BITFIELDS_BIGENDIAN
2449 unsigned DataIsDirectory:1;
2450 unsigned OffsetToDirectory:31;
2451 #else
2452 unsigned OffsetToDirectory:31;
2453 unsigned DataIsDirectory:1;
2454 #endif
2455 } DUMMYSTRUCTNAME3;
2456 } DUMMYUNIONNAME2;
2457 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2460 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2461 WORD Length;
2462 CHAR NameString[ 1 ];
2463 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2465 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2466 WORD Length;
2467 WCHAR NameString[ 1 ];
2468 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2470 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2471 DWORD OffsetToData;
2472 DWORD Size;
2473 DWORD CodePage;
2474 DWORD ResourceHandle;
2475 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2478 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
2479 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
2482 typedef struct _IMAGE_TLS_DIRECTORY {
2483 DWORD StartAddressOfRawData;
2484 DWORD EndAddressOfRawData;
2485 LPDWORD AddressOfIndex;
2486 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2487 DWORD SizeOfZeroFill;
2488 DWORD Characteristics;
2489 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2491 typedef struct _IMAGE_DEBUG_DIRECTORY {
2492 DWORD Characteristics;
2493 DWORD TimeDateStamp;
2494 WORD MajorVersion;
2495 WORD MinorVersion;
2496 DWORD Type;
2497 DWORD SizeOfData;
2498 DWORD AddressOfRawData;
2499 DWORD PointerToRawData;
2500 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
2502 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2503 #define IMAGE_DEBUG_TYPE_COFF 1
2504 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2505 #define IMAGE_DEBUG_TYPE_FPO 3
2506 #define IMAGE_DEBUG_TYPE_MISC 4
2507 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2508 #define IMAGE_DEBUG_TYPE_FIXUP 6
2509 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2510 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2511 #define IMAGE_DEBUG_TYPE_BORLAND 9
2512 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2514 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2515 DWORD NumberOfSymbols;
2516 DWORD LvaToFirstSymbol;
2517 DWORD NumberOfLinenumbers;
2518 DWORD LvaToFirstLinenumber;
2519 DWORD RvaToFirstByteOfCode;
2520 DWORD RvaToLastByteOfCode;
2521 DWORD RvaToFirstByteOfData;
2522 DWORD RvaToLastByteOfData;
2523 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
2525 #define FRAME_FPO 0
2526 #define FRAME_TRAP 1
2527 #define FRAME_TSS 2
2528 #define FRAME_NONFPO 3
2530 typedef struct _FPO_DATA {
2531 DWORD ulOffStart;
2532 DWORD cbProcSize;
2533 DWORD cdwLocals;
2534 WORD cdwParams;
2535 unsigned cbProlog : 8;
2536 unsigned cbRegs : 3;
2537 unsigned fHasSEH : 1;
2538 unsigned fUseBP : 1;
2539 unsigned reserved : 1;
2540 unsigned cbFrame : 2;
2541 } FPO_DATA, *PFPO_DATA;
2543 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2544 DWORD Characteristics;
2545 DWORD TimeDateStamp;
2546 WORD MajorVersion;
2547 WORD MinorVersion;
2548 DWORD GlobalFlagsClear;
2549 DWORD GlobalFlagsSet;
2550 DWORD CriticalSectionDefaultTimeout;
2551 DWORD DeCommitFreeBlockThreshold;
2552 DWORD DeCommitTotalFreeThreshold;
2553 PVOID LockPrefixTable;
2554 DWORD MaximumAllocationSize;
2555 DWORD VirtualMemoryThreshold;
2556 DWORD ProcessHeapFlags;
2557 DWORD ProcessAffinityMask;
2558 WORD CSDVersion;
2559 WORD Reserved1;
2560 PVOID EditList;
2561 DWORD Reserved[1];
2562 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
2564 typedef struct _IMAGE_FUNCTION_ENTRY {
2565 DWORD StartingAddress;
2566 DWORD EndingAddress;
2567 DWORD EndOfPrologue;
2568 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
2570 #define IMAGE_DEBUG_MISC_EXENAME 1
2572 typedef struct _IMAGE_DEBUG_MISC {
2573 DWORD DataType;
2574 DWORD Length;
2575 BYTE Unicode;
2576 BYTE Reserved[ 3 ];
2577 BYTE Data[ 1 ];
2578 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
2580 /* This is the structure that appears at the very start of a .DBG file. */
2582 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
2583 WORD Signature;
2584 WORD Flags;
2585 WORD Machine;
2586 WORD Characteristics;
2587 DWORD TimeDateStamp;
2588 DWORD CheckSum;
2589 DWORD ImageBase;
2590 DWORD SizeOfImage;
2591 DWORD NumberOfSections;
2592 DWORD ExportedNamesSize;
2593 DWORD DebugDirectorySize;
2594 DWORD SectionAlignment;
2595 DWORD Reserved[ 2 ];
2596 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
2598 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2601 typedef struct tagMESSAGE_RESOURCE_ENTRY {
2602 WORD Length;
2603 WORD Flags;
2604 BYTE Text[1];
2605 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2606 #define MESSAGE_RESOURCE_UNICODE 0x0001
2608 typedef struct tagMESSAGE_RESOURCE_BLOCK {
2609 DWORD LowId;
2610 DWORD HighId;
2611 DWORD OffsetToEntries;
2612 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2614 typedef struct tagMESSAGE_RESOURCE_DATA {
2615 DWORD NumberOfBlocks;
2616 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
2617 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2620 * Here follows typedefs for security and tokens.
2624 * First a constant for the following typdefs.
2627 #define ANYSIZE_ARRAY 1
2629 /* FIXME: Orphan. What does it point to? */
2630 typedef PVOID PACCESS_TOKEN;
2633 * TOKEN_INFORMATION_CLASS
2636 typedef enum _TOKEN_INFORMATION_CLASS {
2637 TokenUser = 1,
2638 TokenGroups,
2639 TokenPrivileges,
2640 TokenOwner,
2641 TokenPrimaryGroup,
2642 TokenDefaultDacl,
2643 TokenSource,
2644 TokenType,
2645 TokenImpersonationLevel,
2646 TokenStatistics,
2647 TokenRestrictedSids,
2648 TokenSessionId,
2649 TokenGroupsAndPrivileges,
2650 TokenSessionReference,
2651 TokenSandBoxInert
2652 } TOKEN_INFORMATION_CLASS;
2654 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
2655 #define TOKEN_ADJUST_GROUPS 0x0040
2656 #define TOKEN_ADJUST_PRIVILEGES 0x0020
2657 #define TOKEN_ADJUST_SESSIONID 0x0100
2658 #define TOKEN_ASSIGN_PRIMARY 0x0001
2659 #define TOKEN_DUPLICATE 0x0002
2660 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
2661 #define TOKEN_IMPERSONATE 0x0004
2662 #define TOKEN_QUERY 0x0008
2663 #define TOKEN_QUERY_SOURCE 0x0010
2664 #define TOKEN_ADJUST_DEFAULT 0x0080
2665 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
2666 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
2667 TOKEN_ADJUST_PRIVILEGES | \
2668 TOKEN_ADJUST_GROUPS | \
2669 TOKEN_ADJUST_DEFAULT )
2670 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2671 TOKEN_ASSIGN_PRIMARY | \
2672 TOKEN_DUPLICATE | \
2673 TOKEN_IMPERSONATE | \
2674 TOKEN_QUERY | \
2675 TOKEN_QUERY_SOURCE | \
2676 TOKEN_ADJUST_PRIVILEGES | \
2677 TOKEN_ADJUST_GROUPS | \
2678 TOKEN_ADJUST_SESSIONID | \
2679 TOKEN_ADJUST_DEFAULT )
2681 #ifndef _SECURITY_DEFINED
2682 #define _SECURITY_DEFINED
2685 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2687 typedef struct _GENERIC_MAPPING {
2688 ACCESS_MASK GenericRead;
2689 ACCESS_MASK GenericWrite;
2690 ACCESS_MASK GenericExecute;
2691 ACCESS_MASK GenericAll;
2692 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2694 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2695 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2696 typedef struct {
2697 BYTE Value[6];
2698 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
2699 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2701 #ifndef SID_DEFINED
2702 #define SID_DEFINED
2703 typedef struct _SID {
2704 BYTE Revision;
2705 BYTE SubAuthorityCount;
2706 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2707 DWORD SubAuthority[1];
2708 } SID,*PSID;
2709 #endif /* !defined(SID_DEFINED) */
2711 #define SID_REVISION (1) /* Current revision */
2712 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2713 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2717 * ACL
2720 #define ACL_REVISION1 1
2721 #define ACL_REVISION2 2
2722 #define ACL_REVISION3 3
2723 #define ACL_REVISION4 4
2725 #define MIN_ACL_REVISION ACL_REVISION2
2726 #define MAX_ACL_REVISION ACL_REVISION4
2728 typedef struct _ACL {
2729 BYTE AclRevision;
2730 BYTE Sbz1;
2731 WORD AclSize;
2732 WORD AceCount;
2733 WORD Sbz2;
2734 } ACL, *PACL;
2736 typedef enum _ACL_INFORMATION_CLASS
2738 AclRevisionInformation = 1,
2739 AclSizeInformation
2740 } ACL_INFORMATION_CLASS;
2742 typedef struct _ACL_REVISION_INFORMATION
2744 DWORD AclRevision;
2745 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
2747 typedef struct _ACL_SIZE_INFORMATION
2749 DWORD AceCount;
2750 DWORD AclBytesInUse;
2751 DWORD AclBytesFree;
2752 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
2754 /* SECURITY_DESCRIPTOR */
2755 #define SECURITY_DESCRIPTOR_REVISION 1
2756 #define SECURITY_DESCRIPTOR_REVISION1 1
2760 * Privilege Names
2762 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
2763 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
2764 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
2765 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
2766 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
2767 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
2768 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
2769 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
2770 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
2771 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
2772 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
2773 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
2774 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
2775 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
2776 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
2777 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
2778 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
2779 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
2780 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
2781 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
2782 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
2783 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
2784 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
2785 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
2787 #define SE_GROUP_MANDATORY 0x00000001
2788 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
2789 #define SE_GROUP_ENABLED 0x00000004
2790 #define SE_GROUP_OWNER 0x00000008
2791 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
2792 #define SE_GROUP_LOGON_ID 0xC0000000
2793 #define SE_GROUP_RESOURCE 0x20000000
2795 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
2796 #define SE_PRIVILEGE_ENABLED 0x00000002
2797 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2799 #define SE_OWNER_DEFAULTED 0x00000001
2800 #define SE_GROUP_DEFAULTED 0x00000002
2801 #define SE_DACL_PRESENT 0x00000004
2802 #define SE_DACL_DEFAULTED 0x00000008
2803 #define SE_SACL_PRESENT 0x00000010
2804 #define SE_SACL_DEFAULTED 0x00000020
2805 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
2806 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
2807 #define SE_DACL_AUTO_INHERITED 0x00000400
2808 #define SE_SACL_AUTO_INHERITED 0x00000800
2809 #define SE_DACL_PROTECTED 0x00001000
2810 #define SE_SACL_PROTECTED 0x00002000
2811 #define SE_SELF_RELATIVE 0x00008000
2813 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2814 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
2816 /* The security descriptor structure */
2817 typedef struct {
2818 BYTE Revision;
2819 BYTE Sbz1;
2820 SECURITY_DESCRIPTOR_CONTROL Control;
2821 DWORD Owner;
2822 DWORD Group;
2823 DWORD Sacl;
2824 DWORD Dacl;
2825 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2827 typedef struct {
2828 BYTE Revision;
2829 BYTE Sbz1;
2830 SECURITY_DESCRIPTOR_CONTROL Control;
2831 PSID Owner;
2832 PSID Group;
2833 PACL Sacl;
2834 PACL Dacl;
2835 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
2837 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2839 #endif /* _SECURITY_DEFINED */
2842 * SID_AND_ATTRIBUTES
2845 typedef struct _SID_AND_ATTRIBUTES {
2846 PSID Sid;
2847 DWORD Attributes;
2848 } SID_AND_ATTRIBUTES;
2850 /* security entities */
2851 #define SECURITY_NULL_RID (0x00000000L)
2852 #define SECURITY_WORLD_RID (0x00000000L)
2853 #define SECURITY_LOCAL_RID (0X00000000L)
2855 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2857 /* S-1-1 */
2858 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2860 /* S-1-2 */
2861 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2863 /* S-1-3 */
2864 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2865 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2866 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2867 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2868 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2870 /* S-1-4 */
2871 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2873 /* S-1-5 */
2874 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2875 #define SECURITY_DIALUP_RID 0x00000001L
2876 #define SECURITY_NETWORK_RID 0x00000002L
2877 #define SECURITY_BATCH_RID 0x00000003L
2878 #define SECURITY_INTERACTIVE_RID 0x00000004L
2879 #define SECURITY_LOGON_IDS_RID 0x00000005L
2880 #define SECURITY_SERVICE_RID 0x00000006L
2881 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2882 #define SECURITY_PROXY_RID 0x00000008L
2883 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2884 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2885 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2886 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2887 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2888 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2889 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2890 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2892 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2893 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2894 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2896 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2897 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2898 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2900 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2902 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2905 * TOKEN_USER
2908 typedef struct _TOKEN_USER {
2909 SID_AND_ATTRIBUTES User;
2910 } TOKEN_USER;
2913 * TOKEN_GROUPS
2916 typedef struct _TOKEN_GROUPS {
2917 DWORD GroupCount;
2918 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2919 } TOKEN_GROUPS;
2922 * LUID_AND_ATTRIBUTES
2925 typedef union _LARGE_INTEGER {
2926 struct {
2927 #ifdef WORDS_BIGENDIAN
2928 LONG HighPart;
2929 DWORD LowPart;
2930 #else
2931 DWORD LowPart;
2932 LONG HighPart;
2933 #endif
2934 } u;
2935 #ifndef NONAMELESSSTRUCT
2936 struct {
2937 #ifdef WORDS_BIGENDIAN
2938 LONG HighPart;
2939 DWORD LowPart;
2940 #else
2941 DWORD LowPart;
2942 LONG HighPart;
2943 #endif
2945 #endif
2946 LONGLONG QuadPart;
2947 } LARGE_INTEGER, *PLARGE_INTEGER;
2949 typedef union _ULARGE_INTEGER {
2950 struct {
2951 #ifdef WORDS_BIGENDIAN
2952 DWORD HighPart;
2953 DWORD LowPart;
2954 #else
2955 DWORD LowPart;
2956 DWORD HighPart;
2957 #endif
2958 } u;
2959 #ifndef NONAMELESSSTRUCT
2960 struct {
2961 #ifdef WORDS_BIGENDIAN
2962 DWORD HighPart;
2963 DWORD LowPart;
2964 #else
2965 DWORD LowPart;
2966 DWORD HighPart;
2967 #endif
2969 #endif
2970 ULONGLONG QuadPart;
2971 } ULARGE_INTEGER, *PULARGE_INTEGER;
2974 * Locally Unique Identifier
2977 typedef struct _LUID {
2978 DWORD LowPart;
2979 LONG HighPart;
2980 } LUID, *PLUID;
2982 #include <pshpack4.h>
2983 typedef struct _LUID_AND_ATTRIBUTES {
2984 LUID Luid;
2985 DWORD Attributes;
2986 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
2987 #include <poppack.h>
2990 * PRIVILEGE_SET
2993 typedef struct _PRIVILEGE_SET {
2994 DWORD PrivilegeCount;
2995 DWORD Control;
2996 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2997 } PRIVILEGE_SET, *PPRIVILEGE_SET;
3000 * TOKEN_PRIVILEGES
3003 typedef struct _TOKEN_PRIVILEGES {
3004 DWORD PrivilegeCount;
3005 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3006 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
3009 * TOKEN_OWNER
3012 typedef struct _TOKEN_OWNER {
3013 PSID Owner;
3014 } TOKEN_OWNER;
3017 * TOKEN_PRIMARY_GROUP
3020 typedef struct _TOKEN_PRIMARY_GROUP {
3021 PSID PrimaryGroup;
3022 } TOKEN_PRIMARY_GROUP;
3026 * TOKEN_DEFAULT_DACL
3029 typedef struct _TOKEN_DEFAULT_DACL {
3030 PACL DefaultDacl;
3031 } TOKEN_DEFAULT_DACL;
3034 * TOKEN_SOURCEL
3037 #define TOKEN_SOURCE_LENGTH 8
3039 typedef struct _TOKEN_SOURCE {
3040 char SourceName[TOKEN_SOURCE_LENGTH];
3041 LUID SourceIdentifier;
3042 } TOKEN_SOURCE;
3045 * TOKEN_TYPE
3048 typedef enum tagTOKEN_TYPE {
3049 TokenPrimary = 1,
3050 TokenImpersonation
3051 } TOKEN_TYPE;
3054 * SECURITY_IMPERSONATION_LEVEL
3057 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3058 SecurityAnonymous,
3059 SecurityIdentification,
3060 SecurityImpersonation,
3061 SecurityDelegation
3062 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
3065 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
3066 * PSECURITY_CONTEXT_TRACKING_MODE;
3068 * Quality of Service
3071 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3072 DWORD Length;
3073 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3074 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3075 BOOLEAN EffectiveOnly;
3076 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
3079 * TOKEN_STATISTICS
3082 typedef struct _TOKEN_STATISTICS {
3083 LUID TokenId;
3084 LUID AuthenticationId;
3085 LARGE_INTEGER ExpirationTime;
3086 TOKEN_TYPE TokenType;
3087 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3088 DWORD DynamicCharged;
3089 DWORD DynamicAvailable;
3090 DWORD GroupCount;
3091 DWORD PrivilegeCount;
3092 LUID ModifiedId;
3093 } TOKEN_STATISTICS;
3096 * ACLs of NT
3099 #define ACL_REVISION 2
3101 #define ACL_REVISION1 1
3102 #define ACL_REVISION2 2
3104 /* ACEs, directly starting after an ACL */
3105 typedef struct _ACE_HEADER {
3106 BYTE AceType;
3107 BYTE AceFlags;
3108 WORD AceSize;
3109 } ACE_HEADER,*PACE_HEADER;
3111 /* AceType */
3112 #define ACCESS_ALLOWED_ACE_TYPE 0
3113 #define ACCESS_DENIED_ACE_TYPE 1
3114 #define SYSTEM_AUDIT_ACE_TYPE 2
3115 #define SYSTEM_ALARM_ACE_TYPE 3
3117 /* inherit AceFlags */
3118 #define OBJECT_INHERIT_ACE 0x01
3119 #define CONTAINER_INHERIT_ACE 0x02
3120 #define NO_PROPAGATE_INHERIT_ACE 0x04
3121 #define INHERIT_ONLY_ACE 0x08
3122 #define INHERITED_ACE 0x10
3123 #define VALID_INHERIT_FLAGS 0x0F
3125 /* AceFlags mask for what events we (should) audit */
3126 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3127 #define FAILED_ACCESS_ACE_FLAG 0x80
3129 /* different ACEs depending on AceType
3130 * SidStart marks the begin of a SID
3131 * so the thing finally looks like this:
3132 * 0: ACE_HEADER
3133 * 4: ACCESS_MASK
3134 * 8... : SID
3136 typedef struct _ACCESS_ALLOWED_ACE {
3137 ACE_HEADER Header;
3138 DWORD Mask;
3139 DWORD SidStart;
3140 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
3142 typedef struct _ACCESS_DENIED_ACE {
3143 ACE_HEADER Header;
3144 DWORD Mask;
3145 DWORD SidStart;
3146 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
3148 typedef struct _SYSTEM_AUDIT_ACE {
3149 ACE_HEADER Header;
3150 DWORD Mask;
3151 DWORD SidStart;
3152 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
3154 typedef struct _SYSTEM_ALARM_ACE {
3155 ACE_HEADER Header;
3156 DWORD Mask;
3157 DWORD SidStart;
3158 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
3160 typedef enum tagSID_NAME_USE {
3161 SidTypeUser = 1,
3162 SidTypeGroup,
3163 SidTypeDomain,
3164 SidTypeAlias,
3165 SidTypeWellKnownGroup,
3166 SidTypeDeletedAccount,
3167 SidTypeInvalid,
3168 SidTypeUnknown
3169 } SID_NAME_USE,*PSID_NAME_USE;
3171 /* Access rights */
3173 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3174 #undef DELETE
3175 #define DELETE 0x00010000
3176 #define READ_CONTROL 0x00020000
3177 #define WRITE_DAC 0x00040000
3178 #define WRITE_OWNER 0x00080000
3179 #define SYNCHRONIZE 0x00100000
3180 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3182 #define STANDARD_RIGHTS_READ READ_CONTROL
3183 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3184 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3186 #define STANDARD_RIGHTS_ALL 0x001f0000
3188 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3190 #define GENERIC_READ 0x80000000
3191 #define GENERIC_WRITE 0x40000000
3192 #define GENERIC_EXECUTE 0x20000000
3193 #define GENERIC_ALL 0x10000000
3195 #define MAXIMUM_ALLOWED 0x02000000
3196 #define ACCESS_SYSTEM_SECURITY 0x01000000
3198 #define EVENT_MODIFY_STATE 0x0002
3199 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3201 #define SEMAPHORE_MODIFY_STATE 0x0002
3202 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3204 #define MUTEX_MODIFY_STATE 0x0001
3205 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3207 #define TIMER_QUERY_STATE 0x0001
3208 #define TIMER_MODIFY_STATE 0x0002
3209 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3211 #define PROCESS_TERMINATE 0x0001
3212 #define PROCESS_CREATE_THREAD 0x0002
3213 #define PROCESS_VM_OPERATION 0x0008
3214 #define PROCESS_VM_READ 0x0010
3215 #define PROCESS_VM_WRITE 0x0020
3216 #define PROCESS_DUP_HANDLE 0x0040
3217 #define PROCESS_CREATE_PROCESS 0x0080
3218 #define PROCESS_SET_QUOTA 0x0100
3219 #define PROCESS_SET_INFORMATION 0x0200
3220 #define PROCESS_QUERY_INFORMATION 0x0400
3221 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3223 #define THREAD_TERMINATE 0x0001
3224 #define THREAD_SUSPEND_RESUME 0x0002
3225 #define THREAD_GET_CONTEXT 0x0008
3226 #define THREAD_SET_CONTEXT 0x0010
3227 #define THREAD_SET_INFORMATION 0x0020
3228 #define THREAD_QUERY_INFORMATION 0x0040
3229 #define THREAD_SET_THREAD_TOKEN 0x0080
3230 #define THREAD_IMPERSONATE 0x0100
3231 #define THREAD_DIRECT_IMPERSONATION 0x0200
3232 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3234 #define THREAD_BASE_PRIORITY_LOWRT 15
3235 #define THREAD_BASE_PRIORITY_MAX 2
3236 #define THREAD_BASE_PRIORITY_MIN -2
3237 #define THREAD_BASE_PRIORITY_IDLE -15
3239 #define SECTION_QUERY 0x0001
3240 #define SECTION_MAP_WRITE 0x0002
3241 #define SECTION_MAP_READ 0x0004
3242 #define SECTION_MAP_EXECUTE 0x0008
3243 #define SECTION_EXTEND_SIZE 0x0010
3244 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3246 #define FILE_READ_DATA 0x0001 /* file & pipe */
3247 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3248 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3249 #define FILE_ADD_FILE 0x0002 /* directory */
3250 #define FILE_APPEND_DATA 0x0004 /* file */
3251 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3252 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3253 #define FILE_READ_EA 0x0008 /* file & directory */
3254 #define FILE_READ_PROPERTIES FILE_READ_EA
3255 #define FILE_WRITE_EA 0x0010 /* file & directory */
3256 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3257 #define FILE_EXECUTE 0x0020 /* file */
3258 #define FILE_TRAVERSE 0x0020 /* directory */
3259 #define FILE_DELETE_CHILD 0x0040 /* directory */
3260 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3261 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3262 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3264 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3265 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3266 SYNCHRONIZE)
3267 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3268 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3269 FILE_APPEND_DATA | SYNCHRONIZE)
3270 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3271 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3274 /* File attribute flags */
3275 #define FILE_SHARE_READ 0x00000001L
3276 #define FILE_SHARE_WRITE 0x00000002L
3277 #define FILE_SHARE_DELETE 0x00000004L
3279 #define FILE_ATTRIBUTE_READONLY 0x00000001
3280 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
3281 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
3282 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
3283 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
3284 #define FILE_ATTRIBUTE_NORMAL 0x00000080
3285 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
3286 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
3287 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
3288 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
3289 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
3290 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
3291 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
3293 /* File notification flags */
3294 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3295 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3296 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3297 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3298 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3299 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3300 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3301 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3303 #define FILE_ACTION_ADDED 0x00000001
3304 #define FILE_ACTION_REMOVED 0x00000002
3305 #define FILE_ACTION_MODIFIED 0x00000003
3306 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3307 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3310 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3311 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3312 #define FILE_UNICODE_ON_DISK 0x00000004
3313 #define FILE_PERSISTENT_ACLS 0x00000008
3314 #define FILE_FILE_COMPRESSION 0x00000010
3315 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3316 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
3317 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
3318 #define FILE_NAMED_STREAMS 0x00040000
3319 #define FILE_READ_ONLY_VOLUME 0x00080000
3321 /* File alignments (NT) */
3322 #define FILE_BYTE_ALIGNMENT 0x00000000
3323 #define FILE_WORD_ALIGNMENT 0x00000001
3324 #define FILE_LONG_ALIGNMENT 0x00000003
3325 #define FILE_QUAD_ALIGNMENT 0x00000007
3326 #define FILE_OCTA_ALIGNMENT 0x0000000f
3327 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3328 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3329 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3330 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3331 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3333 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
3334 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
3336 #define REG_NONE 0 /* no type */
3337 #define REG_SZ 1 /* string type (ASCII) */
3338 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3339 #define REG_BINARY 3 /* binary format, callerspecific */
3340 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3341 #define REG_DWORD 4 /* DWORD in little endian format */
3342 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3343 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3344 #define REG_LINK 6 /* symbolic link (UNICODE) */
3345 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3346 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3347 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3348 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3349 #define REG_QWORD 11 /* QWORD in little endian format */
3350 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
3352 /* ----------------------------- begin power management --------------------- */
3354 typedef enum _LATENCY_TIME {
3355 LT_DONT_CARE,
3356 LT_LOWEST_LATENCY
3357 } LATENCY_TIME, *PLATENCY_TIME;
3359 /* ----------------------------- begin registry ----------------------------- */
3361 /* Registry security values */
3362 #define OWNER_SECURITY_INFORMATION 0x00000001
3363 #define GROUP_SECURITY_INFORMATION 0x00000002
3364 #define DACL_SECURITY_INFORMATION 0x00000004
3365 #define SACL_SECURITY_INFORMATION 0x00000008
3367 #define REG_OPTION_RESERVED 0x00000000
3368 #define REG_OPTION_NON_VOLATILE 0x00000000
3369 #define REG_OPTION_VOLATILE 0x00000001
3370 #define REG_OPTION_CREATE_LINK 0x00000002
3371 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
3372 #define REG_OPTION_OPEN_LINK 0x00000008
3373 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
3374 REG_OPTION_NON_VOLATILE| \
3375 REG_OPTION_VOLATILE| \
3376 REG_OPTION_CREATE_LINK| \
3377 REG_OPTION_BACKUP_RESTORE| \
3378 REG_OPTION_OPEN_LINK)
3381 #define REG_CREATED_NEW_KEY 0x00000001
3382 #define REG_OPENED_EXISTING_KEY 0x00000002
3384 /* For RegNotifyChangeKeyValue */
3385 #define REG_NOTIFY_CHANGE_NAME 0x01
3386 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
3387 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
3388 #define REG_NOTIFY_CHANGE_SECURITY 0x08
3390 #define KEY_QUERY_VALUE 0x00000001
3391 #define KEY_SET_VALUE 0x00000002
3392 #define KEY_CREATE_SUB_KEY 0x00000004
3393 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3394 #define KEY_NOTIFY 0x00000010
3395 #define KEY_CREATE_LINK 0x00000020
3397 /* for RegKeyRestore flags */
3398 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
3399 #define REG_REFRESH_HIVE 0x00000002
3400 #define REG_NO_LAZY_FLUSH 0x00000004
3401 #define REG_FORCE_RESTORE 0x00000008
3403 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3404 KEY_QUERY_VALUE| \
3405 KEY_ENUMERATE_SUB_KEYS| \
3406 KEY_NOTIFY) \
3407 & (~SYNCHRONIZE) \
3409 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3410 KEY_SET_VALUE| \
3411 KEY_CREATE_SUB_KEY) \
3412 & (~SYNCHRONIZE) \
3414 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
3415 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3416 KEY_QUERY_VALUE| \
3417 KEY_SET_VALUE| \
3418 KEY_CREATE_SUB_KEY| \
3419 KEY_ENUMERATE_SUB_KEYS| \
3420 KEY_NOTIFY| \
3421 KEY_CREATE_LINK) \
3422 & (~SYNCHRONIZE) \
3424 /* ------------------------------ end registry ------------------------------ */
3427 #define EVENTLOG_SUCCESS 0x0000
3428 #define EVENTLOG_ERROR_TYPE 0x0001
3429 #define EVENTLOG_WARNING_TYPE 0x0002
3430 #define EVENTLOG_INFORMATION_TYPE 0x0004
3431 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3432 #define EVENTLOG_AUDIT_FAILURE 0x0010
3434 #define SERVICE_BOOT_START 0x00000000
3435 #define SERVICE_SYSTEM_START 0x00000001
3436 #define SERVICE_AUTO_START 0x00000002
3437 #define SERVICE_DEMAND_START 0x00000003
3438 #define SERVICE_DISABLED 0x00000004
3440 #define SERVICE_ERROR_IGNORE 0x00000000
3441 #define SERVICE_ERROR_NORMAL 0x00000001
3442 #define SERVICE_ERROR_SEVERE 0x00000002
3443 #define SERVICE_ERROR_CRITICAL 0x00000003
3445 /* Service types */
3446 #define SERVICE_KERNEL_DRIVER 0x00000001
3447 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3448 #define SERVICE_ADAPTER 0x00000004
3449 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3451 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3452 SERVICE_RECOGNIZER_DRIVER )
3454 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3455 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3456 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3458 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3460 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3461 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3464 typedef enum _CM_SERVICE_NODE_TYPE
3466 DriverType = SERVICE_KERNEL_DRIVER,
3467 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3468 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3469 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3470 AdapterType = SERVICE_ADAPTER,
3471 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3472 } SERVICE_NODE_TYPE;
3474 typedef enum _CM_SERVICE_LOAD_TYPE
3476 BootLoad = SERVICE_BOOT_START,
3477 SystemLoad = SERVICE_SYSTEM_START,
3478 AutoLoad = SERVICE_AUTO_START,
3479 DemandLoad = SERVICE_DEMAND_START,
3480 DisableLoad = SERVICE_DISABLED
3481 } SERVICE_LOAD_TYPE;
3483 typedef enum _CM_ERROR_CONTROL_TYPE
3485 IgnoreError = SERVICE_ERROR_IGNORE,
3486 NormalError = SERVICE_ERROR_NORMAL,
3487 SevereError = SERVICE_ERROR_SEVERE,
3488 CriticalError = SERVICE_ERROR_CRITICAL
3489 } SERVICE_ERROR_TYPE;
3493 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3494 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3495 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3496 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3497 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3499 #include <guiddef.h>
3501 typedef struct _OBJECT_TYPE_LIST {
3502 WORD Level;
3503 WORD Sbz;
3504 GUID *ObjectType;
3505 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
3507 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3509 WORD Type;
3510 WORD CreatorBackTraceIndex;
3511 struct _RTL_CRITICAL_SECTION *CriticalSection;
3512 LIST_ENTRY ProcessLocksList;
3513 DWORD EntryCount;
3514 DWORD ContentionCount;
3515 DWORD Spare[ 2 ];
3516 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
3518 typedef struct _RTL_CRITICAL_SECTION {
3519 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3520 LONG LockCount;
3521 LONG RecursionCount;
3522 HANDLE OwningThread;
3523 HANDLE LockSemaphore;
3524 ULONG_PTR SpinCount;
3525 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
3527 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
3529 typedef struct _IO_COUNTERS {
3530 ULONGLONG ReadOperationCount;
3531 ULONGLONG WriteOperationCount;
3532 ULONGLONG OtherOperationCount;
3533 ULONGLONG ReadTransferCount;
3534 ULONGLONG WriteTransferCount;
3535 ULONGLONG OtherTransferCount;
3536 } IO_COUNTERS;
3537 typedef IO_COUNTERS *PIO_COUNTERS;
3539 typedef struct {
3540 DWORD dwOSVersionInfoSize;
3541 DWORD dwMajorVersion;
3542 DWORD dwMinorVersion;
3543 DWORD dwBuildNumber;
3544 DWORD dwPlatformId;
3545 CHAR szCSDVersion[128];
3546 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
3548 typedef struct {
3549 DWORD dwOSVersionInfoSize;
3550 DWORD dwMajorVersion;
3551 DWORD dwMinorVersion;
3552 DWORD dwBuildNumber;
3553 DWORD dwPlatformId;
3554 WCHAR szCSDVersion[128];
3555 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
3557 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
3558 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
3559 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
3561 typedef struct {
3562 DWORD dwOSVersionInfoSize;
3563 DWORD dwMajorVersion;
3564 DWORD dwMinorVersion;
3565 DWORD dwBuildNumber;
3566 DWORD dwPlatformId;
3567 CHAR szCSDVersion[128];
3568 WORD wServicePackMajor;
3569 WORD wServicePackMinor;
3570 WORD wSuiteMask;
3571 BYTE wProductType;
3572 BYTE wReserved;
3573 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
3575 typedef struct {
3576 DWORD dwOSVersionInfoSize;
3577 DWORD dwMajorVersion;
3578 DWORD dwMinorVersion;
3579 DWORD dwBuildNumber;
3580 DWORD dwPlatformId;
3581 WCHAR szCSDVersion[128];
3582 WORD wServicePackMajor;
3583 WORD wServicePackMinor;
3584 WORD wSuiteMask;
3585 BYTE wProductType;
3586 BYTE wReserved;
3587 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
3589 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
3590 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
3591 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
3593 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
3595 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
3597 #define VER_PLATFORM_WIN32s 0
3598 #define VER_PLATFORM_WIN32_WINDOWS 1
3599 #define VER_PLATFORM_WIN32_NT 2
3601 #define VER_MINORVERSION 0x00000001
3602 #define VER_MAJORVERSION 0x00000002
3603 #define VER_BUILDNUMBER 0x00000004
3604 #define VER_PLATFORMID 0x00000008
3605 #define VER_SERVICEPACKMINOR 0x00000010
3606 #define VER_SERVICEPACKMAJOR 0x00000020
3607 #define VER_SUITENAME 0x00000040
3608 #define VER_PRODUCT_TYPE 0x00000080
3610 #define VER_NT_WORKSTATION 1
3611 #define VER_NT_DOMAIN_CONTROLLER 2
3612 #define VER_NT_SERVER 3
3614 #define VER_SUITE_SMALLBUSINESS 0x00000001
3615 #define VER_SUITE_ENTERPRISE 0x00000002
3616 #define VER_SUITE_BACKOFFICE 0x00000004
3617 #define VER_SUITE_COMMUNICATIONS 0x00000008
3618 #define VER_SUITE_TERMINAL 0x00000010
3619 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
3620 #define VER_SUITE_EMBEDDEDNT 0x00000040
3621 #define VER_SUITE_DATACENTER 0x00000080
3622 #define VER_SUITE_SINGLEUSERTS 0x00000100
3623 #define VER_SUITE_PERSONAL 0x00000200
3625 #define VER_EQUAL 1
3626 #define VER_GREATER 2
3627 #define VER_GREATER_EQUAL 3
3628 #define VER_LESS 4
3629 #define VER_LESS_EQUAL 5
3630 #define VER_AND 6
3631 #define VER_OR 7
3633 #endif /* __WINE_WINNT_H */