|
|
1.1.1.4 ! root 1: /*++ BUILD Version: 0093 Increment this if a change has global effects 1.1 root 2: 1.1.1.4 ! root 3: Copyright (c) 1990-1993 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.4 ! root 21: #ifdef __cplusplus ! 22: extern "C" { ! 23: #endif ! 24: ! 25: #include <ctype.h> 1.1.1.2 root 26: #define ANYSIZE_ARRAY 1 1.1.1.4 ! root 27: #if defined(_MIPS_) || defined(_ALPHA_) ! 28: #define UNALIGNED __unaligned ! 29: #else ! 30: #define UNALIGNED ! 31: #endif 1.1 root 32: typedef void *PVOID; 1.1.1.4 ! root 33: #if (_MSC_VER >= 800) ! 34: #define NTAPI __stdcall ! 35: #else ! 36: #define _cdecl ! 37: #define NTAPI ! 38: #endif 1.1 root 39: 40: // 41: // Basics 42: // 43: 44: #ifndef VOID 1.1.1.4 ! root 45: #define VOID void 1.1 root 46: typedef char CHAR; 47: typedef short SHORT; 48: typedef long LONG; 49: #endif 50: 51: // 1.1.1.2 root 52: // UNICODE (Wide Character) types 1.1 root 53: // 54: 1.1.1.4 ! root 55: typedef wchar_t WCHAR; // wc, 16-bit UNICODE character 1.1 root 56: 1.1.1.2 root 57: typedef WCHAR *PWCHAR; 58: typedef WCHAR *LPWCH, *PWCH; 59: typedef CONST WCHAR *LPCWCH, *PCWCH; 60: typedef WCHAR *NWPSTR; 61: typedef WCHAR *LPWSTR, *PWSTR; 62: 63: typedef CONST WCHAR *LPCWSTR, *PCWSTR; 1.1 root 64: 65: // 1.1.1.2 root 66: // ANSI (Multi-byte Character) types 1.1 root 67: // 1.1.1.2 root 68: typedef CHAR *PCHAR; 69: typedef CHAR *LPCH, *PCH; 70: 71: typedef CONST CHAR *LPCCH, *PCCH; 72: typedef CHAR *NPSTR; 73: typedef CHAR *LPSTR, *PSTR; 74: typedef CONST CHAR *LPCSTR, *PCSTR; 1.1 root 75: 1.1.1.2 root 76: // 77: // Neutral ANSI/UNICODE types and macros 78: // 1.1 root 79: #ifdef UNICODE 1.1.1.4 ! root 80: 1.1.1.3 root 81: #ifndef _TCHAR_DEFINED 82: typedef WCHAR TCHAR, *PTCHAR; 1.1.1.4 ! root 83: typedef WCHAR TBYTE , *PTBYTE ; 1.1.1.3 root 84: #define _TCHAR_DEFINED 1.1.1.4 ! root 85: #endif /* !_TCHAR_DEFINED */ ! 86: 1.1.1.2 root 87: typedef LPWSTR LPTCH, PTCH; 88: typedef LPWSTR PTSTR, LPTSTR; 89: typedef LPCWSTR LPCTSTR; 90: typedef LPWSTR LP; 1.1.1.4 ! root 91: #define __TEXT(quote) L##quote ! 92: ! 93: #else /* UNICODE */ ! 94: 1.1.1.3 root 95: #ifndef _TCHAR_DEFINED 1.1.1.2 root 96: typedef char TCHAR, *PTCHAR; 1.1.1.4 ! root 97: typedef unsigned char TBYTE , *PTBYTE ; 1.1.1.3 root 98: #define _TCHAR_DEFINED 1.1.1.4 ! root 99: #endif /* !_TCHAR_DEFINED */ ! 100: 1.1.1.2 root 101: typedef LPSTR LPTCH, PTCH; 102: typedef LPSTR PTSTR, LPTSTR; 103: typedef LPCSTR LPCTSTR; 1.1.1.4 ! root 104: #define __TEXT(quote) quote ! 105: ! 106: #endif /* UNICODE */ ! 107: #define TEXT(quote) __TEXT(quote) 1.1 root 108: 109: 110: typedef SHORT *PSHORT; 111: typedef LONG *PLONG; 1.1.1.4 ! root 112: ! 113: #ifdef STRICT ! 114: typedef void *HANDLE; ! 115: #define DECLARE_HANDLE(name) struct name##__ { int unused; }; typedef struct name##__ *name ! 116: #else ! 117: typedef PVOID HANDLE; ! 118: #define DECLARE_HANDLE(name) typedef HANDLE name ! 119: #endif ! 120: typedef HANDLE *PHANDLE; ! 121: 1.1.1.2 root 122: typedef char CCHAR; 1.1.1.4 ! root 123: typedef DWORD LCID; ! 124: typedef PDWORD PLCID; ! 125: typedef WORD LANGID; 1.1.1.2 root 126: /*lint -e624 */ 127: /*lint +e624 */ 128: #define APPLICATION_ERROR_MASK 0x20000000 129: #define ERROR_SEVERITY_SUCCESS 0x00000000 130: #define ERROR_SEVERITY_INFORMATIONAL 0x40000000 131: #define ERROR_SEVERITY_WARNING 0x80000000 132: #define ERROR_SEVERITY_ERROR 0xC0000000 133: 1.1.1.4 ! root 134: #if defined(MIDL_PASS) ! 135: typedef double LONGLONG; ! 136: typedef double DWORDLONG; ! 137: #else ! 138: #if defined(_M_IX86) ! 139: typedef double LONGLONG; ! 140: typedef double DWORDLONG; ! 141: #else ! 142: typedef double LONGLONG; ! 143: typedef double DWORDLONG; ! 144: #endif ! 145: #endif ! 146: ! 147: typedef LONGLONG *PLONGLONG; ! 148: typedef DWORDLONG *PDWORDLONG; ! 149: ! 150: #if defined(MIDL_PASS) 1.1.1.2 root 151: typedef struct _LARGE_INTEGER { 1.1.1.4 ! root 152: #else // MIDL_PASS ! 153: typedef union _LARGE_INTEGER { ! 154: #if defined(_CFRONT_PASS_) ! 155: struct { ! 156: DWORD LowPart; ! 157: LONG HighPart; ! 158: } u; ! 159: #else ! 160: struct { ! 161: DWORD LowPart; ! 162: LONG HighPart; ! 163: }; ! 164: #endif ! 165: #endif //MIDL_PASS ! 166: LONGLONG QuadPart; 1.1.1.2 root 167: } LARGE_INTEGER, *PLARGE_INTEGER; 168: 1.1.1.4 ! root 169: ! 170: #if defined(MIDL_PASS) 1.1.1.2 root 171: typedef struct _ULARGE_INTEGER { 1.1.1.4 ! root 172: #else // MIDL_PASS ! 173: typedef union _ULARGE_INTEGER { ! 174: #if defined(_CFRONT_PASS_) ! 175: struct { ! 176: DWORD LowPart; ! 177: DWORD HighPart; ! 178: } u; ! 179: #else ! 180: struct { ! 181: DWORD LowPart; ! 182: DWORD HighPart; ! 183: }; ! 184: #endif ! 185: #endif //MIDL_PASS ! 186: DWORDLONG QuadPart; 1.1.1.2 root 187: } ULARGE_INTEGER, *PULARGE_INTEGER; 188: 1.1.1.4 ! root 189: // end_ntminiport ! 190: ! 191: // ! 192: // Locally Unique Identifier ! 193: // ! 194: ! 195: typedef LARGE_INTEGER LUID, *PLUID; ! 196: 1.1 root 197: #define UNICODE_NULL ((WCHAR)0) 1.1.1.4 ! root 198: typedef BYTE BOOLEAN; 1.1.1.2 root 199: typedef BOOLEAN *PBOOLEAN; 200: // 201: // Doubly linked list structure. Can be used as either a list head, or 202: // as link words. 203: // 204: 205: typedef struct _LIST_ENTRY { 206: struct _LIST_ENTRY *Flink; 207: struct _LIST_ENTRY *Blink; 208: } LIST_ENTRY; 209: typedef LIST_ENTRY *PLIST_ENTRY; 210: 211: // 212: // Singly linked list structure. Can be used as either a list head, or 213: // as link words. 214: // 215: 216: typedef struct _SINGLE_LIST_ENTRY { 217: struct _SINGLE_LIST_ENTRY *Next; 218: } SINGLE_LIST_ENTRY, *PSINGLE_LIST_ENTRY; 1.1 root 219: #define MINCHAR 0x80 220: #define MAXCHAR 0x7f 221: #define MINSHORT 0x8000 222: #define MAXSHORT 0x7fff 223: #define MINLONG 0x80000000 224: #define MAXLONG 0x7fffffff 225: #define MAXBYTE 0xff 226: #define MAXWORD 0xffff 227: #define MAXDWORD 0xffffffff 1.1.1.4 ! root 228: // ! 229: // Calculate the byte offset of a field in a structure of type type. ! 230: // ! 231: ! 232: #define FIELD_OFFSET(type, field) ((LONG)&(((type *)0)->field)) ! 233: ! 234: ! 235: // ! 236: // Calculate the address of the base of the structure given its type, and an ! 237: // address of a field within the structure. ! 238: // ! 239: ! 240: #define CONTAINING_RECORD(address, type, field) ((type *)( \ ! 241: (PCHAR)(address) - \ ! 242: (PCHAR)(&((type *)0)->field))) ! 243: ! 244: /* ! 245: * Language IDs. ! 246: * ! 247: * The following two combinations of primary language ID and ! 248: * sublanguage ID have special semantics: ! 249: * ! 250: * Primary Language ID Sublanguage ID Result ! 251: * ------------------- --------------- ------------------------ ! 252: * LANG_NEUTRAL SUBLANG_NEUTRAL Language neutral ! 253: * LANG_NEUTRAL SUBLANG_DEFAULT User default language ! 254: * LANG_NEUTRAL SUBLANG_SYS_DEFAULT System default language ! 255: */ ! 256: ! 257: /* ! 258: * Primary language IDs. ! 259: */ ! 260: #define LANG_NEUTRAL 0x00 ! 261: ! 262: #define LANG_ALBANIAN 0x1c ! 263: #define LANG_ARABIC 0x01 ! 264: #define LANG_BAHASA 0x21 ! 265: #define LANG_BULGARIAN 0x02 ! 266: #define LANG_CATALAN 0x03 ! 267: #define LANG_CHINESE 0x04 ! 268: #define LANG_CZECH 0x05 ! 269: #define LANG_DANISH 0x06 ! 270: #define LANG_DUTCH 0x13 ! 271: #define LANG_ENGLISH 0x09 ! 272: #define LANG_FINNISH 0x0b ! 273: #define LANG_FRENCH 0x0c ! 274: #define LANG_GERMAN 0x07 ! 275: #define LANG_GREEK 0x08 ! 276: #define LANG_HEBREW 0x0d ! 277: #define LANG_HUNGARIAN 0x0e ! 278: #define LANG_ICELANDIC 0x0f ! 279: #define LANG_ITALIAN 0x10 ! 280: #define LANG_JAPANESE 0x11 ! 281: #define LANG_KOREAN 0x12 ! 282: #define LANG_NORWEGIAN 0x14 ! 283: #define LANG_POLISH 0x15 ! 284: #define LANG_PORTUGUESE 0x16 ! 285: #define LANG_RHAETO_ROMAN 0x17 ! 286: #define LANG_ROMANIAN 0x18 ! 287: #define LANG_RUSSIAN 0x19 ! 288: #define LANG_SERBO_CROATIAN 0x1a ! 289: #define LANG_SLOVAK 0x1b ! 290: #define LANG_SPANISH 0x0a ! 291: #define LANG_SWEDISH 0x1d ! 292: #define LANG_THAI 0x1e ! 293: #define LANG_TURKISH 0x1f ! 294: #define LANG_URDU 0x20 ! 295: ! 296: /* ! 297: * Sublanguage IDs. ! 298: * ! 299: * The name immediately following SUBLANG_ dictates which primary ! 300: * language ID that sublanguage ID can be combined with to form a ! 301: * valid language ID. ! 302: */ ! 303: #define SUBLANG_NEUTRAL 0x00 /* language neutral */ ! 304: #define SUBLANG_DEFAULT 0x01 /* user default */ ! 305: #define SUBLANG_SYS_DEFAULT 0x02 /* system default */ ! 306: ! 307: #define SUBLANG_CHINESE_SIMPLIFIED 0x02 /* Chinese (Simplified) */ ! 308: #define SUBLANG_CHINESE_TRADITIONAL 0x01 /* Chinese (Traditional) */ ! 309: #define SUBLANG_DUTCH 0x01 /* Dutch */ ! 310: #define SUBLANG_DUTCH_BELGIAN 0x02 /* Dutch (Belgian) */ ! 311: #define SUBLANG_ENGLISH_US 0x01 /* English (USA) */ ! 312: #define SUBLANG_ENGLISH_UK 0x02 /* English (UK) */ ! 313: #define SUBLANG_ENGLISH_AUS 0x03 /* English (Australian) */ ! 314: #define SUBLANG_ENGLISH_CAN 0x04 /* English (Canadian) */ ! 315: #define SUBLANG_ENGLISH_NZ 0x05 /* English (New Zealand) */ ! 316: #define SUBLANG_ENGLISH_EIRE 0x06 /* English (Irish) */ ! 317: #define SUBLANG_FRENCH 0x01 /* French */ ! 318: #define SUBLANG_FRENCH_BELGIAN 0x02 /* French (Belgian) */ ! 319: #define SUBLANG_FRENCH_CANADIAN 0x03 /* French (Canadian) */ ! 320: #define SUBLANG_FRENCH_SWISS 0x04 /* French (Swiss) */ ! 321: #define SUBLANG_GERMAN 0x01 /* German */ ! 322: #define SUBLANG_GERMAN_SWISS 0x02 /* German (Swiss) */ ! 323: #define SUBLANG_GERMAN_AUSTRIAN 0x03 /* German (Austrian) */ ! 324: #define SUBLANG_ITALIAN 0x01 /* Italian */ ! 325: #define SUBLANG_ITALIAN_SWISS 0x02 /* Italian (Swiss) */ ! 326: #define SUBLANG_NORWEGIAN_BOKMAL 0x01 /* Norwegian (Bokmal) */ ! 327: #define SUBLANG_NORWEGIAN_NYNORSK 0x02 /* Norwegian (Nynorsk) */ ! 328: #define SUBLANG_PORTUGUESE 0x02 /* Portuguese */ ! 329: #define SUBLANG_PORTUGUESE_BRAZILIAN 0x01 /* Portuguese (Brazilian) */ ! 330: #define SUBLANG_SERBO_CROATIAN_CYRILLIC 0x02 /* Serbo-Croatian (Cyrillic) */ ! 331: #define SUBLANG_SERBO_CROATIAN_LATIN 0x01 /* Croato-Serbian (Latin) */ ! 332: #define SUBLANG_SPANISH 0x01 /* Spanish (Castilian) */ ! 333: #define SUBLANG_SPANISH_MEXICAN 0x02 /* Spanish (Mexican) */ ! 334: #define SUBLANG_SPANISH_MODERN 0x03 /* Spanish (Modern) */ ! 335: ! 336: /* ! 337: * Sorting IDs. ! 338: * ! 339: */ ! 340: #define SORT_DEFAULT 0x0 /* sorting default */ ! 341: ! 342: ! 343: /* ! 344: * A language ID is a 16 bit value which is the combination of a ! 345: * primary language ID and a secondary language ID. The bits are ! 346: * allocated as follows: ! 347: * ! 348: * +-----------------------+-------------------------+ ! 349: * | Sublanguage ID | Primary Language ID | ! 350: * +-----------------------+-------------------------+ ! 351: * 15 10 9 0 bit ! 352: * ! 353: * ! 354: * Language ID creation/extraction macros: ! 355: * ! 356: * MAKELANGID - construct language id from a primary language id and ! 357: * a sublanguage id. ! 358: * PRIMARYLANGID - extract primary language id from a language id. ! 359: * SUBLANGID - extract sublanguage id from a language id. ! 360: */ ! 361: #define MAKELANGID(p, s) ((((WORD )(s)) << 10) | (WORD )(p)) ! 362: #define PRIMARYLANGID(lgid) ((WORD )(lgid) & 0x3ff) ! 363: #define SUBLANGID(lgid) ((WORD )(lgid) >> 10) ! 364: ! 365: ! 366: /* ! 367: * A locale ID is a 32 bit value which is the combination of a ! 368: * language ID, a sort ID, and a reserved area. The bits are ! 369: * allocated as follows: ! 370: * ! 371: * +-------------+---------+-------------------------+ ! 372: * | Reserved | Sort ID | Language ID | ! 373: * +-------------+---------+-------------------------+ ! 374: * 31 20 19 16 15 0 bit ! 375: * ! 376: * ! 377: * Locale ID creation/extraction macros: ! 378: * ! 379: * MAKELCID - construct locale id from a language id and a sort id. ! 380: * LANGIDFROMLCID - extract language id from a locale id. ! 381: * SORTIDFROMLCID - extract sort id from a locale id. ! 382: */ ! 383: #define NLS_VALID_LOCALE_MASK 0x000fffff ! 384: ! 385: #define MAKELCID(lgid, srtid) ((DWORD)((((DWORD)((WORD )(srtid))) << 16) | \ ! 386: ((DWORD)((WORD )(lgid))))) ! 387: #define LANGIDFROMLCID(lcid) ((WORD )(lcid)) ! 388: #define SORTIDFROMLCID(lcid) ((WORD )((((DWORD)(lcid)) & NLS_VALID_LOCALE_MASK) >> 16)) ! 389: ! 390: ! 391: /* ! 392: * Default System and User IDs for language and locale. ! 393: */ ! 394: #define LANG_SYSTEM_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_SYS_DEFAULT)) ! 395: #define LANG_USER_DEFAULT (MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT)) ! 396: ! 397: #define LOCALE_SYSTEM_DEFAULT (MAKELCID(LANG_SYSTEM_DEFAULT, SORT_DEFAULT)) ! 398: #define LOCALE_USER_DEFAULT (MAKELCID(LANG_USER_DEFAULT, SORT_DEFAULT)) ! 399: ! 400: ! 401: ! 402: // begin_ntminiport 1.1 root 403: 404: // 405: // Macros used to eliminate compiler warning generated when formal 406: // parameters or local variables are not declared. 407: // 408: // Use DBG_UNREFERENCED_PARAMETER() when a parameter is not yet 409: // referenced but will be once the module is completely developed. 410: // 411: // Use DBG_UNREFERENCED_LOCAL_VARIABLE() when a local variable is not yet 412: // referenced but will be once the module is completely developed. 413: // 414: // Use UNREFERENCED_PARAMETER() if a parameter will never be referenced. 415: // 416: // DBG_UNREFERENCED_PARAMETER and DBG_UNREFERENCED_LOCAL_VARIABLE will 417: // eventually be made into a null macro to help determine whether there 418: // is unfinished work. 419: // 420: 421: #if ! (defined(lint) || defined(_lint)) 422: #define UNREFERENCED_PARAMETER(P) (P) 423: #define DBG_UNREFERENCED_PARAMETER(P) (P) 424: #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) (V) 425: 426: #else // lint or _lint 427: 428: // Note: lint -e530 says don't complain about uninitialized variables for 429: // this. line +e530 turns that checking back on. Error 527 has to do with 430: // unreachable code. 431: 432: #define UNREFERENCED_PARAMETER(P) \ 433: /*lint -e527 -e530 */ \ 434: { \ 435: (P) = (P); \ 436: } \ 437: /*lint +e527 +e530 */ 438: #define DBG_UNREFERENCED_PARAMETER(P) \ 439: /*lint -e527 -e530 */ \ 440: { \ 441: (P) = (P); \ 442: } \ 443: /*lint +e527 +e530 */ 444: #define DBG_UNREFERENCED_LOCAL_VARIABLE(V) \ 445: /*lint -e527 -e530 */ \ 446: { \ 447: (V) = (V); \ 448: } \ 449: /*lint +e527 +e530 */ 450: 451: #endif // lint or _lint 452: 453: 1.1.1.4 ! root 454: /*lint -save -e767 */ 1.1 root 455: #define STATUS_WAIT_0 ((DWORD )0x00000000L) 456: #define STATUS_ABANDONED_WAIT_0 ((DWORD )0x00000080L) 1.1.1.2 root 457: #define STATUS_USER_APC ((DWORD )0x000000C0L) 1.1 root 458: #define STATUS_TIMEOUT ((DWORD )0x00000102L) 459: #define STATUS_PENDING ((DWORD )0x00000103L) 460: #define STATUS_DATATYPE_MISALIGNMENT ((DWORD )0x80000002L) 461: #define STATUS_BREAKPOINT ((DWORD )0x80000003L) 462: #define STATUS_SINGLE_STEP ((DWORD )0x80000004L) 463: #define STATUS_ACCESS_VIOLATION ((DWORD )0xC0000005L) 1.1.1.4 ! root 464: #define STATUS_IN_PAGE_ERROR ((DWORD )0xC0000006L) ! 465: #define STATUS_NO_MEMORY ((DWORD )0xC0000017L) 1.1.1.2 root 466: #define STATUS_ILLEGAL_INSTRUCTION ((DWORD )0xC000001DL) 1.1 root 467: #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD )0xC0000025L) 1.1.1.2 root 468: #define STATUS_INVALID_DISPOSITION ((DWORD )0xC0000026L) 469: #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD )0xC000008CL) 470: #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD )0xC000008DL) 471: #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD )0xC000008EL) 472: #define STATUS_FLOAT_INEXACT_RESULT ((DWORD )0xC000008FL) 473: #define STATUS_FLOAT_INVALID_OPERATION ((DWORD )0xC0000090L) 474: #define STATUS_FLOAT_OVERFLOW ((DWORD )0xC0000091L) 475: #define STATUS_FLOAT_STACK_CHECK ((DWORD )0xC0000092L) 476: #define STATUS_FLOAT_UNDERFLOW ((DWORD )0xC0000093L) 477: #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD )0xC0000094L) 478: #define STATUS_INTEGER_OVERFLOW ((DWORD )0xC0000095L) 479: #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD )0xC0000096L) 480: #define STATUS_STACK_OVERFLOW ((DWORD )0xC00000FDL) 1.1 root 481: #define STATUS_CONTROL_C_EXIT ((DWORD )0xC000013AL) 1.1.1.4 ! root 482: /*lint -restore */ 1.1 root 483: #define MAXIMUM_WAIT_OBJECTS 64 // Maximum number of wait objects 484: 485: #define MAXIMUM_SUSPEND_COUNT MAXCHAR // Maximum times thread can be suspended 486: typedef DWORD KSPIN_LOCK; 487: 1.1.1.4 ! root 488: #ifdef _ALPHA_ ! 489: ! 490: // begin_ntddk begin_nthal ! 491: // ! 492: // The following flags control the contents of the CONTEXT structure. ! 493: // ! 494: ! 495: #define CONTEXT_PORTABLE_32BIT 0x00100000 ! 496: #define CONTEXT_ALPHA 0x00020000 ! 497: ! 498: #define CONTEXT_CONTROL (CONTEXT_ALPHA | 0x00000001L) ! 499: #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA | 0x00000002L) ! 500: #define CONTEXT_INTEGER (CONTEXT_ALPHA | 0x00000004L) ! 501: ! 502: #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) ! 503: ! 504: #ifndef _PORTABLE_32BIT_CONTEXT ! 505: ! 506: // ! 507: // Context Frame ! 508: // ! 509: // This frame has a several purposes: 1) it is used as an argument to ! 510: // NtContinue, 2) it is used to construct a call frame for APC delivery, ! 511: // 3) it is used to construct a call frame for exception dispatching ! 512: // in user mode, 4) it is used in the user level thread creation ! 513: // routines, and 5) it is used to to pass thread state to debuggers. ! 514: // ! 515: // N.B. Because this record is used as a call frame, it must be EXACTLY ! 516: // a multiple of 16 bytes in length. ! 517: // ! 518: // There are two variations of the context structure. This is the real one. ! 519: // ! 520: ! 521: typedef struct _CONTEXT { ! 522: ! 523: // ! 524: // This section is specified/returned if the ContextFlags word contains ! 525: // the flag CONTEXT_FLOATING_POINT. ! 526: // ! 527: ! 528: DWORDLONG FltF0; ! 529: DWORDLONG FltF1; ! 530: DWORDLONG FltF2; ! 531: DWORDLONG FltF3; ! 532: DWORDLONG FltF4; ! 533: DWORDLONG FltF5; ! 534: DWORDLONG FltF6; ! 535: DWORDLONG FltF7; ! 536: DWORDLONG FltF8; ! 537: DWORDLONG FltF9; ! 538: DWORDLONG FltF10; ! 539: DWORDLONG FltF11; ! 540: DWORDLONG FltF12; ! 541: DWORDLONG FltF13; ! 542: DWORDLONG FltF14; ! 543: DWORDLONG FltF15; ! 544: DWORDLONG FltF16; ! 545: DWORDLONG FltF17; ! 546: DWORDLONG FltF18; ! 547: DWORDLONG FltF19; ! 548: DWORDLONG FltF20; ! 549: DWORDLONG FltF21; ! 550: DWORDLONG FltF22; ! 551: DWORDLONG FltF23; ! 552: DWORDLONG FltF24; ! 553: DWORDLONG FltF25; ! 554: DWORDLONG FltF26; ! 555: DWORDLONG FltF27; ! 556: DWORDLONG FltF28; ! 557: DWORDLONG FltF29; ! 558: DWORDLONG FltF30; ! 559: DWORDLONG FltF31; ! 560: ! 561: // ! 562: // This section is specified/returned if the ContextFlags word contains ! 563: // the flag CONTEXT_INTEGER. ! 564: // ! 565: // N.B. The registers gp, sp, and ra are defined in this section, but are ! 566: // considered part of the control context rather than part of the integer ! 567: // context. ! 568: // ! 569: ! 570: DWORDLONG IntV0; // $0: return value register, v0 ! 571: DWORDLONG IntT0; // $1: temporary registers, t0 - t7 ! 572: DWORDLONG IntT1; // $2: ! 573: DWORDLONG IntT2; // $3: ! 574: DWORDLONG IntT3; // $4: ! 575: DWORDLONG IntT4; // $5: ! 576: DWORDLONG IntT5; // $6: ! 577: DWORDLONG IntT6; // $7: ! 578: DWORDLONG IntT7; // $8: ! 579: DWORDLONG IntS0; // $9: nonvolatile registers, s0 - s5 ! 580: DWORDLONG IntS1; // $10: ! 581: DWORDLONG IntS2; // $11: ! 582: DWORDLONG IntS3; // $12: ! 583: DWORDLONG IntS4; // $13: ! 584: DWORDLONG IntS5; // $14: ! 585: DWORDLONG IntFp; // $15: frame pointer register, fp/s6 ! 586: DWORDLONG IntA0; // $16: argument registers, a0 - a5 ! 587: DWORDLONG IntA1; // $17: ! 588: DWORDLONG IntA2; // $18: ! 589: DWORDLONG IntA3; // $19: ! 590: DWORDLONG IntA4; // $20: ! 591: DWORDLONG IntA5; // $21: ! 592: DWORDLONG IntT8; // $22: temporary registers, t8 - t11 ! 593: DWORDLONG IntT9; // $23: ! 594: DWORDLONG IntT10; // $24: ! 595: DWORDLONG IntT11; // $25: ! 596: DWORDLONG IntRa; // $26: return address register, ra ! 597: DWORDLONG IntT12; // $27: temporary register, t12 ! 598: DWORDLONG IntAt; // $28: assembler temp register, at ! 599: DWORDLONG IntGp; // $29: global pointer register, gp ! 600: DWORDLONG IntSp; // $30: stack pointer register, sp ! 601: DWORDLONG IntZero; // $31: zero register, zero ! 602: ! 603: // ! 604: // This section is specified/returned if the ContextFlags word contains ! 605: // the flag CONTEXT_FLOATING_POINT. ! 606: // ! 607: ! 608: DWORDLONG Fpcr; // floating point control register ! 609: DWORDLONG SoftFpcr; // software extension to FPCR ! 610: ! 611: // ! 612: // This section is specified/returned if the ContextFlags word contains ! 613: // the flag CONTEXT_CONTROL. ! 614: // ! 615: // N.B. The registers gp, sp, and ra are defined in the integer section, ! 616: // but are considered part of the control context rather than part of ! 617: // the integer context. ! 618: // ! 619: ! 620: DWORDLONG Fir; // (fault instruction) continuation address ! 621: DWORD Psr; // processor status ! 622: ! 623: // ! 624: // The flags values within this flag control the contents of ! 625: // a CONTEXT record. ! 626: // ! 627: // If the context record is used as an input parameter, then ! 628: // for each portion of the context record controlled by a flag ! 629: // whose value is set, it is assumed that that portion of the ! 630: // context record contains valid context. If the context record ! 631: // is being used to modify a thread's context, then only that ! 632: // portion of the threads context will be modified. ! 633: // ! 634: // If the context record is used as an IN OUT parameter to capture ! 635: // the context of a thread, then only those portions of the thread's ! 636: // context corresponding to set flags will be returned. ! 637: // ! 638: // The context record is never used as an OUT only parameter. ! 639: // ! 640: ! 641: DWORD ContextFlags; ! 642: DWORD Fill[4]; // padding for 16-byte stack frame alignment ! 643: ! 644: } CONTEXT, *PCONTEXT; ! 645: ! 646: #else ! 647: ! 648: // ! 649: // 32-bit Context Frame ! 650: // ! 651: // This alternate version of the Alpha context structure parallels that ! 652: // of MIPS and IX86 in style for the first 64 entries: 32-bit machines ! 653: // can operate on the fields, and a value declared as a pointer to an ! 654: // array of int's can be used to index into the fields. This makes life ! 655: // with windbg and ntsd vastly easier. ! 656: // ! 657: // There are two parts: the first contains the lower 32-bits of each ! 658: // element in the 64-bit definition above. The second part contains ! 659: // the upper 32-bits of each 64-bit element above. ! 660: // ! 661: // The names in the first part are identical to the 64-bit names. ! 662: // The second part names are prefixed with "High". ! 663: // ! 664: // 1st half: at 32 bits each, (containing the low parts of 64-bit values) ! 665: // 32 floats, 32 ints, fpcrs, fir, psr, contextflags ! 666: // 2nd half: at 32 bits each ! 667: // 32 floats, 32 ints, fpcrs, fir, fill ! 668: // ! 669: // There is no external support for the 32-bit version of the context ! 670: // structure. It is only used internally by windbg and ntsd. ! 671: // ! 672: // This structure must be the same size as the 64-bit version above. ! 673: // ! 674: ! 675: typedef struct _CONTEXT { ! 676: ! 677: DWORD FltF0; ! 678: DWORD FltF1; ! 679: DWORD FltF2; ! 680: DWORD FltF3; ! 681: DWORD FltF4; ! 682: DWORD FltF5; ! 683: DWORD FltF6; ! 684: DWORD FltF7; ! 685: DWORD FltF8; ! 686: DWORD FltF9; ! 687: DWORD FltF10; ! 688: DWORD FltF11; ! 689: DWORD FltF12; ! 690: DWORD FltF13; ! 691: DWORD FltF14; ! 692: DWORD FltF15; ! 693: DWORD FltF16; ! 694: DWORD FltF17; ! 695: DWORD FltF18; ! 696: DWORD FltF19; ! 697: DWORD FltF20; ! 698: DWORD FltF21; ! 699: DWORD FltF22; ! 700: DWORD FltF23; ! 701: DWORD FltF24; ! 702: DWORD FltF25; ! 703: DWORD FltF26; ! 704: DWORD FltF27; ! 705: DWORD FltF28; ! 706: DWORD FltF29; ! 707: DWORD FltF30; ! 708: DWORD FltF31; ! 709: ! 710: DWORD IntV0; // $0: return value register, v0 ! 711: DWORD IntT0; // $1: temporary registers, t0 - t7 ! 712: DWORD IntT1; // $2: ! 713: DWORD IntT2; // $3: ! 714: DWORD IntT3; // $4: ! 715: DWORD IntT4; // $5: ! 716: DWORD IntT5; // $6: ! 717: DWORD IntT6; // $7: ! 718: DWORD IntT7; // $8: ! 719: DWORD IntS0; // $9: nonvolatile registers, s0 - s5 ! 720: DWORD IntS1; // $10: ! 721: DWORD IntS2; // $11: ! 722: DWORD IntS3; // $12: ! 723: DWORD IntS4; // $13: ! 724: DWORD IntS5; // $14: ! 725: DWORD IntFp; // $15: frame pointer register, fp/s6 ! 726: DWORD IntA0; // $16: argument registers, a0 - a5 ! 727: DWORD IntA1; // $17: ! 728: DWORD IntA2; // $18: ! 729: DWORD IntA3; // $19: ! 730: DWORD IntA4; // $20: ! 731: DWORD IntA5; // $21: ! 732: DWORD IntT8; // $22: temporary registers, t8 - t11 ! 733: DWORD IntT9; // $23: ! 734: DWORD IntT10; // $24: ! 735: DWORD IntT11; // $25: ! 736: DWORD IntRa; // $26: return address register, ra ! 737: DWORD IntT12; // $27: temporary register, t12 ! 738: DWORD IntAt; // $28: assembler temp register, at ! 739: DWORD IntGp; // $29: global pointer register, gp ! 740: DWORD IntSp; // $30: stack pointer register, sp ! 741: DWORD IntZero; // $31: zero register, zero ! 742: ! 743: DWORD Fpcr; // floating point control register ! 744: DWORD SoftFpcr; // software extension to FPCR ! 745: ! 746: DWORD Fir; // (fault instruction) continuation address ! 747: ! 748: DWORD Psr; // processor status ! 749: DWORD ContextFlags; ! 750: ! 751: // ! 752: // Beginning of the "second half". ! 753: // The name "High" parallels the HighPart of a LargeInteger. ! 754: // ! 755: ! 756: DWORD HighFltF0; ! 757: DWORD HighFltF1; ! 758: DWORD HighFltF2; ! 759: DWORD HighFltF3; ! 760: DWORD HighFltF4; ! 761: DWORD HighFltF5; ! 762: DWORD HighFltF6; ! 763: DWORD HighFltF7; ! 764: DWORD HighFltF8; ! 765: DWORD HighFltF9; ! 766: DWORD HighFltF10; ! 767: DWORD HighFltF11; ! 768: DWORD HighFltF12; ! 769: DWORD HighFltF13; ! 770: DWORD HighFltF14; ! 771: DWORD HighFltF15; ! 772: DWORD HighFltF16; ! 773: DWORD HighFltF17; ! 774: DWORD HighFltF18; ! 775: DWORD HighFltF19; ! 776: DWORD HighFltF20; ! 777: DWORD HighFltF21; ! 778: DWORD HighFltF22; ! 779: DWORD HighFltF23; ! 780: DWORD HighFltF24; ! 781: DWORD HighFltF25; ! 782: DWORD HighFltF26; ! 783: DWORD HighFltF27; ! 784: DWORD HighFltF28; ! 785: DWORD HighFltF29; ! 786: DWORD HighFltF30; ! 787: DWORD HighFltF31; ! 788: ! 789: DWORD HighIntV0; // $0: return value register, v0 ! 790: DWORD HighIntT0; // $1: temporary registers, t0 - t7 ! 791: DWORD HighIntT1; // $2: ! 792: DWORD HighIntT2; // $3: ! 793: DWORD HighIntT3; // $4: ! 794: DWORD HighIntT4; // $5: ! 795: DWORD HighIntT5; // $6: ! 796: DWORD HighIntT6; // $7: ! 797: DWORD HighIntT7; // $8: ! 798: DWORD HighIntS0; // $9: nonvolatile registers, s0 - s5 ! 799: DWORD HighIntS1; // $10: ! 800: DWORD HighIntS2; // $11: ! 801: DWORD HighIntS3; // $12: ! 802: DWORD HighIntS4; // $13: ! 803: DWORD HighIntS5; // $14: ! 804: DWORD HighIntFp; // $15: frame pointer register, fp/s6 ! 805: DWORD HighIntA0; // $16: argument registers, a0 - a5 ! 806: DWORD HighIntA1; // $17: ! 807: DWORD HighIntA2; // $18: ! 808: DWORD HighIntA3; // $19: ! 809: DWORD HighIntA4; // $20: ! 810: DWORD HighIntA5; // $21: ! 811: DWORD HighIntT8; // $22: temporary registers, t8 - t11 ! 812: DWORD HighIntT9; // $23: ! 813: DWORD HighIntT10; // $24: ! 814: DWORD HighIntT11; // $25: ! 815: DWORD HighIntRa; // $26: return address register, ra ! 816: DWORD HighIntT12; // $27: temporary register, t12 ! 817: DWORD HighIntAt; // $28: assembler temp register, at ! 818: DWORD HighIntGp; // $29: global pointer register, gp ! 819: DWORD HighIntSp; // $30: stack pointer register, sp ! 820: DWORD HighIntZero; // $31: zero register, zero ! 821: ! 822: DWORD HighFpcr; // floating point control register ! 823: DWORD HighSoftFpcr; // software extension to FPCR ! 824: DWORD HighFir; // processor status ! 825: ! 826: double DoNotUseThisField; // to force quadword structure alignment ! 827: DWORD HighFill[2]; // padding for 16-byte stack frame alignment ! 828: ! 829: } CONTEXT, *PCONTEXT; ! 830: ! 831: // ! 832: // These should name the fields in the _PORTABLE_32BIT structure ! 833: // that overlay the Psr and ContextFlags in the normal structure. ! 834: // ! 835: ! 836: #define _QUAD_PSR_OFFSET HighSoftFpcr ! 837: #define _QUAD_FLAGS_OFFSET HighFir ! 838: ! 839: #endif // _PORTABLE_32BIT_CONTEXT ! 840: ! 841: // end_ntddk end_nthal ! 842: ! 843: #endif // _ALPHA_ ! 844: ! 845: ! 846: #ifdef _ALPHA_ ! 847: ! 848: VOID ! 849: __jump_unwind ( ! 850: PVOID VirtualFramePointer, ! 851: PVOID TargetPc ! 852: ); ! 853: ! 854: #endif // _ALPHA_ ! 855: ! 856: ! 857: #ifdef _X86_ ! 858: ! 859: // ! 860: // Disable these two pramas that evaluate to "sti" "cli" on x86 so that driver ! 861: // writers to not leave them inadvertantly in their code. ! 862: // ! 863: ! 864: #if !defined(MIDL_PASS) ! 865: #if !defined(_CFRONT_PASS_) ! 866: #if !defined(RC_INVOKED) ! 867: ! 868: #pragma warning(disable:4164) // disable C4164 warning so that apps that ! 869: // build with /Od don't get weird errors ! ! 870: #pragma function(_enable) ! 871: #pragma function(_disable) ! 872: ! 873: #pragma warning(default:4164) // reenable C4164 warning ! 874: ! 875: #endif ! 876: #endif ! 877: #endif ! 878: 1.1 root 879: 880: // 881: // Define the size of the 80387 save area, which is in the context frame. 882: // 883: 884: #define SIZE_OF_80387_REGISTERS 80 885: 886: // 887: // The following flags control the contents of the CONTEXT structure. 888: // 889: 890: #define CONTEXT_i386 0x00010000 // this assumes that i386 and 1.1.1.2 root 891: #define CONTEXT_i486 0x00010000 // i486 have identical context records 1.1 root 892: 893: #define CONTEXT_CONTROL (CONTEXT_i386 | 0x00000001L) // SS:SP, CS:IP, FLAGS, BP 894: #define CONTEXT_INTEGER (CONTEXT_i386 | 0x00000002L) // AX, BX, CX, DX, SI, DI 895: #define CONTEXT_SEGMENTS (CONTEXT_i386 | 0x00000004L) // DS, ES, FS, GS 896: #define CONTEXT_FLOATING_POINT (CONTEXT_i386 | 0x00000008L) // 387 state 897: #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386 | 0x00000010L) // DB 0-3,6,7 898: 899: #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER |\ 1.1.1.2 root 900: CONTEXT_SEGMENTS) 1.1 root 901: 902: typedef struct _FLOATING_SAVE_AREA { 903: DWORD ControlWord; 904: DWORD StatusWord; 905: DWORD TagWord; 906: DWORD ErrorOffset; 907: DWORD ErrorSelector; 908: DWORD DataOffset; 909: DWORD DataSelector; 910: BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; 1.1.1.2 root 911: DWORD Cr0NpxState; 1.1 root 912: } FLOATING_SAVE_AREA; 913: 914: typedef FLOATING_SAVE_AREA *PFLOATING_SAVE_AREA; 915: 916: // 917: // Context Frame 918: // 919: // This frame has a several purposes: 1) it is used as an argument to 920: // NtContinue, 2) is is used to constuct a call frame for APC delivery, 921: // and 3) it is used in the user level thread creation routines. 922: // 923: // The layout of the record conforms to a standard call frame. 924: // 925: 926: typedef struct _CONTEXT { 927: 928: // 929: // The flags values within this flag control the contents of 930: // a CONTEXT record. 931: // 932: // If the context record is used as an input parameter, then 933: // for each portion of the context record controlled by a flag 934: // whose value is set, it is assumed that that portion of the 935: // context record contains valid context. If the context record 936: // is being used to modify a threads context, then only that 937: // portion of the threads context will be modified. 938: // 939: // If the context record is used as an IN OUT parameter to capture 940: // the context of a thread, then only those portions of the thread's 941: // context corresponding to set flags will be returned. 942: // 943: // The context record is never used as an OUT only parameter. 944: // 945: 946: DWORD ContextFlags; 947: 948: // 949: // This section is specified/returned if CONTEXT_DEBUG_REGISTERS is 950: // set in ContextFlags. Note that CONTEXT_DEBUG_REGISTERS is NOT 951: // included in CONTEXT_FULL. 952: // 953: 954: DWORD Dr0; 955: DWORD Dr1; 956: DWORD Dr2; 957: DWORD Dr3; 958: DWORD Dr6; 959: DWORD Dr7; 960: 961: // 962: // This section is specified/returned if the 963: // ContextFlags word contians the flag CONTEXT_FLOATING_POINT. 964: // 965: 966: FLOATING_SAVE_AREA FloatSave; 967: 968: // 969: // This section is specified/returned if the 970: // ContextFlags word contians the flag CONTEXT_SEGMENTS. 971: // 972: 973: DWORD SegGs; 974: DWORD SegFs; 975: DWORD SegEs; 976: DWORD SegDs; 977: 978: // 979: // This section is specified/returned if the 980: // ContextFlags word contians the flag CONTEXT_INTEGER. 981: // 982: 983: DWORD Edi; 984: DWORD Esi; 985: DWORD Ebx; 986: DWORD Edx; 987: DWORD Ecx; 988: DWORD Eax; 989: 990: // 991: // This section is specified/returned if the 992: // ContextFlags word contians the flag CONTEXT_CONTROL. 993: // 994: 995: DWORD Ebp; 996: DWORD Eip; 997: DWORD SegCs; // MUST BE SANITIZED 998: DWORD EFlags; // MUST BE SANITIZED 999: DWORD Esp; 1000: DWORD SegSs; 1001: 1002: } CONTEXT; 1003: 1004: 1005: 1006: typedef CONTEXT *PCONTEXT; 1007: 1.1.1.4 ! root 1008: // begin_ntminiport ! 1009: ! 1010: #endif //_X86_ ! 1011: 1.1 root 1012: 1013: typedef struct _LDT_ENTRY { 1014: WORD LimitLow; 1015: WORD BaseLow; 1016: union { 1017: struct { 1018: BYTE BaseMid; 1019: BYTE Flags1; // Declare as bytes to avoid alignment 1020: BYTE Flags2; // Problems. 1021: BYTE BaseHi; 1022: } Bytes; 1023: struct { 1024: DWORD BaseMid : 8; 1025: DWORD Type : 5; 1026: DWORD Dpl : 2; 1027: DWORD Pres : 1; 1028: DWORD LimitHi : 4; 1029: DWORD Sys : 1; 1030: DWORD Reserved_0 : 1; 1031: DWORD Default_Big : 1; 1032: DWORD Granularity : 1; 1033: DWORD BaseHi : 8; 1034: } Bits; 1035: } HighWord; 1036: } LDT_ENTRY, *PLDT_ENTRY; 1037: 1038: 1.1.1.4 ! root 1039: #if defined(_MIPS_) 1.1 root 1040: 1.1.1.4 ! root 1041: // begin_ntddk begin_nthal 1.1 root 1042: // 1043: // The following flags control the contents of the CONTEXT structure. 1044: // 1045: 1.1.1.4 ! root 1046: #define CONTEXT_R4000 0x00010000 // r4000 context 1.1 root 1047: 1.1.1.4 ! root 1048: #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L) ! 1049: #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L) ! 1050: #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L) 1.1 root 1051: 1052: #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) 1053: 1054: // 1055: // Context Frame 1056: // 1057: // N.B. This frame must be exactly a multiple of 16 bytes in length. 1058: // 1059: // This frame has a several purposes: 1) it is used as an argument to 1060: // NtContinue, 2) it is used to constuct a call frame for APC delivery, 1061: // 3) it is used to construct a call frame for exception dispatching 1062: // in user mode, and 4) it is used in the user level thread creation 1063: // routines. 1064: // 1065: // The layout of the record conforms to a standard call frame. 1066: // 1067: 1068: typedef struct _CONTEXT { 1069: 1070: // 1071: // This section is always present and is used as an argument build 1072: // area. 1073: // 1074: 1075: DWORD Argument[4]; 1076: 1077: // 1078: // This section is specified/returned if the ContextFlags word contains 1079: // the flag CONTEXT_FLOATING_POINT. 1080: // 1081: 1082: DWORD FltF0; 1083: DWORD FltF1; 1084: DWORD FltF2; 1085: DWORD FltF3; 1086: DWORD FltF4; 1087: DWORD FltF5; 1088: DWORD FltF6; 1089: DWORD FltF7; 1090: DWORD FltF8; 1091: DWORD FltF9; 1092: DWORD FltF10; 1093: DWORD FltF11; 1094: DWORD FltF12; 1095: DWORD FltF13; 1096: DWORD FltF14; 1097: DWORD FltF15; 1098: DWORD FltF16; 1099: DWORD FltF17; 1100: DWORD FltF18; 1101: DWORD FltF19; 1102: DWORD FltF20; 1103: DWORD FltF21; 1104: DWORD FltF22; 1105: DWORD FltF23; 1106: DWORD FltF24; 1107: DWORD FltF25; 1108: DWORD FltF26; 1109: DWORD FltF27; 1110: DWORD FltF28; 1111: DWORD FltF29; 1112: DWORD FltF30; 1113: DWORD FltF31; 1114: 1115: // 1116: // This section is specified/returned if the ContextFlags word contains 1117: // the flag CONTEXT_INTEGER. 1118: // 1119: // N.B. The registers gp, sp, and ra are defined in this section, but are 1120: // considered part of the control context rather than part of the integer 1121: // context. 1122: // 1123: // N.B. Register zero is not stored in the frame. 1124: // 1125: 1126: DWORD IntZero; 1127: DWORD IntAt; 1128: DWORD IntV0; 1129: DWORD IntV1; 1130: DWORD IntA0; 1131: DWORD IntA1; 1132: DWORD IntA2; 1133: DWORD IntA3; 1134: DWORD IntT0; 1135: DWORD IntT1; 1136: DWORD IntT2; 1137: DWORD IntT3; 1138: DWORD IntT4; 1139: DWORD IntT5; 1140: DWORD IntT6; 1141: DWORD IntT7; 1142: DWORD IntS0; 1143: DWORD IntS1; 1144: DWORD IntS2; 1145: DWORD IntS3; 1146: DWORD IntS4; 1147: DWORD IntS5; 1148: DWORD IntS6; 1149: DWORD IntS7; 1150: DWORD IntT8; 1151: DWORD IntT9; 1152: DWORD IntK0; 1153: DWORD IntK1; 1154: DWORD IntGp; 1155: DWORD IntSp; 1156: DWORD IntS8; 1157: DWORD IntRa; 1158: DWORD IntLo; 1159: DWORD IntHi; 1160: 1161: // 1162: // This section is specified/returned if the ContextFlags word contains 1163: // the flag CONTEXT_FLOATING_POINT. 1164: // 1165: 1166: DWORD Fsr; 1167: 1168: // 1169: // This section is specified/returned if the ContextFlags word contains 1170: // the flag CONTEXT_CONTROL. 1171: // 1172: // N.B. The registers gp, sp, and ra are defined in the integer section, 1173: // but are considered part of the control context rather than part of 1174: // the integer context. 1175: // 1176: 1177: DWORD Fir; 1178: DWORD Psr; 1179: 1180: // 1181: // The flags values within this flag control the contents of 1182: // a CONTEXT record. 1183: // 1184: // If the context record is used as an input parameter, then 1185: // for each portion of the context record controlled by a flag 1186: // whose value is set, it is assumed that that portion of the 1187: // context record contains valid context. If the context record 1188: // is being used to modify a thread's context, then only that 1189: // portion of the threads context will be modified. 1190: // 1191: // If the context record is used as an IN OUT parameter to capture 1192: // the context of a thread, then only those portions of the thread's 1193: // context corresponding to set flags will be returned. 1194: // 1195: // The context record is never used as an OUT only parameter. 1196: // 1197: 1198: DWORD ContextFlags; 1199: 1200: DWORD Fill[2]; 1201: } CONTEXT, *PCONTEXT; 1202: 1.1.1.4 ! root 1203: // end_ntddk end_nthal ! 1204: 1.1 root 1205: #endif // MIPS 1206: 1207: 1.1.1.4 ! root 1208: #if defined(_MIPS_) 1.1 root 1209: 1210: VOID 1211: __jump_unwind ( 1212: PVOID Fp, 1213: PVOID TargetPc 1214: ); 1215: 1216: #endif // MIPS 1217: 1218: #define EXCEPTION_NONCONTINUABLE 0x1 // Noncontinuable exception 1.1.1.2 root 1219: #define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters 1.1 root 1220: 1221: // 1222: // Exception record definition. 1223: // 1224: 1225: typedef struct _EXCEPTION_RECORD { 1.1.1.2 root 1226: /*lint -e18 */ // Don't complain about different definitions 1.1 root 1227: DWORD ExceptionCode; 1.1.1.2 root 1228: /*lint +e18 */ // Resume checking for different definitions 1.1 root 1229: DWORD ExceptionFlags; 1230: struct _EXCEPTION_RECORD *ExceptionRecord; 1231: PVOID ExceptionAddress; 1232: DWORD NumberParameters; 1233: DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; 1234: } EXCEPTION_RECORD; 1235: 1236: typedef EXCEPTION_RECORD *PEXCEPTION_RECORD; 1237: 1238: // 1239: // Typedef for pointer returned by exception_info() 1240: // 1241: 1242: typedef struct _EXCEPTION_POINTERS { 1243: PEXCEPTION_RECORD ExceptionRecord; 1244: PCONTEXT ContextRecord; 1245: } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; 1246: #define PROCESS_TERMINATE (0x0001) 1.1.1.2 root 1247: #define PROCESS_CREATE_THREAD (0x0002) 1248: #define PROCESS_VM_OPERATION (0x0008) 1.1 root 1249: #define PROCESS_VM_READ (0x0010) 1250: #define PROCESS_VM_WRITE (0x0020) 1251: #define PROCESS_DUP_HANDLE (0x0040) 1252: #define PROCESS_CREATE_PROCESS (0x0080) 1253: #define PROCESS_SET_INFORMATION (0x0200) 1254: #define PROCESS_QUERY_INFORMATION (0x0400) 1255: #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 1256: 0xFFF) 1.1.1.2 root 1257: 1.1 root 1258: #define THREAD_TERMINATE (0x0001) 1259: #define THREAD_SUSPEND_RESUME (0x0002) 1260: #define THREAD_GET_CONTEXT (0x0008) 1261: #define THREAD_SET_CONTEXT (0x0010) 1262: #define THREAD_SET_INFORMATION (0x0020) 1263: #define THREAD_QUERY_INFORMATION (0x0040) 1264: #define THREAD_SET_THREAD_TOKEN (0x0080) 1265: #define THREAD_IMPERSONATE (0x0100) 1266: #define THREAD_DIRECT_IMPERSONATION (0x0200) 1.1.1.4 ! root 1267: // begin_ntddk ! 1268: 1.1 root 1269: #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | \ 1270: 0x3FF) 1.1.1.4 ! root 1271: ! 1272: // end_ntddk 1.1 root 1273: #define TLS_MINIMUM_AVAILABLE 64 1.1.1.3 root 1274: #define THREAD_BASE_PRIORITY_LOWRT 15 // value that gets a thread to LowRealtime-1 1.1 root 1275: #define THREAD_BASE_PRIORITY_MAX 2 // maximum thread base priority boost 1276: #define THREAD_BASE_PRIORITY_MIN -2 // minimum thread base priority boost 1.1.1.3 root 1277: #define THREAD_BASE_PRIORITY_IDLE -15 // value that gets a thread to idle 1.1 root 1278: #define EVENT_MODIFY_STATE 0x0002 1279: #define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 1280: #define MUTANT_QUERY_STATE 0x0001 1281: 1282: #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|\ 1283: MUTANT_QUERY_STATE) 1284: #define SEMAPHORE_MODIFY_STATE 0x0002 1285: #define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 1.1.1.3 root 1286: #define TIME_ZONE_ID_UNKNOWN 0 1287: #define TIME_ZONE_ID_STANDARD 1 1288: #define TIME_ZONE_ID_DAYLIGHT 2 1.1 root 1289: 1290: #define PROCESSOR_INTEL_386 386 1291: #define PROCESSOR_INTEL_486 486 1.1.1.4 ! root 1292: #define PROCESSOR_INTEL_PENTIUM 586 1.1 root 1293: #define PROCESSOR_INTEL_860 860 1294: #define PROCESSOR_MIPS_R2000 2000 1295: #define PROCESSOR_MIPS_R3000 3000 1296: #define PROCESSOR_MIPS_R4000 4000 1.1.1.4 ! root 1297: #define PROCESSOR_ALPHA_21064 21064 1.1 root 1298: 1299: typedef struct _MEMORY_BASIC_INFORMATION { 1300: PVOID BaseAddress; 1301: PVOID AllocationBase; 1302: DWORD AllocationProtect; 1303: DWORD RegionSize; 1304: DWORD State; 1305: DWORD Protect; 1306: DWORD Type; 1.1.1.2 root 1307: } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION; 1.1 root 1308: #define SECTION_QUERY 0x0001 1309: #define SECTION_MAP_WRITE 0x0002 1310: #define SECTION_MAP_READ 0x0004 1311: #define SECTION_MAP_EXECUTE 0x0008 1312: #define SECTION_EXTEND_SIZE 0x0010 1313: 1314: #define SECTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SECTION_QUERY|\ 1315: SECTION_MAP_WRITE | \ 1316: SECTION_MAP_READ | \ 1317: SECTION_MAP_EXECUTE | \ 1318: SECTION_EXTEND_SIZE) 1319: #define PAGE_NOACCESS 0x01 1320: #define PAGE_READONLY 0x02 1321: #define PAGE_READWRITE 0x04 1.1.1.4 ! root 1322: #define PAGE_WRITECOPY 0x08 ! 1323: #define PAGE_EXECUTE 0x10 ! 1324: #define PAGE_EXECUTE_READ 0x20 ! 1325: #define PAGE_EXECUTE_READWRITE 0x40 ! 1326: #define PAGE_EXECUTE_WRITECOPY 0x80 ! 1327: #define PAGE_GUARD 0x100 ! 1328: #define PAGE_NOCACHE 0x200 1.1 root 1329: #define MEM_COMMIT 0x1000 1330: #define MEM_RESERVE 0x2000 1331: #define MEM_DECOMMIT 0x4000 1332: #define MEM_RELEASE 0x8000 1333: #define MEM_FREE 0x10000 1334: #define MEM_PRIVATE 0x20000 1.1.1.4 ! root 1335: #define MEM_MAPPED 0x40000 ! 1336: #define MEM_TOP_DOWN 0x100000 ! 1337: #define SEC_FILE 0x800000 ! 1338: #define SEC_IMAGE 0x1000000 ! 1339: #define SEC_RESERVE 0x4000000 ! 1340: #define SEC_COMMIT 0x8000000 ! 1341: #define SEC_NOCACHE 0x10000000 ! 1342: #define MEM_IMAGE SEC_IMAGE ! 1343: ! 1344: // ! 1345: // Define access rights to files and directories ! 1346: // ! 1347: ! 1348: // ! 1349: // The FILE_READ_DATA and FILE_WRITE_DATA constants are also defined in ! 1350: // devioctl.h as FILE_READ_ACCESS and FILE_WRITE_ACCESS. The values for these ! 1351: // constants *MUST* always be in sync. ! 1352: // The values are redefined in devioctl.h because they must be available to ! 1353: // both DOS and NT. ! 1354: // ! 1355: ! 1356: #define FILE_READ_DATA ( 0x0001 ) // file & pipe ! 1357: #define FILE_LIST_DIRECTORY ( 0x0001 ) // directory ! 1358: ! 1359: #define FILE_WRITE_DATA ( 0x0002 ) // file & pipe ! 1360: #define FILE_ADD_FILE ( 0x0002 ) // directory ! 1361: ! 1362: #define FILE_APPEND_DATA ( 0x0004 ) // file ! 1363: #define FILE_ADD_SUBDIRECTORY ( 0x0004 ) // directory ! 1364: #define FILE_CREATE_PIPE_INSTANCE ( 0x0004 ) // named pipe ! 1365: ! 1366: #define FILE_READ_EA ( 0x0008 ) // file & directory ! 1367: ! 1368: #define FILE_WRITE_EA ( 0x0010 ) // file & directory ! 1369: ! 1370: #define FILE_EXECUTE ( 0x0020 ) // file ! 1371: #define FILE_TRAVERSE ( 0x0020 ) // directory ! 1372: ! 1373: #define FILE_DELETE_CHILD ( 0x0040 ) // directory ! 1374: ! 1375: #define FILE_READ_ATTRIBUTES ( 0x0080 ) // all ! 1376: ! 1377: #define FILE_WRITE_ATTRIBUTES ( 0x0100 ) // all ! 1378: ! 1379: #define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x1FF) ! 1380: ! 1381: ! 1382: #define FILE_GENERIC_READ (STANDARD_RIGHTS_READ |\ ! 1383: FILE_READ_DATA |\ ! 1384: FILE_READ_ATTRIBUTES |\ ! 1385: FILE_READ_EA |\ ! 1386: SYNCHRONIZE) ! 1387: ! 1388: ! 1389: #define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE |\ ! 1390: FILE_WRITE_DATA |\ ! 1391: FILE_WRITE_ATTRIBUTES |\ ! 1392: FILE_WRITE_EA |\ ! 1393: FILE_APPEND_DATA |\ ! 1394: SYNCHRONIZE) ! 1395: ! 1396: ! 1397: #define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE |\ ! 1398: FILE_READ_ATTRIBUTES |\ ! 1399: FILE_EXECUTE |\ ! 1400: SYNCHRONIZE) ! 1401: 1.1 root 1402: #define FILE_SHARE_READ 0x00000001 1403: #define FILE_SHARE_WRITE 0x00000002 1404: #define FILE_ATTRIBUTE_READONLY 0x00000001 1405: #define FILE_ATTRIBUTE_HIDDEN 0x00000002 1406: #define FILE_ATTRIBUTE_SYSTEM 0x00000004 1.1.1.2 root 1407: #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 1.1 root 1408: #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 1409: #define FILE_ATTRIBUTE_NORMAL 0x00000080 1.1.1.2 root 1410: #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 1411: #define FILE_ATTRIBUTE_ATOMIC_WRITE 0x00000200 1412: #define FILE_ATTRIBUTE_XACTION_WRITE 0x00000400 1413: #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 1414: #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 1415: #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 1416: #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 1417: #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 1418: #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 1.1.1.4 ! root 1419: #define MAILSLOT_NO_MESSAGE ((DWORD)-1) ! 1420: #define MAILSLOT_WAIT_FOREVER ((DWORD)-1) 1.1 root 1421: #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 1422: #define FILE_CASE_PRESERVED_NAMES 0x00000002 1423: #define FILE_UNICODE_ON_DISK 0x00000004 1.1.1.3 root 1424: #define FILE_PERSISTENT_ACLS 0x00000008 1.1 root 1425: #define DUPLICATE_CLOSE_SOURCE 0x00000001 1426: #define DUPLICATE_SAME_ACCESS 0x00000002 1.1.1.2 root 1427: typedef PVOID PACCESS_TOKEN; 1.1 root 1428: typedef PVOID PSECURITY_DESCRIPTOR; 1429: typedef PVOID PSID; 1.1.1.2 root 1430: //////////////////////////////////////////////////////////////////////// 1431: // // 1432: // ACCESS MASK // 1433: // // 1434: //////////////////////////////////////////////////////////////////////// 1435: 1436: // 1437: // Define the access mask as a longword sized structure divided up as 1438: // follows: 1439: // 1440: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1441: // 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 1442: // +---------------+---------------+-------------------------------+ 1443: // |G|G|G|G|Res'd|A| StandardRights| SpecificRights | 1444: // |R|W|E|A| |S| | | 1445: // +-+-------------+---------------+-------------------------------+ 1446: // 1447: // typedef struct _ACCESS_MASK { 1448: // WORD SpecificRights; 1449: // BYTE StandardRights; 1450: // BYTE AccessSystemAcl : 1; 1451: // BYTE Reserved : 3; 1452: // BYTE GenericAll : 1; 1453: // BYTE GenericExecute : 1; 1454: // BYTE GenericWrite : 1; 1455: // BYTE GenericRead : 1; 1456: // } ACCESS_MASK; 1457: // typedef ACCESS_MASK *PACCESS_MASK; 1458: // 1459: // but to make life simple for programmer's we'll allow them to specify 1460: // a desired access mask by simply OR'ing together mulitple single rights 1.1.1.4 ! root 1461: // and treat an access mask as a DWORD. For example 1.1.1.2 root 1462: // 1463: // DesiredAccess = DELETE | READ_CONTROL 1464: // 1465: // So we'll declare ACCESS_MASK as DWORD 1466: // 1467: 1.1.1.4 ! root 1468: // begin_ntddk begin_nthal 1.1.1.2 root 1469: typedef DWORD ACCESS_MASK; 1470: typedef ACCESS_MASK *PACCESS_MASK; 1471: 1472: //////////////////////////////////////////////////////////////////////// 1473: // // 1474: // ACCESS TYPES // 1475: // // 1476: //////////////////////////////////////////////////////////////////////// 1477: 1478: 1.1.1.4 ! root 1479: // begin_ntddk begin_nthal 1.1.1.2 root 1480: // 1481: // The following are masks for the predefined standard access types 1482: // 1483: 1.1 root 1484: #define DELETE (0x00010000L) 1485: #define READ_CONTROL (0x00020000L) 1486: #define WRITE_DAC (0x00040000L) 1487: #define WRITE_OWNER (0x00080000L) 1488: #define SYNCHRONIZE (0x00100000L) 1489: 1490: #define STANDARD_RIGHTS_REQUIRED (0x000F0000L) 1491: 1492: #define STANDARD_RIGHTS_READ (READ_CONTROL) 1493: #define STANDARD_RIGHTS_WRITE (READ_CONTROL) 1494: #define STANDARD_RIGHTS_EXECUTE (READ_CONTROL) 1495: 1496: #define STANDARD_RIGHTS_ALL (0x001F0000L) 1497: 1498: #define SPECIFIC_RIGHTS_ALL (0x0000FFFFL) 1499: 1500: // 1501: // AccessSystemAcl access type 1502: // 1503: 1504: #define ACCESS_SYSTEM_SECURITY (0x01000000L) 1505: 1506: // 1507: // MaximumAllowed access type 1508: // 1509: 1510: #define MAXIMUM_ALLOWED (0x02000000L) 1511: 1512: // 1513: // These are the generic rights. 1514: // 1515: 1516: #define GENERIC_READ (0x80000000L) 1517: #define GENERIC_WRITE (0x40000000L) 1518: #define GENERIC_EXECUTE (0x20000000L) 1519: #define GENERIC_ALL (0x10000000L) 1.1.1.2 root 1520: 1521: 1522: // 1523: // Define the generic mapping array. This is used to denote the 1524: // mapping of each generic access right to a specific access mask. 1525: // 1526: 1527: typedef struct _GENERIC_MAPPING { 1528: ACCESS_MASK GenericRead; 1529: ACCESS_MASK GenericWrite; 1530: ACCESS_MASK GenericExecute; 1531: ACCESS_MASK GenericAll; 1532: } GENERIC_MAPPING; 1533: typedef GENERIC_MAPPING *PGENERIC_MAPPING; 1534: 1535: 1536: 1537: //////////////////////////////////////////////////////////////////////// 1538: // // 1539: // LUID_AND_ATTRIBUTES // 1540: // // 1541: //////////////////////////////////////////////////////////////////////// 1542: // 1543: // 1544: 1545: 1.1.1.4 ! root 1546: #ifndef RC_INVOKED ! 1547: #pragma pack(4) ! 1548: #endif ! 1549: 1.1.1.2 root 1550: typedef struct _LUID_AND_ATTRIBUTES { 1551: LUID Luid; 1552: DWORD Attributes; 1553: } LUID_AND_ATTRIBUTES, * PLUID_AND_ATTRIBUTES; 1554: typedef LUID_AND_ATTRIBUTES LUID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; 1555: typedef LUID_AND_ATTRIBUTES_ARRAY *PLUID_AND_ATTRIBUTES_ARRAY; 1556: 1.1.1.4 ! root 1557: #ifndef RC_INVOKED ! 1558: #pragma pack() ! 1559: #endif ! 1560: 1.1.1.2 root 1561: 1562: //////////////////////////////////////////////////////////////////////// 1563: // // 1564: // Security Id (SID) // 1565: // // 1566: //////////////////////////////////////////////////////////////////////// 1567: // 1568: // 1569: // Pictorially the structure of an SID is as follows: 1570: // 1571: // 1 1 1 1 1 1 1572: // 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 1573: // +---------------------------------------------------------------+ 1574: // | SubAuthorityCount |Reserved1 (SBZ)| Revision | 1575: // +---------------------------------------------------------------+ 1576: // | IdentifierAuthority[0] | 1577: // +---------------------------------------------------------------+ 1578: // | IdentifierAuthority[1] | 1579: // +---------------------------------------------------------------+ 1580: // | IdentifierAuthority[2] | 1581: // +---------------------------------------------------------------+ 1582: // | | 1583: // +- - - - - - - - SubAuthority[] - - - - - - - - -+ 1584: // | | 1585: // +---------------------------------------------------------------+ 1586: // 1587: // 1588: 1589: typedef struct _SID_IDENTIFIER_AUTHORITY { 1590: BYTE Value[6]; 1591: } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY; 1592: 1593: 1594: typedef struct _SID { 1595: BYTE Revision; 1596: BYTE SubAuthorityCount; 1597: SID_IDENTIFIER_AUTHORITY IdentifierAuthority; 1598: #ifdef MIDL_PASS 1599: [size_is(SubAuthorityCount)] DWORD SubAuthority[*]; 1600: #else // MIDL_PASS 1601: DWORD SubAuthority[ANYSIZE_ARRAY]; 1602: #endif // MIDL_PASS 1603: } SID, *PISID; 1604: 1605: 1606: #define SID_REVISION (1) // Current revision level 1607: #define SID_MAX_SUB_AUTHORITIES (15) 1608: #define SID_RECOMMENDED_SUB_AUTHORITIES (1) // Will change to around 6 1609: // in a future release. 1610: 1611: typedef enum _SID_NAME_USE { 1612: SidTypeUser = 1, 1613: SidTypeGroup, 1614: SidTypeDomain, 1615: SidTypeAlias, 1616: SidTypeWellKnownGroup, 1617: SidTypeDeletedAccount, 1618: SidTypeInvalid, 1619: SidTypeUnknown 1620: } SID_NAME_USE, *PSID_NAME_USE; 1621: 1622: 1623: typedef struct _SID_AND_ATTRIBUTES { 1624: PSID Sid; 1625: DWORD Attributes; 1626: } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES; 1627: 1628: typedef SID_AND_ATTRIBUTES SID_AND_ATTRIBUTES_ARRAY[ANYSIZE_ARRAY]; 1629: typedef SID_AND_ATTRIBUTES_ARRAY *PSID_AND_ATTRIBUTES_ARRAY; 1630: 1631: 1632: 1633: ///////////////////////////////////////////////////////////////////////////// 1634: // // 1635: // Universal well-known SIDs // 1636: // // 1637: // Null SID S-1-0-0 // 1638: // World S-1-1-0 // 1639: // Local S-1-2-0 // 1640: // Creator Owner ID S-1-3-0 // 1641: // Creator Group ID S-1-3-1 // 1642: // // 1.1.1.4 ! root 1643: // (Non-unique IDs) S-1-4 // ! 1644: // // 1.1.1.2 root 1645: ///////////////////////////////////////////////////////////////////////////// 1646: 1647: #define SECURITY_NULL_SID_AUTHORITY {0,0,0,0,0,0} 1648: #define SECURITY_WORLD_SID_AUTHORITY {0,0,0,0,0,1} 1649: #define SECURITY_LOCAL_SID_AUTHORITY {0,0,0,0,0,2} 1650: #define SECURITY_CREATOR_SID_AUTHORITY {0,0,0,0,0,3} 1.1.1.4 ! root 1651: #define SECURITY_NON_UNIQUE_AUTHORITY {0,0,0,0,0,4} 1.1.1.2 root 1652: 1653: #define SECURITY_NULL_RID (0x00000000L) 1654: #define SECURITY_WORLD_RID (0x00000000L) 1655: #define SECURITY_LOCAL_RID (0X00000000L) 1656: 1657: #define SECURITY_CREATOR_OWNER_RID (0x00000000L) 1658: #define SECURITY_CREATOR_GROUP_RID (0x00000001L) 1659: 1660: 1661: 1662: 1663: ///////////////////////////////////////////////////////////////////////////// 1664: // // 1665: // NT well-known SIDs // 1666: // // 1667: // NT Authority S-1-5 // 1668: // Dialup S-1-5-1 // 1669: // // 1670: // Network S-1-5-2 // 1671: // Batch S-1-5-3 // 1672: // Interactive S-1-5-4 // 1673: // Service S-1-5-6 // 1.1.1.4 ! root 1674: // AnonymousLogon S-1-5-7 (aka null logon session) // 1.1.1.2 root 1675: // // 1676: // (Logon IDs) S-1-5-5-X-Y // 1677: // // 1.1.1.4 ! root 1678: // (NT non-unique IDs) S-1-5-0x15-... // ! 1679: // // ! 1680: // (Built-in domain) s-1-5-0x20 // 1.1.1.2 root 1681: // // 1682: ///////////////////////////////////////////////////////////////////////////// 1683: 1684: 1685: #define SECURITY_NT_AUTHORITY {0,0,0,0,0,5} 1686: 1687: #define SECURITY_DIALUP_RID (0x00000001L) 1688: #define SECURITY_NETWORK_RID (0x00000002L) 1689: #define SECURITY_BATCH_RID (0x00000003L) 1690: #define SECURITY_INTERACTIVE_RID (0x00000004L) 1691: #define SECURITY_SERVICE_RID (0x00000006L) 1.1.1.4 ! root 1692: #define SECURITY_ANONYMOUS_LOGON_RID (0x00000007L) 1.1.1.2 root 1693: 1694: #define SECURITY_LOGON_IDS_RID (0x00000005L) 1695: #define SECURITY_LOGON_IDS_RID_COUNT (3L) 1696: 1697: #define SECURITY_LOCAL_SYSTEM_RID (0x00000012L) 1698: 1.1.1.4 ! root 1699: #define SECURITY_NT_NON_UNIQUE (0x00000015L) ! 1700: 1.1.1.2 root 1701: #define SECURITY_BUILTIN_DOMAIN_RID (0x00000020L) 1702: 1703: 1704: 1705: 1706: 1707: ///////////////////////////////////////////////////////////////////////////// 1708: // // 1709: // well-known domain relative sub-authority values (RIDs)... // 1710: // // 1711: ///////////////////////////////////////////////////////////////////////////// 1712: 1713: // Well-known users ... 1714: 1715: #define DOMAIN_USER_RID_ADMIN (0x000001F4L) 1716: #define DOMAIN_USER_RID_GUEST (0x000001F5L) 1717: 1718: 1719: 1720: // well-known groups ... 1721: 1722: #define DOMAIN_GROUP_RID_ADMINS (0x00000200L) 1723: #define DOMAIN_GROUP_RID_USERS (0x00000201L) 1724: 1725: 1726: 1727: 1728: // well-known aliases ... 1729: 1730: #define DOMAIN_ALIAS_RID_ADMINS (0x00000220L) 1731: #define DOMAIN_ALIAS_RID_USERS (0x00000221L) 1732: #define DOMAIN_ALIAS_RID_GUESTS (0x00000222L) 1733: #define DOMAIN_ALIAS_RID_POWER_USERS (0x00000223L) 1734: 1735: #define DOMAIN_ALIAS_RID_ACCOUNT_OPS (0x00000224L) 1736: #define DOMAIN_ALIAS_RID_SYSTEM_OPS (0x00000225L) 1737: #define DOMAIN_ALIAS_RID_PRINT_OPS (0x00000226L) 1738: #define DOMAIN_ALIAS_RID_BACKUP_OPS (0x00000227L) 1739: 1740: #define DOMAIN_ALIAS_RID_REPLICATOR (0x00000228L) 1741: 1742: 1743: 1744: 1745: 1746: 1747: // 1748: // Allocate the System Luid. The first 1000 LUIDs are reserved. 1749: // Use #999 here (0x3E7 = 999) 1750: // 1751: 1.1.1.4 ! root 1752: #define SYSTEM_LUID { 0x3E7, 0x0 } 1.1.1.2 root 1753: 1754: 1755: 1756: //////////////////////////////////////////////////////////////////////// 1757: // // 1758: // User and Group related SID attributes // 1759: // // 1760: //////////////////////////////////////////////////////////////////////// 1761: 1762: // 1763: // Group attributes 1764: // 1765: 1766: #define SE_GROUP_MANDATORY (0x00000001L) 1767: #define SE_GROUP_ENABLED_BY_DEFAULT (0x00000002L) 1768: #define SE_GROUP_ENABLED (0x00000004L) 1769: #define SE_GROUP_OWNER (0x00000008L) 1770: #define SE_GROUP_LOGON_ID (0xC0000000L) 1771: 1772: 1773: 1774: // 1775: // User attributes 1776: // 1777: 1778: // (None yet defined.) 1779: 1780: 1781: 1782: 1783: //////////////////////////////////////////////////////////////////////// 1784: // // 1785: // ACL and ACE // 1786: // // 1787: //////////////////////////////////////////////////////////////////////// 1788: 1789: // 1790: // Define an ACL and the ACE format. The structure of an ACL header 1791: // followed by one or more ACEs. Pictorally the structure of an ACL header 1792: // is as follows: 1793: // 1794: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1795: // 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 1796: // +-------------------------------+---------------+---------------+ 1797: // | AclSize | Sbz1 | AclRevision | 1798: // +-------------------------------+---------------+---------------+ 1799: // | Sbz2 | AceCount | 1800: // +-------------------------------+-------------------------------+ 1801: // 1802: // The current AclRevision is defined to be ACL_REVISION. 1803: // 1804: // AclSize is the size, in bytes, allocated for the ACL. This includes 1805: // the ACL header, ACES, and remaining free space in the buffer. 1806: // 1807: // AceCount is the number of ACES in the ACL. 1808: // 1809: 1.1.1.4 ! root 1810: // begin_ntddk 1.1.1.2 root 1811: // This is the *current* ACL revision 1812: 1813: #define ACL_REVISION (2) 1814: 1815: // This is the history of ACL revisions. Add a new one whenever 1816: // ACL_REVISION is updated 1817: 1818: #define ACL_REVISION1 (1) 1819: #define ACL_REVISION2 (2) 1820: 1821: typedef struct _ACL { 1822: BYTE AclRevision; 1823: BYTE Sbz1; 1824: WORD AclSize; 1825: WORD AceCount; 1826: WORD Sbz2; 1827: } ACL; 1828: typedef ACL *PACL; 1829: 1.1.1.4 ! root 1830: // end_ntddk ! 1831: 1.1.1.2 root 1832: // 1833: // The structure of an ACE is a common ace header followed by ace type 1834: // specific data. Pictorally the structure of the common ace header is 1835: // as follows: 1836: // 1837: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1838: // 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 1839: // +---------------+-------+-------+---------------+---------------+ 1840: // | AceSize | AceFlags | AceType | 1841: // +---------------+-------+-------+---------------+---------------+ 1842: // 1843: // AceType denotes the type of the ace, there are some predefined ace 1844: // types 1845: // 1846: // AceSize is the size, in bytes, of ace. 1847: // 1848: // AceFlags are the Ace flags for audit and inheritance, defined shortly. 1849: 1850: typedef struct _ACE_HEADER { 1851: BYTE AceType; 1852: BYTE AceFlags; 1853: WORD AceSize; 1854: } ACE_HEADER; 1855: typedef ACE_HEADER *PACE_HEADER; 1856: 1857: // 1858: // The following are the predefined ace types that go into the AceType 1859: // field of an Ace header. 1860: // 1861: 1862: #define ACCESS_ALLOWED_ACE_TYPE (0x0) 1863: #define ACCESS_DENIED_ACE_TYPE (0x1) 1864: #define SYSTEM_AUDIT_ACE_TYPE (0x2) 1865: #define SYSTEM_ALARM_ACE_TYPE (0x3) 1866: 1867: // 1868: // The following are the inherit flags that go into the AceFlags field 1869: // of an Ace header. 1870: // 1871: 1872: #define OBJECT_INHERIT_ACE (0x1) 1873: #define CONTAINER_INHERIT_ACE (0x2) 1874: #define NO_PROPAGATE_INHERIT_ACE (0x4) 1875: #define INHERIT_ONLY_ACE (0x8) 1876: #define VALID_INHERIT_FLAGS (0xF) 1877: 1878: 1879: // The following are the currently defined ACE flags that go into the 1880: // AceFlags field of an ACE header. Each ACE type has its own set of 1881: // AceFlags. 1882: // 1883: // SUCCESSFUL_ACCESS_ACE_FLAG - used only with system audit and alarm ACE 1884: // types to indicate that a message is generated for successful accesses. 1885: // 1886: // FAILED_ACCESS_ACE_FLAG - used only with system audit and alarm ACE types 1887: // to indicate that a message is generated for failed accesses. 1888: // 1889: 1890: // 1891: // SYSTEM_AUDIT and SYSTEM_ALARM AceFlags 1892: // 1893: // These control the signaling of audit and alarms for success or failure. 1894: // 1895: 1896: #define SUCCESSFUL_ACCESS_ACE_FLAG (0x40) 1897: #define FAILED_ACCESS_ACE_FLAG (0x80) 1898: 1899: 1900: // 1901: // We'll define the structure of the predefined ACE types. Pictorally 1902: // the structure of the predefined ACE's is as follows: 1903: // 1904: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1905: // 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 1906: // +---------------+-------+-------+---------------+---------------+ 1907: // | AceFlags | Resd |Inherit| AceSize | AceType | 1908: // +---------------+-------+-------+---------------+---------------+ 1909: // | Mask | 1910: // +---------------------------------------------------------------+ 1911: // | | 1912: // + + 1913: // | | 1914: // + Sid + 1915: // | | 1916: // + + 1917: // | | 1918: // +---------------------------------------------------------------+ 1919: // 1920: // Mask is the access mask associated with the ACE. This is either the 1921: // access allowed, access denied, audit, or alarm mask. 1922: // 1923: // Sid is the Sid associated with the ACE. 1924: // 1925: 1926: // The following are the four predefined ACE types. 1927: 1928: // Examine the AceType field in the Header to determine 1929: // which structure is appropriate to use for casting. 1930: 1931: typedef struct _ACCESS_ALLOWED_ACE { 1932: ACE_HEADER Header; 1933: ACCESS_MASK Mask; 1934: DWORD SidStart; 1935: } ACCESS_ALLOWED_ACE; 1936: 1937: typedef ACCESS_ALLOWED_ACE *PACCESS_ALLOWED_ACE; 1938: 1939: typedef struct _ACCESS_DENIED_ACE { 1940: ACE_HEADER Header; 1941: ACCESS_MASK Mask; 1942: DWORD SidStart; 1943: } ACCESS_DENIED_ACE; 1944: typedef ACCESS_DENIED_ACE *PACCESS_DENIED_ACE; 1945: 1946: typedef struct _SYSTEM_AUDIT_ACE { 1947: ACE_HEADER Header; 1948: ACCESS_MASK Mask; 1949: DWORD SidStart; 1950: } SYSTEM_AUDIT_ACE; 1951: typedef SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; 1952: 1953: typedef struct _SYSTEM_ALARM_ACE { 1954: ACE_HEADER Header; 1955: ACCESS_MASK Mask; 1956: DWORD SidStart; 1957: } SYSTEM_ALARM_ACE; 1958: typedef SYSTEM_ALARM_ACE *PSYSTEM_ALARM_ACE; 1959: 1960: 1961: 1962: // 1963: // The following declarations are used for setting and querying information 1964: // about and ACL. First are the various information classes available to 1965: // the user. 1966: // 1967: 1968: typedef enum _ACL_INFORMATION_CLASS { 1969: AclRevisionInformation = 1, 1970: AclSizeInformation 1971: } ACL_INFORMATION_CLASS; 1972: 1973: // 1974: // This record is returned/sent if the user is requesting/setting the 1975: // AclRevisionInformation 1976: // 1977: 1978: typedef struct _ACL_REVISION_INFORMATION { 1979: DWORD AclRevision; 1980: } ACL_REVISION_INFORMATION; 1981: typedef ACL_REVISION_INFORMATION *PACL_REVISION_INFORMATION; 1982: 1983: // 1984: // This record is returned if the user is requesting AclSizeInformation 1985: // 1986: 1987: typedef struct _ACL_SIZE_INFORMATION { 1988: DWORD AceCount; 1989: DWORD AclBytesInUse; 1990: DWORD AclBytesFree; 1991: } ACL_SIZE_INFORMATION; 1992: typedef ACL_SIZE_INFORMATION *PACL_SIZE_INFORMATION; 1993: 1994: 1995: //////////////////////////////////////////////////////////////////////// 1996: // // 1997: // SECURITY_DESCRIPTOR // 1998: // // 1999: //////////////////////////////////////////////////////////////////////// 2000: // 2001: // Define the Security Descriptor and related data types. 2002: // This is an opaque data structure. 2003: // 2004: 1.1.1.4 ! root 2005: // begin_ntddk 1.1.1.2 root 2006: // 2007: // Current security descriptor revision value 2008: // 2009: 2010: #define SECURITY_DESCRIPTOR_REVISION (1) 2011: #define SECURITY_DESCRIPTOR_REVISION1 (1) 2012: 1.1.1.4 ! root 2013: // end_ntddk ! 2014: 1.1.1.2 root 2015: // 2016: // Minimum length, in bytes, needed to build a security descriptor 2017: // (NOTE: This must manually be kept consistent with the) 2018: // (sizeof(SECURITY_DESCRIPTOR) ) 2019: // 2020: 2021: #define SECURITY_DESCRIPTOR_MIN_LENGTH (20) 2022: 2023: 2024: typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL; 2025: 2026: #define SE_OWNER_DEFAULTED (0x0001) 2027: #define SE_GROUP_DEFAULTED (0x0002) 2028: #define SE_DACL_PRESENT (0x0004) 2029: #define SE_DACL_DEFAULTED (0x0008) 2030: #define SE_SACL_PRESENT (0x0010) 2031: #define SE_SACL_DEFAULTED (0x0020) 2032: #define SE_SELF_RELATIVE (0x8000) 2033: 2034: // 2035: // Where: 2036: // 2037: // SE_OWNER_DEFAULTED - This boolean flag, when set, indicates that the 2038: // SID pointed to by the Owner field was provided by a 2039: // defaulting mechanism rather than explicitly provided by the 2040: // original provider of the security descriptor. This may 2041: // affect the treatment of the SID with respect to inheritence 2042: // of an owner. 2043: // 2044: // SE_GROUP_DEFAULTED - This boolean flag, when set, indicates that the 2045: // SID in the Group field was provided by a defaulting mechanism 2046: // rather than explicitly provided by the original provider of 2047: // the security descriptor. This may affect the treatment of 2048: // the SID with respect to inheritence of a primary group. 2049: // 2050: // SE_DACL_PRESENT - This boolean flag, when set, indicates that the 2051: // security descriptor contains a discretionary ACL. If this 2052: // flag is set and the Dacl field of the SECURITY_DESCRIPTOR is 2053: // null, then a null ACL is explicitly being specified. 2054: // 2055: // SE_DACL_DEFAULTED - This boolean flag, when set, indicates that the 2056: // ACL pointed to by the Dacl field was provided by a defaulting 2057: // mechanism rather than explicitly provided by the original 2058: // provider of the security descriptor. This may affect the 2059: // treatment of the ACL with respect to inheritence of an ACL. 2060: // This flag is ignored if the DaclPresent flag is not set. 2061: // 2062: // SE_SACL_PRESENT - This boolean flag, when set, indicates that the 2063: // security descriptor contains a system ACL pointed to by the 2064: // Sacl field. If this flag is set and the Sacl field of the 2065: // SECURITY_DESCRIPTOR is null, then an empty (but present) 2066: // ACL is being specified. 2067: // 2068: // SE_SACL_DEFAULTED - This boolean flag, when set, indicates that the 2069: // ACL pointed to by the Sacl field was provided by a defaulting 2070: // mechanism rather than explicitly provided by the original 2071: // provider of the security descriptor. This may affect the 2072: // treatment of the ACL with respect to inheritence of an ACL. 2073: // This flag is ignored if the SaclPresent flag is not set. 2074: // 2075: // SE_SELF_RELATIVE - This boolean flag, when set, indicates that the 2076: // security descriptor is in self-relative form. In this form, 2077: // all fields of the security descriptor are contiguous in memory 2078: // and all pointer fields are expressed as offsets from the 2079: // beginning of the security descriptor. This form is useful 2080: // for treating security descriptors as opaque data structures 2081: // for transmission in communication protocol or for storage on 2082: // secondary media. 2083: // 2084: // 2085: // 2086: // Pictorially the structure of a security descriptor is as follows: 2087: // 2088: // 3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 2089: // 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 2090: // +---------------------------------------------------------------+ 2091: // | Control |Reserved1 (SBZ)| Revision | 2092: // +---------------------------------------------------------------+ 2093: // | Owner | 2094: // +---------------------------------------------------------------+ 2095: // | Group | 2096: // +---------------------------------------------------------------+ 2097: // | Sacl | 2098: // +---------------------------------------------------------------+ 2099: // | Dacl | 2100: // +---------------------------------------------------------------+ 2101: // 2102: // In general, this data structure should be treated opaquely to ensure future 2103: // compatibility. 2104: // 2105: // 2106: 2107: typedef struct _SECURITY_DESCRIPTOR { 2108: BYTE Revision; 2109: BYTE Sbz1; 2110: SECURITY_DESCRIPTOR_CONTROL Control; 2111: PSID Owner; 2112: PSID Group; 2113: PACL Sacl; 2114: PACL Dacl; 2115: } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR; 2116: 2117: 2118: // Where: 2119: // 2120: // Revision - Contains the revision level of the security 2121: // descriptor. This allows this structure to be passed between 2122: // systems or stored on disk even though it is expected to 2123: // change in the future. 2124: // 2125: // Control - A set of flags which qualify the meaning of the 2126: // security descriptor or individual fields of the security 2127: // descriptor. 2128: // 2129: // Owner - is a pointer to an SID representing an object's owner. 2130: // If this field is null, then no owner SID is present in the 2131: // security descriptor. If the security descriptor is in 2132: // self-relative form, then this field contains an offset to 2133: // the SID, rather than a pointer. 2134: // 2135: // Group - is a pointer to an SID representing an object's primary 2136: // group. If this field is null, then no primary group SID is 2137: // present in the security descriptor. If the security descriptor 2138: // is in self-relative form, then this field contains an offset to 2139: // the SID, rather than a pointer. 2140: // 2141: // Sacl - is a pointer to a system ACL. This field value is only 2142: // valid if the DaclPresent control flag is set. If the 2143: // SaclPresent flag is set and this field is null, then a null 2144: // ACL is specified. If the security descriptor is in 2145: // self-relative form, then this field contains an offset to 2146: // the ACL, rather than a pointer. 2147: // 2148: // Dacl - is a pointer to a discretionary ACL. This field value is 2149: // only valid if the DaclPresent control flag is set. If the 2150: // DaclPresent flag is set and this field is null, then a null 2151: // ACL (unconditionally granting access) is specified. If the 2152: // security descriptor is in self-relative form, then this field 2153: // contains an offset to the ACL, rather than a pointer. 2154: // 2155: 2156: 2157: 2158: //////////////////////////////////////////////////////////////////////// 2159: // // 2160: // Privilege Related Data Structures // 2161: // // 2162: //////////////////////////////////////////////////////////////////////// 2163: 2164: 1.1.1.4 ! root 2165: // begin_ntddk begin_nthal 1.1.1.2 root 2166: // 2167: // Privilege attributes 2168: // 2169: 2170: #define SE_PRIVILEGE_ENABLED_BY_DEFAULT (0x00000001L) 2171: #define SE_PRIVILEGE_ENABLED (0x00000002L) 2172: #define SE_PRIVILEGE_USED_FOR_ACCESS (0x80000000L) 2173: 2174: // 2175: // Privilege Set Control flags 2176: // 2177: 2178: #define PRIVILEGE_SET_ALL_NECESSARY (1) 2179: 2180: // 2181: // Privilege Set - This is defined for a privilege set of one. 2182: // If more than one privilege is needed, then this structure 2183: // will need to be allocated with more space. 2184: // 2185: // Note: don't change this structure without fixing the INITIAL_PRIVILEGE_SET 2186: // structure (defined in se.h) 2187: // 2188: 2189: typedef struct _PRIVILEGE_SET { 2190: DWORD PrivilegeCount; 2191: DWORD Control; 2192: LUID_AND_ATTRIBUTES Privilege[ANYSIZE_ARRAY]; 2193: } PRIVILEGE_SET, * PPRIVILEGE_SET; 2194: 2195: 2196: //////////////////////////////////////////////////////////////////////// 2197: // // 2198: // NT Defined Privileges // 2199: // // 2200: //////////////////////////////////////////////////////////////////////// 2201: 1.1.1.3 root 2202: #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") 2203: #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") 2204: #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") 2205: #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") 2206: #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") 2207: #define SE_TCB_NAME TEXT("SeTcbPrivilege") 2208: #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") 2209: #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") 2210: #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") 2211: #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") 2212: #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") 2213: #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") 2214: #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") 2215: #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") 2216: #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") 2217: #define SE_BACKUP_NAME TEXT("SeBackupPrivilege") 2218: #define SE_RESTORE_NAME TEXT("SeRestorePrivilege") 2219: #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") 2220: #define SE_DEBUG_NAME TEXT("SeDebugPrivilege") 2221: #define SE_AUDIT_NAME TEXT("SeAuditPrivilege") 2222: #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") 2223: #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") 2224: #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") 1.1.1.2 root 2225: 2226: 2227: //////////////////////////////////////////////////////////////////// 2228: // // 2229: // Security Quality Of Service // 2230: // // 2231: // // 2232: //////////////////////////////////////////////////////////////////// 2233: 1.1.1.4 ! root 2234: // begin_ntddk begin_nthal 1.1.1.2 root 2235: // 2236: // Impersonation Level 2237: // 2238: // Impersonation level is represented by a pair of bits in Windows. 2239: // If a new impersonation level is added or lowest value is changed from 2240: // 0 to something else, fix the Windows CreateFile call. 2241: // 2242: 2243: typedef enum _SECURITY_IMPERSONATION_LEVEL { 2244: SecurityAnonymous, 2245: SecurityIdentification, 2246: SecurityImpersonation, 2247: SecurityDelegation 2248: } SECURITY_IMPERSONATION_LEVEL, * PSECURITY_IMPERSONATION_LEVEL; 2249: 2250: #define SECURITY_MAX_IMPERSONATION_LEVEL SecurityDelegation 2251: 2252: #define DEFAULT_IMPERSONATION_LEVEL SecurityImpersonation 2253: 1.1.1.4 ! root 2254: // end_nthal 1.1.1.2 root 2255: // 2256: // Security Tracking Mode 2257: // 2258: 2259: #define SECURITY_DYNAMIC_TRACKING (TRUE) 2260: #define SECURITY_STATIC_TRACKING (FALSE) 2261: 2262: typedef BOOLEAN SECURITY_CONTEXT_TRACKING_MODE, 2263: * PSECURITY_CONTEXT_TRACKING_MODE; 2264: 2265: 2266: 2267: // 2268: // Quality Of Service 2269: // 2270: 2271: typedef struct _SECURITY_QUALITY_OF_SERVICE { 2272: DWORD Length; 2273: SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 2274: SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; 2275: BOOLEAN EffectiveOnly; 2276: } SECURITY_QUALITY_OF_SERVICE, * PSECURITY_QUALITY_OF_SERVICE; 2277: 2278: 2279: // 2280: // Used to represent information related to a thread impersonation 2281: // 2282: 2283: typedef struct _SE_IMPERSONATION_STATE { 2284: PACCESS_TOKEN Token; 2285: BOOLEAN CopyOnOpen; 2286: BOOLEAN EffectiveOnly; 2287: SECURITY_IMPERSONATION_LEVEL Level; 2288: } SE_IMPERSONATION_STATE, *PSE_IMPERSONATION_STATE; 2289: 2290: 2291: //////////////////////////////////////////////////////////////////// 2292: // // 2293: // Token Object Definitions // 2294: // // 2295: // // 2296: //////////////////////////////////////////////////////////////////// 2297: 2298: 2299: // 2300: // Token Specific Access Rights. 2301: // 2302: 2303: #define TOKEN_ASSIGN_PRIMARY (0x0001) 2304: #define TOKEN_DUPLICATE (0x0002) 2305: #define TOKEN_IMPERSONATE (0x0004) 2306: #define TOKEN_QUERY (0x0008) 2307: #define TOKEN_QUERY_SOURCE (0x0010) 2308: #define TOKEN_ADJUST_PRIVILEGES (0x0020) 2309: #define TOKEN_ADJUST_GROUPS (0x0040) 2310: #define TOKEN_ADJUST_DEFAULT (0x0080) 2311: 2312: #define TOKEN_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED |\ 2313: TOKEN_ASSIGN_PRIMARY |\ 2314: TOKEN_DUPLICATE |\ 2315: TOKEN_IMPERSONATE |\ 2316: TOKEN_QUERY |\ 2317: TOKEN_QUERY_SOURCE |\ 2318: TOKEN_ADJUST_PRIVILEGES |\ 2319: TOKEN_ADJUST_GROUPS |\ 2320: TOKEN_ADJUST_DEFAULT) 2321: 2322: 2323: #define TOKEN_READ (STANDARD_RIGHTS_READ |\ 2324: TOKEN_QUERY) 2325: 2326: 2327: #define TOKEN_WRITE (STANDARD_RIGHTS_WRITE |\ 2328: TOKEN_ADJUST_PRIVILEGES |\ 2329: TOKEN_ADJUST_GROUPS |\ 2330: TOKEN_ADJUST_DEFAULT) 2331: 1.1.1.4 ! root 2332: #define TOKEN_EXECUTE (STANDARD_RIGHTS_EXECUTE) 1.1.1.2 root 2333: 2334: 2335: // 2336: // Token Types 2337: // 2338: 2339: typedef enum _TOKEN_TYPE { 2340: TokenPrimary = 1, 2341: TokenImpersonation 2342: } TOKEN_TYPE; 2343: typedef TOKEN_TYPE *PTOKEN_TYPE; 2344: 2345: 2346: // 2347: // Token Information Classes. 2348: // 2349: 2350: 2351: typedef enum _TOKEN_INFORMATION_CLASS { 2352: TokenUser = 1, 2353: TokenGroups, 2354: TokenPrivileges, 2355: TokenOwner, 2356: TokenPrimaryGroup, 2357: TokenDefaultDacl, 2358: TokenSource, 2359: TokenType, 2360: TokenImpersonationLevel, 2361: TokenStatistics 2362: } TOKEN_INFORMATION_CLASS, *PTOKEN_INFORMATION_CLASS; 2363: 2364: // 2365: // Token information class structures 2366: // 2367: 2368: typedef struct _TOKEN_USER { 2369: SID_AND_ATTRIBUTES User; 2370: } TOKEN_USER, *PTOKEN_USER; 2371: 2372: 2373: typedef struct _TOKEN_GROUPS { 2374: DWORD GroupCount; 2375: SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY]; 2376: } TOKEN_GROUPS, *PTOKEN_GROUPS; 2377: 2378: 2379: typedef struct _TOKEN_PRIVILEGES { 2380: DWORD PrivilegeCount; 2381: LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]; 2382: } TOKEN_PRIVILEGES, *PTOKEN_PRIVILEGES; 2383: 2384: 2385: typedef struct _TOKEN_OWNER { 2386: PSID Owner; 2387: } TOKEN_OWNER, *PTOKEN_OWNER; 2388: 2389: 2390: typedef struct _TOKEN_PRIMARY_GROUP { 2391: PSID PrimaryGroup; 2392: } TOKEN_PRIMARY_GROUP, *PTOKEN_PRIMARY_GROUP; 2393: 2394: 2395: typedef struct _TOKEN_DEFAULT_DACL { 2396: PACL DefaultDacl; 2397: } TOKEN_DEFAULT_DACL, *PTOKEN_DEFAULT_DACL; 2398: 2399: 2400: 2401: #define TOKEN_SOURCE_LENGTH 8 2402: 2403: typedef struct _TOKEN_SOURCE { 2404: CHAR SourceName[TOKEN_SOURCE_LENGTH]; 2405: LUID SourceIdentifier; 2406: } TOKEN_SOURCE, *PTOKEN_SOURCE; 2407: 2408: 2409: typedef struct _TOKEN_STATISTICS { 2410: LUID TokenId; 2411: LUID AuthenticationId; 2412: LARGE_INTEGER ExpirationTime; 2413: TOKEN_TYPE TokenType; 2414: SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 2415: DWORD DynamicCharged; 2416: DWORD DynamicAvailable; 2417: DWORD GroupCount; 2418: DWORD PrivilegeCount; 2419: LUID ModifiedId; 2420: } TOKEN_STATISTICS, *PTOKEN_STATISTICS; 2421: 2422: 2423: typedef struct _TOKEN_CONTROL { 2424: LUID TokenId; 2425: LUID AuthenticationId; 2426: LUID ModifiedId; 2427: TOKEN_SOURCE TokenSource; 2428: } TOKEN_CONTROL, *PTOKEN_CONTROL; 1.1 root 2429: 2430: 2431: typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION; 2432: 2433: #define OWNER_SECURITY_INFORMATION (0X00000001L) 2434: #define GROUP_SECURITY_INFORMATION (0X00000002L) 2435: #define DACL_SECURITY_INFORMATION (0X00000004L) 2436: #define SACL_SECURITY_INFORMATION (0X00000008L) 2437: 1.1.1.2 root 2438: 2439: // 1.1.1.4 ! root 2440: // Image Format 1.1.1.2 root 2441: // 2442: 1.1.1.4 ! root 2443: #ifndef RC_INVOKED ! 2444: #pragma pack (1) ! 2445: #endif // !RC_INVOKED 1.1.1.2 root 2446: 1.1.1.4 ! root 2447: #define IMAGE_DOS_SIGNATURE 0x5A4D // MZ ! 2448: #define IMAGE_OS2_SIGNATURE 0x454E // NE ! 2449: #define IMAGE_OS2_SIGNATURE_LE 0x454C // LE ! 2450: #define IMAGE_NT_SIGNATURE 0x00004550 // PE00 1.1.1.2 root 2451: 1.1.1.4 ! root 2452: typedef struct _IMAGE_DOS_HEADER { // DOS .EXE header ! 2453: WORD e_magic; // Magic number ! 2454: WORD e_cblp; // Bytes on last page of file ! 2455: WORD e_cp; // Pages in file ! 2456: WORD e_crlc; // Relocations ! 2457: WORD e_cparhdr; // Size of header in paragraphs ! 2458: WORD e_minalloc; // Minimum extra paragraphs needed ! 2459: WORD e_maxalloc; // Maximum extra paragraphs needed ! 2460: WORD e_ss; // Initial (relative) SS value ! 2461: WORD e_sp; // Initial SP value ! 2462: WORD e_csum; // Checksum ! 2463: WORD e_ip; // Initial IP value ! 2464: WORD e_cs; // Initial (relative) CS value ! 2465: WORD e_lfarlc; // File address of relocation table ! 2466: WORD e_ovno; // Overlay number ! 2467: WORD e_res[4]; // Reserved words ! 2468: WORD e_oemid; // OEM identifier (for e_oeminfo) ! 2469: WORD e_oeminfo; // OEM information; e_oemid specific ! 2470: WORD e_res2[10]; // Reserved words ! 2471: LONG e_lfanew; // File address of new exe header ! 2472: } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; 1.1 root 2473: 1.1.1.4 ! root 2474: typedef struct _IMAGE_OS2_HEADER { // OS/2 .EXE header ! 2475: WORD ne_magic; // Magic number ! 2476: CHAR ne_ver; // Version number ! 2477: CHAR ne_rev; // Revision number ! 2478: WORD ne_enttab; // Offset of Entry Table ! 2479: WORD ne_cbenttab; // Number of bytes in Entry Table ! 2480: LONG ne_crc; // Checksum of whole file ! 2481: WORD ne_flags; // Flag word ! 2482: WORD ne_autodata; // Automatic data segment number ! 2483: WORD ne_heap; // Initial heap allocation ! 2484: WORD ne_stack; // Initial stack allocation ! 2485: LONG ne_csip; // Initial CS:IP setting ! 2486: LONG ne_sssp; // Initial SS:SP setting ! 2487: WORD ne_cseg; // Count of file segments ! 2488: WORD ne_cmod; // Entries in Module Reference Table ! 2489: WORD ne_cbnrestab; // Size of non-resident name table ! 2490: WORD ne_segtab; // Offset of Segment Table ! 2491: WORD ne_rsrctab; // Offset of Resource Table ! 2492: WORD ne_restab; // Offset of resident name table ! 2493: WORD ne_modtab; // Offset of Module Reference Table ! 2494: WORD ne_imptab; // Offset of Imported Names Table ! 2495: LONG ne_nrestab; // Offset of Non-resident Names Table ! 2496: WORD ne_cmovent; // Count of movable entries ! 2497: WORD ne_align; // Segment alignment shift count ! 2498: WORD ne_cres; // Count of resource segments ! 2499: BYTE ne_exetyp; // Target Operating system ! 2500: BYTE ne_flagsothers; // Other .EXE flags ! 2501: WORD ne_pretthunks; // offset to return thunks ! 2502: WORD ne_psegrefbytes; // offset to segment ref. bytes ! 2503: WORD ne_swaparea; // Minimum code swap area size ! 2504: WORD ne_expver; // Expected Windows version number ! 2505: } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; 1.1.1.2 root 2506: 2507: // 1.1.1.4 ! root 2508: // File header format. 1.1.1.2 root 2509: // 2510: 1.1.1.4 ! root 2511: typedef struct _IMAGE_FILE_HEADER { ! 2512: WORD Machine; ! 2513: WORD NumberOfSections; ! 2514: DWORD TimeDateStamp; ! 2515: DWORD PointerToSymbolTable; ! 2516: DWORD NumberOfSymbols; ! 2517: WORD SizeOfOptionalHeader; ! 2518: WORD Characteristics; ! 2519: } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; 1.1.1.2 root 2520: 1.1.1.4 ! root 2521: #define IMAGE_SIZEOF_FILE_HEADER 20 1.1.1.2 root 2522: 1.1.1.4 ! root 2523: #define IMAGE_FILE_RELOCS_STRIPPED 0x0001 // Relocation info stripped from file. ! 2524: #define IMAGE_FILE_EXECUTABLE_IMAGE 0x0002 // File is executable (i.e. no unresolved externel references). ! 2525: #define IMAGE_FILE_LINE_NUMS_STRIPPED 0x0004 // Line nunbers stripped from file. ! 2526: #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 0x0008 // Local symbols stripped from file. ! 2527: #define IMAGE_FILE_MINIMAL_OBJECT 0x0010 // Reserved. ! 2528: #define IMAGE_FILE_UPDATE_OBJECT 0x0020 // Reserved. ! 2529: #define IMAGE_FILE_16BIT_MACHINE 0x0040 // 16 bit word machine. ! 2530: #define IMAGE_FILE_BYTES_REVERSED_LO 0x0080 // Bytes of machine word are reversed. ! 2531: #define IMAGE_FILE_32BIT_MACHINE 0x0100 // 32 bit word machine. ! 2532: #define IMAGE_FILE_DEBUG_STRIPPED 0x0200 // Debugging info stripped from file in .DBG file ! 2533: #define IMAGE_FILE_PATCH 0x0400 // Reserved. ! 2534: #define IMAGE_FILE_SYSTEM 0x1000 // System File. ! 2535: #define IMAGE_FILE_DLL 0x2000 // File is a DLL. ! 2536: #define IMAGE_FILE_BYTES_REVERSED_HI 0x8000 // Bytes of machine word are reversed. 1.1.1.2 root 2537: 1.1.1.4 ! root 2538: #define IMAGE_FILE_MACHINE_UNKNOWN 0 ! 2539: #define IMAGE_FILE_MACHINE_I860 0x14d // Intel 860. ! 2540: #define IMAGE_FILE_MACHINE_I386 0x14c // Intel 386. ! 2541: #define IMAGE_FILE_MACHINE_R3000 0x162 // MIPS little-endian, 0540 big-endian ! 2542: #define IMAGE_FILE_MACHINE_R4000 0x166 // MIPS little-endian ! 2543: #define IMAGE_FILE_MACHINE_ALPHA 0x184 // Alpha_AXP 1.1.1.2 root 2544: 2545: // 1.1.1.4 ! root 2546: // Directory format. 1.1.1.2 root 2547: // 2548: 1.1.1.4 ! root 2549: typedef struct _IMAGE_DATA_DIRECTORY { ! 2550: DWORD VirtualAddress; ! 2551: DWORD Size; ! 2552: } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; 1.1.1.2 root 2553: 1.1.1.4 ! root 2554: #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 1.1.1.2 root 2555: 2556: // 1.1.1.4 ! root 2557: // Optional header format. 1.1.1.2 root 2558: // 2559: 1.1.1.4 ! root 2560: typedef struct _IMAGE_OPTIONAL_HEADER { ! 2561: // ! 2562: // Standard fields. ! 2563: // 1.1.1.2 root 2564: 1.1.1.4 ! root 2565: WORD Magic; ! 2566: BYTE MajorLinkerVersion; ! 2567: BYTE MinorLinkerVersion; ! 2568: DWORD SizeOfCode; ! 2569: DWORD SizeOfInitializedData; ! 2570: DWORD SizeOfUninitializedData; ! 2571: DWORD AddressOfEntryPoint; ! 2572: DWORD BaseOfCode; ! 2573: DWORD BaseOfData; 1.1.1.2 root 2574: 1.1.1.4 ! root 2575: // ! 2576: // NT additional fields. ! 2577: // 1.1.1.2 root 2578: 1.1.1.4 ! root 2579: DWORD ImageBase; ! 2580: DWORD SectionAlignment; ! 2581: DWORD FileAlignment; ! 2582: WORD MajorOperatingSystemVersion; ! 2583: WORD MinorOperatingSystemVersion; ! 2584: WORD MajorImageVersion; ! 2585: WORD MinorImageVersion; ! 2586: WORD MajorSubsystemVersion; ! 2587: WORD MinorSubsystemVersion; ! 2588: DWORD Reserved1; ! 2589: DWORD SizeOfImage; ! 2590: DWORD SizeOfHeaders; ! 2591: DWORD CheckSum; ! 2592: WORD Subsystem; ! 2593: WORD DllCharacteristics; ! 2594: DWORD SizeOfStackReserve; ! 2595: DWORD SizeOfStackCommit; ! 2596: DWORD SizeOfHeapReserve; ! 2597: DWORD SizeOfHeapCommit; ! 2598: DWORD LoaderFlags; ! 2599: DWORD NumberOfRvaAndSizes; ! 2600: IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; ! 2601: } IMAGE_OPTIONAL_HEADER, *PIMAGE_OPTIONAL_HEADER; 1.1.1.2 root 2602: 1.1.1.4 ! root 2603: #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 ! 2604: #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 1.1.1.2 root 2605: 1.1.1.4 ! root 2606: typedef struct _IMAGE_NT_HEADERS { ! 2607: DWORD Signature; ! 2608: IMAGE_FILE_HEADER FileHeader; ! 2609: IMAGE_OPTIONAL_HEADER OptionalHeader; ! 2610: } IMAGE_NT_HEADERS, *PIMAGE_NT_HEADERS; 1.1.1.2 root 2611: 1.1.1.4 ! root 2612: #define IMAGE_FIRST_SECTION( ntheader ) ((PIMAGE_SECTION_HEADER) \ ! 2613: ((DWORD)ntheader + \ ! 2614: FIELD_OFFSET( IMAGE_NT_HEADERS, OptionalHeader ) + \ ! 2615: ((PIMAGE_NT_HEADERS)(ntheader))->FileHeader.SizeOfOptionalHeader \ ! 2616: )) 1.1.1.2 root 2617: 2618: 1.1.1.4 ! root 2619: // Subsystem Values 1.1.1.2 root 2620: 1.1.1.4 ! root 2621: #define IMAGE_SUBSYSTEM_UNKNOWN 0 // Unknown subsystem. ! 2622: #define IMAGE_SUBSYSTEM_NATIVE 1 // Image doesn't require a subsystem. ! 2623: #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 // Image runs in the Windows GUI subsystem. ! 2624: #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 // Image runs in the Windows character subsystem. ! 2625: #define IMAGE_SUBSYSTEM_OS2_CUI 5 // image runs in the OS/2 character subsystem. ! 2626: #define IMAGE_SUBSYSTEM_POSIX_CUI 7 // image run in the Posix character subsystem. 1.1.1.2 root 2627: 1.1.1.4 ! root 2628: // Dll Characteristics 1.1.1.2 root 2629: 1.1.1.4 ! root 2630: #define IMAGE_LIBRARY_PROCESS_INIT 1 // Dll has a process initialization routine. ! 2631: #define IMAGE_LIBRARY_PROCESS_TERM 2 // Dll has a thread termination routine. ! 2632: #define IMAGE_LIBRARY_THREAD_INIT 4 // Dll has a thread initialization routine. ! 2633: #define IMAGE_LIBRARY_THREAD_TERM 8 // Dll has a thread termination routine. 1.1.1.2 root 2634: 2635: // 1.1.1.4 ! root 2636: // Loader Flags 1.1.1.2 root 2637: // 2638: 1.1.1.4 ! root 2639: #define IMAGE_LOADER_FLAGS_BREAK_ON_LOAD 0x00000001 ! 2640: #define IMAGE_LOADER_FLAGS_DEBUG_ON_LOAD 0x00000002 1.1.1.2 root 2641: 2642: 1.1.1.4 ! root 2643: // Directory Entries ! 2644: ! 2645: #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 // Export Directory ! 2646: #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 // Import Directory ! 2647: #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 // Resource Directory ! 2648: #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 // Exception Directory ! 2649: #define IMAGE_DIRECTORY_ENTRY_SECURITY 4 // Security Directory ! 2650: #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 // Base Relocation Table ! 2651: #define IMAGE_DIRECTORY_ENTRY_DEBUG 6 // Debug Directory ! 2652: #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 // Description String ! 2653: #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 // Machine Value (MIPS GP) ! 2654: #define IMAGE_DIRECTORY_ENTRY_TLS 9 // TLS Directory ! 2655: #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 // Load Configuration Directory 1.1.1.2 root 2656: 2657: // 1.1.1.4 ! root 2658: // Section header format. 1.1.1.2 root 2659: // 2660: 1.1.1.4 ! root 2661: #define IMAGE_SIZEOF_SHORT_NAME 8 1.1.1.2 root 2662: 1.1.1.4 ! root 2663: typedef struct _IMAGE_SECTION_HEADER { ! 2664: BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; ! 2665: union { ! 2666: DWORD PhysicalAddress; ! 2667: DWORD VirtualSize; ! 2668: } Misc; ! 2669: DWORD VirtualAddress; ! 2670: DWORD SizeOfRawData; ! 2671: DWORD PointerToRawData; ! 2672: DWORD PointerToRelocations; ! 2673: DWORD PointerToLinenumbers; ! 2674: WORD NumberOfRelocations; ! 2675: WORD NumberOfLinenumbers; ! 2676: DWORD Characteristics; ! 2677: } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; 1.1.1.2 root 2678: 1.1.1.4 ! root 2679: #define IMAGE_SIZEOF_SECTION_HEADER 40 1.1.1.2 root 2680: 1.1.1.4 ! root 2681: #define IMAGE_SCN_TYPE_REGULAR 0x00000000 // ! 2682: #define IMAGE_SCN_TYPE_DUMMY 0x00000001 // Reserved. ! 2683: #define IMAGE_SCN_TYPE_NO_LOAD 0x00000002 // Reserved. ! 2684: #define IMAGE_SCN_TYPE_GROUPED 0x00000004 // Used for 16-bit offset code. ! 2685: #define IMAGE_SCN_TYPE_NO_PAD 0x00000008 // Reserved. ! 2686: #define IMAGE_SCN_TYPE_COPY 0x00000010 // Reserved. 1.1.1.2 root 2687: 1.1.1.4 ! root 2688: #define IMAGE_SCN_CNT_CODE 0x00000020 // Section contains code. ! 2689: #define IMAGE_SCN_CNT_INITIALIZED_DATA 0x00000040 // Section contains initialized data. ! 2690: #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 0x00000080 // Section contains uninitialized data. 1.1.1.2 root 2691: 1.1.1.4 ! root 2692: #define IMAGE_SCN_LNK_OTHER 0x00000100 // Reserved. ! 2693: #define IMAGE_SCN_LNK_INFO 0x00000200 // Section contains comments or some other type of information. ! 2694: #define IMAGE_SCN_LNK_OVERLAY 0x00000400 // Section contains an overlay. ! 2695: #define IMAGE_SCN_LNK_REMOVE 0x00000800 // Section contents will not become part of image. ! 2696: #define IMAGE_SCN_LNK_COMDAT 0x00001000 // Section contents comdat. 1.1.1.2 root 2697: 1.1.1.4 ! root 2698: #define IMAGE_SCN_ALIGN_1BYTES 0x00100000 // ! 2699: #define IMAGE_SCN_ALIGN_2BYTES 0x00200000 // ! 2700: #define IMAGE_SCN_ALIGN_4BYTES 0x00300000 // ! 2701: #define IMAGE_SCN_ALIGN_8BYTES 0x00400000 // ! 2702: #define IMAGE_SCN_ALIGN_16BYTES 0x00500000 // Default alignment if no others are specified. ! 2703: #define IMAGE_SCN_ALIGN_32BYTES 0x00600000 // ! 2704: #define IMAGE_SCN_ALIGN_64BYTES 0x00700000 // ! 2705: ! 2706: #define IMAGE_SCN_MEM_DISCARDABLE 0x02000000 // Section can be discarded. ! 2707: #define IMAGE_SCN_MEM_NOT_CACHED 0x04000000 // Section is not cachable. ! 2708: #define IMAGE_SCN_MEM_NOT_PAGED 0x08000000 // Section is not pageable. ! 2709: #define IMAGE_SCN_MEM_SHARED 0x10000000 // Section is shareable. ! 2710: #define IMAGE_SCN_MEM_EXECUTE 0x20000000 // Section is executable. ! 2711: #define IMAGE_SCN_MEM_READ 0x40000000 // Section is readable. ! 2712: #define IMAGE_SCN_MEM_WRITE 0x80000000 // Section is writeable. 1.1.1.2 root 2713: 2714: // 1.1.1.4 ! root 2715: // Symbol format. 1.1.1.2 root 2716: // 2717: 1.1.1.4 ! root 2718: typedef struct _IMAGE_SYMBOL { ! 2719: union { ! 2720: BYTE ShortName[8]; ! 2721: struct { ! 2722: DWORD Short; // if 0, use LongName ! 2723: DWORD Long; // offset into string table ! 2724: } Name; ! 2725: PBYTE LongName[2]; ! 2726: } N; ! 2727: DWORD Value; ! 2728: SHORT SectionNumber; ! 2729: WORD Type; ! 2730: BYTE StorageClass; ! 2731: BYTE NumberOfAuxSymbols; ! 2732: } IMAGE_SYMBOL; ! 2733: typedef IMAGE_SYMBOL UNALIGNED *PIMAGE_SYMBOL; 1.1.1.2 root 2734: 1.1.1.4 ! root 2735: #define IMAGE_SIZEOF_SYMBOL 18 1.1.1.2 root 2736: 2737: // 1.1.1.4 ! root 2738: // Section values. ! 2739: // ! 2740: // Symbols have a section number of the section in which they are ! 2741: // defined. Otherwise, section numbers have the following meanings: 1.1.1.2 root 2742: // 2743: 1.1.1.4 ! root 2744: #define IMAGE_SYM_UNDEFINED (SHORT)0 // Symbol is undefined or is common. ! 2745: #define IMAGE_SYM_ABSOLUTE (SHORT)-1 // Symbol is an absolute value. ! 2746: #define IMAGE_SYM_DEBUG (SHORT)-2 // Symbol is a special debug item. 1.1.1.2 root 2747: 2748: // 1.1.1.4 ! root 2749: // Type (fundamental) values. 1.1.1.2 root 2750: // 2751: 1.1.1.4 ! root 2752: #define IMAGE_SYM_TYPE_NULL 0 // no type. ! 2753: #define IMAGE_SYM_TYPE_VOID 1 // ! 2754: #define IMAGE_SYM_TYPE_CHAR 2 // type character. ! 2755: #define IMAGE_SYM_TYPE_SHORT 3 // type short integer. ! 2756: #define IMAGE_SYM_TYPE_INT 4 // ! 2757: #define IMAGE_SYM_TYPE_LONG 5 // ! 2758: #define IMAGE_SYM_TYPE_FLOAT 6 // ! 2759: #define IMAGE_SYM_TYPE_DOUBLE 7 // ! 2760: #define IMAGE_SYM_TYPE_STRUCT 8 // ! 2761: #define IMAGE_SYM_TYPE_UNION 9 // ! 2762: #define IMAGE_SYM_TYPE_ENUM 10 // enumeration. ! 2763: #define IMAGE_SYM_TYPE_MOE 11 // member of enumeration. ! 2764: #define IMAGE_SYM_TYPE_BYTE 12 // ! 2765: #define IMAGE_SYM_TYPE_WORD 13 // ! 2766: #define IMAGE_SYM_TYPE_UINT 14 // ! 2767: #define IMAGE_SYM_TYPE_DWORD 15 // 1.1.1.3 root 2768: 2769: // 1.1.1.4 ! root 2770: // Type (derived) values. 1.1.1.3 root 2771: // 2772: 1.1.1.4 ! root 2773: #define IMAGE_SYM_DTYPE_NULL 0 // no derived type. ! 2774: #define IMAGE_SYM_DTYPE_POINTER 1 // pointer. ! 2775: #define IMAGE_SYM_DTYPE_FUNCTION 2 // function. ! 2776: #define IMAGE_SYM_DTYPE_ARRAY 3 // array. 1.1.1.3 root 2777: 2778: // 1.1.1.4 ! root 2779: // Storage classes. 1.1.1.3 root 2780: // 1.1.1.2 root 2781: 1.1.1.4 ! root 2782: #define IMAGE_SYM_CLASS_END_OF_FUNCTION (BYTE )-1 ! 2783: #define IMAGE_SYM_CLASS_NULL 0 ! 2784: #define IMAGE_SYM_CLASS_AUTOMATIC 1 ! 2785: #define IMAGE_SYM_CLASS_EXTERNAL 2 ! 2786: #define IMAGE_SYM_CLASS_STATIC 3 ! 2787: #define IMAGE_SYM_CLASS_REGISTER 4 ! 2788: #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 ! 2789: #define IMAGE_SYM_CLASS_LABEL 6 ! 2790: #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 ! 2791: #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 ! 2792: #define IMAGE_SYM_CLASS_ARGUMENT 9 ! 2793: #define IMAGE_SYM_CLASS_STRUCT_TAG 10 ! 2794: #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 ! 2795: #define IMAGE_SYM_CLASS_UNION_TAG 12 ! 2796: #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 ! 2797: #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 ! 2798: #define IMAGE_SYM_CLASS_ENUM_TAG 15 ! 2799: #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 ! 2800: #define IMAGE_SYM_CLASS_REGISTER_PARAM 17 ! 2801: #define IMAGE_SYM_CLASS_BIT_FIELD 18 ! 2802: #define IMAGE_SYM_CLASS_BLOCK 100 ! 2803: #define IMAGE_SYM_CLASS_FUNCTION 101 ! 2804: #define IMAGE_SYM_CLASS_END_OF_STRUCT 102 ! 2805: #define IMAGE_SYM_CLASS_FILE 103 ! 2806: // new ! 2807: #define IMAGE_SYM_CLASS_SECTION 104 ! 2808: #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 ! 2809: ! 2810: // type packing constants ! 2811: ! 2812: #define N_BTMASK 017 ! 2813: #define N_TMASK 060 ! 2814: #define N_TMASK1 0300 ! 2815: #define N_TMASK2 0360 ! 2816: #define N_BTSHFT 4 ! 2817: #define N_TSHIFT 2 ! 2818: ! 2819: // MACROS ! 2820: ! 2821: // Basic Type of x ! 2822: #define BTYPE(x) ((x) & N_BTMASK) ! 2823: ! 2824: // Is x a pointer? ! 2825: #ifndef ISPTR ! 2826: #define ISPTR(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT)) ! 2827: #endif ! 2828: ! 2829: // Is x a function? ! 2830: #ifndef ISFCN ! 2831: #define ISFCN(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT)) ! 2832: #endif ! 2833: ! 2834: // Is x an array? ! 2835: ! 2836: #ifndef ISARY ! 2837: #define ISARY(x) (((x) & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT)) ! 2838: #endif ! 2839: ! 2840: // Is x a structure, union, or enumeration TAG? ! 2841: #ifndef ISTAG ! 2842: #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG || (x)==IMAGE_SYM_CLASS_UNION_TAG || (x)==IMAGE_SYM_CLASS_ENUM_TAG) ! 2843: #endif ! 2844: ! 2845: #ifndef INCREF ! 2846: #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK)) ! 2847: #endif ! 2848: #ifndef DECREF ! 2849: #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) ! 2850: #endif ! 2851: 1.1.1.2 root 2852: // 1.1.1.4 ! root 2853: // Auxiliary entry format. 1.1.1.3 root 2854: // 2855: 1.1.1.4 ! root 2856: typedef union _IMAGE_AUX_SYMBOL { ! 2857: struct { ! 2858: DWORD TagIndex; // struct, union, or enum tag index ! 2859: union { ! 2860: struct { ! 2861: WORD Linenumber; // declaration line number ! 2862: WORD Size; // size of struct, union, or enum ! 2863: } LnSz; ! 2864: DWORD TotalSize; ! 2865: } Misc; ! 2866: union { ! 2867: struct { // if ISFCN, tag, or .bb ! 2868: DWORD PointerToLinenumber; ! 2869: DWORD PointerToNextFunction; ! 2870: } Function; ! 2871: struct { // if ISARY, up to 4 dimen. ! 2872: WORD Dimension[4]; ! 2873: } Array; ! 2874: } FcnAry; ! 2875: WORD TvIndex; // tv index ! 2876: } Sym; ! 2877: struct { ! 2878: BYTE Name[IMAGE_SIZEOF_SYMBOL]; ! 2879: } File; ! 2880: struct { ! 2881: DWORD Length; // section length ! 2882: WORD NumberOfRelocations; // number of relocation entries ! 2883: WORD NumberOfLinenumbers; // number of line numbers ! 2884: DWORD CheckSum; // checksum for communal ! 2885: SHORT Number; // section number to associate with ! 2886: BYTE Selection; // communal selection type ! 2887: } Section; ! 2888: } IMAGE_AUX_SYMBOL; ! 2889: typedef IMAGE_AUX_SYMBOL UNALIGNED *PIMAGE_AUX_SYMBOL; 1.1.1.3 root 2890: 1.1.1.4 ! root 2891: #define IMAGE_SIZEOF_AUX_SYMBOL 18 1.1.1.3 root 2892: 1.1.1.4 ! root 2893: // ! 2894: // Communal selection types. ! 2895: // 1.1.1.3 root 2896: 1.1.1.4 ! root 2897: #define IMAGE_COMDAT_SELECT_UNKNOWN 0 ! 2898: #define IMAGE_COMDAT_SELECT_NODUPLICATES 1 ! 2899: #define IMAGE_COMDAT_SELECT_ANY 2 ! 2900: #define IMAGE_COMDAT_SELECT_SAME_SIZE 3 ! 2901: #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 ! 2902: #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 ! 2903: ! 2904: #define IMAGE_WEAK_EXTERN_SEARCH_UNKNOWN 0 ! 2905: #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 ! 2906: #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 1.1.1.3 root 2907: 2908: 2909: // 1.1.1.4 ! root 2910: // Relocation format. 1.1.1.3 root 2911: // 2912: 1.1.1.4 ! root 2913: typedef struct _IMAGE_RELOCATION { ! 2914: DWORD VirtualAddress; ! 2915: DWORD SymbolTableIndex; ! 2916: WORD Type; ! 2917: } IMAGE_RELOCATION; ! 2918: typedef IMAGE_RELOCATION UNALIGNED *PIMAGE_RELOCATION; 1.1.1.3 root 2919: 1.1.1.4 ! root 2920: #define IMAGE_SIZEOF_RELOCATION 10 1.1.1.3 root 2921: 2922: // 1.1.1.4 ! root 2923: // I860 relocation types. 1.1.1.3 root 2924: // 2925: 1.1.1.4 ! root 2926: #define IMAGE_REL_I860_ABSOLUTE 0 // Reference is absolute, no relocation is necessary ! 2927: #define IMAGE_REL_I860_DIR32 06 // Direct 32-bit reference to the symbols virtual address ! 2928: #define IMAGE_REL_I860_DIR32NB 07 ! 2929: #define IMAGE_REL_I860_SECTION 012 ! 2930: #define IMAGE_REL_I860_SECREL 013 ! 2931: #define IMAGE_REL_I860_PAIR 034 ! 2932: #define IMAGE_REL_I860_HIGH 036 ! 2933: #define IMAGE_REL_I860_LOW0 037 ! 2934: #define IMAGE_REL_I860_LOW1 040 ! 2935: #define IMAGE_REL_I860_LOW2 041 ! 2936: #define IMAGE_REL_I860_LOW3 042 ! 2937: #define IMAGE_REL_I860_LOW4 043 ! 2938: #define IMAGE_REL_I860_SPLIT0 044 ! 2939: #define IMAGE_REL_I860_SPLIT1 045 ! 2940: #define IMAGE_REL_I860_SPLIT2 046 ! 2941: #define IMAGE_REL_I860_HIGHADJ 047 ! 2942: #define IMAGE_REL_I860_BRADDR 050 1.1.1.3 root 2943: 2944: // 1.1.1.4 ! root 2945: // I386 relocation types. 1.1.1.2 root 2946: // 2947: 1.1.1.4 ! root 2948: #define IMAGE_REL_I386_ABSOLUTE 0 // Reference is absolute, no relocation is necessary ! 2949: #define IMAGE_REL_I386_DIR16 01 // Direct 16-bit reference to the symbols virtual address ! 2950: #define IMAGE_REL_I386_REL16 02 // PC-relative 16-bit reference to the symbols virtual address ! 2951: #define IMAGE_REL_I386_DIR32 06 // Direct 32-bit reference to the symbols virtual address ! 2952: #define IMAGE_REL_I386_DIR32NB 07 // Direct 32-bit reference to the symbols virtual address, base not included ! 2953: #define IMAGE_REL_I386_SEG12 011 // Direct 16-bit reference to the segment-selector bits of a 32-bit virtual address ! 2954: #define IMAGE_REL_I386_SECTION 012 ! 2955: #define IMAGE_REL_I386_SECREL 013 ! 2956: #define IMAGE_REL_I386_REL32 024 // PC-relative 32-bit reference to the symbols virtual address 1.1.1.2 root 2957: 2958: // 1.1.1.4 ! root 2959: // MIPS relocation types. 1.1.1.2 root 2960: // 2961: 1.1.1.4 ! root 2962: #define IMAGE_REL_MIPS_ABSOLUTE 0 // Reference is absolute, no relocation is necessary ! 2963: #define IMAGE_REL_MIPS_REFHALF 01 ! 2964: #define IMAGE_REL_MIPS_REFWORD 02 ! 2965: #define IMAGE_REL_MIPS_JMPADDR 03 ! 2966: #define IMAGE_REL_MIPS_REFHI 04 ! 2967: #define IMAGE_REL_MIPS_REFLO 05 ! 2968: #define IMAGE_REL_MIPS_GPREL 06 ! 2969: #define IMAGE_REL_MIPS_LITERAL 07 ! 2970: #define IMAGE_REL_MIPS_SECTION 012 ! 2971: #define IMAGE_REL_MIPS_SECREL 013 ! 2972: #define IMAGE_REL_MIPS_REFWORDNB 042 ! 2973: #define IMAGE_REL_MIPS_PAIR 045 1.1.1.2 root 2974: 1.1.1.3 root 2975: // 1.1.1.4 ! root 2976: // Alpha Relocation types. 1.1.1.3 root 2977: // 2978: 1.1.1.4 ! root 2979: #define IMAGE_REL_ALPHA_ABSOLUTE 0x0 ! 2980: #define IMAGE_REL_ALPHA_REFLONG 0x1 ! 2981: #define IMAGE_REL_ALPHA_REFQUAD 0x2 ! 2982: #define IMAGE_REL_ALPHA_GPREL32 0x3 ! 2983: #define IMAGE_REL_ALPHA_LITERAL 0x4 ! 2984: #define IMAGE_REL_ALPHA_LITUSE 0x5 ! 2985: #define IMAGE_REL_ALPHA_GPDISP 0x6 ! 2986: #define IMAGE_REL_ALPHA_BRADDR 0x7 ! 2987: #define IMAGE_REL_ALPHA_HINT 0x8 ! 2988: #define IMAGE_REL_ALPHA_INLINE_REFLONG 0x9 ! 2989: #define IMAGE_REL_ALPHA_REFHI 0xA ! 2990: #define IMAGE_REL_ALPHA_REFLO 0xB ! 2991: #define IMAGE_REL_ALPHA_PAIR 0xC ! 2992: #define IMAGE_REL_ALPHA_MATCH 0xD ! 2993: #define IMAGE_REL_ALPHA_SECTION 0xE ! 2994: #define IMAGE_REL_ALPHA_SECREL 0xF ! 2995: #define IMAGE_REL_ALPHA_REFLONGNB 0x10 1.1.1.3 root 2996: 1.1.1.4 ! root 2997: // ! 2998: // Based relocation format. ! 2999: // 1.1.1.3 root 3000: 1.1.1.4 ! root 3001: typedef struct _IMAGE_BASE_RELOCATION { ! 3002: DWORD VirtualAddress; ! 3003: DWORD SizeOfBlock; ! 3004: // WORD TypeOffset[1]; ! 3005: } IMAGE_BASE_RELOCATION, *PIMAGE_BASE_RELOCATION; 1.1.1.3 root 3006: 1.1.1.4 ! root 3007: #define IMAGE_SIZEOF_BASE_RELOCATION 8 1.1.1.2 root 3008: 3009: // 1.1.1.4 ! root 3010: // Based relocation types. 1.1.1.2 root 3011: // 3012: 1.1.1.4 ! root 3013: #define IMAGE_REL_BASED_ABSOLUTE 0 ! 3014: #define IMAGE_REL_BASED_HIGH 1 ! 3015: #define IMAGE_REL_BASED_LOW 2 ! 3016: #define IMAGE_REL_BASED_HIGHLOW 3 ! 3017: #define IMAGE_REL_BASED_HIGHADJ 4 ! 3018: #define IMAGE_REL_BASED_MIPS_JMPADDR 5 ! 3019: #define IMAGE_REL_BASED_I860_BRADDR 6 ! 3020: #define IMAGE_REL_BASED_I860_SPLIT 7 1.1.1.3 root 3021: 1.1.1.4 ! root 3022: // ! 3023: // Line number format. ! 3024: // 1.1.1.3 root 3025: 1.1.1.4 ! root 3026: typedef struct _IMAGE_LINENUMBER { ! 3027: union { ! 3028: DWORD SymbolTableIndex; // Symbol table index of function name if Linenumber is 0. ! 3029: DWORD VirtualAddress; // Virtual address of line number. ! 3030: } Type; ! 3031: WORD Linenumber; // Line number. ! 3032: } IMAGE_LINENUMBER; ! 3033: typedef IMAGE_LINENUMBER UNALIGNED *PIMAGE_LINENUMBER; 1.1.1.3 root 3034: 1.1.1.4 ! root 3035: #define IMAGE_SIZEOF_LINENUMBER 6 1.1.1.3 root 3036: 3037: // 1.1.1.4 ! root 3038: // Archive format. 1.1.1.3 root 3039: // 3040: 1.1.1.4 ! root 3041: #define IMAGE_ARCHIVE_START_SIZE 8 ! 3042: #define IMAGE_ARCHIVE_START "!<arch>\n" ! 3043: #define IMAGE_ARCHIVE_END "`\n" ! 3044: #define IMAGE_ARCHIVE_PAD "\n" ! 3045: #define IMAGE_ARCHIVE_LINKER_MEMBER "/ " ! 3046: #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " ! 3047: ! 3048: typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { ! 3049: BYTE Name[16]; // File member name - `/' terminated. ! 3050: BYTE Date[12]; // File member date - decimal. ! 3051: BYTE UserID[6]; // File member user id - decimal. ! 3052: BYTE GroupID[6]; // File member group id - decimal. ! 3053: BYTE Mode[8]; // File member mode - octal. ! 3054: BYTE Size[10]; // File member size - decimal. ! 3055: BYTE EndHeader[2]; // String to end header. ! 3056: } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; ! 3057: ! 3058: #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 ! 3059: ! 3060: // ! 3061: // DLL support. ! 3062: // ! 3063: ! 3064: // ! 3065: // Export Format ! 3066: // ! 3067: ! 3068: typedef struct _IMAGE_EXPORT_DIRECTORY { ! 3069: DWORD Characteristics; 1.1.1.3 root 3070: DWORD TimeDateStamp; 1.1.1.4 ! root 3071: WORD MajorVersion; ! 3072: WORD MinorVersion; ! 3073: DWORD Name; ! 3074: DWORD Base; ! 3075: DWORD NumberOfFunctions; ! 3076: DWORD NumberOfNames; ! 3077: PDWORD *AddressOfFunctions; ! 3078: PDWORD *AddressOfNames; ! 3079: PWORD *AddressOfNameOrdinals; ! 3080: } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; 1.1.1.3 root 3081: 1.1.1.4 ! root 3082: // ! 3083: // Import Format ! 3084: // 1.1.1.3 root 3085: 1.1.1.4 ! root 3086: typedef struct _IMAGE_IMPORT_BY_NAME { ! 3087: WORD Hint; ! 3088: BYTE Name[1]; ! 3089: } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; 1.1.1.3 root 3090: 1.1.1.4 ! root 3091: typedef struct _IMAGE_THUNK_DATA { ! 3092: union { ! 3093: PDWORD Function; ! 3094: DWORD Ordinal; ! 3095: PIMAGE_IMPORT_BY_NAME AddressOfData; ! 3096: } u1; ! 3097: } IMAGE_THUNK_DATA, *PIMAGE_THUNK_DATA; ! 3098: ! 3099: #define IMAGE_ORDINAL_FLAG 0x80000000 ! 3100: #define IMAGE_SNAP_BY_ORDINAL(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG) != 0) ! 3101: #define IMAGE_ORDINAL(Ordinal) (Ordinal & 0xffff) ! 3102: ! 3103: typedef struct _IMAGE_IMPORT_DESCRIPTOR { ! 3104: DWORD Characteristics; ! 3105: DWORD TimeDateStamp; ! 3106: DWORD ForwarderChain; ! 3107: DWORD Name; ! 3108: PIMAGE_THUNK_DATA FirstThunk; ! 3109: } IMAGE_IMPORT_DESCRIPTOR, *PIMAGE_IMPORT_DESCRIPTOR; 1.1.1.3 root 3110: 3111: // 1.1.1.4 ! root 3112: // Thread Local Storage 1.1.1.3 root 3113: // 3114: 1.1.1.4 ! root 3115: typedef VOID ! 3116: (NTAPI *PIMAGE_TLS_CALLBACK) ( ! 3117: PVOID DllHandle, ! 3118: DWORD Reason, ! 3119: PVOID Reserved ! 3120: ); ! 3121: ! 3122: typedef struct _IMAGE_TLS_DIRECTORY { ! 3123: DWORD StartAddressOfRawData; ! 3124: DWORD EndAddressOfRawData; ! 3125: PDWORD AddressOfIndex; ! 3126: PIMAGE_TLS_CALLBACK *AddressOfCallBacks; ! 3127: DWORD SizeOfZeroFill; ! 3128: DWORD Characteristics; ! 3129: } IMAGE_TLS_DIRECTORY, *PIMAGE_TLS_DIRECTORY; 1.1.1.3 root 3130: 3131: 3132: // 1.1.1.4 ! root 3133: // Resource Format. 1.1.1.3 root 3134: // 3135: 1.1.1.4 ! root 3136: // ! 3137: // Resource directory consists of two counts, following by a variable length ! 3138: // array of directory entries. The first count is the number of entries at ! 3139: // beginning of the array that have actual names associated with each entry. ! 3140: // The entries are in ascending order, case insensitive strings. The second ! 3141: // count is the number of entries that immediately follow the named entries. ! 3142: // This second count identifies the number of entries that have 31-bit integer ! 3143: // Ids as their name. These entries are also sorted in ascending order. ! 3144: // ! 3145: // This structure allows fast lookup by either name or number, but for any ! 3146: // given resource entry only one form of lookup is supported, not both. ! 3147: // This is consistant with the syntax of the .RC file and the .RES file. ! 3148: // 1.1.1.3 root 3149: 1.1.1.4 ! root 3150: typedef struct _IMAGE_RESOURCE_DIRECTORY { ! 3151: DWORD Characteristics; ! 3152: DWORD TimeDateStamp; ! 3153: WORD MajorVersion; ! 3154: WORD MinorVersion; ! 3155: WORD NumberOfNamedEntries; ! 3156: WORD NumberOfIdEntries; ! 3157: // IMAGE_RESOURCE_DIRECTORY_ENTRY DirectoryEntries[]; ! 3158: } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY; 1.1.1.3 root 3159: 1.1.1.4 ! root 3160: #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 ! 3161: #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 1.1.1.3 root 3162: 1.1.1.4 ! root 3163: // ! 3164: // Each directory contains the 32-bit Name of the entry and an offset, ! 3165: // relative to the beginning of the resource directory of the data associated ! 3166: // with this directory entry. If the name of the entry is an actual text ! 3167: // string instead of an integer Id, then the high order bit of the name field ! 3168: // is set to one and the low order 31-bits are an offset, relative to the ! 3169: // beginning of the resource directory of the string, which is of type ! 3170: // IMAGE_RESOURCE_DIRECTORY_STRING. Otherwise the high bit is clear and the ! 3171: // low-order 31-bits are the integer Id that identify this resource directory ! 3172: // entry. If the directory entry is yet another resource directory (i.e. a ! 3173: // subdirectory), then the high order bit of the offset field will be ! 3174: // set to indicate this. Otherwise the high bit is clear and the offset ! 3175: // field points to a resource data entry. ! 3176: // 1.1.1.3 root 3177: 1.1.1.4 ! root 3178: typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { ! 3179: DWORD Name; ! 3180: DWORD OffsetToData; ! 3181: } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY; 1.1.1.3 root 3182: 1.1.1.4 ! root 3183: // ! 3184: // For resource directory entries that have actual string names, the Name ! 3185: // field of the directory entry points to an object of the following type. ! 3186: // All of these string objects are stored together after the last resource ! 3187: // directory entry and before the first resource data object. This minimizes ! 3188: // the impact of these variable length objects on the alignment of the fixed ! 3189: // size directory entry objects. ! 3190: // 1.1.1.3 root 3191: 1.1.1.4 ! root 3192: typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { ! 3193: WORD Length; ! 3194: CHAR NameString[ 1 ]; ! 3195: } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING; ! 3196: ! 3197: ! 3198: typedef struct _IMAGE_RESOURCE_DIR_STRING_U { ! 3199: WORD Length; ! 3200: WCHAR NameString[ 1 ]; ! 3201: } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U; 1.1.1.3 root 3202: 3203: 1.1.1.4 ! root 3204: // ! 3205: // Each resource data entry describes a leaf node in the resource directory ! 3206: // tree. It contains an offset, relative to the beginning of the resource ! 3207: // directory of the data for the resource, a size field that gives the number ! 3208: // of bytes of data at that offset, a CodePage that should be used when ! 3209: // decoding code point values within the resource data. Typically for new ! 3210: // applications the code page would be the unicode code page. ! 3211: // ! 3212: ! 3213: typedef struct _IMAGE_RESOURCE_DATA_ENTRY { ! 3214: DWORD OffsetToData; ! 3215: DWORD Size; ! 3216: DWORD CodePage; ! 3217: DWORD Reserved; ! 3218: } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY; ! 3219: ! 3220: // ! 3221: // Load Configuration Directory Entry ! 3222: // ! 3223: ! 3224: typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY { ! 3225: DWORD Characteristics; ! 3226: DWORD TimeDateStamp; ! 3227: WORD MajorVersion; ! 3228: WORD MinorVersion; ! 3229: DWORD GlobalFlagsClear; ! 3230: DWORD GlobalFlagsSet; ! 3231: DWORD CriticalSectionDefaultTimeout; ! 3232: DWORD DeCommitFreeBlockThreshold; ! 3233: DWORD DeCommitTotalFreeThreshold; ! 3234: DWORD Reserved[ 8 ]; ! 3235: } IMAGE_LOAD_CONFIG_DIRECTORY, *PIMAGE_LOAD_CONFIG_DIRECTORY; ! 3236: ! 3237: ! 3238: // ! 3239: // Function table entry format for MIPS/ALPHA images. Function table is ! 3240: // pointed to by the IMAGE_DIRECTORY_ENTRY_EXCEPTION directory entry. ! 3241: // This definition duplicates ones in ntmips.h and ntalpha.h for use ! 3242: // by portable image file mungers. ! 3243: // ! 3244: ! 3245: typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { ! 3246: DWORD BeginAddress; ! 3247: DWORD EndAddress; ! 3248: PVOID ExceptionHandler; ! 3249: PVOID HandlerData; ! 3250: DWORD PrologEndAddress; ! 3251: } IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY; ! 3252: ! 3253: // ! 3254: // Debug Format ! 3255: // ! 3256: ! 3257: typedef struct _IMAGE_DEBUG_DIRECTORY { ! 3258: DWORD Characteristics; ! 3259: DWORD TimeDateStamp; ! 3260: WORD MajorVersion; ! 3261: WORD MinorVersion; ! 3262: DWORD Type; ! 3263: DWORD SizeOfData; ! 3264: DWORD AddressOfRawData; ! 3265: DWORD PointerToRawData; ! 3266: } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; ! 3267: ! 3268: #define IMAGE_DEBUG_TYPE_UNKNOWN 0 ! 3269: #define IMAGE_DEBUG_TYPE_COFF 1 ! 3270: #define IMAGE_DEBUG_TYPE_CODEVIEW 2 ! 3271: #define IMAGE_DEBUG_TYPE_FPO 3 ! 3272: #define IMAGE_DEBUG_TYPE_MISC 4 ! 3273: #define IMAGE_DEBUG_TYPE_EXCEPTION 5 ! 3274: #define IMAGE_DEBUG_TYPE_FIXUP 6 ! 3275: #define IMAGE_DEBUG_TYPE_RESERVED6 7 ! 3276: #define IMAGE_DEBUG_TYPE_RESERVED7 8 1.1.1.3 root 3277: 1.1.1.4 ! root 3278: typedef struct _IMAGE_COFF_SYMBOLS_HEADER { ! 3279: DWORD NumberOfSymbols; ! 3280: DWORD LvaToFirstSymbol; ! 3281: DWORD NumberOfLinenumbers; ! 3282: DWORD LvaToFirstLinenumber; ! 3283: DWORD RvaToFirstByteOfCode; ! 3284: DWORD RvaToLastByteOfCode; ! 3285: DWORD RvaToFirstByteOfData; ! 3286: DWORD RvaToLastByteOfData; ! 3287: } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; 1.1.1.3 root 3288: 1.1.1.4 ! root 3289: #define FRAME_FPO 0 ! 3290: #define FRAME_TRAP 1 ! 3291: #define FRAME_TSS 2 ! 3292: ! 3293: typedef struct _FPO_DATA { ! 3294: DWORD ulOffStart; // offset 1st byte of function code ! 3295: DWORD cbProcSize; // # bytes in function ! 3296: DWORD cdwLocals; // # bytes in locals/4 ! 3297: WORD cdwParams; // # bytes in params/4 ! 3298: WORD cbProlog : 8; // # bytes in prolog ! 3299: WORD cbRegs : 3; // # regs saved ! 3300: WORD fHasSEH : 1; // TRUE if SEH in func ! 3301: WORD fUseBP : 1; // TRUE if EBP has been allocated ! 3302: WORD reserved : 1; // reserved for future use ! 3303: WORD cbFrame : 2; // frame type ! 3304: } FPO_DATA, *PFPO_DATA; ! 3305: #define SIZEOF_RFPO_DATA 16 ! 3306: ! 3307: ! 3308: #define IMAGE_DEBUG_MISC_EXENAME 1 ! 3309: ! 3310: typedef struct _IMAGE_DEBUG_MISC { ! 3311: DWORD DataType; // type of misc data, see defines ! 3312: DWORD Length; // total length of record, rounded to four ! 3313: // byte multiple. ! 3314: BOOLEAN Unicode; // TRUE if data is unicode string ! 3315: BYTE Reserved[ 3 ]; ! 3316: BYTE Data[ 1 ]; // Actual data ! 3317: } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC; ! 3318: ! 3319: ! 3320: // ! 3321: // Debugging information can be stripped from an image file and placed ! 3322: // in a separate .DBG file, whose file name part is the same as the ! 3323: // image file name part (e.g. symbols for CMD.EXE could be stripped ! 3324: // and placed in CMD.DBG). This is indicated by the IMAGE_FILE_DEBUG_STRIPPED ! 3325: // flag in the Characteristics field of the file header. The beginning of ! 3326: // the .DBG file contains the following structure which captures certain ! 3327: // information from the image file. This allows a debug to proceed even if ! 3328: // the original image file is not accessable. This header is followed by ! 3329: // zero of more IMAGE_SECTION_HEADER structures, followed by zero or more ! 3330: // IMAGE_DEBUG_DIRECTORY structures. The latter structures and those in ! 3331: // the image file contain file offsets relative to the beginning of the ! 3332: // .DBG file. ! 3333: // ! 3334: // If symbols have been stripped from an image, the IMAGE_DEBUG_MISC structure ! 3335: // is left in the image file, but not mapped. This allows a debugger to ! 3336: // compute the name of the .DBG file, from the name of the image in the ! 3337: // IMAGE_DEBUG_MISC structure. ! 3338: // ! 3339: ! 3340: typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { ! 3341: WORD Signature; ! 3342: WORD Flags; ! 3343: WORD Machine; ! 3344: WORD Characteristics; ! 3345: DWORD TimeDateStamp; ! 3346: DWORD CheckSum; ! 3347: DWORD ImageBase; ! 3348: DWORD SizeOfImage; ! 3349: DWORD NumberOfSections; ! 3350: DWORD ExportedNamesSize; ! 3351: DWORD DebugDirectorySize; ! 3352: DWORD Reserved[ 3 ]; ! 3353: } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER; 1.1.1.3 root 3354: 1.1.1.4 ! root 3355: #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 1.1.1.3 root 3356: 1.1.1.4 ! root 3357: #ifndef RC_INVOKED ! 3358: #pragma pack () ! 3359: #endif // !RC_INVOKED 1.1.1.3 root 3360: 1.1.1.4 ! root 3361: // ! 3362: // End Image Format ! 3363: // 1.1.1.3 root 3364: 3365: // 1.1.1.4 ! root 3366: // for move macros 1.1.1.3 root 3367: // 1.1.1.4 ! root 3368: #include <string.h> ! 3369: #define HEAP_NO_SERIALIZE 0x00000001 ! 3370: #define HEAP_GROWABLE 0x00000002 ! 3371: #define HEAP_GENERATE_EXCEPTIONS 0x00000004 ! 3372: #define HEAP_ZERO_MEMORY 0x00000008 ! 3373: #define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010 ! 3374: #define HEAP_TAIL_CHECKING_ENABLED 0x00000020 ! 3375: #define HEAP_FREE_CHECKING_ENABLED 0x00000040 ! 3376: #define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080 ! 3377: #ifdef _M_IX86 ! 3378: #define RtlMoveMemory(Destination,Source,Length) memmove((Destination),(Source),(Length)) ! 3379: #define RtlCopyMemory(Destination,Source,Length) memcpy((Destination),(Source),(Length)) ! 3380: #define RtlFillMemory(Destination,Length,Fill) memset((Destination),(Fill),(Length)) ! 3381: #define RtlZeroMemory(Destination,Length) memset((Destination),0,(Length)) ! 3382: #else ! 3383: #define RtlCopyMemory(Destination,Source,Length) RtlMoveMemory((Destination),(Source),(Length)) ! 3384: VOID ! 3385: NTAPI ! 3386: RtlMoveMemory ( ! 3387: PVOID Destination, ! 3388: CONST VOID *Source, ! 3389: DWORD Length ! 3390: ); 1.1.1.3 root 3391: 1.1.1.4 ! root 3392: VOID ! 3393: NTAPI ! 3394: RtlFillMemory ( ! 3395: PVOID Destination, ! 3396: DWORD Length, ! 3397: BYTE Fill ! 3398: ); 1.1.1.3 root 3399: 1.1.1.4 ! root 3400: VOID ! 3401: NTAPI ! 3402: RtlZeroMemory ( ! 3403: PVOID Destination, ! 3404: DWORD Length ! 3405: ); ! 3406: #endif 1.1.1.3 root 3407: 1.1.1.4 ! root 3408: typedef struct _RTL_CRITICAL_SECTION_DEBUG { ! 3409: WORD Type; ! 3410: WORD CreatorBackTraceIndex; ! 3411: struct _RTL_CRITICAL_SECTION *CriticalSection; ! 3412: LIST_ENTRY ProcessLocksList; ! 3413: DWORD EntryCount; ! 3414: DWORD ContentionCount; ! 3415: DWORD Depth; ! 3416: PVOID OwnerBackTrace[ 5 ]; ! 3417: } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG; 1.1.1.3 root 3418: 1.1.1.4 ! root 3419: #define RTL_CRITSECT_TYPE 0 ! 3420: #define RTL_RESOURCE_TYPE 1 1.1.1.2 root 3421: 1.1.1.4 ! root 3422: typedef struct _RTL_CRITICAL_SECTION { ! 3423: PRTL_CRITICAL_SECTION_DEBUG DebugInfo; 1.1.1.2 root 3424: 1.1.1.4 ! root 3425: // ! 3426: // The following three fields control entering and exiting the critical ! 3427: // section for the resource ! 3428: // 1.1.1.3 root 3429: 1.1.1.4 ! root 3430: LONG LockCount; ! 3431: LONG RecursionCount; ! 3432: HANDLE OwningThread; // from the thread's ClientId->UniqueThread ! 3433: HANDLE LockSemaphore; ! 3434: DWORD Reserved; ! 3435: } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; ! 3436: #define DLL_PROCESS_ATTACH 1 ! 3437: #define DLL_THREAD_ATTACH 2 ! 3438: #define DLL_THREAD_DETACH 3 ! 3439: #define DLL_PROCESS_DETACH 0 1.1.1.3 root 3440: 3441: // 1.1.1.4 ! root 3442: // Defines for the READ flags for Eventlogging 1.1.1.3 root 3443: // 1.1.1.4 ! root 3444: #define EVENTLOG_SEQUENTIAL_READ 0X0001 ! 3445: #define EVENTLOG_SEEK_READ 0X0002 ! 3446: #define EVENTLOG_FORWARDS_READ 0X0004 ! 3447: #define EVENTLOG_BACKWARDS_READ 0X0008 1.1.1.3 root 3448: 1.1.1.4 ! root 3449: // ! 3450: // The types of events that can be logged. ! 3451: // ! 3452: #define EVENTLOG_SUCCESS 0X0000 ! 3453: #define EVENTLOG_ERROR_TYPE 0x0001 ! 3454: #define EVENTLOG_WARNING_TYPE 0x0002 ! 3455: #define EVENTLOG_INFORMATION_TYPE 0x0004 ! 3456: #define EVENTLOG_AUDIT_SUCCESS 0x0008 ! 3457: #define EVENTLOG_AUDIT_FAILURE 0x0010 1.1.1.3 root 3458: 3459: // 1.1.1.4 ! root 3460: // Defines for the WRITE flags used by Auditing for paired events ! 3461: // These are not implemented in Product 1 1.1.1.3 root 3462: // 3463: 1.1.1.4 ! root 3464: #define EVENTLOG_START_PAIRED_EVENT 0x0001 ! 3465: #define EVENTLOG_END_PAIRED_EVENT 0x0002 ! 3466: #define EVENTLOG_END_ALL_PAIRED_EVENTS 0x0004 ! 3467: #define EVENTLOG_PAIRED_EVENT_ACTIVE 0x0008 ! 3468: #define EVENTLOG_PAIRED_EVENT_INACTIVE 0x0010 1.1.1.3 root 3469: 3470: // 1.1.1.4 ! root 3471: // Structure that defines the header of the Eventlog record. This is the ! 3472: // fixed-sized portion before all the variable-length strings, binary ! 3473: // data and pad bytes. ! 3474: // ! 3475: // TimeGenerated is the time it was generated at the client. ! 3476: // TimeWritten is the time it was put into the log at the server end. 1.1.1.3 root 3477: // 3478: 1.1.1.4 ! root 3479: typedef struct _EVENTLOGRECORD { ! 3480: DWORD Length; // Length of full record ! 3481: DWORD Reserved; // Used by the service ! 3482: DWORD RecordNumber; // Absolute record number ! 3483: DWORD TimeGenerated; // Seconds since 1-1-1970 ! 3484: DWORD TimeWritten; // Seconds since 1-1-1970 ! 3485: DWORD EventID; ! 3486: WORD EventType; ! 3487: WORD NumStrings; ! 3488: WORD EventCategory; ! 3489: WORD ReservedFlags; // For use with paired events (auditing) ! 3490: DWORD ClosingRecordNumber; // For use with paired events (auditing) ! 3491: DWORD StringOffset; // Offset from beginning of record ! 3492: DWORD UserSidLength; ! 3493: DWORD UserSidOffset; ! 3494: DWORD DataLength; ! 3495: DWORD DataOffset; // Offset from beginning of record ! 3496: // ! 3497: // Then follow: ! 3498: // ! 3499: // WCHAR SourceName[] ! 3500: // WCHAR Computername[] ! 3501: // SID UserSid ! 3502: // WCHAR Strings[] ! 3503: // BYTE Data[] ! 3504: // CHAR Pad[] ! 3505: // DWORD Length; ! 3506: // ! 3507: } EVENTLOGRECORD, *PEVENTLOGRECORD; ! 3508: ! 3509: #define DBG_CONTINUE ((DWORD )0x00010002L) ! 3510: #define DBG_TERMINATE_THREAD ((DWORD )0x40010003L) ! 3511: #define DBG_TERMINATE_PROCESS ((DWORD )0x40010004L) ! 3512: #define DBG_CONTROL_C ((DWORD )0x40010005L) ! 3513: #define DBG_CONTROL_BREAK ((DWORD )0x40010008L) ! 3514: #define DBG_EXCEPTION_NOT_HANDLED ((DWORD )0x80010001L) ! 3515: // 1.1.1.3 root 3516: 1.1.1.4 ! root 3517: // begin_ntddk begin_nthal 1.1.1.3 root 3518: // 1.1.1.4 ! root 3519: // Registry Specific Access Rights. 1.1.1.3 root 3520: // 3521: 1.1.1.4 ! root 3522: #define KEY_QUERY_VALUE (0x0001) ! 3523: #define KEY_SET_VALUE (0x0002) ! 3524: #define KEY_CREATE_SUB_KEY (0x0004) ! 3525: #define KEY_ENUMERATE_SUB_KEYS (0x0008) ! 3526: #define KEY_NOTIFY (0x0010) ! 3527: #define KEY_CREATE_LINK (0x0020) ! 3528: ! 3529: #define KEY_READ ((STANDARD_RIGHTS_READ |\ ! 3530: KEY_QUERY_VALUE |\ ! 3531: KEY_ENUMERATE_SUB_KEYS |\ ! 3532: KEY_NOTIFY) \ ! 3533: & \ ! 3534: (~SYNCHRONIZE)) 1.1.1.3 root 3535: 3536: 1.1.1.4 ! root 3537: #define KEY_WRITE ((STANDARD_RIGHTS_WRITE |\ ! 3538: KEY_SET_VALUE |\ ! 3539: KEY_CREATE_SUB_KEY) \ ! 3540: & \ ! 3541: (~SYNCHRONIZE)) 1.1.1.3 root 3542: 1.1.1.4 ! root 3543: #define KEY_EXECUTE ((KEY_READ) \ ! 3544: & \ ! 3545: (~SYNCHRONIZE)) 1.1.1.3 root 3546: 1.1.1.4 ! root 3547: #define KEY_ALL_ACCESS ((STANDARD_RIGHTS_ALL |\ ! 3548: KEY_QUERY_VALUE |\ ! 3549: KEY_SET_VALUE |\ ! 3550: KEY_CREATE_SUB_KEY |\ ! 3551: KEY_ENUMERATE_SUB_KEYS |\ ! 3552: KEY_NOTIFY |\ ! 3553: KEY_CREATE_LINK) \ ! 3554: & \ ! 3555: (~SYNCHRONIZE)) 1.1.1.3 root 3556: 1.1.1.4 ! root 3557: // ! 3558: // Open/Create Options ! 3559: // 1.1.1.2 root 3560: 1.1.1.4 ! root 3561: #define REG_OPTION_RESERVED (0x00000000L) // Parameter is reserved 1.1.1.2 root 3562: 1.1.1.4 ! root 3563: #define REG_OPTION_NON_VOLATILE (0x00000000L) // Key is preserved ! 3564: // when system is rebooted 1.1.1.2 root 3565: 1.1.1.4 ! root 3566: #define REG_OPTION_VOLATILE (0x00000001L) // Key is not preserved ! 3567: // when system is rebooted 1.1.1.3 root 3568: 1.1.1.4 ! root 3569: #define REG_OPTION_CREATE_LINK (0x00000002L) // Created key is a ! 3570: // symbolic link 1.1.1.3 root 3571: 1.1.1.4 ! root 3572: #define REG_OPTION_BACKUP_RESTORE (0x00000004L) // open for backup or restore ! 3573: // special access rules ! 3574: // privilege required ! 3575: ! 3576: #define REG_LEGAL_OPTION \ ! 3577: (REG_OPTION_RESERVED |\ ! 3578: REG_OPTION_NON_VOLATILE |\ ! 3579: REG_OPTION_VOLATILE |\ ! 3580: REG_OPTION_CREATE_LINK |\ ! 3581: REG_OPTION_BACKUP_RESTORE) 1.1.1.2 root 3582: 3583: // 1.1.1.4 ! root 3584: // Key creation/open disposition 1.1.1.2 root 3585: // 3586: 1.1.1.4 ! root 3587: #define REG_CREATED_NEW_KEY (0x00000001L) // New Registry Key created ! 3588: #define REG_OPENED_EXISTING_KEY (0x00000002L) // Existing Key opened 1.1.1.2 root 3589: 3590: // 1.1.1.4 ! root 3591: // Key restore flags 1.1.1.2 root 3592: // 3593: 1.1.1.4 ! root 3594: #define REG_WHOLE_HIVE_VOLATILE (0x00000001L) // Restore whole hive volatile ! 3595: #define REG_REFRESH_HIVE (0x00000002L) // Unwind changes to last flush 1.1.1.3 root 3596: 1.1.1.4 ! root 3597: // end_ntddk end_nthal 1.1.1.3 root 3598: 3599: // 1.1.1.4 ! root 3600: // Notify filter values 1.1.1.3 root 3601: // 1.1.1.4 ! root 3602: #define REG_NOTIFY_CHANGE_NAME (0x00000001L) // Create or delete (child) ! 3603: #define REG_NOTIFY_CHANGE_ATTRIBUTES (0x00000002L) ! 3604: #define REG_NOTIFY_CHANGE_LAST_SET (0x00000004L) // time stamp ! 3605: #define REG_NOTIFY_CHANGE_SECURITY (0x00000008L) 1.1.1.3 root 3606: 1.1.1.4 ! root 3607: #define REG_LEGAL_CHANGE_FILTER \ ! 3608: (REG_NOTIFY_CHANGE_NAME |\ ! 3609: REG_NOTIFY_CHANGE_ATTRIBUTES |\ ! 3610: REG_NOTIFY_CHANGE_LAST_SET |\ ! 3611: REG_NOTIFY_CHANGE_SECURITY) 1.1.1.3 root 3612: 3613: // 1.1.1.4 ! root 3614: // ! 3615: // Predefined Value Types. 1.1.1.3 root 3616: // 3617: 1.1.1.4 ! root 3618: #define REG_NONE ( 0 ) // No value type ! 3619: #define REG_SZ ( 1 ) // Unicode nul terminated string ! 3620: #define REG_EXPAND_SZ ( 2 ) // Unicode nul terminated string ! 3621: // (with environment variable references) ! 3622: #define REG_BINARY ( 3 ) // Free form binary ! 3623: #define REG_DWORD ( 4 ) // 32-bit number ! 3624: #define REG_DWORD_LITTLE_ENDIAN ( 4 ) // 32-bit number (same as REG_DWORD) ! 3625: #define REG_DWORD_BIG_ENDIAN ( 5 ) // 32-bit number ! 3626: #define REG_LINK ( 6 ) // Symbolic Link (unicode) ! 3627: #define REG_MULTI_SZ ( 7 ) // Multiple Unicode strings ! 3628: #define REG_RESOURCE_LIST ( 8 ) // Resource list in the resource map ! 3629: #define REG_FULL_RESOURCE_DESCRIPTOR ( 9 ) // Resource list in the hardware description 1.1.1.3 root 3630: 1.1.1.4 ! root 3631: // end_ntddk end_nthal ! 3632: ! 3633: // begin_ntddk begin_nthal 1.1.1.3 root 3634: // 1.1.1.4 ! root 3635: // Service Types (Bit Mask) 1.1.1.3 root 3636: // 1.1.1.4 ! root 3637: #define SERVICE_KERNEL_DRIVER 0x00000001 ! 3638: #define SERVICE_FILE_SYSTEM_DRIVER 0x00000002 ! 3639: #define SERVICE_ADAPTER 0x00000004 ! 3640: #define SERVICE_RECOGNIZER_DRIVER 0x00000008 1.1.1.3 root 3641: 1.1.1.4 ! root 3642: #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER | \ ! 3643: SERVICE_FILE_SYSTEM_DRIVER | \ ! 3644: SERVICE_RECOGNIZER_DRIVER) 1.1.1.3 root 3645: 1.1.1.4 ! root 3646: #define SERVICE_WIN32_OWN_PROCESS 0x00000010 ! 3647: #define SERVICE_WIN32_SHARE_PROCESS 0x00000020 ! 3648: #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS | \ ! 3649: SERVICE_WIN32_SHARE_PROCESS) 1.1.1.3 root 3650: 1.1.1.4 ! root 3651: #define SERVICE_TYPE_ALL (SERVICE_WIN32 | \ ! 3652: SERVICE_ADAPTER | \ ! 3653: SERVICE_DRIVER) 1.1.1.3 root 3654: 3655: // 1.1.1.4 ! root 3656: // Start Type 1.1.1.3 root 3657: // 3658: 1.1.1.4 ! root 3659: #define SERVICE_BOOT_START 0x00000000 ! 3660: #define SERVICE_SYSTEM_START 0x00000001 ! 3661: #define SERVICE_AUTO_START 0x00000002 ! 3662: #define SERVICE_DEMAND_START 0x00000003 ! 3663: #define SERVICE_DISABLED 0x00000004 1.1.1.3 root 3664: 1.1.1.4 ! root 3665: // ! 3666: // Error control type ! 3667: // ! 3668: #define SERVICE_ERROR_IGNORE 0x00000000 ! 3669: #define SERVICE_ERROR_NORMAL 0x00000001 ! 3670: #define SERVICE_ERROR_SEVERE 0x00000002 ! 3671: #define SERVICE_ERROR_CRITICAL 0x00000003 1.1.1.3 root 3672: 3673: // 1.1.1.4 ! root 3674: // ! 3675: // Define the registry driver node enumerations 1.1.1.3 root 3676: // 3677: 1.1.1.4 ! root 3678: typedef enum _CM_SERVICE_NODE_TYPE { ! 3679: DriverType = SERVICE_KERNEL_DRIVER, ! 3680: FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, ! 3681: Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, ! 3682: Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, ! 3683: AdapterType = SERVICE_ADAPTER, ! 3684: RecognizerType = SERVICE_RECOGNIZER_DRIVER ! 3685: } SERVICE_NODE_TYPE; ! 3686: ! 3687: typedef enum _CM_SERVICE_LOAD_TYPE { ! 3688: BootLoad = SERVICE_BOOT_START, ! 3689: SystemLoad = SERVICE_SYSTEM_START, ! 3690: AutoLoad = SERVICE_AUTO_START, ! 3691: DemandLoad = SERVICE_DEMAND_START, ! 3692: DisableLoad = SERVICE_DISABLED ! 3693: } SERVICE_LOAD_TYPE; ! 3694: ! 3695: typedef enum _CM_ERROR_CONTROL_TYPE { ! 3696: IgnoreError = SERVICE_ERROR_IGNORE, ! 3697: NormalError = SERVICE_ERROR_NORMAL, ! 3698: SevereError = SERVICE_ERROR_SEVERE, ! 3699: CriticalError = SERVICE_ERROR_CRITICAL ! 3700: } SERVICE_ERROR_TYPE; ! 3701: 1.1.1.3 root 3702: 3703: // 1.1.1.4 ! root 3704: // IOCTL_TAPE_ERASE definitions 1.1.1.3 root 3705: // 3706: 1.1.1.4 ! root 3707: #define TAPE_ERASE_SHORT 0L ! 3708: #define TAPE_ERASE_LONG 1L 1.1.1.3 root 3709: 1.1.1.4 ! root 3710: typedef struct _TAPE_ERASE { ! 3711: DWORD Type; ! 3712: BOOLEAN Immediate; ! 3713: } TAPE_ERASE, *PTAPE_ERASE; 1.1.1.3 root 3714: 3715: // 1.1.1.4 ! root 3716: // IOCTL_TAPE_PREPARE definitions 1.1.1.3 root 3717: // 3718: 1.1.1.4 ! root 3719: #define TAPE_LOAD 0L ! 3720: #define TAPE_UNLOAD 1L ! 3721: #define TAPE_TENSION 2L ! 3722: #define TAPE_LOCK 3L ! 3723: #define TAPE_UNLOCK 4L ! 3724: #define TAPE_FORMAT 5L 1.1.1.3 root 3725: 1.1.1.4 ! root 3726: typedef struct _TAPE_PREPARE { ! 3727: DWORD Operation; ! 3728: BOOLEAN Immediate; ! 3729: } TAPE_PREPARE, *PTAPE_PREPARE; 1.1.1.3 root 3730: 3731: // 1.1.1.4 ! root 3732: // IOCTL_TAPE_WRITE_MARKS definitions 1.1.1.3 root 3733: // 3734: 1.1.1.4 ! root 3735: #define TAPE_SETMARKS 0L ! 3736: #define TAPE_FILEMARKS 1L ! 3737: #define TAPE_SHORT_FILEMARKS 2L ! 3738: #define TAPE_LONG_FILEMARKS 3L 1.1.1.3 root 3739: 1.1.1.4 ! root 3740: typedef struct _TAPE_WRITE_MARKS { ! 3741: DWORD Type; ! 3742: DWORD Count; ! 3743: BOOLEAN Immediate; ! 3744: } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS; 1.1.1.3 root 3745: 3746: // 1.1.1.4 ! root 3747: // IOCTL_TAPE_GET_POSITION definitions 1.1.1.3 root 3748: // 3749: 1.1.1.4 ! root 3750: #define TAPE_ABSOLUTE_POSITION 0L ! 3751: #define TAPE_LOGICAL_POSITION 1L ! 3752: #define TAPE_PSEUDO_LOGICAL_POSITION 2L 1.1.1.3 root 3753: 1.1.1.4 ! root 3754: typedef struct _TAPE_GET_POSITION { ! 3755: DWORD Type; ! 3756: DWORD Partition; ! 3757: LARGE_INTEGER Offset; ! 3758: } TAPE_GET_POSITION, *PTAPE_GET_POSITION; 1.1.1.3 root 3759: 1.1.1.4 ! root 3760: // ! 3761: // IOCTL_TAPE_SET_POSITION definitions ! 3762: // 1.1.1.3 root 3763: 1.1.1.4 ! root 3764: #define TAPE_REWIND 0L ! 3765: #define TAPE_ABSOLUTE_BLOCK 1L ! 3766: #define TAPE_LOGICAL_BLOCK 2L ! 3767: #define TAPE_PSEUDO_LOGICAL_BLOCK 3L ! 3768: #define TAPE_SPACE_END_OF_DATA 4L ! 3769: #define TAPE_SPACE_RELATIVE_BLOCKS 5L ! 3770: #define TAPE_SPACE_FILEMARKS 6L ! 3771: #define TAPE_SPACE_SEQUENTIAL_FMKS 7L ! 3772: #define TAPE_SPACE_SETMARKS 8L ! 3773: #define TAPE_SPACE_SEQUENTIAL_SMKS 9L ! 3774: ! 3775: typedef struct _TAPE_SET_POSITION { ! 3776: DWORD Method; ! 3777: DWORD Partition; ! 3778: LARGE_INTEGER Offset; ! 3779: BOOLEAN Immediate; ! 3780: } TAPE_SET_POSITION, *PTAPE_SET_POSITION; 1.1.1.3 root 3781: 3782: // 1.1.1.4 ! root 3783: // IOCTL_TAPE_GET_DRIVE_PARAMS definitions 1.1.1.3 root 3784: // 3785: 3786: // 1.1.1.4 ! root 3787: // Definitions for FeaturesLow parameter 1.1.1.3 root 3788: // 3789: 1.1.1.4 ! root 3790: #define TAPE_DRIVE_FIXED 0x00000001 ! 3791: #define TAPE_DRIVE_SELECT 0x00000002 ! 3792: #define TAPE_DRIVE_INITIATOR 0x00000004 1.1.1.3 root 3793: 1.1.1.4 ! root 3794: #define TAPE_DRIVE_ERASE_SHORT 0x00000010 ! 3795: #define TAPE_DRIVE_ERASE_LONG 0x00000020 ! 3796: #define TAPE_DRIVE_ERASE_BOP_ONLY 0x00000040 ! 3797: #define TAPE_DRIVE_ERASE_IMMEDIATE 0x00000080 1.1.1.3 root 3798: 1.1.1.4 ! root 3799: #define TAPE_DRIVE_TAPE_CAPACITY 0x00000100 ! 3800: #define TAPE_DRIVE_TAPE_REMAINING 0x00000200 ! 3801: #define TAPE_DRIVE_FIXED_BLOCK 0x00000400 ! 3802: #define TAPE_DRIVE_VARIABLE_BLOCK 0x00000800 1.1.1.3 root 3803: 1.1.1.4 ! root 3804: #define TAPE_DRIVE_WRITE_PROTECT 0x00001000 ! 3805: #define TAPE_DRIVE_EOT_WZ_SIZE 0x00002000 ! 3806: ! 3807: #define TAPE_DRIVE_ECC 0x00010000 ! 3808: #define TAPE_DRIVE_COMPRESSION 0x00020000 ! 3809: #define TAPE_DRIVE_PADDING 0x00040000 ! 3810: #define TAPE_DRIVE_REPORT_SMKS 0x00080000 ! 3811: ! 3812: #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x00100000 ! 3813: #define TAPE_DRIVE_GET_LOGICAL_BLK 0x00200000 ! 3814: #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x00400000 ! 3815: ! 3816: #define TAPE_DRIVE_RESERVED_BIT 0x80000000 //don't use this bit! ! 3817: // //can't be a low features bit! ! 3818: // //reserved; high features only 1.1.1.3 root 3819: 3820: // 1.1.1.4 ! root 3821: // Definitions for FeaturesHigh parameter 1.1.1.3 root 3822: // 3823: 1.1.1.4 ! root 3824: #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 ! 3825: #define TAPE_DRIVE_TENSION 0x80000002 ! 3826: #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 ! 3827: #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 ! 3828: ! 3829: #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 ! 3830: #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 ! 3831: #define TAPE_DRIVE_TENSION_IMMED 0x80000040 ! 3832: #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 ! 3833: ! 3834: #define TAPE_DRIVE_SET_ECC 0x80000100 ! 3835: #define TAPE_DRIVE_SET_COMPRESSION 0x80000200 ! 3836: #define TAPE_DRIVE_SET_PADDING 0x80000400 ! 3837: #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 ! 3838: ! 3839: #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 ! 3840: #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 ! 3841: #define TAPE_DRIVE_LOGICAL_BLK 0x80004000 ! 3842: #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 ! 3843: ! 3844: #define TAPE_DRIVE_END_OF_DATA 0x80010000 ! 3845: #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 ! 3846: #define TAPE_DRIVE_FILEMARKS 0x80040000 ! 3847: #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 ! 3848: ! 3849: #define TAPE_DRIVE_SETMARKS 0x80100000 ! 3850: #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 ! 3851: #define TAPE_DRIVE_REVERSE_POSITION 0x80400000 ! 3852: #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 ! 3853: ! 3854: #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 ! 3855: #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 ! 3856: #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 ! 3857: #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 ! 3858: ! 3859: #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 ! 3860: #define TAPE_DRIVE_FORMAT 0xA0000000 ! 3861: #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 ! 3862: #define TAPE_DRIVE_HIGH_FEATURES 0x80000000 //mask for high features flag 1.1.1.3 root 3863: 1.1.1.4 ! root 3864: typedef struct _TAPE_GET_DRIVE_PARAMETERS { ! 3865: BOOLEAN ECC; ! 3866: BOOLEAN Compression; ! 3867: BOOLEAN DataPadding; ! 3868: BOOLEAN ReportSetmarks; ! 3869: DWORD DefaultBlockSize; ! 3870: DWORD MaximumBlockSize; ! 3871: DWORD MinimumBlockSize; ! 3872: DWORD MaximumPartitionCount; ! 3873: DWORD FeaturesLow; ! 3874: DWORD FeaturesHigh; ! 3875: DWORD EOTWarningZoneSize; ! 3876: } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS; 1.1.1.3 root 3877: 1.1.1.4 ! root 3878: // ! 3879: // IOCTL_TAPE_SET_DRIVE_PARAMETERS definitions ! 3880: // 1.1.1.3 root 3881: 1.1.1.4 ! root 3882: typedef struct _TAPE_SET_DRIVE_PARAMETERS { ! 3883: BOOLEAN ECC; ! 3884: BOOLEAN Compression; ! 3885: BOOLEAN DataPadding; ! 3886: BOOLEAN ReportSetmarks; ! 3887: DWORD EOTWarningZoneSize; ! 3888: } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS; 1.1.1.3 root 3889: 3890: // 1.1.1.4 ! root 3891: // IOCTL_TAPE_GET_MEDIA_PARAMETERS definitions 1.1.1.3 root 3892: // 3893: 1.1.1.4 ! root 3894: typedef struct _TAPE_GET_MEDIA_PARAMETERS { ! 3895: LARGE_INTEGER Capacity; ! 3896: LARGE_INTEGER Remaining; ! 3897: DWORD BlockSize; ! 3898: DWORD PartitionCount; ! 3899: BOOLEAN WriteProtected; ! 3900: } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS; 1.1.1.3 root 3901: 3902: // 1.1.1.4 ! root 3903: // IOCTL_TAPE_SET_MEDIA_PARAMETERS definitions 1.1.1.3 root 3904: // 3905: 1.1.1.4 ! root 3906: typedef struct _TAPE_SET_MEDIA_PARAMETERS { ! 3907: DWORD BlockSize; ! 3908: } TAPE_SET_MEDIA_PARAMETERS, *PTAPE_SET_MEDIA_PARAMETERS; 1.1.1.3 root 3909: 1.1.1.4 ! root 3910: // ! 3911: // IOCTL_TAPE_CREATE_PARTITION definitions ! 3912: // 1.1.1.3 root 3913: 1.1.1.4 ! root 3914: #define TAPE_FIXED_PARTITIONS 0L ! 3915: #define TAPE_SELECT_PARTITIONS 1L ! 3916: #define TAPE_INITIATOR_PARTITIONS 2L 1.1.1.3 root 3917: 1.1.1.4 ! root 3918: typedef struct _TAPE_CREATE_PARTITION { ! 3919: DWORD Method; ! 3920: DWORD Count; ! 3921: DWORD Size; ! 3922: } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION; 1.1.1.3 root 3923: 1.1.1.2 root 3924: 1.1.1.4 ! root 3925: #ifdef __cplusplus ! 3926: } ! 3927: #endif 1.1.1.2 root 3928: 1.1.1.4 ! root 3929: #endif /* _WINNT_ */ 1.1 root 3930:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.