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