Add Fonts key for NT versions of Windows.
[wine.git] / include / winnt.h
bloba63eccff02c6c342c5916ef378a7d1dd0d57824a
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 *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
1637 typedef LONG (CALLBACK *PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1638 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1640 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1641 LPTOP_LEVEL_EXCEPTION_FILTER
1642 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1644 typedef struct _NT_TIB
1646 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1647 PVOID StackBase;
1648 PVOID StackLimit;
1649 PVOID SubSystemTib;
1650 union {
1651 PVOID FiberData;
1652 DWORD Version;
1653 } DUMMYUNIONNAME;
1654 PVOID ArbitraryUserPointer;
1655 struct _NT_TIB *Self;
1656 } NT_TIB, *PNT_TIB;
1658 struct _TEB;
1660 #if defined(__i386__) && defined(__GNUC__)
1661 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1662 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1664 struct _TEB *teb;
1665 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1666 return teb;
1668 #elif defined(__i386__) && defined(_MSC_VER)
1669 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1671 struct _TEB *teb;
1672 __asm mov eax, fs:[0x18];
1673 __asm mov teb, eax;
1674 return teb;
1676 #elif defined(__powerpc__)
1677 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1678 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1680 struct _TEB *teb;
1681 # ifdef __APPLE__
1682 __asm__("\tmr %0, r13" : "=r" (teb));
1683 # else
1684 __asm__("\tmr %0, 2" : "=r" (teb));
1685 # endif
1686 return teb;
1688 #else
1689 extern struct _TEB * WINAPI NtCurrentTeb(void);
1690 #endif
1692 #ifdef NONAMELESSUNION
1693 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
1694 #else
1695 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
1696 #endif
1697 #define GetFiberData() (*(void **)GetCurrentFiber())
1700 * File formats definitions
1703 #include <pshpack2.h>
1704 typedef struct _IMAGE_DOS_HEADER {
1705 WORD e_magic; /* 00: MZ Header signature */
1706 WORD e_cblp; /* 02: Bytes on last page of file */
1707 WORD e_cp; /* 04: Pages in file */
1708 WORD e_crlc; /* 06: Relocations */
1709 WORD e_cparhdr; /* 08: Size of header in paragraphs */
1710 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
1711 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
1712 WORD e_ss; /* 0e: Initial (relative) SS value */
1713 WORD e_sp; /* 10: Initial SP value */
1714 WORD e_csum; /* 12: Checksum */
1715 WORD e_ip; /* 14: Initial IP value */
1716 WORD e_cs; /* 16: Initial (relative) CS value */
1717 WORD e_lfarlc; /* 18: File address of relocation table */
1718 WORD e_ovno; /* 1a: Overlay number */
1719 WORD e_res[4]; /* 1c: Reserved words */
1720 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
1721 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
1722 WORD e_res2[10]; /* 28: Reserved words */
1723 DWORD e_lfanew; /* 3c: Offset to extended header */
1724 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
1725 #include <poppack.h>
1727 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1728 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1729 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1730 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1731 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1732 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1735 * This is the Windows executable (NE) header.
1736 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1738 #include <pshpack2.h>
1739 typedef struct
1741 WORD ne_magic; /* 00 NE signature 'NE' */
1742 BYTE ne_ver; /* 02 Linker version number */
1743 BYTE ne_rev; /* 03 Linker revision number */
1744 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
1745 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
1746 LONG ne_crc; /* 08 Checksum */
1747 WORD ne_flags; /* 0c Flags about segments in this file */
1748 WORD ne_autodata; /* 0e Automatic data segment number */
1749 WORD ne_heap; /* 10 Initial size of local heap */
1750 WORD ne_stack; /* 12 Initial size of stack */
1751 DWORD ne_csip; /* 14 Initial CS:IP */
1752 DWORD ne_sssp; /* 18 Initial SS:SP */
1753 WORD ne_cseg; /* 1c # of entries in segment table */
1754 WORD ne_cmod; /* 1e # of entries in module reference tab. */
1755 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
1756 WORD ne_segtab; /* 22 Offset to segment table */
1757 WORD ne_rsrctab; /* 24 Offset to resource table */
1758 WORD ne_restab; /* 26 Offset to resident-name table */
1759 WORD ne_modtab; /* 28 Offset to module reference table */
1760 WORD ne_imptab; /* 2a Offset to imported name table */
1761 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
1762 WORD ne_cmovent; /* 30 # of movable entry points */
1763 WORD ne_align; /* 32 Logical sector alignment shift count */
1764 WORD ne_cres; /* 34 # of resource segments */
1765 BYTE ne_exetyp; /* 36 Flags indicating target OS */
1766 BYTE ne_flagsothers; /* 37 Additional information flags */
1767 WORD ne_pretthunks; /* 38 Offset to return thunks */
1768 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
1769 WORD ne_swaparea; /* 3c Reserved by Microsoft */
1770 WORD ne_expver; /* 3e Expected Windows version number */
1771 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
1772 #include <poppack.h>
1774 #include <pshpack2.h>
1775 typedef struct _IMAGE_VXD_HEADER {
1776 WORD e32_magic;
1777 BYTE e32_border;
1778 BYTE e32_worder;
1779 DWORD e32_level;
1780 WORD e32_cpu;
1781 WORD e32_os;
1782 DWORD e32_ver;
1783 DWORD e32_mflags;
1784 DWORD e32_mpages;
1785 DWORD e32_startobj;
1786 DWORD e32_eip;
1787 DWORD e32_stackobj;
1788 DWORD e32_esp;
1789 DWORD e32_pagesize;
1790 DWORD e32_lastpagesize;
1791 DWORD e32_fixupsize;
1792 DWORD e32_fixupsum;
1793 DWORD e32_ldrsize;
1794 DWORD e32_ldrsum;
1795 DWORD e32_objtab;
1796 DWORD e32_objcnt;
1797 DWORD e32_objmap;
1798 DWORD e32_itermap;
1799 DWORD e32_rsrctab;
1800 DWORD e32_rsrccnt;
1801 DWORD e32_restab;
1802 DWORD e32_enttab;
1803 DWORD e32_dirtab;
1804 DWORD e32_dircnt;
1805 DWORD e32_fpagetab;
1806 DWORD e32_frectab;
1807 DWORD e32_impmod;
1808 DWORD e32_impmodcnt;
1809 DWORD e32_impproc;
1810 DWORD e32_pagesum;
1811 DWORD e32_datapage;
1812 DWORD e32_preload;
1813 DWORD e32_nrestab;
1814 DWORD e32_cbnrestab;
1815 DWORD e32_nressum;
1816 DWORD e32_autodata;
1817 DWORD e32_debuginfo;
1818 DWORD e32_debuglen;
1819 DWORD e32_instpreload;
1820 DWORD e32_instdemand;
1821 DWORD e32_heapsize;
1822 BYTE e32_res3[12];
1823 DWORD e32_winresoff;
1824 DWORD e32_winreslen;
1825 WORD e32_devid;
1826 WORD e32_ddkver;
1827 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
1828 #include <poppack.h>
1830 /* These defines describe the meanings of the bits in the Characteristics
1831 field */
1833 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1834 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1835 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1836 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1837 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
1838 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
1839 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1840 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1841 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1842 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1843 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
1844 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
1845 #define IMAGE_FILE_SYSTEM 0x1000
1846 #define IMAGE_FILE_DLL 0x2000
1847 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
1848 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1850 /* These are the settings of the Machine field. */
1851 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1852 #define IMAGE_FILE_MACHINE_I860 0x014d
1853 #define IMAGE_FILE_MACHINE_I386 0x014c
1854 #define IMAGE_FILE_MACHINE_R3000 0x0162
1855 #define IMAGE_FILE_MACHINE_R4000 0x0166
1856 #define IMAGE_FILE_MACHINE_R10000 0x0168
1857 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
1858 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
1859 #define IMAGE_FILE_MACHINE_SH3 0x01a2
1860 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
1861 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
1862 #define IMAGE_FILE_MACHINE_SH4 0x01a6
1863 #define IMAGE_FILE_MACHINE_SH5 0x01a8
1864 #define IMAGE_FILE_MACHINE_ARM 0x01c0
1865 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
1866 #define IMAGE_FILE_MACHINE_AM33 0x01d3
1867 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
1868 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
1869 #define IMAGE_FILE_MACHINE_IA64 0x0200
1870 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
1871 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
1872 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
1873 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
1874 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
1875 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
1876 #define IMAGE_FILE_MACHINE_CEF 0x0cef
1877 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
1878 #define IMAGE_FILE_MACHINE_AMD64 0x8664
1879 #define IMAGE_FILE_MACHINE_M32R 0x9041
1880 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
1882 #define IMAGE_SIZEOF_FILE_HEADER 20
1883 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
1884 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
1885 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224
1886 #define IMAGE_SIZEOF_SHORT_NAME 8
1887 #define IMAGE_SIZEOF_SECTION_HEADER 40
1888 #define IMAGE_SIZEOF_SYMBOL 18
1889 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1890 #define IMAGE_SIZEOF_RELOCATION 10
1891 #define IMAGE_SIZEOF_BASE_RELOCATION 8
1892 #define IMAGE_SIZEOF_LINENUMBER 6
1893 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
1895 /* Possible Magic values */
1896 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1897 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1899 /* These are indexes into the DataDirectory array */
1900 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1901 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1902 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1903 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1904 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1905 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1906 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1907 #define IMAGE_FILE_DESCRIPTION_STRING 7
1908 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1909 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1910 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1912 /* Directory Entries, indices into the DataDirectory array */
1914 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1915 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1916 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1917 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1918 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1919 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1920 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1921 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1922 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1923 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1924 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1925 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1926 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1927 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1928 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1930 /* Subsystem Values */
1932 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1933 #define IMAGE_SUBSYSTEM_NATIVE 1
1934 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1935 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
1936 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1937 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1938 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
1939 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
1940 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
1941 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
1942 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
1943 #define IMAGE_SUBSYSTEM_EFI_ROM 13
1944 #define IMAGE_SUBSYSTEM_XBOX 14
1946 typedef struct _IMAGE_FILE_HEADER {
1947 WORD Machine;
1948 WORD NumberOfSections;
1949 DWORD TimeDateStamp;
1950 DWORD PointerToSymbolTable;
1951 DWORD NumberOfSymbols;
1952 WORD SizeOfOptionalHeader;
1953 WORD Characteristics;
1954 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
1956 typedef struct _IMAGE_DATA_DIRECTORY {
1957 DWORD VirtualAddress;
1958 DWORD Size;
1959 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
1961 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1963 typedef struct _IMAGE_OPTIONAL_HEADER {
1965 /* Standard fields */
1967 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
1968 BYTE MajorLinkerVersion;
1969 BYTE MinorLinkerVersion;
1970 DWORD SizeOfCode;
1971 DWORD SizeOfInitializedData;
1972 DWORD SizeOfUninitializedData;
1973 DWORD AddressOfEntryPoint; /* 0x10 */
1974 DWORD BaseOfCode;
1975 DWORD BaseOfData;
1977 /* NT additional fields */
1979 DWORD ImageBase;
1980 DWORD SectionAlignment; /* 0x20 */
1981 DWORD FileAlignment;
1982 WORD MajorOperatingSystemVersion;
1983 WORD MinorOperatingSystemVersion;
1984 WORD MajorImageVersion;
1985 WORD MinorImageVersion;
1986 WORD MajorSubsystemVersion; /* 0x30 */
1987 WORD MinorSubsystemVersion;
1988 DWORD Win32VersionValue;
1989 DWORD SizeOfImage;
1990 DWORD SizeOfHeaders;
1991 DWORD CheckSum; /* 0x40 */
1992 WORD Subsystem;
1993 WORD DllCharacteristics;
1994 DWORD SizeOfStackReserve;
1995 DWORD SizeOfStackCommit;
1996 DWORD SizeOfHeapReserve; /* 0x50 */
1997 DWORD SizeOfHeapCommit;
1998 DWORD LoaderFlags;
1999 DWORD NumberOfRvaAndSizes;
2000 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2001 /* 0xE0 */
2002 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
2004 typedef struct _IMAGE_NT_HEADERS {
2005 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2006 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2007 IMAGE_OPTIONAL_HEADER OptionalHeader; /* 0x18 */
2008 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
2010 #define IMAGE_SIZEOF_SHORT_NAME 8
2012 typedef struct _IMAGE_SECTION_HEADER {
2013 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2014 union {
2015 DWORD PhysicalAddress;
2016 DWORD VirtualSize;
2017 } Misc;
2018 DWORD VirtualAddress;
2019 DWORD SizeOfRawData;
2020 DWORD PointerToRawData;
2021 DWORD PointerToRelocations;
2022 DWORD PointerToLinenumbers;
2023 WORD NumberOfRelocations;
2024 WORD NumberOfLinenumbers;
2025 DWORD Characteristics;
2026 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2028 #define IMAGE_SIZEOF_SECTION_HEADER 40
2030 #define IMAGE_FIRST_SECTION(ntheader) \
2031 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
2032 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
2034 /* These defines are for the Characteristics bitfield. */
2035 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2036 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2037 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2038 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2039 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2040 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2042 #define IMAGE_SCN_CNT_CODE 0x00000020
2043 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2044 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2046 #define IMAGE_SCN_LNK_OTHER 0x00000100
2047 #define IMAGE_SCN_LNK_INFO 0x00000200
2048 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2049 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2050 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2052 /* 0x00002000 - Reserved */
2053 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2054 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2056 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2057 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2058 #define IMAGE_SCN_MEM_16BIT 0x00020000
2059 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2060 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2062 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2063 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2064 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2065 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2066 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2067 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2068 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2069 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2070 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2071 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2072 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2073 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2074 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2075 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2076 /* 0x00F00000 - Unused */
2077 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2079 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2082 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2083 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2084 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2085 #define IMAGE_SCN_MEM_SHARED 0x10000000
2086 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2087 #define IMAGE_SCN_MEM_READ 0x40000000
2088 #define IMAGE_SCN_MEM_WRITE 0x80000000
2090 #include <pshpack2.h>
2092 typedef struct _IMAGE_SYMBOL {
2093 union {
2094 BYTE ShortName[8];
2095 struct {
2096 DWORD Short;
2097 DWORD Long;
2098 } Name;
2099 DWORD LongName[2];
2100 } N;
2101 DWORD Value;
2102 SHORT SectionNumber;
2103 WORD Type;
2104 BYTE StorageClass;
2105 BYTE NumberOfAuxSymbols;
2106 } IMAGE_SYMBOL;
2107 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
2109 #define IMAGE_SIZEOF_SYMBOL 18
2111 typedef struct _IMAGE_LINENUMBER {
2112 union {
2113 DWORD SymbolTableIndex;
2114 DWORD VirtualAddress;
2115 } Type;
2116 WORD Linenumber;
2117 } IMAGE_LINENUMBER;
2118 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
2120 #define IMAGE_SIZEOF_LINENUMBER 6
2122 typedef union _IMAGE_AUX_SYMBOL {
2123 struct {
2124 DWORD TagIndex;
2125 union {
2126 struct {
2127 WORD Linenumber;
2128 WORD Size;
2129 } LnSz;
2130 DWORD TotalSize;
2131 } Misc;
2132 union {
2133 struct {
2134 DWORD PointerToLinenumber;
2135 DWORD PointerToNextFunction;
2136 } Function;
2137 struct {
2138 WORD Dimension[4];
2139 } Array;
2140 } FcnAry;
2141 WORD TvIndex;
2142 } Sym;
2143 struct {
2144 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2145 } File;
2146 struct {
2147 DWORD Length;
2148 WORD NumberOfRelocations;
2149 WORD NumberOfLinenumbers;
2150 DWORD CheckSum;
2151 SHORT Number;
2152 BYTE Selection;
2153 } Section;
2154 } IMAGE_AUX_SYMBOL;
2155 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2157 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2159 #include <poppack.h>
2161 #define IMAGE_SYM_UNDEFINED (SHORT)0
2162 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2163 #define IMAGE_SYM_DEBUG (SHORT)-2
2165 #define IMAGE_SYM_TYPE_NULL 0x0000
2166 #define IMAGE_SYM_TYPE_VOID 0x0001
2167 #define IMAGE_SYM_TYPE_CHAR 0x0002
2168 #define IMAGE_SYM_TYPE_SHORT 0x0003
2169 #define IMAGE_SYM_TYPE_INT 0x0004
2170 #define IMAGE_SYM_TYPE_LONG 0x0005
2171 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2172 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2173 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2174 #define IMAGE_SYM_TYPE_UNION 0x0009
2175 #define IMAGE_SYM_TYPE_ENUM 0x000A
2176 #define IMAGE_SYM_TYPE_MOE 0x000B
2177 #define IMAGE_SYM_TYPE_BYTE 0x000C
2178 #define IMAGE_SYM_TYPE_WORD 0x000D
2179 #define IMAGE_SYM_TYPE_UINT 0x000E
2180 #define IMAGE_SYM_TYPE_DWORD 0x000F
2181 #define IMAGE_SYM_TYPE_PCODE 0x8000
2183 #define IMAGE_SYM_DTYPE_NULL 0
2184 #define IMAGE_SYM_DTYPE_POINTER 1
2185 #define IMAGE_SYM_DTYPE_FUNCTION 2
2186 #define IMAGE_SYM_DTYPE_ARRAY 3
2188 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2189 #define IMAGE_SYM_CLASS_NULL 0x0000
2190 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2191 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2192 #define IMAGE_SYM_CLASS_STATIC 0x0003
2193 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2194 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2195 #define IMAGE_SYM_CLASS_LABEL 0x0006
2196 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2197 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2198 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2199 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2200 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2201 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2202 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2203 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2204 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2205 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2206 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2207 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2209 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2210 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2211 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2212 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2213 #define IMAGE_SYM_CLASS_FILE 0x0067
2214 #define IMAGE_SYM_CLASS_SECTION 0x0068
2215 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2217 #define N_BTMASK 0x000F
2218 #define N_TMASK 0x0030
2219 #define N_TMASK1 0x00C0
2220 #define N_TMASK2 0x00F0
2221 #define N_BTSHFT 4
2222 #define N_TSHIFT 2
2224 #define BTYPE(x) ((x) & N_BTMASK)
2226 #ifndef ISPTR
2227 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2228 #endif
2230 #ifndef ISFCN
2231 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2232 #endif
2234 #ifndef ISARY
2235 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2236 #endif
2238 #ifndef ISTAG
2239 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2240 #endif
2242 #ifndef INCREF
2243 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2244 #endif
2245 #ifndef DECREF
2246 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2247 #endif
2249 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2250 #define IMAGE_COMDAT_SELECT_ANY 2
2251 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2252 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2253 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2254 #define IMAGE_COMDAT_SELECT_LARGEST 6
2255 #define IMAGE_COMDAT_SELECT_NEWEST 7
2257 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2258 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2259 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2261 /* Export module directory */
2263 typedef struct _IMAGE_EXPORT_DIRECTORY {
2264 DWORD Characteristics;
2265 DWORD TimeDateStamp;
2266 WORD MajorVersion;
2267 WORD MinorVersion;
2268 DWORD Name;
2269 DWORD Base;
2270 DWORD NumberOfFunctions;
2271 DWORD NumberOfNames;
2272 DWORD AddressOfFunctions;
2273 DWORD AddressOfNames;
2274 DWORD AddressOfNameOrdinals;
2275 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2277 /* Import name entry */
2278 typedef struct _IMAGE_IMPORT_BY_NAME {
2279 WORD Hint;
2280 BYTE Name[1];
2281 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2283 /* Import thunk */
2284 typedef struct _IMAGE_THUNK_DATA {
2285 union {
2286 LPBYTE ForwarderString;
2287 PDWORD Function;
2288 DWORD Ordinal;
2289 PIMAGE_IMPORT_BY_NAME AddressOfData;
2290 } u1;
2291 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
2293 /* Import module directory */
2295 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2296 union {
2297 DWORD Characteristics; /* 0 for terminating null import descriptor */
2298 PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
2299 } u;
2300 DWORD TimeDateStamp; /* 0 if not bound,
2301 * -1 if bound, and real date\time stamp
2302 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2303 * (new BIND)
2304 * otherwise date/time stamp of DLL bound to
2305 * (Old BIND)
2307 DWORD ForwarderChain; /* -1 if no forwarders */
2308 DWORD Name;
2309 /* RVA to IAT (if bound this IAT has actual addresses) */
2310 PIMAGE_THUNK_DATA FirstThunk;
2311 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2313 #define IMAGE_ORDINAL_FLAG 0x80000000
2314 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
2315 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
2317 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2319 DWORD TimeDateStamp;
2320 WORD OffsetModuleName;
2321 WORD NumberOfModuleForwarderRefs;
2322 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2323 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2325 typedef struct _IMAGE_BOUND_FORWARDER_REF
2327 DWORD TimeDateStamp;
2328 WORD OffsetModuleName;
2329 WORD Reserved;
2330 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2332 typedef struct _IMAGE_BASE_RELOCATION
2334 DWORD VirtualAddress;
2335 DWORD SizeOfBlock;
2336 /* WORD TypeOffset[1]; */
2337 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2339 #include <pshpack2.h>
2341 typedef struct _IMAGE_RELOCATION
2343 union {
2344 DWORD VirtualAddress;
2345 DWORD RelocCount;
2346 } DUMMYUNIONNAME;
2347 DWORD SymbolTableIndex;
2348 WORD Type;
2349 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2351 #include <poppack.h>
2353 #define IMAGE_SIZEOF_RELOCATION 10
2355 /* generic relocation types */
2356 #define IMAGE_REL_BASED_ABSOLUTE 0
2357 #define IMAGE_REL_BASED_HIGH 1
2358 #define IMAGE_REL_BASED_LOW 2
2359 #define IMAGE_REL_BASED_HIGHLOW 3
2360 #define IMAGE_REL_BASED_HIGHADJ 4
2361 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2362 #define IMAGE_REL_BASED_SECTION 6
2363 #define IMAGE_REL_BASED_REL 7
2364 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2365 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2366 #define IMAGE_REL_BASED_DIR64 10
2367 #define IMAGE_REL_BASED_HIGH3ADJ 11
2369 /* I386 relocation types */
2370 #define IMAGE_REL_I386_ABSOLUTE 0
2371 #define IMAGE_REL_I386_DIR16 1
2372 #define IMAGE_REL_I386_REL16 2
2373 #define IMAGE_REL_I386_DIR32 6
2374 #define IMAGE_REL_I386_DIR32NB 7
2375 #define IMAGE_REL_I386_SEG12 9
2376 #define IMAGE_REL_I386_SECTION 10
2377 #define IMAGE_REL_I386_SECREL 11
2378 #define IMAGE_REL_I386_REL32 20
2380 /* MIPS relocation types */
2381 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2382 #define IMAGE_REL_MIPS_REFHALF 0x0001
2383 #define IMAGE_REL_MIPS_REFWORD 0x0002
2384 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2385 #define IMAGE_REL_MIPS_REFHI 0x0004
2386 #define IMAGE_REL_MIPS_REFLO 0x0005
2387 #define IMAGE_REL_MIPS_GPREL 0x0006
2388 #define IMAGE_REL_MIPS_LITERAL 0x0007
2389 #define IMAGE_REL_MIPS_SECTION 0x000A
2390 #define IMAGE_REL_MIPS_SECREL 0x000B
2391 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2392 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2393 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2394 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2395 #define IMAGE_REL_MIPS_PAIR 0x0025
2397 /* ALPHA relocation types */
2398 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2399 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2400 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2401 #define IMAGE_REL_ALPHA_GPREL 0x0003
2402 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2403 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2404 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2405 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2406 #define IMAGE_REL_ALPHA_HINT 0x0008
2407 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2408 #define IMAGE_REL_ALPHA_REFHI 0x000A
2409 #define IMAGE_REL_ALPHA_REFLO 0x000B
2410 #define IMAGE_REL_ALPHA_PAIR 0x000C
2411 #define IMAGE_REL_ALPHA_MATCH 0x000D
2412 #define IMAGE_REL_ALPHA_SECTION 0x000E
2413 #define IMAGE_REL_ALPHA_SECREL 0x000F
2414 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2415 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2416 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2417 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2418 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2419 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2420 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2421 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2423 /* PowerPC relocation types */
2424 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2425 #define IMAGE_REL_PPC_ADDR64 0x0001
2426 #define IMAGE_REL_PPC_ADDR 0x0002
2427 #define IMAGE_REL_PPC_ADDR24 0x0003
2428 #define IMAGE_REL_PPC_ADDR16 0x0004
2429 #define IMAGE_REL_PPC_ADDR14 0x0005
2430 #define IMAGE_REL_PPC_REL24 0x0006
2431 #define IMAGE_REL_PPC_REL14 0x0007
2432 #define IMAGE_REL_PPC_TOCREL16 0x0008
2433 #define IMAGE_REL_PPC_TOCREL14 0x0009
2434 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2435 #define IMAGE_REL_PPC_SECREL 0x000B
2436 #define IMAGE_REL_PPC_SECTION 0x000C
2437 #define IMAGE_REL_PPC_IFGLUE 0x000D
2438 #define IMAGE_REL_PPC_IMGLUE 0x000E
2439 #define IMAGE_REL_PPC_SECREL16 0x000F
2440 #define IMAGE_REL_PPC_REFHI 0x0010
2441 #define IMAGE_REL_PPC_REFLO 0x0011
2442 #define IMAGE_REL_PPC_PAIR 0x0012
2443 #define IMAGE_REL_PPC_SECRELLO 0x0013
2444 #define IMAGE_REL_PPC_SECRELHI 0x0014
2445 #define IMAGE_REL_PPC_GPREL 0x0015
2446 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2447 /* modifier bits */
2448 #define IMAGE_REL_PPC_NEG 0x0100
2449 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2450 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2451 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2453 /* SH3 ? relocation type */
2454 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2455 #define IMAGE_REL_SH3_DIRECT16 0x0001
2456 #define IMAGE_REL_SH3_DIRECT 0x0002
2457 #define IMAGE_REL_SH3_DIRECT8 0x0003
2458 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2459 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2460 #define IMAGE_REL_SH3_DIRECT4 0x0006
2461 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2462 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2463 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2464 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2465 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2466 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2467 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2468 #define IMAGE_REL_SH3_SECTION 0x000E
2469 #define IMAGE_REL_SH3_SECREL 0x000F
2470 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2472 /* ARM (Archimedes?) relocation types */
2473 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2474 #define IMAGE_REL_ARM_ADDR 0x0001
2475 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2476 #define IMAGE_REL_ARM_BRANCH24 0x0003
2477 #define IMAGE_REL_ARM_BRANCH11 0x0004
2478 #define IMAGE_REL_ARM_SECTION 0x000E
2479 #define IMAGE_REL_ARM_SECREL 0x000F
2481 /* IA64 relocation types */
2482 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2483 #define IMAGE_REL_IA64_IMM14 0x0001
2484 #define IMAGE_REL_IA64_IMM22 0x0002
2485 #define IMAGE_REL_IA64_IMM64 0x0003
2486 #define IMAGE_REL_IA64_DIR 0x0004
2487 #define IMAGE_REL_IA64_DIR64 0x0005
2488 #define IMAGE_REL_IA64_PCREL21B 0x0006
2489 #define IMAGE_REL_IA64_PCREL21M 0x0007
2490 #define IMAGE_REL_IA64_PCREL21F 0x0008
2491 #define IMAGE_REL_IA64_GPREL22 0x0009
2492 #define IMAGE_REL_IA64_LTOFF22 0x000A
2493 #define IMAGE_REL_IA64_SECTION 0x000B
2494 #define IMAGE_REL_IA64_SECREL22 0x000C
2495 #define IMAGE_REL_IA64_SECREL64I 0x000D
2496 #define IMAGE_REL_IA64_SECREL 0x000E
2497 #define IMAGE_REL_IA64_LTOFF64 0x000F
2498 #define IMAGE_REL_IA64_DIR32NB 0x0010
2499 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2500 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2501 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2502 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2503 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2504 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2505 #define IMAGE_REL_IA64_ADDEND 0x001F
2507 /* archive format */
2509 #define IMAGE_ARCHIVE_START_SIZE 8
2510 #define IMAGE_ARCHIVE_START "!<arch>\n"
2511 #define IMAGE_ARCHIVE_END "`\n"
2512 #define IMAGE_ARCHIVE_PAD "\n"
2513 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2514 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2516 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2518 BYTE Name[16];
2519 BYTE Date[12];
2520 BYTE UserID[6];
2521 BYTE GroupID[6];
2522 BYTE Mode[8];
2523 BYTE Size[10];
2524 BYTE EndHeader[2];
2525 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2527 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2530 * Resource directory stuff
2532 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2533 DWORD Characteristics;
2534 DWORD TimeDateStamp;
2535 WORD MajorVersion;
2536 WORD MinorVersion;
2537 WORD NumberOfNamedEntries;
2538 WORD NumberOfIdEntries;
2539 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2540 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2542 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2543 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2545 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2546 union {
2547 struct {
2548 #ifdef BITFIELDS_BIGENDIAN
2549 unsigned NameIsString:1;
2550 unsigned NameOffset:31;
2551 #else
2552 unsigned NameOffset:31;
2553 unsigned NameIsString:1;
2554 #endif
2555 } DUMMYSTRUCTNAME1;
2556 DWORD Name;
2557 struct {
2558 #ifdef WORDS_BIGENDIAN
2559 WORD __pad;
2560 WORD Id;
2561 #else
2562 WORD Id;
2563 WORD __pad;
2564 #endif
2565 } DUMMYSTRUCTNAME2;
2566 } DUMMYUNIONNAME1;
2567 union {
2568 DWORD OffsetToData;
2569 struct {
2570 #ifdef BITFIELDS_BIGENDIAN
2571 unsigned DataIsDirectory:1;
2572 unsigned OffsetToDirectory:31;
2573 #else
2574 unsigned OffsetToDirectory:31;
2575 unsigned DataIsDirectory:1;
2576 #endif
2577 } DUMMYSTRUCTNAME3;
2578 } DUMMYUNIONNAME2;
2579 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2582 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2583 WORD Length;
2584 CHAR NameString[ 1 ];
2585 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2587 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2588 WORD Length;
2589 WCHAR NameString[ 1 ];
2590 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2592 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2593 DWORD OffsetToData;
2594 DWORD Size;
2595 DWORD CodePage;
2596 DWORD ResourceHandle;
2597 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2600 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
2601 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
2604 typedef struct _IMAGE_TLS_DIRECTORY {
2605 DWORD StartAddressOfRawData;
2606 DWORD EndAddressOfRawData;
2607 LPDWORD AddressOfIndex;
2608 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2609 DWORD SizeOfZeroFill;
2610 DWORD Characteristics;
2611 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2613 typedef struct _IMAGE_DEBUG_DIRECTORY {
2614 DWORD Characteristics;
2615 DWORD TimeDateStamp;
2616 WORD MajorVersion;
2617 WORD MinorVersion;
2618 DWORD Type;
2619 DWORD SizeOfData;
2620 DWORD AddressOfRawData;
2621 DWORD PointerToRawData;
2622 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
2624 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2625 #define IMAGE_DEBUG_TYPE_COFF 1
2626 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2627 #define IMAGE_DEBUG_TYPE_FPO 3
2628 #define IMAGE_DEBUG_TYPE_MISC 4
2629 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2630 #define IMAGE_DEBUG_TYPE_FIXUP 6
2631 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2632 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2633 #define IMAGE_DEBUG_TYPE_BORLAND 9
2634 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2636 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2637 DWORD NumberOfSymbols;
2638 DWORD LvaToFirstSymbol;
2639 DWORD NumberOfLinenumbers;
2640 DWORD LvaToFirstLinenumber;
2641 DWORD RvaToFirstByteOfCode;
2642 DWORD RvaToLastByteOfCode;
2643 DWORD RvaToFirstByteOfData;
2644 DWORD RvaToLastByteOfData;
2645 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
2647 #define FRAME_FPO 0
2648 #define FRAME_TRAP 1
2649 #define FRAME_TSS 2
2650 #define FRAME_NONFPO 3
2652 typedef struct _FPO_DATA {
2653 DWORD ulOffStart;
2654 DWORD cbProcSize;
2655 DWORD cdwLocals;
2656 WORD cdwParams;
2657 unsigned cbProlog : 8;
2658 unsigned cbRegs : 3;
2659 unsigned fHasSEH : 1;
2660 unsigned fUseBP : 1;
2661 unsigned reserved : 1;
2662 unsigned cbFrame : 2;
2663 } FPO_DATA, *PFPO_DATA;
2665 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2666 DWORD Characteristics;
2667 DWORD TimeDateStamp;
2668 WORD MajorVersion;
2669 WORD MinorVersion;
2670 DWORD GlobalFlagsClear;
2671 DWORD GlobalFlagsSet;
2672 DWORD CriticalSectionDefaultTimeout;
2673 DWORD DeCommitFreeBlockThreshold;
2674 DWORD DeCommitTotalFreeThreshold;
2675 PVOID LockPrefixTable;
2676 DWORD MaximumAllocationSize;
2677 DWORD VirtualMemoryThreshold;
2678 DWORD ProcessHeapFlags;
2679 DWORD ProcessAffinityMask;
2680 WORD CSDVersion;
2681 WORD Reserved1;
2682 PVOID EditList;
2683 DWORD Reserved[1];
2684 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
2686 typedef struct _IMAGE_FUNCTION_ENTRY {
2687 DWORD StartingAddress;
2688 DWORD EndingAddress;
2689 DWORD EndOfPrologue;
2690 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
2692 #define IMAGE_DEBUG_MISC_EXENAME 1
2694 typedef struct _IMAGE_DEBUG_MISC {
2695 DWORD DataType;
2696 DWORD Length;
2697 BYTE Unicode;
2698 BYTE Reserved[ 3 ];
2699 BYTE Data[ 1 ];
2700 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
2702 /* This is the structure that appears at the very start of a .DBG file. */
2704 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
2705 WORD Signature;
2706 WORD Flags;
2707 WORD Machine;
2708 WORD Characteristics;
2709 DWORD TimeDateStamp;
2710 DWORD CheckSum;
2711 DWORD ImageBase;
2712 DWORD SizeOfImage;
2713 DWORD NumberOfSections;
2714 DWORD ExportedNamesSize;
2715 DWORD DebugDirectorySize;
2716 DWORD SectionAlignment;
2717 DWORD Reserved[ 2 ];
2718 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
2720 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2723 typedef struct tagMESSAGE_RESOURCE_ENTRY {
2724 WORD Length;
2725 WORD Flags;
2726 BYTE Text[1];
2727 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2728 #define MESSAGE_RESOURCE_UNICODE 0x0001
2730 typedef struct tagMESSAGE_RESOURCE_BLOCK {
2731 DWORD LowId;
2732 DWORD HighId;
2733 DWORD OffsetToEntries;
2734 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2736 typedef struct tagMESSAGE_RESOURCE_DATA {
2737 DWORD NumberOfBlocks;
2738 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
2739 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2742 * Here follows typedefs for security and tokens.
2746 * First a constant for the following typdefs.
2749 #define ANYSIZE_ARRAY 1
2751 /* FIXME: Orphan. What does it point to? */
2752 typedef PVOID PACCESS_TOKEN;
2755 * TOKEN_INFORMATION_CLASS
2758 typedef enum _TOKEN_INFORMATION_CLASS {
2759 TokenUser = 1,
2760 TokenGroups,
2761 TokenPrivileges,
2762 TokenOwner,
2763 TokenPrimaryGroup,
2764 TokenDefaultDacl,
2765 TokenSource,
2766 TokenType,
2767 TokenImpersonationLevel,
2768 TokenStatistics,
2769 TokenRestrictedSids,
2770 TokenSessionId,
2771 TokenGroupsAndPrivileges,
2772 TokenSessionReference,
2773 TokenSandBoxInert
2774 } TOKEN_INFORMATION_CLASS;
2776 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
2777 #define TOKEN_ADJUST_GROUPS 0x0040
2778 #define TOKEN_ADJUST_PRIVILEGES 0x0020
2779 #define TOKEN_ADJUST_SESSIONID 0x0100
2780 #define TOKEN_ASSIGN_PRIMARY 0x0001
2781 #define TOKEN_DUPLICATE 0x0002
2782 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
2783 #define TOKEN_IMPERSONATE 0x0004
2784 #define TOKEN_QUERY 0x0008
2785 #define TOKEN_QUERY_SOURCE 0x0010
2786 #define TOKEN_ADJUST_DEFAULT 0x0080
2787 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
2788 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
2789 TOKEN_ADJUST_PRIVILEGES | \
2790 TOKEN_ADJUST_GROUPS | \
2791 TOKEN_ADJUST_DEFAULT )
2792 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
2793 TOKEN_ASSIGN_PRIMARY | \
2794 TOKEN_DUPLICATE | \
2795 TOKEN_IMPERSONATE | \
2796 TOKEN_QUERY | \
2797 TOKEN_QUERY_SOURCE | \
2798 TOKEN_ADJUST_PRIVILEGES | \
2799 TOKEN_ADJUST_GROUPS | \
2800 TOKEN_ADJUST_SESSIONID | \
2801 TOKEN_ADJUST_DEFAULT )
2803 #ifndef _SECURITY_DEFINED
2804 #define _SECURITY_DEFINED
2807 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2809 typedef struct _GENERIC_MAPPING {
2810 ACCESS_MASK GenericRead;
2811 ACCESS_MASK GenericWrite;
2812 ACCESS_MASK GenericExecute;
2813 ACCESS_MASK GenericAll;
2814 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2816 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2817 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2818 typedef struct {
2819 BYTE Value[6];
2820 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
2821 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2823 #ifndef SID_DEFINED
2824 #define SID_DEFINED
2825 typedef struct _SID {
2826 BYTE Revision;
2827 BYTE SubAuthorityCount;
2828 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2829 DWORD SubAuthority[1];
2830 } SID,*PSID;
2831 #endif /* !defined(SID_DEFINED) */
2833 #define SID_REVISION (1) /* Current revision */
2834 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2835 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2839 * ACL
2842 #define ACL_REVISION1 1
2843 #define ACL_REVISION2 2
2844 #define ACL_REVISION3 3
2845 #define ACL_REVISION4 4
2847 #define MIN_ACL_REVISION ACL_REVISION2
2848 #define MAX_ACL_REVISION ACL_REVISION4
2850 typedef struct _ACL {
2851 BYTE AclRevision;
2852 BYTE Sbz1;
2853 WORD AclSize;
2854 WORD AceCount;
2855 WORD Sbz2;
2856 } ACL, *PACL;
2858 typedef enum _ACL_INFORMATION_CLASS
2860 AclRevisionInformation = 1,
2861 AclSizeInformation
2862 } ACL_INFORMATION_CLASS;
2864 typedef struct _ACL_REVISION_INFORMATION
2866 DWORD AclRevision;
2867 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
2869 typedef struct _ACL_SIZE_INFORMATION
2871 DWORD AceCount;
2872 DWORD AclBytesInUse;
2873 DWORD AclBytesFree;
2874 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
2876 /* SECURITY_DESCRIPTOR */
2877 #define SECURITY_DESCRIPTOR_REVISION 1
2878 #define SECURITY_DESCRIPTOR_REVISION1 1
2882 * Privilege Names
2884 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
2885 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
2886 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
2887 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
2888 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
2889 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
2890 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
2891 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
2892 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
2893 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
2894 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
2895 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
2896 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
2897 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
2898 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
2899 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
2900 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
2901 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
2902 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
2903 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
2904 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
2905 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
2906 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
2907 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
2909 #define SE_GROUP_MANDATORY 0x00000001
2910 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
2911 #define SE_GROUP_ENABLED 0x00000004
2912 #define SE_GROUP_OWNER 0x00000008
2913 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
2914 #define SE_GROUP_LOGON_ID 0xC0000000
2915 #define SE_GROUP_RESOURCE 0x20000000
2917 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
2918 #define SE_PRIVILEGE_ENABLED 0x00000002
2919 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
2921 #define SE_OWNER_DEFAULTED 0x00000001
2922 #define SE_GROUP_DEFAULTED 0x00000002
2923 #define SE_DACL_PRESENT 0x00000004
2924 #define SE_DACL_DEFAULTED 0x00000008
2925 #define SE_SACL_PRESENT 0x00000010
2926 #define SE_SACL_DEFAULTED 0x00000020
2927 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
2928 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
2929 #define SE_DACL_AUTO_INHERITED 0x00000400
2930 #define SE_SACL_AUTO_INHERITED 0x00000800
2931 #define SE_DACL_PROTECTED 0x00001000
2932 #define SE_SACL_PROTECTED 0x00002000
2933 #define SE_SELF_RELATIVE 0x00008000
2935 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2936 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
2938 /* The security descriptor structure */
2939 typedef struct {
2940 BYTE Revision;
2941 BYTE Sbz1;
2942 SECURITY_DESCRIPTOR_CONTROL Control;
2943 DWORD Owner;
2944 DWORD Group;
2945 DWORD Sacl;
2946 DWORD Dacl;
2947 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2949 typedef struct {
2950 BYTE Revision;
2951 BYTE Sbz1;
2952 SECURITY_DESCRIPTOR_CONTROL Control;
2953 PSID Owner;
2954 PSID Group;
2955 PACL Sacl;
2956 PACL Dacl;
2957 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
2959 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2961 #endif /* _SECURITY_DEFINED */
2964 * SID_AND_ATTRIBUTES
2967 typedef struct _SID_AND_ATTRIBUTES {
2968 PSID Sid;
2969 DWORD Attributes;
2970 } SID_AND_ATTRIBUTES;
2972 /* security entities */
2973 #define SECURITY_NULL_RID (0x00000000L)
2974 #define SECURITY_WORLD_RID (0x00000000L)
2975 #define SECURITY_LOCAL_RID (0X00000000L)
2977 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2979 /* S-1-1 */
2980 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2982 /* S-1-2 */
2983 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2985 /* S-1-3 */
2986 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2987 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2988 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2989 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2990 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2992 /* S-1-4 */
2993 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2995 /* S-1-5 */
2996 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2997 #define SECURITY_DIALUP_RID 0x00000001L
2998 #define SECURITY_NETWORK_RID 0x00000002L
2999 #define SECURITY_BATCH_RID 0x00000003L
3000 #define SECURITY_INTERACTIVE_RID 0x00000004L
3001 #define SECURITY_LOGON_IDS_RID 0x00000005L
3002 #define SECURITY_SERVICE_RID 0x00000006L
3003 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
3004 #define SECURITY_PROXY_RID 0x00000008L
3005 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
3006 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
3007 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
3008 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
3009 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
3010 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
3011 #define SECURITY_NT_NON_UNIQUE 0x00000015L
3012 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
3014 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
3015 #define DOMAIN_GROUP_RID_USERS 0x00000201L
3016 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
3018 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
3019 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
3020 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
3022 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3024 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
3027 * TOKEN_USER
3030 typedef struct _TOKEN_USER {
3031 SID_AND_ATTRIBUTES User;
3032 } TOKEN_USER;
3035 * TOKEN_GROUPS
3038 typedef struct _TOKEN_GROUPS {
3039 DWORD GroupCount;
3040 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3041 } TOKEN_GROUPS;
3044 * LUID_AND_ATTRIBUTES
3047 typedef union _LARGE_INTEGER {
3048 struct {
3049 #ifdef WORDS_BIGENDIAN
3050 LONG HighPart;
3051 DWORD LowPart;
3052 #else
3053 DWORD LowPart;
3054 LONG HighPart;
3055 #endif
3056 } DUMMYSTRUCTNAME;
3057 LONGLONG QuadPart;
3058 } LARGE_INTEGER, *PLARGE_INTEGER;
3060 typedef union _ULARGE_INTEGER {
3061 struct {
3062 #ifdef WORDS_BIGENDIAN
3063 DWORD HighPart;
3064 DWORD LowPart;
3065 #else
3066 DWORD LowPart;
3067 DWORD HighPart;
3068 #endif
3069 } DUMMYSTRUCTNAME;
3070 ULONGLONG QuadPart;
3071 } ULARGE_INTEGER, *PULARGE_INTEGER;
3074 * Locally Unique Identifier
3077 typedef struct _LUID {
3078 DWORD LowPart;
3079 LONG HighPart;
3080 } LUID, *PLUID;
3082 #include <pshpack4.h>
3083 typedef struct _LUID_AND_ATTRIBUTES {
3084 LUID Luid;
3085 DWORD Attributes;
3086 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3087 #include <poppack.h>
3090 * PRIVILEGE_SET
3093 typedef struct _PRIVILEGE_SET {
3094 DWORD PrivilegeCount;
3095 DWORD Control;
3096 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3097 } PRIVILEGE_SET, *PPRIVILEGE_SET;
3100 * TOKEN_PRIVILEGES
3103 typedef struct _TOKEN_PRIVILEGES {
3104 DWORD PrivilegeCount;
3105 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3106 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
3109 * TOKEN_OWNER
3112 typedef struct _TOKEN_OWNER {
3113 PSID Owner;
3114 } TOKEN_OWNER;
3117 * TOKEN_PRIMARY_GROUP
3120 typedef struct _TOKEN_PRIMARY_GROUP {
3121 PSID PrimaryGroup;
3122 } TOKEN_PRIMARY_GROUP;
3126 * TOKEN_DEFAULT_DACL
3129 typedef struct _TOKEN_DEFAULT_DACL {
3130 PACL DefaultDacl;
3131 } TOKEN_DEFAULT_DACL;
3134 * TOKEN_SOURCEL
3137 #define TOKEN_SOURCE_LENGTH 8
3139 typedef struct _TOKEN_SOURCE {
3140 char SourceName[TOKEN_SOURCE_LENGTH];
3141 LUID SourceIdentifier;
3142 } TOKEN_SOURCE;
3145 * TOKEN_TYPE
3148 typedef enum tagTOKEN_TYPE {
3149 TokenPrimary = 1,
3150 TokenImpersonation
3151 } TOKEN_TYPE;
3154 * SECURITY_IMPERSONATION_LEVEL
3157 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3158 SecurityAnonymous,
3159 SecurityIdentification,
3160 SecurityImpersonation,
3161 SecurityDelegation
3162 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
3165 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
3166 * PSECURITY_CONTEXT_TRACKING_MODE;
3168 * Quality of Service
3171 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3172 DWORD Length;
3173 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3174 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3175 BOOLEAN EffectiveOnly;
3176 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
3179 * TOKEN_STATISTICS
3182 typedef struct _TOKEN_STATISTICS {
3183 LUID TokenId;
3184 LUID AuthenticationId;
3185 LARGE_INTEGER ExpirationTime;
3186 TOKEN_TYPE TokenType;
3187 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3188 DWORD DynamicCharged;
3189 DWORD DynamicAvailable;
3190 DWORD GroupCount;
3191 DWORD PrivilegeCount;
3192 LUID ModifiedId;
3193 } TOKEN_STATISTICS;
3196 * ACLs of NT
3199 #define ACL_REVISION 2
3201 #define ACL_REVISION1 1
3202 #define ACL_REVISION2 2
3204 /* ACEs, directly starting after an ACL */
3205 typedef struct _ACE_HEADER {
3206 BYTE AceType;
3207 BYTE AceFlags;
3208 WORD AceSize;
3209 } ACE_HEADER,*PACE_HEADER;
3211 /* AceType */
3212 #define ACCESS_ALLOWED_ACE_TYPE 0
3213 #define ACCESS_DENIED_ACE_TYPE 1
3214 #define SYSTEM_AUDIT_ACE_TYPE 2
3215 #define SYSTEM_ALARM_ACE_TYPE 3
3217 /* inherit AceFlags */
3218 #define OBJECT_INHERIT_ACE 0x01
3219 #define CONTAINER_INHERIT_ACE 0x02
3220 #define NO_PROPAGATE_INHERIT_ACE 0x04
3221 #define INHERIT_ONLY_ACE 0x08
3222 #define INHERITED_ACE 0x10
3223 #define VALID_INHERIT_FLAGS 0x0F
3225 /* AceFlags mask for what events we (should) audit */
3226 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3227 #define FAILED_ACCESS_ACE_FLAG 0x80
3229 /* different ACEs depending on AceType
3230 * SidStart marks the begin of a SID
3231 * so the thing finally looks like this:
3232 * 0: ACE_HEADER
3233 * 4: ACCESS_MASK
3234 * 8... : SID
3236 typedef struct _ACCESS_ALLOWED_ACE {
3237 ACE_HEADER Header;
3238 DWORD Mask;
3239 DWORD SidStart;
3240 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
3242 typedef struct _ACCESS_DENIED_ACE {
3243 ACE_HEADER Header;
3244 DWORD Mask;
3245 DWORD SidStart;
3246 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
3248 typedef struct _SYSTEM_AUDIT_ACE {
3249 ACE_HEADER Header;
3250 DWORD Mask;
3251 DWORD SidStart;
3252 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
3254 typedef struct _SYSTEM_ALARM_ACE {
3255 ACE_HEADER Header;
3256 DWORD Mask;
3257 DWORD SidStart;
3258 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
3260 typedef enum tagSID_NAME_USE {
3261 SidTypeUser = 1,
3262 SidTypeGroup,
3263 SidTypeDomain,
3264 SidTypeAlias,
3265 SidTypeWellKnownGroup,
3266 SidTypeDeletedAccount,
3267 SidTypeInvalid,
3268 SidTypeUnknown
3269 } SID_NAME_USE,*PSID_NAME_USE;
3271 /* Access rights */
3273 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3274 #undef DELETE
3275 #define DELETE 0x00010000
3276 #define READ_CONTROL 0x00020000
3277 #define WRITE_DAC 0x00040000
3278 #define WRITE_OWNER 0x00080000
3279 #define SYNCHRONIZE 0x00100000
3280 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3282 #define STANDARD_RIGHTS_READ READ_CONTROL
3283 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3284 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3286 #define STANDARD_RIGHTS_ALL 0x001f0000
3288 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3290 #define GENERIC_READ 0x80000000
3291 #define GENERIC_WRITE 0x40000000
3292 #define GENERIC_EXECUTE 0x20000000
3293 #define GENERIC_ALL 0x10000000
3295 #define MAXIMUM_ALLOWED 0x02000000
3296 #define ACCESS_SYSTEM_SECURITY 0x01000000
3298 #define EVENT_MODIFY_STATE 0x0002
3299 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3301 #define SEMAPHORE_MODIFY_STATE 0x0002
3302 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3304 #define MUTEX_MODIFY_STATE 0x0001
3305 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
3307 #define TIMER_QUERY_STATE 0x0001
3308 #define TIMER_MODIFY_STATE 0x0002
3309 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3311 #define PROCESS_TERMINATE 0x0001
3312 #define PROCESS_CREATE_THREAD 0x0002
3313 #define PROCESS_VM_OPERATION 0x0008
3314 #define PROCESS_VM_READ 0x0010
3315 #define PROCESS_VM_WRITE 0x0020
3316 #define PROCESS_DUP_HANDLE 0x0040
3317 #define PROCESS_CREATE_PROCESS 0x0080
3318 #define PROCESS_SET_QUOTA 0x0100
3319 #define PROCESS_SET_INFORMATION 0x0200
3320 #define PROCESS_QUERY_INFORMATION 0x0400
3321 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
3323 #define THREAD_TERMINATE 0x0001
3324 #define THREAD_SUSPEND_RESUME 0x0002
3325 #define THREAD_GET_CONTEXT 0x0008
3326 #define THREAD_SET_CONTEXT 0x0010
3327 #define THREAD_SET_INFORMATION 0x0020
3328 #define THREAD_QUERY_INFORMATION 0x0040
3329 #define THREAD_SET_THREAD_TOKEN 0x0080
3330 #define THREAD_IMPERSONATE 0x0100
3331 #define THREAD_DIRECT_IMPERSONATION 0x0200
3332 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
3334 #define THREAD_BASE_PRIORITY_LOWRT 15
3335 #define THREAD_BASE_PRIORITY_MAX 2
3336 #define THREAD_BASE_PRIORITY_MIN -2
3337 #define THREAD_BASE_PRIORITY_IDLE -15
3339 #define SECTION_QUERY 0x0001
3340 #define SECTION_MAP_WRITE 0x0002
3341 #define SECTION_MAP_READ 0x0004
3342 #define SECTION_MAP_EXECUTE 0x0008
3343 #define SECTION_EXTEND_SIZE 0x0010
3344 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
3346 #define FILE_READ_DATA 0x0001 /* file & pipe */
3347 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
3348 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
3349 #define FILE_ADD_FILE 0x0002 /* directory */
3350 #define FILE_APPEND_DATA 0x0004 /* file */
3351 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
3352 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
3353 #define FILE_READ_EA 0x0008 /* file & directory */
3354 #define FILE_READ_PROPERTIES FILE_READ_EA
3355 #define FILE_WRITE_EA 0x0010 /* file & directory */
3356 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
3357 #define FILE_EXECUTE 0x0020 /* file */
3358 #define FILE_TRAVERSE 0x0020 /* directory */
3359 #define FILE_DELETE_CHILD 0x0040 /* directory */
3360 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
3361 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
3362 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
3364 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
3365 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
3366 SYNCHRONIZE)
3367 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
3368 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
3369 FILE_APPEND_DATA | SYNCHRONIZE)
3370 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
3371 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
3374 /* File attribute flags */
3375 #define FILE_SHARE_READ 0x00000001L
3376 #define FILE_SHARE_WRITE 0x00000002L
3377 #define FILE_SHARE_DELETE 0x00000004L
3378 #define FILE_ATTRIBUTE_READONLY 0x00000001L
3379 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
3380 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
3381 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
3382 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
3383 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
3384 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
3385 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
3386 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
3387 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
3388 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
3389 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
3391 /* File notification flags */
3392 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
3393 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
3394 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
3395 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
3396 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
3397 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
3398 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
3399 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
3401 #define FILE_ACTION_ADDED 0x00000001
3402 #define FILE_ACTION_REMOVED 0x00000002
3403 #define FILE_ACTION_MODIFIED 0x00000003
3404 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
3405 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
3408 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
3409 #define FILE_CASE_PRESERVED_NAMES 0x00000002
3410 #define FILE_UNICODE_ON_DISK 0x00000004
3411 #define FILE_PERSISTENT_ACLS 0x00000008
3412 #define FILE_FILE_COMPRESSION 0x00000010
3413 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
3415 /* File alignments (NT) */
3416 #define FILE_BYTE_ALIGNMENT 0x00000000
3417 #define FILE_WORD_ALIGNMENT 0x00000001
3418 #define FILE_LONG_ALIGNMENT 0x00000003
3419 #define FILE_QUAD_ALIGNMENT 0x00000007
3420 #define FILE_OCTA_ALIGNMENT 0x0000000f
3421 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
3422 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
3423 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
3424 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
3425 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
3427 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
3428 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
3430 #define REG_NONE 0 /* no type */
3431 #define REG_SZ 1 /* string type (ASCII) */
3432 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
3433 #define REG_BINARY 3 /* binary format, callerspecific */
3434 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
3435 #define REG_DWORD 4 /* DWORD in little endian format */
3436 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
3437 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
3438 #define REG_LINK 6 /* symbolic link (UNICODE) */
3439 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
3440 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
3441 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
3442 #define REG_RESOURCE_REQUIREMENTS_LIST 10
3443 #define REG_QWORD 11 /* QWORD in little endian format */
3444 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
3446 /* ----------------------------- begin power management --------------------- */
3448 typedef enum _LATENCY_TIME {
3449 LT_DONT_CARE,
3450 LT_LOWEST_LATENCY
3451 } LATENCY_TIME, *PLATENCY_TIME;
3453 /* ----------------------------- begin registry ----------------------------- */
3455 /* Registry security values */
3456 #define OWNER_SECURITY_INFORMATION 0x00000001
3457 #define GROUP_SECURITY_INFORMATION 0x00000002
3458 #define DACL_SECURITY_INFORMATION 0x00000004
3459 #define SACL_SECURITY_INFORMATION 0x00000008
3461 #define REG_OPTION_RESERVED 0x00000000
3462 #define REG_OPTION_NON_VOLATILE 0x00000000
3463 #define REG_OPTION_VOLATILE 0x00000001
3464 #define REG_OPTION_CREATE_LINK 0x00000002
3465 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
3466 #define REG_OPTION_OPEN_LINK 0x00000008
3467 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
3468 REG_OPTION_NON_VOLATILE| \
3469 REG_OPTION_VOLATILE| \
3470 REG_OPTION_CREATE_LINK| \
3471 REG_OPTION_BACKUP_RESTORE| \
3472 REG_OPTION_OPEN_LINK)
3475 #define REG_CREATED_NEW_KEY 0x00000001
3476 #define REG_OPENED_EXISTING_KEY 0x00000002
3478 /* For RegNotifyChangeKeyValue */
3479 #define REG_NOTIFY_CHANGE_NAME 0x01
3480 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
3481 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
3482 #define REG_NOTIFY_CHANGE_SECURITY 0x08
3484 #define KEY_QUERY_VALUE 0x00000001
3485 #define KEY_SET_VALUE 0x00000002
3486 #define KEY_CREATE_SUB_KEY 0x00000004
3487 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3488 #define KEY_NOTIFY 0x00000010
3489 #define KEY_CREATE_LINK 0x00000020
3491 /* for RegKeyRestore flags */
3492 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
3493 #define REG_REFRESH_HIVE 0x00000002
3494 #define REG_NO_LAZY_FLUSH 0x00000004
3495 #define REG_FORCE_RESTORE 0x00000008
3497 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3498 KEY_QUERY_VALUE| \
3499 KEY_ENUMERATE_SUB_KEYS| \
3500 KEY_NOTIFY) \
3501 & (~SYNCHRONIZE) \
3503 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3504 KEY_SET_VALUE| \
3505 KEY_CREATE_SUB_KEY) \
3506 & (~SYNCHRONIZE) \
3508 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
3509 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3510 KEY_QUERY_VALUE| \
3511 KEY_SET_VALUE| \
3512 KEY_CREATE_SUB_KEY| \
3513 KEY_ENUMERATE_SUB_KEYS| \
3514 KEY_NOTIFY| \
3515 KEY_CREATE_LINK) \
3516 & (~SYNCHRONIZE) \
3518 /* ------------------------------ end registry ------------------------------ */
3521 #define EVENTLOG_SUCCESS 0x0000
3522 #define EVENTLOG_ERROR_TYPE 0x0001
3523 #define EVENTLOG_WARNING_TYPE 0x0002
3524 #define EVENTLOG_INFORMATION_TYPE 0x0004
3525 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3526 #define EVENTLOG_AUDIT_FAILURE 0x0010
3528 #define SERVICE_BOOT_START 0x00000000
3529 #define SERVICE_SYSTEM_START 0x00000001
3530 #define SERVICE_AUTO_START 0x00000002
3531 #define SERVICE_DEMAND_START 0x00000003
3532 #define SERVICE_DISABLED 0x00000004
3534 #define SERVICE_ERROR_IGNORE 0x00000000
3535 #define SERVICE_ERROR_NORMAL 0x00000001
3536 #define SERVICE_ERROR_SEVERE 0x00000002
3537 #define SERVICE_ERROR_CRITICAL 0x00000003
3539 /* Service types */
3540 #define SERVICE_KERNEL_DRIVER 0x00000001
3541 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3542 #define SERVICE_ADAPTER 0x00000004
3543 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3545 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3546 SERVICE_RECOGNIZER_DRIVER )
3548 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3549 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3550 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3552 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3554 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3555 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3558 typedef enum _CM_SERVICE_NODE_TYPE
3560 DriverType = SERVICE_KERNEL_DRIVER,
3561 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3562 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3563 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3564 AdapterType = SERVICE_ADAPTER,
3565 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3566 } SERVICE_NODE_TYPE;
3568 typedef enum _CM_SERVICE_LOAD_TYPE
3570 BootLoad = SERVICE_BOOT_START,
3571 SystemLoad = SERVICE_SYSTEM_START,
3572 AutoLoad = SERVICE_AUTO_START,
3573 DemandLoad = SERVICE_DEMAND_START,
3574 DisableLoad = SERVICE_DISABLED
3575 } SERVICE_LOAD_TYPE;
3577 typedef enum _CM_ERROR_CONTROL_TYPE
3579 IgnoreError = SERVICE_ERROR_IGNORE,
3580 NormalError = SERVICE_ERROR_NORMAL,
3581 SevereError = SERVICE_ERROR_SEVERE,
3582 CriticalError = SERVICE_ERROR_CRITICAL
3583 } SERVICE_ERROR_TYPE;
3587 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3588 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3589 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3590 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3591 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3593 #include <guiddef.h>
3595 typedef struct _OBJECT_TYPE_LIST {
3596 WORD Level;
3597 WORD Sbz;
3598 GUID *ObjectType;
3599 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
3601 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3603 WORD Type;
3604 WORD CreatorBackTraceIndex;
3605 struct _RTL_CRITICAL_SECTION *CriticalSection;
3606 LIST_ENTRY ProcessLocksList;
3607 DWORD EntryCount;
3608 DWORD ContentionCount;
3609 DWORD Spare[ 2 ];
3610 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
3612 typedef struct _RTL_CRITICAL_SECTION {
3613 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3614 LONG LockCount;
3615 LONG RecursionCount;
3616 HANDLE OwningThread;
3617 HANDLE LockSemaphore;
3618 ULONG_PTR SpinCount;
3619 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
3621 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
3623 typedef struct _IO_COUNTERS {
3624 ULONGLONG ReadOperationCount;
3625 ULONGLONG WriteOperationCount;
3626 ULONGLONG OtherOperationCount;
3627 ULONGLONG ReadTransferCount;
3628 ULONGLONG WriteTransferCount;
3629 ULONGLONG OtherTransferCount;
3630 } IO_COUNTERS;
3631 typedef IO_COUNTERS *PIO_COUNTERS;
3633 typedef struct {
3634 DWORD dwOSVersionInfoSize;
3635 DWORD dwMajorVersion;
3636 DWORD dwMinorVersion;
3637 DWORD dwBuildNumber;
3638 DWORD dwPlatformId;
3639 CHAR szCSDVersion[128];
3640 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
3642 typedef struct {
3643 DWORD dwOSVersionInfoSize;
3644 DWORD dwMajorVersion;
3645 DWORD dwMinorVersion;
3646 DWORD dwBuildNumber;
3647 DWORD dwPlatformId;
3648 WCHAR szCSDVersion[128];
3649 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
3651 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
3652 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
3653 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
3655 typedef struct {
3656 DWORD dwOSVersionInfoSize;
3657 DWORD dwMajorVersion;
3658 DWORD dwMinorVersion;
3659 DWORD dwBuildNumber;
3660 DWORD dwPlatformId;
3661 CHAR szCSDVersion[128];
3662 WORD wServicePackMajor;
3663 WORD wServicePackMinor;
3664 WORD wSuiteMask;
3665 BYTE wProductType;
3666 BYTE wReserved;
3667 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
3669 typedef struct {
3670 DWORD dwOSVersionInfoSize;
3671 DWORD dwMajorVersion;
3672 DWORD dwMinorVersion;
3673 DWORD dwBuildNumber;
3674 DWORD dwPlatformId;
3675 WCHAR szCSDVersion[128];
3676 WORD wServicePackMajor;
3677 WORD wServicePackMinor;
3678 WORD wSuiteMask;
3679 BYTE wProductType;
3680 BYTE wReserved;
3681 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
3683 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
3684 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
3685 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
3687 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
3689 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
3691 #define VER_PLATFORM_WIN32s 0
3692 #define VER_PLATFORM_WIN32_WINDOWS 1
3693 #define VER_PLATFORM_WIN32_NT 2
3695 #define VER_MINORVERSION 0x00000001
3696 #define VER_MAJORVERSION 0x00000002
3697 #define VER_BUILDNUMBER 0x00000004
3698 #define VER_PLATFORMID 0x00000008
3699 #define VER_SERVICEPACKMINOR 0x00000010
3700 #define VER_SERVICEPACKMAJOR 0x00000020
3701 #define VER_SUITENAME 0x00000040
3702 #define VER_PRODUCT_TYPE 0x00000080
3704 #define VER_NT_WORKSTATION 1
3705 #define VER_NT_DOMAIN_CONTROLLER 2
3706 #define VER_NT_SERVER 3
3708 #define VER_SUITE_SMALLBUSINESS 0x00000001
3709 #define VER_SUITE_ENTERPRISE 0x00000002
3710 #define VER_SUITE_BACKOFFICE 0x00000004
3711 #define VER_SUITE_COMMUNICATIONS 0x00000008
3712 #define VER_SUITE_TERMINAL 0x00000010
3713 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
3714 #define VER_SUITE_EMBEDDEDNT 0x00000040
3715 #define VER_SUITE_DATACENTER 0x00000080
3716 #define VER_SUITE_SINGLEUSERTS 0x00000100
3717 #define VER_SUITE_PERSONAL 0x00000200
3719 #define VER_EQUAL 1
3720 #define VER_GREATER 2
3721 #define VER_GREATER_EQUAL 3
3722 #define VER_LESS 4
3723 #define VER_LESS_EQUAL 5
3724 #define VER_AND 6
3725 #define VER_OR 7
3727 #endif /* __WINE_WINNT_H */