|
|
1.1.1.2 ! root 1: /*++ BUILD Version: 0078 // Increment this if a change has global effects 1.1 root 2: 1.1.1.2 ! root 3: Copyright (c) 1990-1992 Microsoft Corporation 1.1 root 4: 5: Module Name: 6: 7: winnt.h 8: 9: Abstract: 10: 11: This module defines the 32-Bit Windows types and constants that are 12: defined by NT, but exposed through the Win32 API. 13: 14: Revision History: 15: 16: --*/ 17: 18: #ifndef _WINNT_ 19: #define _WINNT_ 20: 1.1.1.2 ! root 21: #define ANYSIZE_ARRAY 1 1.1 root 22: #ifdef MIPS 23: #define UNALIGNED __unaligned 24: #else 25: #define UNALIGNED 26: #endif 27: typedef void *PVOID; 28: 29: // 30: // Basics 31: // 32: 33: #ifndef VOID 34: #define VOID void 35: typedef char CHAR; 36: typedef short SHORT; 37: typedef long LONG; 38: #endif 39: 40: // 1.1.1.2 ! root 41: // UNICODE (Wide Character) types 1.1 root 42: // 43: 44: typedef unsigned short WCHAR; // wc, 16-bit UNICODE character 45: 1.1.1.2 ! root 46: typedef WCHAR *PWCHAR; ! 47: typedef WCHAR *LPWCH, *PWCH; ! 48: typedef CONST WCHAR *LPCWCH, *PCWCH; ! 49: typedef WCHAR *NWPSTR; ! 50: typedef WCHAR *LPWSTR, *PWSTR; ! 51: ! 52: typedef CONST WCHAR *LPCWSTR, *PCWSTR; 1.1 root 53: 54: // 1.1.1.2 ! root 55: // ANSI (Multi-byte Character) types 1.1 root 56: // 1.1.1.2 ! root 57: typedef CHAR *PCHAR; ! 58: typedef CHAR *LPCH, *PCH; ! 59: ! 60: typedef CONST CHAR *LPCCH, *PCCH; ! 61: typedef CHAR *NPSTR; ! 62: typedef CHAR *LPSTR, *PSTR; ! 63: typedef CONST CHAR *LPCSTR, *PCSTR; 1.1 root 64: 1.1.1.2 ! root 65: ! 66: // ! 67: // Neutral ANSI/UNICODE types and macros ! 68: // 1.1 root 69: #ifdef UNICODE 70: typedef WCHAR TCHAR; 1.1.1.2 ! root 71: typedef LPWSTR LPTCH, PTCH; ! 72: typedef LPWSTR PTSTR, LPTSTR; ! 73: typedef LPCWSTR LPCTSTR; ! 74: typedef LPWSTR LP; 1.1 root 75: #define TEXT(quote) L##quote 76: #else 1.1.1.2 ! root 77: typedef char TCHAR, *PTCHAR; ! 78: typedef LPSTR LPTCH, PTCH; ! 79: typedef LPSTR PTSTR, LPTSTR; ! 80: typedef LPCSTR LPCTSTR; 1.1 root 81: #define TEXT(quote) quote 82: #endif 83: 84: 85: typedef SHORT *PSHORT; 86: typedef LONG *PLONG; 1.1.1.2 ! root 87: #ifdef STRICT ! 88: typedef const void *HANDLE; ! 89: #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef const struct name##__ *name ! 90: ! 91: #else ! 92: typedef PVOID HANDLE; ! 93: #define DECLARE_HANDLE(name) typedef HANDLE name ! 94: #endif ! 95: typedef HANDLE *PHANDLE; ! 96: typedef char CCHAR; ! 97: /*lint -e624 */ ! 98: /*lint +e624 */ ! 99: #define APPLICATION_ERROR_MASK 0x20000000 ! 100: #define ERROR_SEVERITY_SUCCESS 0x00000000 ! 101: #define ERROR_SEVERITY_INFORMATIONAL 0x40000000 ! 102: #define ERROR_SEVERITY_WARNING 0x80000000 ! 103: #define ERROR_SEVERITY_ERROR 0xC0000000 ! 104: ! 105: typedef struct _LARGE_INTEGER { ! 106: DWORD LowPart; ! 107: LONG HighPart; ! 108: } LARGE_INTEGER, *PLARGE_INTEGER; ! 109: ! 110: typedef struct _ULARGE_INTEGER { ! 111: DWORD LowPart; ! 112: DWORD HighPart; ! 113: } ULARGE_INTEGER, *PULARGE_INTEGER; ! 114: ! 115: typedef LARGE_INTEGER LUID; ! 116: typedef LUID *PLUID; 1.1 root 117: #define UNICODE_NULL ((WCHAR)0) 1.1.1.2 ! root 118: typedef CCHAR BOOLEAN; ! 119: typedef BOOLEAN *PBOOLEAN; ! 120: // ! 121: // Doubly linked list structure. Can be used as either a list head, or ! 122: // as link words. ! 123: // ! 124: ! 125: typedef struct _LIST_ENTRY { ! 126: struct _LIST_ENTRY *Flink; ! 127: struct _LIST_ENTRY *Blink; ! 128: } LIST_ENTRY; ! 129: typedef LIST_ENTRY *PLIST_ENTRY; ! 130: ! 131: // ! 132: // Singly linked list structure. Can be used as either a list head, or ! 133: // as link words. ! 134: // ! 135: ! 136: typedef struct _SINGLE_LIST_ENTRY { ! 137: struct _SINGLE_LIST_ENTRY *Next; ! 138: } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; 1.1 root 139: #define MINCHAR 0x80 140: #define MAXCHAR 0x7f 141: #define MINSHORT 0x8000 142: #define MAXSHORT 0x7fff 143: #define MINLONG 0x80000000 144: #define MAXLONG 0x7fffffff 145: #define MAXBYTE 0xff 146: #define MAXWORD 0xffff 147: #define MAXDWORD 0xffffffff 148: 149: // 150: // Macros used to eliminate compiler warning generated when formal 151: // parameters or local variables are not declared. 152: // 153: // Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet 154: // referenced but will be once the module is completely developed. 155: // 156: // Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet 157: // referenced but will be once the module is completely developed. 158: // 159: // Use UNREFERENCED_PARAMETER() if a parameter will never be referenced. 160: // 161: // DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will 162: // eventually be made into a null macro to help determine whether there 163: // is unfinished work. 164: // 165: 166: #if ! (defined(lint) || defined(_lint)) 167: #define UNREFERENCED_PARAMETER(P) (P) 168: #define DBG_UNREFERENCED_PARAMETER(P) (P) 169: #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) 170: 171: #else // lint or _lint 172: 173: // Note: lint -e530 says don't complain about uninitialized variables for 174: // this. line +e530 turns that checking back on. Error 527 has to do with 175: // unreachable code. 176: 177: #define UNREFERENCED_PARAMETER(P) \ 178: /*lint -e527 -e530 */ \ 179: { \ 180: (P) = (P); \ 181: } \ 182: /*lint +e527 +e530 */ 183: #define DBG_UNREFERENCED_PARAMETER(P) \ 184: /*lint -e527 -e530 */ \ 185: { \ 186: (P) = (P); \ 187: } \ 188: /*lint +e527 +e530 */ 189: #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \ 190: /*lint -e527 -e530 */ \ 191: { \ 192: (V) = (V); \ 193: } \ 194: /*lint +e527 +e530 */ 195: 196: #endif // lint or _lint 197: 198: 1.1.1.2 ! root 199: /*lint -e767 */ 1.1 root 200: #define STATUS_WAIT_0 ((DWORD )0x00000000L) 201: #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) 1.1.1.2 ! root 202: #define STATUS_USER_APC ((DWORD )0x000000C0L) 1.1 root 203: #define STATUS_TIMEOUT ((DWORD )0x00000102L) 204: #define STATUS_PENDING ((DWORD )0x00000103L) 205: #define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L) 206: #define STATUS_BREAKPOINT ((DWORD )0x80000003L) 207: #define STATUS_SINGLE_STEP ((DWORD )0x80000004L) 208: #define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L) 1.1.1.2 ! root 209: #define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL) 1.1 root 210: #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L) 1.1.1.2 ! root 211: #define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L) ! 212: #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL) ! 213: #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL) ! 214: #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL) ! 215: #define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL) ! 216: #define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L) ! 217: #define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L) ! 218: #define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L) ! 219: #define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L) ! 220: #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L) ! 221: #define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L) ! 222: #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L) ! 223: #define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL) 1.1 root 224: #define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL) 1.1.1.2 ! root 225: /*lint +e767 */ 1.1 root 226: #define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects 227: 228: #define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended 229: typedef DWORD KSPIN_LOCK; 230: 231: #ifdef i386 232: 233: // 234: // Define the size of the 80387 save area, which is in the context frame. 235: // 236: 237: #define SIZE_OF_80387_REGISTERS 80 238: 239: // 240: // The following flags control the contents of the CONTEXT structure. 241: // 242: 243: #define CONTEXT_i386 0x00010000 // this assumes that i386 and 1.1.1.2 ! root 244: #define CONTEXT_i486 0x00010000 // i486 have identical context records 1.1 root 245: 246: #define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP 247: #define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI 248: #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS 249: #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) // 387 state 250: #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7 251: 252: #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\ 1.1.1.2 ! root 253: CONTEXT_SEGMENTS) 1.1 root 254: 255: typedef struct _FLOATING_SAVE_AREA { 256: DWORD ControlWord; 257: DWORD StatusWord; 258: DWORD TagWord; 259: DWORD ErrorOffset; 260: DWORD ErrorSelector; 261: DWORD DataOffset; 262: DWORD DataSelector; 263: BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; 1.1.1.2 ! root 264: DWORD Cr0NpxState; 1.1 root 265: } FLOATING_SAVE_AREA; 266: 267: typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; 268: 269: // 270: // Context Frame 271: // 272: // This frame has a several purposes: 1) it is used as an argument to 273: // NtContinue, 2) is is used to constuct a call frame for APC delivery, 274: // and 3) it is used in the user level thread creation routines. 275: // 276: // The layout of the record conforms to a standard call frame. 277: // 278: 279: typedef struct _CONTEXT { 280: 281: // 282: // The flags values within this flag control the contents of 283: // a CONTEXT record. 284: // 285: // If the context record is used as an input parameter, then 286: // for each portion of the context record controlled by a flag 287: // whose value is set, it is assumed that that portion of the 288: // context record contains valid context. If the context record 289: // is being used to modify a threads context, then only that 290: // portion of the threads context will be modified. 291: // 292: // If the context record is used as an IN OUT parameter to capture 293: // the context of a thread, then only those portions of the thread's 294: // context corresponding to set flags will be returned. 295: // 296: // The context record is never used as an OUT only parameter. 297: // 298: 299: DWORD ContextFlags; 300: 301: // 302: // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is 303: // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT 304: // included in CONTEXT_FULL. 305: // 306: 307: DWORD Dr0; 308: DWORD Dr1; 309: DWORD Dr2; 310: DWORD Dr3; 311: DWORD Dr6; 312: DWORD Dr7; 313: 314: // 315: // This section is specified/returned if the 316: // ContextFlags word contians the flag CONTEXT_FLOATING_POINT. 317: // 318: 319: FLOATING_SAVE_AREA FloatSave; 320: 321: // 322: // This section is specified/returned if the 323: // ContextFlags word contians the flag CONTEXT_SEGMENTS. 324: // 325: 326: DWORD SegGs; 327: DWORD SegFs; 328: DWORD SegEs; 329: DWORD SegDs; 330: 331: // 332: // This section is specified/returned if the 333: // ContextFlags word contians the flag CONTEXT_INTEGER. 334: // 335: 336: DWORD Edi; 337: DWORD Esi; 338: DWORD Ebx; 339: DWORD Edx; 340: DWORD Ecx; 341: DWORD Eax; 342: 343: // 344: // This section is specified/returned if the 345: // ContextFlags word contians the flag CONTEXT_CONTROL. 346: // 347: 348: DWORD Ebp; 349: DWORD Eip; 350: DWORD SegCs; // MUST BE SANITIZED 351: DWORD EFlags; // MUST BE SANITIZED 352: DWORD Esp; 353: DWORD SegSs; 354: 355: } CONTEXT; 356: 357: 358: 359: typedef CONTEXT *PCONTEXT; 360: 361: #endif // i386 362: 363: typedef struct _LDT_ENTRY { 364: WORD LimitLow; 365: WORD BaseLow; 366: union { 367: struct { 368: BYTE BaseMid; 369: BYTE Flags1; // Declare as bytes to avoid alignment 370: BYTE Flags2; // Problems. 371: BYTE BaseHi; 372: } Bytes; 373: struct { 374: DWORD BaseMid : 8; 375: DWORD Type : 5; 376: DWORD Dpl : 2; 377: DWORD Pres : 1; 378: DWORD LimitHi : 4; 379: DWORD Sys : 1; 380: DWORD Reserved_0 : 1; 381: DWORD Default_Big : 1; 382: DWORD Granularity : 1; 383: DWORD BaseHi : 8; 384: } Bits; 385: } HighWord; 386: } LDT_ENTRY, *PLDT_ENTRY; 387: 388: 389: #ifdef MIPS 390: 391: // 392: // The following flags control the contents of the CONTEXT structure. 393: // 394: 395: #define CONTEXT_R3000 0x00010000 // this assumes that r3000 and 396: #define CONTEXT_R4000 0x00010000 // r4000 have identical context records 397: 398: #define CONTEXT_CONTROL (CONTEXT_R3000 | 0x00000001L) 399: #define CONTEXT_FLOATING_POINT (CONTEXT_R3000 | 0x00000002L) 400: #define CONTEXT_INTEGER (CONTEXT_R3000 | 0x00000004L) 401: 402: #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) 403: 404: // 405: // Context Frame 406: // 407: // N.B. This frame must be exactly a multiple of 16 bytes in length. 408: // 409: // This frame has a several purposes: 1) it is used as an argument to 410: // NtContinue, 2) it is used to constuct a call frame for APC delivery, 411: // 3) it is used to construct a call frame for exception dispatching 412: // in user mode, and 4) it is used in the user level thread creation 413: // routines. 414: // 415: // The layout of the record conforms to a standard call frame. 416: // 417: 418: typedef struct _CONTEXT { 419: 420: // 421: // This section is always present and is used as an argument build 422: // area. 423: // 424: 425: DWORD Argument[4]; 426: 427: // 428: // This section is specified/returned if the ContextFlags word contains 429: // the flag CONTEXT_FLOATING_POINT. 430: // 431: 432: DWORD FltF0; 433: DWORD FltF1; 434: DWORD FltF2; 435: DWORD FltF3; 436: DWORD FltF4; 437: DWORD FltF5; 438: DWORD FltF6; 439: DWORD FltF7; 440: DWORD FltF8; 441: DWORD FltF9; 442: DWORD FltF10; 443: DWORD FltF11; 444: DWORD FltF12; 445: DWORD FltF13; 446: DWORD FltF14; 447: DWORD FltF15; 448: DWORD FltF16; 449: DWORD FltF17; 450: DWORD FltF18; 451: DWORD FltF19; 452: DWORD FltF20; 453: DWORD FltF21; 454: DWORD FltF22; 455: DWORD FltF23; 456: DWORD FltF24; 457: DWORD FltF25; 458: DWORD FltF26; 459: DWORD FltF27; 460: DWORD FltF28; 461: DWORD FltF29; 462: DWORD FltF30; 463: DWORD FltF31; 464: 465: // 466: // This section is specified/returned if the ContextFlags word contains 467: // the flag CONTEXT_INTEGER. 468: // 469: // N.B. The registers gp, sp, and ra are defined in this section, but are 470: // considered part of the control context rather than part of the integer 471: // context. 472: // 473: // N.B. Register zero is not stored in the frame. 474: // 475: 476: DWORD IntZero; 477: DWORD IntAt; 478: DWORD IntV0; 479: DWORD IntV1; 480: DWORD IntA0; 481: DWORD IntA1; 482: DWORD IntA2; 483: DWORD IntA3; 484: DWORD IntT0; 485: DWORD IntT1; 486: DWORD IntT2; 487: DWORD IntT3; 488: DWORD IntT4; 489: DWORD IntT5; 490: DWORD IntT6; 491: DWORD IntT7; 492: DWORD IntS0; 493: DWORD IntS1; 494: DWORD IntS2; 495: DWORD IntS3; 496: DWORD IntS4; 497: DWORD IntS5; 498: DWORD IntS6; 499: DWORD IntS7; 500: DWORD IntT8; 501: DWORD IntT9; 502: DWORD IntK0; 503: DWORD IntK1; 504: DWORD IntGp; 505: DWORD IntSp; 506: DWORD IntS8; 507: DWORD IntRa; 508: DWORD IntLo; 509: DWORD IntHi; 510: 511: // 512: // This section is specified/returned if the ContextFlags word contains 513: // the flag CONTEXT_FLOATING_POINT. 514: // 515: 516: DWORD Fsr; 517: 518: // 519: // This section is specified/returned if the ContextFlags word contains 520: // the flag CONTEXT_CONTROL. 521: // 522: // N.B. The registers gp, sp, and ra are defined in the integer section, 523: // but are considered part of the control context rather than part of 524: // the integer context. 525: // 526: 527: DWORD Fir; 528: DWORD Psr; 529: 530: // 531: // The flags values within this flag control the contents of 532: // a CONTEXT record. 533: // 534: // If the context record is used as an input parameter, then 535: // for each portion of the context record controlled by a flag 536: // whose value is set, it is assumed that that portion of the 537: // context record contains valid context. If the context record 538: // is being used to modify a thread's context, then only that 539: // portion of the threads context will be modified. 540: // 541: // If the context record is used as an IN OUT parameter to capture 542: // the context of a thread, then only those portions of the thread's 543: // context corresponding to set flags will be returned. 544: // 545: // The context record is never used as an OUT only parameter. 546: // 547: 548: DWORD ContextFlags; 549: 550: DWORD Fill[2]; 551: } CONTEXT, *PCONTEXT; 552: 553: #endif // MIPS 554: 555: 556: #ifdef MIPS 557: 558: VOID 559: __jump_unwind ( 560: PVOID Fp, 561: PVOID TargetPc 562: ); 563: 564: #endif // MIPS 565: 566: #define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception 1.1.1.2 ! root 567: #define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters 1.1 root 568: 569: // 570: // Exception record definition. 571: // 572: 573: typedef struct _EXCEPTION_RECORD { 1.1.1.2 ! root 574: /*lint -e18 */ // Don't complain about different definitions 1.1 root 575: DWORD ExceptionCode; 1.1.1.2 ! root 576: /*lint +e18 */ // Resume checking for different definitions 1.1 root 577: DWORD ExceptionFlags; 578: struct _EXCEPTION_RECORD *ExceptionRecord; 579: PVOID ExceptionAddress; 580: DWORD NumberParameters; 581: DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; 582: } EXCEPTION_RECORD; 583: 584: typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; 585: 586: // 587: // Typedef for pointer returned by exception_info() 588: // 589: 590: typedef struct _EXCEPTION_POINTERS { 591: PEXCEPTION_RECORD ExceptionRecord; 592: PCONTEXT ContextRecord; 593: } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; 594: #define PROCESS_TERMINATE (0x0001) 1.1.1.2 ! root 595: #define PROCESS_CREATE_THREAD (0x0002) ! 596: #define PROCESS_VM_OPERATION (0x0008) 1.1 root 597: #define PROCESS_VM_READ (0x0010) 598: #define PROCESS_VM_WRITE (0x0020) 599: #define PROCESS_DUP_HANDLE (0x0040) 600: #define PROCESS_CREATE_PROCESS (0x0080) 601: #define PROCESS_SET_INFORMATION (0x0200) 602: #define PROCESS_QUERY_INFORMATION (0x0400) 603: #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 604: 0xFFF) 1.1.1.2 ! root 605: 1.1 root 606: #define THREAD_TERMINATE (0x0001) 607: #define THREAD_SUSPEND_RESUME (0x0002) 608: #define THREAD_GET_CONTEXT (0x0008) 609: #define THREAD_SET_CONTEXT (0x0010) 610: #define THREAD_SET_INFORMATION (0x0020) 611: #define THREAD_QUERY_INFORMATION (0x0040) 612: #define THREAD_SET_THREAD_TOKEN (0x0080) 613: #define THREAD_IMPERSONATE (0x0100) 614: #define THREAD_DIRECT_IMPERSONATION (0x0200) 615: #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 616: 0x3FF) 617: #define TLS_MINIMUM_AVAILABLE 64 618: #define THREAD_BASE_PRIORITY_MAX 2 // maximum thread base priority boost 619: #define THREAD_BASE_PRIORITY_MIN -2 // minimum thread base priority boost 620: #define EVENT_MODIFY_STATE 0x0002 621: #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 622: #define MUTANT_QUERY_STATE 0x0001 623: 624: #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\ 625: MUTANT_QUERY_STATE) 626: #define SEMAPHORE_MODIFY_STATE 0x0002 627: #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 628: 629: #define PROCESSOR_INTEL_386 386 630: #define PROCESSOR_INTEL_486 486 631: #define PROCESSOR_INTEL_860 860 632: #define PROCESSOR_MIPS_R2000 2000 633: #define PROCESSOR_MIPS_R3000 3000 634: #define PROCESSOR_MIPS_R4000 4000 635: 636: #define PROCESSOR_STEP_A0 0x00000000 637: #define PROCESSOR_STEP_B0 0x00010000 638: #define PROCESSOR_STEP_C0 0x00020000 639: #define PROCESSOR_STEP_D0 0x00030000 640: #define PROCESSOR_STEP_E0 0x00040000 641: #define PROCESSOR_STEP_F0 0x00050000 642: #define PROCESSOR_STEP_G0 0x00060000 643: #define PROCESSOR_STEP_H0 0x00070000 644: #define PROCESSOR_STEP_I0 0x00080000 645: 646: #define PROCESSOR_OPTION_387 0x00000001 647: 648: typedef struct _MEMORY_BASIC_INFORMATION { 649: PVOID BaseAddress; 650: PVOID AllocationBase; 651: DWORD AllocationProtect; 652: DWORD RegionSize; 653: DWORD State; 654: DWORD Protect; 655: DWORD Type; 1.1.1.2 ! root 656: } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION; 1.1 root 657: #define SECTION_QUERY 0x0001 658: #define SECTION_MAP_WRITE 0x0002 659: #define SECTION_MAP_READ 0x0004 660: #define SECTION_MAP_EXECUTE 0x0008 661: #define SECTION_EXTEND_SIZE 0x0010 662: 663: #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\ 664: SECTION_MAP_WRITE | \ 665: SECTION_MAP_READ | \ 666: SECTION_MAP_EXECUTE | \ 667: SECTION_EXTEND_SIZE) 668: #define PAGE_NOACCESS 0x01 669: #define PAGE_READONLY 0x02 670: #define PAGE_READWRITE 0x04 671: #define MEM_COMMIT 0x1000 672: #define MEM_RESERVE 0x2000 673: #define MEM_DECOMMIT 0x4000 674: #define MEM_RELEASE 0x8000 675: #define MEM_FREE 0x10000 676: #define MEM_PRIVATE 0x20000 677: #define FILE_SHARE_READ 0x00000001 678: #define FILE_SHARE_WRITE 0x00000002 679: #define FILE_ATTRIBUTE_READONLY 0x00000001 680: #define FILE_ATTRIBUTE_HIDDEN 0x00000002 681: #define FILE_ATTRIBUTE_SYSTEM 0x00000004 1.1.1.2 ! root 682: #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 1.1 root 683: #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 684: #define FILE_ATTRIBUTE_NORMAL 0x00000080 1.1.1.2 ! root 685: #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 ! 686: #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200 ! 687: #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400 ! 688: #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 ! 689: #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 ! 690: #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 ! 691: #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 ! 692: #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 ! 693: #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 1.1 root 694: #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 695: #define FILE_CASE_PRESERVED_NAMES 0x00000002 696: #define FILE_UNICODE_ON_DISK 0x00000004 697: #define DUPLICATE_CLOSE_SOURCE 0x00000001 698: #define DUPLICATE_SAME_ACCESS 0x00000002 1.1.1.2 ! root 699: typedef PVOID PACCESS_TOKEN; 1.1 root 700: typedef PVOID PSECURITY_DESCRIPTOR; 701: typedef PVOID PSID; 1.1.1.2 ! root 702: //////////////////////////////////////////////////////////////////////// ! 703: // // ! 704: // ACCESS MASK // ! 705: // // ! 706: //////////////////////////////////////////////////////////////////////// ! 707: ! 708: // ! 709: // Define the access mask as a longword sized structure divided up as ! 710: // follows: ! 711: // ! 712: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 ! 713: // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 714: // +---------------+---------------+-------------------------------+ ! 715: // |G|G|G|G|Res'd|A| StandardRights| SpecificRights | ! 716: // |R|W|E|A| |S| | | ! 717: // +-+-------------+---------------+-------------------------------+ ! 718: // ! 719: // typedef struct _ACCESS_MASK { ! 720: // WORD SpecificRights; ! 721: // BYTE StandardRights; ! 722: // BYTE AccessSystemAcl : 1; ! 723: // BYTE Reserved : 3; ! 724: // BYTE GenericAll : 1; ! 725: // BYTE GenericExecute : 1; ! 726: // BYTE GenericWrite : 1; ! 727: // BYTE GenericRead : 1; ! 728: // } ACCESS_MASK; ! 729: // typedef ACCESS_MASK *PACCESS_MASK; ! 730: // ! 731: // but to make life simple for programmer's we'll allow them to specify ! 732: // a desired access mask by simply OR'ing together mulitple single rights ! 733: // and treat an access mask as a ulong. For example ! 734: // ! 735: // DesiredAccess = DELETE | READ_CONTROL ! 736: // ! 737: // So we'll declare ACCESS_MASK as DWORD ! 738: // ! 739: ! 740: typedef DWORD ACCESS_MASK; ! 741: typedef ACCESS_MASK *PACCESS_MASK; ! 742: ! 743: //////////////////////////////////////////////////////////////////////// ! 744: // // ! 745: // ACCESS TYPES // ! 746: // // ! 747: //////////////////////////////////////////////////////////////////////// ! 748: ! 749: ! 750: // ! 751: // The following are masks for the predefined standard access types ! 752: // ! 753: 1.1 root 754: #define DELETE (0x00010000L) 755: #define READ_CONTROL (0x00020000L) 756: #define WRITE_DAC (0x00040000L) 757: #define WRITE_OWNER (0x00080000L) 758: #define SYNCHRONIZE (0x00100000L) 759: 760: #define STANDARD_RIGHTS_REQUIRED (0x000F0000L) 761: 762: #define STANDARD_RIGHTS_READ (READ_CONTROL) 763: #define STANDARD_RIGHTS_WRITE (READ_CONTROL) 764: #define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) 765: 766: #define STANDARD_RIGHTS_ALL (0x001F0000L) 767: 768: #define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) 769: 770: // 771: // AccessSystemAcl access type 772: // 773: 774: #define ACCESS_SYSTEM_SECURITY (0x01000000L) 775: 776: // 777: // MaximumAllowed access type 778: // 779: 780: #define MAXIMUM_ALLOWED (0x02000000L) 781: 782: // 783: // These are the generic rights. 784: // 785: 786: #define GENERIC_READ (0x80000000L) 787: #define GENERIC_WRITE (0x40000000L) 788: #define GENERIC_EXECUTE (0x20000000L) 789: #define GENERIC_ALL (0x10000000L) 1.1.1.2 ! root 790: ! 791: ! 792: // ! 793: // Define the generic mapping array. This is used to denote the ! 794: // mapping of each generic access right to a specific access mask. ! 795: // ! 796: ! 797: typedef struct _GENERIC_MAPPING { ! 798: ACCESS_MASK GenericRead; ! 799: ACCESS_MASK GenericWrite; ! 800: ACCESS_MASK GenericExecute; ! 801: ACCESS_MASK GenericAll; ! 802: } GENERIC_MAPPING; ! 803: typedef GENERIC_MAPPING *PGENERIC_MAPPING; ! 804: ! 805: ! 806: ! 807: //////////////////////////////////////////////////////////////////////// ! 808: // // ! 809: // LUID_AND_ATTRIBUTES // ! 810: // // ! 811: //////////////////////////////////////////////////////////////////////// ! 812: // ! 813: // ! 814: ! 815: ! 816: typedef struct _LUID_AND_ATTRIBUTES { ! 817: LUID Luid; ! 818: DWORD Attributes; ! 819: } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES; ! 820: ! 821: typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; ! 822: typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; ! 823: ! 824: ! 825: //////////////////////////////////////////////////////////////////////// ! 826: // // ! 827: // Security Id (SID) // ! 828: // // ! 829: //////////////////////////////////////////////////////////////////////// ! 830: // ! 831: // ! 832: // Pictorially the structure of an SID is as follows: ! 833: // ! 834: // 1 1 1 1 1 1 ! 835: // 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 836: // +---------------------------------------------------------------+ ! 837: // | SubAuthorityCount |Reserved1 (SBZ)| Revision | ! 838: // +---------------------------------------------------------------+ ! 839: // | IdentifierAuthority[0] | ! 840: // +---------------------------------------------------------------+ ! 841: // | IdentifierAuthority[1] | ! 842: // +---------------------------------------------------------------+ ! 843: // | IdentifierAuthority[2] | ! 844: // +---------------------------------------------------------------+ ! 845: // | | ! 846: // +- - - - - - - - SubAuthority[] - - - - - - - - -+ ! 847: // | | ! 848: // +---------------------------------------------------------------+ ! 849: // ! 850: // ! 851: ! 852: typedef struct _SID_IDENTIFIER_AUTHORITY { ! 853: BYTE Value[6]; ! 854: } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY; ! 855: ! 856: ! 857: typedef struct _SID { ! 858: BYTE Revision; ! 859: BYTE SubAuthorityCount; ! 860: SID_IDENTIFIER_AUTHORITY IdentifierAuthority; ! 861: #ifdef MIDL_PASS ! 862: [size_is(SubAuthorityCount)] DWORD SubAuthority[*]; ! 863: #else // MIDL_PASS ! 864: DWORD SubAuthority[ANYSIZE_ARRAY]; ! 865: #endif // MIDL_PASS ! 866: } SID, *PISID; ! 867: ! 868: ! 869: ! 870: ! 871: ! 872: ! 873: ! 874: #define SID_REVISION (1) // Current revision level ! 875: #define SID_MAX_SUB_AUTHORITIES (15) ! 876: #define SID_RECOMMENDED_SUB_AUTHORITIES (1) // Will change to around 6 ! 877: // in a future release. ! 878: ! 879: typedef enum _SID_NAME_USE { ! 880: SidTypeUser = 1, ! 881: SidTypeGroup, ! 882: SidTypeDomain, ! 883: SidTypeAlias, ! 884: SidTypeWellKnownGroup, ! 885: SidTypeDeletedAccount, ! 886: SidTypeInvalid, ! 887: SidTypeUnknown ! 888: } SID_NAME_USE, *PSID_NAME_USE; ! 889: ! 890: ! 891: typedef struct _SID_AND_ATTRIBUTES { ! 892: PSID Sid; ! 893: DWORD Attributes; ! 894: } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES; ! 895: ! 896: typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; ! 897: typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; ! 898: ! 899: ! 900: ! 901: ! 902: ! 903: ! 904: ! 905: ! 906: ! 907: ///////////////////////////////////////////////////////////////////////////// ! 908: // // ! 909: // Universal well-known SIDs // ! 910: // // ! 911: // Null SID S-1-0-0 // ! 912: // World S-1-1-0 // ! 913: // Local S-1-2-0 // ! 914: // Creator Owner ID S-1-3-0 // ! 915: // Creator Group ID S-1-3-1 // ! 916: // // ! 917: ///////////////////////////////////////////////////////////////////////////// ! 918: ! 919: #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} ! 920: #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} ! 921: #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} ! 922: #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} ! 923: ! 924: #define SECURITY_NULL_RID (0x00000000L) ! 925: #define SECURITY_WORLD_RID (0x00000000L) ! 926: #define SECURITY_LOCAL_RID (0X00000000L) ! 927: ! 928: #define SECURITY_CREATOR_OWNER_RID (0x00000000L) ! 929: #define SECURITY_CREATOR_GROUP_RID (0x00000001L) ! 930: ! 931: ! 932: ! 933: ! 934: ///////////////////////////////////////////////////////////////////////////// ! 935: // // ! 936: // NT well-known SIDs // ! 937: // // ! 938: // NT Authority S-1-5 // ! 939: // Dialup S-1-5-1 // ! 940: // // ! 941: // Network S-1-5-2 // ! 942: // Batch S-1-5-3 // ! 943: // Interactive S-1-5-4 // ! 944: // Service S-1-5-6 // ! 945: // // ! 946: // (Logon IDs) S-1-5-5-X-Y // ! 947: // // ! 948: // (Built-in domain) s-1-5-20 // ! 949: // // ! 950: ///////////////////////////////////////////////////////////////////////////// ! 951: ! 952: ! 953: #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} ! 954: ! 955: #define SECURITY_DIALUP_RID (0x00000001L) ! 956: #define SECURITY_NETWORK_RID (0x00000002L) ! 957: #define SECURITY_BATCH_RID (0x00000003L) ! 958: #define SECURITY_INTERACTIVE_RID (0x00000004L) ! 959: #define SECURITY_SERVICE_RID (0x00000006L) ! 960: ! 961: #define SECURITY_LOGON_IDS_RID (0x00000005L) ! 962: #define SECURITY_LOGON_IDS_RID_COUNT (3L) ! 963: ! 964: #define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) ! 965: ! 966: #define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) ! 967: ! 968: ! 969: ! 970: ! 971: ! 972: ///////////////////////////////////////////////////////////////////////////// ! 973: // // ! 974: // well-known domain relative sub-authority values (RIDs)... // ! 975: // // ! 976: ///////////////////////////////////////////////////////////////////////////// ! 977: ! 978: // Well-known users ... ! 979: ! 980: #define DOMAIN_USER_RID_ADMIN (0x000001F4L) ! 981: #define DOMAIN_USER_RID_GUEST (0x000001F5L) ! 982: ! 983: ! 984: ! 985: // well-known groups ... ! 986: ! 987: #define DOMAIN_GROUP_RID_ADMINS (0x00000200L) ! 988: #define DOMAIN_GROUP_RID_USERS (0x00000201L) ! 989: ! 990: ! 991: ! 992: ! 993: // well-known aliases ... ! 994: ! 995: #define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) ! 996: #define DOMAIN_ALIAS_RID_USERS (0x00000221L) ! 997: #define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) ! 998: #define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) ! 999: ! 1000: #define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) ! 1001: #define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) ! 1002: #define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) ! 1003: #define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) ! 1004: ! 1005: #define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) ! 1006: ! 1007: ! 1008: ! 1009: ! 1010: ! 1011: ! 1012: // ! 1013: // Allocate the System Luid. The first 1000 LUIDs are reserved. ! 1014: // Use #999 here (0x3E7 = 999) ! 1015: // ! 1016: ! 1017: #define SYSTEM_LUID {0x0, 0x3E7} ! 1018: ! 1019: ! 1020: ! 1021: //////////////////////////////////////////////////////////////////////// ! 1022: // // ! 1023: // User and Group related SID attributes // ! 1024: // // ! 1025: //////////////////////////////////////////////////////////////////////// ! 1026: ! 1027: // ! 1028: // Group attributes ! 1029: // ! 1030: ! 1031: #define SE_GROUP_MANDATORY (0x00000001L) ! 1032: #define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L) ! 1033: #define SE_GROUP_ENABLED (0x00000004L) ! 1034: #define SE_GROUP_OWNER (0x00000008L) ! 1035: #define SE_GROUP_LOGON_ID (0xC0000000L) ! 1036: ! 1037: ! 1038: ! 1039: // ! 1040: // User attributes ! 1041: // ! 1042: ! 1043: // (None yet defined.) ! 1044: ! 1045: ! 1046: ! 1047: ! 1048: //////////////////////////////////////////////////////////////////////// ! 1049: // // ! 1050: // ACL and ACE // ! 1051: // // ! 1052: //////////////////////////////////////////////////////////////////////// ! 1053: ! 1054: // ! 1055: // Define an ACL and the ACE format. The structure of an ACL header ! 1056: // followed by one or more ACEs. Pictorally the structure of an ACL header ! 1057: // is as follows: ! 1058: // ! 1059: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 ! 1060: // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 1061: // +-------------------------------+---------------+---------------+ ! 1062: // | AclSize | Sbz1 | AclRevision | ! 1063: // +-------------------------------+---------------+---------------+ ! 1064: // | Sbz2 | AceCount | ! 1065: // +-------------------------------+-------------------------------+ ! 1066: // ! 1067: // The current AclRevision is defined to be ACL_REVISION. ! 1068: // ! 1069: // AclSize is the size, in bytes, allocated for the ACL. This includes ! 1070: // the ACL header, ACES, and remaining free space in the buffer. ! 1071: // ! 1072: // AceCount is the number of ACES in the ACL. ! 1073: // ! 1074: ! 1075: // This is the *current* ACL revision ! 1076: ! 1077: #define ACL_REVISION (2) ! 1078: ! 1079: // This is the history of ACL revisions. Add a new one whenever ! 1080: // ACL_REVISION is updated ! 1081: ! 1082: #define ACL_REVISION1 (1) ! 1083: #define ACL_REVISION2 (2) ! 1084: ! 1085: typedef struct _ACL { ! 1086: BYTE AclRevision; ! 1087: BYTE Sbz1; ! 1088: WORD AclSize; ! 1089: WORD AceCount; ! 1090: WORD Sbz2; ! 1091: } ACL; ! 1092: typedef ACL *PACL; ! 1093: ! 1094: // ! 1095: // The structure of an ACE is a common ace header followed by ace type ! 1096: // specific data. Pictorally the structure of the common ace header is ! 1097: // as follows: ! 1098: // ! 1099: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 ! 1100: // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 1101: // +---------------+-------+-------+---------------+---------------+ ! 1102: // | AceSize | AceFlags | AceType | ! 1103: // +---------------+-------+-------+---------------+---------------+ ! 1104: // ! 1105: // AceType denotes the type of the ace, there are some predefined ace ! 1106: // types ! 1107: // ! 1108: // AceSize is the size, in bytes, of ace. ! 1109: // ! 1110: // AceFlags are the Ace flags for audit and inheritance, defined shortly. ! 1111: ! 1112: typedef struct _ACE_HEADER { ! 1113: BYTE AceType; ! 1114: BYTE AceFlags; ! 1115: WORD AceSize; ! 1116: } ACE_HEADER; ! 1117: typedef ACE_HEADER *PACE_HEADER; ! 1118: ! 1119: // ! 1120: // The following are the predefined ace types that go into the AceType ! 1121: // field of an Ace header. ! 1122: // ! 1123: ! 1124: #define ACCESS_ALLOWED_ACE_TYPE (0x0) ! 1125: #define ACCESS_DENIED_ACE_TYPE (0x1) ! 1126: #define SYSTEM_AUDIT_ACE_TYPE (0x2) ! 1127: #define SYSTEM_ALARM_ACE_TYPE (0x3) ! 1128: ! 1129: // ! 1130: // The following are the inherit flags that go into the AceFlags field ! 1131: // of an Ace header. ! 1132: // ! 1133: ! 1134: #define OBJECT_INHERIT_ACE (0x1) ! 1135: #define CONTAINER_INHERIT_ACE (0x2) ! 1136: #define NO_PROPAGATE_INHERIT_ACE (0x4) ! 1137: #define INHERIT_ONLY_ACE (0x8) ! 1138: #define VALID_INHERIT_FLAGS (0xF) ! 1139: ! 1140: ! 1141: // The following are the currently defined ACE flags that go into the ! 1142: // AceFlags field of an ACE header. Each ACE type has its own set of ! 1143: // AceFlags. ! 1144: // ! 1145: // SUCCESSFUL_ACCESS_ACE_FLAG - used only with system audit and alarm ACE ! 1146: // types to indicate that a message is generated for successful accesses. ! 1147: // ! 1148: // FAILED_ACCESS_ACE_FLAG - used only with system audit and alarm ACE types ! 1149: // to indicate that a message is generated for failed accesses. ! 1150: // ! 1151: ! 1152: // ! 1153: // SYSTEM_AUDIT and SYSTEM_ALARM AceFlags ! 1154: // ! 1155: // These control the signaling of audit and alarms for success or failure. ! 1156: // ! 1157: ! 1158: #define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) ! 1159: #define FAILED_ACCESS_ACE_FLAG (0x80) ! 1160: ! 1161: ! 1162: // ! 1163: // We'll define the structure of the predefined ACE types. Pictorally ! 1164: // the structure of the predefined ACE's is as follows: ! 1165: // ! 1166: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 ! 1167: // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 1168: // +---------------+-------+-------+---------------+---------------+ ! 1169: // | AceFlags | Resd |Inherit| AceSize | AceType | ! 1170: // +---------------+-------+-------+---------------+---------------+ ! 1171: // | Mask | ! 1172: // +---------------------------------------------------------------+ ! 1173: // | | ! 1174: // + + ! 1175: // | | ! 1176: // + Sid + ! 1177: // | | ! 1178: // + + ! 1179: // | | ! 1180: // +---------------------------------------------------------------+ ! 1181: // ! 1182: // Mask is the access mask associated with the ACE. This is either the ! 1183: // access allowed, access denied, audit, or alarm mask. ! 1184: // ! 1185: // Sid is the Sid associated with the ACE. ! 1186: // ! 1187: ! 1188: // The following are the four predefined ACE types. ! 1189: ! 1190: // Examine the AceType field in the Header to determine ! 1191: // which structure is appropriate to use for casting. ! 1192: ! 1193: typedef struct _ACCESS_ALLOWED_ACE { ! 1194: ACE_HEADER Header; ! 1195: ACCESS_MASK Mask; ! 1196: DWORD SidStart; ! 1197: } ACCESS_ALLOWED_ACE; ! 1198: ! 1199: typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; ! 1200: ! 1201: typedef struct _ACCESS_DENIED_ACE { ! 1202: ACE_HEADER Header; ! 1203: ACCESS_MASK Mask; ! 1204: DWORD SidStart; ! 1205: } ACCESS_DENIED_ACE; ! 1206: typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; ! 1207: ! 1208: typedef struct _SYSTEM_AUDIT_ACE { ! 1209: ACE_HEADER Header; ! 1210: ACCESS_MASK Mask; ! 1211: DWORD SidStart; ! 1212: } SYSTEM_AUDIT_ACE; ! 1213: typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; ! 1214: ! 1215: typedef struct _SYSTEM_ALARM_ACE { ! 1216: ACE_HEADER Header; ! 1217: ACCESS_MASK Mask; ! 1218: DWORD SidStart; ! 1219: } SYSTEM_ALARM_ACE; ! 1220: typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; ! 1221: ! 1222: ! 1223: ! 1224: // ! 1225: // The following declarations are used for setting and querying information ! 1226: // about and ACL. First are the various information classes available to ! 1227: // the user. ! 1228: // ! 1229: ! 1230: typedef enum _ACL_INFORMATION_CLASS { ! 1231: AclRevisionInformation = 1, ! 1232: AclSizeInformation ! 1233: } ACL_INFORMATION_CLASS; ! 1234: ! 1235: // ! 1236: // This record is returned/sent if the user is requesting/setting the ! 1237: // AclRevisionInformation ! 1238: // ! 1239: ! 1240: typedef struct _ACL_REVISION_INFORMATION { ! 1241: DWORD AclRevision; ! 1242: } ACL_REVISION_INFORMATION; ! 1243: typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; ! 1244: ! 1245: // ! 1246: // This record is returned if the user is requesting AclSizeInformation ! 1247: // ! 1248: ! 1249: typedef struct _ACL_SIZE_INFORMATION { ! 1250: DWORD AceCount; ! 1251: DWORD AclBytesInUse; ! 1252: DWORD AclBytesFree; ! 1253: } ACL_SIZE_INFORMATION; ! 1254: typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; ! 1255: ! 1256: ! 1257: //////////////////////////////////////////////////////////////////////// ! 1258: // // ! 1259: // SECURITY_DESCRIPTOR // ! 1260: // // ! 1261: //////////////////////////////////////////////////////////////////////// ! 1262: // ! 1263: // Define the Security Descriptor and related data types. ! 1264: // This is an opaque data structure. ! 1265: // ! 1266: ! 1267: // ! 1268: // Current security descriptor revision value ! 1269: // ! 1270: ! 1271: #define SECURITY_DESCRIPTOR_REVISION (1) ! 1272: #define SECURITY_DESCRIPTOR_REVISION1 (1) ! 1273: ! 1274: // ! 1275: // Minimum length, in bytes, needed to build a security descriptor ! 1276: // (NOTE: This must manually be kept consistent with the) ! 1277: // (sizeof(SECURITY_DESCRIPTOR) ) ! 1278: // ! 1279: ! 1280: #define SECURITY_DESCRIPTOR_MIN_LENGTH (20) ! 1281: ! 1282: ! 1283: typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; ! 1284: ! 1285: #define SE_OWNER_DEFAULTED (0x0001) ! 1286: #define SE_GROUP_DEFAULTED (0x0002) ! 1287: #define SE_DACL_PRESENT (0x0004) ! 1288: #define SE_DACL_DEFAULTED (0x0008) ! 1289: #define SE_SACL_PRESENT (0x0010) ! 1290: #define SE_SACL_DEFAULTED (0x0020) ! 1291: #define SE_SELF_RELATIVE (0x8000) ! 1292: ! 1293: // ! 1294: // Where: ! 1295: // ! 1296: // SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the ! 1297: // SID pointed to by the Owner field was provided by a ! 1298: // defaulting mechanism rather than explicitly provided by the ! 1299: // original provider of the security descriptor. This may ! 1300: // affect the treatment of the SID with respect to inheritence ! 1301: // of an owner. ! 1302: // ! 1303: // SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the ! 1304: // SID in the Group field was provided by a defaulting mechanism ! 1305: // rather than explicitly provided by the original provider of ! 1306: // the security descriptor. This may affect the treatment of ! 1307: // the SID with respect to inheritence of a primary group. ! 1308: // ! 1309: // SE_DACL_PRESENT - This boolean flag, when set, indicates that the ! 1310: // security descriptor contains a discretionary ACL. If this ! 1311: // flag is set and the Dacl field of the SECURITY_DESCRIPTOR is ! 1312: // null, then a null ACL is explicitly being specified. ! 1313: // ! 1314: // SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the ! 1315: // ACL pointed to by the Dacl field was provided by a defaulting ! 1316: // mechanism rather than explicitly provided by the original ! 1317: // provider of the security descriptor. This may affect the ! 1318: // treatment of the ACL with respect to inheritence of an ACL. ! 1319: // This flag is ignored if the DaclPresent flag is not set. ! 1320: // ! 1321: // SE_SACL_PRESENT - This boolean flag, when set, indicates that the ! 1322: // security descriptor contains a system ACL pointed to by the ! 1323: // Sacl field. If this flag is set and the Sacl field of the ! 1324: // SECURITY_DESCRIPTOR is null, then an empty (but present) ! 1325: // ACL is being specified. ! 1326: // ! 1327: // SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the ! 1328: // ACL pointed to by the Sacl field was provided by a defaulting ! 1329: // mechanism rather than explicitly provided by the original ! 1330: // provider of the security descriptor. This may affect the ! 1331: // treatment of the ACL with respect to inheritence of an ACL. ! 1332: // This flag is ignored if the SaclPresent flag is not set. ! 1333: // ! 1334: // SE_SELF_RELATIVE - This boolean flag, when set, indicates that the ! 1335: // security descriptor is in self-relative form. In this form, ! 1336: // all fields of the security descriptor are contiguous in memory ! 1337: // and all pointer fields are expressed as offsets from the ! 1338: // beginning of the security descriptor. This form is useful ! 1339: // for treating security descriptors as opaque data structures ! 1340: // for transmission in communication protocol or for storage on ! 1341: // secondary media. ! 1342: // ! 1343: // ! 1344: // ! 1345: // Pictorially the structure of a security descriptor is as follows: ! 1346: // ! 1347: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 ! 1348: // 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 ! 1349: // +---------------------------------------------------------------+ ! 1350: // | Control |Reserved1 (SBZ)| Revision | ! 1351: // +---------------------------------------------------------------+ ! 1352: // | Owner | ! 1353: // +---------------------------------------------------------------+ ! 1354: // | Group | ! 1355: // +---------------------------------------------------------------+ ! 1356: // | Sacl | ! 1357: // +---------------------------------------------------------------+ ! 1358: // | Dacl | ! 1359: // +---------------------------------------------------------------+ ! 1360: // ! 1361: // In general, this data structure should be treated opaquely to ensure future ! 1362: // compatibility. ! 1363: // ! 1364: // ! 1365: ! 1366: typedef struct _SECURITY_DESCRIPTOR { ! 1367: BYTE Revision; ! 1368: BYTE Sbz1; ! 1369: SECURITY_DESCRIPTOR_CONTROL Control; ! 1370: PSID Owner; ! 1371: PSID Group; ! 1372: PACL Sacl; ! 1373: PACL Dacl; ! 1374: } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR; ! 1375: ! 1376: ! 1377: // Where: ! 1378: // ! 1379: // Revision - Contains the revision level of the security ! 1380: // descriptor. This allows this structure to be passed between ! 1381: // systems or stored on disk even though it is expected to ! 1382: // change in the future. ! 1383: // ! 1384: // Control - A set of flags which qualify the meaning of the ! 1385: // security descriptor or individual fields of the security ! 1386: // descriptor. ! 1387: // ! 1388: // Owner - is a pointer to an SID representing an object's owner. ! 1389: // If this field is null, then no owner SID is present in the ! 1390: // security descriptor. If the security descriptor is in ! 1391: // self-relative form, then this field contains an offset to ! 1392: // the SID, rather than a pointer. ! 1393: // ! 1394: // Group - is a pointer to an SID representing an object's primary ! 1395: // group. If this field is null, then no primary group SID is ! 1396: // present in the security descriptor. If the security descriptor ! 1397: // is in self-relative form, then this field contains an offset to ! 1398: // the SID, rather than a pointer. ! 1399: // ! 1400: // Sacl - is a pointer to a system ACL. This field value is only ! 1401: // valid if the DaclPresent control flag is set. If the ! 1402: // SaclPresent flag is set and this field is null, then a null ! 1403: // ACL is specified. If the security descriptor is in ! 1404: // self-relative form, then this field contains an offset to ! 1405: // the ACL, rather than a pointer. ! 1406: // ! 1407: // Dacl - is a pointer to a discretionary ACL. This field value is ! 1408: // only valid if the DaclPresent control flag is set. If the ! 1409: // DaclPresent flag is set and this field is null, then a null ! 1410: // ACL (unconditionally granting access) is specified. If the ! 1411: // security descriptor is in self-relative form, then this field ! 1412: // contains an offset to the ACL, rather than a pointer. ! 1413: // ! 1414: ! 1415: ! 1416: ! 1417: //////////////////////////////////////////////////////////////////////// ! 1418: // // ! 1419: // Privilege Related Data Structures // ! 1420: // // ! 1421: //////////////////////////////////////////////////////////////////////// ! 1422: ! 1423: ! 1424: // ! 1425: // Privilege attributes ! 1426: // ! 1427: ! 1428: #define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) ! 1429: #define SE_PRIVILEGE_ENABLED (0x00000002L) ! 1430: #define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) ! 1431: ! 1432: ! 1433: ! 1434: ! 1435: // ! 1436: // Privilege Set Control flags ! 1437: // ! 1438: ! 1439: #define PRIVILEGE_SET_ALL_NECESSARY (1) ! 1440: ! 1441: ! 1442: // ! 1443: // Privilege Set - This is defined for a privilege set of one. ! 1444: // If more than one privilege is needed, then this structure ! 1445: // will need to be allocated with more space. ! 1446: // ! 1447: // Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET ! 1448: // structure (defined in se.h) ! 1449: // ! 1450: ! 1451: typedef struct _PRIVILEGE_SET { ! 1452: DWORD PrivilegeCount; ! 1453: DWORD Control; ! 1454: LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; ! 1455: } PRIVILEGE_SET, * PPRIVILEGE_SET; ! 1456: ! 1457: ! 1458: //////////////////////////////////////////////////////////////////////// ! 1459: // // ! 1460: // NT Defined Privileges // ! 1461: // // ! 1462: //////////////////////////////////////////////////////////////////////// ! 1463: ! 1464: #define SE_CREATE_TOKEN_NAME L"SeCreateTokenPrivilege" ! 1465: #define SE_ASSIGNPRIMARYTOKEN_NAME L"SeAssignPrimaryTokenPrivilege" ! 1466: #define SE_LOCK_MEMORY_NAME L"SeLockMemoryPrivilege" ! 1467: #define SE_INCREASE_QUOTA_NAME L"SeIncreaseQuotaPrivilege" ! 1468: #define SE_UNSOLICITED_INPUT_NAME L"SeUnsolicitedInputPrivilege" ! 1469: #define SE_TCB_NAME L"SeTcbPrivilege" ! 1470: #define SE_SECURITY_NAME L"SeSecurityPrivilege" ! 1471: #define SE_TAKE_OWNERSHIP_NAME L"SeTakeOwnershipPrivilege" ! 1472: #define SE_LOAD_DRIVER_NAME L"SeLoadDriverPrivilege" ! 1473: #define SE_SYSTEM_PROFILE_NAME L"SeSystemProfilePrivilege" ! 1474: #define SE_SYSTEMTIME_NAME L"SeSystemtimePrivilege" ! 1475: #define SE_PROF_SINGLE_PROCESS_NAME L"SeProfileSingleProcessPrivilege" ! 1476: #define SE_INC_BASE_PRIORITY_NAME L"SeIncreaseBasePriorityPrivilege" ! 1477: #define SE_CREATE_PAGEFILE_NAME L"SeCreatePagefilePrivilege" ! 1478: #define SE_CREATE_PERMANENT_NAME L"SeCreatePermanentPrivilege" ! 1479: #define SE_BACKUP_NAME L"SeBackupPrivilege" ! 1480: #define SE_RESTORE_NAME L"SeRestorePrivilege" ! 1481: #define SE_SHUTDOWN_NAME L"SeShutdownPrivilege" ! 1482: #define SE_DEBUG_NAME L"SeDebugPrivilege" ! 1483: #define SE_AUDIT_NAME L"SeAuditPrivilege" ! 1484: #define SE_SYSTEM_ENVIRONMENT_NAME L"SeSystemEnvironmentPrivilege" ! 1485: #define SE_CHANGE_NOTIFY_NAME L"SeChangeNotifyPrivilege" ! 1486: #define SE_REMOTE_SHUTDOWN_NAME L"SeRemoteShutdownPrivilege" ! 1487: ! 1488: ! 1489: //////////////////////////////////////////////////////////////////// ! 1490: // // ! 1491: // Security Quality Of Service // ! 1492: // // ! 1493: // // ! 1494: //////////////////////////////////////////////////////////////////// ! 1495: ! 1496: // ! 1497: // Impersonation Level ! 1498: // ! 1499: // Impersonation level is represented by a pair of bits in Windows. ! 1500: // If a new impersonation level is added or lowest value is changed from ! 1501: // 0 to something else, fix the Windows CreateFile call. ! 1502: // ! 1503: ! 1504: typedef enum _SECURITY_IMPERSONATION_LEVEL { ! 1505: SecurityAnonymous, ! 1506: SecurityIdentification, ! 1507: SecurityImpersonation, ! 1508: SecurityDelegation ! 1509: } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL; ! 1510: ! 1511: #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation ! 1512: ! 1513: #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation ! 1514: ! 1515: ! 1516: // ! 1517: // Security Tracking Mode ! 1518: // ! 1519: ! 1520: #define SECURITY_DYNAMIC_TRACKING (TRUE) ! 1521: #define SECURITY_STATIC_TRACKING (FALSE) ! 1522: ! 1523: typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, ! 1524: * PSECURITY_CONTEXT_TRACKING_MODE; ! 1525: ! 1526: ! 1527: ! 1528: // ! 1529: // Quality Of Service ! 1530: // ! 1531: ! 1532: typedef struct _SECURITY_QUALITY_OF_SERVICE { ! 1533: DWORD Length; ! 1534: SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; ! 1535: SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; ! 1536: BOOLEAN EffectiveOnly; ! 1537: } SECURITY_QUALITY_OF_SERVICE, * PSECURITY_QUALITY_OF_SERVICE; ! 1538: ! 1539: ! 1540: // ! 1541: // Used to represent information related to a thread impersonation ! 1542: // ! 1543: ! 1544: typedef struct _SE_IMPERSONATION_STATE { ! 1545: PACCESS_TOKEN Token; ! 1546: BOOLEAN CopyOnOpen; ! 1547: BOOLEAN EffectiveOnly; ! 1548: SECURITY_IMPERSONATION_LEVEL Level; ! 1549: } SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE; ! 1550: ! 1551: ! 1552: //////////////////////////////////////////////////////////////////// ! 1553: // // ! 1554: // Token Object Definitions // ! 1555: // // ! 1556: // // ! 1557: //////////////////////////////////////////////////////////////////// ! 1558: ! 1559: ! 1560: // ! 1561: // Token Specific Access Rights. ! 1562: // ! 1563: ! 1564: #define TOKEN_ASSIGN_PRIMARY (0x0001) ! 1565: #define TOKEN_DUPLICATE (0x0002) ! 1566: #define TOKEN_IMPERSONATE (0x0004) ! 1567: #define TOKEN_QUERY (0x0008) ! 1568: #define TOKEN_QUERY_SOURCE (0x0010) ! 1569: #define TOKEN_ADJUST_PRIVILEGES (0x0020) ! 1570: #define TOKEN_ADJUST_GROUPS (0x0040) ! 1571: #define TOKEN_ADJUST_DEFAULT (0x0080) ! 1572: ! 1573: #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ ! 1574: TOKEN_ASSIGN_PRIMARY |\ ! 1575: TOKEN_DUPLICATE |\ ! 1576: TOKEN_IMPERSONATE |\ ! 1577: TOKEN_QUERY |\ ! 1578: TOKEN_QUERY_SOURCE |\ ! 1579: TOKEN_ADJUST_PRIVILEGES |\ ! 1580: TOKEN_ADJUST_GROUPS |\ ! 1581: TOKEN_ADJUST_DEFAULT) ! 1582: ! 1583: ! 1584: #define TOKEN_READ (STANDARD_RIGHTS_READ |\ ! 1585: TOKEN_QUERY) ! 1586: ! 1587: ! 1588: #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\ ! 1589: TOKEN_ADJUST_PRIVILEGES |\ ! 1590: TOKEN_ADJUST_GROUPS |\ ! 1591: TOKEN_ADJUST_DEFAULT) ! 1592: ! 1593: #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ ! 1594: TOKEN_IMPERSONATE) ! 1595: ! 1596: ! 1597: // ! 1598: // Token Types ! 1599: // ! 1600: ! 1601: typedef enum _TOKEN_TYPE { ! 1602: TokenPrimary = 1, ! 1603: TokenImpersonation ! 1604: } TOKEN_TYPE; ! 1605: typedef TOKEN_TYPE *PTOKEN_TYPE; ! 1606: ! 1607: ! 1608: // ! 1609: // Token Information Classes. ! 1610: // ! 1611: ! 1612: ! 1613: typedef enum _TOKEN_INFORMATION_CLASS { ! 1614: TokenUser = 1, ! 1615: TokenGroups, ! 1616: TokenPrivileges, ! 1617: TokenOwner, ! 1618: TokenPrimaryGroup, ! 1619: TokenDefaultDacl, ! 1620: TokenSource, ! 1621: TokenType, ! 1622: TokenImpersonationLevel, ! 1623: TokenStatistics ! 1624: } TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS; ! 1625: ! 1626: // ! 1627: // Token information class structures ! 1628: // ! 1629: ! 1630: typedef struct _TOKEN_USER { ! 1631: SID_AND_ATTRIBUTES User; ! 1632: } TOKEN_USER, *PTOKEN_USER; ! 1633: ! 1634: ! 1635: typedef struct _TOKEN_GROUPS { ! 1636: DWORD GroupCount; ! 1637: SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; ! 1638: } TOKEN_GROUPS, *PTOKEN_GROUPS; ! 1639: ! 1640: ! 1641: typedef struct _TOKEN_PRIVILEGES { ! 1642: DWORD PrivilegeCount; ! 1643: LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; ! 1644: } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; ! 1645: ! 1646: ! 1647: typedef struct _TOKEN_OWNER { ! 1648: PSID Owner; ! 1649: } TOKEN_OWNER, *PTOKEN_OWNER; ! 1650: ! 1651: ! 1652: typedef struct _TOKEN_PRIMARY_GROUP { ! 1653: PSID PrimaryGroup; ! 1654: } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP; ! 1655: ! 1656: ! 1657: typedef struct _TOKEN_DEFAULT_DACL { ! 1658: PACL DefaultDacl; ! 1659: } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL; ! 1660: ! 1661: ! 1662: ! 1663: #define TOKEN_SOURCE_LENGTH 8 ! 1664: ! 1665: typedef struct _TOKEN_SOURCE { ! 1666: CHAR SourceName[TOKEN_SOURCE_LENGTH]; ! 1667: LUID SourceIdentifier; ! 1668: } TOKEN_SOURCE, *PTOKEN_SOURCE; ! 1669: ! 1670: ! 1671: typedef struct _TOKEN_STATISTICS { ! 1672: LUID TokenId; ! 1673: LUID AuthenticationId; ! 1674: LARGE_INTEGER ExpirationTime; ! 1675: TOKEN_TYPE TokenType; ! 1676: SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; ! 1677: DWORD DynamicCharged; ! 1678: DWORD DynamicAvailable; ! 1679: DWORD GroupCount; ! 1680: DWORD PrivilegeCount; ! 1681: LUID ModifiedId; ! 1682: } TOKEN_STATISTICS, *PTOKEN_STATISTICS; ! 1683: ! 1684: ! 1685: typedef struct _TOKEN_CONTROL { ! 1686: LUID TokenId; ! 1687: LUID AuthenticationId; ! 1688: LUID ModifiedId; ! 1689: TOKEN_SOURCE TokenSource; ! 1690: } TOKEN_CONTROL, *PTOKEN_CONTROL; 1.1 root 1691: 1692: 1693: typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; 1694: 1695: #define OWNER_SECURITY_INFORMATION (0X00000001L) 1696: #define GROUP_SECURITY_INFORMATION (0X00000002L) 1697: #define DACL_SECURITY_INFORMATION (0X00000004L) 1698: #define SACL_SECURITY_INFORMATION (0X00000008L) 1699: #define HEAP_SERIALIZE 0x00000001 1700: typedef struct _RTL_CRITICAL_SECTION { 1701: 1.1.1.2 ! root 1702: #if DEVL ! 1703: WORD Type; ! 1704: WORD Depth; ! 1705: PVOID OwnerBackTrace[ 4 ]; ! 1706: DWORD ContentionCount; ! 1707: LIST_ENTRY ProcessLocksList; ! 1708: #endif // DEVL 1.1 root 1709: 1710: // 1711: // The following three fields control entering and exiting the critical 1712: // section for the resource 1713: // 1714: 1715: LONG LockCount; 1716: LONG RecursionCount; 1717: HANDLE OwningThread; // from the thread's ClientId->UniqueThread 1718: HANDLE LockSemaphore; 1719: KSPIN_LOCK SpinLock; 1720: 1.1.1.2 ! root 1721: #if DEVL && defined(i386) ! 1722: DWORD CreatorBackTraceIndex; ! 1723: #else ! 1724: DWORD Reserved; ! 1725: #endif // DEVL && defined(i386) ! 1726: ! 1727: } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; 1.1 root 1728: #define DLL_PROCESS_ATTACH 1 1729: #define DLL_THREAD_ATTACH 2 1730: #define DLL_THREAD_DETACH 3 1731: #define DLL_PROCESS_DETACH 0 1732: 1733: // 1734: // Defines for the READ flags for Eventlogging 1735: // 1.1.1.2 ! root 1736: #define EVENTLOG_SEQUENTIAL_READ 0X0001 ! 1737: #define EVENTLOG_SEEK_READ 0X0002 ! 1738: #define EVENTLOG_FORWARDS_READ 0X0004 ! 1739: #define EVENTLOG_BACKWARDS_READ 0X0008 1.1 root 1740: 1741: // 1742: // The types of events that can be logged. 1743: // 1.1.1.2 ! root 1744: #define EVENTLOG_SUCCESS 0X0000 ! 1745: #define EVENTLOG_ERROR_TYPE 0x0001 ! 1746: #define EVENTLOG_WARNING_TYPE 0x0002 ! 1747: #define EVENTLOG_INFORMATION_TYPE 0x0004 ! 1748: #define EVENTLOG_AUDIT_SUCCESS 0x0008 ! 1749: #define EVENTLOG_AUDIT_FAILURE 0x0010 ! 1750: ! 1751: // ! 1752: // Defines for the WRITE flags used by Auditing for paired events ! 1753: // These are not implemented in Product 1 ! 1754: // ! 1755: ! 1756: #define EVENTLOG_START_PAIRED_EVENT 0x0001 ! 1757: #define EVENTLOG_END_PAIRED_EVENT 0x0002 ! 1758: #define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004 ! 1759: #define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008 ! 1760: #define EVENTLOG_PAIRED_EVENT_INACTIVE 0x000C ! 1761: ! 1762: // ! 1763: // Structure that defines the header of the Eventlog record. This is the ! 1764: // fixed-sized portion before all the variable-length strings, binary ! 1765: // data and pad bytes. ! 1766: // ! 1767: // TimeGenerated is the time it was generated at the client. ! 1768: // TimeWritten is the time it was put into the log at the server end. ! 1769: // ! 1770: ! 1771: typedef struct _EVENTLOGRECORD { ! 1772: DWORD Length; // Length of full record ! 1773: DWORD Reserved; // Used by the service ! 1774: DWORD RecordNumber; // Absolute record number ! 1775: DWORD TimeGenerated; // Seconds since 1-1-1970 ! 1776: DWORD TimeWritten; // Seconds since 1-1-1970 ! 1777: DWORD EventID; ! 1778: WORD EventType; ! 1779: WORD NumStrings; ! 1780: WORD EventCategory; ! 1781: WORD ReservedFlags; // For use with paired events (auditing) ! 1782: DWORD ClosingRecordNumber; // For use with paired events (auditing) ! 1783: DWORD StringOffset; // Offset from beginning of record ! 1784: DWORD UserSidLength; ! 1785: DWORD UserSidOffset; ! 1786: DWORD DataLength; ! 1787: DWORD DataOffset; // Offset from beginning of record ! 1788: // ! 1789: // Then follow: ! 1790: // ! 1791: // WCHAR SourceName[] ! 1792: // WCHAR Computername[] ! 1793: // SID UserSid ! 1794: // WCHAR Strings[] ! 1795: // BYTE Data[] ! 1796: // CHAR Pad[] ! 1797: // DWORD Length; ! 1798: // ! 1799: } EVENTLOGRECORD, *PEVENTLOGRECORD; 1.1 root 1800: 1801: #define DBG_CONTINUE ((DWORD )0x00010002L) 1802: #define DBG_TERMINATE_THREAD ((DWORD )0x40010003L) 1803: #define DBG_TERMINATE_PROCESS ((DWORD )0x40010004L) 1804: #define DBG_CONTROL_C ((DWORD )0x40010005L) 1805: #define DBG_EXCEPTION_NOT_HANDLED ((DWORD )0x80010001L) 1.1.1.2 ! root 1806: // ! 1807: ! 1808: // ! 1809: // Registry Specific Access Rights. ! 1810: // ! 1811: ! 1812: #define KEY_QUERY_VALUE (0x0001) ! 1813: #define KEY_SET_VALUE (0x0002) ! 1814: #define KEY_CREATE_SUB_KEY (0x0004) ! 1815: #define KEY_ENUMERATE_SUB_KEYS (0x0008) ! 1816: #define KEY_NOTIFY (0x0010) ! 1817: #define KEY_CREATE_LINK (0x0020) ! 1818: ! 1819: #define KEY_READ ((STANDARD_RIGHTS_READ |\ ! 1820: KEY_QUERY_VALUE |\ ! 1821: KEY_ENUMERATE_SUB_KEYS |\ ! 1822: KEY_NOTIFY) \ ! 1823: & \ ! 1824: (~SYNCHRONIZE)) ! 1825: ! 1826: ! 1827: #define KEY_WRITE ((STANDARD_RIGHTS_WRITE |\ ! 1828: KEY_SET_VALUE |\ ! 1829: KEY_CREATE_SUB_KEY) \ ! 1830: & \ ! 1831: (~SYNCHRONIZE)) ! 1832: ! 1833: #define KEY_EXECUTE ((KEY_READ) \ ! 1834: & \ ! 1835: (~SYNCHRONIZE)) ! 1836: ! 1837: #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL |\ ! 1838: KEY_QUERY_VALUE |\ ! 1839: KEY_SET_VALUE |\ ! 1840: KEY_CREATE_SUB_KEY |\ ! 1841: KEY_ENUMERATE_SUB_KEYS |\ ! 1842: KEY_NOTIFY |\ ! 1843: KEY_CREATE_LINK) \ ! 1844: & \ ! 1845: (~SYNCHRONIZE)) ! 1846: ! 1847: ! 1848: ! 1849: // ! 1850: // Open/Create Options ! 1851: // ! 1852: ! 1853: #define REG_OPTION_RESERVED (0x00000000L) // Parameter is reserved ! 1854: ! 1855: #define REG_OPTION_NON_VOLATILE (0x00000000L) // Key is preserved ! 1856: // when system is rebooted ! 1857: ! 1858: #define REG_OPTION_VOLATILE (0x00000001L) // Key is not preserved ! 1859: // when system is rebooted ! 1860: ! 1861: #define REG_OPTION_CREATE_LINK (0x00000002L) // Created key is a ! 1862: // symbolic link ! 1863: ! 1864: // ! 1865: // Key creation/open disposition ! 1866: // ! 1867: ! 1868: #define REG_CREATED_NEW_KEY (0x00000001L) // New Registry Key created ! 1869: #define REG_OPENED_EXISTING_KEY (0x00000002L) // Existing Key opened ! 1870: ! 1871: // ! 1872: // Key restore flags ! 1873: // ! 1874: ! 1875: #define REG_WHOLE_HIVE_VOLATILE (0x00000001L) // Restore whole hive volatile ! 1876: ! 1877: // ! 1878: // Notify filter values ! 1879: // ! 1880: #define REG_NOTIFY_CHANGE_NAME (0x00000001L) // Create or delete (child) ! 1881: #define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) ! 1882: #define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) // time stamp ! 1883: #define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) ! 1884: ! 1885: #define REG_LEGAL_CHANGE_FILTER \ ! 1886: (REG_NOTIFY_CHANGE_NAME |\ ! 1887: REG_NOTIFY_CHANGE_ATTRIBUTES |\ ! 1888: REG_NOTIFY_CHANGE_LAST_SET |\ ! 1889: REG_NOTIFY_CHANGE_SECURITY) ! 1890: ! 1891: // ! 1892: // ! 1893: ! 1894: // ! 1895: // Predefined Value Types. ! 1896: // ! 1897: ! 1898: #define REG_NONE ( 0 ) // No value type ! 1899: #define REG_SZ ( 1 ) // Unicode nul terminated string ! 1900: #define REG_EXPAND_SZ ( 2 ) // Unicode nul terminated string ! 1901: // (with environment variable references) ! 1902: #define REG_BINARY ( 3 ) // Free form binary ! 1903: #define REG_DWORD ( 4 ) // 32-bit number ! 1904: #define REG_DWORD_LITTLE_ENDIAN ( 4 ) // 32-bit number (same as REG_DWORD) ! 1905: #define REG_DWORD_BIG_ENDIAN ( 5 ) // 32-bit number ! 1906: #define REG_LINK ( 6 ) // Symbolic Link (unicode) ! 1907: #define REG_MULTI_SZ ( 7 ) // Multiple Unicode strings ! 1908: #define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map ! 1909: #define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description ! 1910: ! 1911: ! 1912: // ! 1913: // Service Types (Bit Mask) ! 1914: // ! 1915: #define SERVICE_KERNEL_DRIVER 0x00000001 ! 1916: #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 ! 1917: #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | \ ! 1918: SERVICE_FILE_SYSTEM_DRIVER) ! 1919: ! 1920: #define SERVICE_ADAPTER 0x00000004 ! 1921: ! 1922: #define SERVICE_WIN32_OWN_PROCESS 0x00000010 ! 1923: #define SERVICE_WIN32_SHARE_PROCESS 0x00000020 ! 1924: #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | \ ! 1925: SERVICE_WIN32_SHARE_PROCESS) ! 1926: ! 1927: #define SERVICE_TYPE_ALL (SERVICE_WIN32 | \ ! 1928: SERVICE_ADAPTER | \ ! 1929: SERVICE_DRIVER) ! 1930: ! 1931: // ! 1932: // Start Type ! 1933: // ! 1934: ! 1935: #define SERVICE_BOOT_START 0x00000000 ! 1936: #define SERVICE_SYSTEM_START 0x00000001 ! 1937: #define SERVICE_AUTO_START 0x00000002 ! 1938: #define SERVICE_DEMAND_START 0x00000003 ! 1939: #define SERVICE_DISABLED 0x00000004 ! 1940: ! 1941: // ! 1942: // Error control type ! 1943: // ! 1944: ! 1945: #define SERVICE_ERROR_NORMAL 0x00000001 ! 1946: #define SERVICE_ERROR_SEVERE 0x00000002 ! 1947: #define SERVICE_ERROR_CRITICAL 0x00000003 ! 1948: ! 1949: // ! 1950: // ! 1951: // Define the registry driver node enumerations ! 1952: // ! 1953: ! 1954: typedef enum _CM_SERVICE_NODE_TYPE { ! 1955: DriverType = SERVICE_KERNEL_DRIVER, ! 1956: FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, ! 1957: Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, ! 1958: Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, ! 1959: AdapterType = SERVICE_ADAPTER ! 1960: } SERVICE_NODE_TYPE; ! 1961: ! 1962: typedef enum _CM_SERVICE_LOAD_TYPE { ! 1963: BootLoad = SERVICE_BOOT_START, ! 1964: SystemLoad = SERVICE_SYSTEM_START, ! 1965: AutoLoad = SERVICE_AUTO_START, ! 1966: DemandLoad = SERVICE_DEMAND_START, ! 1967: DisableLoad = SERVICE_DISABLED ! 1968: } SERVICE_LOAD_TYPE; ! 1969: ! 1970: typedef enum _CM_ERROR_CONTROL_TYPE { ! 1971: NormalError = SERVICE_ERROR_NORMAL, ! 1972: SevereError = SERVICE_ERROR_SEVERE, ! 1973: CriticalError = SERVICE_ERROR_CRITICAL ! 1974: } SERVICE_ERROR_TYPE; ! 1975: ! 1976: // ! 1977: ! 1978: // ! 1979: // IOCTL_TAPE_ERASE definitions ! 1980: // ! 1981: ! 1982: #define TAPE_ERASE_SHORT 0 ! 1983: #define TAPE_ERASE_LONG 1 ! 1984: #define TAPE_ERASE_SHORT_IMMED 2 ! 1985: #define TAPE_ERASE_LONG_IMMED 3 ! 1986: ! 1987: typedef struct _TAPE_ERASE { ! 1988: DWORD Partition; ! 1989: DWORD Type; ! 1990: } TAPE_ERASE, *PTAPE_ERASE; ! 1991: ! 1992: ! 1993: // ! 1994: // IOCTL_TAPE_PREPARE definitions ! 1995: // ! 1996: ! 1997: #define TAPE_UNLOAD 0 ! 1998: #define TAPE_UNLOAD_IMMED 1 ! 1999: #define TAPE_TENSION 2 ! 2000: #define TAPE_LOCK 3 ! 2001: #define TAPE_UNLOCK 4 ! 2002: ! 2003: typedef struct _TAPE_PREPARE { ! 2004: DWORD Operation; ! 2005: } TAPE_PREPARE, *PTAPE_PREPARE; ! 2006: ! 2007: // ! 2008: // IOCTL_TAPE_WRITE_MARKS definitions ! 2009: // ! 2010: ! 2011: #define TAPE_SETMARKS 0 ! 2012: #define TAPE_SHORT_FILEMARKS 1 ! 2013: #define TAPE_LONG_FILEMARKS 2 ! 2014: #define TAPE_SEQUENTIAL_FILEMARKS 3 ! 2015: ! 2016: typedef struct _TAPE_WRITE_MARKS { ! 2017: DWORD Type; ! 2018: DWORD Count; ! 2019: } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS; ! 2020: ! 2021: // ! 2022: // IOCTL_TAPE_GET/SET_POSITION definitions ! 2023: // ! 2024: ! 2025: #define TAPE_REWIND (TAPE_SEQUENTIAL_FILEMARKS+1) ! 2026: #define TAPE_REWIND_IMMED (TAPE_SEQUENTIAL_FILEMARKS+2) ! 2027: #define TAPE_END_OF_DATA (TAPE_SEQUENTIAL_FILEMARKS+3) ! 2028: #define TAPE_ABSOLUTE_BLOCK (TAPE_SEQUENTIAL_FILEMARKS+4) ! 2029: #define TAPE_RELATIVE_BLOCK (TAPE_SEQUENTIAL_FILEMARKS+5) ! 2030: #define TAPE_BLOCKS (TAPE_SEQUENTIAL_FILEMARKS+6) ! 2031: ! 2032: typedef struct _TAPE_POSITION { ! 2033: DWORD Method; ! 2034: DWORD Partition; ! 2035: LARGE_INTEGER Position; ! 2036: } TAPE_POSITION, *PTAPE_POSITION; ! 2037: ! 2038: // ! 2039: // IOCTL_TAPE_GET_MEDIA_PARAMS definitions ! 2040: // ! 2041: ! 2042: typedef struct _TAPE_GET_MEDIA_PARAMETERS { ! 2043: LARGE_INTEGER Capacity; ! 2044: LARGE_INTEGER Remaining; ! 2045: DWORD Type; ! 2046: DWORD Density; ! 2047: DWORD BlockSize; ! 2048: DWORD Partitions; ! 2049: BOOLEAN WriteProtected; ! 2050: } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS; ! 2051: ! 2052: ! 2053: // ! 2054: // IOCTL_TAPE_SET_MEDIA_PARAMS definitions ! 2055: // ! 2056: ! 2057: typedef struct _TAPE_SET_MEDIA_PARAMETERS { ! 2058: DWORD BlockSize; ! 2059: } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS; ! 2060: ! 2061: ! 2062: // ! 2063: // IOCTL_TAPE_GET_DRIVE_PARAMS definitions ! 2064: // ! 2065: ! 2066: #define TAPE_DRIVE_SETMARKS 0x10000000 ! 2067: #define TAPE_DRIVE_SHORT_FILEMARKS 0x20000000 ! 2068: #define TAPE_DRIVE_LONG_FILEMARKS 0x40000000 ! 2069: ! 2070: #define TAPE_DRIVE_ECC 0x00000001 ! 2071: #define TAPE_DRIVE_COMPRESSION 0x00000002 ! 2072: #define TAPE_DRIVE_PADDING 0x00000004 ! 2073: ! 2074: typedef struct _TAPE_DRIVE_PARAMETERS { ! 2075: DWORD Capabilities; ! 2076: DWORD CurrentSettings; ! 2077: } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS; ! 2078: ! 2079: // ! 2080: // IOCTL_TAPE_SET_DRIVE_PARAMS definitions ! 2081: // ! 2082: ! 2083: #define TAPE_DRIVE_SETMARKS 0x10000000 ! 2084: #define TAPE_DRIVE_SHORT_FILEMARKS 0x20000000 ! 2085: #define TAPE_DRIVE_LONG_FILEMARKS 0x40000000 ! 2086: ! 2087: #define TAPE_DRIVE_SHORT_ERASE 0x00000010 ! 2088: #define TAPE_DRIVE_LONG_ERASE 0x00000020 ! 2089: ! 2090: #define TAPE_DRIVE_ECC 0x00000001 ! 2091: #define TAPE_DRIVE_COMPRESSION 0x00000002 ! 2092: #define TAPE_DRIVE_PADDING 0x00000004 ! 2093: ! 2094: typedef struct _TAPE_SET_DRIVE_PARAMETERS { ! 2095: DWORD CurrentSettings; ! 2096: } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS; ! 2097: ! 2098: // ! 2099: // IOCTL_TAPE_GET_STATUS definitions ! 2100: // ! 2101: ! 2102: #define TAPE_STATUS_DEVICE_READY 0x00000000 ! 2103: #define TAPE_STATUS_NO_MEDIA 0x00000001 ! 2104: #define TAPE_STATUS_WRITE_PROTECTED 0x00000002 ! 2105: #define TAPE_STATUS_MEDIA_CHANGED 0x00000004 ! 2106: #define TAPE_STATUS_RESET_DETECTED 0x00000008 ! 2107: #define TAPE_STATUS_BEGINNING_OF_MEDIA 0x00000010 ! 2108: #define TAPE_STATUS_END_OF_MEDIA 0x00000020 ! 2109: #define TAPE_STATUS_DEVICE_NOT_READY 0x00000800 ! 2110: ! 2111: typedef struct _TAPE_STATUS { ! 2112: DWORD Status; ! 2113: } TAPE_STATUS, *PTAPE_STATUS; ! 2114: ! 2115: // ! 2116: // IOCTL_TAPE_CREATE_PARTITION definitions ! 2117: // ! 2118: ! 2119: #define TAPE_PARTITION_FIXED 0 ! 2120: #define TAPE_PARTITION_SELECT 1 ! 2121: #define TAPE_PARTITION_INITIATOR 2 ! 2122: ! 2123: typedef struct _TAPE_CREATE_PARTITION_PARAMETERS { ! 2124: DWORD Type; ! 2125: DWORD Count; ! 2126: DWORD Size[1]; // variable length array, 0 terminates ! 2127: } TAPE_CREATE_PARTITION_PARAMETERS, *PTAPE_CREATE_PARTITION_PARAMETERS; ! 2128: ! 2129: ! 2130: #endif // _WINNT_ 1.1 root 2131:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.