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