configure: Merge the libGL existence check with the soname check.
[wine/dibdrv.git] / include / winnt.h
blob71dbf6de8c2f5b3e7271a7849364492a9af88f36
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #ifndef _WINNT_
22 #define _WINNT_
24 #include <basetsd.h>
25 #include <guiddef.h>
27 #ifndef RC_INVOKED
28 #include <ctype.h>
29 #include <stddef.h>
30 #include <string.h>
31 #endif
34 #ifdef __cplusplus
35 extern "C" {
36 #endif
38 #define NTAPI __stdcall
40 #if (defined(_M_IX86) || defined(_M_IA64) || defined(_M_AMD64) || defined(__MINGW32__)) && !defined(MIDL_PASS)
41 # if defined(_MSC_VER)
42 # define DECLSPEC_IMPORT __declspec(dllimport)
43 # elif defined(__MINGW32__)
44 # define DECLSPEC_IMPORT __attribute__((dllimport))
45 # else
46 # define DECLSPEC_IMPORT
47 # endif
48 #else
49 # define DECLSPEC_IMPORT
50 #endif
52 #ifndef DECLSPEC_NORETURN
53 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && !defined(MIDL_PASS)
54 # define DECLSPEC_NORETURN __declspec(noreturn)
55 # elif defined(__GNUC__)
56 # define DECLSPEC_NORETURN __attribute__((noreturn))
57 # else
58 # define DECLSPEC_NORETURN
59 # endif
60 #endif
62 #ifndef DECLSPEC_ALIGN
63 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
64 # define DECLSPEC_ALIGN(x) __declspec(align(x))
65 # elif defined(__GNUC__)
66 # define DECLSPEC_ALIGN(x) __attribute__((aligned(x)))
67 # else
68 # define DECLSPEC_ALIGN(x)
69 # endif
70 #endif
72 #ifndef DECLSPEC_CACHEALIGN
73 # define DECLSPEC_CACHEALIGN DECLSPEC_ALIGN(128)
74 #endif
76 #ifndef DECLSPEC_UUID
77 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined (__cplusplus)
78 # define DECLSPEC_UUID(x) __declspec(uuid(x))
79 # else
80 # define DECLSPEC_UUID(x)
81 # endif
82 #endif
84 #ifndef DECLSPEC_NOVTABLE
85 # if defined(_MSC_VER) && (_MSC_VER >= 1100) && defined(__cplusplus)
86 # define DECLSPEC_NOVTABLE __declspec(novtable)
87 # else
88 # define DECLSPEC_NOVTABLE
89 # endif
90 #endif
92 #ifndef DECLSPEC_SELECTANY
93 #if defined(_MSC_VER) && (_MSC_VER >= 1100)
94 #define DECLSPEC_SELECTANY __declspec(selectany)
95 #else
96 #define DECLSPEC_SELECTANY
97 #endif
98 #endif
100 #ifndef NOP_FUNCTION
101 # if defined(_MSC_VER) && (_MSC_VER >= 1210)
102 # define NOP_FUNCTION __noop
103 # else
104 # define NOP_FUNCTION (void)0
105 # endif
106 #endif
108 #ifndef DECLSPEC_ADDRSAFE
109 # if defined(_MSC_VER) && (_MSC_VER >= 1200) && (defined(_M_ALPHA) || defined(_M_AXP64))
110 # define DECLSPEC_ADDRSAFE __declspec(address_safe)
111 # else
112 # define DECLSPEC_ADDRSAFE
113 # endif
114 #endif
116 #ifndef FORCEINLINE
117 # if defined(_MSC_VER) && (_MSC_VER >= 1200)
118 # define FORCEINLINE __forceinline
119 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
120 # define FORCEINLINE __attribute__((always_inline))
121 # else
122 # define FORCEINLINE inline
123 # endif
124 #endif
126 #ifndef DECLSPEC_DEPRECATED
127 # if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(MIDL_PASS)
128 # define DECLSPEC_DEPRECATED __declspec(deprecated)
129 # define DEPRECATE_SUPPORTED
130 # elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 2)))
131 # define DECLSPEC_DEPRECATED __attribute__((deprecated))
132 # define DEPRECATE_SUPPORTED
133 # else
134 # define DECLSPEC_DEPRECATED
135 # undef DEPRECATE_SUPPORTED
136 # endif
137 #endif
139 /* a couple of useful Wine extensions */
141 #ifdef _MSC_VER
142 # define DECLSPEC_EXPORT __declspec(dllexport)
143 #elif defined(__MINGW32__)
144 # define DECLSPEC_EXPORT __attribute__((dllexport))
145 #elif defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
146 # define DECLSPEC_EXPORT __attribute__((visibility ("default")))
147 #else
148 # define DECLSPEC_EXPORT
149 #endif
151 #if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
152 # define DECLSPEC_HIDDEN __attribute__((visibility ("hidden")))
153 #else
154 # define DECLSPEC_HIDDEN
155 #endif
157 /* Anonymous union/struct handling */
159 #ifndef NONAMELESSSTRUCT
160 # ifdef __GNUC__
161 /* Anonymous struct support starts with gcc 2.96 or gcc/g++ 3.x */
162 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && (defined(__cplusplus) || (__GNUC_MINOR__ < 96)))
163 # define NONAMELESSSTRUCT
164 # endif
165 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
166 # define NONAMELESSSTRUCT
167 # endif
168 #endif /* NONAMELESSSTRUCT */
170 #ifndef NONAMELESSUNION
171 # ifdef __GNUC__
172 /* Anonymous unions support starts with gcc 2.96/g++ 2.95 */
173 # if (__GNUC__ < 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ < 95) || ((__GNUC_MINOR__ == 95) && !defined(__cplusplus))))
174 # define NONAMELESSUNION
175 # endif
176 # elif defined(__SUNPRO_C) || defined(__SUNPRO_CC)
177 # define NONAMELESSUNION
178 # endif
179 #endif /* NONAMELESSUNION */
181 #ifndef NONAMELESSSTRUCT
182 #define DUMMYSTRUCTNAME
183 #define DUMMYSTRUCTNAME1
184 #define DUMMYSTRUCTNAME2
185 #define DUMMYSTRUCTNAME3
186 #define DUMMYSTRUCTNAME4
187 #define DUMMYSTRUCTNAME5
188 #else /* !defined(NONAMELESSSTRUCT) */
189 #define DUMMYSTRUCTNAME s
190 #define DUMMYSTRUCTNAME1 s1
191 #define DUMMYSTRUCTNAME2 s2
192 #define DUMMYSTRUCTNAME3 s3
193 #define DUMMYSTRUCTNAME4 s4
194 #define DUMMYSTRUCTNAME5 s5
195 #endif /* !defined(NONAMELESSSTRUCT) */
197 #ifndef NONAMELESSUNION
198 #define DUMMYUNIONNAME
199 #define DUMMYUNIONNAME1
200 #define DUMMYUNIONNAME2
201 #define DUMMYUNIONNAME3
202 #define DUMMYUNIONNAME4
203 #define DUMMYUNIONNAME5
204 #define DUMMYUNIONNAME6
205 #define DUMMYUNIONNAME7
206 #define DUMMYUNIONNAME8
207 #else /* !defined(NONAMELESSUNION) */
208 #define DUMMYUNIONNAME u
209 #define DUMMYUNIONNAME1 u1
210 #define DUMMYUNIONNAME2 u2
211 #define DUMMYUNIONNAME3 u3
212 #define DUMMYUNIONNAME4 u4
213 #define DUMMYUNIONNAME5 u5
214 #define DUMMYUNIONNAME6 u6
215 #define DUMMYUNIONNAME7 u7
216 #define DUMMYUNIONNAME8 u8
217 #endif /* !defined(NONAMELESSUNION) */
219 /* C99 restrict support */
221 #if defined(ENABLE_RESTRICTED) && !defined(MIDL_PASS) && !defined(RC_INVOKED)
222 # if defined(_MSC_VER) && defined(_M_MRX000)
223 # define RESTRICTED_POINTER __restrict
224 # elif defined(__GNUC__) && ((__GNUC__ > 2) || ((__GNUC__ == 2) && (__GNUC_MINOR__ >= 95)))
225 # define RESTRICTED_POINTER __restrict
226 # else
227 # define RESTRICTED_POINTER
228 # endif
229 #else
230 # define RESTRICTED_POINTER
231 #endif
233 /* C99 unaligned support */
235 #if defined(_MSC_VER) && (defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) || defined(_M_IA64) || defined(_M_AMD64))
236 # define UNALIGNED __unaligned
237 # ifdef _WIN64
238 # define UNALIGNED64 __unaligned
239 # else
240 # define UNALIGNED64
241 # endif
242 #else
243 # define UNALIGNED
244 # define UNALIGNED64
245 #endif
247 /* Alignment macros */
249 #if defined(_WIN64) || (defined(_MSC_VER) && defined(_M_ALPHA)) || defined(__alpha__)
250 #define MAX_NATURAL_ALIGNMENT sizeof(ULONGLONG)
251 #define MEMORY_ALLOCATION_ALIGNMENT 16
252 #else
253 #define MAX_NATURAL_ALIGNMENT sizeof(DWORD)
254 #define MEMORY_ALLOCATION_ALIGNMENT 8
255 #endif
257 #if defined(_MSC_VER) && (_MSC_VER >= 1300) && defined(__cplusplus)
258 # define TYPE_ALIGNMENT(t) __alignof(t)
259 #elif defined(__GNUC__)
260 # define TYPE_ALIGNMENT(t) __alignof__(t)
261 #else
262 # define TYPE_ALIGNMENT(t) FIELD_OFFSET(struct { char x; t test; }, test)
263 #endif
265 #ifdef _WIN64
266 # define PROBE_ALIGNMENT(_s) \
267 (TYPE_ALIGNMENT(_s) > TYPE_ALIGNMENT(DWORD) ? \
268 TYPE_ALIGNMENT(_s) : TYPE_ALIGNMENT(DWORD))
269 # define PROBE_ALIGNMENT32(_s) TYPE_ALIGNMENT(DWORD)
270 #else
271 # define PROBE_ALIGNMENT(_s) TYPE_ALIGNMENT(DWORD)
272 #endif
274 /* Compile time assertion */
276 #if defined(_MSC_VER)
277 # define C_ASSERT(e) typedef char __C_ASSERT__[(e)?1:-1]
278 #elif defined(__GNUC__)
279 # define C_ASSERT(e) extern char __C_ASSERT__[(e)?1:-1]
280 #endif
282 /* Eliminate Microsoft C/C++ compiler warning 4715 */
283 #if (_MSC_VER > 1200)
284 # define DEFAULT_UNREACHABLE default: __assume(0)
285 #else
286 # define DEFAULT_UNREACHABLE
287 #endif
289 /* Error Masks */
290 #define APPLICATION_ERROR_MASK 0x20000000
291 #define ERROR_SEVERITY_SUCCESS 0x00000000
292 #define ERROR_SEVERITY_INFORMATIONAL 0x40000000
293 #define ERROR_SEVERITY_WARNING 0x80000000
294 #define ERROR_SEVERITY_ERROR 0xC0000000
296 /* Microsoft's macros for declaring functions */
298 #ifdef __cplusplus
299 # define EXTERN_C extern "C"
300 #else
301 # define EXTERN_C extern
302 #endif
304 #define STDMETHODCALLTYPE __stdcall
305 #define STDMETHODVCALLTYPE __cdecl
306 #define STDAPICALLTYPE __stdcall
307 #define STDAPIVCALLTYPE __cdecl
309 #define STDAPI EXTERN_C HRESULT STDAPICALLTYPE
310 #define STDAPI_(type) EXTERN_C type STDAPICALLTYPE
311 #define STDMETHODIMP HRESULT STDMETHODCALLTYPE
312 #define STDMETHODIMP_(type) type STDMETHODCALLTYPE
313 #define STDAPIV EXTERN_C HRESULT STDAPIVCALLTYPE
314 #define STDAPIV_(type) EXTERN_C type STDAPIVCALLTYPE
315 #define STDMETHODIMPV HRESULT STDMETHODVCALLTYPE
316 #define STDMETHODIMPV_(type) type STDMETHODVCALLTYPE
318 /* Define the basic types */
319 #ifndef VOID
320 #define VOID void
321 #endif
322 typedef VOID *PVOID;
323 typedef VOID *PVOID64;
324 typedef BYTE BOOLEAN, *PBOOLEAN;
325 typedef char CHAR, *PCHAR;
326 typedef short SHORT, *PSHORT;
327 #ifdef _MSC_VER
328 typedef long LONG, *PLONG;
329 #else
330 typedef int LONG, *PLONG;
331 #endif
333 /* Some systems might have wchar_t, but we really need 16 bit characters */
334 #ifdef WINE_UNICODE_NATIVE
335 typedef wchar_t WCHAR, *PWCHAR;
336 #else
337 typedef unsigned short WCHAR, *PWCHAR;
338 #endif
340 /* 'Extended/Wide' numerical types */
341 #ifndef _ULONGLONG_
342 # define _ULONGLONG_
343 # ifdef _MSC_VER
344 typedef signed __int64 LONGLONG, *PLONGLONG;
345 typedef unsigned __int64 ULONGLONG, *PULONGLONG;
346 # else
347 typedef signed __int64 DECLSPEC_ALIGN(8) LONGLONG, *PLONGLONG;
348 typedef unsigned __int64 DECLSPEC_ALIGN(8) ULONGLONG, *PULONGLONG;
349 # endif
350 #endif
352 #ifndef _DWORDLONG_
353 # define _DWORDLONG_
354 # ifdef _MSC_VER
355 typedef ULONGLONG DWORDLONG, *PDWORDLONG;
356 # else
357 typedef ULONGLONG DECLSPEC_ALIGN(8) DWORDLONG, *PDWORDLONG;
358 # endif
359 #endif
361 /* ANSI string types */
362 typedef CHAR *PCH, *LPCH;
363 typedef const CHAR *PCCH, *LPCCH;
364 typedef CHAR *PSTR, *LPSTR, *NPSTR;
365 typedef const CHAR *PCSTR, *LPCSTR;
367 /* Unicode string types */
368 typedef WCHAR *PWCH, *LPWCH;
369 typedef const WCHAR *PCWCH, *LPCWCH;
370 typedef WCHAR *PWSTR, *LPWSTR, *NWPSTR;
371 typedef const WCHAR *PCWSTR, *LPCWSTR;
373 /* Neutral character and string types */
374 /* These are only defined for Winelib, i.e. _not_ defined for
375 * the emulator. The reason is they depend on the UNICODE
376 * macro which only exists in the user's code.
378 #ifndef __WINESRC__
379 # ifdef UNICODE
380 # ifndef _TCHAR_DEFINED
381 typedef WCHAR TCHAR, *PTCHAR;
382 # define _TCHAR_DEFINED
383 #endif
384 typedef LPWSTR PTSTR, LPTSTR;
385 typedef LPCWSTR PCTSTR, LPCTSTR;
386 # define __TEXT(string) L##string
387 # else /* UNICODE */
388 # ifndef _TCHAR_DEFINED
389 typedef CHAR TCHAR, *PTCHAR;
390 # define _TCHAR_DEFINED
391 # endif
392 typedef LPSTR PTSTR, LPTSTR;
393 typedef LPCSTR PCTSTR, LPCTSTR;
394 # define __TEXT(string) string
395 # endif /* UNICODE */
396 # define TEXT(quote) __TEXT(quote)
397 #endif /* __WINESRC__ */
399 /* Misc common WIN32 types */
400 typedef char CCHAR;
401 typedef DWORD LCID, *PLCID;
402 typedef WORD LANGID;
403 typedef DWORD EXECUTION_STATE;
404 #ifndef _HRESULT_DEFINED
405 #define _HRESULT_DEFINED
406 typedef LONG HRESULT;
407 #endif
409 /* Handle type */
411 typedef void *HANDLE;
412 typedef HANDLE *PHANDLE, *LPHANDLE;
414 #ifdef STRICT
415 #define DECLARE_HANDLE(a) typedef struct a##__ { int unused; } *a
416 #else /*STRICT*/
417 #define DECLARE_HANDLE(a) typedef HANDLE a
418 #endif /*STRICT*/
420 typedef BYTE FCHAR;
421 typedef WORD FSHORT;
422 typedef DWORD FLONG;
424 /* Defines */
426 #ifndef WIN32_NO_STATUS
428 #define STATUS_WAIT_0 ((DWORD) 0x00000000)
429 #define STATUS_ABANDONED_WAIT_0 ((DWORD) 0x00000080)
430 #define STATUS_USER_APC ((DWORD) 0x000000C0)
431 #define STATUS_TIMEOUT ((DWORD) 0x00000102)
432 #define STATUS_PENDING ((DWORD) 0x00000103)
433 #define STATUS_SEGMENT_NOTIFICATION ((DWORD) 0x40000005)
434 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD) 0x80000001)
435 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD) 0x80000002)
436 #define STATUS_BREAKPOINT ((DWORD) 0x80000003)
437 #define STATUS_SINGLE_STEP ((DWORD) 0x80000004)
438 #define STATUS_ACCESS_VIOLATION ((DWORD) 0xC0000005)
439 #define STATUS_IN_PAGE_ERROR ((DWORD) 0xC0000006)
440 #define STATUS_INVALID_HANDLE ((DWORD) 0xC0000008)
441 #define STATUS_NO_MEMORY ((DWORD) 0xC0000017)
442 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD) 0xC000001D)
443 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD) 0xC0000025)
444 #define STATUS_INVALID_DISPOSITION ((DWORD) 0xC0000026)
445 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD) 0xC000008C)
446 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD) 0xC000008D)
447 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD) 0xC000008E)
448 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD) 0xC000008F)
449 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD) 0xC0000090)
450 #define STATUS_FLOAT_OVERFLOW ((DWORD) 0xC0000091)
451 #define STATUS_FLOAT_STACK_CHECK ((DWORD) 0xC0000092)
452 #define STATUS_FLOAT_UNDERFLOW ((DWORD) 0xC0000093)
453 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD) 0xC0000094)
454 #define STATUS_INTEGER_OVERFLOW ((DWORD) 0xC0000095)
455 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD) 0xC0000096)
456 #define STATUS_STACK_OVERFLOW ((DWORD) 0xC00000FD)
457 #define STATUS_CONTROL_C_EXIT ((DWORD) 0xC000013A)
458 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD) 0xC00002B4)
459 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD) 0xC00002B5)
460 #define STATUS_REG_NAT_CONSUMPTION ((DWORD) 0xC00002C9)
461 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD) 0xC015000F)
462 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD) 0xC0150010)
464 /* status values for ContinueDebugEvent */
465 #define DBG_EXCEPTION_HANDLED ((DWORD) 0x00010001)
466 #define DBG_CONTINUE ((DWORD) 0x00010002)
467 #define DBG_TERMINATE_THREAD ((DWORD) 0x40010003)
468 #define DBG_TERMINATE_PROCESS ((DWORD) 0x40010004)
469 #define DBG_CONTROL_C ((DWORD) 0x40010005)
470 #define DBG_CONTROL_BREAK ((DWORD) 0x40010008)
471 #define DBG_COMMAND_EXCEPTION ((DWORD) 0x40010009)
472 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD) 0x80010001)
474 #endif /* WIN32_NO_STATUS */
476 /* Argument 1 passed to the DllEntryProc. */
477 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
478 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
479 #define DLL_THREAD_ATTACH 2 /* attach new thread */
480 #define DLL_THREAD_DETACH 3 /* detach thread */
481 #ifdef __WINESRC__
482 #define DLL_WINE_PREATTACH 8 /* called before process attach for Wine builtins */
483 #endif
485 /* u.x.wProcessorArchitecture (NT) */
486 #define PROCESSOR_ARCHITECTURE_INTEL 0
487 #define PROCESSOR_ARCHITECTURE_MIPS 1
488 #define PROCESSOR_ARCHITECTURE_ALPHA 2
489 #define PROCESSOR_ARCHITECTURE_PPC 3
490 #define PROCESSOR_ARCHITECTURE_SHX 4
491 #define PROCESSOR_ARCHITECTURE_ARM 5
492 #define PROCESSOR_ARCHITECTURE_IA64 6
493 #define PROCESSOR_ARCHITECTURE_ALPHA64 7
494 #define PROCESSOR_ARCHITECTURE_MSIL 8
495 #define PROCESSOR_ARCHITECTURE_AMD64 9
496 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
498 /* dwProcessorType */
499 #define PROCESSOR_INTEL_386 386
500 #define PROCESSOR_INTEL_486 486
501 #define PROCESSOR_INTEL_PENTIUM 586
502 #define PROCESSOR_INTEL_860 860
503 #define PROCESSOR_INTEL_IA64 2200
504 #define PROCESSOR_AMD_X8664 8664
505 #define PROCESSOR_MIPS_R2000 2000
506 #define PROCESSOR_MIPS_R3000 3000
507 #define PROCESSOR_MIPS_R4000 4000
508 #define PROCESSOR_ALPHA_21064 21064
509 #define PROCESSOR_PPC_601 601
510 #define PROCESSOR_PPC_603 603
511 #define PROCESSOR_PPC_604 604
512 #define PROCESSOR_PPC_620 620
513 #define PROCESSOR_HITACHI_SH3 10003
514 #define PROCESSOR_HITACHI_SH3E 10004
515 #define PROCESSOR_HITACHI_SH4 10005
516 #define PROCESSOR_MOTOROLA_821 821
517 #define PROCESSOR_SHx_SH3 103
518 #define PROCESSOR_SHx_SH4 104
519 #define PROCESSOR_STRONGARM 2577
520 #define PROCESSOR_ARM720 1824 /* 0x720 */
521 #define PROCESSOR_ARM820 2080 /* 0x820 */
522 #define PROCESSOR_ARM920 2336 /* 0x920 */
523 #define PROCESSOR_ARM_7TDMI 70001
525 #define MAXIMUM_PROCESSORS 32
526 typedef struct _MEMORY_BASIC_INFORMATION
528 LPVOID BaseAddress;
529 LPVOID AllocationBase;
530 DWORD AllocationProtect;
531 SIZE_T RegionSize;
532 DWORD State;
533 DWORD Protect;
534 DWORD Type;
535 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION;
537 #define PAGE_NOACCESS 0x01
538 #define PAGE_READONLY 0x02
539 #define PAGE_READWRITE 0x04
540 #define PAGE_WRITECOPY 0x08
541 #define PAGE_EXECUTE 0x10
542 #define PAGE_EXECUTE_READ 0x20
543 #define PAGE_EXECUTE_READWRITE 0x40
544 #define PAGE_EXECUTE_WRITECOPY 0x80
545 #define PAGE_GUARD 0x100
546 #define PAGE_NOCACHE 0x200
547 #define PAGE_WRITECOMBINE 0x400
549 #define MEM_COMMIT 0x00001000
550 #define MEM_RESERVE 0x00002000
551 #define MEM_DECOMMIT 0x00004000
552 #define MEM_RELEASE 0x00008000
553 #define MEM_FREE 0x00010000
554 #define MEM_PRIVATE 0x00020000
555 #define MEM_MAPPED 0x00040000
556 #define MEM_RESET 0x00080000
557 #define MEM_TOP_DOWN 0x00100000
558 #define MEM_WRITE_WATCH 0x00200000
559 #define MEM_PHYSICAL 0x00400000
560 #define MEM_LARGE_PAGES 0x20000000
561 #define MEM_4MB_PAGES 0x80000000
562 #ifdef __WINESRC__
563 #define MEM_SYSTEM 0x80000000
564 #endif
566 #define SEC_FILE 0x00800000
567 #define SEC_IMAGE 0x01000000
568 #define SEC_RESERVE 0x04000000
569 #define SEC_COMMIT 0x08000000
570 #define SEC_NOCACHE 0x10000000
571 #define SEC_LARGE_PAGES 0x80000000
572 #define MEM_IMAGE SEC_IMAGE
574 #define WRITE_WATCH_FLAG_RESET 0x00000001
577 #define MINCHAR 0x80
578 #define MAXCHAR 0x7f
579 #define MINSHORT 0x8000
580 #define MAXSHORT 0x7fff
581 #define MINLONG 0x80000000
582 #define MAXLONG 0x7fffffff
583 #define MAXBYTE 0xff
584 #define MAXWORD 0xffff
585 #define MAXDWORD 0xffffffff
587 #define FIELD_OFFSET(type, field) \
588 ((LONG)(INT_PTR)&(((type *)0)->field))
590 #define CONTAINING_RECORD(address, type, field) \
591 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
593 /* Types */
595 typedef struct _LIST_ENTRY {
596 struct _LIST_ENTRY *Flink;
597 struct _LIST_ENTRY *Blink;
598 } LIST_ENTRY, *PLIST_ENTRY, * RESTRICTED_POINTER PRLIST_ENTRY;
600 typedef struct _SINGLE_LIST_ENTRY {
601 struct _SINGLE_LIST_ENTRY *Next;
602 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
604 #ifdef _WIN64
606 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY *PSLIST_ENTRY;
607 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY {
608 PSLIST_ENTRY Next;
609 } SLIST_ENTRY;
611 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER {
612 struct {
613 ULONGLONG Alignment;
614 ULONGLONG Region;
615 } DUMMYSTRUCTNAME;
616 struct {
617 ULONGLONG Depth:16;
618 ULONGLONG Sequence:9;
619 ULONGLONG NextEntry:39;
620 ULONGLONG HeaderType:1;
621 ULONGLONG Init:1;
622 ULONGLONG Reserved:59;
623 ULONGLONG Region:3;
624 } Header8;
625 struct {
626 ULONGLONG Depth:16;
627 ULONGLONG Sequence:48;
628 ULONGLONG HeaderType:1;
629 ULONGLONG Init:1;
630 ULONGLONG Reserved:2;
631 ULONGLONG NextEntry:60;
632 } Header16;
633 } SLIST_HEADER, *PSLIST_HEADER;
635 #else
637 #undef SLIST_ENTRY /* for Mac OS */
638 #define SLIST_ENTRY SINGLE_LIST_ENTRY
639 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY
640 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY
642 typedef union _SLIST_HEADER {
643 ULONGLONG Alignment;
644 struct {
645 SLIST_ENTRY Next;
646 WORD Depth;
647 WORD Sequence;
648 } DUMMYSTRUCTNAME;
649 } SLIST_HEADER, *PSLIST_HEADER;
651 #endif
653 PSLIST_ENTRY WINAPI RtlFirstEntrySList(const SLIST_HEADER*);
654 VOID WINAPI RtlInitializeSListHead(PSLIST_HEADER);
655 PSLIST_ENTRY WINAPI RtlInterlockedFlushSList(PSLIST_HEADER);
656 PSLIST_ENTRY WINAPI RtlInterlockedPopEntrySList(PSLIST_HEADER);
657 PSLIST_ENTRY WINAPI RtlInterlockedPushEntrySList(PSLIST_HEADER, PSLIST_ENTRY);
658 WORD WINAPI RtlQueryDepthSList(PSLIST_HEADER);
661 /* Heap flags */
663 #define HEAP_NO_SERIALIZE 0x00000001
664 #define HEAP_GROWABLE 0x00000002
665 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
666 #define HEAP_ZERO_MEMORY 0x00000008
667 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
668 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
669 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
670 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
671 #define HEAP_CREATE_ALIGN_16 0x00010000
672 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
673 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000
675 /* This flag allows it to create heaps shared by all processes under win95,
676 FIXME: correct name */
677 #define HEAP_SHARED 0x04000000
679 typedef enum _HEAP_INFORMATION_CLASS {
680 HeapCompatibilityInformation,
681 } HEAP_INFORMATION_CLASS;
683 /* Processor feature flags. */
684 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
685 #define PF_FLOATING_POINT_EMULATED 1
686 #define PF_COMPARE_EXCHANGE_DOUBLE 2
687 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
688 #define PF_PPC_MOVEMEM_64BIT_OK 4
689 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
690 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6
691 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7
692 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8
693 #define PF_PAE_ENABLED 9
694 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10
695 #define PF_NX_ENABLED 12
698 /* Execution state flags */
699 #define ES_SYSTEM_REQUIRED 0x00000001
700 #define ES_DISPLAY_REQUIRED 0x00000002
701 #define ES_USER_PRESENT 0x00000004
702 #define ES_CONTINUOUS 0x80000000
704 /* The Win32 register context */
706 /* CONTEXT is the CPU-dependent context; it should be used */
707 /* wherever a platform-specific context is needed (e.g. exception */
708 /* handling, Win32 register functions). */
710 /* CONTEXT86 is the i386-specific context; it should be used */
711 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
712 /* Win16 register functions), so that this code can be compiled */
713 /* on all platforms. */
715 #define SIZE_OF_80387_REGISTERS 80
717 typedef struct _FLOATING_SAVE_AREA
719 DWORD ControlWord;
720 DWORD StatusWord;
721 DWORD TagWord;
722 DWORD ErrorOffset;
723 DWORD ErrorSelector;
724 DWORD DataOffset;
725 DWORD DataSelector;
726 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
727 DWORD Cr0NpxState;
728 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
730 #define MAXIMUM_SUPPORTED_EXTENSION 512
732 typedef struct _CONTEXT86
734 DWORD ContextFlags;
736 /* These are selected by CONTEXT_DEBUG_REGISTERS */
737 DWORD Dr0;
738 DWORD Dr1;
739 DWORD Dr2;
740 DWORD Dr3;
741 DWORD Dr6;
742 DWORD Dr7;
744 /* These are selected by CONTEXT_FLOATING_POINT */
745 FLOATING_SAVE_AREA FloatSave;
747 /* These are selected by CONTEXT_SEGMENTS */
748 DWORD SegGs;
749 DWORD SegFs;
750 DWORD SegEs;
751 DWORD SegDs;
753 /* These are selected by CONTEXT_INTEGER */
754 DWORD Edi;
755 DWORD Esi;
756 DWORD Ebx;
757 DWORD Edx;
758 DWORD Ecx;
759 DWORD Eax;
761 /* These are selected by CONTEXT_CONTROL */
762 DWORD Ebp;
763 DWORD Eip;
764 DWORD SegCs;
765 DWORD EFlags;
766 DWORD Esp;
767 DWORD SegSs;
769 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION];
770 } CONTEXT86;
772 #define CONTEXT_X86 0x00010000
773 #define CONTEXT_i386 CONTEXT_X86
774 #define CONTEXT_i486 CONTEXT_X86
776 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
777 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
778 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
779 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
780 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
781 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
783 /* i386 context definitions */
784 #ifdef __i386__
786 #define CONTEXT_CONTROL CONTEXT86_CONTROL
787 #define CONTEXT_INTEGER CONTEXT86_INTEGER
788 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
789 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
790 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
791 #define CONTEXT_FULL CONTEXT86_FULL
793 typedef CONTEXT86 CONTEXT;
795 #define EXCEPTION_READ_FAULT 0
796 #define EXCEPTION_WRITE_FAULT 1
797 #define EXCEPTION_EXECUTE_FAULT 8
799 #endif /* __i386__ */
801 typedef struct _LDT_ENTRY {
802 WORD LimitLow;
803 WORD BaseLow;
804 union {
805 struct {
806 BYTE BaseMid;
807 BYTE Flags1;
808 BYTE Flags2;
809 BYTE BaseHi;
810 } Bytes;
811 struct {
812 unsigned BaseMid: 8;
813 unsigned Type : 5;
814 unsigned Dpl : 2;
815 unsigned Pres : 1;
816 unsigned LimitHi : 4;
817 unsigned Sys : 1;
818 unsigned Reserved_0 : 1;
819 unsigned Default_Big : 1;
820 unsigned Granularity : 1;
821 unsigned BaseHi : 8;
822 } Bits;
823 } HighWord;
824 } LDT_ENTRY, *PLDT_ENTRY;
826 /* x86-64 context definitions */
827 #if defined(__x86_64__)
829 #define CONTEXT_AMD64 0x00100000
831 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x0001)
832 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x0002)
833 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x0004)
834 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x0008L)
835 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x0010L)
836 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT)
837 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS)
839 #define EXCEPTION_READ_FAULT 0
840 #define EXCEPTION_WRITE_FAULT 1
841 #define EXCEPTION_EXECUTE_FAULT 8
843 typedef struct DECLSPEC_ALIGN(16) _M128A {
844 ULONGLONG Low;
845 LONGLONG High;
846 } M128A, *PM128A;
848 typedef struct _XMM_SAVE_AREA32 {
849 WORD ControlWord;
850 WORD StatusWord;
851 BYTE TagWord;
852 BYTE Reserved1;
853 WORD ErrorOpcode;
854 DWORD ErrorOffset;
855 WORD ErrorSelector;
856 WORD Reserved2;
857 DWORD DataOffset;
858 WORD DataSelector;
859 WORD Reserved3;
860 DWORD MxCsr;
861 DWORD MxCsr_Mask;
862 M128A FloatRegisters[8];
863 M128A XmmRegisters[16];
864 BYTE Reserved4[96];
865 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32;
867 typedef struct DECLSPEC_ALIGN(16) _CONTEXT {
868 DWORD64 P1Home;
869 DWORD64 P2Home;
870 DWORD64 P3Home;
871 DWORD64 P4Home;
872 DWORD64 P5Home;
873 DWORD64 P6Home;
875 /* Control flags */
876 DWORD ContextFlags;
877 DWORD MxCsr;
879 /* Segment */
880 WORD SegCs;
881 WORD SegDs;
882 WORD SegEs;
883 WORD SegFs;
884 WORD SegGs;
885 WORD SegSs;
886 DWORD EFlags;
888 /* Debug */
889 DWORD64 Dr0;
890 DWORD64 Dr1;
891 DWORD64 Dr2;
892 DWORD64 Dr3;
893 DWORD64 Dr6;
894 DWORD64 Dr7;
896 /* Integer */
897 DWORD64 Rax;
898 DWORD64 Rcx;
899 DWORD64 Rdx;
900 DWORD64 Rbx;
901 DWORD64 Rsp;
902 DWORD64 Rbp;
903 DWORD64 Rsi;
904 DWORD64 Rdi;
905 DWORD64 R8;
906 DWORD64 R9;
907 DWORD64 R10;
908 DWORD64 R11;
909 DWORD64 R12;
910 DWORD64 R13;
911 DWORD64 R14;
912 DWORD64 R15;
914 /* Counter */
915 DWORD64 Rip;
917 /* Floating point */
918 union {
919 XMM_SAVE_AREA32 FltSave;
920 struct {
921 M128A Header[2];
922 M128A Legacy[8];
923 M128A Xmm0;
924 M128A Xmm1;
925 M128A Xmm2;
926 M128A Xmm3;
927 M128A Xmm4;
928 M128A Xmm5;
929 M128A Xmm6;
930 M128A Xmm7;
931 M128A Xmm8;
932 M128A Xmm9;
933 M128A Xmm10;
934 M128A Xmm11;
935 M128A Xmm12;
936 M128A Xmm13;
937 M128A Xmm14;
938 M128A Xmm15;
939 } DUMMYSTRUCTNAME;
940 } DUMMYUNIONNAME;
942 /* Vector */
943 M128A VectorRegister[26];
944 DWORD64 VectorControl;
946 /* Debug control */
947 DWORD64 DebugControl;
948 DWORD64 LastBranchToRip;
949 DWORD64 LastBranchFromRip;
950 DWORD64 LastExceptionToRip;
951 DWORD64 LastExceptionFromRip;
952 } CONTEXT;
954 #endif /* __x86_64__ */
956 /* Alpha context definitions */
957 #if defined(_ALPHA_) || defined(__ALPHA__) || defined(__alpha__)
959 #define CONTEXT_ALPHA 0x00020000
961 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
962 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
963 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
964 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
966 #define EXCEPTION_READ_FAULT 0
967 #define EXCEPTION_WRITE_FAULT 1
968 #define EXCEPTION_EXECUTE_FAULT 8
970 typedef struct _CONTEXT
972 /* selected by CONTEXT_FLOATING_POINT */
973 ULONGLONG FltF0;
974 ULONGLONG FltF1;
975 ULONGLONG FltF2;
976 ULONGLONG FltF3;
977 ULONGLONG FltF4;
978 ULONGLONG FltF5;
979 ULONGLONG FltF6;
980 ULONGLONG FltF7;
981 ULONGLONG FltF8;
982 ULONGLONG FltF9;
983 ULONGLONG FltF10;
984 ULONGLONG FltF11;
985 ULONGLONG FltF12;
986 ULONGLONG FltF13;
987 ULONGLONG FltF14;
988 ULONGLONG FltF15;
989 ULONGLONG FltF16;
990 ULONGLONG FltF17;
991 ULONGLONG FltF18;
992 ULONGLONG FltF19;
993 ULONGLONG FltF20;
994 ULONGLONG FltF21;
995 ULONGLONG FltF22;
996 ULONGLONG FltF23;
997 ULONGLONG FltF24;
998 ULONGLONG FltF25;
999 ULONGLONG FltF26;
1000 ULONGLONG FltF27;
1001 ULONGLONG FltF28;
1002 ULONGLONG FltF29;
1003 ULONGLONG FltF30;
1004 ULONGLONG FltF31;
1006 /* selected by CONTEXT_INTEGER */
1007 ULONGLONG IntV0;
1008 ULONGLONG IntT0;
1009 ULONGLONG IntT1;
1010 ULONGLONG IntT2;
1011 ULONGLONG IntT3;
1012 ULONGLONG IntT4;
1013 ULONGLONG IntT5;
1014 ULONGLONG IntT6;
1015 ULONGLONG IntT7;
1016 ULONGLONG IntS0;
1017 ULONGLONG IntS1;
1018 ULONGLONG IntS2;
1019 ULONGLONG IntS3;
1020 ULONGLONG IntS4;
1021 ULONGLONG IntS5;
1022 ULONGLONG IntFp;
1023 ULONGLONG IntA0;
1024 ULONGLONG IntA1;
1025 ULONGLONG IntA2;
1026 ULONGLONG IntA3;
1027 ULONGLONG IntA4;
1028 ULONGLONG IntA5;
1029 ULONGLONG IntT8;
1030 ULONGLONG IntT9;
1031 ULONGLONG IntT10;
1032 ULONGLONG IntT11;
1033 ULONGLONG IntRa;
1034 ULONGLONG IntT12;
1035 ULONGLONG IntAt;
1036 ULONGLONG IntGp;
1037 ULONGLONG IntSp;
1038 ULONGLONG IntZero;
1040 /* selected by CONTEXT_FLOATING_POINT */
1041 ULONGLONG Fpcr;
1042 ULONGLONG SoftFpcr;
1044 /* selected by CONTEXT_CONTROL */
1045 ULONGLONG Fir;
1046 DWORD Psr;
1047 DWORD ContextFlags;
1048 DWORD Fill[4];
1049 } CONTEXT;
1051 #define _QUAD_PSR_OFFSET HighSoftFpcr
1052 #define _QUAD_FLAGS_OFFSET HighFir
1054 #endif /* _ALPHA_ */
1056 #ifdef __arm__
1058 /* The following flags control the contents of the CONTEXT structure. */
1060 #define CONTEXT_ARM 0x0000040
1061 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L)
1062 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L)
1064 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER)
1066 #define EXCEPTION_READ_FAULT 0
1067 #define EXCEPTION_WRITE_FAULT 1
1068 #define EXCEPTION_EXECUTE_FAULT 8
1070 typedef struct _CONTEXT {
1071 /* The flags values within this flag control the contents of
1072 a CONTEXT record.
1074 If the context record is used as an input parameter, then
1075 for each portion of the context record controlled by a flag
1076 whose value is set, it is assumed that that portion of the
1077 context record contains valid context. If the context record
1078 is being used to modify a thread's context, then only that
1079 portion of the threads context will be modified.
1081 If the context record is used as an IN OUT parameter to capture
1082 the context of a thread, then only those portions of the thread's
1083 context corresponding to set flags will be returned.
1085 The context record is never used as an OUT only parameter. */
1087 ULONG ContextFlags;
1089 /* This section is specified/returned if the ContextFlags word contains
1090 the flag CONTEXT_INTEGER. */
1091 ULONG R0;
1092 ULONG R1;
1093 ULONG R2;
1094 ULONG R3;
1095 ULONG R4;
1096 ULONG R5;
1097 ULONG R6;
1098 ULONG R7;
1099 ULONG R8;
1100 ULONG R9;
1101 ULONG R10;
1102 ULONG R11;
1103 ULONG R12;
1105 ULONG Sp;
1106 ULONG Lr;
1107 ULONG Pc;
1108 ULONG Psr;
1109 } CONTEXT;
1111 #endif /* __arm__ */
1114 /* Mips context definitions */
1115 #ifdef _MIPS_
1117 #define CONTEXT_R4000 0x00010000
1119 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
1120 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
1121 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
1123 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1125 #define EXCEPTION_READ_FAULT 0
1126 #define EXCEPTION_WRITE_FAULT 1
1127 #define EXCEPTION_EXECUTE_FAULT 8
1129 typedef struct _CONTEXT
1131 DWORD Argument[4];
1132 /* These are selected by CONTEXT_FLOATING_POINT */
1133 DWORD FltF0;
1134 DWORD FltF1;
1135 DWORD FltF2;
1136 DWORD FltF3;
1137 DWORD FltF4;
1138 DWORD FltF5;
1139 DWORD FltF6;
1140 DWORD FltF7;
1141 DWORD FltF8;
1142 DWORD FltF9;
1143 DWORD FltF10;
1144 DWORD FltF11;
1145 DWORD FltF12;
1146 DWORD FltF13;
1147 DWORD FltF14;
1148 DWORD FltF15;
1149 DWORD FltF16;
1150 DWORD FltF17;
1151 DWORD FltF18;
1152 DWORD FltF19;
1153 DWORD FltF20;
1154 DWORD FltF21;
1155 DWORD FltF22;
1156 DWORD FltF23;
1157 DWORD FltF24;
1158 DWORD FltF25;
1159 DWORD FltF26;
1160 DWORD FltF27;
1161 DWORD FltF28;
1162 DWORD FltF29;
1163 DWORD FltF30;
1164 DWORD FltF31;
1166 /* These are selected by CONTEXT_INTEGER */
1167 DWORD IntZero;
1168 DWORD IntAt;
1169 DWORD IntV0;
1170 DWORD IntV1;
1171 DWORD IntA0;
1172 DWORD IntA1;
1173 DWORD IntA2;
1174 DWORD IntA3;
1175 DWORD IntT0;
1176 DWORD IntT1;
1177 DWORD IntT2;
1178 DWORD IntT3;
1179 DWORD IntT4;
1180 DWORD IntT5;
1181 DWORD IntT6;
1182 DWORD IntT7;
1183 DWORD IntS0;
1184 DWORD IntS1;
1185 DWORD IntS2;
1186 DWORD IntS3;
1187 DWORD IntS4;
1188 DWORD IntS5;
1189 DWORD IntS6;
1190 DWORD IntS7;
1191 DWORD IntT8;
1192 DWORD IntT9;
1193 DWORD IntK0;
1194 DWORD IntK1;
1195 DWORD IntGp;
1196 DWORD IntSp;
1197 DWORD IntS8;
1198 DWORD IntRa;
1199 DWORD IntLo;
1200 DWORD IntHi;
1202 /* These are selected by CONTEXT_FLOATING_POINT */
1203 DWORD Fsr;
1205 /* These are selected by CONTEXT_CONTROL */
1206 DWORD Fir;
1207 DWORD Psr;
1209 DWORD ContextFlags;
1210 DWORD Fill[2];
1211 } CONTEXT;
1213 #endif /* _MIPS_ */
1215 /* PowerPC context definitions */
1216 #ifdef __powerpc__
1218 #define CONTEXT_CONTROL 0x0001
1219 #define CONTEXT_FLOATING_POINT 0x0002
1220 #define CONTEXT_INTEGER 0x0004
1221 #define CONTEXT_DEBUG_REGISTERS 0x0008
1222 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1224 #define EXCEPTION_READ_FAULT 0
1225 #define EXCEPTION_WRITE_FAULT 1
1226 #define EXCEPTION_EXECUTE_FAULT 8
1228 typedef struct
1230 /* These are selected by CONTEXT_FLOATING_POINT */
1231 double Fpr0;
1232 double Fpr1;
1233 double Fpr2;
1234 double Fpr3;
1235 double Fpr4;
1236 double Fpr5;
1237 double Fpr6;
1238 double Fpr7;
1239 double Fpr8;
1240 double Fpr9;
1241 double Fpr10;
1242 double Fpr11;
1243 double Fpr12;
1244 double Fpr13;
1245 double Fpr14;
1246 double Fpr15;
1247 double Fpr16;
1248 double Fpr17;
1249 double Fpr18;
1250 double Fpr19;
1251 double Fpr20;
1252 double Fpr21;
1253 double Fpr22;
1254 double Fpr23;
1255 double Fpr24;
1256 double Fpr25;
1257 double Fpr26;
1258 double Fpr27;
1259 double Fpr28;
1260 double Fpr29;
1261 double Fpr30;
1262 double Fpr31;
1263 double Fpscr;
1265 /* These are selected by CONTEXT_INTEGER */
1266 DWORD Gpr0;
1267 DWORD Gpr1;
1268 DWORD Gpr2;
1269 DWORD Gpr3;
1270 DWORD Gpr4;
1271 DWORD Gpr5;
1272 DWORD Gpr6;
1273 DWORD Gpr7;
1274 DWORD Gpr8;
1275 DWORD Gpr9;
1276 DWORD Gpr10;
1277 DWORD Gpr11;
1278 DWORD Gpr12;
1279 DWORD Gpr13;
1280 DWORD Gpr14;
1281 DWORD Gpr15;
1282 DWORD Gpr16;
1283 DWORD Gpr17;
1284 DWORD Gpr18;
1285 DWORD Gpr19;
1286 DWORD Gpr20;
1287 DWORD Gpr21;
1288 DWORD Gpr22;
1289 DWORD Gpr23;
1290 DWORD Gpr24;
1291 DWORD Gpr25;
1292 DWORD Gpr26;
1293 DWORD Gpr27;
1294 DWORD Gpr28;
1295 DWORD Gpr29;
1296 DWORD Gpr30;
1297 DWORD Gpr31;
1299 DWORD Cr;
1300 DWORD Xer;
1302 /* These are selected by CONTEXT_CONTROL */
1303 DWORD Msr;
1304 DWORD Iar; /* Instruction Address Register , aka PC ... */
1305 DWORD Lr;
1306 DWORD Ctr;
1308 DWORD ContextFlags;
1310 DWORD Dar; /* Fault registers for coredump */
1311 DWORD Dsisr;
1312 DWORD Trap; /* number of powerpc exception taken */
1314 /* These are selected by CONTEXT_DEBUG_REGISTERS */
1315 DWORD Dr0;
1316 DWORD Dr1;
1317 DWORD Dr2;
1318 DWORD Dr3;
1319 DWORD Dr4;
1320 DWORD Dr5;
1321 DWORD Dr6;
1322 DWORD Dr7;
1323 } CONTEXT;
1325 typedef struct _STACK_FRAME_HEADER
1327 DWORD BackChain;
1328 DWORD GlueSaved1;
1329 DWORD GlueSaved2;
1330 DWORD Reserved1;
1331 DWORD Spare1;
1332 DWORD Spare2;
1334 DWORD Parameter0;
1335 DWORD Parameter1;
1336 DWORD Parameter2;
1337 DWORD Parameter3;
1338 DWORD Parameter4;
1339 DWORD Parameter5;
1340 DWORD Parameter6;
1341 DWORD Parameter7;
1342 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
1344 #endif /* __powerpc__ */
1346 #ifdef __sparc__
1349 * FIXME:
1351 * There is no official CONTEXT structure defined for the SPARC
1352 * architecture, so I just made one up.
1354 * This structure is valid only for 32-bit SPARC architectures,
1355 * not for 64-bit SPARC.
1357 * Note that this structure contains only the 'top-level' registers;
1358 * the rest of the register window chain is not visible.
1360 * The layout follows the Solaris 'prgregset_t' structure.
1364 #define CONTEXT_SPARC 0x10000000
1366 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
1367 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
1368 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
1370 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
1372 #define EXCEPTION_READ_FAULT 0
1373 #define EXCEPTION_WRITE_FAULT 1
1374 #define EXCEPTION_EXECUTE_FAULT 8
1376 typedef struct _CONTEXT
1378 DWORD ContextFlags;
1380 /* These are selected by CONTEXT_INTEGER */
1381 DWORD g0;
1382 DWORD g1;
1383 DWORD g2;
1384 DWORD g3;
1385 DWORD g4;
1386 DWORD g5;
1387 DWORD g6;
1388 DWORD g7;
1389 DWORD o0;
1390 DWORD o1;
1391 DWORD o2;
1392 DWORD o3;
1393 DWORD o4;
1394 DWORD o5;
1395 DWORD o6;
1396 DWORD o7;
1397 DWORD l0;
1398 DWORD l1;
1399 DWORD l2;
1400 DWORD l3;
1401 DWORD l4;
1402 DWORD l5;
1403 DWORD l6;
1404 DWORD l7;
1405 DWORD i0;
1406 DWORD i1;
1407 DWORD i2;
1408 DWORD i3;
1409 DWORD i4;
1410 DWORD i5;
1411 DWORD i6;
1412 DWORD i7;
1414 /* These are selected by CONTEXT_CONTROL */
1415 DWORD psr;
1416 DWORD pc;
1417 DWORD npc;
1418 DWORD y;
1419 DWORD wim;
1420 DWORD tbr;
1422 /* FIXME: floating point registers missing */
1424 } CONTEXT;
1426 #endif /* __sparc__ */
1428 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
1429 #error You need to define a CONTEXT for your CPU
1430 #endif
1432 typedef CONTEXT *PCONTEXT;
1435 * Language IDs
1438 #define MAKELCID(l, s) (MAKELONG(l, s))
1440 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
1441 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
1442 #define SUBLANGID(l) ((WORD)(l) >> 10)
1444 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
1445 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
1447 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
1448 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
1449 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
1450 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
1451 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
1453 #define UNREFERENCED_PARAMETER(u) (u)
1454 #define DBG_UNREFERENCED_PARAMETER(u) (u)
1455 #define DBG_UNREFERENCED_LOCAL_VARIABLE(u) (u)
1457 #define LANG_NEUTRAL 0x00
1458 #define LANG_INVARIANT 0x7f
1460 #define LANG_AFRIKAANS 0x36
1461 #define LANG_ALBANIAN 0x1c
1462 #define LANG_ALSATIAN 0x84
1463 #define LANG_AMHARIC 0x5e
1464 #define LANG_ARABIC 0x01
1465 #define LANG_ARMENIAN 0x2b
1466 #define LANG_ASSAMESE 0x4d
1467 #define LANG_AZERI 0x2c
1468 #define LANG_BASHKIR 0x6d
1469 #define LANG_BASQUE 0x2d
1470 #define LANG_BELARUSIAN 0x23
1471 #define LANG_BENGALI 0x45
1472 #define LANG_BOSNIAN 0x1a
1473 #define LANG_BOSNIAN_NEUTRAL 0x781a
1474 #define LANG_BRETON 0x7e
1475 #define LANG_BULGARIAN 0x02
1476 #define LANG_CATALAN 0x03
1477 #define LANG_CHINESE 0x04
1478 #define LANG_CHINESE_SIMPLIFIED 0x0004
1479 #define LANG_CHINESE_TRADITIONAL 0x7c04
1480 #define LANG_CORSICAN 0x83
1481 #define LANG_CROATIAN 0x1a
1482 #define LANG_CZECH 0x05
1483 #define LANG_DANISH 0x06
1484 #define LANG_DARI 0x8c
1485 #define LANG_DIVEHI 0x65
1486 #define LANG_DUTCH 0x13
1487 #define LANG_ENGLISH 0x09
1488 #define LANG_ESTONIAN 0x25
1489 #define LANG_FAEROESE 0x38
1490 #define LANG_FARSI LANG_PERSIAN
1491 #define LANG_FILIPINO 0x64
1492 #define LANG_FINNISH 0x0b
1493 #define LANG_FRENCH 0x0c
1494 #define LANG_FRISIAN 0x62
1495 #define LANG_GALICIAN 0x56
1496 #define LANG_GEORGIAN 0x37
1497 #define LANG_GERMAN 0x07
1498 #define LANG_GREEK 0x08
1499 #define LANG_GREENLANDIC 0x6f
1500 #define LANG_GUJARATI 0x47
1501 #define LANG_HAUSA 0x68
1502 #define LANG_HEBREW 0x0d
1503 #define LANG_HINDI 0x39
1504 #define LANG_HUNGARIAN 0x0e
1505 #define LANG_ICELANDIC 0x0f
1506 #define LANG_IGBO 0x70
1507 #define LANG_INDONESIAN 0x21
1508 #define LANG_INUKTITUT 0x5d
1509 #define LANG_IRISH 0x3c
1510 #define LANG_ITALIAN 0x10
1511 #define LANG_JAPANESE 0x11
1512 #define LANG_KANNADA 0x4b
1513 #define LANG_KASHMIRI 0x60
1514 #define LANG_KAZAK 0x3f
1515 #define LANG_KHMER 0x53
1516 #define LANG_KICHE 0x86
1517 #define LANG_KINYARWANDA 0x87
1518 #define LANG_KONKANI 0x57
1519 #define LANG_KOREAN 0x12
1520 #define LANG_KYRGYZ 0x40
1521 #define LANG_LAO 0x54
1522 #define LANG_LATVIAN 0x26
1523 #define LANG_LITHUANIAN 0x27
1524 #define LANG_LOWER_SORBIAN 0x2e
1525 #define LANG_LUXEMBOURGISH 0x6e
1526 #define LANG_MACEDONIAN 0x2f
1527 #define LANG_MALAY 0x3e
1528 #define LANG_MALAYALAM 0x4c
1529 #define LANG_MALTESE 0x3a
1530 #define LANG_MANIPURI 0x58
1531 #define LANG_MAORI 0x81
1532 #define LANG_MAPUDUNGUN 0x7a
1533 #define LANG_MARATHI 0x4e
1534 #define LANG_MOHAWK 0x7c
1535 #define LANG_MONGOLIAN 0x50
1536 #define LANG_NEPALI 0x61
1537 #define LANG_NORWEGIAN 0x14
1538 #define LANG_OCCITAN 0x82
1539 #define LANG_ORIYA 0x48
1540 #define LANG_PASHTO 0x63
1541 #define LANG_PERSIAN 0x29
1542 #define LANG_POLISH 0x15
1543 #define LANG_PORTUGUESE 0x16
1544 #define LANG_PUNJABI 0x46
1545 #define LANG_QUECHUA 0x6b
1546 #define LANG_ROMANIAN 0x18
1547 #define LANG_ROMANSH 0x17
1548 #define LANG_RUSSIAN 0x19
1549 #define LANG_SAMI 0x3b
1550 #define LANG_SANSKRIT 0x4f
1551 #define LANG_SERBIAN 0x1a
1552 #define LANG_SERBIAN_NEUTRAL 0x7c1a
1553 #define LANG_SINDHI 0x59
1554 #define LANG_SINHALESE 0x5b
1555 #define LANG_SLOVAK 0x1b
1556 #define LANG_SLOVENIAN 0x24
1557 #define LANG_SOTHO 0x6c
1558 #define LANG_SPANISH 0x0a
1559 #define LANG_SWAHILI 0x41
1560 #define LANG_SWEDISH 0x1d
1561 #define LANG_SYRIAC 0x5a
1562 #define LANG_TAJIK 0x28
1563 #define LANG_TAMAZIGHT 0x5f
1564 #define LANG_TAMIL 0x49
1565 #define LANG_TATAR 0x44
1566 #define LANG_TELUGU 0x4a
1567 #define LANG_THAI 0x1e
1568 #define LANG_TIBETAN 0x51
1569 #define LANG_TIGRIGNA 0x73
1570 #define LANG_TSWANA 0x32
1571 #define LANG_TURKISH 0x1f
1572 #define LANG_TURKMEN 0x42
1573 #define LANG_UIGHUR 0x80
1574 #define LANG_UKRAINIAN 0x22
1575 #define LANG_UPPER_SORBIAN 0x2e
1576 #define LANG_URDU 0x20
1577 #define LANG_UZBEK 0x43
1578 #define LANG_VIETNAMESE 0x2a
1579 #define LANG_WELSH 0x52
1580 #define LANG_WOLOF 0x88
1581 #define LANG_XHOSA 0x34
1582 #define LANG_YAKUT 0x85
1583 #define LANG_YI 0x78
1584 #define LANG_YORUBA 0x6a
1585 #define LANG_ZULU 0x35
1587 /* These are documented by the MSDN but are missing from the Windows header */
1588 #define LANG_MALAGASY 0x8d
1590 /* FIXME: these are not defined anywhere */
1591 #define LANG_SUTU 0x30
1592 #define LANG_TSONGA 0x31
1593 #define LANG_VENDA 0x33
1595 /* non standard; keep the number high enough (but < 0xff) */
1596 #define LANG_ESPERANTO 0x8f
1597 #define LANG_WALON 0x90
1598 #define LANG_CORNISH 0x91
1599 #define LANG_GAELIC 0x94
1601 /* Sublanguage definitions */
1602 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
1603 #define SUBLANG_DEFAULT 0x01 /* user default */
1604 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
1605 #define SUBLANG_CUSTOM_DEFAULT 0x03
1606 #define SUBLANG_CUSTOM_UNSPECIFIED 0x04
1607 #define SUBLANG_UI_CUSTOM_DEFAULT 0x05
1609 #define SUBLANG_AFRIKAANS_SOUTH_AFRICA 0x01
1610 #define SUBLANG_ALBANIAN_ALBANIA 0x01
1611 #define SUBLANG_ALSATIAN_FRANCE 0x01
1612 #define SUBLANG_AMHARIC_ETHIOPIA 0x01
1613 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
1614 #define SUBLANG_ARABIC_IRAQ 0x02
1615 #define SUBLANG_ARABIC_EGYPT 0x03
1616 #define SUBLANG_ARABIC_LIBYA 0x04
1617 #define SUBLANG_ARABIC_ALGERIA 0x05
1618 #define SUBLANG_ARABIC_MOROCCO 0x06
1619 #define SUBLANG_ARABIC_TUNISIA 0x07
1620 #define SUBLANG_ARABIC_OMAN 0x08
1621 #define SUBLANG_ARABIC_YEMEN 0x09
1622 #define SUBLANG_ARABIC_SYRIA 0x0a
1623 #define SUBLANG_ARABIC_JORDAN 0x0b
1624 #define SUBLANG_ARABIC_LEBANON 0x0c
1625 #define SUBLANG_ARABIC_KUWAIT 0x0d
1626 #define SUBLANG_ARABIC_UAE 0x0e
1627 #define SUBLANG_ARABIC_BAHRAIN 0x0f
1628 #define SUBLANG_ARABIC_QATAR 0x10
1629 #define SUBLANG_ARMENIAN_ARMENIA 0x01
1630 #define SUBLANG_ASSAMESE_INDIA 0x01
1631 #define SUBLANG_AZERI_LATIN 0x01
1632 #define SUBLANG_AZERI_CYRILLIC 0x02
1633 #define SUBLANG_BASHKIR_RUSSIA 0x01
1634 #define SUBLANG_BASQUE_BASQUE 0x01
1635 #define SUBLANG_BELARUSIAN_BELARUS 0x01
1636 #define SUBLANG_BENGALI_INDIA 0x01
1637 #define SUBLANG_BENGALI_BANGLADESH 0x02
1638 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN 0x05
1639 #define SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x08
1640 #define SUBLANG_BRETON_FRANCE 0x01
1641 #define SUBLANG_BULGARIAN_BULGARIA 0x01
1642 #define SUBLANG_CATALAN_CATALAN 0x01
1643 #define SUBLANG_CHINESE_TRADITIONAL 0x01
1644 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
1645 #define SUBLANG_CHINESE_HONGKONG 0x03
1646 #define SUBLANG_CHINESE_SINGAPORE 0x04
1647 #define SUBLANG_CHINESE_MACAU 0x05
1648 #define SUBLANG_CORSICAN_FRANCE 0x01
1649 #define SUBLANG_CROATIAN_CROATIA 0x01
1650 #define SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN 0x04
1651 #define SUBLANG_CZECH_CZECH_REPUBLIC 0x01
1652 #define SUBLANG_DANISH_DENMARK 0x01
1653 #define SUBLANG_DARI_AFGHANISTAN 0x01
1654 #define SUBLANG_DIVEHI_MALDIVES 0x01
1655 #define SUBLANG_DUTCH 0x01
1656 #define SUBLANG_DUTCH_BELGIAN 0x02
1657 #define SUBLANG_ENGLISH_US 0x01
1658 #define SUBLANG_ENGLISH_UK 0x02
1659 #define SUBLANG_ENGLISH_AUS 0x03
1660 #define SUBLANG_ENGLISH_CAN 0x04
1661 #define SUBLANG_ENGLISH_NZ 0x05
1662 #define SUBLANG_ENGLISH_EIRE 0x06
1663 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
1664 #define SUBLANG_ENGLISH_JAMAICA 0x08
1665 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
1666 #define SUBLANG_ENGLISH_BELIZE 0x0a
1667 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1668 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1669 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1670 #define SUBLANG_ENGLISH_INDIA 0x10
1671 #define SUBLANG_ENGLISH_MALAYSIA 0x11
1672 #define SUBLANG_ENGLISH_SINGAPORE 0x12
1673 #define SUBLANG_ESTONIAN_ESTONIA 0x01
1674 #define SUBLANG_FAEROESE_FAROE_ISLANDS 0x01
1675 #define SUBLANG_FILIPINO_PHILIPPINES 0x01
1676 #define SUBLANG_FINNISH_FINLAND 0x01
1677 #define SUBLANG_FRENCH 0x01
1678 #define SUBLANG_FRENCH_BELGIAN 0x02
1679 #define SUBLANG_FRENCH_CANADIAN 0x03
1680 #define SUBLANG_FRENCH_SWISS 0x04
1681 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1682 #define SUBLANG_FRENCH_MONACO 0x06
1683 #define SUBLANG_FRISIAN_NETHERLANDS 0x01
1684 #define SUBLANG_GALICIAN_GALICIAN 0x01
1685 #define SUBLANG_GEORGIAN_GEORGIA 0x01
1686 #define SUBLANG_GERMAN 0x01
1687 #define SUBLANG_GERMAN_SWISS 0x02
1688 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1689 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1690 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1691 #define SUBLANG_GREEK_GREECE 0x01
1692 #define SUBLANG_GREENLANDIC_GREENLAND 0x01
1693 #define SUBLANG_GUJARATI_INDIA 0x01
1694 #define SUBLANG_HAUSA_NIGERIA_LATIN 0x01
1695 #define SUBLANG_HEBREW_ISRAEL 0x01
1696 #define SUBLANG_HINDI_INDIA 0x01
1697 #define SUBLANG_HUNGARIAN_HUNGARY 0x01
1698 #define SUBLANG_ICELANDIC_ICELAND 0x01
1699 #define SUBLANG_IGBO_NIGERIA 0x01
1700 #define SUBLANG_INDONESIAN_INDONESIA 0x01
1701 #define SUBLANG_INUKTITUT_CANADA 0x01
1702 #define SUBLANG_INUKTITUT_CANADA_LATIN 0x02
1703 #define SUBLANG_IRISH_IRELAND 0x02
1704 #define SUBLANG_ITALIAN 0x01
1705 #define SUBLANG_ITALIAN_SWISS 0x02
1706 #define SUBLANG_JAPANESE_JAPAN 0x01
1707 #define SUBLANG_KANNADA_INDIA 0x01
1708 #define SUBLANG_KASHMIRI_SASIA 0x02
1709 #define SUBLANG_KASHMIRI_INDIA 0x02
1710 #define SUBLANG_KAZAK_KAZAKHSTAN 0x01
1711 #define SUBLANG_KHMER_CAMBODIA 0x01
1712 #define SUBLANG_KICHE_GUATEMALA 0x01
1713 #define SUBLANG_KINYARWANDA_RWANDA 0X01
1714 #define SUBLANG_KONKANI_INDIA 0x01
1715 #define SUBLANG_KOREAN 0x01
1716 #define SUBLANG_KYRGYZ_KYRGYZSTAN 0x01
1717 #define SUBLANG_LAO_LAO 0x01
1718 #define SUBLANG_LATVIAN_LATVIA 0x01
1719 #define SUBLANG_LITHUANIAN_LITHUANIA 0x01
1720 #define SUBLANG_LOWER_SORBIAN_GERMANY 0x02
1721 #define SUBLANG_LUXEMBOURGISH_LUXEMBOURG 0x01
1722 #define SUBLANG_MACEDONIAN_MACEDONIA 0x01
1723 #define SUBLANG_MALAY_MALAYSIA 0x01
1724 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1725 #define SUBLANG_MALAYALAM_INDIA 0x01
1726 #define SUBLANG_MALTESE_MALTA 0x01
1727 #define SUBLANG_MAORI_NEW_ZEALAND 0x01
1728 #define SUBLANG_MAPUDUNGUN_CHILE 0x01
1729 #define SUBLANG_MARATHI_INDIA 0x01
1730 #define SUBLANG_MOHAWK_MOHAWK 0x01
1731 #define SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA 0x01
1732 #define SUBLANG_MONGOLIAN_PRC 0x02
1733 #define SUBLANG_NEPALI_INDIA 0x02
1734 #define SUBLANG_NEPALI_NEPAL 0x01
1735 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1736 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1737 #define SUBLANG_OCCITAN_FRANCE 0x01
1738 #define SUBLANG_ORIYA_INDIA 0x01
1739 #define SUBLANG_PASHTO_AFGHANISTAN 0x01
1740 #define SUBLANG_PERSIAN_IRAN 0x01
1741 #define SUBLANG_POLISH_POLAND 0x01
1742 #define SUBLANG_PORTUGUESE 0x02
1743 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1744 #define SUBLANG_PUNJABI_INDIA 0x01
1745 #define SUBLANG_QUECHUA_BOLIVIA 0x01
1746 #define SUBLANG_QUECHUA_ECUADOR 0x02
1747 #define SUBLANG_QUECHUA_PERU 0x03
1748 #define SUBLANG_ROMANIAN_ROMANIA 0x01
1749 #define SUBLANG_ROMANSH_SWITZERLAND 0x01
1750 #define SUBLANG_RUSSIAN_RUSSIA 0x01
1751 #define SUBLANG_SAMI_NORTHERN_NORWAY 0x01
1752 #define SUBLANG_SAMI_NORTHERN_SWEDEN 0x02
1753 #define SUBLANG_SAMI_NORTHERN_FINLAND 0x03
1754 #define SUBLANG_SAMI_LULE_NORWAY 0x04
1755 #define SUBLANG_SAMI_LULE_SWEDEN 0x05
1756 #define SUBLANG_SAMI_SOUTHERN_NORWAY 0x06
1757 #define SUBLANG_SAMI_SOUTHERN_SWEDEN 0x07
1758 #define SUBLANG_SAMI_SKOLT_FINLAND 0x08
1759 #define SUBLANG_SAMI_INARI_FINLAND 0x09
1760 #define SUBLANG_SANSKRIT_INDIA 0x01
1761 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN 0x06
1762 #define SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC 0x07
1763 #define SUBLANG_SERBIAN_CROATIA 0x01
1764 #define SUBLANG_SERBIAN_LATIN 0x02
1765 #define SUBLANG_SERBIAN_CYRILLIC 0x03
1766 #define SUBLANG_SINDHI_AFGHANISTAN 0x02
1767 #define SUBLANG_SINHALESE_SRI_LANKA 0x01
1768 #define SUBLANG_SLOVAK_SLOVAKIA 0x01
1769 #define SUBLANG_SLOVENIAN_SLOVENIA 0x01
1770 #define SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA 0x01
1771 #define SUBLANG_SPANISH 0x01
1772 #define SUBLANG_SPANISH_MEXICAN 0x02
1773 #define SUBLANG_SPANISH_MODERN 0x03
1774 #define SUBLANG_SPANISH_GUATEMALA 0x04
1775 #define SUBLANG_SPANISH_COSTA_RICA 0x05
1776 #define SUBLANG_SPANISH_PANAMA 0x06
1777 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
1778 #define SUBLANG_SPANISH_VENEZUELA 0x08
1779 #define SUBLANG_SPANISH_COLOMBIA 0x09
1780 #define SUBLANG_SPANISH_PERU 0x0a
1781 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1782 #define SUBLANG_SPANISH_ECUADOR 0x0c
1783 #define SUBLANG_SPANISH_CHILE 0x0d
1784 #define SUBLANG_SPANISH_URUGUAY 0x0e
1785 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1786 #define SUBLANG_SPANISH_BOLIVIA 0x10
1787 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1788 #define SUBLANG_SPANISH_HONDURAS 0x12
1789 #define SUBLANG_SPANISH_NICARAGUA 0x13
1790 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1791 #define SUBLANG_SPANISH_US 0x15
1792 #define SUBLANG_SWAHILI_KENYA 0x01
1793 #define SUBLANG_SWEDISH 0x01
1794 #define SUBLANG_SWEDISH_FINLAND 0x02
1795 #define SUBLANG_SYRIAC_SYRIA 0x01
1796 #define SUBLANG_TAJIK_TAJIKISTAN 0x01
1797 #define SUBLANG_TAMAZIGHT_ALGERIA_LATIN 0x02
1798 #define SUBLANG_TAMIL_INDIA 0x01
1799 #define SUBLANG_TATAR_RUSSIA 0x01
1800 #define SUBLANG_TELUGU_INDIA 0x01
1801 #define SUBLANG_THAI_THAILAND 0x01
1802 #define SUBLANG_TIBETAN_PRC 0x01
1803 #define SUBLANG_TIBETAN_BHUTAN 0x02
1804 #define SUBLANG_TIGRIGNA_ERITREA 0x02
1805 #define SUBLANG_TSWANA_SOUTH_AFRICA 0x01
1806 #define SUBLANG_TURKISH_TURKEY 0x01
1807 #define SUBLANG_TURKMEN_TURKMENISTAN 0x01
1808 #define SUBLANG_UIGHUR_PRC 0x01
1809 #define SUBLANG_UKRAINIAN_UKRAINE 0x01
1810 #define SUBLANG_UPPER_SORBIAN_GERMANY 0x01
1811 #define SUBLANG_URDU_PAKISTAN 0x01
1812 #define SUBLANG_URDU_INDIA 0x02
1813 #define SUBLANG_UZBEK_LATIN 0x01
1814 #define SUBLANG_UZBEK_CYRILLIC 0x02
1815 #define SUBLANG_VIETNAMESE_VIETNAM 0x01
1816 #define SUBLANG_WELSH_UNITED_KINGDOM 0x01
1817 #define SUBLANG_WOLOF_SENEGAL 0x01
1818 #define SUBLANG_XHOSA_SOUTH_AFRICA 0x01
1819 #define SUBLANG_YAKUT_RUSSIA 0x01
1820 #define SUBLANG_YI_PRC 0x01
1821 #define SUBLANG_YORUBA_NIGERIA 0x01
1822 #define SUBLANG_ZULU_SOUTH_AFRICA 0x01
1824 /* These are documented by the MSDN but are missing from the Windows header */
1825 #define SUBLANG_ENGLISH_IRELAND SUBLANG_ENGLISH_EIRE
1826 #define SUBLANG_HAUSA_NIGERIA SUBLANG_HAUSA_NIGERIA_LATIN
1827 #define SUBLANG_LAO_LAO_PDR SUBLANG_LAO_LAO
1828 #define SUBLANG_LITHUANIAN SUBLANG_LITHUANIAN_LITHUANIA
1829 #define SUBLANG_PORTUGUESE_PORTUGAL SUBLANG_PORTUGUESE
1830 #define SUBLANG_SWAHILI SUBLANG_SWAHILI_KENYA
1831 #define SUBLANG_SWEDISH_SWEDEN SUBLANG_SWEDISH
1832 #define SUBLANG_SYRIAC SUBLANG_SYRIAC_SYRIA
1834 /* FIXME: these are not defined anywhere */
1835 #define SUBLANG_DUTCH_SURINAM 0x03
1836 #define SUBLANG_ROMANIAN SUBLANG_ROMANIAN_ROMANIA
1837 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1838 #define SUBLANG_RUSSIAN SUBLANG_RUSSIAN_RUSSIA
1839 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1840 #define SUBLANG_CROATIAN SUBLANG_CROATIAN_CROATIA
1841 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1842 #define SUBLANG_GAELIC 0x01
1843 #define SUBLANG_GAELIC_SCOTTISH 0x02
1844 #define SUBLANG_GAELIC_MANX 0x03
1848 * Sort definitions
1851 #define SORT_DEFAULT 0x0
1852 #define SORT_JAPANESE_XJIS 0x0
1853 #define SORT_JAPANESE_UNICODE 0x1
1854 #define SORT_CHINESE_BIG5 0x0
1855 #define SORT_CHINESE_UNICODE 0x1
1856 #define SORT_KOREAN_KSC 0x0
1857 #define SORT_KOREAN_UNICODE 0x1
1862 * Definitions for IsTextUnicode()
1865 #define IS_TEXT_UNICODE_ASCII16 0x0001
1866 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1867 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1868 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1869 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1870 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1871 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1872 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1873 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1874 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1875 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1876 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1877 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1878 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1879 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1880 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1882 #define MAXIMUM_WAIT_OBJECTS 64
1883 #define MAXIMUM_SUSPEND_COUNT 127
1885 #define WT_EXECUTEDEFAULT 0x00
1886 #define WT_EXECUTEINIOTHREAD 0x01
1887 #define WT_EXECUTEINUITHREAD 0x02
1888 #define WT_EXECUTEINWAITTHREAD 0x04
1889 #define WT_EXECUTEONLYONCE 0x08
1890 #define WT_EXECUTELONGFUNCTION 0x10
1891 #define WT_EXECUTEINTIMERTHREAD 0x20
1892 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x40
1893 #define WT_EXECUTEINPERSISTENTTHREAD 0x80
1894 #define WT_EXECUTEINLONGTHREAD 0x10
1895 #define WT_EXECUTEDELETEWAIT 0x08
1899 * From OS/2 2.0 exception handling
1900 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1903 #define EH_NONCONTINUABLE 0x01
1904 #define EH_UNWINDING 0x02
1905 #define EH_EXIT_UNWIND 0x04
1906 #define EH_STACK_INVALID 0x08
1907 #define EH_NESTED_CALL 0x10
1909 #define EXCEPTION_CONTINUABLE 0
1910 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1913 * The exception record used by Win32 to give additional information
1914 * about exception to exception handlers.
1917 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1919 typedef struct _EXCEPTION_RECORD
1921 DWORD ExceptionCode;
1922 DWORD ExceptionFlags;
1923 struct _EXCEPTION_RECORD *ExceptionRecord;
1925 PVOID ExceptionAddress;
1926 DWORD NumberParameters;
1927 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1928 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1931 * The exception pointers structure passed to exception filters
1932 * in except() and the UnhandledExceptionFilter().
1935 typedef struct _EXCEPTION_POINTERS
1937 PEXCEPTION_RECORD ExceptionRecord;
1938 PCONTEXT ContextRecord;
1939 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1943 * The exception frame, used for registering exception handlers
1944 * Win32 cares only about this, but compilers generally emit
1945 * larger exception frames for their own use.
1948 struct _EXCEPTION_REGISTRATION_RECORD;
1950 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct _EXCEPTION_REGISTRATION_RECORD*,
1951 PCONTEXT,struct _EXCEPTION_REGISTRATION_RECORD **);
1953 typedef struct _EXCEPTION_REGISTRATION_RECORD
1955 struct _EXCEPTION_REGISTRATION_RECORD *Prev;
1956 PEXCEPTION_HANDLER Handler;
1957 } EXCEPTION_REGISTRATION_RECORD;
1960 * function pointer to an exception filter
1963 typedef LONG (CALLBACK *PVECTORED_EXCEPTION_HANDLER)(PEXCEPTION_POINTERS ExceptionInfo);
1965 typedef struct _NT_TIB
1967 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1968 PVOID StackBase;
1969 PVOID StackLimit;
1970 PVOID SubSystemTib;
1971 union {
1972 PVOID FiberData;
1973 DWORD Version;
1974 } DUMMYUNIONNAME;
1975 PVOID ArbitraryUserPointer;
1976 struct _NT_TIB *Self;
1977 } NT_TIB, *PNT_TIB;
1979 struct _TEB;
1981 #if defined(__i386__) && defined(__GNUC__)
1982 extern inline struct _TEB * WINAPI NtCurrentTeb(void);
1983 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1985 struct _TEB *teb;
1986 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1987 return teb;
1989 #elif defined(__i386__) && defined(_MSC_VER)
1990 extern inline struct _TEB * WINAPI NtCurrentTeb(void)
1992 struct _TEB *teb;
1993 __asm mov eax, fs:[0x18];
1994 __asm mov teb, eax;
1995 return teb;
1997 #else
1998 extern struct _TEB * WINAPI NtCurrentTeb(void);
1999 #endif
2001 #ifdef NONAMELESSUNION
2002 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->u.FiberData)
2003 #else
2004 #define GetCurrentFiber() (((NT_TIB *)NtCurrentTeb())->FiberData)
2005 #endif
2006 #define GetFiberData() (*(void **)GetCurrentFiber())
2008 #define TLS_MINIMUM_AVAILABLE 64
2011 * File formats definitions
2014 #include <pshpack2.h>
2015 typedef struct _IMAGE_DOS_HEADER {
2016 WORD e_magic; /* 00: MZ Header signature */
2017 WORD e_cblp; /* 02: Bytes on last page of file */
2018 WORD e_cp; /* 04: Pages in file */
2019 WORD e_crlc; /* 06: Relocations */
2020 WORD e_cparhdr; /* 08: Size of header in paragraphs */
2021 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
2022 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
2023 WORD e_ss; /* 0e: Initial (relative) SS value */
2024 WORD e_sp; /* 10: Initial SP value */
2025 WORD e_csum; /* 12: Checksum */
2026 WORD e_ip; /* 14: Initial IP value */
2027 WORD e_cs; /* 16: Initial (relative) CS value */
2028 WORD e_lfarlc; /* 18: File address of relocation table */
2029 WORD e_ovno; /* 1a: Overlay number */
2030 WORD e_res[4]; /* 1c: Reserved words */
2031 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
2032 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
2033 WORD e_res2[10]; /* 28: Reserved words */
2034 DWORD e_lfanew; /* 3c: Offset to extended header */
2035 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
2036 #include <poppack.h>
2038 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
2039 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
2040 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
2041 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
2042 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
2043 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
2046 * This is the Windows executable (NE) header.
2047 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
2049 #include <pshpack2.h>
2050 typedef struct
2052 WORD ne_magic; /* 00 NE signature 'NE' */
2053 BYTE ne_ver; /* 02 Linker version number */
2054 BYTE ne_rev; /* 03 Linker revision number */
2055 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
2056 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
2057 LONG ne_crc; /* 08 Checksum */
2058 WORD ne_flags; /* 0c Flags about segments in this file */
2059 WORD ne_autodata; /* 0e Automatic data segment number */
2060 WORD ne_heap; /* 10 Initial size of local heap */
2061 WORD ne_stack; /* 12 Initial size of stack */
2062 DWORD ne_csip; /* 14 Initial CS:IP */
2063 DWORD ne_sssp; /* 18 Initial SS:SP */
2064 WORD ne_cseg; /* 1c # of entries in segment table */
2065 WORD ne_cmod; /* 1e # of entries in module reference tab. */
2066 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
2067 WORD ne_segtab; /* 22 Offset to segment table */
2068 WORD ne_rsrctab; /* 24 Offset to resource table */
2069 WORD ne_restab; /* 26 Offset to resident-name table */
2070 WORD ne_modtab; /* 28 Offset to module reference table */
2071 WORD ne_imptab; /* 2a Offset to imported name table */
2072 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
2073 WORD ne_cmovent; /* 30 # of movable entry points */
2074 WORD ne_align; /* 32 Logical sector alignment shift count */
2075 WORD ne_cres; /* 34 # of resource segments */
2076 BYTE ne_exetyp; /* 36 Flags indicating target OS */
2077 BYTE ne_flagsothers; /* 37 Additional information flags */
2078 WORD ne_pretthunks; /* 38 Offset to return thunks */
2079 WORD ne_psegrefbytes; /* 3a Offset to segment ref. bytes */
2080 WORD ne_swaparea; /* 3c Reserved by Microsoft */
2081 WORD ne_expver; /* 3e Expected Windows version number */
2082 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER;
2083 #include <poppack.h>
2085 #include <pshpack2.h>
2086 typedef struct _IMAGE_VXD_HEADER {
2087 WORD e32_magic;
2088 BYTE e32_border;
2089 BYTE e32_worder;
2090 DWORD e32_level;
2091 WORD e32_cpu;
2092 WORD e32_os;
2093 DWORD e32_ver;
2094 DWORD e32_mflags;
2095 DWORD e32_mpages;
2096 DWORD e32_startobj;
2097 DWORD e32_eip;
2098 DWORD e32_stackobj;
2099 DWORD e32_esp;
2100 DWORD e32_pagesize;
2101 DWORD e32_lastpagesize;
2102 DWORD e32_fixupsize;
2103 DWORD e32_fixupsum;
2104 DWORD e32_ldrsize;
2105 DWORD e32_ldrsum;
2106 DWORD e32_objtab;
2107 DWORD e32_objcnt;
2108 DWORD e32_objmap;
2109 DWORD e32_itermap;
2110 DWORD e32_rsrctab;
2111 DWORD e32_rsrccnt;
2112 DWORD e32_restab;
2113 DWORD e32_enttab;
2114 DWORD e32_dirtab;
2115 DWORD e32_dircnt;
2116 DWORD e32_fpagetab;
2117 DWORD e32_frectab;
2118 DWORD e32_impmod;
2119 DWORD e32_impmodcnt;
2120 DWORD e32_impproc;
2121 DWORD e32_pagesum;
2122 DWORD e32_datapage;
2123 DWORD e32_preload;
2124 DWORD e32_nrestab;
2125 DWORD e32_cbnrestab;
2126 DWORD e32_nressum;
2127 DWORD e32_autodata;
2128 DWORD e32_debuginfo;
2129 DWORD e32_debuglen;
2130 DWORD e32_instpreload;
2131 DWORD e32_instdemand;
2132 DWORD e32_heapsize;
2133 BYTE e32_res3[12];
2134 DWORD e32_winresoff;
2135 DWORD e32_winreslen;
2136 WORD e32_devid;
2137 WORD e32_ddkver;
2138 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
2139 #include <poppack.h>
2141 /* These defines describe the meanings of the bits in the Characteristics
2142 field */
2144 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
2145 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
2146 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
2147 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
2148 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 0x0010
2149 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 0x0020
2150 #define IMAGE_FILE_16BIT_MACHINE 0x0040
2151 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
2152 #define IMAGE_FILE_32BIT_MACHINE 0x0100
2153 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
2154 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 0x0400
2155 #define IMAGE_FILE_NET_RUN_FROM_SWAP 0x0800
2156 #define IMAGE_FILE_SYSTEM 0x1000
2157 #define IMAGE_FILE_DLL 0x2000
2158 #define IMAGE_FILE_UP_SYSTEM_ONLY 0x4000
2159 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
2161 /* These are the settings of the Machine field. */
2162 #define IMAGE_FILE_MACHINE_UNKNOWN 0
2163 #define IMAGE_FILE_MACHINE_I860 0x014d
2164 #define IMAGE_FILE_MACHINE_I386 0x014c
2165 #define IMAGE_FILE_MACHINE_R3000 0x0162
2166 #define IMAGE_FILE_MACHINE_R4000 0x0166
2167 #define IMAGE_FILE_MACHINE_R10000 0x0168
2168 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x0169
2169 #define IMAGE_FILE_MACHINE_ALPHA 0x0184
2170 #define IMAGE_FILE_MACHINE_SH3 0x01a2
2171 #define IMAGE_FILE_MACHINE_SH3DSP 0x01a3
2172 #define IMAGE_FILE_MACHINE_SH3E 0x01a4
2173 #define IMAGE_FILE_MACHINE_SH4 0x01a6
2174 #define IMAGE_FILE_MACHINE_SH5 0x01a8
2175 #define IMAGE_FILE_MACHINE_ARM 0x01c0
2176 #define IMAGE_FILE_MACHINE_THUMB 0x01c2
2177 #define IMAGE_FILE_MACHINE_AM33 0x01d3
2178 #define IMAGE_FILE_MACHINE_POWERPC 0x01f0
2179 #define IMAGE_FILE_MACHINE_POWERPCFP 0x01f1
2180 #define IMAGE_FILE_MACHINE_IA64 0x0200
2181 #define IMAGE_FILE_MACHINE_MIPS16 0x0266
2182 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284
2183 #define IMAGE_FILE_MACHINE_MIPSFPU 0x0366
2184 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x0466
2185 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64
2186 #define IMAGE_FILE_MACHINE_TRICORE 0x0520
2187 #define IMAGE_FILE_MACHINE_CEF 0x0cef
2188 #define IMAGE_FILE_MACHINE_EBC 0x0ebc
2189 #define IMAGE_FILE_MACHINE_AMD64 0x8664
2190 #define IMAGE_FILE_MACHINE_M32R 0x9041
2191 #define IMAGE_FILE_MACHINE_CEE 0xc0ee
2193 #define IMAGE_SIZEOF_FILE_HEADER 20
2194 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56
2195 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28
2196 #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER 224
2197 #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER 240
2198 #define IMAGE_SIZEOF_SHORT_NAME 8
2199 #define IMAGE_SIZEOF_SECTION_HEADER 40
2200 #define IMAGE_SIZEOF_SYMBOL 18
2201 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2202 #define IMAGE_SIZEOF_RELOCATION 10
2203 #define IMAGE_SIZEOF_BASE_RELOCATION 8
2204 #define IMAGE_SIZEOF_LINENUMBER 6
2205 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2207 /* Possible Magic values */
2208 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b
2209 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
2210 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
2212 #ifdef _WIN64
2213 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
2214 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC
2215 #else
2216 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
2217 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC
2218 #endif
2220 /* These are indexes into the DataDirectory array */
2221 #define IMAGE_FILE_EXPORT_DIRECTORY 0
2222 #define IMAGE_FILE_IMPORT_DIRECTORY 1
2223 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
2224 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
2225 #define IMAGE_FILE_SECURITY_DIRECTORY 4
2226 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
2227 #define IMAGE_FILE_DEBUG_DIRECTORY 6
2228 #define IMAGE_FILE_DESCRIPTION_STRING 7
2229 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
2230 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
2231 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
2233 /* Directory Entries, indices into the DataDirectory array */
2235 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
2236 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
2237 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
2238 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
2239 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
2240 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
2241 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
2242 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
2243 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
2244 #define IMAGE_DIRECTORY_ENTRY_TLS 9
2245 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
2246 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
2247 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
2248 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
2249 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
2251 /* Subsystem Values */
2253 #define IMAGE_SUBSYSTEM_UNKNOWN 0
2254 #define IMAGE_SUBSYSTEM_NATIVE 1
2255 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
2256 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem */
2257 #define IMAGE_SUBSYSTEM_OS2_CUI 5
2258 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
2259 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 /* native Win9x driver */
2260 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 /* Windows CE subsystem */
2261 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10
2262 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11
2263 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12
2264 #define IMAGE_SUBSYSTEM_EFI_ROM 13
2265 #define IMAGE_SUBSYSTEM_XBOX 14
2267 /* DLL Characteristics */
2268 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040
2269 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080
2270 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100
2271 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200
2272 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400
2273 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800
2274 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000
2275 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000
2277 typedef struct _IMAGE_FILE_HEADER {
2278 WORD Machine;
2279 WORD NumberOfSections;
2280 DWORD TimeDateStamp;
2281 DWORD PointerToSymbolTable;
2282 DWORD NumberOfSymbols;
2283 WORD SizeOfOptionalHeader;
2284 WORD Characteristics;
2285 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
2287 typedef struct _IMAGE_DATA_DIRECTORY {
2288 DWORD VirtualAddress;
2289 DWORD Size;
2290 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
2292 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
2294 typedef struct _IMAGE_OPTIONAL_HEADER64 {
2295 WORD Magic; /* 0x20b */
2296 BYTE MajorLinkerVersion;
2297 BYTE MinorLinkerVersion;
2298 DWORD SizeOfCode;
2299 DWORD SizeOfInitializedData;
2300 DWORD SizeOfUninitializedData;
2301 DWORD AddressOfEntryPoint;
2302 DWORD BaseOfCode;
2303 ULONGLONG ImageBase;
2304 DWORD SectionAlignment;
2305 DWORD FileAlignment;
2306 WORD MajorOperatingSystemVersion;
2307 WORD MinorOperatingSystemVersion;
2308 WORD MajorImageVersion;
2309 WORD MinorImageVersion;
2310 WORD MajorSubsystemVersion;
2311 WORD MinorSubsystemVersion;
2312 DWORD Win32VersionValue;
2313 DWORD SizeOfImage;
2314 DWORD SizeOfHeaders;
2315 DWORD CheckSum;
2316 WORD Subsystem;
2317 WORD DllCharacteristics;
2318 ULONGLONG SizeOfStackReserve;
2319 ULONGLONG SizeOfStackCommit;
2320 ULONGLONG SizeOfHeapReserve;
2321 ULONGLONG SizeOfHeapCommit;
2322 DWORD LoaderFlags;
2323 DWORD NumberOfRvaAndSizes;
2324 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
2325 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64;
2327 typedef struct _IMAGE_NT_HEADERS64 {
2328 DWORD Signature;
2329 IMAGE_FILE_HEADER FileHeader;
2330 IMAGE_OPTIONAL_HEADER64 OptionalHeader;
2331 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64;
2333 typedef struct _IMAGE_OPTIONAL_HEADER {
2335 /* Standard fields */
2337 WORD Magic; /* 0x10b or 0x107 */ /* 0x00 */
2338 BYTE MajorLinkerVersion;
2339 BYTE MinorLinkerVersion;
2340 DWORD SizeOfCode;
2341 DWORD SizeOfInitializedData;
2342 DWORD SizeOfUninitializedData;
2343 DWORD AddressOfEntryPoint; /* 0x10 */
2344 DWORD BaseOfCode;
2345 DWORD BaseOfData;
2347 /* NT additional fields */
2349 DWORD ImageBase;
2350 DWORD SectionAlignment; /* 0x20 */
2351 DWORD FileAlignment;
2352 WORD MajorOperatingSystemVersion;
2353 WORD MinorOperatingSystemVersion;
2354 WORD MajorImageVersion;
2355 WORD MinorImageVersion;
2356 WORD MajorSubsystemVersion; /* 0x30 */
2357 WORD MinorSubsystemVersion;
2358 DWORD Win32VersionValue;
2359 DWORD SizeOfImage;
2360 DWORD SizeOfHeaders;
2361 DWORD CheckSum; /* 0x40 */
2362 WORD Subsystem;
2363 WORD DllCharacteristics;
2364 DWORD SizeOfStackReserve;
2365 DWORD SizeOfStackCommit;
2366 DWORD SizeOfHeapReserve; /* 0x50 */
2367 DWORD SizeOfHeapCommit;
2368 DWORD LoaderFlags;
2369 DWORD NumberOfRvaAndSizes;
2370 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; /* 0x60 */
2371 /* 0xE0 */
2372 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32;
2374 typedef struct _IMAGE_NT_HEADERS {
2375 DWORD Signature; /* "PE"\0\0 */ /* 0x00 */
2376 IMAGE_FILE_HEADER FileHeader; /* 0x04 */
2377 IMAGE_OPTIONAL_HEADER32 OptionalHeader; /* 0x18 */
2378 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32;
2380 #ifdef _WIN64
2381 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS;
2382 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS;
2383 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER;
2384 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER;
2385 #else
2386 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS;
2387 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS;
2388 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER;
2389 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER;
2390 #endif
2392 #define IMAGE_SIZEOF_SHORT_NAME 8
2394 typedef struct _IMAGE_SECTION_HEADER {
2395 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
2396 union {
2397 DWORD PhysicalAddress;
2398 DWORD VirtualSize;
2399 } Misc;
2400 DWORD VirtualAddress;
2401 DWORD SizeOfRawData;
2402 DWORD PointerToRawData;
2403 DWORD PointerToRelocations;
2404 DWORD PointerToLinenumbers;
2405 WORD NumberOfRelocations;
2406 WORD NumberOfLinenumbers;
2407 DWORD Characteristics;
2408 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
2410 #define IMAGE_SIZEOF_SECTION_HEADER 40
2412 #define IMAGE_FIRST_SECTION(ntheader) \
2413 ((PIMAGE_SECTION_HEADER)(ULONG_PTR)((const BYTE *)&((const IMAGE_NT_HEADERS *)(ntheader))->OptionalHeader + \
2414 ((const IMAGE_NT_HEADERS *)(ntheader))->FileHeader.SizeOfOptionalHeader))
2416 /* These defines are for the Characteristics bitfield. */
2417 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
2418 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
2419 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
2420 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
2421 #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 /* Reserved */
2422 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
2424 #define IMAGE_SCN_CNT_CODE 0x00000020
2425 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
2426 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
2428 #define IMAGE_SCN_LNK_OTHER 0x00000100
2429 #define IMAGE_SCN_LNK_INFO 0x00000200
2430 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
2431 #define IMAGE_SCN_LNK_REMOVE 0x00000800
2432 #define IMAGE_SCN_LNK_COMDAT 0x00001000
2434 /* 0x00002000 - Reserved */
2435 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
2436 #define IMAGE_SCN_MEM_FARDATA 0x00008000
2438 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
2439 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
2440 #define IMAGE_SCN_MEM_16BIT 0x00020000
2441 #define IMAGE_SCN_MEM_LOCKED 0x00040000
2442 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
2444 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
2445 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
2446 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
2447 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
2448 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
2449 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
2450 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
2451 #define IMAGE_SCN_ALIGN_128BYTES 0x00800000
2452 #define IMAGE_SCN_ALIGN_256BYTES 0x00900000
2453 #define IMAGE_SCN_ALIGN_512BYTES 0x00A00000
2454 #define IMAGE_SCN_ALIGN_1024BYTES 0x00B00000
2455 #define IMAGE_SCN_ALIGN_2048BYTES 0x00C00000
2456 #define IMAGE_SCN_ALIGN_4096BYTES 0x00D00000
2457 #define IMAGE_SCN_ALIGN_8192BYTES 0x00E00000
2458 /* 0x00F00000 - Unused */
2459 #define IMAGE_SCN_ALIGN_MASK 0x00F00000
2461 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
2464 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
2465 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
2466 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
2467 #define IMAGE_SCN_MEM_SHARED 0x10000000
2468 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
2469 #define IMAGE_SCN_MEM_READ 0x40000000
2470 #define IMAGE_SCN_MEM_WRITE 0x80000000
2472 #include <pshpack2.h>
2474 typedef struct _IMAGE_SYMBOL {
2475 union {
2476 BYTE ShortName[8];
2477 struct {
2478 DWORD Short;
2479 DWORD Long;
2480 } Name;
2481 DWORD LongName[2];
2482 } N;
2483 DWORD Value;
2484 SHORT SectionNumber;
2485 WORD Type;
2486 BYTE StorageClass;
2487 BYTE NumberOfAuxSymbols;
2488 } IMAGE_SYMBOL;
2489 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
2491 #define IMAGE_SIZEOF_SYMBOL 18
2493 typedef struct _IMAGE_LINENUMBER {
2494 union {
2495 DWORD SymbolTableIndex;
2496 DWORD VirtualAddress;
2497 } Type;
2498 WORD Linenumber;
2499 } IMAGE_LINENUMBER;
2500 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
2502 #define IMAGE_SIZEOF_LINENUMBER 6
2504 typedef union _IMAGE_AUX_SYMBOL {
2505 struct {
2506 DWORD TagIndex;
2507 union {
2508 struct {
2509 WORD Linenumber;
2510 WORD Size;
2511 } LnSz;
2512 DWORD TotalSize;
2513 } Misc;
2514 union {
2515 struct {
2516 DWORD PointerToLinenumber;
2517 DWORD PointerToNextFunction;
2518 } Function;
2519 struct {
2520 WORD Dimension[4];
2521 } Array;
2522 } FcnAry;
2523 WORD TvIndex;
2524 } Sym;
2525 struct {
2526 BYTE Name[IMAGE_SIZEOF_SYMBOL];
2527 } File;
2528 struct {
2529 DWORD Length;
2530 WORD NumberOfRelocations;
2531 WORD NumberOfLinenumbers;
2532 DWORD CheckSum;
2533 SHORT Number;
2534 BYTE Selection;
2535 } Section;
2536 } IMAGE_AUX_SYMBOL;
2537 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
2539 #define IMAGE_SIZEOF_AUX_SYMBOL 18
2541 #include <poppack.h>
2543 #define IMAGE_SYM_UNDEFINED (SHORT)0
2544 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
2545 #define IMAGE_SYM_DEBUG (SHORT)-2
2547 #define IMAGE_SYM_TYPE_NULL 0x0000
2548 #define IMAGE_SYM_TYPE_VOID 0x0001
2549 #define IMAGE_SYM_TYPE_CHAR 0x0002
2550 #define IMAGE_SYM_TYPE_SHORT 0x0003
2551 #define IMAGE_SYM_TYPE_INT 0x0004
2552 #define IMAGE_SYM_TYPE_LONG 0x0005
2553 #define IMAGE_SYM_TYPE_FLOAT 0x0006
2554 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
2555 #define IMAGE_SYM_TYPE_STRUCT 0x0008
2556 #define IMAGE_SYM_TYPE_UNION 0x0009
2557 #define IMAGE_SYM_TYPE_ENUM 0x000A
2558 #define IMAGE_SYM_TYPE_MOE 0x000B
2559 #define IMAGE_SYM_TYPE_BYTE 0x000C
2560 #define IMAGE_SYM_TYPE_WORD 0x000D
2561 #define IMAGE_SYM_TYPE_UINT 0x000E
2562 #define IMAGE_SYM_TYPE_DWORD 0x000F
2563 #define IMAGE_SYM_TYPE_PCODE 0x8000
2565 #define IMAGE_SYM_DTYPE_NULL 0
2566 #define IMAGE_SYM_DTYPE_POINTER 1
2567 #define IMAGE_SYM_DTYPE_FUNCTION 2
2568 #define IMAGE_SYM_DTYPE_ARRAY 3
2570 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
2571 #define IMAGE_SYM_CLASS_NULL 0x0000
2572 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
2573 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
2574 #define IMAGE_SYM_CLASS_STATIC 0x0003
2575 #define IMAGE_SYM_CLASS_REGISTER 0x0004
2576 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
2577 #define IMAGE_SYM_CLASS_LABEL 0x0006
2578 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
2579 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
2580 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
2581 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
2582 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
2583 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
2584 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
2585 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
2586 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
2587 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
2588 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
2589 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
2591 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
2592 #define IMAGE_SYM_CLASS_BLOCK 0x0064
2593 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
2594 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
2595 #define IMAGE_SYM_CLASS_FILE 0x0067
2596 #define IMAGE_SYM_CLASS_SECTION 0x0068
2597 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
2599 #define N_BTMASK 0x000F
2600 #define N_TMASK 0x0030
2601 #define N_TMASK1 0x00C0
2602 #define N_TMASK2 0x00F0
2603 #define N_BTSHFT 4
2604 #define N_TSHIFT 2
2606 #define BTYPE(x) ((x) & N_BTMASK)
2608 #ifndef ISPTR
2609 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
2610 #endif
2612 #ifndef ISFCN
2613 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
2614 #endif
2616 #ifndef ISARY
2617 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
2618 #endif
2620 #ifndef ISTAG
2621 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
2622 #endif
2624 #ifndef INCREF
2625 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
2626 #endif
2627 #ifndef DECREF
2628 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
2629 #endif
2631 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
2632 #define IMAGE_COMDAT_SELECT_ANY 2
2633 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
2634 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
2635 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
2636 #define IMAGE_COMDAT_SELECT_LARGEST 6
2637 #define IMAGE_COMDAT_SELECT_NEWEST 7
2639 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
2640 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
2641 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
2643 /* Export module directory */
2645 typedef struct _IMAGE_EXPORT_DIRECTORY {
2646 DWORD Characteristics;
2647 DWORD TimeDateStamp;
2648 WORD MajorVersion;
2649 WORD MinorVersion;
2650 DWORD Name;
2651 DWORD Base;
2652 DWORD NumberOfFunctions;
2653 DWORD NumberOfNames;
2654 DWORD AddressOfFunctions;
2655 DWORD AddressOfNames;
2656 DWORD AddressOfNameOrdinals;
2657 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
2659 /* Import name entry */
2660 typedef struct _IMAGE_IMPORT_BY_NAME {
2661 WORD Hint;
2662 BYTE Name[1];
2663 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
2665 #include <pshpack8.h>
2666 /* Import thunk */
2667 typedef struct _IMAGE_THUNK_DATA64 {
2668 union {
2669 ULONGLONG ForwarderString;
2670 ULONGLONG Function;
2671 ULONGLONG Ordinal;
2672 ULONGLONG AddressOfData;
2673 } u1;
2674 } IMAGE_THUNK_DATA64,*PIMAGE_THUNK_DATA64;
2675 #include <poppack.h>
2677 typedef struct _IMAGE_THUNK_DATA32 {
2678 union {
2679 DWORD ForwarderString;
2680 DWORD Function;
2681 DWORD Ordinal;
2682 DWORD AddressOfData;
2683 } u1;
2684 } IMAGE_THUNK_DATA32,*PIMAGE_THUNK_DATA32;
2686 /* Import module directory */
2688 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
2689 union {
2690 DWORD Characteristics; /* 0 for terminating null import descriptor */
2691 DWORD OriginalFirstThunk; /* RVA to original unbound IAT */
2692 } DUMMYUNIONNAME;
2693 DWORD TimeDateStamp; /* 0 if not bound,
2694 * -1 if bound, and real date\time stamp
2695 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
2696 * (new BIND)
2697 * otherwise date/time stamp of DLL bound to
2698 * (Old BIND)
2700 DWORD ForwarderChain; /* -1 if no forwarders */
2701 DWORD Name;
2702 /* RVA to IAT (if bound this IAT has actual addresses) */
2703 DWORD FirstThunk;
2704 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
2706 #define IMAGE_ORDINAL_FLAG64 (((ULONGLONG)0x80000000 << 32) | 0x00000000)
2707 #define IMAGE_ORDINAL_FLAG32 0x80000000
2708 #define IMAGE_SNAP_BY_ORDINAL64(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG64) != 0)
2709 #define IMAGE_SNAP_BY_ORDINAL32(ordinal) (((ordinal) & IMAGE_ORDINAL_FLAG32) != 0)
2710 #define IMAGE_ORDINAL64(ordinal) ((ordinal) & 0xffff)
2711 #define IMAGE_ORDINAL32(ordinal) ((ordinal) & 0xffff)
2713 #ifdef _WIN64
2714 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64
2715 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal)
2716 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal)
2717 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA;
2718 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA;
2719 #else
2720 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32
2721 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal)
2722 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal)
2723 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA;
2724 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA;
2725 #endif
2727 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
2729 DWORD TimeDateStamp;
2730 WORD OffsetModuleName;
2731 WORD NumberOfModuleForwarderRefs;
2732 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
2733 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
2735 typedef struct _IMAGE_BOUND_FORWARDER_REF
2737 DWORD TimeDateStamp;
2738 WORD OffsetModuleName;
2739 WORD Reserved;
2740 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2742 typedef struct _IMAGE_BASE_RELOCATION
2744 DWORD VirtualAddress;
2745 DWORD SizeOfBlock;
2746 /* WORD TypeOffset[1]; */
2747 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2749 #include <pshpack2.h>
2751 typedef struct _IMAGE_RELOCATION
2753 union {
2754 DWORD VirtualAddress;
2755 DWORD RelocCount;
2756 } DUMMYUNIONNAME;
2757 DWORD SymbolTableIndex;
2758 WORD Type;
2759 } IMAGE_RELOCATION, *PIMAGE_RELOCATION;
2761 #include <poppack.h>
2763 #define IMAGE_SIZEOF_RELOCATION 10
2765 /* generic relocation types */
2766 #define IMAGE_REL_BASED_ABSOLUTE 0
2767 #define IMAGE_REL_BASED_HIGH 1
2768 #define IMAGE_REL_BASED_LOW 2
2769 #define IMAGE_REL_BASED_HIGHLOW 3
2770 #define IMAGE_REL_BASED_HIGHADJ 4
2771 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2772 #define IMAGE_REL_BASED_SECTION 6
2773 #define IMAGE_REL_BASED_REL 7
2774 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2775 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2776 #define IMAGE_REL_BASED_DIR64 10
2777 #define IMAGE_REL_BASED_HIGH3ADJ 11
2779 /* I386 relocation types */
2780 #define IMAGE_REL_I386_ABSOLUTE 0
2781 #define IMAGE_REL_I386_DIR16 1
2782 #define IMAGE_REL_I386_REL16 2
2783 #define IMAGE_REL_I386_DIR32 6
2784 #define IMAGE_REL_I386_DIR32NB 7
2785 #define IMAGE_REL_I386_SEG12 9
2786 #define IMAGE_REL_I386_SECTION 10
2787 #define IMAGE_REL_I386_SECREL 11
2788 #define IMAGE_REL_I386_REL32 20
2790 /* MIPS relocation types */
2791 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2792 #define IMAGE_REL_MIPS_REFHALF 0x0001
2793 #define IMAGE_REL_MIPS_REFWORD 0x0002
2794 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2795 #define IMAGE_REL_MIPS_REFHI 0x0004
2796 #define IMAGE_REL_MIPS_REFLO 0x0005
2797 #define IMAGE_REL_MIPS_GPREL 0x0006
2798 #define IMAGE_REL_MIPS_LITERAL 0x0007
2799 #define IMAGE_REL_MIPS_SECTION 0x000A
2800 #define IMAGE_REL_MIPS_SECREL 0x000B
2801 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2802 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2803 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2804 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2805 #define IMAGE_REL_MIPS_PAIR 0x0025
2807 /* ALPHA relocation types */
2808 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2809 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2810 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2811 #define IMAGE_REL_ALPHA_GPREL 0x0003
2812 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2813 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2814 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2815 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2816 #define IMAGE_REL_ALPHA_HINT 0x0008
2817 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2818 #define IMAGE_REL_ALPHA_REFHI 0x000A
2819 #define IMAGE_REL_ALPHA_REFLO 0x000B
2820 #define IMAGE_REL_ALPHA_PAIR 0x000C
2821 #define IMAGE_REL_ALPHA_MATCH 0x000D
2822 #define IMAGE_REL_ALPHA_SECTION 0x000E
2823 #define IMAGE_REL_ALPHA_SECREL 0x000F
2824 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2825 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2826 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2827 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2828 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2829 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2830 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2831 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2833 /* PowerPC relocation types */
2834 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2835 #define IMAGE_REL_PPC_ADDR64 0x0001
2836 #define IMAGE_REL_PPC_ADDR 0x0002
2837 #define IMAGE_REL_PPC_ADDR24 0x0003
2838 #define IMAGE_REL_PPC_ADDR16 0x0004
2839 #define IMAGE_REL_PPC_ADDR14 0x0005
2840 #define IMAGE_REL_PPC_REL24 0x0006
2841 #define IMAGE_REL_PPC_REL14 0x0007
2842 #define IMAGE_REL_PPC_TOCREL16 0x0008
2843 #define IMAGE_REL_PPC_TOCREL14 0x0009
2844 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2845 #define IMAGE_REL_PPC_SECREL 0x000B
2846 #define IMAGE_REL_PPC_SECTION 0x000C
2847 #define IMAGE_REL_PPC_IFGLUE 0x000D
2848 #define IMAGE_REL_PPC_IMGLUE 0x000E
2849 #define IMAGE_REL_PPC_SECREL16 0x000F
2850 #define IMAGE_REL_PPC_REFHI 0x0010
2851 #define IMAGE_REL_PPC_REFLO 0x0011
2852 #define IMAGE_REL_PPC_PAIR 0x0012
2853 #define IMAGE_REL_PPC_SECRELLO 0x0013
2854 #define IMAGE_REL_PPC_SECRELHI 0x0014
2855 #define IMAGE_REL_PPC_GPREL 0x0015
2856 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2857 /* modifier bits */
2858 #define IMAGE_REL_PPC_NEG 0x0100
2859 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2860 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2861 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2863 /* SH3 ? relocation type */
2864 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2865 #define IMAGE_REL_SH3_DIRECT16 0x0001
2866 #define IMAGE_REL_SH3_DIRECT 0x0002
2867 #define IMAGE_REL_SH3_DIRECT8 0x0003
2868 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2869 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2870 #define IMAGE_REL_SH3_DIRECT4 0x0006
2871 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2872 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2873 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2874 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2875 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2876 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2877 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2878 #define IMAGE_REL_SH3_SECTION 0x000E
2879 #define IMAGE_REL_SH3_SECREL 0x000F
2880 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2882 /* ARM (Archimedes?) relocation types */
2883 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2884 #define IMAGE_REL_ARM_ADDR 0x0001
2885 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2886 #define IMAGE_REL_ARM_BRANCH24 0x0003
2887 #define IMAGE_REL_ARM_BRANCH11 0x0004
2888 #define IMAGE_REL_ARM_SECTION 0x000E
2889 #define IMAGE_REL_ARM_SECREL 0x000F
2891 /* IA64 relocation types */
2892 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2893 #define IMAGE_REL_IA64_IMM14 0x0001
2894 #define IMAGE_REL_IA64_IMM22 0x0002
2895 #define IMAGE_REL_IA64_IMM64 0x0003
2896 #define IMAGE_REL_IA64_DIR 0x0004
2897 #define IMAGE_REL_IA64_DIR64 0x0005
2898 #define IMAGE_REL_IA64_PCREL21B 0x0006
2899 #define IMAGE_REL_IA64_PCREL21M 0x0007
2900 #define IMAGE_REL_IA64_PCREL21F 0x0008
2901 #define IMAGE_REL_IA64_GPREL22 0x0009
2902 #define IMAGE_REL_IA64_LTOFF22 0x000A
2903 #define IMAGE_REL_IA64_SECTION 0x000B
2904 #define IMAGE_REL_IA64_SECREL22 0x000C
2905 #define IMAGE_REL_IA64_SECREL64I 0x000D
2906 #define IMAGE_REL_IA64_SECREL 0x000E
2907 #define IMAGE_REL_IA64_LTOFF64 0x000F
2908 #define IMAGE_REL_IA64_DIR32NB 0x0010
2909 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2910 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2911 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2912 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2913 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2914 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2915 #define IMAGE_REL_IA64_ADDEND 0x001F
2917 /* AMD64 relocation types */
2918 #define IMAGE_REL_AMD64_ABSOLUTE 0x0000
2919 #define IMAGE_REL_AMD64_ADDR64 0x0001
2920 #define IMAGE_REL_AMD64_ADDR32 0x0002
2921 #define IMAGE_REL_AMD64_ADDR32NB 0x0003
2922 #define IMAGE_REL_AMD64_REL32 0x0004
2923 #define IMAGE_REL_AMD64_REL32_1 0x0005
2924 #define IMAGE_REL_AMD64_REL32_2 0x0006
2925 #define IMAGE_REL_AMD64_REL32_3 0x0007
2926 #define IMAGE_REL_AMD64_REL32_4 0x0008
2927 #define IMAGE_REL_AMD64_REL32_5 0x0009
2928 #define IMAGE_REL_AMD64_SECTION 0x000A
2929 #define IMAGE_REL_AMD64_SECREL 0x000B
2930 #define IMAGE_REL_AMD64_SECREL7 0x000C
2931 #define IMAGE_REL_AMD64_TOKEN 0x000D
2932 #define IMAGE_REL_AMD64_SREL32 0x000E
2933 #define IMAGE_REL_AMD64_PAIR 0x000F
2934 #define IMAGE_REL_AMD64_SSPAN32 0x0010
2936 /* archive format */
2938 #define IMAGE_ARCHIVE_START_SIZE 8
2939 #define IMAGE_ARCHIVE_START "!<arch>\n"
2940 #define IMAGE_ARCHIVE_END "`\n"
2941 #define IMAGE_ARCHIVE_PAD "\n"
2942 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2943 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2945 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2947 BYTE Name[16];
2948 BYTE Date[12];
2949 BYTE UserID[6];
2950 BYTE GroupID[6];
2951 BYTE Mode[8];
2952 BYTE Size[10];
2953 BYTE EndHeader[2];
2954 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2956 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2958 typedef struct _IMPORT_OBJECT_HEADER
2960 WORD Sig1;
2961 WORD Sig2;
2962 WORD Version;
2963 WORD Machine;
2964 DWORD TimeDateStamp;
2965 DWORD SizeOfData;
2966 union
2968 WORD Ordinal;
2969 WORD Hint;
2970 } DUMMYUNIONNAME;
2971 WORD Type : 2;
2972 WORD NameType : 3;
2973 WORD Reserved : 11;
2974 } IMPORT_OBJECT_HEADER;
2976 #define IMPORT_OBJECT_HDR_SIG2 0xffff
2978 typedef enum IMPORT_OBJECT_TYPE
2980 IMPORT_OBJECT_CODE = 0,
2981 IMPORT_OBJECT_DATA = 1,
2982 IMPORT_OBJECT_CONST = 2
2983 } IMPORT_OBJECT_TYPE;
2985 typedef enum IMPORT_OBJECT_NAME_TYPE
2987 IMPORT_OBJECT_ORDINAL = 0,
2988 IMPORT_OBJECT_NAME = 1,
2989 IMPORT_OBJECT_NAME_NO_PREFIX = 2,
2990 IMPORT_OBJECT_NAME_UNDECORATE = 3
2991 } IMPORT_OBJECT_NAME_TYPE;
2993 typedef struct _ANON_OBJECT_HEADER
2995 WORD Sig1;
2996 WORD Sig2;
2997 WORD Version;
2998 WORD Machine;
2999 DWORD TimeDateStamp;
3000 CLSID ClassID;
3001 DWORD SizeOfData;
3002 } ANON_OBJECT_HEADER;
3005 * Resource directory stuff
3007 typedef struct _IMAGE_RESOURCE_DIRECTORY {
3008 DWORD Characteristics;
3009 DWORD TimeDateStamp;
3010 WORD MajorVersion;
3011 WORD MinorVersion;
3012 WORD NumberOfNamedEntries;
3013 WORD NumberOfIdEntries;
3014 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
3015 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
3017 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
3018 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
3020 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
3021 union {
3022 struct {
3023 #ifdef BITFIELDS_BIGENDIAN
3024 unsigned NameIsString:1;
3025 unsigned NameOffset:31;
3026 #else
3027 unsigned NameOffset:31;
3028 unsigned NameIsString:1;
3029 #endif
3030 } DUMMYSTRUCTNAME1;
3031 DWORD Name;
3032 struct {
3033 #ifdef WORDS_BIGENDIAN
3034 WORD __pad;
3035 WORD Id;
3036 #else
3037 WORD Id;
3038 WORD __pad;
3039 #endif
3040 } DUMMYSTRUCTNAME2;
3041 } DUMMYUNIONNAME1;
3042 union {
3043 DWORD OffsetToData;
3044 struct {
3045 #ifdef BITFIELDS_BIGENDIAN
3046 unsigned DataIsDirectory:1;
3047 unsigned OffsetToDirectory:31;
3048 #else
3049 unsigned OffsetToDirectory:31;
3050 unsigned DataIsDirectory:1;
3051 #endif
3052 } DUMMYSTRUCTNAME3;
3053 } DUMMYUNIONNAME2;
3054 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
3057 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
3058 WORD Length;
3059 CHAR NameString[ 1 ];
3060 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
3062 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
3063 WORD Length;
3064 WCHAR NameString[ 1 ];
3065 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
3067 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
3068 DWORD OffsetToData;
3069 DWORD Size;
3070 DWORD CodePage;
3071 DWORD Reserved;
3072 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
3075 typedef VOID (CALLBACK *PIMAGE_TLS_CALLBACK)(
3076 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
3079 typedef struct _IMAGE_TLS_DIRECTORY64 {
3080 ULONGLONG StartAddressOfRawData;
3081 ULONGLONG EndAddressOfRawData;
3082 ULONGLONG AddressOfIndex;
3083 ULONGLONG AddressOfCallBacks;
3084 DWORD SizeOfZeroFill;
3085 DWORD Characteristics;
3086 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64;
3088 typedef struct _IMAGE_TLS_DIRECTORY32 {
3089 DWORD StartAddressOfRawData;
3090 DWORD EndAddressOfRawData;
3091 DWORD AddressOfIndex;
3092 DWORD AddressOfCallBacks;
3093 DWORD SizeOfZeroFill;
3094 DWORD Characteristics;
3095 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32;
3097 #ifdef _WIN64
3098 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY;
3099 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY;
3100 #else
3101 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY;
3102 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY;
3103 #endif
3105 typedef struct _IMAGE_DEBUG_DIRECTORY {
3106 DWORD Characteristics;
3107 DWORD TimeDateStamp;
3108 WORD MajorVersion;
3109 WORD MinorVersion;
3110 DWORD Type;
3111 DWORD SizeOfData;
3112 DWORD AddressOfRawData;
3113 DWORD PointerToRawData;
3114 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
3116 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
3117 #define IMAGE_DEBUG_TYPE_COFF 1
3118 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
3119 #define IMAGE_DEBUG_TYPE_FPO 3
3120 #define IMAGE_DEBUG_TYPE_MISC 4
3121 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
3122 #define IMAGE_DEBUG_TYPE_FIXUP 6
3123 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
3124 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
3125 #define IMAGE_DEBUG_TYPE_BORLAND 9
3126 #define IMAGE_DEBUG_TYPE_RESERVED10 10
3128 typedef enum ReplacesCorHdrNumericDefines
3130 COMIMAGE_FLAGS_ILONLY = 0x00000001,
3131 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002,
3132 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004,
3133 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008,
3134 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000,
3136 COR_VERSION_MAJOR_V2 = 2,
3137 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2,
3138 COR_VERSION_MINOR = 0,
3139 COR_DELETED_NAME_LENGTH = 8,
3140 COR_VTABLEGAP_NAME_LENGTH = 8,
3142 NATIVE_TYPE_MAX_CB = 1,
3143 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xff,
3145 IMAGE_COR_MIH_METHODRVA = 0x01,
3146 IMAGE_COR_MIH_EHRVA = 0x02,
3147 IMAGE_COR_MIH_BASICBLOCK = 0x08,
3149 COR_VTABLE_32BIT = 0x01,
3150 COR_VTABLE_64BIT = 0x02,
3151 COR_VTABLE_FROM_UNMANAGED = 0x04,
3152 COR_VTABLE_CALL_MOST_DERIVED = 0x10,
3154 IMAGE_COR_EATJ_THUNK_SIZE = 32,
3156 MAX_CLASS_NAME = 1024,
3157 MAX_PACKAGE_NAME = 1024,
3158 } ReplacesCorHdrNumericDefines;
3160 typedef struct IMAGE_COR20_HEADER
3162 DWORD cb;
3163 WORD MajorRuntimeVersion;
3164 WORD MinorRuntimeVersion;
3166 IMAGE_DATA_DIRECTORY MetaData;
3167 DWORD Flags;
3168 DWORD EntryPointToken;
3170 IMAGE_DATA_DIRECTORY Resources;
3171 IMAGE_DATA_DIRECTORY StrongNameSignature;
3172 IMAGE_DATA_DIRECTORY CodeManagerTable;
3173 IMAGE_DATA_DIRECTORY VTableFixups;
3174 IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
3175 IMAGE_DATA_DIRECTORY ManagedNativeHeader;
3177 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
3179 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
3180 DWORD NumberOfSymbols;
3181 DWORD LvaToFirstSymbol;
3182 DWORD NumberOfLinenumbers;
3183 DWORD LvaToFirstLinenumber;
3184 DWORD RvaToFirstByteOfCode;
3185 DWORD RvaToLastByteOfCode;
3186 DWORD RvaToFirstByteOfData;
3187 DWORD RvaToLastByteOfData;
3188 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
3190 #define FRAME_FPO 0
3191 #define FRAME_TRAP 1
3192 #define FRAME_TSS 2
3193 #define FRAME_NONFPO 3
3195 typedef struct _FPO_DATA {
3196 DWORD ulOffStart;
3197 DWORD cbProcSize;
3198 DWORD cdwLocals;
3199 WORD cdwParams;
3200 WORD cbProlog : 8;
3201 WORD cbRegs : 3;
3202 WORD fHasSEH : 1;
3203 WORD fUseBP : 1;
3204 WORD reserved : 1;
3205 WORD cbFrame : 2;
3206 } FPO_DATA, *PFPO_DATA;
3208 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
3209 DWORD Size;
3210 DWORD TimeDateStamp;
3211 WORD MajorVersion;
3212 WORD MinorVersion;
3213 DWORD GlobalFlagsClear;
3214 DWORD GlobalFlagsSet;
3215 DWORD CriticalSectionDefaultTimeout;
3216 DWORD DeCommitFreeBlockThreshold;
3217 DWORD DeCommitTotalFreeThreshold;
3218 PVOID LockPrefixTable;
3219 DWORD MaximumAllocationSize;
3220 DWORD VirtualMemoryThreshold;
3221 DWORD ProcessHeapFlags;
3222 DWORD ProcessAffinityMask;
3223 WORD CSDVersion;
3224 WORD Reserved1;
3225 PVOID EditList;
3226 DWORD SecurityCookie;
3227 DWORD SEHandlerTable;
3228 DWORD SEHandlerCount;
3229 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
3231 typedef struct _IMAGE_FUNCTION_ENTRY {
3232 DWORD StartingAddress;
3233 DWORD EndingAddress;
3234 DWORD EndOfPrologue;
3235 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
3237 #define IMAGE_DEBUG_MISC_EXENAME 1
3239 typedef struct _IMAGE_DEBUG_MISC {
3240 DWORD DataType;
3241 DWORD Length;
3242 BYTE Unicode;
3243 BYTE Reserved[ 3 ];
3244 BYTE Data[ 1 ];
3245 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
3247 /* This is the structure that appears at the very start of a .DBG file. */
3249 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
3250 WORD Signature;
3251 WORD Flags;
3252 WORD Machine;
3253 WORD Characteristics;
3254 DWORD TimeDateStamp;
3255 DWORD CheckSum;
3256 DWORD ImageBase;
3257 DWORD SizeOfImage;
3258 DWORD NumberOfSections;
3259 DWORD ExportedNamesSize;
3260 DWORD DebugDirectorySize;
3261 DWORD SectionAlignment;
3262 DWORD Reserved[ 2 ];
3263 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
3265 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
3268 typedef struct tagMESSAGE_RESOURCE_ENTRY {
3269 WORD Length;
3270 WORD Flags;
3271 BYTE Text[1];
3272 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
3273 #define MESSAGE_RESOURCE_UNICODE 0x0001
3275 typedef struct tagMESSAGE_RESOURCE_BLOCK {
3276 DWORD LowId;
3277 DWORD HighId;
3278 DWORD OffsetToEntries;
3279 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
3281 typedef struct tagMESSAGE_RESOURCE_DATA {
3282 DWORD NumberOfBlocks;
3283 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
3284 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
3287 * Here follows typedefs for security and tokens.
3291 * First a constant for the following typedefs.
3294 #define ANYSIZE_ARRAY 1
3296 /* FIXME: Orphan. What does it point to? */
3297 typedef PVOID PACCESS_TOKEN;
3298 typedef PVOID PSECURITY_DESCRIPTOR;
3299 typedef PVOID PSID;
3302 * TOKEN_INFORMATION_CLASS
3305 typedef enum _TOKEN_INFORMATION_CLASS {
3306 TokenUser = 1,
3307 TokenGroups,
3308 TokenPrivileges,
3309 TokenOwner,
3310 TokenPrimaryGroup,
3311 TokenDefaultDacl,
3312 TokenSource,
3313 TokenType,
3314 TokenImpersonationLevel,
3315 TokenStatistics,
3316 TokenRestrictedSids,
3317 TokenSessionId,
3318 TokenGroupsAndPrivileges,
3319 TokenSessionReference,
3320 TokenSandBoxInert
3321 } TOKEN_INFORMATION_CLASS;
3323 #define TOKEN_TOKEN_ADJUST_DEFAULT 0x0080
3324 #define TOKEN_ADJUST_GROUPS 0x0040
3325 #define TOKEN_ADJUST_PRIVILEGES 0x0020
3326 #define TOKEN_ADJUST_SESSIONID 0x0100
3327 #define TOKEN_ASSIGN_PRIMARY 0x0001
3328 #define TOKEN_DUPLICATE 0x0002
3329 #define TOKEN_EXECUTE STANDARD_RIGHTS_EXECUTE
3330 #define TOKEN_IMPERSONATE 0x0004
3331 #define TOKEN_QUERY 0x0008
3332 #define TOKEN_QUERY_SOURCE 0x0010
3333 #define TOKEN_ADJUST_DEFAULT 0x0080
3334 #define TOKEN_READ (STANDARD_RIGHTS_READ|TOKEN_QUERY)
3335 #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE | \
3336 TOKEN_ADJUST_PRIVILEGES | \
3337 TOKEN_ADJUST_GROUPS | \
3338 TOKEN_ADJUST_DEFAULT )
3339 #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | \
3340 TOKEN_ASSIGN_PRIMARY | \
3341 TOKEN_DUPLICATE | \
3342 TOKEN_IMPERSONATE | \
3343 TOKEN_QUERY | \
3344 TOKEN_QUERY_SOURCE | \
3345 TOKEN_ADJUST_PRIVILEGES | \
3346 TOKEN_ADJUST_GROUPS | \
3347 TOKEN_ADJUST_SESSIONID | \
3348 TOKEN_ADJUST_DEFAULT )
3350 #ifndef _SECURITY_DEFINED
3351 #define _SECURITY_DEFINED
3354 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
3356 typedef struct _GENERIC_MAPPING {
3357 ACCESS_MASK GenericRead;
3358 ACCESS_MASK GenericWrite;
3359 ACCESS_MASK GenericExecute;
3360 ACCESS_MASK GenericAll;
3361 } GENERIC_MAPPING, *PGENERIC_MAPPING;
3363 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
3364 #define SID_IDENTIFIER_AUTHORITY_DEFINED
3365 typedef struct {
3366 BYTE Value[6];
3367 } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
3368 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
3370 #ifndef SID_DEFINED
3371 #define SID_DEFINED
3372 typedef struct _SID {
3373 BYTE Revision;
3374 BYTE SubAuthorityCount;
3375 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
3376 DWORD SubAuthority[1];
3377 } SID,*PISID;
3378 #endif /* !defined(SID_DEFINED) */
3380 #define SID_REVISION (1) /* Current revision */
3381 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
3382 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
3384 #define SECURITY_MAX_SID_SIZE (sizeof(SID) - sizeof(DWORD) + (SID_MAX_SUB_AUTHORITIES * sizeof(DWORD)))
3387 * ACL
3390 #define ACL_REVISION1 1
3391 #define ACL_REVISION2 2
3392 #define ACL_REVISION3 3
3393 #define ACL_REVISION4 4
3395 #define MIN_ACL_REVISION ACL_REVISION2
3396 #define MAX_ACL_REVISION ACL_REVISION4
3398 typedef struct _ACL {
3399 BYTE AclRevision;
3400 BYTE Sbz1;
3401 WORD AclSize;
3402 WORD AceCount;
3403 WORD Sbz2;
3404 } ACL, *PACL;
3406 typedef enum _ACL_INFORMATION_CLASS
3408 AclRevisionInformation = 1,
3409 AclSizeInformation
3410 } ACL_INFORMATION_CLASS;
3412 typedef struct _ACL_REVISION_INFORMATION
3414 DWORD AclRevision;
3415 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION;
3417 typedef struct _ACL_SIZE_INFORMATION
3419 DWORD AceCount;
3420 DWORD AclBytesInUse;
3421 DWORD AclBytesFree;
3422 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION;
3424 /* SECURITY_DESCRIPTOR */
3425 #define SECURITY_DESCRIPTOR_REVISION 1
3426 #define SECURITY_DESCRIPTOR_REVISION1 1
3430 * Privilege Names
3432 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege")
3433 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege")
3434 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege")
3435 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege")
3436 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege")
3437 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege")
3438 #define SE_TCB_NAME TEXT("SeTcbPrivilege")
3439 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege")
3440 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege")
3441 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege")
3442 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege")
3443 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege")
3444 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege")
3445 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege")
3446 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege")
3447 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege")
3448 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege")
3449 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege")
3450 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege")
3451 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege")
3452 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege")
3453 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege")
3454 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege")
3455 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege")
3456 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege")
3457 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege")
3458 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege")
3459 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege")
3460 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege")
3462 #define SE_GROUP_MANDATORY 0x00000001
3463 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002
3464 #define SE_GROUP_ENABLED 0x00000004
3465 #define SE_GROUP_OWNER 0x00000008
3466 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010
3467 #define SE_GROUP_LOGON_ID 0xC0000000
3468 #define SE_GROUP_RESOURCE 0x20000000
3470 #define SE_PRIVILEGE_ENABLED_BY_DEFAULT 0x00000001
3471 #define SE_PRIVILEGE_ENABLED 0x00000002
3472 #define SE_PRIVILEGE_REMOVE 0x00000004
3473 #define SE_PRIVILEGE_USED_FOR_ACCESS 0x80000000
3475 #define PRIVILEGE_SET_ALL_NECESSARY 1
3477 #define SE_OWNER_DEFAULTED 0x00000001
3478 #define SE_GROUP_DEFAULTED 0x00000002
3479 #define SE_DACL_PRESENT 0x00000004
3480 #define SE_DACL_DEFAULTED 0x00000008
3481 #define SE_SACL_PRESENT 0x00000010
3482 #define SE_SACL_DEFAULTED 0x00000020
3483 #define SE_DACL_AUTO_INHERIT_REQ 0x00000100
3484 #define SE_SACL_AUTO_INHERIT_REQ 0x00000200
3485 #define SE_DACL_AUTO_INHERITED 0x00000400
3486 #define SE_SACL_AUTO_INHERITED 0x00000800
3487 #define SE_DACL_PROTECTED 0x00001000
3488 #define SE_SACL_PROTECTED 0x00002000
3489 #define SE_RM_CONTROL_VALID 0x00004000
3490 #define SE_SELF_RELATIVE 0x00008000
3492 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
3493 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
3495 /* The security descriptor structure */
3496 typedef struct {
3497 BYTE Revision;
3498 BYTE Sbz1;
3499 SECURITY_DESCRIPTOR_CONTROL Control;
3500 DWORD Owner;
3501 DWORD Group;
3502 DWORD Sacl;
3503 DWORD Dacl;
3504 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
3506 typedef struct {
3507 BYTE Revision;
3508 BYTE Sbz1;
3509 SECURITY_DESCRIPTOR_CONTROL Control;
3510 PSID Owner;
3511 PSID Group;
3512 PACL Sacl;
3513 PACL Dacl;
3514 } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
3516 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
3518 #endif /* _SECURITY_DEFINED */
3521 * SID_AND_ATTRIBUTES
3524 typedef struct _SID_AND_ATTRIBUTES {
3525 PSID Sid;
3526 DWORD Attributes;
3527 } SID_AND_ATTRIBUTES;
3529 /* security entities */
3530 #define SECURITY_NULL_RID (0x00000000L)
3531 #define SECURITY_WORLD_RID (0x00000000L)
3532 #define SECURITY_LOCAL_RID (0X00000000L)
3534 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
3536 /* S-1-1 */
3537 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
3539 /* S-1-2 */
3540 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
3542 /* S-1-3 */
3543 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
3544 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
3545 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
3546 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
3547 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
3549 /* S-1-4 */
3550 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
3552 /* S-1-5 */
3553 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
3554 #define SECURITY_DIALUP_RID 0x00000001L
3555 #define SECURITY_NETWORK_RID 0x00000002L
3556 #define SECURITY_BATCH_RID 0x00000003L
3557 #define SECURITY_INTERACTIVE_RID 0x00000004L
3558 #define SECURITY_LOGON_IDS_RID 0x00000005L
3559 #define SECURITY_SERVICE_RID 0x00000006L
3560 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
3561 #define SECURITY_PROXY_RID 0x00000008L
3562 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
3563 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3564 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
3565 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
3566 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
3567 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
3568 #define SECURITY_REMOTE_LOGON_RID 0x0000000EL
3569 #define SECURITY_THIS_ORGANIZATION_RID 0x0000000FL
3570 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
3571 #define SECURITY_LOCAL_SERVICE_RID 0x00000013L
3572 #define SECURITY_NETWORK_SERVICE_RID 0x00000014L
3573 #define SECURITY_NT_NON_UNIQUE 0x00000015L
3574 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
3576 #define SECURITY_PACKAGE_BASE_RID 0x00000040L
3577 #define SECURITY_PACKAGE_NTLM_RID 0x0000000AL
3578 #define SECURITY_PACKAGE_SCHANNEL_RID 0x0000000EL
3579 #define SECURITY_PACKAGE_DIGEST_RID 0x00000015L
3580 #define SECURITY_MAX_ALWAYS_FILTERED 0x000003E7L
3581 #define SECURITY_MIN_NEVER_FILTERED 0x000003E8L
3582 #define SECURITY_OTHER_ORGANIZATION_RID 0x000003E8L
3584 #define FOREST_USER_RID_MAX 0x000001F3L
3585 #define DOMAIN_USER_RID_ADMIN 0x000001F4L
3586 #define DOMAIN_USER_RID_GUEST 0x000001F5L
3587 #define DOMAIN_USER_RID_KRBTGT 0x000001F6L
3588 #define DOMAIN_USER_RID_MAX 0x000003E7L
3590 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
3591 #define DOMAIN_GROUP_RID_USERS 0x00000201L
3592 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
3593 #define DOMAIN_GROUP_RID_COMPUTERS 0x00000203L
3594 #define DOMAIN_GROUP_RID_CONTROLLERS 0x00000204L
3595 #define DOMAIN_GROUP_RID_CERT_ADMINS 0x00000205L
3596 #define DOMAIN_GROUP_RID_SCHEMA_ADMINS 0x00000206L
3597 #define DOMAIN_GROUP_RID_ENTERPRISE_ADMINS 0x00000207L
3598 #define DOMAIN_GROUP_RID_POLICY_ADMINS 0x00000208L
3600 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
3601 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
3602 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
3603 #define DOMAIN_ALIAS_RID_POWER_USERS 0x00000223L
3605 #define DOMAIN_ALIAS_RID_ACCOUNT_OPS 0x00000224L
3606 #define DOMAIN_ALIAS_RID_SYSTEM_OPS 0x00000225L
3607 #define DOMAIN_ALIAS_RID_PRINT_OPS 0x00000226L
3608 #define DOMAIN_ALIAS_RID_BACKUP_OPS 0x00000227L
3610 #define DOMAIN_ALIAS_RID_REPLICATOR 0x00000228L
3611 #define DOMAIN_ALIAS_RID_RAS_SERVERS 0x00000229L
3612 #define DOMAIN_ALIAS_RID_PREW2KCOMPACCESS 0x0000022AL
3613 #define DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS 0x0000022BL
3614 #define DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS 0x0000022CL
3615 #define DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS 0x0000022DL
3617 #define DOMAIN_ALIAS_RID_MONITORING_USERS 0x0000022EL
3618 #define DOMAIN_ALIAS_RID_LOGGING_USERS 0x0000022FL
3619 #define DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS 0x00000230L
3620 #define DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS 0x00000231L
3621 #define DOMAIN_ALIAS_RID_DCOM_USERS 0x00000232L
3623 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
3625 #define SECURITY_PACKAGE_RID_COUNT 2L
3626 #define SECURITY_LOGON_IDS_RID_COUNT 3L
3628 typedef enum {
3629 WinNullSid = 0,
3630 WinWorldSid = 1,
3631 WinLocalSid = 2,
3632 WinCreatorOwnerSid = 3,
3633 WinCreatorGroupSid = 4,
3634 WinCreatorOwnerServerSid = 5,
3635 WinCreatorGroupServerSid = 6,
3636 WinNtAuthoritySid = 7,
3637 WinDialupSid = 8,
3638 WinNetworkSid = 9,
3639 WinBatchSid = 10,
3640 WinInteractiveSid = 11,
3641 WinServiceSid = 12,
3642 WinAnonymousSid = 13,
3643 WinProxySid = 14,
3644 WinEnterpriseControllersSid = 15,
3645 WinSelfSid = 16,
3646 WinAuthenticatedUserSid = 17,
3647 WinRestrictedCodeSid = 18,
3648 WinTerminalServerSid = 19,
3649 WinRemoteLogonIdSid = 20,
3650 WinLogonIdsSid = 21,
3651 WinLocalSystemSid = 22,
3652 WinLocalServiceSid = 23,
3653 WinNetworkServiceSid = 24,
3654 WinBuiltinDomainSid = 25,
3655 WinBuiltinAdministratorsSid = 26,
3656 WinBuiltinUsersSid = 27,
3657 WinBuiltinGuestsSid = 28,
3658 WinBuiltinPowerUsersSid = 29,
3659 WinBuiltinAccountOperatorsSid = 30,
3660 WinBuiltinSystemOperatorsSid = 31,
3661 WinBuiltinPrintOperatorsSid = 32,
3662 WinBuiltinBackupOperatorsSid = 33,
3663 WinBuiltinReplicatorSid = 34,
3664 WinBuiltinPreWindows2000CompatibleAccessSid = 35,
3665 WinBuiltinRemoteDesktopUsersSid = 36,
3666 WinBuiltinNetworkConfigurationOperatorsSid = 37,
3667 WinAccountAdministratorSid = 38,
3668 WinAccountGuestSid = 39,
3669 WinAccountKrbtgtSid = 40,
3670 WinAccountDomainAdminsSid = 41,
3671 WinAccountDomainUsersSid = 42,
3672 WinAccountDomainGuestsSid = 43,
3673 WinAccountComputersSid = 44,
3674 WinAccountControllersSid = 45,
3675 WinAccountCertAdminsSid = 46,
3676 WinAccountSchemaAdminsSid = 47,
3677 WinAccountEnterpriseAdminsSid = 48,
3678 WinAccountPolicyAdminsSid = 49,
3679 WinAccountRasAndIasServersSid = 50,
3680 WinNTLMAuthenticationSid = 51,
3681 WinDigestAuthenticationSid = 52,
3682 WinSChannelAuthenticationSid = 53,
3683 WinThisOrganizationSid = 54,
3684 WinOtherOrganizationSid = 55,
3685 WinBuiltinIncomingForestTrustBuildersSid = 56,
3686 WinBuiltinPerfMonitoringUsersSid = 57,
3687 WinBuiltinPerfLoggingUsersSid = 58,
3688 WinBuiltinAuthorizationAccessSid = 59,
3689 WinBuiltinTerminalServerLicenseServersSid = 60
3690 } WELL_KNOWN_SID_TYPE;
3693 * TOKEN_USER
3696 typedef struct _TOKEN_USER {
3697 SID_AND_ATTRIBUTES User;
3698 } TOKEN_USER, *PTOKEN_USER;
3701 * TOKEN_GROUPS
3704 typedef struct _TOKEN_GROUPS {
3705 DWORD GroupCount;
3706 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
3707 } TOKEN_GROUPS, *PTOKEN_GROUPS;
3710 * LUID_AND_ATTRIBUTES
3713 typedef union _LARGE_INTEGER {
3714 struct {
3715 #ifdef WORDS_BIGENDIAN
3716 LONG HighPart;
3717 DWORD LowPart;
3718 #else
3719 DWORD LowPart;
3720 LONG HighPart;
3721 #endif
3722 } u;
3723 #ifndef NONAMELESSSTRUCT
3724 struct {
3725 #ifdef WORDS_BIGENDIAN
3726 LONG HighPart;
3727 DWORD LowPart;
3728 #else
3729 DWORD LowPart;
3730 LONG HighPart;
3731 #endif
3733 #endif
3734 LONGLONG QuadPart;
3735 } LARGE_INTEGER, *PLARGE_INTEGER;
3737 typedef union _ULARGE_INTEGER {
3738 struct {
3739 #ifdef WORDS_BIGENDIAN
3740 DWORD HighPart;
3741 DWORD LowPart;
3742 #else
3743 DWORD LowPart;
3744 DWORD HighPart;
3745 #endif
3746 } u;
3747 #ifndef NONAMELESSSTRUCT
3748 struct {
3749 #ifdef WORDS_BIGENDIAN
3750 DWORD HighPart;
3751 DWORD LowPart;
3752 #else
3753 DWORD LowPart;
3754 DWORD HighPart;
3755 #endif
3757 #endif
3758 ULONGLONG QuadPart;
3759 } ULARGE_INTEGER, *PULARGE_INTEGER;
3762 * Locally Unique Identifier
3765 typedef struct _LUID {
3766 DWORD LowPart;
3767 LONG HighPart;
3768 } LUID, *PLUID;
3770 #include <pshpack4.h>
3771 typedef struct _LUID_AND_ATTRIBUTES {
3772 LUID Luid;
3773 DWORD Attributes;
3774 } LUID_AND_ATTRIBUTES, *PLUID_AND_ATTRIBUTES;
3775 #include <poppack.h>
3778 * PRIVILEGE_SET
3781 typedef struct _PRIVILEGE_SET {
3782 DWORD PrivilegeCount;
3783 DWORD Control;
3784 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
3785 } PRIVILEGE_SET, *PPRIVILEGE_SET;
3788 * TOKEN_PRIVILEGES
3791 typedef struct _TOKEN_PRIVILEGES {
3792 DWORD PrivilegeCount;
3793 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
3794 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
3797 * TOKEN_OWNER
3800 typedef struct _TOKEN_OWNER {
3801 PSID Owner;
3802 } TOKEN_OWNER, *PTOKEN_OWNER;
3805 * TOKEN_PRIMARY_GROUP
3808 typedef struct _TOKEN_PRIMARY_GROUP {
3809 PSID PrimaryGroup;
3810 } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP;
3814 * TOKEN_DEFAULT_DACL
3817 typedef struct _TOKEN_DEFAULT_DACL {
3818 PACL DefaultDacl;
3819 } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL;
3822 * TOKEN_SOURCEL
3825 #define TOKEN_SOURCE_LENGTH 8
3827 typedef struct _TOKEN_SOURCE {
3828 char SourceName[TOKEN_SOURCE_LENGTH];
3829 LUID SourceIdentifier;
3830 } TOKEN_SOURCE, *PTOKEN_SOURCE;
3833 * TOKEN_TYPE
3836 typedef enum tagTOKEN_TYPE {
3837 TokenPrimary = 1,
3838 TokenImpersonation
3839 } TOKEN_TYPE;
3842 * SECURITY_IMPERSONATION_LEVEL
3845 typedef enum _SECURITY_IMPERSONATION_LEVEL {
3846 SecurityAnonymous,
3847 SecurityIdentification,
3848 SecurityImpersonation,
3849 SecurityDelegation
3850 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
3852 #define SECURITY_DYNAMIC_TRACKING (TRUE)
3853 #define SECURITY_STATIC_TRACKING (FALSE)
3855 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
3856 * PSECURITY_CONTEXT_TRACKING_MODE;
3858 * Quality of Service
3861 typedef struct _SECURITY_QUALITY_OF_SERVICE {
3862 DWORD Length;
3863 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3864 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
3865 BOOLEAN EffectiveOnly;
3866 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
3869 * TOKEN_STATISTICS
3872 #include <pshpack4.h>
3873 typedef struct _TOKEN_STATISTICS {
3874 LUID TokenId;
3875 LUID AuthenticationId;
3876 LARGE_INTEGER ExpirationTime;
3877 TOKEN_TYPE TokenType;
3878 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
3879 DWORD DynamicCharged;
3880 DWORD DynamicAvailable;
3881 DWORD GroupCount;
3882 DWORD PrivilegeCount;
3883 LUID ModifiedId;
3884 } TOKEN_STATISTICS;
3885 #include <poppack.h>
3888 * ACLs of NT
3891 #define ACL_REVISION 2
3893 #define ACL_REVISION1 1
3894 #define ACL_REVISION2 2
3896 /* ACEs, directly starting after an ACL */
3897 typedef struct _ACE_HEADER {
3898 BYTE AceType;
3899 BYTE AceFlags;
3900 WORD AceSize;
3901 } ACE_HEADER,*PACE_HEADER;
3903 /* AceType */
3904 #define ACCESS_ALLOWED_ACE_TYPE 0
3905 #define ACCESS_DENIED_ACE_TYPE 1
3906 #define SYSTEM_AUDIT_ACE_TYPE 2
3907 #define SYSTEM_ALARM_ACE_TYPE 3
3909 /* inherit AceFlags */
3910 #define OBJECT_INHERIT_ACE 0x01
3911 #define CONTAINER_INHERIT_ACE 0x02
3912 #define NO_PROPAGATE_INHERIT_ACE 0x04
3913 #define INHERIT_ONLY_ACE 0x08
3914 #define INHERITED_ACE 0x10
3915 #define VALID_INHERIT_FLAGS 0x0F
3917 /* AceFlags mask for what events we (should) audit */
3918 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
3919 #define FAILED_ACCESS_ACE_FLAG 0x80
3921 /* different ACEs depending on AceType
3922 * SidStart marks the begin of a SID
3923 * so the thing finally looks like this:
3924 * 0: ACE_HEADER
3925 * 4: ACCESS_MASK
3926 * 8... : SID
3928 typedef struct _ACCESS_ALLOWED_ACE {
3929 ACE_HEADER Header;
3930 DWORD Mask;
3931 DWORD SidStart;
3932 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
3934 typedef struct _ACCESS_DENIED_ACE {
3935 ACE_HEADER Header;
3936 DWORD Mask;
3937 DWORD SidStart;
3938 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
3940 typedef struct _SYSTEM_AUDIT_ACE {
3941 ACE_HEADER Header;
3942 DWORD Mask;
3943 DWORD SidStart;
3944 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
3946 typedef struct _SYSTEM_ALARM_ACE {
3947 ACE_HEADER Header;
3948 DWORD Mask;
3949 DWORD SidStart;
3950 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
3952 typedef enum tagSID_NAME_USE {
3953 SidTypeUser = 1,
3954 SidTypeGroup,
3955 SidTypeDomain,
3956 SidTypeAlias,
3957 SidTypeWellKnownGroup,
3958 SidTypeDeletedAccount,
3959 SidTypeInvalid,
3960 SidTypeUnknown
3961 } SID_NAME_USE,*PSID_NAME_USE;
3963 #define ACE_OBJECT_TYPE_PRESENT 0x1
3964 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x2
3966 /* Access rights */
3968 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
3969 #undef DELETE
3970 #define DELETE 0x00010000
3971 #define READ_CONTROL 0x00020000
3972 #define WRITE_DAC 0x00040000
3973 #define WRITE_OWNER 0x00080000
3974 #define SYNCHRONIZE 0x00100000
3975 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
3977 #define STANDARD_RIGHTS_READ READ_CONTROL
3978 #define STANDARD_RIGHTS_WRITE READ_CONTROL
3979 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
3981 #define STANDARD_RIGHTS_ALL 0x001f0000
3983 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
3985 #define GENERIC_READ 0x80000000
3986 #define GENERIC_WRITE 0x40000000
3987 #define GENERIC_EXECUTE 0x20000000
3988 #define GENERIC_ALL 0x10000000
3990 #define MAXIMUM_ALLOWED 0x02000000
3991 #define ACCESS_SYSTEM_SECURITY 0x01000000
3993 #define EVENT_QUERY_STATE 0x0001
3994 #define EVENT_MODIFY_STATE 0x0002
3995 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
3997 #define SEMAPHORE_MODIFY_STATE 0x0002
3998 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4000 #define MUTEX_MODIFY_STATE 0x0001
4001 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
4003 #define TIMER_QUERY_STATE 0x0001
4004 #define TIMER_MODIFY_STATE 0x0002
4005 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
4007 #define PROCESS_TERMINATE 0x0001
4008 #define PROCESS_CREATE_THREAD 0x0002
4009 #define PROCESS_VM_OPERATION 0x0008
4010 #define PROCESS_VM_READ 0x0010
4011 #define PROCESS_VM_WRITE 0x0020
4012 #define PROCESS_DUP_HANDLE 0x0040
4013 #define PROCESS_CREATE_PROCESS 0x0080
4014 #define PROCESS_SET_QUOTA 0x0100
4015 #define PROCESS_SET_INFORMATION 0x0200
4016 #define PROCESS_QUERY_INFORMATION 0x0400
4017 #define PROCESS_SUSPEND_RESUME 0x0800
4018 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
4020 #define THREAD_TERMINATE 0x0001
4021 #define THREAD_SUSPEND_RESUME 0x0002
4022 #define THREAD_GET_CONTEXT 0x0008
4023 #define THREAD_SET_CONTEXT 0x0010
4024 #define THREAD_SET_INFORMATION 0x0020
4025 #define THREAD_QUERY_INFORMATION 0x0040
4026 #define THREAD_SET_THREAD_TOKEN 0x0080
4027 #define THREAD_IMPERSONATE 0x0100
4028 #define THREAD_DIRECT_IMPERSONATION 0x0200
4029 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
4031 #define THREAD_BASE_PRIORITY_LOWRT 15
4032 #define THREAD_BASE_PRIORITY_MAX 2
4033 #define THREAD_BASE_PRIORITY_MIN -2
4034 #define THREAD_BASE_PRIORITY_IDLE -15
4036 typedef struct _QUOTA_LIMITS {
4037 SIZE_T PagedPoolLimit;
4038 SIZE_T NonPagedPoolLimit;
4039 SIZE_T MinimumWorkingSetSize;
4040 SIZE_T MaximumWorkingSetSize;
4041 SIZE_T PagefileLimit;
4042 LARGE_INTEGER TimeLimit;
4043 } QUOTA_LIMITS, *PQUOTA_LIMITS;
4045 #define QUOTA_LIMITS_HARDWS_MIN_ENABLE 0x00000001
4046 #define QUOTA_LIMITS_HARDWS_MIN_DISABLE 0x00000002
4047 #define QUOTA_LIMITS_HARDWS_MAX_ENABLE 0x00000004
4048 #define QUOTA_LIMITS_HARDWS_MAX_DISABLE 0x00000008
4050 typedef struct _QUOTA_LIMITS_EX {
4051 SIZE_T PagedPoolLimit;
4052 SIZE_T NonPagedPoolLimit;
4053 SIZE_T MinimumWorkingSetSize;
4054 SIZE_T MaximumWorkingSetSize;
4055 SIZE_T PagefileLimit;
4056 LARGE_INTEGER TimeLimit;
4057 SIZE_T Reserved1;
4058 SIZE_T Reserved2;
4059 SIZE_T Reserved3;
4060 SIZE_T Reserved4;
4061 DWORD Flags;
4062 DWORD Reserved5;
4063 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX;
4065 #define SECTION_QUERY 0x0001
4066 #define SECTION_MAP_WRITE 0x0002
4067 #define SECTION_MAP_READ 0x0004
4068 #define SECTION_MAP_EXECUTE 0x0008
4069 #define SECTION_EXTEND_SIZE 0x0010
4070 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020
4071 #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x01f)
4073 #define FILE_READ_DATA 0x0001 /* file & pipe */
4074 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
4075 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
4076 #define FILE_ADD_FILE 0x0002 /* directory */
4077 #define FILE_APPEND_DATA 0x0004 /* file */
4078 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
4079 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
4080 #define FILE_READ_EA 0x0008 /* file & directory */
4081 #define FILE_READ_PROPERTIES FILE_READ_EA
4082 #define FILE_WRITE_EA 0x0010 /* file & directory */
4083 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
4084 #define FILE_EXECUTE 0x0020 /* file */
4085 #define FILE_TRAVERSE 0x0020 /* directory */
4086 #define FILE_DELETE_CHILD 0x0040 /* directory */
4087 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
4088 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
4089 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
4091 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
4092 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
4093 SYNCHRONIZE)
4094 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
4095 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
4096 FILE_APPEND_DATA | SYNCHRONIZE)
4097 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
4098 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
4100 #define DUPLICATE_CLOSE_SOURCE 0x00000001
4101 #define DUPLICATE_SAME_ACCESS 0x00000002
4103 /* File attribute flags */
4104 #define FILE_SHARE_READ 0x00000001L
4105 #define FILE_SHARE_WRITE 0x00000002L
4106 #define FILE_SHARE_DELETE 0x00000004L
4108 #define FILE_ATTRIBUTE_READONLY 0x00000001
4109 #define FILE_ATTRIBUTE_HIDDEN 0x00000002
4110 #define FILE_ATTRIBUTE_SYSTEM 0x00000004
4111 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010
4112 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020
4113 #define FILE_ATTRIBUTE_NORMAL 0x00000080
4114 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100
4115 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200
4116 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400
4117 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800
4118 #define FILE_ATTRIBUTE_OFFLINE 0x00001000
4119 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000
4120 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000
4122 /* File notification flags */
4123 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
4124 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
4125 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
4126 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
4127 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
4128 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
4129 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
4130 #define FILE_NOTIFY_CHANGE_EA 0x00000080
4131 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
4132 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200
4133 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400
4134 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800
4136 #define FILE_ACTION_ADDED 0x00000001
4137 #define FILE_ACTION_REMOVED 0x00000002
4138 #define FILE_ACTION_MODIFIED 0x00000003
4139 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
4140 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
4141 #define FILE_ACTION_ADDED_STREAM 0x00000006
4142 #define FILE_ACTION_REMOVED_STREAM 0x00000007
4143 #define FILE_ACTION_MODIFIED_STREAM 0x00000008
4145 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
4146 #define FILE_CASE_PRESERVED_NAMES 0x00000002
4147 #define FILE_UNICODE_ON_DISK 0x00000004
4148 #define FILE_PERSISTENT_ACLS 0x00000008
4149 #define FILE_FILE_COMPRESSION 0x00000010
4150 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
4151 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000
4152 #define FILE_SUPPORTS_ENCRYPTION 0x00020000
4153 #define FILE_NAMED_STREAMS 0x00040000
4154 #define FILE_READ_ONLY_VOLUME 0x00080000
4156 /* File alignments (NT) */
4157 #define FILE_BYTE_ALIGNMENT 0x00000000
4158 #define FILE_WORD_ALIGNMENT 0x00000001
4159 #define FILE_LONG_ALIGNMENT 0x00000003
4160 #define FILE_QUAD_ALIGNMENT 0x00000007
4161 #define FILE_OCTA_ALIGNMENT 0x0000000f
4162 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
4163 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
4164 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
4165 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
4166 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
4168 #define MAILSLOT_NO_MESSAGE ((DWORD)-1)
4169 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
4171 #define REG_NONE 0 /* no type */
4172 #define REG_SZ 1 /* string type (ASCII) */
4173 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
4174 #define REG_BINARY 3 /* binary format, callerspecific */
4175 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
4176 #define REG_DWORD 4 /* DWORD in little endian format */
4177 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
4178 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
4179 #define REG_LINK 6 /* symbolic link (UNICODE) */
4180 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
4181 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
4182 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
4183 #define REG_RESOURCE_REQUIREMENTS_LIST 10
4184 #define REG_QWORD 11 /* QWORD in little endian format */
4185 #define REG_QWORD_LITTLE_ENDIAN 11 /* QWORD in little endian format */
4187 /* ----------------------------- begin power management --------------------- */
4189 typedef enum _LATENCY_TIME {
4190 LT_DONT_CARE,
4191 LT_LOWEST_LATENCY
4192 } LATENCY_TIME, *PLATENCY_TIME;
4194 #define DISCHARGE_POLICY_CRITICAL 0
4195 #define DISCHARGE_POLICY_LOW 1
4196 #define NUM_DISCHARGE_POLICIES 4
4198 #define PO_THROTTLE_NONE 0
4199 #define PO_THROTTLE_CONSTANT 1
4200 #define PO_THROTTLE_DEGRADE 2
4201 #define PO_THROTTLE_ADAPTIVE 3
4203 typedef enum _POWER_ACTION {
4204 PowerActionNone = 0,
4205 PowerActionReserved,
4206 PowerActionSleep,
4207 PowerActionHibernate,
4208 PowerActionShutdown,
4209 PowerActionShutdownReset,
4210 PowerActionShutdownOff,
4211 PowerActionWarmEject
4212 } POWER_ACTION,
4213 *PPOWER_ACTION;
4215 typedef enum _SYSTEM_POWER_STATE {
4216 PowerSystemUnspecified = 0,
4217 PowerSystemWorking = 1,
4218 PowerSystemSleeping1 = 2,
4219 PowerSystemSleeping2 = 3,
4220 PowerSystemSleeping3 = 4,
4221 PowerSystemHibernate = 5,
4222 PowerSystemShutdown = 6,
4223 PowerSystemMaximum = 7
4224 } SYSTEM_POWER_STATE,
4225 *PSYSTEM_POWER_STATE;
4227 typedef enum _DEVICE_POWER_STATE {
4228 PowerDeviceUnspecified,
4229 PowerDeviceD0,
4230 PowerDeviceD1,
4231 PowerDeviceD2,
4232 PowerDeviceD3,
4233 PowerDeviceMaximum
4234 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE;
4236 typedef enum _POWER_INFORMATION_LEVEL {
4237 SystemPowerPolicyAc,
4238 SystemPowerPolicyDc,
4239 VerifySystemPolicyAc,
4240 VerifySystemPolicyDc,
4241 SystemPowerCapabilities,
4242 SystemBatteryState,
4243 SystemPowerStateHandler,
4244 ProcessorStateHandler,
4245 SystemPowerPolicyCurrent,
4246 AdministratorPowerPolicy,
4247 SystemReserveHiberFile,
4248 ProcessorInformation,
4249 SystemPowerInformation,
4250 ProcessorStateHandler2,
4251 LastWakeTime,
4252 LastSleepTime,
4253 SystemExecutionState,
4254 SystemPowerStateNotifyHandler,
4255 ProcessorPowerPolicyAc,
4256 ProcessorPowerPolicyDc,
4257 VerifyProcessorPowerPolicyAc,
4258 VerifyProcessorPowerPolicyDc,
4259 ProcessorPowerPolicyCurrent
4260 } POWER_INFORMATION_LEVEL;
4262 typedef struct _ADMINISTRATOR_POWER_POLICY {
4263 SYSTEM_POWER_STATE MinSleep;
4264 SYSTEM_POWER_STATE MaxSleep;
4265 ULONG MinVideoTimeout;
4266 ULONG MaxVideoTimeout;
4267 ULONG MinSpindownTimeout;
4268 ULONG MaxSpindownTimeout;
4269 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY;
4271 typedef struct {
4272 ULONG Granularity;
4273 ULONG Capacity;
4274 } BATTERY_REPORTING_SCALE,
4275 *PBATTERY_REPORTING_SCALE;
4277 typedef struct {
4278 POWER_ACTION Action;
4279 ULONG Flags;
4280 ULONG EventCode;
4281 } POWER_ACTION_POLICY,
4282 *PPOWER_ACTION_POLICY;
4284 typedef struct _PROCESSOR_POWER_INFORMATION {
4285 ULONG Number;
4286 ULONG MaxMhz;
4287 ULONG CurrentMhz;
4288 ULONG MhzLimit;
4289 ULONG MaxIdleState;
4290 ULONG CurrentIdleState;
4291 } PROCESSOR_POWER_INFORMATION,
4292 *PPROCESSOR_POWER_INFORMATION;
4294 typedef struct _PROCESSOR_POWER_POLICY_INFO {
4295 ULONG TimeCheck;
4296 ULONG DemoteLimit;
4297 ULONG PromoteLimit;
4298 UCHAR DemotePercent;
4299 UCHAR PromotePercent;
4300 UCHAR Spare[2];
4301 ULONG AllowDemotion:1;
4302 ULONG AllowPromotion:1;
4303 ULONG Reserved:30;
4304 } PROCESSOR_POWER_POLICY_INFO,
4305 *PPROCESSOR_POWER_POLICY_INFO;
4307 typedef struct _PROCESSOR_POWER_POLICY {
4308 DWORD Revision;
4309 BYTE DynamicThrottle;
4310 BYTE Spare[3];
4311 DWORD DisableCStates:1;
4312 DWORD Reserved:31;
4313 DWORD PolicyCount;
4314 PROCESSOR_POWER_POLICY_INFO Policy[3];
4315 } PROCESSOR_POWER_POLICY,
4316 *PPROCESSOR_POWER_POLICY;
4318 typedef struct {
4319 BOOLEAN AcOnLine;
4320 BOOLEAN BatteryPresent;
4321 BOOLEAN Charging;
4322 BOOLEAN Discharging;
4323 BOOLEAN Spare1[4];
4324 ULONG MaxCapacity;
4325 ULONG RemainingCapacity;
4326 ULONG Rate;
4327 ULONG EstimatedTime;
4328 ULONG DefaultAlert1;
4329 ULONG DefaultAlert2;
4330 } SYSTEM_BATTERY_STATE,
4331 *PSYSTEM_BATTERY_STATE;
4333 typedef struct {
4334 BOOLEAN PowerButtonPresent;
4335 BOOLEAN SleepButtonPresent;
4336 BOOLEAN LidPresent;
4337 BOOLEAN SystemS1;
4338 BOOLEAN SystemS2;
4339 BOOLEAN SystemS3;
4340 BOOLEAN SystemS4;
4341 BOOLEAN SystemS5;
4342 BOOLEAN HiberFilePresent;
4343 BOOLEAN FullWake;
4344 BOOLEAN VideoDimPresent;
4345 BOOLEAN ApmPresent;
4346 BOOLEAN UpsPresent;
4347 BOOLEAN ThermalControl;
4348 BOOLEAN ProcessorThrottle;
4349 UCHAR ProcessorMinThrottle;
4350 UCHAR ProcessorMaxThrottle;
4351 UCHAR spare2[4];
4352 BOOLEAN DiskSpinDown;
4353 UCHAR spare3[8];
4354 BOOLEAN SystemBatteriesPresent;
4355 BOOLEAN BatteriesAreShortTerm;
4356 BATTERY_REPORTING_SCALE BatteryScale[3];
4357 SYSTEM_POWER_STATE AcOnLineWake;
4358 SYSTEM_POWER_STATE SoftLidWake;
4359 SYSTEM_POWER_STATE RtcWake;
4360 SYSTEM_POWER_STATE MinDeviceWakeState;
4361 SYSTEM_POWER_STATE DefaultLowLatencyWake;
4362 } SYSTEM_POWER_CAPABILITIES,
4363 *PSYSTEM_POWER_CAPABILITIES;
4365 typedef struct _SYSTEM_POWER_INFORMATION {
4366 ULONG MaxIdlenessAllowed;
4367 ULONG Idleness;
4368 ULONG TimeRemaining;
4369 UCHAR CoolingMode;
4370 } SYSTEM_POWER_INFORMATION,
4371 *PSYSTEM_POWER_INFORMATION;
4373 typedef struct _SYSTEM_POWER_LEVEL {
4374 BOOLEAN Enable;
4375 UCHAR Spare[3];
4376 ULONG BatteryLevel;
4377 POWER_ACTION_POLICY PowerPolicy;
4378 SYSTEM_POWER_STATE MinSystemState;
4379 } SYSTEM_POWER_LEVEL,
4380 *PSYSTEM_POWER_LEVEL;
4382 typedef struct _SYSTEM_POWER_POLICY {
4383 ULONG Revision;
4384 POWER_ACTION_POLICY PowerButton;
4385 POWER_ACTION_POLICY SleepButton;
4386 POWER_ACTION_POLICY LidClose;
4387 SYSTEM_POWER_STATE LidOpenWake;
4388 ULONG Reserved;
4389 POWER_ACTION_POLICY Idle;
4390 ULONG IdleTimeout;
4391 UCHAR IdleSensitivity;
4392 UCHAR DynamicThrottle;
4393 UCHAR Spare2[2];
4394 SYSTEM_POWER_STATE MinSleep;
4395 SYSTEM_POWER_STATE MaxSleep;
4396 SYSTEM_POWER_STATE ReducedLatencySleep;
4397 ULONG WinLogonFlags;
4398 ULONG Spare3;
4399 ULONG DozeS4Timeout;
4400 ULONG BroadcastCapacityResolution;
4401 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES];
4402 ULONG VideoTimeout;
4403 BOOLEAN VideoDimDisplay;
4404 ULONG VideoReserved[3];
4405 ULONG SpindownTimeout;
4406 BOOLEAN OptimizeForPower;
4407 UCHAR FanThrottleTolerance;
4408 UCHAR ForcedThrottle;
4409 UCHAR MinThrottle;
4410 POWER_ACTION_POLICY OverThrottled;
4411 } SYSTEM_POWER_POLICY,
4412 *PSYSTEM_POWER_POLICY;
4414 typedef union _FILE_SEGMENT_ELEMENT {
4415 PVOID64 Buffer;
4416 ULONGLONG Alignment;
4417 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT;
4419 typedef struct _FILE_NOTIFY_INFORMATION {
4420 DWORD NextEntryOffset;
4421 DWORD Action;
4422 DWORD FileNameLength;
4423 WCHAR FileName[1];
4424 } FILE_NOTIFY_INFORMATION, *PFILE_NOTIFY_INFORMATION;
4426 /* ----------------------------- begin tape storage --------------------- */
4428 #define TAPE_FIXED_PARTITIONS 0
4429 #define TAPE_SELECT_PARTITIONS 1
4430 #define TAPE_INITIATOR_PARTITIONS 2
4431 #define TAPE_ERASE_SHORT 0
4432 #define TAPE_ERASE_LONG 1
4433 #define TAPE_LOAD 0
4434 #define TAPE_UNLOAD 1
4435 #define TAPE_TENSION 2
4436 #define TAPE_LOCK 3
4437 #define TAPE_UNLOCK 4
4438 #define TAPE_FORMAT 5
4439 #define TAPE_SETMARKS 0
4440 #define TAPE_FILEMARKS 1
4441 #define TAPE_SHORT_FILEMARKS 2
4442 #define TAPE_LONG_FILEMARKS 3
4443 #define TAPE_REWIND 0
4444 #define TAPE_ABSOLUTE_BLOCK 1
4445 #define TAPE_LOGICAL_BLOCK 2
4446 #define TAPE_PSEUDO_LOGICAL_BLOCK 3
4447 #define TAPE_SPACE_END_OF_DATA 4
4448 #define TAPE_SPACE_RELATIVE_BLOCKS 5
4449 #define TAPE_SPACE_FILEMARKS 6
4450 #define TAPE_SPACE_SEQUENTIAL_FMKS 7
4451 #define TAPE_SPACE_SETMARKS 8
4452 #define TAPE_SPACE_SEQUENTIAL_SMKS 9
4454 typedef struct _TAPE_CREATE_PARTITION {
4455 DWORD Method;
4456 DWORD Count;
4457 DWORD Size;
4458 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION;
4460 typedef struct _TAPE_ERASE {
4461 DWORD Type;
4462 BOOLEAN Immediate;
4463 } TAPE_ERASE, *PTAPE_ERASE;
4465 typedef struct _TAPE_PREPARE {
4466 DWORD Operation;
4467 BOOLEAN Immediate;
4468 } TAPE_PREPARE, *PTAPE_PREPARE;
4470 typedef struct _TAPE_SET_DRIVE_PARAMETERS {
4471 BOOLEAN ECC;
4472 BOOLEAN Compression;
4473 BOOLEAN DataPadding;
4474 BOOLEAN ReportSetmarks;
4475 ULONG EOTWarningZoneSize;
4476 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS;
4478 typedef struct _TAPE_SET_MEDIA_PARAMETERS {
4479 ULONG BlockSize;
4480 } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS;
4482 typedef struct _TAPE_WRITE_MARKS {
4483 DWORD Type;
4484 DWORD Count;
4485 BOOLEAN Immediate;
4486 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS;
4488 typedef struct _TAPE_GET_POSITION {
4489 ULONG Type;
4490 ULONG Partition;
4491 ULONG OffsetLow;
4492 ULONG OffsetHigh;
4493 } TAPE_GET_POSITION, *PTAPE_GET_POSITION;
4495 typedef struct _TAPE_SET_POSITION {
4496 ULONG Method;
4497 ULONG Partition;
4498 LARGE_INTEGER Offset;
4499 BOOLEAN Immediate;
4500 } TAPE_SET_POSITION, *PTAPE_SET_POSITION;
4502 typedef struct _TAPE_GET_DRIVE_PARAMETERS {
4503 BOOLEAN ECC;
4504 BOOLEAN Compression;
4505 BOOLEAN DataPadding;
4506 BOOLEAN ReportSetmarks;
4507 DWORD DefaultBlockSize;
4508 DWORD MaximumBlockSize;
4509 DWORD MinimumBlockSize;
4510 DWORD MaximumPartitionCount;
4511 DWORD FeaturesLow;
4512 DWORD FeaturesHigh;
4513 DWORD EOTWarningZoneSize;
4514 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS;
4516 typedef struct _TAPE_GET_MEDIA_PARAMETERS {
4517 LARGE_INTEGER Capacity;
4518 LARGE_INTEGER Remaining;
4519 DWORD BlockSize;
4520 DWORD PartitionCount;
4521 BOOLEAN WriteProtected;
4522 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS;
4524 /* ----------------------------- begin registry ----------------------------- */
4526 /* Registry security values */
4527 #define OWNER_SECURITY_INFORMATION 0x00000001
4528 #define GROUP_SECURITY_INFORMATION 0x00000002
4529 #define DACL_SECURITY_INFORMATION 0x00000004
4530 #define SACL_SECURITY_INFORMATION 0x00000008
4532 #define REG_OPTION_RESERVED 0x00000000
4533 #define REG_OPTION_NON_VOLATILE 0x00000000
4534 #define REG_OPTION_VOLATILE 0x00000001
4535 #define REG_OPTION_CREATE_LINK 0x00000002
4536 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
4537 #define REG_OPTION_OPEN_LINK 0x00000008
4538 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
4539 REG_OPTION_NON_VOLATILE| \
4540 REG_OPTION_VOLATILE| \
4541 REG_OPTION_CREATE_LINK| \
4542 REG_OPTION_BACKUP_RESTORE| \
4543 REG_OPTION_OPEN_LINK)
4546 #define REG_CREATED_NEW_KEY 0x00000001
4547 #define REG_OPENED_EXISTING_KEY 0x00000002
4549 /* For RegNotifyChangeKeyValue */
4550 #define REG_NOTIFY_CHANGE_NAME 0x01
4551 #define REG_NOTIFY_CHANGE_ATTRIBUTES 0x02
4552 #define REG_NOTIFY_CHANGE_LAST_SET 0x04
4553 #define REG_NOTIFY_CHANGE_SECURITY 0x08
4555 #define KEY_QUERY_VALUE 0x00000001
4556 #define KEY_SET_VALUE 0x00000002
4557 #define KEY_CREATE_SUB_KEY 0x00000004
4558 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
4559 #define KEY_NOTIFY 0x00000010
4560 #define KEY_CREATE_LINK 0x00000020
4562 /* for RegKeyRestore flags */
4563 #define REG_WHOLE_HIVE_VOLATILE 0x00000001
4564 #define REG_REFRESH_HIVE 0x00000002
4565 #define REG_NO_LAZY_FLUSH 0x00000004
4566 #define REG_FORCE_RESTORE 0x00000008
4568 #define KEY_READ ((STANDARD_RIGHTS_READ| \
4569 KEY_QUERY_VALUE| \
4570 KEY_ENUMERATE_SUB_KEYS| \
4571 KEY_NOTIFY) \
4572 & (~SYNCHRONIZE) \
4574 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
4575 KEY_SET_VALUE| \
4576 KEY_CREATE_SUB_KEY) \
4577 & (~SYNCHRONIZE) \
4579 #define KEY_EXECUTE ((KEY_READ) & (~SYNCHRONIZE))
4580 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
4581 KEY_QUERY_VALUE| \
4582 KEY_SET_VALUE| \
4583 KEY_CREATE_SUB_KEY| \
4584 KEY_ENUMERATE_SUB_KEYS| \
4585 KEY_NOTIFY| \
4586 KEY_CREATE_LINK) \
4587 & (~SYNCHRONIZE) \
4589 /* ------------------------------ end registry ------------------------------ */
4592 #define EVENTLOG_SUCCESS 0x0000
4593 #define EVENTLOG_ERROR_TYPE 0x0001
4594 #define EVENTLOG_WARNING_TYPE 0x0002
4595 #define EVENTLOG_INFORMATION_TYPE 0x0004
4596 #define EVENTLOG_AUDIT_SUCCESS 0x0008
4597 #define EVENTLOG_AUDIT_FAILURE 0x0010
4599 #define SERVICE_BOOT_START 0x00000000
4600 #define SERVICE_SYSTEM_START 0x00000001
4601 #define SERVICE_AUTO_START 0x00000002
4602 #define SERVICE_DEMAND_START 0x00000003
4603 #define SERVICE_DISABLED 0x00000004
4605 #define SERVICE_ERROR_IGNORE 0x00000000
4606 #define SERVICE_ERROR_NORMAL 0x00000001
4607 #define SERVICE_ERROR_SEVERE 0x00000002
4608 #define SERVICE_ERROR_CRITICAL 0x00000003
4610 /* Service types */
4611 #define SERVICE_KERNEL_DRIVER 0x00000001
4612 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
4613 #define SERVICE_ADAPTER 0x00000004
4614 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
4616 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
4617 SERVICE_RECOGNIZER_DRIVER )
4619 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
4620 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
4621 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
4623 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
4625 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
4626 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
4629 typedef enum _CM_SERVICE_NODE_TYPE
4631 DriverType = SERVICE_KERNEL_DRIVER,
4632 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
4633 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
4634 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
4635 AdapterType = SERVICE_ADAPTER,
4636 RecognizerType = SERVICE_RECOGNIZER_DRIVER
4637 } SERVICE_NODE_TYPE;
4639 typedef enum _CM_SERVICE_LOAD_TYPE
4641 BootLoad = SERVICE_BOOT_START,
4642 SystemLoad = SERVICE_SYSTEM_START,
4643 AutoLoad = SERVICE_AUTO_START,
4644 DemandLoad = SERVICE_DEMAND_START,
4645 DisableLoad = SERVICE_DISABLED
4646 } SERVICE_LOAD_TYPE;
4648 typedef enum _CM_ERROR_CONTROL_TYPE
4650 IgnoreError = SERVICE_ERROR_IGNORE,
4651 NormalError = SERVICE_ERROR_NORMAL,
4652 SevereError = SERVICE_ERROR_SEVERE,
4653 CriticalError = SERVICE_ERROR_CRITICAL
4654 } SERVICE_ERROR_TYPE;
4658 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
4659 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
4660 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
4661 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
4662 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
4664 #include <guiddef.h>
4666 typedef struct _OBJECT_TYPE_LIST {
4667 WORD Level;
4668 WORD Sbz;
4669 GUID *ObjectType;
4670 } OBJECT_TYPE_LIST, *POBJECT_TYPE_LIST;
4672 typedef struct _RTL_CRITICAL_SECTION_DEBUG
4674 WORD Type;
4675 WORD CreatorBackTraceIndex;
4676 struct _RTL_CRITICAL_SECTION *CriticalSection;
4677 LIST_ENTRY ProcessLocksList;
4678 DWORD EntryCount;
4679 DWORD ContentionCount;
4680 #ifdef __WINESRC__ /* in Wine we store the name here */
4681 DWORD_PTR Spare[8/sizeof(DWORD_PTR)];
4682 #else
4683 DWORD Spare[ 2 ];
4684 #endif
4685 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
4687 typedef struct _RTL_CRITICAL_SECTION {
4688 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
4689 LONG LockCount;
4690 LONG RecursionCount;
4691 HANDLE OwningThread;
4692 HANDLE LockSemaphore;
4693 ULONG_PTR SpinCount;
4694 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
4696 typedef VOID (NTAPI * WAITORTIMERCALLBACKFUNC) (PVOID, BOOLEAN );
4698 #include <pshpack8.h>
4699 typedef struct _IO_COUNTERS {
4700 ULONGLONG DECLSPEC_ALIGN(8) ReadOperationCount;
4701 ULONGLONG DECLSPEC_ALIGN(8) WriteOperationCount;
4702 ULONGLONG DECLSPEC_ALIGN(8) OtherOperationCount;
4703 ULONGLONG DECLSPEC_ALIGN(8) ReadTransferCount;
4704 ULONGLONG DECLSPEC_ALIGN(8) WriteTransferCount;
4705 ULONGLONG DECLSPEC_ALIGN(8) OtherTransferCount;
4706 } IO_COUNTERS, *PIO_COUNTERS;
4707 #include <poppack.h>
4709 typedef struct {
4710 DWORD dwOSVersionInfoSize;
4711 DWORD dwMajorVersion;
4712 DWORD dwMinorVersion;
4713 DWORD dwBuildNumber;
4714 DWORD dwPlatformId;
4715 CHAR szCSDVersion[128];
4716 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
4718 typedef struct {
4719 DWORD dwOSVersionInfoSize;
4720 DWORD dwMajorVersion;
4721 DWORD dwMinorVersion;
4722 DWORD dwBuildNumber;
4723 DWORD dwPlatformId;
4724 WCHAR szCSDVersion[128];
4725 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
4727 DECL_WINELIB_TYPE_AW(OSVERSIONINFO)
4728 DECL_WINELIB_TYPE_AW(POSVERSIONINFO)
4729 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFO)
4731 typedef struct {
4732 DWORD dwOSVersionInfoSize;
4733 DWORD dwMajorVersion;
4734 DWORD dwMinorVersion;
4735 DWORD dwBuildNumber;
4736 DWORD dwPlatformId;
4737 CHAR szCSDVersion[128];
4738 WORD wServicePackMajor;
4739 WORD wServicePackMinor;
4740 WORD wSuiteMask;
4741 BYTE wProductType;
4742 BYTE wReserved;
4743 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA;
4745 typedef struct {
4746 DWORD dwOSVersionInfoSize;
4747 DWORD dwMajorVersion;
4748 DWORD dwMinorVersion;
4749 DWORD dwBuildNumber;
4750 DWORD dwPlatformId;
4751 WCHAR szCSDVersion[128];
4752 WORD wServicePackMajor;
4753 WORD wServicePackMinor;
4754 WORD wSuiteMask;
4755 BYTE wProductType;
4756 BYTE wReserved;
4757 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW;
4759 DECL_WINELIB_TYPE_AW(OSVERSIONINFOEX)
4760 DECL_WINELIB_TYPE_AW(POSVERSIONINFOEX)
4761 DECL_WINELIB_TYPE_AW(LPOSVERSIONINFOEX)
4763 ULONGLONG WINAPI VerSetConditionMask(ULONGLONG,DWORD,BYTE);
4765 #define VER_SET_CONDITION(_m_,_t_,_c_) ((_m_)=VerSetConditionMask((_m_),(_t_),(_c_)))
4767 #define VER_PLATFORM_WIN32s 0
4768 #define VER_PLATFORM_WIN32_WINDOWS 1
4769 #define VER_PLATFORM_WIN32_NT 2
4771 #define VER_MINORVERSION 0x00000001
4772 #define VER_MAJORVERSION 0x00000002
4773 #define VER_BUILDNUMBER 0x00000004
4774 #define VER_PLATFORMID 0x00000008
4775 #define VER_SERVICEPACKMINOR 0x00000010
4776 #define VER_SERVICEPACKMAJOR 0x00000020
4777 #define VER_SUITENAME 0x00000040
4778 #define VER_PRODUCT_TYPE 0x00000080
4780 #define VER_NT_WORKSTATION 1
4781 #define VER_NT_DOMAIN_CONTROLLER 2
4782 #define VER_NT_SERVER 3
4784 #define VER_SUITE_SMALLBUSINESS 0x00000001
4785 #define VER_SUITE_ENTERPRISE 0x00000002
4786 #define VER_SUITE_BACKOFFICE 0x00000004
4787 #define VER_SUITE_COMMUNICATIONS 0x00000008
4788 #define VER_SUITE_TERMINAL 0x00000010
4789 #define VER_SUITE_SMALLBUSINESS_RESTRICTED 0x00000020
4790 #define VER_SUITE_EMBEDDEDNT 0x00000040
4791 #define VER_SUITE_DATACENTER 0x00000080
4792 #define VER_SUITE_SINGLEUSERTS 0x00000100
4793 #define VER_SUITE_PERSONAL 0x00000200
4794 #define VER_SUITE_BLADE 0x00000400
4796 #define VER_EQUAL 1
4797 #define VER_GREATER 2
4798 #define VER_GREATER_EQUAL 3
4799 #define VER_LESS 4
4800 #define VER_LESS_EQUAL 5
4801 #define VER_AND 6
4802 #define VER_OR 7
4804 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION {
4805 DWORD dwFlags;
4806 DWORD ulFormatVersion;
4807 DWORD ulAssemblyCount;
4808 DWORD ulRootManifestPathType;
4809 DWORD ulRootManifestPathChars;
4810 DWORD ulRootConfigurationPathType;
4811 DWORD ulRootConfigurationPathChars;
4812 DWORD ulAppDirPathType;
4813 DWORD ulAppDirPathChars;
4814 PCWSTR lpRootManifestPath;
4815 PCWSTR lpRootConfigurationPath;
4816 PCWSTR lpAppDirPath;
4817 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION;
4819 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION {
4820 DWORD ulFlags;
4821 DWORD ulEncodedAssemblyIdentityLength;
4822 DWORD ulManifestPathType;
4823 DWORD ulManifestPathLength;
4824 LARGE_INTEGER liManifestLastWriteTime;
4825 DWORD ulPolicyPathType;
4826 DWORD ulPolicyPathLength;
4827 LARGE_INTEGER liPolicyLastWriteTime;
4828 DWORD ulMetadataSatelliteRosterIndex;
4829 DWORD ulManifestVersionMajor;
4830 DWORD ulManifestVersionMinor;
4831 DWORD ulPolicyVersionMajor;
4832 DWORD ulPolicyVersionMinor;
4833 DWORD ulAssemblyDirectoryNameLength;
4834 PCWSTR lpAssemblyEncodedAssemblyIdentity;
4835 PCWSTR lpAssemblyManifestPath;
4836 PCWSTR lpAssemblyPolicyPath;
4837 PCWSTR lpAssemblyDirectoryName;
4838 DWORD ulFileCount;
4839 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION;
4841 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX {
4842 DWORD ulAssemblyIndex;
4843 DWORD ulFileIndexInAssembly;
4844 } ACTIVATION_CONTEXT_QUERY_INDEX, *PACTIVATION_CONTEXT_QUERY_INDEX;
4846 typedef const struct _ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX;
4848 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION {
4849 DWORD ulFlags;
4850 DWORD ulFilenameLength;
4851 DWORD ulPathLength;
4852 PCWSTR lpFileName;
4853 PCWSTR lpFilePath;
4854 } ASSEMBLY_FILE_DETAILED_INFORMATION, *PASSEMBLY_FILE_DETAILED_INFORMATION;
4856 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION;
4858 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS {
4859 ActivationContextBasicInformation = 1,
4860 ActivationContextDetailedInformation = 2,
4861 AssemblyDetailedInformationInActivationContext = 3,
4862 FileInformationInAssemblyOfAssemblyInActivationContext = 4,
4863 MaxActivationContextInfoClass,
4865 AssemblyDetailedInformationInActivationContxt = 3,
4866 FileInformationInAssemblyOfAssemblyInActivationContxt = 4
4867 } ACTIVATION_CONTEXT_INFO_CLASS;
4869 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1
4870 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2
4871 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3
4872 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4
4874 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1
4875 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2
4876 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3
4877 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4
4878 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5
4879 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6
4880 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7
4881 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8
4882 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9
4884 #ifdef __cplusplus
4886 #endif
4888 #endif /* _WINNT_ */