source: trunk/include/win/winnt.h@ 8082

Last change on this file since 8082 was 8009, checked in by sandervl, 24 years ago

removed Rtl* macros

File size: 52.5 KB
Line 
1/*
2 * Win32 definitions for Windows NT
3 *
4 * Copyright 1996 Alexandre Julliard
5 */
6
7#ifndef __WINE_WINNT_H
8#define __WINE_WINNT_H
9
10#include "windef.h"
11
12#include "pshpack1.h"
13/* Defines */
14
15#define UNREFERENCED_PARAMETER(a)
16
17/* Argument 1 passed to the DllEntryProc. */
18#define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
19#define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
20#define DLL_THREAD_ATTACH 2 /* attach new thread */
21#define DLL_THREAD_DETACH 3 /* detach thread */
22
23
24/* u.x.wProcessorArchitecture (NT) */
25#define PROCESSOR_ARCHITECTURE_INTEL 0
26#define PROCESSOR_ARCHITECTURE_MIPS 1
27#define PROCESSOR_ARCHITECTURE_ALPHA 2
28#define PROCESSOR_ARCHITECTURE_PPC 3
29#define PROCESSOR_ARCHITECTURE_SHX 4
30#define PROCESSOR_ARCHITECTURE_ARM 5
31#define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
32
33/* dwProcessorType */
34#define PROCESSOR_INTEL_386 386
35#define PROCESSOR_INTEL_486 486
36#define PROCESSOR_INTEL_PENTIUM 586
37#define PROCESSOR_INTEL_860 860
38#define PROCESSOR_MIPS_R2000 2000
39#define PROCESSOR_MIPS_R3000 3000
40#define PROCESSOR_MIPS_R4000 4000
41#define PROCESSOR_ALPHA_21064 21064
42#define PROCESSOR_PPC_601 601
43#define PROCESSOR_PPC_603 603
44#define PROCESSOR_PPC_604 604
45#define PROCESSOR_PPC_620 620
46#define PROCESSOR_HITACHI_SH3 10003
47#define PROCESSOR_HITACHI_SH3E 10004
48#define PROCESSOR_HITACHI_SH4 10005
49#define PROCESSOR_MOTOROLA_821 821
50#define PROCESSOR_SHx_SH3 103
51#define PROCESSOR_SHx_SH4 104
52#define PROCESSOR_STRONGARM 2577
53#define PROCESSOR_ARM720 1824 /* 0x720 */
54#define PROCESSOR_ARM820 2080 /* 0x820 */
55#define PROCESSOR_ARM920 2336 /* 0x920 */
56#define PROCESSOR_ARM_7TDMI 70001
57
58#define ANYSIZE_ARRAY 1
59
60#define MINCHAR 0x80
61#define MAXCHAR 0x7f
62#define MINSHORT 0x8000
63#define MAXSHORT 0x7fff
64#define MINLONG 0x80000000
65#define MAXLONG 0x7fffffff
66#define MAXBYTE 0xff
67#define MAXWORD 0xffff
68#define MAXDWORD 0xffffffff
69
70#define FIELD_OFFSET(type, field) \
71 ((LONG)(INT)&(((type *)0)->field))
72
73#define CONTAINING_RECORD(address, type, field) \
74 ((type *)((PCHAR)(address) - (PCHAR)(&((type *)0)->field)))
75
76/* Types */
77
78/* TCHAR data types definitions for Winelib. */
79/* These types are _not_ defined for the emulator, because they */
80/* depend on the UNICODE macro that only exists in user's code. */
81
82#if !defined(__WINE__) && !defined(__WINE_WINDEF_H)
83# ifdef UNICODE
84typedef LPWSTR LPTSTR;
85typedef LPCWSTR LPCTSTR;
86#define __TEXT(string) L##string /*probably wrong */
87# else /* UNICODE */
88typedef LPSTR LPTSTR;
89typedef LPCSTR LPCTSTR;
90#define __TEXT(string) string
91# endif /* UNICODE */
92#endif /* __WINE__ */
93#define TEXT(quote) __TEXT(quote)
94
95typedef BYTE BOOLEAN;
96typedef BOOLEAN *PBOOLEAN;
97typedef DWORD EXECUTION_STATE;
98
99typedef struct _LIST_ENTRY {
100 struct _LIST_ENTRY *Flink;
101 struct _LIST_ENTRY *Blink;
102} LIST_ENTRY, *PLIST_ENTRY;
103
104typedef struct _SINGLE_LIST_ENTRY {
105 struct _SINGLE_LIST_ENTRY *Next;
106} SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY;
107
108/* Heap flags */
109
110#define HEAP_NO_SERIALIZE 0x00000001
111#define HEAP_GROWABLE 0x00000002
112#define HEAP_GENERATE_EXCEPTIONS 0x00000004
113#define HEAP_ZERO_MEMORY 0x00000008
114#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
115#define HEAP_TAIL_CHECKING_ENABLED 0x00000020
116#define HEAP_FREE_CHECKING_ENABLED 0x00000040
117#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
118#define HEAP_CREATE_ALIGN_16 0x00010000
119#define HEAP_CREATE_ENABLE_TRACING 0x00020000
120#define HEAP_WINE_SEGPTR 0x01000000 /* Not a Win32 flag */
121#define HEAP_WINE_CODESEG 0x02000000 /* Not a Win32 flag */
122#define HEAP_WINE_CODE16SEG 0x04000000 /* Not a Win32 flag */
123
124/* Processor feature flags. */
125#define PF_FLOATING_POINT_PRECISION_ERRATA 0
126#define PF_FLOATING_POINT_EMULATED 1
127#define PF_COMPARE_EXCHANGE_DOUBLE 2
128#define PF_MMX_INSTRUCTIONS_AVAILABLE 3
129#define PF_PPC_MOVEMEM_64BIT_OK 4
130#define PF_ALPHA_BYTE_INSTRUCTIONS 5
131
132
133/* The Win32 register context */
134
135/* CONTEXT is the CPU-dependent context; it should be used */
136/* wherever a platform-specific context is needed (e.g. exception */
137/* handling, Win32 register functions). */
138
139/* CONTEXT86 is the i386-specific context; it should be used */
140/* wherever only a 386 context makes sense (e.g. DOS interrupts, */
141/* Win16 register functions), so that this code can be compiled */
142/* on all platforms. */
143
144#define SIZE_OF_80387_REGISTERS 80
145
146typedef struct _FLOATING_SAVE_AREA
147{
148 DWORD ControlWord;
149 DWORD StatusWord;
150 DWORD TagWord;
151 DWORD ErrorOffset;
152 DWORD ErrorSelector;
153 DWORD DataOffset;
154 DWORD DataSelector;
155 BYTE RegisterArea[SIZE_OF_80387_REGISTERS];
156 DWORD Cr0NpxState;
157} FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA;
158
159typedef struct _CONTEXT86
160{
161 DWORD ContextFlags;
162
163 /* These are selected by CONTEXT_DEBUG_REGISTERS */
164 DWORD Dr0;
165 DWORD Dr1;
166 DWORD Dr2;
167 DWORD Dr3;
168 DWORD Dr6;
169 DWORD Dr7;
170
171 /* These are selected by CONTEXT_FLOATING_POINT */
172 FLOATING_SAVE_AREA FloatSave;
173
174 /* These are selected by CONTEXT_SEGMENTS */
175 DWORD SegGs;
176 DWORD SegFs;
177 DWORD SegEs;
178 DWORD SegDs;
179
180 /* These are selected by CONTEXT_INTEGER */
181 DWORD Edi;
182 DWORD Esi;
183 DWORD Ebx;
184 DWORD Edx;
185 DWORD Ecx;
186 DWORD Eax;
187
188 /* These are selected by CONTEXT_CONTROL */
189 DWORD Ebp;
190 DWORD Eip;
191 DWORD SegCs;
192 DWORD EFlags;
193 DWORD Esp;
194 DWORD SegSs;
195} CONTEXT86;
196
197#define CONTEXT_X86 0x00010000
198#define CONTEXT_i386 CONTEXT_X86
199#define CONTEXT_i486 CONTEXT_X86
200
201#define CONTEXT86_CONTROL (CONTEXT_i386 | 0x0001) /* SS:SP, CS:IP, FLAGS, BP */
202#define CONTEXT86_INTEGER (CONTEXT_i386 | 0x0002) /* AX, BX, CX, DX, SI, DI */
203#define CONTEXT86_SEGMENTS (CONTEXT_i386 | 0x0004) /* DS, ES, FS, GS */
204#define CONTEXT86_FLOATING_POINT (CONTEXT_i386 | 0x0008L) /* 387 state */
205#define CONTEXT86_DEBUG_REGISTERS (CONTEXT_i386 | 0x0010L) /* DB 0-3,6,7 */
206#define CONTEXT86_FULL (CONTEXT86_CONTROL | CONTEXT86_INTEGER | CONTEXT86_SEGMENTS)
207
208/* i386 context definitions */
209#ifdef __i386__
210
211#define CONTEXT_CONTROL CONTEXT86_CONTROL
212#define CONTEXT_INTEGER CONTEXT86_INTEGER
213#define CONTEXT_SEGMENTS CONTEXT86_SEGMENTS
214#define CONTEXT_FLOATING_POINT CONTEXT86_FLOATING_POINT
215#define CONTEXT_DEBUG_REGISTERS CONTEXT86_DEBUG_REGISTERS
216#define CONTEXT_FULL CONTEXT86_FULL
217
218typedef CONTEXT86 CONTEXT;
219
220#endif /* __i386__ */
221
222/* Alpha context definitions */
223#ifdef _ALPHA_
224
225#define CONTEXT_ALPHA 0x00020000
226
227#define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L)
228#define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L)
229#define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L)
230#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
231
232typedef struct _CONTEXT
233{
234 /* selected by CONTEXT_FLOATING_POINT */
235 ULONGLONG FltF0;
236 ULONGLONG FltF1;
237 ULONGLONG FltF2;
238 ULONGLONG FltF3;
239 ULONGLONG FltF4;
240 ULONGLONG FltF5;
241 ULONGLONG FltF6;
242 ULONGLONG FltF7;
243 ULONGLONG FltF8;
244 ULONGLONG FltF9;
245 ULONGLONG FltF10;
246 ULONGLONG FltF11;
247 ULONGLONG FltF12;
248 ULONGLONG FltF13;
249 ULONGLONG FltF14;
250 ULONGLONG FltF15;
251 ULONGLONG FltF16;
252 ULONGLONG FltF17;
253 ULONGLONG FltF18;
254 ULONGLONG FltF19;
255 ULONGLONG FltF20;
256 ULONGLONG FltF21;
257 ULONGLONG FltF22;
258 ULONGLONG FltF23;
259 ULONGLONG FltF24;
260 ULONGLONG FltF25;
261 ULONGLONG FltF26;
262 ULONGLONG FltF27;
263 ULONGLONG FltF28;
264 ULONGLONG FltF29;
265 ULONGLONG FltF30;
266 ULONGLONG FltF31;
267
268 /* selected by CONTEXT_INTEGER */
269 ULONGLONG IntV0;
270 ULONGLONG IntT0;
271 ULONGLONG IntT1;
272 ULONGLONG IntT2;
273 ULONGLONG IntT3;
274 ULONGLONG IntT4;
275 ULONGLONG IntT5;
276 ULONGLONG IntT6;
277 ULONGLONG IntT7;
278 ULONGLONG IntS0;
279 ULONGLONG IntS1;
280 ULONGLONG IntS2;
281 ULONGLONG IntS3;
282 ULONGLONG IntS4;
283 ULONGLONG IntS5;
284 ULONGLONG IntFp;
285 ULONGLONG IntA0;
286 ULONGLONG IntA1;
287 ULONGLONG IntA2;
288 ULONGLONG IntA3;
289 ULONGLONG IntA4;
290 ULONGLONG IntA5;
291 ULONGLONG IntT8;
292 ULONGLONG IntT9;
293 ULONGLONG IntT10;
294 ULONGLONG IntT11;
295 ULONGLONG IntRa;
296 ULONGLONG IntT12;
297 ULONGLONG IntAt;
298 ULONGLONG IntGp;
299 ULONGLONG IntSp;
300 ULONGLONG IntZero;
301
302 /* selected by CONTEXT_FLOATING_POINT */
303 ULONGLONG Fpcr;
304 ULONGLONG SoftFpcr;
305
306 /* selected by CONTEXT_CONTROL */
307 ULONGLONG Fir;
308 DWORD Psr;
309 DWORD ContextFlags;
310 DWORD Fill[4];
311} CONTEXT;
312
313#define _QUAD_PSR_OFFSET HighSoftFpcr
314#define _QUAD_FLAGS_OFFSET HighFir
315
316#endif /* _ALPHA_ */
317
318/* Mips context definitions */
319#ifdef _MIPS_
320
321#define CONTEXT_R4000 0x00010000
322
323#define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001)
324#define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002)
325#define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004)
326
327#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
328
329typedef struct _CONTEXT
330{
331 DWORD Argument[4];
332 /* These are selected by CONTEXT_FLOATING_POINT */
333 DWORD FltF0;
334 DWORD FltF1;
335 DWORD FltF2;
336 DWORD FltF3;
337 DWORD FltF4;
338 DWORD FltF5;
339 DWORD FltF6;
340 DWORD FltF7;
341 DWORD FltF8;
342 DWORD FltF9;
343 DWORD FltF10;
344 DWORD FltF11;
345 DWORD FltF12;
346 DWORD FltF13;
347 DWORD FltF14;
348 DWORD FltF15;
349 DWORD FltF16;
350 DWORD FltF17;
351 DWORD FltF18;
352 DWORD FltF19;
353 DWORD FltF20;
354 DWORD FltF21;
355 DWORD FltF22;
356 DWORD FltF23;
357 DWORD FltF24;
358 DWORD FltF25;
359 DWORD FltF26;
360 DWORD FltF27;
361 DWORD FltF28;
362 DWORD FltF29;
363 DWORD FltF30;
364 DWORD FltF31;
365
366 /* These are selected by CONTEXT_INTEGER */
367 DWORD IntZero;
368 DWORD IntAt;
369 DWORD IntV0;
370 DWORD IntV1;
371 DWORD IntA0;
372 DWORD IntA1;
373 DWORD IntA2;
374 DWORD IntA3;
375 DWORD IntT0;
376 DWORD IntT1;
377 DWORD IntT2;
378 DWORD IntT3;
379 DWORD IntT4;
380 DWORD IntT5;
381 DWORD IntT6;
382 DWORD IntT7;
383 DWORD IntS0;
384 DWORD IntS1;
385 DWORD IntS2;
386 DWORD IntS3;
387 DWORD IntS4;
388 DWORD IntS5;
389 DWORD IntS6;
390 DWORD IntS7;
391 DWORD IntT8;
392 DWORD IntT9;
393 DWORD IntK0;
394 DWORD IntK1;
395 DWORD IntGp;
396 DWORD IntSp;
397 DWORD IntS8;
398 DWORD IntRa;
399 DWORD IntLo;
400 DWORD IntHi;
401
402 /* These are selected by CONTEXT_FLOATING_POINT */
403 DWORD Fsr;
404
405 /* These are selected by CONTEXT_CONTROL */
406 DWORD Fir;
407 DWORD Psr;
408
409 DWORD ContextFlags;
410 DWORD Fill[2];
411} CONTEXT;
412
413#endif /* _MIPS_ */
414
415/* PowerPC context definitions */
416#ifdef __PPC__
417
418#define CONTEXT_CONTROL 0x0001
419#define CONTEXT_FLOATING_POINT 0x0002
420#define CONTEXT_INTEGER 0x0004
421#define CONTEXT_DEBUG_REGISTERS 0x0008
422#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
423
424typedef struct
425{
426 /* These are selected by CONTEXT_FLOATING_POINT */
427 double Fpr0;
428 double Fpr1;
429 double Fpr2;
430 double Fpr3;
431 double Fpr4;
432 double Fpr5;
433 double Fpr6;
434 double Fpr7;
435 double Fpr8;
436 double Fpr9;
437 double Fpr10;
438 double Fpr11;
439 double Fpr12;
440 double Fpr13;
441 double Fpr14;
442 double Fpr15;
443 double Fpr16;
444 double Fpr17;
445 double Fpr18;
446 double Fpr19;
447 double Fpr20;
448 double Fpr21;
449 double Fpr22;
450 double Fpr23;
451 double Fpr24;
452 double Fpr25;
453 double Fpr26;
454 double Fpr27;
455 double Fpr28;
456 double Fpr29;
457 double Fpr30;
458 double Fpr31;
459 double Fpscr;
460
461 /* These are selected by CONTEXT_INTEGER */
462 DWORD Gpr0;
463 DWORD Gpr1;
464 DWORD Gpr2;
465 DWORD Gpr3;
466 DWORD Gpr4;
467 DWORD Gpr5;
468 DWORD Gpr6;
469 DWORD Gpr7;
470 DWORD Gpr8;
471 DWORD Gpr9;
472 DWORD Gpr10;
473 DWORD Gpr11;
474 DWORD Gpr12;
475 DWORD Gpr13;
476 DWORD Gpr14;
477 DWORD Gpr15;
478 DWORD Gpr16;
479 DWORD Gpr17;
480 DWORD Gpr18;
481 DWORD Gpr19;
482 DWORD Gpr20;
483 DWORD Gpr21;
484 DWORD Gpr22;
485 DWORD Gpr23;
486 DWORD Gpr24;
487 DWORD Gpr25;
488 DWORD Gpr26;
489 DWORD Gpr27;
490 DWORD Gpr28;
491 DWORD Gpr29;
492 DWORD Gpr30;
493 DWORD Gpr31;
494
495 DWORD Cr;
496 DWORD Xer;
497
498 /* These are selected by CONTEXT_CONTROL */
499 DWORD Msr;
500 DWORD Iar;
501 DWORD Lr;
502 DWORD Ctr;
503
504 DWORD ContextFlags;
505 DWORD Fill[3];
506
507 /* These are selected by CONTEXT_DEBUG_REGISTERS */
508 DWORD Dr0;
509 DWORD Dr1;
510 DWORD Dr2;
511 DWORD Dr3;
512 DWORD Dr4;
513 DWORD Dr5;
514 DWORD Dr6;
515 DWORD Dr7;
516} CONTEXT;
517
518typedef struct _STACK_FRAME_HEADER
519{
520 DWORD BackChain;
521 DWORD GlueSaved1;
522 DWORD GlueSaved2;
523 DWORD Reserved1;
524 DWORD Spare1;
525 DWORD Spare2;
526
527 DWORD Parameter0;
528 DWORD Parameter1;
529 DWORD Parameter2;
530 DWORD Parameter3;
531 DWORD Parameter4;
532 DWORD Parameter5;
533 DWORD Parameter6;
534 DWORD Parameter7;
535} STACK_FRAME_HEADER,*PSTACK_FRAME_HEADER;
536
537#endif /* __PPC__ */
538
539#ifdef __sparc__
540
541/*
542 * FIXME:
543 *
544 * There is no official CONTEXT structure defined for the SPARC
545 * architecture, so I just made one up.
546 *
547 * This structure is valid only for 32-bit SPARC architectures,
548 * not for 64-bit SPARC.
549 *
550 * Note that this structure contains only the 'top-level' registers;
551 * the rest of the register window chain is not visible.
552 *
553 * The layout follows the Solaris 'prgregset_t' structure.
554 *
555 */
556
557#define CONTEXT_SPARC 0x10000000
558
559#define CONTEXT_CONTROL (CONTEXT_SPARC | 0x00000001)
560#define CONTEXT_FLOATING_POINT (CONTEXT_SPARC | 0x00000002)
561#define CONTEXT_INTEGER (CONTEXT_SPARC | 0x00000004)
562
563#define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER)
564
565typedef struct _CONTEXT
566{
567 DWORD ContextFlags;
568
569 /* These are selected by CONTEXT_INTEGER */
570 DWORD g0;
571 DWORD g1;
572 DWORD g2;
573 DWORD g3;
574 DWORD g4;
575 DWORD g5;
576 DWORD g6;
577 DWORD g7;
578 DWORD o0;
579 DWORD o1;
580 DWORD o2;
581 DWORD o3;
582 DWORD o4;
583 DWORD o5;
584 DWORD o6;
585 DWORD o7;
586 DWORD l0;
587 DWORD l1;
588 DWORD l2;
589 DWORD l3;
590 DWORD l4;
591 DWORD l5;
592 DWORD l6;
593 DWORD l7;
594 DWORD i0;
595 DWORD i1;
596 DWORD i2;
597 DWORD i3;
598 DWORD i4;
599 DWORD i5;
600 DWORD i6;
601 DWORD i7;
602
603 /* These are selected by CONTEXT_CONTROL */
604 DWORD psr;
605 DWORD pc;
606 DWORD npc;
607 DWORD y;
608 DWORD wim;
609 DWORD tbr;
610
611 /* FIXME: floating point registers missing */
612
613} CONTEXT;
614
615#endif
616
617#if !defined(CONTEXT_FULL) && !defined(RC_INVOKED)
618#error You need to define a CONTEXT for your CPU
619#endif
620
621typedef CONTEXT *PCONTEXT;
622typedef HANDLE *PHANDLE;
623
624#ifdef __WINE__
625
626/* Macros for easier access to i386 context registers */
627
628#define EAX_reg(context) ((context)->Eax)
629#define EBX_reg(context) ((context)->Ebx)
630#define ECX_reg(context) ((context)->Ecx)
631#define EDX_reg(context) ((context)->Edx)
632#define ESI_reg(context) ((context)->Esi)
633#define EDI_reg(context) ((context)->Edi)
634#define EBP_reg(context) ((context)->Ebp)
635
636#define CS_reg(context) ((context)->SegCs)
637#define DS_reg(context) ((context)->SegDs)
638#define ES_reg(context) ((context)->SegEs)
639#define FS_reg(context) ((context)->SegFs)
640#define GS_reg(context) ((context)->SegGs)
641#define SS_reg(context) ((context)->SegSs)
642
643#define EFL_reg(context) ((context)->EFlags)
644#define EIP_reg(context) ((context)->Eip)
645#define ESP_reg(context) ((context)->Esp)
646
647#define AX_reg(context) (*(WORD*)&EAX_reg(context))
648#define BX_reg(context) (*(WORD*)&EBX_reg(context))
649#define CX_reg(context) (*(WORD*)&ECX_reg(context))
650#define DX_reg(context) (*(WORD*)&EDX_reg(context))
651#define SI_reg(context) (*(WORD*)&ESI_reg(context))
652#define DI_reg(context) (*(WORD*)&EDI_reg(context))
653#define BP_reg(context) (*(WORD*)&EBP_reg(context))
654
655#define AL_reg(context) (*(BYTE*)&EAX_reg(context))
656#define AH_reg(context) (*((BYTE*)&EAX_reg(context)+1))
657#define BL_reg(context) (*(BYTE*)&EBX_reg(context))
658#define BH_reg(context) (*((BYTE*)&EBX_reg(context)+1))
659#define CL_reg(context) (*(BYTE*)&ECX_reg(context))
660#define CH_reg(context) (*((BYTE*)&ECX_reg(context)+1))
661#define DL_reg(context) (*(BYTE*)&EDX_reg(context))
662#define DH_reg(context) (*((BYTE*)&EDX_reg(context)+1))
663
664#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
665#define RESET_CFLAG(context) (EFL_reg(context) &= ~0x0001)
666#define SET_ZFLAG(context) (EFL_reg(context) |= 0x0040)
667#define RESET_ZFLAG(context) (EFL_reg(context) &= ~0x0040)
668
669#define ISV86(context) (EFL_reg(context) & 0x00020000)
670#define V86BASE(context) ((context)->Dr7) /* ugly */
671
672
673/* Macros to retrieve the current context */
674
675#ifdef __i386__
676#define _DEFINE_REGS_ENTRYPOINT( name, fn, args ) \
677 __asm__(".align 4\n\t" \
678 ".globl " #name "\n\t" \
679 ".type " #name ",@function\n\t" \
680 #name ":\n\t" \
681 "call CALL32_Regs\n\t" \
682 ".long " #fn "\n\t" \
683 ".byte " #args ", " #args "\n\t");
684
685#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
686 _DEFINE_REGS_ENTRYPOINT( name, fn, 0 )
687#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
688 _DEFINE_REGS_ENTRYPOINT( name, fn, 4 )
689#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
690 _DEFINE_REGS_ENTRYPOINT( name, fn, 8 )
691#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
692 _DEFINE_REGS_ENTRYPOINT( name, fn, 12 )
693#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
694 _DEFINE_REGS_ENTRYPOINT( name, fn, 16 )
695
696#endif /* __i386__ */
697
698#ifdef __sparc__
699/* FIXME: use getcontext() to retrieve full context */
700#define _GET_CONTEXT \
701 CONTEXT context; \
702 do { memset(&context, 0, sizeof(CONTEXT)); \
703 context.ContextFlags = CONTEXT_CONTROL; \
704 context.pc = (DWORD)__builtin_return_address(0); \
705 } while (0)
706
707#define DEFINE_REGS_ENTRYPOINT_0( name, fn ) \
708 void WINAPI name ( void ) \
709 { _GET_CONTEXT; fn( &context ); }
710#define DEFINE_REGS_ENTRYPOINT_1( name, fn, t1 ) \
711 void WINAPI name ( t1 a1 ) \
712 { _GET_CONTEXT; fn( a1, &context ); }
713#define DEFINE_REGS_ENTRYPOINT_2( name, fn, t1, t2 ) \
714 void WINAPI name ( t1 a1, t2 a2 ) \
715 { _GET_CONTEXT; fn( a1, a2, &context ); }
716#define DEFINE_REGS_ENTRYPOINT_3( name, fn, t1, t2, t3 ) \
717 void WINAPI name ( t1 a1, t2 a2, t3 a3 ) \
718 { _GET_CONTEXT; fn( a1, a2, a3, &context ); }
719#define DEFINE_REGS_ENTRYPOINT_4( name, fn, t1, t2, t3, t4 ) \
720 void WINAPI name ( t1 a1, t2 a2, t3 a3, t4 a4 ) \
721 { _GET_CONTEXT; fn( a1, a2, a3, a4, &context ); }
722
723#endif /* __sparc__ */
724
725#ifndef DEFINE_REGS_ENTRYPOINT_0
726#error You need to define DEFINE_REGS_ENTRYPOINT macros for your CPU
727#endif
728
729#ifdef __i386__
730# define GET_IP(context) ((LPVOID)(context)->Eip)
731#endif
732#ifdef __sparc__
733# define GET_IP(context) ((LPVOID)(context)->pc)
734#endif
735
736#if !defined(GET_IP) && !defined(RC_INVOKED)
737# error You must define GET_IP for this CPU
738#endif
739
740#endif /* __WINE__ */
741
742/*
743 * Exception codes
744 */
745
746#define STATUS_SUCCESS 0x00000000
747#define STATUS_WAIT_0 0x00000000
748#define STATUS_ABANDONED_WAIT_0 0x00000080
749#define STATUS_USER_APC 0x000000C0
750#define STATUS_TIMEOUT 0x00000102
751#define STATUS_PENDING 0x00000103
752
753#define STATUS_GUARD_PAGE_VIOLATION 0x80000001
754#define STATUS_DATATYPE_MISALIGNMENT 0x80000002
755#define STATUS_BREAKPOINT 0x80000003
756#define STATUS_SINGLE_STEP 0x80000004
757#define STATUS_BUFFER_OVERFLOW 0x80000005
758#define STATUS_NO_MORE_FILES 0x80000006
759#define STATUS_WAKE_SYSTEM_DEBUGGER 0x80000007
760
761#define STATUS_HANDLES_CLOSED 0x8000000A
762#define STATUS_NO_INHERITANCE 0x8000000B
763#define STATUS_GUID_SUBSTITUTION_MADE 0x8000000C
764#define STATUS_PARTIAL_COPY 0x8000000D
765#define STATUS_DEVICE_PAPER_EMPTY 0x8000000E
766#define STATUS_DEVICE_POWERED_OFF 0x8000000F
767#define STATUS_DEVICE_OFF_LINE 0x80000010
768#define STATUS_DEVICE_BUSY 0x80000011
769#define STATUS_NO_MORE_EAS 0x80000012
770#define STATUS_INVALID_EA_NAME 0x80000013
771#define STATUS_EA_LIST_INCONSISTENT 0x80000014
772#define STATUS_INVALID_EA_FLAG 0x80000015
773#define STATUS_VERIFY_REQUIRED 0x80000016
774#define STATUS_EXTRANEOUS_INFORMATION 0x80000017
775#define STATUS_RXACT_COMMIT_NECESSARY 0x80000018
776#define STATUS_NO_MORE_ENTRIES 0x8000001A
777#define STATUS_FILEMARK_DETECTED 0x8000001B
778#define STATUS_MEDIA_CHANGED 0x8000001C
779#define STATUS_BUS_RESET 0x8000001D
780#define STATUS_END_OF_MEDIA 0x8000001E
781#define STATUS_BEGINNING_OF_MEDIA 0x8000001F
782#define STATUS_MEDIA_CHECK 0x80000020
783#define STATUS_SETMARK_DETECTED 0x80000021
784#define STATUS_NO_DATA_DETECTED 0x80000022
785#define STATUS_REDIRECTOR_HAS_OPEN_HANDLES 0x80000023
786#define STATUS_SERVER_HAS_OPEN_HANDLES 0x80000024
787#define STATUS_ALREADY_DISCONNECTED 0x80000025
788#define STATUS_LONGJUMP 0x80000026
789
790#define STATUS_UNSUCCESSFUL 0xC0000001
791#define STATUS_NOT_IMPLEMENTED 0xC0000002
792#define STATUS_INVALID_INFO_CLASS 0xC0000003
793#define STATUS_INFO_LENGTH_MISMATCH 0xC0000004
794#define STATUS_ACCESS_VIOLATION 0xC0000005
795#define STATUS_IN_PAGE_ERROR 0xC0000006
796#define STATUS_PAGEFILE_QUOTA 0xC0000007
797#define STATUS_INVALID_HANDLE 0xC0000008
798#define STATUS_BAD_INITIAL_STACK 0xC0000009
799#define STATUS_BAD_INITIAL_PC 0xC000000A
800#define STATUS_INVALID_CID 0xC000000B
801#define STATUS_TIMER_NOT_CANCELED 0xC000000C
802#define STATUS_INVALID_PARAMETER 0xC000000D
803#define STATUS_NO_SUCH_DEVICE 0xC000000E
804#define STATUS_NO_SUCH_FILE 0xC000000F
805#define STATUS_INVALID_DEVICE_REQUEST 0xC0000010
806#define STATUS_END_OF_FILE 0xC0000011
807#define STATUS_WRONG_VOLUME 0xC0000012
808#define STATUS_NO_MEDIA_IN_DEVICE 0xC0000013
809#define STATUS_UNRECOGNIZED_MEDIA 0xC0000014
810#define STATUS_NONEXISTENT_SECTOR 0xC0000015
811#define STATUS_MORE_PROCESSING_REQUIRED 0xC0000016
812#define STATUS_NO_MEMORY 0xC0000017
813#define STATUS_CONFLICTING_ADDRESSES 0xC0000018
814#define STATUS_NOT_MAPPED_VIEW 0xC0000019
815#define STATUS_UNABLE_TO_FREE_VM 0xC000001A
816#define STATUS_UNABLE_TO_DELETE_SECTION 0xC000001B
817#define STATUS_INVALID_SYSTEM_SERVICE 0xC000001C
818#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
819#define STATUS_INVALID_LOCK_SEQUENCE 0xC000001E
820#define STATUS_INVALID_VIEW_SIZE 0xC000001F
821#define STATUS_INVALID_FILE_FOR_SECTION 0xC0000020
822#define STATUS_ALREADY_COMMITTED 0xC0000021
823#define STATUS_ACCESS_DENIED 0xC0000022
824#define STATUS_BUFFER_TOO_SMALL 0xC0000023
825#define STATUS_OBJECT_TYPE_MISMATCH 0xC0000024
826#define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
827#define STATUS_INVALID_DISPOSITION 0xC0000026
828#define STATUS_UNWIND 0xC0000027
829#define STATUS_BAD_STACK 0xC0000028
830#define STATUS_INVALID_UNWIND_TARGET 0xC0000029
831#define STATUS_NOT_LOCKED 0xC000002A
832#define STATUS_PARITY_ERROR 0xC000002B
833#define STATUS_UNABLE_TO_DECOMMIT_VM 0xC000002C
834#define STATUS_NOT_COMMITTED 0xC000002D
835#define STATUS_INVALID_PORT_ATTRIBUTES 0xC000002E
836#define STATUS_PORT_MESSAGE_TOO_LONG 0xC000002F
837#define STATUS_INVALID_PARAMETER_MIX 0xC0000030
838#define STATUS_INVALID_QUOTA_LOWER 0xC0000031
839#define STATUS_DISK_CORRUPT_ERROR 0xC0000032
840#define STATUS_OBJECT_NAME_INVALID 0xC0000033
841#define STATUS_OBJECT_NAME_NOT_FOUND 0xC0000034
842#define STATUS_OBJECT_NAME_COLLISION 0xC0000035
843#define STATUS_PORT_DISCONNECTED 0xC0000037
844#define STATUS_DEVICE_ALREADY_ATTACHED 0xC0000038
845#define STATUS_OBJECT_PATH_INVALID 0xC0000039
846#define STATUS_OBJECT_PATH_NOT_FOUND 0xC000003A
847#define STATUS_PATH_SYNTAX_BAD 0xC000003B
848#define STATUS_DATA_OVERRUN 0xC000003C
849#define STATUS_DATA_LATE_ERROR 0xC000003D
850#define STATUS_DATA_ERROR 0xC000003E
851#define STATUS_CRC_ERROR 0xC000003F
852#define STATUS_SECTION_TOO_BIG 0xC0000040
853#define STATUS_PORT_CONNECTION_REFUSED 0xC0000041
854#define STATUS_INVALID_PORT_HANDLE 0xC0000042
855#define STATUS_SHARING_VIOLATION 0xC0000043
856#define STATUS_QUOTA_EXCEEDED 0xC0000044
857#define STATUS_INVALID_PAGE_PROTECTION 0xC0000045
858#define STATUS_MUTANT_NOT_OWNED 0xC0000046
859#define STATUS_SEMAPHORE_LIMIT_EXCEEDED 0xC0000047
860#define STATUS_PORT_ALREADY_SET 0xC0000048
861#define STATUS_SUSPEND_COUNT_EXCEEDED 0xC000004A
862#define STATUS_LOCK_NOT_GRANTED 0xC0000054 /* FIXME: not sure */
863#define STATUS_FILE_LOCK_CONFLICT 0xC0000055 /* FIXME: not sure */
864#define STATUS_UNKNOWN_REVISION 0xC0000058
865#define STATUS_INVALID_SECURITY_DESCR 0xC0000079
866#define STATUS_DISK_FULL 0xC000007F
867#define STATUS_SECTION_NOT_EXTENDED 0xC0000087
868#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
869#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
870#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
871#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
872#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
873#define STATUS_FLOAT_OVERFLOW 0xC0000091
874#define STATUS_FLOAT_STACK_CHECK 0xC0000092
875#define STATUS_FLOAT_UNDERFLOW 0xC0000093
876#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
877#define STATUS_INTEGER_OVERFLOW 0xC0000095
878#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
879#define STATUS_MEDIA_WRITE_PROTECTED 0XC00000A2
880#define STATUS_INVALID_PARAMETER_2 0xC00000F0
881#define STATUS_STACK_OVERFLOW 0xC00000FD
882#define STATUS_DIRECTORY_NOT_EMPTY 0xC0000101
883#define STATUS_TOO_MANY_OPENED_FILES 0xC000011F
884#define STATUS_CONTROL_C_EXIT 0xC000013A
885#define STATUS_PIPE_BROKEN 0xC000014B
886#define STATUS_NOT_REGISTRY_FILE 0xC000015C
887#define STATUS_PARTITION_FAILURE 0xC0000172
888#define STATUS_INVALID_BLOCK_LENGTH 0xC0000173
889#define STATUS_DEVICE_NOT_PARTITIONED 0xC0000174
890#define STATUS_UNABLE_TO_LOCK_MEDIA 0xC0000175
891#define STATUS_UNABLE_TO_UNLOAD_MEDIA 0xC0000176
892#define STATUS_EOM_OVERFLOW 0xC0000177
893#define STATUS_NO_MEDIA 0xC0000178
894#define STATUS_NO_SUCH_MEMBER 0xC000017A
895#define STATUS_INVALID_MEMBER 0xC000017B
896#define STATUS_KEY_DELETED 0xC000017C
897#define STATUS_NO_LOG_SPACE 0xC000017D
898#define STATUS_TOO_MANY_SIDS 0xC000017E
899#define STATUS_LM_CROSS_ENCRYPTION_REQUIRED 0xC000017F
900#define STATUS_KEY_HAS_CHILDREN 0xC0000180
901#define STATUS_CHILD_MUST_BE_VOLATILE 0xC0000181
902#define STATUS_DEVICE_CONFIGURATION_ERROR0xC0000182
903#define STATUS_DRIVER_INTERNAL_ERROR 0xC0000183
904#define STATUS_INVALID_DEVICE_STATE 0xC0000184
905#define STATUS_IO_DEVICE_ERROR 0xC0000185
906#define STATUS_DEVICE_PROTOCOL_ERROR 0xC0000186
907#define STATUS_BACKUP_CONTROLLER 0xC0000187
908#define STATUS_LOG_FILE_FULL 0xC0000188
909#define STATUS_TOO_LATE 0xC0000189
910#define STATUS_NO_TRUST_LSA_SECRET 0xC000018A
911#define STATUS_NO_TRUST_SAM_ACCOUNT 0xC000018B
912#define STATUS_TRUSTED_DOMAIN_FAILURE 0xC000018C
913#define STATUS_TRUSTED_RELATIONSHIP_FAILURE 0xC000018D
914#define STATUS_EVENTLOG_FILE_CORRUPT 0xC000018E
915#define STATUS_EVENTLOG_CANT_START 0xC000018F
916#define STATUS_TRUST_FAILURE 0xC0000190
917#define STATUS_MUTANT_LIMIT_EXCEEDED 0xC0000191
918#define STATUS_NETLOGON_NOT_STARTED 0xC0000192
919#define STATUS_ACCOUNT_EXPIRED 0xC0000193
920#define STATUS_POSSIBLE_DEADLOCK 0xC0000194
921#define STATUS_NETWORK_CREDENTIAL_CONFLICT 0xC0000195
922#define STATUS_REMOTE_SESSION_LIMIT 0xC0000196
923#define STATUS_EVENTLOG_FILE_CHANGED 0xC0000197
924#define STATUS_NOLOGON_INTERDOMAIN_TRUST_ACCOUNT 0xC0000198
925#define STATUS_NOLOGON_WORKSTATION_TRUST_ACCOUNT 0xC0000199
926#define STATUS_NOLOGON_SERVER_TRUST_ACCOUNT 0xC000019A
927#define STATUS_DOMAIN_TRUST_INCONSISTENT 0xC000019B
928#define STATUS_FS_DRIVER_REQUIRED 0xC000019C
929
930#define STATUS_RESOURCE_LANG_NOT_FOUND 0xC0000204
931
932#define MAXIMUM_WAIT_OBJECTS 64
933#define MAXIMUM_SUSPEND_COUNT 127
934
935#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
936#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
937#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
938#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
939#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
940#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
941#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
942#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
943#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
944#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
945#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
946#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
947#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
948#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
949#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
950#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
951#define EXCEPTION_ILLEGAL_INSTRUCTION STATUS_ILLEGAL_INSTRUCTION
952#define EXCEPTION_NONCONTINUABLE_EXCEPTION STATUS_NONCONTINUABLE_EXCEPTION
953#define EXCEPTION_STACK_OVERFLOW STATUS_STACK_OVERFLOW
954#define EXCEPTION_INVALID_DISPOSITION STATUS_INVALID_DISPOSITION
955#define EXCEPTION_GUARD_PAGE STATUS_GUARD_PAGE_VIOLATION
956#define EXCEPTION_INVALID_HANDLE STATUS_INVALID_HANDLE
957#define CONTROL_C_EXIT STATUS_CONTROL_C_EXIT
958
959/* Wine extension; Windows doesn't have a name for this code */
960#define EXCEPTION_CRITICAL_SECTION_WAIT 0xc0000194
961
962
963/*
964 * Return values from the actual exception handlers
965 */
966
967#define ExceptionContinueExecution 0
968#define ExceptionContinueSearch 1
969#define ExceptionNestedException 2
970#define ExceptionCollidedUnwind 3
971
972/*
973 * Return values from filters in except() and from UnhandledExceptionFilter
974 */
975
976#define EXCEPTION_EXECUTE_HANDLER 1
977#define EXCEPTION_CONTINUE_SEARCH 0
978#define EXCEPTION_CONTINUE_EXECUTION -1
979
980/*
981 * From OS/2 2.0 exception handling
982 * Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
983 */
984
985#define EH_NONCONTINUABLE 0x01
986#define EH_UNWINDING 0x02
987#define EH_EXIT_UNWIND 0x04
988#define EH_STACK_INVALID 0x08
989#define EH_NESTED_CALL 0x10
990
991#define EXCEPTION_CONTINUABLE 0
992#define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
993
994/*
995 * The exception record used by Win32 to give additional information
996 * about exception to exception handlers.
997 */
998
999#define EXCEPTION_MAXIMUM_PARAMETERS 15
1000
1001typedef struct __EXCEPTION_RECORD
1002{
1003 DWORD ExceptionCode;
1004 DWORD ExceptionFlags;
1005 struct __EXCEPTION_RECORD *ExceptionRecord;
1006
1007 LPVOID ExceptionAddress;
1008 DWORD NumberParameters;
1009 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
1010} EXCEPTION_RECORD, *PEXCEPTION_RECORD;
1011
1012/*
1013 * The exception pointers structure passed to exception filters
1014 * in except() and the UnhandledExceptionFilter().
1015 */
1016
1017typedef struct _EXCEPTION_POINTERS
1018{
1019 PEXCEPTION_RECORD ExceptionRecord;
1020 PCONTEXT ContextRecord;
1021} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
1022
1023
1024/*
1025 * The exception frame, used for registering exception handlers
1026 * Win32 cares only about this, but compilers generally emit
1027 * larger exception frames for their own use.
1028 */
1029
1030struct __EXCEPTION_FRAME;
1031
1032typedef DWORD (*PEXCEPTION_HANDLER)(PEXCEPTION_RECORD,struct __EXCEPTION_FRAME*,
1033 PCONTEXT,struct __EXCEPTION_FRAME **);
1034
1035typedef struct __EXCEPTION_FRAME
1036{
1037 struct __EXCEPTION_FRAME *Prev;
1038 PEXCEPTION_HANDLER Handler;
1039} EXCEPTION_FRAME, *PEXCEPTION_FRAME;
1040
1041#include "poppack.h"
1042
1043/*
1044 * function pointer to a exception filter
1045 */
1046
1047typedef LONG (* CALLBACK PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
1048typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
1049
1050DWORD WINAPI UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
1051LPTOP_LEVEL_EXCEPTION_FILTER
1052WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
1053
1054/* status values for ContinueDebugEvent */
1055#define DBG_CONTINUE 0x00010002
1056#define DBG_TERMINATE_THREAD 0x40010003
1057#define DBG_TERMINATE_PROCESS 0x40010004
1058#define DBG_CONTROL_C 0x40010005
1059#define DBG_CONTROL_BREAK 0x40010008
1060#define DBG_EXCEPTION_NOT_HANDLED 0x80010001
1061
1062struct _TEB;
1063
1064#ifdef __WINE__
1065
1066#ifndef __WIN32OS2__
1067#if defined(__i386__)
1068static inline struct _TEB * WINE_UNUSED __get_teb(void)
1069{
1070 struct _TEB *teb;
1071 __asm__(".byte 0x64\n\tmovl (0x18),%0" : "=r" (teb));
1072 return teb;
1073}
1074#elif defined(HAVE__LWP_CREATE)
1075extern void *_lwp_getprivate(void);
1076static inline struct _TEB * WINE_UNUSED __get_teb(void)
1077{
1078 return (struct _TEB *)_lwp_getprivate();
1079}
1080#else
1081#error NtCurrentTeb() not defined for this architecture!
1082#endif
1083
1084#define NtCurrentTeb() __get_teb()
1085
1086#else /* __WINE__ */
1087#define NtCurrentTeb GetThreadTEB
1088struct _TEB *WINAPI GetThreadTEB();
1089#endif
1090#endif //__WIN32OS2__
1091
1092/*
1093 * Here follows typedefs for security and tokens.
1094 */
1095
1096/*
1097 * First a constant for the following typdefs.
1098 */
1099
1100#define ANYSIZE_ARRAY 1
1101
1102/* FIXME: Orphan. What does it point to? */
1103typedef PVOID PACCESS_TOKEN;
1104
1105/*
1106 * TOKEN_INFORMATION_CLASS
1107 */
1108
1109typedef enum _TOKEN_INFORMATION_CLASS {
1110 TokenUser = 1,
1111 TokenGroups,
1112 TokenPrivileges,
1113 TokenOwner,
1114 TokenPrimaryGroup,
1115 TokenDefaultDacl,
1116 TokenSource,
1117 TokenType,
1118 TokenImpersonationLevel,
1119 TokenStatistics
1120} TOKEN_INFORMATION_CLASS;
1121
1122#ifndef _SECURITY_DEFINED
1123#define _SECURITY_DEFINED
1124
1125#include "pshpack1.h"
1126
1127typedef DWORD ACCESS_MASK, *PACCESS_MASK;
1128
1129typedef struct _GENERIC_MAPPING {
1130 ACCESS_MASK GenericRead;
1131 ACCESS_MASK GenericWrite;
1132 ACCESS_MASK GenericExecute;
1133 ACCESS_MASK GenericAll;
1134} GENERIC_MAPPING, *PGENERIC_MAPPING;
1135
1136#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED
1137#define SID_IDENTIFIER_AUTHORITY_DEFINED
1138typedef struct {
1139 BYTE Value[6];
1140} SID_IDENTIFIER_AUTHORITY,*PSID_IDENTIFIER_AUTHORITY,*LPSID_IDENTIFIER_AUTHORITY;
1141#endif /* !defined(SID_IDENTIFIER_AUTHORITY_DEFINED) */
1142
1143#ifndef SID_DEFINED
1144#define SID_DEFINED
1145typedef struct _SID {
1146 BYTE Revision;
1147 BYTE SubAuthorityCount;
1148 SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
1149 DWORD SubAuthority[1];
1150} SID,*PSID;
1151#endif /* !defined(SID_DEFINED) */
1152
1153#define SID_REVISION (1) /* Current revision */
1154#define SID_MAX_SUB_AUTHORITIES (15) /* current max subauths */
1155#define SID_RECOMMENDED_SUB_AUTHORITIES (1) /* recommended subauths */
1156
1157
1158/*
1159 * ACL
1160 */
1161
1162#define ACL_REVISION1 1
1163#define ACL_REVISION2 2
1164#define ACL_REVISION3 3
1165#define ACL_REVISION4 4
1166
1167typedef enum _ACL_INFORMATION_CLASS {
1168 AclRevisionInformation = 1,
1169 AclSizeInformation
1170} ACL_INFORMATION_CLASS;
1171
1172typedef struct _ACL_REVISION_INFORMATION {
1173 DWORD AclRevision;
1174} ACL_REVISION_INFORMATION;
1175typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION;
1176
1177typedef struct _ACL_SIZE_INFORMATION {
1178 DWORD AceCount;
1179 DWORD AclBytesInUse;
1180 DWORD AclBytesFree;
1181} ACL_SIZE_INFORMATION;
1182typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION;
1183
1184#define MIN_ACL_REVISION ACL_REVISION2
1185#define MAX_ACL_REVISION ACL_REVISION4
1186
1187typedef struct _ACL {
1188 BYTE AclRevision;
1189 BYTE Sbz1;
1190 WORD AclSize;
1191 WORD AceCount;
1192 WORD Sbz2;
1193} ACL, *PACL;
1194
1195
1196/* SECURITY_DESCRIPTOR */
1197#define SECURITY_DESCRIPTOR_REVISION 1
1198#define SECURITY_DESCRIPTOR_REVISION1 1
1199
1200
1201#define SE_OWNER_DEFAULTED 0x0001
1202#define SE_GROUP_DEFAULTED 0x0002
1203#define SE_DACL_PRESENT 0x0004
1204#define SE_DACL_DEFAULTED 0x0008
1205#define SE_SACL_PRESENT 0x0010
1206#define SE_SACL_DEFAULTED 0x0020
1207#define SE_SELF_RELATIVE 0x8000
1208
1209typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
1210typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
1211
1212/* The security descriptor structure */
1213typedef struct {
1214 BYTE Revision;
1215 BYTE Sbz1;
1216 SECURITY_DESCRIPTOR_CONTROL Control;
1217 DWORD Owner;
1218 DWORD Group;
1219 DWORD Sacl;
1220 DWORD Dacl;
1221} SECURITY_DESCRIPTOR_RELATIVE, *PISECURITY_DESCRIPTOR_RELATIVE;
1222
1223typedef struct {
1224 BYTE Revision;
1225 BYTE Sbz1;
1226 SECURITY_DESCRIPTOR_CONTROL Control;
1227 PSID Owner;
1228 PSID Group;
1229 PACL Sacl;
1230 PACL Dacl;
1231} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
1232
1233#define SECURITY_DESCRIPTOR_MIN_LENGTH (sizeof(SECURITY_DESCRIPTOR))
1234
1235#include "poppack.h"
1236
1237#endif /* _SECURITY_DEFINED */
1238
1239#include "pshpack1.h"
1240
1241/*
1242 * SID_AND_ATTRIBUTES
1243 */
1244
1245typedef struct _SID_AND_ATTRIBUTES {
1246 PSID Sid;
1247 DWORD Attributes;
1248} SID_AND_ATTRIBUTES ;
1249
1250/* security entities */
1251#define SECURITY_NULL_RID (0x00000000L)
1252#define SECURITY_WORLD_RID (0x00000000L)
1253#define SECURITY_LOCAL_RID (0X00000000L)
1254
1255#define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0}
1256
1257/* S-1-1 */
1258#define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1}
1259
1260/* S-1-2 */
1261#define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2}
1262
1263/* S-1-3 */
1264#define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3}
1265#define SECURITY_CREATOR_OWNER_RID (0x00000000L)
1266#define SECURITY_CREATOR_GROUP_RID (0x00000001L)
1267#define SECURITY_CREATOR_OWNER_SERVER_RID (0x00000002L)
1268#define SECURITY_CREATOR_GROUP_SERVER_RID (0x00000003L)
1269
1270/* S-1-4 */
1271#define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4}
1272
1273/* S-1-5 */
1274#define SECURITY_NT_AUTHORITY {0,0,0,0,0,5}
1275#define SECURITY_DIALUP_RID 0x00000001L
1276#define SECURITY_NETWORK_RID 0x00000002L
1277#define SECURITY_BATCH_RID 0x00000003L
1278#define SECURITY_INTERACTIVE_RID 0x00000004L
1279#define SECURITY_LOGON_IDS_RID 0x00000005L
1280#define SECURITY_SERVICE_RID 0x00000006L
1281#define SECURITY_ANONYMOUS_LOGON_RID 0x00000007L
1282#define SECURITY_PROXY_RID 0x00000008L
1283#define SECURITY_ENTERPRISE_CONTROLLERS_RID 0x00000009L
1284#define SECURITY_PRINCIPAL_SELF_RID 0x0000000AL
1285#define SECURITY_AUTHENTICATED_USER_RID 0x0000000BL
1286#define SECURITY_RESTRICTED_CODE_RID 0x0000000CL
1287#define SECURITY_TERMINAL_SERVER_RID 0x0000000DL
1288#define SECURITY_LOCAL_SYSTEM_RID 0x00000012L
1289#define SECURITY_NT_NON_UNIQUE 0x00000015L
1290#define SECURITY_BUILTIN_DOMAIN_RID 0x00000020L
1291
1292#define DOMAIN_GROUP_RID_ADMINS 0x00000200L
1293#define DOMAIN_GROUP_RID_USERS 0x00000201L
1294#define DOMAIN_GROUP_RID_GUESTS 0x00000202L
1295
1296#define DOMAIN_ALIAS_RID_ADMINS 0x00000220L
1297#define DOMAIN_ALIAS_RID_USERS 0x00000221L
1298#define DOMAIN_ALIAS_RID_GUESTS 0x00000222L
1299
1300#define SECURITY_SERVER_LOGON_RID SECURITY_ENTERPRISE_CONTROLLERS_RID
1301
1302#define SECURITY_LOGON_IDS_RID_COUNT (3L)
1303
1304/*
1305 * TOKEN_USER
1306 */
1307
1308typedef struct _TOKEN_USER {
1309 SID_AND_ATTRIBUTES User;
1310} TOKEN_USER;
1311
1312/*
1313 * TOKEN_GROUPS
1314 */
1315
1316typedef struct _TOKEN_GROUPS {
1317 DWORD GroupCount;
1318 SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
1319} TOKEN_GROUPS, *PTOKEN_GROUPS;
1320
1321/*
1322 * LUID_AND_ATTRIBUTES
1323 */
1324#if defined(__WIN32OS2__) && !defined(WINE_LARGE_INTEGER)
1325typedef struct _LARGE_INTEGER {
1326 ULONG LowPart;
1327 LONG HighPart;
1328} LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
1329
1330typedef struct _ULARGE_INTEGER {
1331 ULONG LowPart;
1332 LONG HighPart;
1333} ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
1334#else
1335typedef union _LARGE_INTEGER {
1336 struct {
1337 DWORD LowPart;
1338 LONG HighPart;
1339 } DUMMYSTRUCTNAME;
1340 LONGLONG QuadPart;
1341} LARGE_INTEGER, *LPLARGE_INTEGER, *PLARGE_INTEGER;
1342
1343typedef union _ULARGE_INTEGER {
1344 struct {
1345 DWORD LowPart;
1346 DWORD HighPart;
1347 } DUMMYSTRUCTNAME;
1348 ULONGLONG QuadPart;
1349} ULARGE_INTEGER, *LPULARGE_INTEGER, *PULARGE_INTEGER;
1350#endif
1351/*
1352 * Locally Unique Identifier
1353 */
1354
1355typedef LARGE_INTEGER LUID,*PLUID;
1356
1357typedef struct _LUID_AND_ATTRIBUTES {
1358 LUID Luid;
1359 DWORD Attributes;
1360} LUID_AND_ATTRIBUTES;
1361
1362/*
1363 * PRIVILEGE_SET
1364 */
1365
1366typedef struct _PRIVILEGE_SET {
1367 DWORD PrivilegeCount;
1368 DWORD Control;
1369 LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY];
1370} PRIVILEGE_SET, *PPRIVILEGE_SET;
1371
1372/*
1373 * TOKEN_PRIVILEGES
1374 */
1375
1376typedef struct _TOKEN_PRIVILEGES {
1377 DWORD PrivilegeCount;
1378 LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY];
1379} TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES;
1380
1381/*
1382 * TOKEN_OWNER
1383 */
1384
1385typedef struct _TOKEN_OWNER {
1386 PSID Owner;
1387} TOKEN_OWNER;
1388
1389/*
1390 * TOKEN_PRIMARY_GROUP
1391 */
1392
1393typedef struct _TOKEN_PRIMARY_GROUP {
1394 PSID PrimaryGroup;
1395} TOKEN_PRIMARY_GROUP;
1396
1397
1398/*
1399 * TOKEN_DEFAULT_DACL
1400 */
1401
1402typedef struct _TOKEN_DEFAULT_DACL {
1403 PACL DefaultDacl;
1404} TOKEN_DEFAULT_DACL;
1405
1406/*
1407 * TOKEN_SOURCEL
1408 */
1409
1410typedef struct _TOKEN_SOURCE {
1411 char Sourcename[8];
1412 LUID SourceIdentifier;
1413} TOKEN_SOURCE;
1414
1415/*
1416 * TOKEN_TYPE
1417 */
1418
1419typedef enum tagTOKEN_TYPE {
1420 TokenPrimary = 1,
1421 TokenImpersonation
1422} TOKEN_TYPE;
1423
1424/*
1425 * SECURITY_IMPERSONATION_LEVEL
1426 */
1427
1428typedef enum _SECURITY_IMPERSONATION_LEVEL {
1429 SecurityAnonymous,
1430 SecurityIdentification,
1431 SecurityImpersonation,
1432 SecurityDelegation
1433} SECURITY_IMPERSONATION_LEVEL, *PSECURITY_IMPERSONATION_LEVEL;
1434
1435
1436typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE,
1437 * PSECURITY_CONTEXT_TRACKING_MODE;
1438/*
1439 * Quality of Service
1440 */
1441
1442typedef struct _SECURITY_QUALITY_OF_SERVICE {
1443 DWORD Length;
1444 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
1445 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode;
1446 BOOL EffectiveOnly;
1447} SECURITY_QUALITY_OF_SERVICE, *PSECURITY_QUALITY_OF_SERVICE;
1448
1449/*
1450 * TOKEN_STATISTICS
1451 */
1452
1453typedef struct _TOKEN_STATISTICS {
1454 LUID TokenId;
1455 LUID AuthenticationId;
1456 LARGE_INTEGER ExpirationTime;
1457 TOKEN_TYPE TokenType;
1458 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel;
1459 DWORD DynamicCharged;
1460 DWORD DynamicAvailable;
1461 DWORD GroupCount;
1462 DWORD PrivilegeCount;
1463 LUID ModifiedId;
1464} TOKEN_STATISTICS;
1465
1466/*
1467 * ACLs of NT
1468 */
1469
1470#define ACL_REVISION 2
1471
1472#define ACL_REVISION1 1
1473#define ACL_REVISION2 2
1474
1475/* ACEs, directly starting after an ACL */
1476typedef struct _ACE_HEADER {
1477 BYTE AceType;
1478 BYTE AceFlags;
1479 WORD AceSize;
1480} ACE_HEADER,*PACE_HEADER;
1481
1482/* AceType */
1483#define ACCESS_ALLOWED_ACE_TYPE 0
1484#define ACCESS_DENIED_ACE_TYPE 1
1485#define SYSTEM_AUDIT_ACE_TYPE 2
1486#define SYSTEM_ALARM_ACE_TYPE 3
1487
1488/* inherit AceFlags */
1489#define OBJECT_INHERIT_ACE 0x01
1490#define CONTAINER_INHERIT_ACE 0x02
1491#define NO_PROPAGATE_INHERIT_ACE 0x04
1492#define INHERIT_ONLY_ACE 0x08
1493#define VALID_INHERIT_FLAGS 0x0F
1494
1495/* AceFlags mask for what events we (should) audit */
1496#define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
1497#define FAILED_ACCESS_ACE_FLAG 0x80
1498
1499/* different ACEs depending on AceType
1500 * SidStart marks the begin of a SID
1501 * so the thing finally looks like this:
1502 * 0: ACE_HEADER
1503 * 4: ACCESS_MASK
1504 * 8... : SID
1505 */
1506typedef struct _ACCESS_ALLOWED_ACE {
1507 ACE_HEADER Header;
1508 DWORD Mask;
1509 DWORD SidStart;
1510} ACCESS_ALLOWED_ACE,*PACCESS_ALLOWED_ACE;
1511
1512typedef struct _ACCESS_DENIED_ACE {
1513 ACE_HEADER Header;
1514 DWORD Mask;
1515 DWORD SidStart;
1516} ACCESS_DENIED_ACE,*PACCESS_DENIED_ACE;
1517
1518typedef struct _SYSTEM_AUDIT_ACE {
1519 ACE_HEADER Header;
1520 DWORD Mask;
1521 DWORD SidStart;
1522} SYSTEM_AUDIT_ACE,*PSYSTEM_AUDIT_ACE;
1523
1524typedef struct _SYSTEM_ALARM_ACE {
1525 ACE_HEADER Header;
1526 DWORD Mask;
1527 DWORD SidStart;
1528} SYSTEM_ALARM_ACE,*PSYSTEM_ALARM_ACE;
1529
1530typedef enum tagSID_NAME_USE {
1531 SidTypeUser = 1,
1532 SidTypeGroup,
1533 SidTypeDomain,
1534 SidTypeAlias,
1535 SidTypeWellKnownGroup,
1536 SidTypeDeletedAccount,
1537 SidTypeInvalid,
1538 SidTypeUnknown
1539} SID_NAME_USE,*PSID_NAME_USE;
1540
1541/* Access rights */
1542
1543#define DELETE 0x00010000
1544#define READ_CONTROL 0x00020000
1545#define WRITE_DAC 0x00040000
1546#define WRITE_OWNER 0x00080000
1547#define SYNCHRONIZE 0x00100000
1548#define STANDARD_RIGHTS_REQUIRED 0x000f0000
1549
1550#define STANDARD_RIGHTS_READ READ_CONTROL
1551#define STANDARD_RIGHTS_WRITE READ_CONTROL
1552#define STANDARD_RIGHTS_EXECUTE READ_CONTROL
1553
1554#define STANDARD_RIGHTS_ALL 0x001f0000
1555
1556#define SPECIFIC_RIGHTS_ALL 0x0000ffff
1557
1558#define GENERIC_READ 0x80000000
1559#define GENERIC_WRITE 0x40000000
1560#define GENERIC_EXECUTE 0x20000000
1561#define GENERIC_ALL 0x10000000
1562
1563#define MAXIMUM_ALLOWED 0x02000000
1564#define ACCESS_SYSTEM_SECURITY 0x01000000
1565
1566#define EVENT_MODIFY_STATE 0x0002
1567#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
1568
1569#define SEMAPHORE_MODIFY_STATE 0x0002
1570#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
1571
1572#define MUTEX_MODIFY_STATE 0x0001
1573#define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
1574
1575#define PROCESS_TERMINATE 0x0001
1576#define PROCESS_CREATE_THREAD 0x0002
1577#define PROCESS_VM_OPERATION 0x0008
1578#define PROCESS_VM_READ 0x0010
1579#define PROCESS_VM_WRITE 0x0020
1580#define PROCESS_DUP_HANDLE 0x0040
1581#define PROCESS_CREATE_PROCESS 0x0080
1582#define PROCESS_SET_QUOTA 0x0100
1583#define PROCESS_SET_INFORMATION 0x0200
1584#define PROCESS_QUERY_INFORMATION 0x0400
1585#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
1586
1587#define THREAD_TERMINATE 0x0001
1588#define THREAD_SUSPEND_RESUME 0x0002
1589#define THREAD_GET_CONTEXT 0x0008
1590#define THREAD_SET_CONTEXT 0x0010
1591#define THREAD_SET_INFORMATION 0x0020
1592#define THREAD_QUERY_INFORMATION 0x0040
1593#define THREAD_SET_THREAD_TOKEN 0x0080
1594#define THREAD_IMPERSONATE 0x0100
1595#define THREAD_DIRECT_IMPERSONATION 0x0200
1596#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
1597
1598#define THREAD_BASE_PRIORITY_LOWRT 15
1599#define THREAD_BASE_PRIORITY_MAX 2
1600#define THREAD_BASE_PRIORITY_MIN -2
1601#define THREAD_BASE_PRIORITY_IDLE -15
1602
1603#define FILE_READ_DATA 0x0001 /* file & pipe */
1604#define FILE_LIST_DIRECTORY 0x0001 /* directory */
1605#define FILE_WRITE_DATA 0x0002 /* file & pipe */
1606#define FILE_ADD_FILE 0x0002 /* directory */
1607#define FILE_APPEND_DATA 0x0004 /* file */
1608#define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
1609#define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
1610#define FILE_READ_EA 0x0008 /* file & directory */
1611#define FILE_READ_PROPERTIES FILE_READ_EA
1612#define FILE_WRITE_EA 0x0010 /* file & directory */
1613#define FILE_WRITE_PROPERTIES FILE_WRITE_EA
1614#define FILE_EXECUTE 0x0020 /* file */
1615#define FILE_TRAVERSE 0x0020 /* directory */
1616#define FILE_DELETE_CHILD 0x0040 /* directory */
1617#define FILE_READ_ATTRIBUTES 0x0080 /* all */
1618#define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
1619#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
1620
1621#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
1622 FILE_READ_ATTRIBUTES | FILE_READ_EA | \
1623 SYNCHRONIZE)
1624#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
1625 FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
1626 FILE_APPEND_DATA | SYNCHRONIZE)
1627#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
1628 FILE_READ_ATTRIBUTES | SYNCHRONIZE)
1629
1630
1631/* File attribute flags
1632 */
1633#define FILE_SHARE_READ 0x00000001L
1634#define FILE_SHARE_WRITE 0x00000002L
1635#define FILE_SHARE_DELETE 0x00000004L
1636#define FILE_ATTRIBUTE_READONLY 0x00000001L
1637#define FILE_ATTRIBUTE_HIDDEN 0x00000002L
1638#define FILE_ATTRIBUTE_SYSTEM 0x00000004L
1639#define FILE_ATTRIBUTE_LABEL 0x00000008L /* Not in Windows API */
1640#define FILE_ATTRIBUTE_DIRECTORY 0x00000010L
1641#define FILE_ATTRIBUTE_ARCHIVE 0x00000020L
1642#define FILE_ATTRIBUTE_NORMAL 0x00000080L
1643#define FILE_ATTRIBUTE_TEMPORARY 0x00000100L
1644#define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200L
1645#define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400L
1646#define FILE_ATTRIBUTE_COMPRESSED 0x00000800L
1647#define FILE_ATTRIBUTE_OFFLINE 0x00001000L
1648#define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001L
1649#define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002L
1650#define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004L
1651#define FILE_NOTIFY_CHANGE_SIZE 0x00000008L
1652#define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010L
1653#define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020L
1654#define FILE_NOTIFY_CHANGE_CREATION 0x00000040L
1655#define FILE_NOTIFY_CHANGE_SECURITY 0x00000100L
1656#define FILE_ACTION_ADDED 0x00000001L
1657#define FILE_ACTION_REMOVED 0x00000002L
1658#define FILE_ACTION_MODIFIED 0x00000003L
1659#define FILE_ACTION_RENAMED_OLD_NAME 0x00000004L
1660#define FILE_ACTION_RENAMED_NEW_NAME 0x00000005L
1661#define MAILSLOT_NO_MESSAGE ((DWORD)-1)
1662#define MAILSLOT_WAIT_FOREVER ((DWORD)-1)
1663
1664/* File alignments (NT) */
1665#define FILE_BYTE_ALIGNMENT 0x00000000
1666#define FILE_WORD_ALIGNMENT 0x00000001
1667#define FILE_LONG_ALIGNMENT 0x00000003
1668#define FILE_QUAD_ALIGNMENT 0x00000007
1669#define FILE_OCTA_ALIGNMENT 0x0000000f
1670#define FILE_32_BYTE_ALIGNMENT 0x0000001f
1671#define FILE_64_BYTE_ALIGNMENT 0x0000003f
1672#define FILE_128_BYTE_ALIGNMENT 0x0000007f
1673#define FILE_256_BYTE_ALIGNMENT 0x000000ff
1674#define FILE_512_BYTE_ALIGNMENT 0x000001ff
1675
1676/* Registry security values */
1677#define OWNER_SECURITY_INFORMATION 0x00000001
1678#define GROUP_SECURITY_INFORMATION 0x00000002
1679#define DACL_SECURITY_INFORMATION 0x00000004
1680#define SACL_SECURITY_INFORMATION 0x00000008
1681
1682
1683#define EVENTLOG_SUCCESS 0x0000
1684#define EVENTLOG_ERROR_TYPE 0x0001
1685#define EVENTLOG_WARNING_TYPE 0x0002
1686#define EVENTLOG_INFORMATION_TYPE 0x0004
1687#define EVENTLOG_AUDIT_SUCCESS 0x0008
1688#define EVENTLOG_AUDIT_FAILURE 0x0010
1689
1690#define SERVICE_BOOT_START 0x00000000
1691#define SERVICE_SYSTEM_START 0x00000001
1692#define SERVICE_AUTO_START 0x00000002
1693#define SERVICE_DEMAND_START 0x00000003
1694#define SERVICE_DISABLED 0x00000004
1695
1696#define SERVICE_ERROR_IGNORE 0x00000000
1697#define SERVICE_ERROR_NORMAL 0x00000001
1698#define SERVICE_ERROR_SEVERE 0x00000002
1699#define SERVICE_ERROR_CRITICAL 0x00000003
1700
1701/* Service types */
1702#define SERVICE_KERNEL_DRIVER 0x00000001
1703#define SERVICE_FILE_SYSTEM_DRIVER 0x00000002
1704#define SERVICE_ADAPTER 0x00000004
1705#define SERVICE_RECOGNIZER_DRIVER 0x00000008
1706
1707#define SERVICE_DRIVER ( SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | \
1708 SERVICE_RECOGNIZER_DRIVER )
1709
1710#define SERVICE_WIN32_OWN_PROCESS 0x00000010
1711#define SERVICE_WIN32_SHARE_PROCESS 0x00000020
1712#define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS)
1713
1714#define SERVICE_INTERACTIVE_PROCESS 0x00000100
1715
1716#define SERVICE_TYPE_ALL ( SERVICE_WIN32 | SERVICE_ADAPTER | \
1717 SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS )
1718
1719
1720typedef enum _CM_SERVICE_NODE_TYPE
1721{
1722 DriverType = SERVICE_KERNEL_DRIVER,
1723 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER,
1724 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS,
1725 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS,
1726 AdapterType = SERVICE_ADAPTER,
1727 RecognizerType = SERVICE_RECOGNIZER_DRIVER
1728} SERVICE_NODE_TYPE;
1729
1730typedef enum _CM_SERVICE_LOAD_TYPE
1731{
1732 BootLoad = SERVICE_BOOT_START,
1733 SystemLoad = SERVICE_SYSTEM_START,
1734 AutoLoad = SERVICE_AUTO_START,
1735 DemandLoad = SERVICE_DEMAND_START,
1736 DisableLoad = SERVICE_DISABLED
1737} SERVICE_LOAD_TYPE;
1738
1739typedef enum _CM_ERROR_CONTROL_TYPE
1740{
1741 IgnoreError = SERVICE_ERROR_IGNORE,
1742 NormalError = SERVICE_ERROR_NORMAL,
1743 SevereError = SERVICE_ERROR_SEVERE,
1744 CriticalError = SERVICE_ERROR_CRITICAL
1745} SERVICE_ERROR_TYPE;
1746
1747
1748#if 0
1749ndef __WINE__
1750#define RtlEqualMemory(Destination, Source, Length) (!memcmp((Destination),(Source),(Length)))
1751#define RtlMoveMemory(Destination, Source, Length) memmove((Destination),(Source),(Length))
1752#define RtlCopyMemory(Destination, Source, Length) memcpy((Destination),(Source),(Length))
1753#define RtlFillMemory(Destination, Length, Fill) memset((Destination),(Fill),(Length))
1754#define RtlZeroMemory(Destination, Length) memset((Destination),0,(Length))
1755#endif
1756
1757//#include "guiddef.h"
1758
1759typedef struct _RTL_CRITICAL_SECTION_DEBUG
1760{
1761 WORD Type;
1762 WORD CreatorBackTraceIndex;
1763 struct _RTL_CRITICAL_SECTION *CriticalSection;
1764 LIST_ENTRY ProcessLocksList;
1765 DWORD EntryCount;
1766 DWORD ContentionCount;
1767 DWORD Spare[ 2 ];
1768} RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG;
1769
1770typedef struct _RTL_CRITICAL_SECTION {
1771 PRTL_CRITICAL_SECTION_DEBUG DebugInfo;
1772 LONG LockCount;
1773 LONG RecursionCount;
1774 HANDLE OwningThread;
1775 HANDLE LockSemaphore;
1776 ULONG_PTR SpinCount;
1777} RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION;
1778
1779#include <peexe.h>
1780
1781#include "poppack.h"
1782
1783#endif /* __WINE_WINNT_H */
Note: See TracBrowser for help on using the repository browser.