Spelling fix.
[wine/multimedia.git] / include / winnt.h
blob425528502b93235875bd5a6bf45ba5839e7a18f8
1 /*
2 * Win32 definitions for Windows NT
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_WINNT_H
8 #define __WINE_WINNT_H
10 #include "basetsd.h"
11 #include "windef.h"
13 #ifndef RC_INVOKED
14 #include <ctype.h>
15 #include <string.h>
16 #endif
18 #include "pshpack1.h"
19 /* Defines */
21 /* Argument 1 passed to the DllEntryProc. */
22 #define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
23 #define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
24 #define DLL_THREAD_ATTACH 2 /* attach new thread */
25 #define DLL_THREAD_DETACH 3 /* detach thread */
28 /* u.x.wProcessorArchitecture (NT) */
29 #define PROCESSOR_ARCHITECTURE_INTEL 0
30 #define PROCESSOR_ARCHITECTURE_MIPS 1
31 #define PROCESSOR_ARCHITECTURE_ALPHA 2
32 #define PROCESSOR_ARCHITECTURE_PPC 3
33 #define PROCESSOR_ARCHITECTURE_SHX 4
34 #define PROCESSOR_ARCHITECTURE_ARM 5
35 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
37 /* dwProcessorType */
38 #define PROCESSOR_INTEL_386 386
39 #define PROCESSOR_INTEL_486 486
40 #define PROCESSOR_INTEL_PENTIUM 586
41 #define PROCESSOR_INTEL_860 860
42 #define PROCESSOR_MIPS_R2000 2000
43 #define PROCESSOR_MIPS_R3000 3000
44 #define PROCESSOR_MIPS_R4000 4000
45 #define PROCESSOR_ALPHA_21064 21064
46 #define PROCESSOR_PPC_601 601
47 #define PROCESSOR_PPC_603 603
48 #define PROCESSOR_PPC_604 604
49 #define PROCESSOR_PPC_620 620
50 #define PROCESSOR_HITACHI_SH3 10003
51 #define PROCESSOR_HITACHI_SH3E 10004
52 #define PROCESSOR_HITACHI_SH4 10005
53 #define PROCESSOR_MOTOROLA_821 821
54 #define PROCESSOR_SHx_SH3 103
55 #define PROCESSOR_SHx_SH4 104
56 #define PROCESSOR_STRONGARM 2577
57 #define PROCESSOR_ARM720 1824 /* 0x720 */
58 #define PROCESSOR_ARM820 2080 /* 0x820 */
59 #define PROCESSOR_ARM920 2336 /* 0x920 */
60 #define PROCESSOR_ARM_7TDMI 70001
62 typedef struct _MEMORY_BASIC_INFORMATION
64 LPVOID BaseAddress;
65 LPVOID AllocationBase;
66 DWORD AllocationProtect;
67 DWORD RegionSize;
68 DWORD State;
69 DWORD Protect;
70 DWORD Type;
71 } MEMORY_BASIC_INFORMATION,*LPMEMORY_BASIC_INFORMATION,*PMEMORY_BASIC_INFORMATION;
73 #define PAGE_NOACCESS 0x01
74 #define PAGE_READONLY 0x02
75 #define PAGE_READWRITE 0x04
76 #define PAGE_WRITECOPY 0x08
77 #define PAGE_EXECUTE 0x10
78 #define PAGE_EXECUTE_READ 0x20
79 #define PAGE_EXECUTE_READWRITE 0x40
80 #define PAGE_EXECUTE_WRITECOPY 0x80
81 #define PAGE_GUARD 0x100
82 #define PAGE_NOCACHE 0x200
84 #define MEM_COMMIT 0x00001000
85 #define MEM_RESERVE 0x00002000
86 #define MEM_DECOMMIT 0x00004000
87 #define MEM_RELEASE 0x00008000
88 #define MEM_FREE 0x00010000
89 #define MEM_PRIVATE 0x00020000
90 #define MEM_MAPPED 0x00040000
91 #define MEM_RESET 0x00080000
92 #define MEM_TOP_DOWN 0x00100000
93 #ifdef __WINE__
94 #define MEM_SYSTEM 0x80000000
95 #endif
97 #define SEC_FILE 0x00800000
98 #define SEC_IMAGE 0x01000000
99 #define SEC_RESERVE 0x04000000
100 #define SEC_COMMIT 0x08000000
101 #define SEC_NOCACHE 0x10000000
102 #define MEM_IMAGE SEC_IMAGE
105 #define MINCHAR 0x80
106 #define MAXCHAR 0x7f
107 #define MINSHORT 0x8000
108 #define MAXSHORT 0x7fff
109 #define MINLONG 0x80000000
110 #define MAXLONG 0x7fffffff
111 #define MAXBYTE 0xff
112 #define MAXWORD 0xffff
113 #define MAXDWORD 0xffffffff
115 #define FIELD_OFFSET(type, field) \
116 ((LONG)(INT)&(((type *)0)->field))
118 #define CONTAINING_RECORD(address, type, field) \
119 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
121 /* Types */
123 /* TCHAR data types definitions for Winelib. */
124 /* These types are _not_ defined for the emulator, because they */
125 /* depend on the UNICODE macro that only exists in user's code. */
127 #ifndef __WINE__
128 # ifdef UNICODE
129 typedef WCHAR TCHAR, *PTCHAR;
130 typedef LPWSTR PTSTR, LPTSTR;
131 typedef LPCWSTR PCTSTR, LPCTSTR;
132 #define __TEXT(string) L##string /*probably wrong */
133 # else /* UNICODE */
134 typedef char TCHAR, *PTCHAR;
135 typedef LPSTR PTSTR, LPTSTR;
136 typedef LPCSTR PCTSTR, LPCTSTR;
137 #define __TEXT(string) string
138 # endif /* UNICODE */
139 #endif /* __WINE__ */
140 #define TEXT(quote) __TEXT(quote)
142 typedef BYTE BOOLEAN;
143 typedef BOOLEAN *PBOOLEAN;
145 #ifndef _DWORDLONG_
146 #define _DWORDLONG_
147 typedef __uint64 DWORDLONG, *PDWORDLONG;
148 #endif
150 #ifndef _ULONGLONG_
151 #define _ULONGLONG_
152 typedef __int64 LONGLONG, *PLONGLONG;
153 typedef __uint64 ULONGLONG, *PULONGLONG;
154 #endif
156 typedef struct _LIST_ENTRY {
157 struct _LIST_ENTRY *Flink;
158 struct _LIST_ENTRY *Blink;
159 } LIST_ENTRY, *PLIST_ENTRY;
161 typedef struct _SINGLE_LIST_ENTRY {
162 struct _SINGLE_LIST_ENTRY *Next;
163 } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
165 /* Heap flags */
167 #define HEAP_NO_SERIALIZE 0x00000001
168 #define HEAP_GROWABLE 0x00000002
169 #define HEAP_GENERATE_EXCEPTIONS 0x00000004
170 #define HEAP_ZERO_MEMORY 0x00000008
171 #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
172 #define HEAP_TAIL_CHECKING_ENABLED 0x00000020
173 #define HEAP_FREE_CHECKING_ENABLED 0x00000040
174 #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
175 #define HEAP_CREATE_ALIGN_16 0x00010000
176 #define HEAP_CREATE_ENABLE_TRACING 0x00020000
178 /* This flag allows it to create heaps shared by all processes under win95,
179 FIXME: correct name */
180 #define HEAP_SHARED 0x04000000
182 #define HEAP_WINE_SEGPTR 0x10000000 /* Not a Win32 flag */
183 #define HEAP_WINE_CODESEG 0x20000000 /* Not a Win32 flag */
184 #define HEAP_WINE_CODE16SEG 0x40000000 /* Not a Win32 flag */
186 /* Processor feature flags. */
187 #define PF_FLOATING_POINT_PRECISION_ERRATA 0
188 #define PF_FLOATING_POINT_EMULATED 1
189 #define PF_COMPARE_EXCHANGE_DOUBLE 2
190 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3
191 #define PF_PPC_MOVEMEM_64BIT_OK 4
192 #define PF_ALPHA_BYTE_INSTRUCTIONS 5
195 /* The Win32 register context */
197 /* CONTEXT is the CPU-dependent context; it should be used */
198 /* wherever a platform-specific context is needed (e.g. exception */
199 /* handling, Win32 register functions). */
201 /* CONTEXT86 is the i386-specific context; it should be used */
202 /* wherever only a 386 context makes sense (e.g. DOS interrupts, */
203 /* Win16 register functions), so that this code can be compiled */
204 /* on all platforms. */
206 #define SIZE_OF_80387_REGISTERS 80
208 typedef struct _FLOATING_SAVE_AREA
210 DWORD ControlWord;
211 DWORD StatusWord;
212 DWORD TagWord;
213 DWORD ErrorOffset;
214 DWORD ErrorSelector;
215 DWORD DataOffset;
216 DWORD DataSelector;
217 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
218 DWORD Cr0NpxState;
219 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
221 typedef struct _CONTEXT86
223 DWORD ContextFlags;
225 /* These are selected by CONTEXT_DEBUG_REGISTERS */
226 DWORD Dr0;
227 DWORD Dr1;
228 DWORD Dr2;
229 DWORD Dr3;
230 DWORD Dr6;
231 DWORD Dr7;
233 /* These are selected by CONTEXT_FLOATING_POINT */
234 FLOATING_SAVE_AREA FloatSave;
236 /* These are selected by CONTEXT_SEGMENTS */
237 DWORD SegGs;
238 DWORD SegFs;
239 DWORD SegEs;
240 DWORD SegDs;
242 /* These are selected by CONTEXT_INTEGER */
243 DWORD Edi;
244 DWORD Esi;
245 DWORD Ebx;
246 DWORD Edx;
247 DWORD Ecx;
248 DWORD Eax;
250 /* These are selected by CONTEXT_CONTROL */
251 DWORD Ebp;
252 DWORD Eip;
253 DWORD SegCs;
254 DWORD EFlags;
255 DWORD Esp;
256 DWORD SegSs;
257 } CONTEXT86;
259 #define CONTEXT_X86 0x00010000
260 #define CONTEXT_i386 CONTEXT_X86
261 #define CONTEXT_i486 CONTEXT_X86
263 #define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
264 #define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
265 #define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
266 #define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
267 #define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
268 #define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
270 /* i386 context definitions */
271 #ifdef __i386__
273 #define CONTEXT_CONTROL CONTEXT86_CONTROL
274 #define CONTEXT_INTEGER CONTEXT86_INTEGER
275 #define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
276 #define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
277 #define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
278 #define CONTEXT_FULL CONTEXT86_FULL
280 typedef CONTEXT86 CONTEXT;
282 #endif /* __i386__ */
284 /* Alpha context definitions */
285 #ifdef _ALPHA_
287 #define CONTEXT_ALPHA 0x00020000
289 #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
290 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
291 #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
292 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
294 typedef struct _CONTEXT
296 /* selected by CONTEXT_FLOATING_POINT */
297 ULONGLONG FltF0;
298 ULONGLONG FltF1;
299 ULONGLONG FltF2;
300 ULONGLONG FltF3;
301 ULONGLONG FltF4;
302 ULONGLONG FltF5;
303 ULONGLONG FltF6;
304 ULONGLONG FltF7;
305 ULONGLONG FltF8;
306 ULONGLONG FltF9;
307 ULONGLONG FltF10;
308 ULONGLONG FltF11;
309 ULONGLONG FltF12;
310 ULONGLONG FltF13;
311 ULONGLONG FltF14;
312 ULONGLONG FltF15;
313 ULONGLONG FltF16;
314 ULONGLONG FltF17;
315 ULONGLONG FltF18;
316 ULONGLONG FltF19;
317 ULONGLONG FltF20;
318 ULONGLONG FltF21;
319 ULONGLONG FltF22;
320 ULONGLONG FltF23;
321 ULONGLONG FltF24;
322 ULONGLONG FltF25;
323 ULONGLONG FltF26;
324 ULONGLONG FltF27;
325 ULONGLONG FltF28;
326 ULONGLONG FltF29;
327 ULONGLONG FltF30;
328 ULONGLONG FltF31;
330 /* selected by CONTEXT_INTEGER */
331 ULONGLONG IntV0;
332 ULONGLONG IntT0;
333 ULONGLONG IntT1;
334 ULONGLONG IntT2;
335 ULONGLONG IntT3;
336 ULONGLONG IntT4;
337 ULONGLONG IntT5;
338 ULONGLONG IntT6;
339 ULONGLONG IntT7;
340 ULONGLONG IntS0;
341 ULONGLONG IntS1;
342 ULONGLONG IntS2;
343 ULONGLONG IntS3;
344 ULONGLONG IntS4;
345 ULONGLONG IntS5;
346 ULONGLONG IntFp;
347 ULONGLONG IntA0;
348 ULONGLONG IntA1;
349 ULONGLONG IntA2;
350 ULONGLONG IntA3;
351 ULONGLONG IntA4;
352 ULONGLONG IntA5;
353 ULONGLONG IntT8;
354 ULONGLONG IntT9;
355 ULONGLONG IntT10;
356 ULONGLONG IntT11;
357 ULONGLONG IntRa;
358 ULONGLONG IntT12;
359 ULONGLONG IntAt;
360 ULONGLONG IntGp;
361 ULONGLONG IntSp;
362 ULONGLONG IntZero;
364 /* selected by CONTEXT_FLOATING_POINT */
365 ULONGLONG Fpcr;
366 ULONGLONG SoftFpcr;
368 /* selected by CONTEXT_CONTROL */
369 ULONGLONG Fir;
370 DWORD Psr;
371 DWORD ContextFlags;
372 DWORD Fill[4];
373 } CONTEXT;
375 #define _QUAD_PSR_OFFSET HighSoftFpcr
376 #define _QUAD_FLAGS_OFFSET HighFir
378 #endif /* _ALPHA_ */
380 /* Mips context definitions */
381 #ifdef _MIPS_
383 #define CONTEXT_R4000 0x00010000
385 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
386 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
387 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
389 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
391 typedef struct _CONTEXT
393 DWORD Argument[4];
394 /* These are selected by CONTEXT_FLOATING_POINT */
395 DWORD FltF0;
396 DWORD FltF1;
397 DWORD FltF2;
398 DWORD FltF3;
399 DWORD FltF4;
400 DWORD FltF5;
401 DWORD FltF6;
402 DWORD FltF7;
403 DWORD FltF8;
404 DWORD FltF9;
405 DWORD FltF10;
406 DWORD FltF11;
407 DWORD FltF12;
408 DWORD FltF13;
409 DWORD FltF14;
410 DWORD FltF15;
411 DWORD FltF16;
412 DWORD FltF17;
413 DWORD FltF18;
414 DWORD FltF19;
415 DWORD FltF20;
416 DWORD FltF21;
417 DWORD FltF22;
418 DWORD FltF23;
419 DWORD FltF24;
420 DWORD FltF25;
421 DWORD FltF26;
422 DWORD FltF27;
423 DWORD FltF28;
424 DWORD FltF29;
425 DWORD FltF30;
426 DWORD FltF31;
428 /* These are selected by CONTEXT_INTEGER */
429 DWORD IntZero;
430 DWORD IntAt;
431 DWORD IntV0;
432 DWORD IntV1;
433 DWORD IntA0;
434 DWORD IntA1;
435 DWORD IntA2;
436 DWORD IntA3;
437 DWORD IntT0;
438 DWORD IntT1;
439 DWORD IntT2;
440 DWORD IntT3;
441 DWORD IntT4;
442 DWORD IntT5;
443 DWORD IntT6;
444 DWORD IntT7;
445 DWORD IntS0;
446 DWORD IntS1;
447 DWORD IntS2;
448 DWORD IntS3;
449 DWORD IntS4;
450 DWORD IntS5;
451 DWORD IntS6;
452 DWORD IntS7;
453 DWORD IntT8;
454 DWORD IntT9;
455 DWORD IntK0;
456 DWORD IntK1;
457 DWORD IntGp;
458 DWORD IntSp;
459 DWORD IntS8;
460 DWORD IntRa;
461 DWORD IntLo;
462 DWORD IntHi;
464 /* These are selected by CONTEXT_FLOATING_POINT */
465 DWORD Fsr;
467 /* These are selected by CONTEXT_CONTROL */
468 DWORD Fir;
469 DWORD Psr;
471 DWORD ContextFlags;
472 DWORD Fill[2];
473 } CONTEXT;
475 #endif /* _MIPS_ */
477 /* PowerPC context definitions */
478 #ifdef __PPC__
480 #define CONTEXT_CONTROL 0x0001
481 #define CONTEXT_FLOATING_POINT 0x0002
482 #define CONTEXT_INTEGER 0x0004
483 #define CONTEXT_DEBUG_REGISTERS 0x0008
484 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
486 typedef struct
488 /* These are selected by CONTEXT_FLOATING_POINT */
489 double Fpr0;
490 double Fpr1;
491 double Fpr2;
492 double Fpr3;
493 double Fpr4;
494 double Fpr5;
495 double Fpr6;
496 double Fpr7;
497 double Fpr8;
498 double Fpr9;
499 double Fpr10;
500 double Fpr11;
501 double Fpr12;
502 double Fpr13;
503 double Fpr14;
504 double Fpr15;
505 double Fpr16;
506 double Fpr17;
507 double Fpr18;
508 double Fpr19;
509 double Fpr20;
510 double Fpr21;
511 double Fpr22;
512 double Fpr23;
513 double Fpr24;
514 double Fpr25;
515 double Fpr26;
516 double Fpr27;
517 double Fpr28;
518 double Fpr29;
519 double Fpr30;
520 double Fpr31;
521 double Fpscr;
523 /* These are selected by CONTEXT_INTEGER */
524 DWORD Gpr0;
525 DWORD Gpr1;
526 DWORD Gpr2;
527 DWORD Gpr3;
528 DWORD Gpr4;
529 DWORD Gpr5;
530 DWORD Gpr6;
531 DWORD Gpr7;
532 DWORD Gpr8;
533 DWORD Gpr9;
534 DWORD Gpr10;
535 DWORD Gpr11;
536 DWORD Gpr12;
537 DWORD Gpr13;
538 DWORD Gpr14;
539 DWORD Gpr15;
540 DWORD Gpr16;
541 DWORD Gpr17;
542 DWORD Gpr18;
543 DWORD Gpr19;
544 DWORD Gpr20;
545 DWORD Gpr21;
546 DWORD Gpr22;
547 DWORD Gpr23;
548 DWORD Gpr24;
549 DWORD Gpr25;
550 DWORD Gpr26;
551 DWORD Gpr27;
552 DWORD Gpr28;
553 DWORD Gpr29;
554 DWORD Gpr30;
555 DWORD Gpr31;
557 DWORD Cr;
558 DWORD Xer;
560 /* These are selected by CONTEXT_CONTROL */
561 DWORD Msr;
562 DWORD Iar;
563 DWORD Lr;
564 DWORD Ctr;
566 DWORD ContextFlags;
567 DWORD Fill[3];
569 /* These are selected by CONTEXT_DEBUG_REGISTERS */
570 DWORD Dr0;
571 DWORD Dr1;
572 DWORD Dr2;
573 DWORD Dr3;
574 DWORD Dr4;
575 DWORD Dr5;
576 DWORD Dr6;
577 DWORD Dr7;
578 } CONTEXT;
580 typedef struct _STACK_FRAME_HEADER
582 DWORD BackChain;
583 DWORD GlueSaved1;
584 DWORD GlueSaved2;
585 DWORD Reserved1;
586 DWORD Spare1;
587 DWORD Spare2;
589 DWORD Parameter0;
590 DWORD Parameter1;
591 DWORD Parameter2;
592 DWORD Parameter3;
593 DWORD Parameter4;
594 DWORD Parameter5;
595 DWORD Parameter6;
596 DWORD Parameter7;
597 } STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
599 #endif /* __PPC__ */
601 #ifdef __sparc__
604 * FIXME:
606 * There is no official CONTEXT structure defined for the SPARC
607 * architecture, so I just made one up.
609 * This structure is valid only for 32-bit SPARC architectures,
610 * not for 64-bit SPARC.
612 * Note that this structure contains only the 'top-level' registers;
613 * the rest of the register window chain is not visible.
615 * The layout follows the Solaris 'prgregset_t' structure.
619 #define CONTEXT_SPARC 0x10000000
621 #define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
622 #define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
623 #define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
625 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
627 typedef struct _CONTEXT
629 DWORD ContextFlags;
631 /* These are selected by CONTEXT_INTEGER */
632 DWORD g0;
633 DWORD g1;
634 DWORD g2;
635 DWORD g3;
636 DWORD g4;
637 DWORD g5;
638 DWORD g6;
639 DWORD g7;
640 DWORD o0;
641 DWORD o1;
642 DWORD o2;
643 DWORD o3;
644 DWORD o4;
645 DWORD o5;
646 DWORD o6;
647 DWORD o7;
648 DWORD l0;
649 DWORD l1;
650 DWORD l2;
651 DWORD l3;
652 DWORD l4;
653 DWORD l5;
654 DWORD l6;
655 DWORD l7;
656 DWORD i0;
657 DWORD i1;
658 DWORD i2;
659 DWORD i3;
660 DWORD i4;
661 DWORD i5;
662 DWORD i6;
663 DWORD i7;
665 /* These are selected by CONTEXT_CONTROL */
666 DWORD psr;
667 DWORD pc;
668 DWORD npc;
669 DWORD y;
670 DWORD wim;
671 DWORD tbr;
673 /* FIXME: floating point registers missing */
675 } CONTEXT;
677 #endif /* __sparc__ */
679 #if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
680 #error You need to define a CONTEXT for your CPU
681 #endif
683 typedef CONTEXT *PCONTEXT;
684 typedef HANDLE *PHANDLE;
686 #ifdef __WINE__
688 /* Macros for easier access to i386 context registers */
690 #define AX_reg(context) (*(WORD*)&(context)->Eax)
691 #define BX_reg(context) (*(WORD*)&(context)->Ebx)
692 #define CX_reg(context) (*(WORD*)&(context)->Ecx)
693 #define DX_reg(context) (*(WORD*)&(context)->Edx)
694 #define SI_reg(context) (*(WORD*)&(context)->Esi)
695 #define DI_reg(context) (*(WORD*)&(context)->Edi)
696 #define BP_reg(context) (*(WORD*)&(context)->Ebp)
698 #define AL_reg(context) (*(BYTE*)&(context)->Eax)
699 #define AH_reg(context) (*((BYTE*)&(context)->Eax + 1))
700 #define BL_reg(context) (*(BYTE*)&(context)->Ebx)
701 #define BH_reg(context) (*((BYTE*)&(context)->Ebx + 1))
702 #define CL_reg(context) (*(BYTE*)&(context)->Ecx)
703 #define CH_reg(context) (*((BYTE*)&(context)->Ecx + 1))
704 #define DL_reg(context) (*(BYTE*)&(context)->Edx)
705 #define DH_reg(context) (*((BYTE*)&(context)->Edx + 1))
707 #define SET_CFLAG(context) ((context)->EFlags |= 0x0001)
708 #define RESET_CFLAG(context) ((context)->EFlags &= ~0x0001)
709 #define SET_ZFLAG(context) ((context)->EFlags |= 0x0040)
710 #define RESET_ZFLAG(context) ((context)->EFlags &= ~0x0040)
711 #define ISV86(context) ((context)->EFlags & 0x00020000)
714 /* Macros to retrieve the current context */
716 #ifdef __i386__
718 #ifdef NEED_UNDERSCORE_PREFIX
719 # define __ASM_NAME(name) "_" name
720 #else
721 # define __ASM_NAME(name) name
722 #endif
724 #ifdef NEED_TYPE_IN_DEF
725 # define __ASM_FUNC(name) ".def " __ASM_NAME(name) "; .scl 2; .type 32; .endef"
726 #else
727 # define __ASM_FUNC(name) ".type " __ASM_NAME(name) ",@function"
728 #endif
730 #ifdef __GNUC__
731 # define __ASM_GLOBAL_FUNC(name,code) \
732 __asm__( ".align 4\n\t" \
733 ".globl " __ASM_NAME(#name) "\n\t" \
734 __ASM_FUNC(#name) "\n" \
735 __ASM_NAME(#name) ":\n\t" \
736 code );
737 #else /* __GNUC__ */
738 # define __ASM_GLOBAL_FUNC(name,code) \
739 void __asm_dummy_##name(void) { \
740 asm( ".align 4\n\t" \
741 ".globl " __ASM_NAME(#name) "\n\t" \
742 __ASM_FUNC(#name) "\n" \
743 __ASM_NAME(#name) ":\n\t" \
744 code ); \
746 #endif /* __GNUC__ */
748 #define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
749 __ASM_GLOBAL_FUNC( name, \
750 "call " __ASM_NAME("CALL32_Regs") "\n\t" \
751 ".long " __ASM_NAME(#fn) "\n\t" \
752 ".byte " #args ", " #args )
753 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
754 extern void WINAPI name(void); \
755 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
756 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
757 extern void WINAPI name( t1 a1 ); \
758 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
759 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
760 extern void WINAPI name( t1 a1, t2 a2 ); \
761 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
762 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
763 extern void WINAPI name( t1 a1, t2 a2, t3 a3 ); \
764 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
765 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
766 extern void WINAPI name( t1 a1, t2 a2, t3 a3, t4 a4 ); \
767 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
769 #endif /* __i386__ */
771 #ifdef __sparc__
772 /* FIXME: use getcontext() to retrieve full context */
773 #define _GET_CONTEXT \
774 CONTEXT context; \
775 do { memset(&context, 0, sizeof(CONTEXT)); \
776 context.ContextFlags = CONTEXT_CONTROL; \
777 context.pc = (DWORD)__builtin_return_address(0); \
778 } while (0)
780 #define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
781 void WINAPI name ( void ) \
782 { _GET_CONTEXT; fn( &context ); }
783 #define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
784 void WINAPI name ( t1 a1 ) \
785 { _GET_CONTEXT; fn( a1, &context ); }
786 #define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
787 void WINAPI name ( t1 a1, t2 a2 ) \
788 { _GET_CONTEXT; fn( a1, a2, &context ); }
789 #define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
790 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
791 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
792 #define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
793 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
794 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
796 #endif /* __sparc__ */
798 #ifndef DEFINE_REGS_ENTRYPOINT_0
799 #error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
800 #endif
802 /* Constructor functions */
804 #ifdef __GNUC__
805 # define DECL_GLOBAL_CONSTRUCTOR(func) \
806 static void func(void) __attribute__((constructor)); \
807 static void func(void)
808 #else /* __GNUC__ */
809 # ifdef __i386__
810 # define DECL_GLOBAL_CONSTRUCTOR(func) \
811 static void __dummy_init_##func(void) { \
812 asm(".section .init,\"ax\"\n\t" \
813 "call " #func "\n\t" \
814 ".previous"); } \
815 static void func(void)
816 # else /* __i386__ */
817 # error You must define the DECL_GLOBAL_CONSTRUCTOR macro for your platform
818 # endif
819 #endif /* __GNUC__ */
821 /* Segment register access */
823 #ifdef __i386__
824 # ifdef __GNUC__
825 # define __DEFINE_GET_SEG(seg) \
826 extern inline unsigned short __get_##seg(void) \
827 { unsigned short res; __asm__("movw %%" #seg ",%w0" : "=r"(res)); return res; }
828 # define __DEFINE_SET_SEG(seg) \
829 extern inline void __set_##seg(int val) { __asm__("movw %w0,%%" #seg : : "r" (val)); }
830 # else /* __GNUC__ */
831 # define __DEFINE_GET_SEG(seg) extern unsigned short __get_##seg(void);
832 # define __DEFINE_SET_SEG(seg) extern void __set_##seg(unsigned int);
833 # endif /* __GNUC__ */
834 #else /* __i386__ */
835 # define __DEFINE_GET_SEG(seg) inline static unsigned short __get_##seg(void) { return 0; }
836 # define __DEFINE_SET_SEG(seg) /* nothing */
837 #endif /* __i386__ */
839 __DEFINE_GET_SEG(cs)
840 __DEFINE_GET_SEG(ds)
841 __DEFINE_GET_SEG(es)
842 __DEFINE_GET_SEG(fs)
843 __DEFINE_GET_SEG(gs)
844 __DEFINE_GET_SEG(ss)
845 __DEFINE_SET_SEG(fs)
846 __DEFINE_SET_SEG(gs)
847 #undef __DEFINE_GET_SEG
848 #undef __DEFINE_SET_SEG
850 #endif /* __WINE__ */
855 * Language IDs
858 #define MAKELCID(l, s) (MAKELONG(l, s))
860 #define MAKELANGID(p, s) ((((WORD)(s))<<10) | (WORD)(p))
861 #define PRIMARYLANGID(l) ((WORD)(l) & 0x3ff)
862 #define SUBLANGID(l) ((WORD)(l) >> 10)
864 #define LANGIDFROMLCID(lcid) ((WORD)(lcid))
865 #define SORTIDFROMLCID(lcid) ((WORD)((((DWORD)(lcid)) >> 16) & 0x0f))
867 #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT))
868 #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT))
869 #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT))
870 #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT))
871 #define LOCALE_NEUTRAL (MAKELCID(MAKELANGID(LANG_NEUTRAL,SUBLANG_NEUTRAL),SORT_DEFAULT))
873 /* FIXME: are the symbolic names correct for LIDs: 0x17, 0x20, 0x28,
874 * 0x2a, 0x2b, 0x2c, 0x2f, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35,
875 * 0x37, 0x39, 0x3a, 0x3b, 0x3c, 0x3e, 0x3f, 0x41, 0x43, 0x44,
876 * 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e,
877 * 0x4f, 0x57
879 #define LANG_NEUTRAL 0x00
880 #define LANG_AFRIKAANS 0x36
881 #define LANG_ALBANIAN 0x1c
882 #define LANG_ARABIC 0x01
883 #define LANG_ARMENIAN 0x2b
884 #define LANG_ASSAMESE 0x4d
885 #define LANG_AZERI 0x2c
886 #define LANG_BASQUE 0x2d
887 #define LANG_BENGALI 0x45
888 #define LANG_BULGARIAN 0x02
889 #define LANG_BYELORUSSIAN 0x23
890 #define LANG_CATALAN 0x03
891 #define LANG_CHINESE 0x04
892 #define LANG_SERBO_CROATIAN 0x1a
893 #define LANG_CROATIAN LANG_SERBO_CROATIAN
894 #define LANG_SERBIAN LANG_SERBO_CROATIAN
895 #define LANG_CZECH 0x05
896 #define LANG_DANISH 0x06
897 #define LANG_DUTCH 0x13
898 #define LANG_ENGLISH 0x09
899 #define LANG_ESTONIAN 0x25
900 #define LANG_FAEROESE 0x38
901 #define LANG_FARSI 0x29
902 #define LANG_FINNISH 0x0b
903 #define LANG_FRENCH 0x0c
904 #define LANG_GAELIC 0x3c
905 #define LANG_GEORGIAN 0x37
906 #define LANG_GERMAN 0x07
907 #define LANG_GREEK 0x08
908 #define LANG_GUJARATI 0x47
909 #define LANG_HEBREW 0x0D
910 #define LANG_HINDI 0x39
911 #define LANG_HUNGARIAN 0x0e
912 #define LANG_ICELANDIC 0x0f
913 #define LANG_INDONESIAN 0x21
914 #define LANG_ITALIAN 0x10
915 #define LANG_JAPANESE 0x11
916 #define LANG_KANNADA 0x4b
917 #define LANG_KAZAKH 0x3f
918 #define LANG_KONKANI 0x57
919 #define LANG_KOREAN 0x12
920 #define LANG_LATVIAN 0x26
921 #define LANG_LITHUANIAN 0x27
922 #define LANG_MACEDONIAN 0x2f
923 #define LANG_MALAY 0x3e
924 #define LANG_MALAYALAM 0x4c
925 #define LANG_MALTESE 0x3a
926 #define LANG_MAORI 0x28
927 #define LANG_MARATHI 0x4e
928 #define LANG_NORWEGIAN 0x14
929 #define LANG_ORIYA 0x48
930 #define LANG_POLISH 0x15
931 #define LANG_PORTUGUESE 0x16
932 #define LANG_PUNJABI 0x46
933 #define LANG_RHAETO_ROMANCE 0x17
934 #define LANG_ROMANIAN 0x18
935 #define LANG_RUSSIAN 0x19
936 #define LANG_SAAMI 0x3b
937 #define LANG_SANSKRIT 0x4f
938 #define LANG_SLOVAK 0x1b
939 #define LANG_SLOVENIAN 0x24
940 #define LANG_SORBIAN 0x2e
941 #define LANG_SPANISH 0x0a
942 #define LANG_SUTU 0x30
943 #define LANG_SWAHILI 0x41
944 #define LANG_SWEDISH 0x1d
945 #define LANG_TAMIL 0x49
946 #define LANG_TATAR 0x44
947 #define LANG_TELUGU 0x4a
948 #define LANG_THAI 0x1e
949 #define LANG_TSONGA 0x31
950 #define LANG_TSWANA 0x32
951 #define LANG_TURKISH 0x1f
952 #define LANG_UKRAINIAN 0x22
953 #define LANG_URDU 0x20
954 #define LANG_UZBEK 0x43
955 #define LANG_VENDA 0x33
956 #define LANG_VIETNAMESE 0x2a
957 #define LANG_XHOSA 0x34
958 #define LANG_ZULU 0x35
959 /* non standard; keep the number high enough (but < 0xff) */
960 #define LANG_ESPERANTO 0x8f
961 #define LANG_WALON 0x90
962 #define LANG_CORNISH 0x91
963 #define LANG_WELSH 0x92
964 #define LANG_BRETON 0x93
966 /* Sublanguage definitions */
967 #define SUBLANG_NEUTRAL 0x00 /* language neutral */
968 #define SUBLANG_DEFAULT 0x01 /* user default */
969 #define SUBLANG_SYS_DEFAULT 0x02 /* system default */
971 #define SUBLANG_ARABIC 0x01
972 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
973 #define SUBLANG_ARABIC_IRAQ 0x02
974 #define SUBLANG_ARABIC_EGYPT 0x03
975 #define SUBLANG_ARABIC_LIBYA 0x04
976 #define SUBLANG_ARABIC_ALGERIA 0x05
977 #define SUBLANG_ARABIC_MOROCCO 0x06
978 #define SUBLANG_ARABIC_TUNISIA 0x07
979 #define SUBLANG_ARABIC_OMAN 0x08
980 #define SUBLANG_ARABIC_YEMEN 0x09
981 #define SUBLANG_ARABIC_SYRIA 0x0a
982 #define SUBLANG_ARABIC_JORDAN 0x0b
983 #define SUBLANG_ARABIC_LEBANON 0x0c
984 #define SUBLANG_ARABIC_KUWAIT 0x0d
985 #define SUBLANG_ARABIC_UAE 0x0e
986 #define SUBLANG_ARABIC_BAHRAIN 0x0f
987 #define SUBLANG_ARABIC_QATAR 0x10
988 #define SUBLANG_CHINESE_TRADITIONAL 0x01
989 #define SUBLANG_CHINESE_SIMPLIFIED 0x02
990 #define SUBLANG_CHINESE_HONGKONG 0x03
991 #define SUBLANG_CHINESE_SINGAPORE 0x04
992 #define SUBLANG_CHINESE_MACAU 0x05
993 #define SUBLANG_DUTCH 0x01
994 #define SUBLANG_DUTCH_BELGIAN 0x02
995 #define SUBLANG_DUTCH_SURINAM 0x03
996 #define SUBLANG_ENGLISH_US 0x01
997 #define SUBLANG_ENGLISH_UK 0x02
998 #define SUBLANG_ENGLISH_AUS 0x03
999 #define SUBLANG_ENGLISH_CAN 0x04
1000 #define SUBLANG_ENGLISH_NZ 0x05
1001 #define SUBLANG_ENGLISH_EIRE 0x06
1002 #define SUBLANG_ENGLISH_SAFRICA 0x07
1003 #define SUBLANG_ENGLISH_JAMAICA 0x08
1004 #define SUBLANG_ENGLISH_CARRIBEAN 0x09
1005 #define SUBLANG_ENGLISH_BELIZE 0x0a
1006 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
1007 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
1008 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
1009 #define SUBLANG_FRENCH 0x01
1010 #define SUBLANG_FRENCH_BELGIAN 0x02
1011 #define SUBLANG_FRENCH_CANADIAN 0x03
1012 #define SUBLANG_FRENCH_SWISS 0x04
1013 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
1014 #define SUBLANG_FRENCH_MONACO 0x06
1015 #define SUBLANG_GERMAN 0x01
1016 #define SUBLANG_GERMAN_SWISS 0x02
1017 #define SUBLANG_GERMAN_AUSTRIAN 0x03
1018 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
1019 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
1020 #define SUBLANG_ITALIAN 0x01
1021 #define SUBLANG_ITALIAN_SWISS 0x02
1022 #define SUBLANG_KOREAN 0x01
1023 #define SUBLANG_KOREAN_JOHAB 0x02
1024 #define SUBLANG_NORWEGIAN_BOKMAL 0x01
1025 #define SUBLANG_NORWEGIAN_NYNORSK 0x02
1026 #define SUBLANG_PORTUGUESE 0x02
1027 #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01
1028 #define SUBLANG_SPANISH 0x01
1029 #define SUBLANG_SPANISH_MEXICAN 0x02
1030 #define SUBLANG_SPANISH_MODERN 0x03
1031 #define SUBLANG_SPANISH_GUATEMALA 0x04
1032 #define SUBLANG_SPANISH_COSTARICA 0x05
1033 #define SUBLANG_SPANISH_PANAMA 0x06
1034 #define SUBLANG_SPANISH_DOMINICAN 0x07
1035 #define SUBLANG_SPANISH_VENEZUELA 0x08
1036 #define SUBLANG_SPANISH_COLOMBIA 0x09
1037 #define SUBLANG_SPANISH_PERU 0x0a
1038 #define SUBLANG_SPANISH_ARGENTINA 0x0b
1039 #define SUBLANG_SPANISH_ECUADOR 0x0c
1040 #define SUBLANG_SPANISH_CHILE 0x0d
1041 #define SUBLANG_SPANISH_URUGUAY 0x0e
1042 #define SUBLANG_SPANISH_PARAGUAY 0x0f
1043 #define SUBLANG_SPANISH_BOLIVIA 0x10
1044 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
1045 #define SUBLANG_SPANISH_HONDURAS 0x12
1046 #define SUBLANG_SPANISH_NICARAGUA 0x13
1047 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
1048 /* FIXME: I don't know the symbolic names for those */
1049 #define SUBLANG_ROMANIAN 0x01
1050 #define SUBLANG_ROMANIAN_MOLDAVIA 0x02
1051 #define SUBLANG_RUSSIAN 0x01
1052 #define SUBLANG_RUSSIAN_MOLDAVIA 0x02
1053 #define SUBLANG_CROATIAN 0x01
1054 #define SUBLANG_SERBIAN 0x02
1055 #define SUBLANG_SERBIAN_LATIN 0x03
1056 #define SUBLANG_SWEDISH 0x01
1057 #define SUBLANG_SWEDISH_FINLAND 0x02
1058 #define SUBLANG_LITHUANIAN 0x01
1059 #define SUBLANG_LITHUANIAN_CLASSIC 0x02
1060 #define SUBLANG_AZERI 0x01
1061 #define SUBLANG_AZERI_CYRILLIC 0x02
1062 #define SUBLANG_GAELIC 0x01
1063 #define SUBLANG_GAELIC_SCOTTISH 0x02
1064 #define SUBLANG_GAELIC_MANX 0x03
1065 #define SUBLANG_MALAY 0x01
1066 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
1067 #define SUBLANG_UZBEK 0x01
1068 #define SUBLANG_UZBEK_CYRILLIC 0x02
1069 #define SUBLANG_URDU_PAKISTAN 0x01
1074 * Sort definitions
1077 #define SORT_DEFAULT 0x0
1078 #define SORT_JAPANESE_XJIS 0x0
1079 #define SORT_JAPANESE_UNICODE 0x1
1080 #define SORT_CHINESE_BIG5 0x0
1081 #define SORT_CHINESE_UNICODE 0x1
1082 #define SORT_KOREAN_KSC 0x0
1083 #define SORT_KOREAN_UNICODE 0x1
1088 * Definitions for IsTextUnicode()
1091 #define IS_TEXT_UNICODE_ASCII16 0x0001
1092 #define IS_TEXT_UNICODE_STATISTICS 0x0002
1093 #define IS_TEXT_UNICODE_CONTROLS 0x0004
1094 #define IS_TEXT_UNICODE_SIGNATURE 0x0008
1095 #define IS_TEXT_UNICODE_UNICODE_MASK 0x000F
1096 #define IS_TEXT_UNICODE_REVERSE_ASCII16 0x0010
1097 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 0x0020
1098 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 0x0040
1099 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 0x0080
1100 #define IS_TEXT_UNICODE_REVERSE_MASK 0x00F0
1101 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 0x0100
1102 #define IS_TEXT_UNICODE_ODD_LENGTH 0x0200
1103 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 0x0400
1104 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 0x0F00
1105 #define IS_TEXT_UNICODE_NULL_BYTES 0x1000
1106 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 0xF000
1111 * Exception codes
1114 #define STATUS_SUCCESS 0x00000000
1115 #define STATUS_WAIT_0 0x00000000
1116 #define STATUS_ABANDONED_WAIT_0 0x00000080
1117 #define STATUS_USER_APC 0x000000C0
1118 #define STATUS_TIMEOUT 0x00000102
1119 #define STATUS_PENDING 0x00000103
1121 #define STATUS_GUARD_PAGE_VIOLATION 0x80000001
1122 #define STATUS_DATATYPE_MISALIGNMENT 0x80000002
1123 #define STATUS_BREAKPOINT 0x80000003
1124 #define STATUS_SINGLE_STEP 0x80000004
1125 #define STATUS_BUFFER_OVERFLOW 0x80000005
1126 #define STATUS_NO_MORE_FILES 0x80000006
1127 #define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
1129 #define STATUS_HANDLES_CLOSED 0x8000000A
1130 #define STATUS_NO_INHERITANCE 0x8000000B
1131 #define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
1132 #define STATUS_PARTIAL_COPY 0x8000000D
1133 #define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
1134 #define STATUS_DEVICE_POWERED_OFF 0x8000000F
1135 #define STATUS_DEVICE_OFF_LINE 0x80000010
1136 #define STATUS_DEVICE_BUSY 0x80000011
1137 #define STATUS_NO_MORE_EAS 0x80000012
1138 #define STATUS_INVALID_EA_NAME 0x80000013
1139 #define STATUS_EA_LIST_INCONSISTENT 0x80000014
1140 #define STATUS_INVALID_EA_FLAG 0x80000015
1141 #define STATUS_VERIFY_REQUIRED 0x80000016
1142 #define STATUS_EXTRANEOUS_INFORMATION 0x80000017
1143 #define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
1144 #define STATUS_NO_MORE_ENTRIES 0x8000001A
1145 #define STATUS_FILEMARK_DETECTED 0x8000001B
1146 #define STATUS_MEDIA_CHANGED 0x8000001C
1147 #define STATUS_BUS_RESET 0x8000001D
1148 #define STATUS_END_OF_MEDIA 0x8000001E
1149 #define STATUS_BEGINNING_OF_MEDIA 0x8000001F
1150 #define STATUS_MEDIA_CHECK 0x80000020
1151 #define STATUS_SETMARK_DETECTED 0x80000021
1152 #define STATUS_NO_DATA_DETECTED 0x80000022
1153 #define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
1154 #define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
1155 #define STATUS_ALREADY_DISCONNECTED 0x80000025
1156 #define STATUS_LONGJUMP 0x80000026
1158 #define STATUS_UNSUCCESSFUL 0xC0000001
1159 #define STATUS_NOT_IMPLEMENTED 0xC0000002
1160 #define STATUS_INVALID_INFO_CLASS 0xC0000003
1161 #define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
1162 #define STATUS_ACCESS_VIOLATION 0xC0000005
1163 #define STATUS_IN_PAGE_ERROR 0xC0000006
1164 #define STATUS_PAGEFILE_QUOTA 0xC0000007
1165 #define STATUS_INVALID_HANDLE 0xC0000008
1166 #define STATUS_BAD_INITIAL_STACK 0xC0000009
1167 #define STATUS_BAD_INITIAL_PC 0xC000000A
1168 #define STATUS_INVALID_CID 0xC000000B
1169 #define STATUS_TIMER_NOT_CANCELED 0xC000000C
1170 #define STATUS_INVALID_PARAMETER 0xC000000D
1171 #define STATUS_NO_SUCH_DEVICE 0xC000000E
1172 #define STATUS_NO_SUCH_FILE 0xC000000F
1173 #define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
1174 #define STATUS_END_OF_FILE 0xC0000011
1175 #define STATUS_WRONG_VOLUME 0xC0000012
1176 #define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
1177 #define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
1178 #define STATUS_NONEXISTENT_SECTOR 0xC0000015
1179 #define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
1180 #define STATUS_NO_MEMORY 0xC0000017
1181 #define STATUS_CONFLICTING_ADDRESSES 0xC0000018
1182 #define STATUS_NOT_MAPPED_VIEW 0xC0000019
1183 #define STATUS_UNABLE_TO_FREE_VM 0xC000001A
1184 #define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
1185 #define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
1186 #define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
1187 #define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
1188 #define STATUS_INVALID_VIEW_SIZE 0xC000001F
1189 #define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
1190 #define STATUS_ALREADY_COMMITTED 0xC0000021
1191 #define STATUS_ACCESS_DENIED 0xC0000022
1192 #define STATUS_BUFFER_TOO_SMALL 0xC0000023
1193 #define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
1194 #define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
1195 #define STATUS_INVALID_DISPOSITION 0xC0000026
1196 #define STATUS_UNWIND 0xC0000027
1197 #define STATUS_BAD_STACK 0xC0000028
1198 #define STATUS_INVALID_UNWIND_TARGET 0xC0000029
1199 #define STATUS_NOT_LOCKED 0xC000002A
1200 #define STATUS_PARITY_ERROR 0xC000002B
1201 #define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
1202 #define STATUS_NOT_COMMITTED 0xC000002D
1203 #define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
1204 #define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
1205 #define STATUS_INVALID_PARAMETER_MIX 0xC0000030
1206 #define STATUS_INVALID_QUOTA_LOWER 0xC0000031
1207 #define STATUS_DISK_CORRUPT_ERROR 0xC0000032
1208 #define STATUS_OBJECT_NAME_INVALID 0xC0000033
1209 #define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
1210 #define STATUS_OBJECT_NAME_COLLISION 0xC0000035
1211 #define STATUS_PORT_DISCONNECTED 0xC0000037
1212 #define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
1213 #define STATUS_OBJECT_PATH_INVALID 0xC0000039
1214 #define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
1215 #define STATUS_PATH_SYNTAX_BAD 0xC000003B
1216 #define STATUS_DATA_OVERRUN 0xC000003C
1217 #define STATUS_DATA_LATE_ERROR 0xC000003D
1218 #define STATUS_DATA_ERROR 0xC000003E
1219 #define STATUS_CRC_ERROR 0xC000003F
1220 #define STATUS_SECTION_TOO_BIG 0xC0000040
1221 #define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
1222 #define STATUS_INVALID_PORT_HANDLE 0xC0000042
1223 #define STATUS_SHARING_VIOLATION 0xC0000043
1224 #define STATUS_QUOTA_EXCEEDED 0xC0000044
1225 #define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
1226 #define STATUS_MUTANT_NOT_OWNED 0xC0000046
1227 #define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
1228 #define STATUS_PORT_ALREADY_SET 0xC0000048
1229 #define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
1230 #define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
1231 #define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
1232 #define STATUS_UNKNOWN_REVISION 0xC0000058
1233 #define STATUS_INVALID_SECURITY_DESCR 0xC0000079
1234 #define STATUS_DISK_FULL 0xC000007F
1235 #define STATUS_SECTION_NOT_EXTENDED 0xC0000087
1236 #define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
1237 #define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
1238 #define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
1239 #define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
1240 #define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
1241 #define STATUS_FLOAT_OVERFLOW 0xC0000091
1242 #define STATUS_FLOAT_STACK_CHECK 0xC0000092
1243 #define STATUS_FLOAT_UNDERFLOW 0xC0000093
1244 #define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
1245 #define STATUS_INTEGER_OVERFLOW 0xC0000095
1246 #define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
1247 #define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
1248 #define STATUS_INVALID_PARAMETER_2 0xC00000F0
1249 #define STATUS_STACK_OVERFLOW 0xC00000FD
1250 #define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
1251 #define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
1252 #define STATUS_CONTROL_C_EXIT 0xC000013A
1253 #define STATUS_PIPE_BROKEN 0xC000014B
1254 #define STATUS_NOT_REGISTRY_FILE 0xC000015C
1255 #define STATUS_PARTITION_FAILURE 0xC0000172
1256 #define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
1257 #define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
1258 #define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
1259 #define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
1260 #define STATUS_EOM_OVERFLOW 0xC0000177
1261 #define STATUS_NO_MEDIA 0xC0000178
1262 #define STATUS_NO_SUCH_MEMBER 0xC000017A
1263 #define STATUS_INVALID_MEMBER 0xC000017B
1264 #define STATUS_KEY_DELETED 0xC000017C
1265 #define STATUS_NO_LOG_SPACE 0xC000017D
1266 #define STATUS_TOO_MANY_SIDS 0xC000017E
1267 #define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
1268 #define STATUS_KEY_HAS_CHILDREN 0xC0000180
1269 #define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
1270 #define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
1271 #define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
1272 #define STATUS_INVALID_DEVICE_STATE 0xC0000184
1273 #define STATUS_IO_DEVICE_ERROR 0xC0000185
1274 #define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
1275 #define STATUS_BACKUP_CONTROLLER 0xC0000187
1276 #define STATUS_LOG_FILE_FULL 0xC0000188
1277 #define STATUS_TOO_LATE 0xC0000189
1278 #define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
1279 #define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
1280 #define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
1281 #define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
1282 #define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
1283 #define STATUS_EVENTLOG_CANT_START 0xC000018F
1284 #define STATUS_TRUST_FAILURE 0xC0000190
1285 #define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
1286 #define STATUS_NETLOGON_NOT_STARTED 0xC0000192
1287 #define STATUS_ACCOUNT_EXPIRED 0xC0000193
1288 #define STATUS_POSSIBLE_DEADLOCK 0xC0000194
1289 #define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
1290 #define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
1291 #define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
1292 #define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
1293 #define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
1294 #define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
1295 #define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
1296 #define STATUS_FS_DRIVER_REQUIRED 0xC000019C
1298 #define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
1300 #define MAXIMUM_WAIT_OBJECTS 64
1301 #define MAXIMUM_SUSPEND_COUNT 127
1305 * Return values from the actual exception handlers
1308 #define ExceptionContinueExecution 0
1309 #define ExceptionContinueSearch 1
1310 #define ExceptionNestedException 2
1311 #define ExceptionCollidedUnwind 3
1314 * Return values from filters in except() and from UnhandledExceptionFilter
1317 #define EXCEPTION_EXECUTE_HANDLER 1
1318 #define EXCEPTION_CONTINUE_SEARCH 0
1319 #define EXCEPTION_CONTINUE_EXECUTION -1
1322 * From OS/2 2.0 exception handling
1323 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
1326 #define EH_NONCONTINUABLE 0x01
1327 #define EH_UNWINDING 0x02
1328 #define EH_EXIT_UNWIND 0x04
1329 #define EH_STACK_INVALID 0x08
1330 #define EH_NESTED_CALL 0x10
1332 #define EXCEPTION_CONTINUABLE 0
1333 #define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
1336 * The exception record used by Win32 to give additional information
1337 * about exception to exception handlers.
1340 #define EXCEPTION_MAXIMUM_PARAMETERS 15
1342 typedef struct __EXCEPTION_RECORD
1344 DWORD ExceptionCode;
1345 DWORD ExceptionFlags;
1346 struct __EXCEPTION_RECORD *ExceptionRecord;
1348 LPVOID ExceptionAddress;
1349 DWORD NumberParameters;
1350 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1351 } EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1354 * The exception pointers structure passed to exception filters
1355 * in except() and the UnhandledExceptionFilter().
1358 typedef struct _EXCEPTION_POINTERS
1360 PEXCEPTION_RECORD ExceptionRecord;
1361 PCONTEXT ContextRecord;
1362 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1366 * The exception frame, used for registering exception handlers
1367 * Win32 cares only about this, but compilers generally emit
1368 * larger exception frames for their own use.
1371 struct __EXCEPTION_FRAME;
1373 typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*,
1374 PCONTEXT,struct __EXCEPTION_FRAME **);
1376 typedef struct __EXCEPTION_FRAME
1378 struct __EXCEPTION_FRAME *Prev;
1379 PEXCEPTION_HANDLER Handler;
1380 } EXCEPTION_FRAME, *PEXCEPTION_FRAME;
1382 #include "poppack.h"
1385 * function pointer to a exception filter
1388 typedef LONG CALLBACK (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1389 typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1391 DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1392 LPTOP_LEVEL_EXCEPTION_FILTER
1393 WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1395 /* status values for ContinueDebugEvent */
1396 #define DBG_CONTINUE 0x00010002
1397 #define DBG_TERMINATE_THREAD 0x40010003
1398 #define DBG_TERMINATE_PROCESS 0x40010004
1399 #define DBG_CONTROL_C 0x40010005
1400 #define DBG_CONTROL_BREAK 0x40010008
1401 #define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1403 typedef struct _NT_TIB
1405 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList;
1406 PVOID StackBase;
1407 PVOID StackLimit;
1408 PVOID SubSystemTib;
1409 union {
1410 PVOID FiberData;
1411 DWORD Version;
1412 } DUMMYUNIONNAME;
1413 PVOID ArbitraryUserPointer;
1414 struct _NT_TIB *Self;
1415 } NT_TIB, *PNT_TIB;
1417 struct _TEB;
1419 #if defined(__i386__) && defined(__GNUC__)
1420 extern inline struct _TEB WINAPI *NtCurrentTeb(void);
1421 extern inline struct _TEB WINAPI *NtCurrentTeb(void)
1423 struct _TEB *teb;
1424 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1425 return teb;
1427 #else
1428 extern struct _TEB WINAPI *NtCurrentTeb(void);
1429 #endif
1433 * File formats definitions
1436 typedef struct _IMAGE_DOS_HEADER {
1437 WORD e_magic; /* 00: MZ Header signature */
1438 WORD e_cblp; /* 02: Bytes on last page of file */
1439 WORD e_cp; /* 04: Pages in file */
1440 WORD e_crlc; /* 06: Relocations */
1441 WORD e_cparhdr; /* 08: Size of header in paragraphs */
1442 WORD e_minalloc; /* 0a: Minimum extra paragraphs needed */
1443 WORD e_maxalloc; /* 0c: Maximum extra paragraphs needed */
1444 WORD e_ss; /* 0e: Initial (relative) SS value */
1445 WORD e_sp; /* 10: Initial SP value */
1446 WORD e_csum; /* 12: Checksum */
1447 WORD e_ip; /* 14: Initial IP value */
1448 WORD e_cs; /* 16: Initial (relative) CS value */
1449 WORD e_lfarlc; /* 18: File address of relocation table */
1450 WORD e_ovno; /* 1a: Overlay number */
1451 WORD e_res[4]; /* 1c: Reserved words */
1452 WORD e_oemid; /* 24: OEM identifier (for e_oeminfo) */
1453 WORD e_oeminfo; /* 26: OEM information; e_oemid specific */
1454 WORD e_res2[10]; /* 28: Reserved words */
1455 DWORD e_lfanew; /* 3c: Offset to extended header */
1456 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER;
1458 #define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
1459 #define IMAGE_OS2_SIGNATURE 0x454E /* NE */
1460 #define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
1461 #define IMAGE_OS2_SIGNATURE_LX 0x584C /* LX */
1462 #define IMAGE_VXD_SIGNATURE 0x454C /* LE */
1463 #define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
1466 * This is the Windows executable (NE) header.
1467 * the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
1469 typedef struct
1471 WORD ne_magic; /* 00 NE signature 'NE' */
1472 BYTE ne_ver; /* 02 Linker version number */
1473 BYTE ne_rev; /* 03 Linker revision number */
1474 WORD ne_enttab; /* 04 Offset to entry table relative to NE */
1475 WORD ne_cbenttab; /* 06 Length of entry table in bytes */
1476 LONG ne_crc; /* 08 Checksum */
1477 WORD ne_flags; /* 0c Flags about segments in this file */
1478 WORD ne_autodata; /* 0e Automatic data segment number */
1479 WORD ne_heap; /* 10 Initial size of local heap */
1480 WORD ne_stack; /* 12 Initial size of stack */
1481 DWORD ne_csip; /* 14 Initial CS:IP */
1482 DWORD ne_sssp; /* 18 Initial SS:SP */
1483 WORD ne_cseg; /* 1c # of entries in segment table */
1484 WORD ne_cmod; /* 1e # of entries in module reference tab. */
1485 WORD ne_cbnrestab; /* 20 Length of nonresident-name table */
1486 WORD ne_segtab; /* 22 Offset to segment table */
1487 WORD ne_rsrctab; /* 24 Offset to resource table */
1488 WORD ne_restab; /* 26 Offset to resident-name table */
1489 WORD ne_modtab; /* 28 Offset to module reference table */
1490 WORD ne_imptab; /* 2a Offset to imported name table */
1491 DWORD ne_nrestab; /* 2c Offset to nonresident-name table */
1492 WORD ne_cmovent; /* 30 # of movable entry points */
1493 WORD ne_align; /* 32 Logical sector alignment shift count */
1494 WORD ne_cres; /* 34 # of resource segments */
1495 BYTE ne_exetyp; /* 36 Flags indicating target OS */
1496 BYTE ne_flagsothers; /* 37 Additional information flags */
1497 WORD fastload_offset; /* 38 Offset to fast load area (should be ne_pretthunks)*/
1498 WORD fastload_length; /* 3a Length of fast load area (should be ne_psegrefbytes) */
1499 WORD ne_swaparea; /* 3c Reserved by Microsoft */
1500 WORD ne_expver; /* 3e Expected Windows version number */
1501 } IMAGE_OS2_HEADER,*PIMAGE_OS2_HEADER;
1503 typedef struct _IMAGE_VXD_HEADER {
1504 WORD e32_magic;
1505 BYTE e32_border;
1506 BYTE e32_worder;
1507 DWORD e32_level;
1508 WORD e32_cpu;
1509 WORD e32_os;
1510 DWORD e32_ver;
1511 DWORD e32_mflags;
1512 DWORD e32_mpages;
1513 DWORD e32_startobj;
1514 DWORD e32_eip;
1515 DWORD e32_stackobj;
1516 DWORD e32_esp;
1517 DWORD e32_pagesize;
1518 DWORD e32_lastpagesize;
1519 DWORD e32_fixupsize;
1520 DWORD e32_fixupsum;
1521 DWORD e32_ldrsize;
1522 DWORD e32_ldrsum;
1523 DWORD e32_objtab;
1524 DWORD e32_objcnt;
1525 DWORD e32_objmap;
1526 DWORD e32_itermap;
1527 DWORD e32_rsrctab;
1528 DWORD e32_rsrccnt;
1529 DWORD e32_restab;
1530 DWORD e32_enttab;
1531 DWORD e32_dirtab;
1532 DWORD e32_dircnt;
1533 DWORD e32_fpagetab;
1534 DWORD e32_frectab;
1535 DWORD e32_impmod;
1536 DWORD e32_impmodcnt;
1537 DWORD e32_impproc;
1538 DWORD e32_pagesum;
1539 DWORD e32_datapage;
1540 DWORD e32_preload;
1541 DWORD e32_nrestab;
1542 DWORD e32_cbnrestab;
1543 DWORD e32_nressum;
1544 DWORD e32_autodata;
1545 DWORD e32_debuginfo;
1546 DWORD e32_debuglen;
1547 DWORD e32_instpreload;
1548 DWORD e32_instdemand;
1549 DWORD e32_heapsize;
1550 BYTE e32_res3[12];
1551 DWORD e32_winresoff;
1552 DWORD e32_winreslen;
1553 WORD e32_devid;
1554 WORD e32_ddkver;
1555 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER;
1558 /* These defines describe the meanings of the bits in the Characteristics
1559 field */
1561 #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 /* No relocation info */
1562 #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002
1563 #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004
1564 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008
1565 #define IMAGE_FILE_16BIT_MACHINE 0x0040
1566 #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080
1567 #define IMAGE_FILE_32BIT_MACHINE 0x0100
1568 #define IMAGE_FILE_DEBUG_STRIPPED 0x0200
1569 #define IMAGE_FILE_SYSTEM 0x1000
1570 #define IMAGE_FILE_DLL 0x2000
1571 #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000
1573 /* These are the settings of the Machine field. */
1574 #define IMAGE_FILE_MACHINE_UNKNOWN 0
1575 #define IMAGE_FILE_MACHINE_I860 0x14d
1576 #define IMAGE_FILE_MACHINE_I386 0x14c
1577 #define IMAGE_FILE_MACHINE_R3000 0x162
1578 #define IMAGE_FILE_MACHINE_R4000 0x166
1579 #define IMAGE_FILE_MACHINE_R10000 0x168
1580 #define IMAGE_FILE_MACHINE_ALPHA 0x184
1581 #define IMAGE_FILE_MACHINE_POWERPC 0x1F0
1583 #define IMAGE_SIZEOF_FILE_HEADER 20
1585 /* Possible Magic values */
1586 #define IMAGE_NT_OPTIONAL_HDR_MAGIC 0x10b
1587 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
1589 /* These are indexes into the DataDirectory array */
1590 #define IMAGE_FILE_EXPORT_DIRECTORY 0
1591 #define IMAGE_FILE_IMPORT_DIRECTORY 1
1592 #define IMAGE_FILE_RESOURCE_DIRECTORY 2
1593 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3
1594 #define IMAGE_FILE_SECURITY_DIRECTORY 4
1595 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5
1596 #define IMAGE_FILE_DEBUG_DIRECTORY 6
1597 #define IMAGE_FILE_DESCRIPTION_STRING 7
1598 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */
1599 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9
1600 #define IMAGE_FILE_CALLBACK_DIRECTORY 10
1602 /* Directory Entries, indices into the DataDirectory array */
1604 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0
1605 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1
1606 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2
1607 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3
1608 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4
1609 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5
1610 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6
1611 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7
1612 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 /* (MIPS GP) */
1613 #define IMAGE_DIRECTORY_ENTRY_TLS 9
1614 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10
1615 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11
1616 #define IMAGE_DIRECTORY_ENTRY_IAT 12 /* Import Address Table */
1617 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13
1618 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14
1620 /* Subsystem Values */
1622 #define IMAGE_SUBSYSTEM_UNKNOWN 0
1623 #define IMAGE_SUBSYSTEM_NATIVE 1
1624 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 /* Windows GUI subsystem */
1625 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 /* Windows character subsystem*/
1626 #define IMAGE_SUBSYSTEM_OS2_CUI 5
1627 #define IMAGE_SUBSYSTEM_POSIX_CUI 7
1629 typedef struct _IMAGE_FILE_HEADER {
1630 WORD Machine;
1631 WORD NumberOfSections;
1632 DWORD TimeDateStamp;
1633 DWORD PointerToSymbolTable;
1634 DWORD NumberOfSymbols;
1635 WORD SizeOfOptionalHeader;
1636 WORD Characteristics;
1637 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
1639 typedef struct _IMAGE_DATA_DIRECTORY {
1640 DWORD VirtualAddress;
1641 DWORD Size;
1642 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY;
1644 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
1646 typedef struct _IMAGE_OPTIONAL_HEADER {
1648 /* Standard fields */
1650 WORD Magic;
1651 BYTE MajorLinkerVersion;
1652 BYTE MinorLinkerVersion;
1653 DWORD SizeOfCode;
1654 DWORD SizeOfInitializedData;
1655 DWORD SizeOfUninitializedData;
1656 DWORD AddressOfEntryPoint;
1657 DWORD BaseOfCode;
1658 DWORD BaseOfData;
1660 /* NT additional fields */
1662 DWORD ImageBase;
1663 DWORD SectionAlignment;
1664 DWORD FileAlignment;
1665 WORD MajorOperatingSystemVersion;
1666 WORD MinorOperatingSystemVersion;
1667 WORD MajorImageVersion;
1668 WORD MinorImageVersion;
1669 WORD MajorSubsystemVersion;
1670 WORD MinorSubsystemVersion;
1671 DWORD Win32VersionValue;
1672 DWORD SizeOfImage;
1673 DWORD SizeOfHeaders;
1674 DWORD CheckSum;
1675 WORD Subsystem;
1676 WORD DllCharacteristics;
1677 DWORD SizeOfStackReserve;
1678 DWORD SizeOfStackCommit;
1679 DWORD SizeOfHeapReserve;
1680 DWORD SizeOfHeapCommit;
1681 DWORD LoaderFlags;
1682 DWORD NumberOfRvaAndSizes;
1683 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
1684 } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER;
1686 typedef struct _IMAGE_NT_HEADERS {
1687 DWORD Signature;
1688 IMAGE_FILE_HEADER FileHeader;
1689 IMAGE_OPTIONAL_HEADER OptionalHeader;
1690 } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS;
1692 #define IMAGE_SIZEOF_SHORT_NAME 8
1694 typedef struct _IMAGE_SECTION_HEADER {
1695 BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
1696 union {
1697 DWORD PhysicalAddress;
1698 DWORD VirtualSize;
1699 } Misc;
1700 DWORD VirtualAddress;
1701 DWORD SizeOfRawData;
1702 DWORD PointerToRawData;
1703 DWORD PointerToRelocations;
1704 DWORD PointerToLinenumbers;
1705 WORD NumberOfRelocations;
1706 WORD NumberOfLinenumbers;
1707 DWORD Characteristics;
1708 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER;
1710 #define IMAGE_SIZEOF_SECTION_HEADER 40
1712 #define IMAGE_FIRST_SECTION(ntheader) \
1713 ((PIMAGE_SECTION_HEADER)((LPBYTE)&((PIMAGE_NT_HEADERS)(ntheader))->OptionalHeader + \
1714 ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader))
1716 /* These defines are for the Characteristics bitfield. */
1717 /* #define IMAGE_SCN_TYPE_REG 0x00000000 - Reserved */
1718 /* #define IMAGE_SCN_TYPE_DSECT 0x00000001 - Reserved */
1719 /* #define IMAGE_SCN_TYPE_NOLOAD 0x00000002 - Reserved */
1720 /* #define IMAGE_SCN_TYPE_GROUP 0x00000004 - Reserved */
1721 /* #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 - Reserved */
1722 /* #define IMAGE_SCN_TYPE_COPY 0x00000010 - Reserved */
1724 #define IMAGE_SCN_CNT_CODE 0x00000020
1725 #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040
1726 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080
1728 #define IMAGE_SCN_LNK_OTHER 0x00000100
1729 #define IMAGE_SCN_LNK_INFO 0x00000200
1730 /* #define IMAGE_SCN_TYPE_OVER 0x00000400 - Reserved */
1731 #define IMAGE_SCN_LNK_REMOVE 0x00000800
1732 #define IMAGE_SCN_LNK_COMDAT 0x00001000
1734 /* 0x00002000 - Reserved */
1735 /* #define IMAGE_SCN_MEM_PROTECTED 0x00004000 - Obsolete */
1736 #define IMAGE_SCN_MEM_FARDATA 0x00008000
1738 /* #define IMAGE_SCN_MEM_SYSHEAP 0x00010000 - Obsolete */
1739 #define IMAGE_SCN_MEM_PURGEABLE 0x00020000
1740 #define IMAGE_SCN_MEM_16BIT 0x00020000
1741 #define IMAGE_SCN_MEM_LOCKED 0x00040000
1742 #define IMAGE_SCN_MEM_PRELOAD 0x00080000
1744 #define IMAGE_SCN_ALIGN_1BYTES 0x00100000
1745 #define IMAGE_SCN_ALIGN_2BYTES 0x00200000
1746 #define IMAGE_SCN_ALIGN_4BYTES 0x00300000
1747 #define IMAGE_SCN_ALIGN_8BYTES 0x00400000
1748 #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 /* Default */
1749 #define IMAGE_SCN_ALIGN_32BYTES 0x00600000
1750 #define IMAGE_SCN_ALIGN_64BYTES 0x00700000
1751 /* 0x00800000 - Unused */
1753 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x01000000
1756 #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000
1757 #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000
1758 #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000
1759 #define IMAGE_SCN_MEM_SHARED 0x10000000
1760 #define IMAGE_SCN_MEM_EXECUTE 0x20000000
1761 #define IMAGE_SCN_MEM_READ 0x40000000
1762 #define IMAGE_SCN_MEM_WRITE 0x80000000
1764 #include "pshpack2.h"
1766 typedef struct _IMAGE_SYMBOL {
1767 union {
1768 BYTE ShortName[8];
1769 struct {
1770 DWORD Short;
1771 DWORD Long;
1772 } Name;
1773 DWORD LongName[2];
1774 } N;
1775 DWORD Value;
1776 SHORT SectionNumber;
1777 WORD Type;
1778 BYTE StorageClass;
1779 BYTE NumberOfAuxSymbols;
1780 } IMAGE_SYMBOL;
1781 typedef IMAGE_SYMBOL *PIMAGE_SYMBOL;
1783 #define IMAGE_SIZEOF_SYMBOL 18
1785 typedef struct _IMAGE_LINENUMBER {
1786 union {
1787 DWORD SymbolTableIndex;
1788 DWORD VirtualAddress;
1789 } Type;
1790 WORD Linenumber;
1791 } IMAGE_LINENUMBER;
1792 typedef IMAGE_LINENUMBER *PIMAGE_LINENUMBER;
1794 #define IMAGE_SIZEOF_LINENUMBER 6
1796 typedef union _IMAGE_AUX_SYMBOL {
1797 struct {
1798 DWORD TagIndex;
1799 union {
1800 struct {
1801 WORD Linenumber;
1802 WORD Size;
1803 } LnSz;
1804 DWORD TotalSize;
1805 } Misc;
1806 union {
1807 struct {
1808 DWORD PointerToLinenumber;
1809 DWORD PointerToNextFunction;
1810 } Function;
1811 struct {
1812 WORD Dimension[4];
1813 } Array;
1814 } FcnAry;
1815 WORD TvIndex;
1816 } Sym;
1817 struct {
1818 BYTE Name[IMAGE_SIZEOF_SYMBOL];
1819 } File;
1820 struct {
1821 DWORD Length;
1822 WORD NumberOfRelocations;
1823 WORD NumberOfLinenumbers;
1824 DWORD CheckSum;
1825 SHORT Number;
1826 BYTE Selection;
1827 } Section;
1828 } IMAGE_AUX_SYMBOL;
1829 typedef IMAGE_AUX_SYMBOL *PIMAGE_AUX_SYMBOL;
1831 #define IMAGE_SIZEOF_AUX_SYMBOL 18
1833 #include "poppack.h"
1835 #define IMAGE_SYM_UNDEFINED (SHORT)0
1836 #define IMAGE_SYM_ABSOLUTE (SHORT)-1
1837 #define IMAGE_SYM_DEBUG (SHORT)-2
1839 #define IMAGE_SYM_TYPE_NULL 0x0000
1840 #define IMAGE_SYM_TYPE_VOID 0x0001
1841 #define IMAGE_SYM_TYPE_CHAR 0x0002
1842 #define IMAGE_SYM_TYPE_SHORT 0x0003
1843 #define IMAGE_SYM_TYPE_INT 0x0004
1844 #define IMAGE_SYM_TYPE_LONG 0x0005
1845 #define IMAGE_SYM_TYPE_FLOAT 0x0006
1846 #define IMAGE_SYM_TYPE_DOUBLE 0x0007
1847 #define IMAGE_SYM_TYPE_STRUCT 0x0008
1848 #define IMAGE_SYM_TYPE_UNION 0x0009
1849 #define IMAGE_SYM_TYPE_ENUM 0x000A
1850 #define IMAGE_SYM_TYPE_MOE 0x000B
1851 #define IMAGE_SYM_TYPE_BYTE 0x000C
1852 #define IMAGE_SYM_TYPE_WORD 0x000D
1853 #define IMAGE_SYM_TYPE_UINT 0x000E
1854 #define IMAGE_SYM_TYPE_DWORD 0x000F
1855 #define IMAGE_SYM_TYPE_PCODE 0x8000
1857 #define IMAGE_SYM_DTYPE_NULL 0
1858 #define IMAGE_SYM_DTYPE_POINTER 1
1859 #define IMAGE_SYM_DTYPE_FUNCTION 2
1860 #define IMAGE_SYM_DTYPE_ARRAY 3
1862 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1
1863 #define IMAGE_SYM_CLASS_NULL 0x0000
1864 #define IMAGE_SYM_CLASS_AUTOMATIC 0x0001
1865 #define IMAGE_SYM_CLASS_EXTERNAL 0x0002
1866 #define IMAGE_SYM_CLASS_STATIC 0x0003
1867 #define IMAGE_SYM_CLASS_REGISTER 0x0004
1868 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 0x0005
1869 #define IMAGE_SYM_CLASS_LABEL 0x0006
1870 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 0x0007
1871 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 0x0008
1872 #define IMAGE_SYM_CLASS_ARGUMENT 0x0009
1873 #define IMAGE_SYM_CLASS_STRUCT_TAG 0x000A
1874 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 0x000B
1875 #define IMAGE_SYM_CLASS_UNION_TAG 0x000C
1876 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 0x000D
1877 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 0x000E
1878 #define IMAGE_SYM_CLASS_ENUM_TAG 0x000F
1879 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 0x0010
1880 #define IMAGE_SYM_CLASS_REGISTER_PARAM 0x0011
1881 #define IMAGE_SYM_CLASS_BIT_FIELD 0x0012
1883 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 0x0044
1884 #define IMAGE_SYM_CLASS_BLOCK 0x0064
1885 #define IMAGE_SYM_CLASS_FUNCTION 0x0065
1886 #define IMAGE_SYM_CLASS_END_OF_STRUCT 0x0066
1887 #define IMAGE_SYM_CLASS_FILE 0x0067
1888 #define IMAGE_SYM_CLASS_SECTION 0x0068
1889 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 0x0069
1891 #define N_BTMASK 0x000F
1892 #define N_TMASK 0x0030
1893 #define N_TMASK1 0x00C0
1894 #define N_TMASK2 0x00F0
1895 #define N_BTSHFT 4
1896 #define N_TSHIFT 2
1898 #define BTYPE(x) ((x) & N_BTMASK)
1900 #ifndef ISPTR
1901 #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT))
1902 #endif
1904 #ifndef ISFCN
1905 #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT))
1906 #endif
1908 #ifndef ISARY
1909 #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT))
1910 #endif
1912 #ifndef ISTAG
1913 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG)
1914 #endif
1916 #ifndef INCREF
1917 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK))
1918 #endif
1919 #ifndef DECREF
1920 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK))
1921 #endif
1923 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1
1924 #define IMAGE_COMDAT_SELECT_ANY 2
1925 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3
1926 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4
1927 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5
1928 #define IMAGE_COMDAT_SELECT_LARGEST 6
1929 #define IMAGE_COMDAT_SELECT_NEWEST 7
1931 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1
1932 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2
1933 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3
1935 /* Export module directory */
1937 typedef struct _IMAGE_EXPORT_DIRECTORY {
1938 DWORD Characteristics;
1939 DWORD TimeDateStamp;
1940 WORD MajorVersion;
1941 WORD MinorVersion;
1942 DWORD Name;
1943 DWORD Base;
1944 DWORD NumberOfFunctions;
1945 DWORD NumberOfNames;
1946 DWORD AddressOfFunctions;
1947 DWORD AddressOfNames;
1948 DWORD AddressOfNameOrdinals;
1949 } IMAGE_EXPORT_DIRECTORY,*PIMAGE_EXPORT_DIRECTORY;
1951 /* Import name entry */
1952 typedef struct _IMAGE_IMPORT_BY_NAME {
1953 WORD Hint;
1954 BYTE Name[1];
1955 } IMAGE_IMPORT_BY_NAME,*PIMAGE_IMPORT_BY_NAME;
1957 /* Import thunk */
1958 typedef struct _IMAGE_THUNK_DATA {
1959 union {
1960 LPBYTE ForwarderString;
1961 PDWORD Function;
1962 DWORD Ordinal;
1963 PIMAGE_IMPORT_BY_NAME AddressOfData;
1964 } u1;
1965 } IMAGE_THUNK_DATA,*PIMAGE_THUNK_DATA;
1967 /* Import module directory */
1969 typedef struct _IMAGE_IMPORT_DESCRIPTOR {
1970 union {
1971 DWORD Characteristics; /* 0 for terminating null import descriptor */
1972 PIMAGE_THUNK_DATA OriginalFirstThunk; /* RVA to original unbound IAT */
1973 } u;
1974 DWORD TimeDateStamp; /* 0 if not bound,
1975 * -1 if bound, and real date\time stamp
1976 * in IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT
1977 * (new BIND)
1978 * otherwise date/time stamp of DLL bound to
1979 * (Old BIND)
1981 DWORD ForwarderChain; /* -1 if no forwarders */
1982 DWORD Name;
1983 /* RVA to IAT (if bound this IAT has actual addresses) */
1984 PIMAGE_THUNK_DATA FirstThunk;
1985 } IMAGE_IMPORT_DESCRIPTOR,*PIMAGE_IMPORT_DESCRIPTOR;
1987 #define IMAGE_ORDINAL_FLAG 0x80000000
1988 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0)
1989 #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff)
1991 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR
1993 DWORD TimeDateStamp;
1994 WORD OffsetModuleName;
1995 WORD NumberOfModuleForwarderRefs;
1996 /* Array of zero or more IMAGE_BOUND_FORWARDER_REF follows */
1997 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR;
1999 typedef struct _IMAGE_BOUND_FORWARDER_REF
2001 DWORD TimeDateStamp;
2002 WORD OffsetModuleName;
2003 WORD Reserved;
2004 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF;
2006 typedef struct _IMAGE_BASE_RELOCATION
2008 DWORD VirtualAddress;
2009 DWORD SizeOfBlock;
2010 WORD TypeOffset[1];
2011 } IMAGE_BASE_RELOCATION,*PIMAGE_BASE_RELOCATION;
2013 typedef struct _IMAGE_RELOCATION
2015 union {
2016 DWORD VirtualAddress;
2017 DWORD RelocCount;
2018 } u;
2019 DWORD SymbolTableIndex;
2020 WORD Type;
2021 } IMAGE_RELOCATION;
2022 typedef IMAGE_RELOCATION *PIMAGE_RELOCATION;
2024 #define IMAGE_SIZEOF_RELOCATION 10
2026 /* generic relocation types */
2027 #define IMAGE_REL_BASED_ABSOLUTE 0
2028 #define IMAGE_REL_BASED_HIGH 1
2029 #define IMAGE_REL_BASED_LOW 2
2030 #define IMAGE_REL_BASED_HIGHLOW 3
2031 #define IMAGE_REL_BASED_HIGHADJ 4
2032 #define IMAGE_REL_BASED_MIPS_JMPADDR 5
2033 #define IMAGE_REL_BASED_SECTION 6
2034 #define IMAGE_REL_BASED_REL 7
2035 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9
2036 #define IMAGE_REL_BASED_IA64_IMM64 9 /* yes, 9 too */
2037 #define IMAGE_REL_BASED_DIR64 10
2038 #define IMAGE_REL_BASED_HIGH3ADJ 11
2040 /* I386 relocation types */
2041 #define IMAGE_REL_I386_ABSOLUTE 0
2042 #define IMAGE_REL_I386_DIR16 1
2043 #define IMAGE_REL_I386_REL16 2
2044 #define IMAGE_REL_I386_DIR32 6
2045 #define IMAGE_REL_I386_DIR32NB 7
2046 #define IMAGE_REL_I386_SEG12 9
2047 #define IMAGE_REL_I386_SECTION 10
2048 #define IMAGE_REL_I386_SECREL 11
2049 #define IMAGE_REL_I386_REL32 20
2051 /* MIPS relocation types */
2052 #define IMAGE_REL_MIPS_ABSOLUTE 0x0000
2053 #define IMAGE_REL_MIPS_REFHALF 0x0001
2054 #define IMAGE_REL_MIPS_REFWORD 0x0002
2055 #define IMAGE_REL_MIPS_JMPADDR 0x0003
2056 #define IMAGE_REL_MIPS_REFHI 0x0004
2057 #define IMAGE_REL_MIPS_REFLO 0x0005
2058 #define IMAGE_REL_MIPS_GPREL 0x0006
2059 #define IMAGE_REL_MIPS_LITERAL 0x0007
2060 #define IMAGE_REL_MIPS_SECTION 0x000A
2061 #define IMAGE_REL_MIPS_SECREL 0x000B
2062 #define IMAGE_REL_MIPS_SECRELLO 0x000C
2063 #define IMAGE_REL_MIPS_SECRELHI 0x000D
2064 #define IMAGE_REL_MIPS_JMPADDR16 0x0010
2065 #define IMAGE_REL_MIPS_REFWORDNB 0x0022
2066 #define IMAGE_REL_MIPS_PAIR 0x0025
2068 /* ALPHA relocation types */
2069 #define IMAGE_REL_ALPHA_ABSOLUTE 0x0000
2070 #define IMAGE_REL_ALPHA_REFLONG 0x0001
2071 #define IMAGE_REL_ALPHA_REFQUAD 0x0002
2072 #define IMAGE_REL_ALPHA_GPREL 0x0003
2073 #define IMAGE_REL_ALPHA_LITERAL 0x0004
2074 #define IMAGE_REL_ALPHA_LITUSE 0x0005
2075 #define IMAGE_REL_ALPHA_GPDISP 0x0006
2076 #define IMAGE_REL_ALPHA_BRADDR 0x0007
2077 #define IMAGE_REL_ALPHA_HINT 0x0008
2078 #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x0009
2079 #define IMAGE_REL_ALPHA_REFHI 0x000A
2080 #define IMAGE_REL_ALPHA_REFLO 0x000B
2081 #define IMAGE_REL_ALPHA_PAIR 0x000C
2082 #define IMAGE_REL_ALPHA_MATCH 0x000D
2083 #define IMAGE_REL_ALPHA_SECTION 0x000E
2084 #define IMAGE_REL_ALPHA_SECREL 0x000F
2085 #define IMAGE_REL_ALPHA_REFLONGNB 0x0010
2086 #define IMAGE_REL_ALPHA_SECRELLO 0x0011
2087 #define IMAGE_REL_ALPHA_SECRELHI 0x0012
2088 #define IMAGE_REL_ALPHA_REFQ3 0x0013
2089 #define IMAGE_REL_ALPHA_REFQ2 0x0014
2090 #define IMAGE_REL_ALPHA_REFQ1 0x0015
2091 #define IMAGE_REL_ALPHA_GPRELLO 0x0016
2092 #define IMAGE_REL_ALPHA_GPRELHI 0x0017
2094 /* PowerPC relocation types */
2095 #define IMAGE_REL_PPC_ABSOLUTE 0x0000
2096 #define IMAGE_REL_PPC_ADDR64 0x0001
2097 #define IMAGE_REL_PPC_ADDR 0x0002
2098 #define IMAGE_REL_PPC_ADDR24 0x0003
2099 #define IMAGE_REL_PPC_ADDR16 0x0004
2100 #define IMAGE_REL_PPC_ADDR14 0x0005
2101 #define IMAGE_REL_PPC_REL24 0x0006
2102 #define IMAGE_REL_PPC_REL14 0x0007
2103 #define IMAGE_REL_PPC_TOCREL16 0x0008
2104 #define IMAGE_REL_PPC_TOCREL14 0x0009
2105 #define IMAGE_REL_PPC_ADDR32NB 0x000A
2106 #define IMAGE_REL_PPC_SECREL 0x000B
2107 #define IMAGE_REL_PPC_SECTION 0x000C
2108 #define IMAGE_REL_PPC_IFGLUE 0x000D
2109 #define IMAGE_REL_PPC_IMGLUE 0x000E
2110 #define IMAGE_REL_PPC_SECREL16 0x000F
2111 #define IMAGE_REL_PPC_REFHI 0x0010
2112 #define IMAGE_REL_PPC_REFLO 0x0011
2113 #define IMAGE_REL_PPC_PAIR 0x0012
2114 #define IMAGE_REL_PPC_SECRELLO 0x0013
2115 #define IMAGE_REL_PPC_SECRELHI 0x0014
2116 #define IMAGE_REL_PPC_GPREL 0x0015
2117 #define IMAGE_REL_PPC_TYPEMASK 0x00FF
2118 /* modifier bits */
2119 #define IMAGE_REL_PPC_NEG 0x0100
2120 #define IMAGE_REL_PPC_BRTAKEN 0x0200
2121 #define IMAGE_REL_PPC_BRNTAKEN 0x0400
2122 #define IMAGE_REL_PPC_TOCDEFN 0x0800
2124 /* SH3 ? relocation type */
2125 #define IMAGE_REL_SH3_ABSOLUTE 0x0000
2126 #define IMAGE_REL_SH3_DIRECT16 0x0001
2127 #define IMAGE_REL_SH3_DIRECT 0x0002
2128 #define IMAGE_REL_SH3_DIRECT8 0x0003
2129 #define IMAGE_REL_SH3_DIRECT8_WORD 0x0004
2130 #define IMAGE_REL_SH3_DIRECT8_LONG 0x0005
2131 #define IMAGE_REL_SH3_DIRECT4 0x0006
2132 #define IMAGE_REL_SH3_DIRECT4_WORD 0x0007
2133 #define IMAGE_REL_SH3_DIRECT4_LONG 0x0008
2134 #define IMAGE_REL_SH3_PCREL8_WORD 0x0009
2135 #define IMAGE_REL_SH3_PCREL8_LONG 0x000A
2136 #define IMAGE_REL_SH3_PCREL12_WORD 0x000B
2137 #define IMAGE_REL_SH3_STARTOF_SECTION 0x000C
2138 #define IMAGE_REL_SH3_SIZEOF_SECTION 0x000D
2139 #define IMAGE_REL_SH3_SECTION 0x000E
2140 #define IMAGE_REL_SH3_SECREL 0x000F
2141 #define IMAGE_REL_SH3_DIRECT32_NB 0x0010
2143 /* ARM (Archimedes?) relocation types */
2144 #define IMAGE_REL_ARM_ABSOLUTE 0x0000
2145 #define IMAGE_REL_ARM_ADDR 0x0001
2146 #define IMAGE_REL_ARM_ADDR32NB 0x0002
2147 #define IMAGE_REL_ARM_BRANCH24 0x0003
2148 #define IMAGE_REL_ARM_BRANCH11 0x0004
2149 #define IMAGE_REL_ARM_SECTION 0x000E
2150 #define IMAGE_REL_ARM_SECREL 0x000F
2152 /* IA64 relocation types */
2153 #define IMAGE_REL_IA64_ABSOLUTE 0x0000
2154 #define IMAGE_REL_IA64_IMM14 0x0001
2155 #define IMAGE_REL_IA64_IMM22 0x0002
2156 #define IMAGE_REL_IA64_IMM64 0x0003
2157 #define IMAGE_REL_IA64_DIR 0x0004
2158 #define IMAGE_REL_IA64_DIR64 0x0005
2159 #define IMAGE_REL_IA64_PCREL21B 0x0006
2160 #define IMAGE_REL_IA64_PCREL21M 0x0007
2161 #define IMAGE_REL_IA64_PCREL21F 0x0008
2162 #define IMAGE_REL_IA64_GPREL22 0x0009
2163 #define IMAGE_REL_IA64_LTOFF22 0x000A
2164 #define IMAGE_REL_IA64_SECTION 0x000B
2165 #define IMAGE_REL_IA64_SECREL22 0x000C
2166 #define IMAGE_REL_IA64_SECREL64I 0x000D
2167 #define IMAGE_REL_IA64_SECREL 0x000E
2168 #define IMAGE_REL_IA64_LTOFF64 0x000F
2169 #define IMAGE_REL_IA64_DIR32NB 0x0010
2170 #define IMAGE_REL_IA64_RESERVED_11 0x0011
2171 #define IMAGE_REL_IA64_RESERVED_12 0x0012
2172 #define IMAGE_REL_IA64_RESERVED_13 0x0013
2173 #define IMAGE_REL_IA64_RESERVED_14 0x0014
2174 #define IMAGE_REL_IA64_RESERVED_15 0x0015
2175 #define IMAGE_REL_IA64_RESERVED_16 0x0016
2176 #define IMAGE_REL_IA64_ADDEND 0x001F
2178 /* archive format */
2180 #define IMAGE_ARCHIVE_START_SIZE 8
2181 #define IMAGE_ARCHIVE_START "!<arch>\n"
2182 #define IMAGE_ARCHIVE_END "`\n"
2183 #define IMAGE_ARCHIVE_PAD "\n"
2184 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ "
2185 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// "
2187 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER
2189 BYTE Name[16];
2190 BYTE Date[12];
2191 BYTE UserID[6];
2192 BYTE GroupID[6];
2193 BYTE Mode[8];
2194 BYTE Size[10];
2195 BYTE EndHeader[2];
2196 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER;
2198 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60
2201 * Resource directory stuff
2203 typedef struct _IMAGE_RESOURCE_DIRECTORY {
2204 DWORD Characteristics;
2205 DWORD TimeDateStamp;
2206 WORD MajorVersion;
2207 WORD MinorVersion;
2208 WORD NumberOfNamedEntries;
2209 WORD NumberOfIdEntries;
2210 /* IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; */
2211 } IMAGE_RESOURCE_DIRECTORY,*PIMAGE_RESOURCE_DIRECTORY;
2213 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000
2214 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000
2216 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY {
2217 union {
2218 struct {
2219 unsigned NameOffset:31;
2220 unsigned NameIsString:1;
2221 } DUMMYSTRUCTNAME1;
2222 DWORD Name;
2223 WORD Id;
2224 } DUMMYUNIONNAME1;
2225 union {
2226 DWORD OffsetToData;
2227 struct {
2228 unsigned OffsetToDirectory:31;
2229 unsigned DataIsDirectory:1;
2230 } DUMMYSTRUCTNAME2;
2231 } DUMMYUNIONNAME2;
2232 } IMAGE_RESOURCE_DIRECTORY_ENTRY,*PIMAGE_RESOURCE_DIRECTORY_ENTRY;
2235 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING {
2236 WORD Length;
2237 CHAR NameString[ 1 ];
2238 } IMAGE_RESOURCE_DIRECTORY_STRING,*PIMAGE_RESOURCE_DIRECTORY_STRING;
2240 typedef struct _IMAGE_RESOURCE_DIR_STRING_U {
2241 WORD Length;
2242 WCHAR NameString[ 1 ];
2243 } IMAGE_RESOURCE_DIR_STRING_U,*PIMAGE_RESOURCE_DIR_STRING_U;
2245 typedef struct _IMAGE_RESOURCE_DATA_ENTRY {
2246 DWORD OffsetToData;
2247 DWORD Size;
2248 DWORD CodePage;
2249 DWORD ResourceHandle;
2250 } IMAGE_RESOURCE_DATA_ENTRY,*PIMAGE_RESOURCE_DATA_ENTRY;
2253 typedef VOID CALLBACK (*PIMAGE_TLS_CALLBACK)(
2254 LPVOID DllHandle,DWORD Reason,LPVOID Reserved
2257 typedef struct _IMAGE_TLS_DIRECTORY {
2258 DWORD StartAddressOfRawData;
2259 DWORD EndAddressOfRawData;
2260 LPDWORD AddressOfIndex;
2261 PIMAGE_TLS_CALLBACK *AddressOfCallBacks;
2262 DWORD SizeOfZeroFill;
2263 DWORD Characteristics;
2264 } IMAGE_TLS_DIRECTORY,*PIMAGE_TLS_DIRECTORY;
2266 typedef struct _IMAGE_DEBUG_DIRECTORY {
2267 DWORD Characteristics;
2268 DWORD TimeDateStamp;
2269 WORD MajorVersion;
2270 WORD MinorVersion;
2271 DWORD Type;
2272 DWORD SizeOfData;
2273 DWORD AddressOfRawData;
2274 DWORD PointerToRawData;
2275 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY;
2277 #define IMAGE_DEBUG_TYPE_UNKNOWN 0
2278 #define IMAGE_DEBUG_TYPE_COFF 1
2279 #define IMAGE_DEBUG_TYPE_CODEVIEW 2
2280 #define IMAGE_DEBUG_TYPE_FPO 3
2281 #define IMAGE_DEBUG_TYPE_MISC 4
2282 #define IMAGE_DEBUG_TYPE_EXCEPTION 5
2283 #define IMAGE_DEBUG_TYPE_FIXUP 6
2284 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7
2285 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8
2286 #define IMAGE_DEBUG_TYPE_BORLAND 9
2287 #define IMAGE_DEBUG_TYPE_RESERVED10 10
2289 typedef struct _IMAGE_COFF_SYMBOLS_HEADER {
2290 DWORD NumberOfSymbols;
2291 DWORD LvaToFirstSymbol;
2292 DWORD NumberOfLinenumbers;
2293 DWORD LvaToFirstLinenumber;
2294 DWORD RvaToFirstByteOfCode;
2295 DWORD RvaToLastByteOfCode;
2296 DWORD RvaToFirstByteOfData;
2297 DWORD RvaToLastByteOfData;
2298 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER;
2300 #define FRAME_FPO 0
2301 #define FRAME_TRAP 1
2302 #define FRAME_TSS 2
2303 #define FRAME_NONFPO 3
2305 typedef struct _FPO_DATA {
2306 DWORD ulOffStart;
2307 DWORD cbProcSize;
2308 DWORD cdwLocals;
2309 WORD cdwParams;
2310 unsigned cbProlog : 8;
2311 unsigned cbRegs : 3;
2312 unsigned fHasSEH : 1;
2313 unsigned fUseBP : 1;
2314 unsigned reserved : 1;
2315 unsigned cbFrame : 2;
2316 } FPO_DATA, *PFPO_DATA;
2318 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
2319 DWORD Characteristics;
2320 DWORD TimeDateStamp;
2321 WORD MajorVersion;
2322 WORD MinorVersion;
2323 DWORD GlobalFlagsClear;
2324 DWORD GlobalFlagsSet;
2325 DWORD CriticalSectionDefaultTimeout;
2326 DWORD DeCommitFreeBlockThreshold;
2327 DWORD DeCommitTotalFreeThreshold;
2328 PVOID LockPrefixTable;
2329 DWORD MaximumAllocationSize;
2330 DWORD VirtualMemoryThreshold;
2331 DWORD ProcessHeapFlags;
2332 DWORD ProcessAffinityMask;
2333 WORD CSDVersion;
2334 WORD Reserved1;
2335 PVOID EditList;
2336 DWORD Reserved[1];
2337 } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY;
2339 typedef struct _IMAGE_FUNCTION_ENTRY {
2340 DWORD StartingAddress;
2341 DWORD EndingAddress;
2342 DWORD EndOfPrologue;
2343 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY;
2345 #define IMAGE_DEBUG_MISC_EXENAME 1
2347 typedef struct _IMAGE_DEBUG_MISC {
2348 DWORD DataType;
2349 DWORD Length;
2350 BYTE Unicode;
2351 BYTE Reserved[ 3 ];
2352 BYTE Data[ 1 ];
2353 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC;
2355 /* This is the structure that appears at the very start of a .DBG file. */
2357 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER {
2358 WORD Signature;
2359 WORD Flags;
2360 WORD Machine;
2361 WORD Characteristics;
2362 DWORD TimeDateStamp;
2363 DWORD CheckSum;
2364 DWORD ImageBase;
2365 DWORD SizeOfImage;
2366 DWORD NumberOfSections;
2367 DWORD ExportedNamesSize;
2368 DWORD DebugDirectorySize;
2369 DWORD SectionAlignment;
2370 DWORD Reserved[ 2 ];
2371 } IMAGE_SEPARATE_DEBUG_HEADER,*PIMAGE_SEPARATE_DEBUG_HEADER;
2373 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944
2376 typedef struct tagMESSAGE_RESOURCE_ENTRY {
2377 WORD Length;
2378 WORD Flags;
2379 BYTE Text[1];
2380 } MESSAGE_RESOURCE_ENTRY,*PMESSAGE_RESOURCE_ENTRY;
2381 #define MESSAGE_RESOURCE_UNICODE 0x0001
2383 typedef struct tagMESSAGE_RESOURCE_BLOCK {
2384 DWORD LowId;
2385 DWORD HighId;
2386 DWORD OffsetToEntries;
2387 } MESSAGE_RESOURCE_BLOCK,*PMESSAGE_RESOURCE_BLOCK;
2389 typedef struct tagMESSAGE_RESOURCE_DATA {
2390 DWORD NumberOfBlocks;
2391 MESSAGE_RESOURCE_BLOCK Blocks[ 1 ];
2392 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA;
2395 * Here follows typedefs for security and tokens.
2399 * First a constant for the following typdefs.
2402 #define ANYSIZE_ARRAY 1
2404 /* FIXME: Orphan. What does it point to? */
2405 typedef PVOID PACCESS_TOKEN;
2408 * TOKEN_INFORMATION_CLASS
2411 typedef enum _TOKEN_INFORMATION_CLASS {
2412 TokenUser = 1,
2413 TokenGroups,
2414 TokenPrivileges,
2415 TokenOwner,
2416 TokenPrimaryGroup,
2417 TokenDefaultDacl,
2418 TokenSource,
2419 TokenType,
2420 TokenImpersonationLevel,
2421 TokenStatistics
2422 } TOKEN_INFORMATION_CLASS;
2424 #ifndef _SECURITY_DEFINED
2425 #define _SECURITY_DEFINED
2427 #include "pshpack1.h"
2429 typedef DWORD ACCESS_MASK, *PACCESS_MASK;
2431 typedef struct _GENERIC_MAPPING {
2432 ACCESS_MASK GenericRead;
2433 ACCESS_MASK GenericWrite;
2434 ACCESS_MASK GenericExecute;
2435 ACCESS_MASK GenericAll;
2436 } GENERIC_MAPPING, *PGENERIC_MAPPING;
2438 #ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
2439 #define SID_IDENTIFIER_AUTHORITY_DEFINED
2440 typedef struct {
2441 BYTE Value[6];
2442 } SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
2443 #endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
2445 #ifndef SID_DEFINED
2446 #define SID_DEFINED
2447 typedef struct _SID {
2448 BYTE Revision;
2449 BYTE SubAuthorityCount;
2450 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
2451 DWORD SubAuthority[1];
2452 } SID,*PSID;
2453 #endif /* !defined(SID_DEFINED) */
2455 #define SID_REVISION (1) /* Current revision */
2456 #define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
2457 #define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
2461 * ACL
2464 #define ACL_REVISION1 1
2465 #define ACL_REVISION2 2
2466 #define ACL_REVISION3 3
2467 #define ACL_REVISION4 4
2469 #define MIN_ACL_REVISION ACL_REVISION2
2470 #define MAX_ACL_REVISION ACL_REVISION4
2472 typedef struct _ACL {
2473 BYTE AclRevision;
2474 BYTE Sbz1;
2475 WORD AclSize;
2476 WORD AceCount;
2477 WORD Sbz2;
2478 } ACL, *PACL;
2480 /* SECURITY_DESCRIPTOR */
2481 #define SECURITY_DESCRIPTOR_REVISION 1
2482 #define SECURITY_DESCRIPTOR_REVISION1 1
2485 #define SE_OWNER_DEFAULTED 0x0001
2486 #define SE_GROUP_DEFAULTED 0x0002
2487 #define SE_DACL_PRESENT 0x0004
2488 #define SE_DACL_DEFAULTED 0x0008
2489 #define SE_SACL_PRESENT 0x0010
2490 #define SE_SACL_DEFAULTED 0x0020
2491 #define SE_SELF_RELATIVE 0x8000
2493 typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
2494 typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
2496 /* The security descriptor structure */
2497 typedef struct {
2498 BYTE Revision;
2499 BYTE Sbz1;
2500 SECURITY_DESCRIPTOR_CONTROL Control;
2501 DWORD Owner;
2502 DWORD Group;
2503 DWORD Sacl;
2504 DWORD Dacl;
2505 } SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
2507 typedef struct {
2508 BYTE Revision;
2509 BYTE Sbz1;
2510 SECURITY_DESCRIPTOR_CONTROL Control;
2511 PSID Owner;
2512 PSID Group;
2513 PACL Sacl;
2514 PACL Dacl;
2515 } SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
2517 #define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
2519 #include "poppack.h"
2521 #endif /* _SECURITY_DEFINED */
2523 #include "pshpack1.h"
2526 * SID_AND_ATTRIBUTES
2529 typedef struct _SID_AND_ATTRIBUTES {
2530 PSID Sid;
2531 DWORD Attributes;
2532 } SID_AND_ATTRIBUTES ;
2534 /* security entities */
2535 #define SECURITY_NULL_RID (0x00000000L)
2536 #define SECURITY_WORLD_RID (0x00000000L)
2537 #define SECURITY_LOCAL_RID (0X00000000L)
2539 #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
2541 /* S-1-1 */
2542 #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
2544 /* S-1-2 */
2545 #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
2547 /* S-1-3 */
2548 #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
2549 #define SECURITY_CREATOR_OWNER_RID (0x00000000L)
2550 #define SECURITY_CREATOR_GROUP_RID (0x00000001L)
2551 #define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
2552 #define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
2554 /* S-1-4 */
2555 #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
2557 /* S-1-5 */
2558 #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
2559 #define SECURITY_DIALUP_RID 0x00000001L
2560 #define SECURITY_NETWORK_RID 0x00000002L
2561 #define SECURITY_BATCH_RID 0x00000003L
2562 #define SECURITY_INTERACTIVE_RID 0x00000004L
2563 #define SECURITY_LOGON_IDS_RID 0x00000005L
2564 #define SECURITY_SERVICE_RID 0x00000006L
2565 #define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
2566 #define SECURITY_PROXY_RID 0x00000008L
2567 #define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
2568 #define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
2569 #define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
2570 #define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
2571 #define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
2572 #define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
2573 #define SECURITY_NT_NON_UNIQUE 0x00000015L
2574 #define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
2576 #define DOMAIN_GROUP_RID_ADMINS 0x00000200L
2577 #define DOMAIN_GROUP_RID_USERS 0x00000201L
2578 #define DOMAIN_GROUP_RID_GUESTS 0x00000202L
2580 #define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
2581 #define DOMAIN_ALIAS_RID_USERS 0x00000221L
2582 #define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
2584 #define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
2586 #define SECURITY_LOGON_IDS_RID_COUNT (3L)
2589 * TOKEN_USER
2592 typedef struct _TOKEN_USER {
2593 SID_AND_ATTRIBUTES User;
2594 } TOKEN_USER;
2597 * TOKEN_GROUPS
2600 typedef struct _TOKEN_GROUPS {
2601 DWORD GroupCount;
2602 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
2603 } TOKEN_GROUPS;
2606 * LUID_AND_ATTRIBUTES
2609 typedef union _LARGE_INTEGER {
2610 struct {
2611 DWORD LowPart;
2612 LONG HighPart;
2613 } DUMMYSTRUCTNAME;
2614 LONGLONG QuadPart;
2615 } LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
2617 typedef union _ULARGE_INTEGER {
2618 struct {
2619 DWORD LowPart;
2620 DWORD HighPart;
2621 } DUMMYSTRUCTNAME;
2622 ULONGLONG QuadPart;
2623 } ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
2626 * Locally Unique Identifier
2629 typedef LARGE_INTEGER LUID,*PLUID;
2631 typedef struct _LUID_AND_ATTRIBUTES {
2632 LUID Luid;
2633 DWORD Attributes;
2634 } LUID_AND_ATTRIBUTES;
2637 * PRIVILEGE_SET
2640 typedef struct _PRIVILEGE_SET {
2641 DWORD PrivilegeCount;
2642 DWORD Control;
2643 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
2644 } PRIVILEGE_SET, *PPRIVILEGE_SET;
2647 * TOKEN_PRIVILEGES
2650 typedef struct _TOKEN_PRIVILEGES {
2651 DWORD PrivilegeCount;
2652 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
2653 } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
2656 * TOKEN_OWNER
2659 typedef struct _TOKEN_OWNER {
2660 PSID Owner;
2661 } TOKEN_OWNER;
2664 * TOKEN_PRIMARY_GROUP
2667 typedef struct _TOKEN_PRIMARY_GROUP {
2668 PSID PrimaryGroup;
2669 } TOKEN_PRIMARY_GROUP;
2673 * TOKEN_DEFAULT_DACL
2676 typedef struct _TOKEN_DEFAULT_DACL {
2677 PACL DefaultDacl;
2678 } TOKEN_DEFAULT_DACL;
2681 * TOKEN_SOURCEL
2684 typedef struct _TOKEN_SOURCE {
2685 char Sourcename[8];
2686 LUID SourceIdentifier;
2687 } TOKEN_SOURCE;
2690 * TOKEN_TYPE
2693 typedef enum tagTOKEN_TYPE {
2694 TokenPrimary = 1,
2695 TokenImpersonation
2696 } TOKEN_TYPE;
2699 * SECURITY_IMPERSONATION_LEVEL
2702 typedef enum _SECURITY_IMPERSONATION_LEVEL {
2703 SecurityAnonymous,
2704 SecurityIdentification,
2705 SecurityImpersonation,
2706 SecurityDelegation
2707 } SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
2710 typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
2711 * PSECURITY_CONTEXT_TRACKING_MODE;
2713 * Quality of Service
2716 typedef struct _SECURITY_QUALITY_OF_SERVICE {
2717 DWORD Length;
2718 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2719 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
2720 BOOL EffectiveOnly;
2721 } SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
2724 * TOKEN_STATISTICS
2727 typedef struct _TOKEN_STATISTICS {
2728 LUID TokenId;
2729 LUID AuthenticationId;
2730 LARGE_INTEGER ExpirationTime;
2731 TOKEN_TYPE TokenType;
2732 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
2733 DWORD DynamicCharged;
2734 DWORD DynamicAvailable;
2735 DWORD GroupCount;
2736 DWORD PrivilegeCount;
2737 LUID ModifiedId;
2738 } TOKEN_STATISTICS;
2741 * ACLs of NT
2744 #define ACL_REVISION 2
2746 #define ACL_REVISION1 1
2747 #define ACL_REVISION2 2
2749 /* ACEs, directly starting after an ACL */
2750 typedef struct _ACE_HEADER {
2751 BYTE AceType;
2752 BYTE AceFlags;
2753 WORD AceSize;
2754 } ACE_HEADER,*PACE_HEADER;
2756 /* AceType */
2757 #define ACCESS_ALLOWED_ACE_TYPE 0
2758 #define ACCESS_DENIED_ACE_TYPE 1
2759 #define SYSTEM_AUDIT_ACE_TYPE 2
2760 #define SYSTEM_ALARM_ACE_TYPE 3
2762 /* inherit AceFlags */
2763 #define OBJECT_INHERIT_ACE 0x01
2764 #define CONTAINER_INHERIT_ACE 0x02
2765 #define NO_PROPAGATE_INHERIT_ACE 0x04
2766 #define INHERIT_ONLY_ACE 0x08
2767 #define VALID_INHERIT_FLAGS 0x0F
2769 /* AceFlags mask for what events we (should) audit */
2770 #define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
2771 #define FAILED_ACCESS_ACE_FLAG 0x80
2773 /* different ACEs depending on AceType
2774 * SidStart marks the begin of a SID
2775 * so the thing finally looks like this:
2776 * 0: ACE_HEADER
2777 * 4: ACCESS_MASK
2778 * 8... : SID
2780 typedef struct _ACCESS_ALLOWED_ACE {
2781 ACE_HEADER Header;
2782 DWORD Mask;
2783 DWORD SidStart;
2784 } ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
2786 typedef struct _ACCESS_DENIED_ACE {
2787 ACE_HEADER Header;
2788 DWORD Mask;
2789 DWORD SidStart;
2790 } ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
2792 typedef struct _SYSTEM_AUDIT_ACE {
2793 ACE_HEADER Header;
2794 DWORD Mask;
2795 DWORD SidStart;
2796 } SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
2798 typedef struct _SYSTEM_ALARM_ACE {
2799 ACE_HEADER Header;
2800 DWORD Mask;
2801 DWORD SidStart;
2802 } SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
2804 typedef enum tagSID_NAME_USE {
2805 SidTypeUser = 1,
2806 SidTypeGroup,
2807 SidTypeDomain,
2808 SidTypeAlias,
2809 SidTypeWellKnownGroup,
2810 SidTypeDeletedAccount,
2811 SidTypeInvalid,
2812 SidTypeUnknown
2813 } SID_NAME_USE,*PSID_NAME_USE;
2815 /* Access rights */
2817 /* DELETE may be already defined via /usr/include/arpa/nameser_compat.h */
2818 #undef DELETE
2819 #define DELETE 0x00010000
2820 #define READ_CONTROL 0x00020000
2821 #define WRITE_DAC 0x00040000
2822 #define WRITE_OWNER 0x00080000
2823 #define SYNCHRONIZE 0x00100000
2824 #define STANDARD_RIGHTS_REQUIRED 0x000f0000
2826 #define STANDARD_RIGHTS_READ READ_CONTROL
2827 #define STANDARD_RIGHTS_WRITE READ_CONTROL
2828 #define STANDARD_RIGHTS_EXECUTE READ_CONTROL
2830 #define STANDARD_RIGHTS_ALL 0x001f0000
2832 #define SPECIFIC_RIGHTS_ALL 0x0000ffff
2834 #define GENERIC_READ 0x80000000
2835 #define GENERIC_WRITE 0x40000000
2836 #define GENERIC_EXECUTE 0x20000000
2837 #define GENERIC_ALL 0x10000000
2839 #define MAXIMUM_ALLOWED 0x02000000
2840 #define ACCESS_SYSTEM_SECURITY 0x01000000
2842 #define EVENT_MODIFY_STATE 0x0002
2843 #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2845 #define SEMAPHORE_MODIFY_STATE 0x0002
2846 #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2848 #define MUTEX_MODIFY_STATE 0x0001
2849 #define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
2851 #define TIMER_QUERY_STATE 0x0001
2852 #define TIMER_MODIFY_STATE 0x0002
2853 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
2855 #define PROCESS_TERMINATE 0x0001
2856 #define PROCESS_CREATE_THREAD 0x0002
2857 #define PROCESS_VM_OPERATION 0x0008
2858 #define PROCESS_VM_READ 0x0010
2859 #define PROCESS_VM_WRITE 0x0020
2860 #define PROCESS_DUP_HANDLE 0x0040
2861 #define PROCESS_CREATE_PROCESS 0x0080
2862 #define PROCESS_SET_QUOTA 0x0100
2863 #define PROCESS_SET_INFORMATION 0x0200
2864 #define PROCESS_QUERY_INFORMATION 0x0400
2865 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
2867 #define THREAD_TERMINATE 0x0001
2868 #define THREAD_SUSPEND_RESUME 0x0002
2869 #define THREAD_GET_CONTEXT 0x0008
2870 #define THREAD_SET_CONTEXT 0x0010
2871 #define THREAD_SET_INFORMATION 0x0020
2872 #define THREAD_QUERY_INFORMATION 0x0040
2873 #define THREAD_SET_THREAD_TOKEN 0x0080
2874 #define THREAD_IMPERSONATE 0x0100
2875 #define THREAD_DIRECT_IMPERSONATION 0x0200
2876 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
2878 #define THREAD_BASE_PRIORITY_LOWRT 15
2879 #define THREAD_BASE_PRIORITY_MAX 2
2880 #define THREAD_BASE_PRIORITY_MIN -2
2881 #define THREAD_BASE_PRIORITY_IDLE -15
2883 #define FILE_READ_DATA 0x0001 /* file & pipe */
2884 #define FILE_LIST_DIRECTORY 0x0001 /* directory */
2885 #define FILE_WRITE_DATA 0x0002 /* file & pipe */
2886 #define FILE_ADD_FILE 0x0002 /* directory */
2887 #define FILE_APPEND_DATA 0x0004 /* file */
2888 #define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
2889 #define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
2890 #define FILE_READ_EA 0x0008 /* file & directory */
2891 #define FILE_READ_PROPERTIES FILE_READ_EA
2892 #define FILE_WRITE_EA 0x0010 /* file & directory */
2893 #define FILE_WRITE_PROPERTIES FILE_WRITE_EA
2894 #define FILE_EXECUTE 0x0020 /* file */
2895 #define FILE_TRAVERSE 0x0020 /* directory */
2896 #define FILE_DELETE_CHILD 0x0040 /* directory */
2897 #define FILE_READ_ATTRIBUTES 0x0080 /* all */
2898 #define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
2899 #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
2901 #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
2902 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
2903 SYNCHRONIZE)
2904 #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
2905 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
2906 FILE_APPEND_DATA | SYNCHRONIZE)
2907 #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
2908 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
2911 /* File attribute flags */
2912 #define FILE_SHARE_READ 0x00000001L
2913 #define FILE_SHARE_WRITE 0x00000002L
2914 #define FILE_SHARE_DELETE 0x00000004L
2915 #define FILE_ATTRIBUTE_READONLY 0x00000001L
2916 #define FILE_ATTRIBUTE_HIDDEN 0x00000002L
2917 #define FILE_ATTRIBUTE_SYSTEM 0x00000004L
2918 #define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
2919 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
2920 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
2921 #define FILE_ATTRIBUTE_NORMAL 0x00000080L
2922 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
2923 #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
2924 #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
2925 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
2926 #define FILE_ATTRIBUTE_OFFLINE 0x00001000L
2927 #define FILE_ATTRIBUTE_SYMLINK 0x80000000L /* Not in Windows API */
2929 /* File notification flags */
2930 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001
2931 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002
2932 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004
2933 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008
2934 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010
2935 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020
2936 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040
2937 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100
2939 #define FILE_ACTION_ADDED 0x00000001
2940 #define FILE_ACTION_REMOVED 0x00000002
2941 #define FILE_ACTION_MODIFIED 0x00000003
2942 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004
2943 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005
2946 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001
2947 #define FILE_CASE_PRESERVED_NAMES 0x00000002
2948 #define FILE_UNICODE_ON_DISK 0x00000004
2949 #define FILE_PERSISTENT_ACLS 0x00000008
2950 #define FILE_FILE_COMPRESSION 0x00000010
2951 #define FILE_VOLUME_IS_COMPRESSED 0x00008000
2953 /* File alignments (NT) */
2954 #define FILE_BYTE_ALIGNMENT 0x00000000
2955 #define FILE_WORD_ALIGNMENT 0x00000001
2956 #define FILE_LONG_ALIGNMENT 0x00000003
2957 #define FILE_QUAD_ALIGNMENT 0x00000007
2958 #define FILE_OCTA_ALIGNMENT 0x0000000f
2959 #define FILE_32_BYTE_ALIGNMENT 0x0000001f
2960 #define FILE_64_BYTE_ALIGNMENT 0x0000003f
2961 #define FILE_128_BYTE_ALIGNMENT 0x0000007f
2962 #define FILE_256_BYTE_ALIGNMENT 0x000000ff
2963 #define FILE_512_BYTE_ALIGNMENT 0x000001ff
2965 #define REG_NONE 0 /* no type */
2966 #define REG_SZ 1 /* string type (ASCII) */
2967 #define REG_EXPAND_SZ 2 /* string, includes %ENVVAR% (expanded by caller) (ASCII) */
2968 #define REG_BINARY 3 /* binary format, callerspecific */
2969 /* YES, REG_DWORD == REG_DWORD_LITTLE_ENDIAN */
2970 #define REG_DWORD 4 /* DWORD in little endian format */
2971 #define REG_DWORD_LITTLE_ENDIAN 4 /* DWORD in little endian format */
2972 #define REG_DWORD_BIG_ENDIAN 5 /* DWORD in big endian format */
2973 #define REG_LINK 6 /* symbolic link (UNICODE) */
2974 #define REG_MULTI_SZ 7 /* multiple strings, delimited by \0, terminated by \0\0 (ASCII) */
2975 #define REG_RESOURCE_LIST 8 /* resource list? huh? */
2976 #define REG_FULL_RESOURCE_DESCRIPTOR 9 /* full resource descriptor? huh? */
2977 #define REG_RESOURCE_REQUIREMENTS_LIST 10
2979 /* ----------------------------- begin registry ----------------------------- */
2981 /* Registry security values */
2982 #define OWNER_SECURITY_INFORMATION 0x00000001
2983 #define GROUP_SECURITY_INFORMATION 0x00000002
2984 #define DACL_SECURITY_INFORMATION 0x00000004
2985 #define SACL_SECURITY_INFORMATION 0x00000008
2987 #define REG_OPTION_RESERVED 0x00000000
2988 #define REG_OPTION_NON_VOLATILE 0x00000000
2989 #define REG_OPTION_VOLATILE 0x00000001
2990 #define REG_OPTION_CREATE_LINK 0x00000002
2991 #define REG_OPTION_BACKUP_RESTORE 0x00000004 /* FIXME */
2992 #define REG_OPTION_OPEN_LINK 0x00000008
2993 #define REG_LEGAL_OPTION (REG_OPTION_RESERVED| \
2994 REG_OPTION_NON_VOLATILE| \
2995 REG_OPTION_VOLATILE| \
2996 REG_OPTION_CREATE_LINK| \
2997 REG_OPTION_BACKUP_RESTORE| \
2998 REG_OPTION_OPEN_LINK)
3001 #define REG_CREATED_NEW_KEY 0x00000001
3002 #define REG_OPENED_EXISTING_KEY 0x00000002
3004 /* For RegNotifyChangeKeyValue */
3005 #define REG_NOTIFY_CHANGE_NAME 0x1
3007 #define KEY_QUERY_VALUE 0x00000001
3008 #define KEY_SET_VALUE 0x00000002
3009 #define KEY_CREATE_SUB_KEY 0x00000004
3010 #define KEY_ENUMERATE_SUB_KEYS 0x00000008
3011 #define KEY_NOTIFY 0x00000010
3012 #define KEY_CREATE_LINK 0x00000020
3014 #define KEY_READ ((STANDARD_RIGHTS_READ| \
3015 KEY_QUERY_VALUE| \
3016 KEY_ENUMERATE_SUB_KEYS| \
3017 KEY_NOTIFY) \
3018 & (~SYNCHRONIZE) \
3020 #define KEY_WRITE ((STANDARD_RIGHTS_WRITE| \
3021 KEY_SET_VALUE| \
3022 KEY_CREATE_SUB_KEY) \
3023 & (~SYNCHRONIZE) \
3025 #define KEY_EXECUTE ((KEY_READ) \
3026 & (~SYNCHRONIZE)) \
3028 #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL| \
3029 KEY_QUERY_VALUE| \
3030 KEY_SET_VALUE| \
3031 KEY_CREATE_SUB_KEY| \
3032 KEY_ENUMERATE_SUB_KEYS| \
3033 KEY_NOTIFY| \
3034 KEY_CREATE_LINK) \
3035 & (~SYNCHRONIZE) \
3037 /* ------------------------------ end registry ------------------------------ */
3040 typedef struct _RTL_CRITICAL_SECTION_DEBUG
3042 WORD Type;
3043 WORD CreatorBackTraceIndex;
3044 struct _RTL_CRITICAL_SECTION *CriticalSection;
3045 LIST_ENTRY ProcessLocksList;
3046 DWORD EntryCount;
3047 DWORD ContentionCount;
3048 DWORD Spare[ 2 ];
3049 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
3051 typedef struct _RTL_CRITICAL_SECTION {
3052 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
3053 LONG LockCount;
3054 LONG RecursionCount;
3055 HANDLE OwningThread;
3056 HANDLE LockSemaphore;
3057 ULONG_PTR SpinCount;
3058 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
3061 #define EVENTLOG_SUCCESS 0x0000
3062 #define EVENTLOG_ERROR_TYPE 0x0001
3063 #define EVENTLOG_WARNING_TYPE 0x0002
3064 #define EVENTLOG_INFORMATION_TYPE 0x0004
3065 #define EVENTLOG_AUDIT_SUCCESS 0x0008
3066 #define EVENTLOG_AUDIT_FAILURE 0x0010
3068 #define SERVICE_BOOT_START 0x00000000
3069 #define SERVICE_SYSTEM_START 0x00000001
3070 #define SERVICE_AUTO_START 0x00000002
3071 #define SERVICE_DEMAND_START 0x00000003
3072 #define SERVICE_DISABLED 0x00000004
3074 #define SERVICE_ERROR_IGNORE 0x00000000
3075 #define SERVICE_ERROR_NORMAL 0x00000001
3076 #define SERVICE_ERROR_SEVERE 0x00000002
3077 #define SERVICE_ERROR_CRITICAL 0x00000003
3079 /* Service types */
3080 #define SERVICE_KERNEL_DRIVER 0x00000001
3081 #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
3082 #define SERVICE_ADAPTER 0x00000004
3083 #define SERVICE_RECOGNIZER_DRIVER 0x00000008
3085 #define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
3086 SERVICE_RECOGNIZER_DRIVER )
3088 #define SERVICE_WIN32_OWN_PROCESS 0x00000010
3089 #define SERVICE_WIN32_SHARE_PROCESS 0x00000020
3090 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
3092 #define SERVICE_INTERACTIVE_PROCESS 0x00000100
3094 #define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
3095 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
3098 typedef enum _CM_SERVICE_NODE_TYPE
3100 DriverType = SERVICE_KERNEL_DRIVER,
3101 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
3102 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
3103 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
3104 AdapterType = SERVICE_ADAPTER,
3105 RecognizerType = SERVICE_RECOGNIZER_DRIVER
3106 } SERVICE_NODE_TYPE;
3108 typedef enum _CM_SERVICE_LOAD_TYPE
3110 BootLoad = SERVICE_BOOT_START,
3111 SystemLoad = SERVICE_SYSTEM_START,
3112 AutoLoad = SERVICE_AUTO_START,
3113 DemandLoad = SERVICE_DEMAND_START,
3114 DisableLoad = SERVICE_DISABLED
3115 } SERVICE_LOAD_TYPE;
3117 typedef enum _CM_ERROR_CONTROL_TYPE
3119 IgnoreError = SERVICE_ERROR_IGNORE,
3120 NormalError = SERVICE_ERROR_NORMAL,
3121 SevereError = SERVICE_ERROR_SEVERE,
3122 CriticalError = SERVICE_ERROR_CRITICAL
3123 } SERVICE_ERROR_TYPE;
3127 #define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
3128 #define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
3129 #define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
3130 #define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
3131 #define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
3133 #include "guiddef.h"
3135 #include "poppack.h"
3137 #endif /* __WINE_WINNT_H */