1 /***********************************************************************\ 2 * winnt.d * 3 * * 4 * Windows API header module * 5 * * 6 * Translated from MinGW API for MS-Windows 3.12 * 7 * * 8 * Placed into public domain * 9 \***********************************************************************/ 10 module windows.winnt; 11 12 public import windows.basetsd, windows.basetyps, windows.windef, windows.winerror; 13 private import windows.w32api; 14 nothrow: 15 /* Translation Notes: 16 The following macros are unneeded for D: 17 FIELD_OFFSET(t,f), CONTAINING_RECORD(address, type, field) 18 */ 19 20 alias void VOID; 21 alias char CHAR, CCHAR; 22 alias wchar WCHAR; 23 alias bool BOOLEAN; 24 alias byte FCHAR; 25 alias ubyte UCHAR; 26 alias short SHORT; 27 alias ushort LANGID, FSHORT; 28 alias uint LCID, FLONG, ACCESS_MASK; 29 alias long LONGLONG, USN; 30 alias ulong DWORDLONG, ULONGLONG; 31 32 alias void* PVOID, LPVOID; 33 alias char* PSZ, PCHAR, PCCHAR, LPCH, PCH, LPSTR, PSTR; 34 alias wchar* PWCHAR, LPWCH, PWCH, LPWSTR, PWSTR; 35 alias bool* PBOOLEAN; 36 alias ubyte* PUCHAR; 37 alias short* PSHORT; 38 alias int* PLONG; 39 alias uint* PLCID, PACCESS_MASK; 40 alias long* PLONGLONG; 41 alias ulong* PDWORDLONG, PULONGLONG; 42 43 // FIXME(MinGW) for __WIN64 44 alias void* PVOID64; 45 46 // const versions 47 alias const(char)* LPCCH, PCSTR, LPCSTR; 48 alias const(wchar)* LPCWCH, PCWCH, LPCWSTR, PCWSTR; 49 50 version (Unicode) { 51 alias WCHAR TCHAR, _TCHAR; 52 } else { 53 alias CHAR TCHAR, _TCHAR; 54 } 55 56 alias TCHAR TBYTE; 57 alias TCHAR* PTCH, PTBYTE, LPTCH, PTSTR, LPTSTR, LP, PTCHAR; 58 alias const(TCHAR)* LPCTSTR; 59 60 const char ANSI_NULL = '\0'; 61 const wchar UNICODE_NULL = '\0'; 62 63 const APPLICATION_ERROR_MASK = 0x20000000; 64 const ERROR_SEVERITY_SUCCESS = 0x00000000; 65 const ERROR_SEVERITY_INFORMATIONAL = 0x40000000; 66 const ERROR_SEVERITY_WARNING = 0x80000000; 67 const ERROR_SEVERITY_ERROR = 0xC0000000; 68 69 // MinGW: also in ddk/ntifs.h 70 enum : USHORT { 71 COMPRESSION_FORMAT_NONE = 0x0000, 72 COMPRESSION_FORMAT_DEFAULT = 0x0001, 73 COMPRESSION_FORMAT_LZNT1 = 0x0002, 74 COMPRESSION_ENGINE_STANDARD = 0x0000, 75 COMPRESSION_ENGINE_MAXIMUM = 0x0100, 76 COMPRESSION_ENGINE_HIBER = 0x0200 77 } 78 79 // ACCESS_DENIED_OBJECT_ACE, etc 80 const DWORD 81 ACE_OBJECT_TYPE_PRESENT = 0x00000001, 82 ACE_INHERITED_OBJECT_TYPE_PRESENT = 0x00000002; 83 84 // ACE_HEADER.AceType 85 // also in ddk/ntifs.h 86 enum : BYTE { 87 ACCESS_ALLOWED_ACE_TYPE, 88 ACCESS_DENIED_ACE_TYPE, 89 SYSTEM_AUDIT_ACE_TYPE, 90 SYSTEM_ALARM_ACE_TYPE 91 } 92 93 // ACE_HEADER.AceFlags 94 const BYTE 95 OBJECT_INHERIT_ACE = 0x01, 96 CONTAINER_INHERIT_ACE = 0x02, 97 NO_PROPAGATE_INHERIT_ACE = 0x04, 98 INHERIT_ONLY_ACE = 0x08, 99 INHERITED_ACE = 0x10, 100 VALID_INHERIT_FLAGS = 0x1F, 101 SUCCESSFUL_ACCESS_ACE_FLAG = 0x40, 102 FAILED_ACCESS_ACE_FLAG = 0x80; 103 104 // Access Mask Format 105 const ACCESS_MASK 106 DELETE = 0x00010000, 107 READ_CONTROL = 0x00020000, 108 WRITE_DAC = 0x00040000, 109 WRITE_OWNER = 0x00080000, 110 SYNCHRONIZE = 0x00100000, 111 ACCESS_SYSTEM_SECURITY = 0x01000000, 112 MAXIMUM_ALLOWED = 0x02000000, 113 GENERIC_READ = 0x80000000, 114 GENERIC_WRITE = 0x40000000, 115 GENERIC_EXECUTE = 0x20000000, 116 GENERIC_ALL = 0x10000000, 117 STANDARD_RIGHTS_REQUIRED = 0x000F0000, 118 STANDARD_RIGHTS_READ = 0x00020000, 119 STANDARD_RIGHTS_WRITE = 0x00020000, 120 STANDARD_RIGHTS_EXECUTE = 0x00020000, 121 STANDARD_RIGHTS_ALL = 0x001F0000, 122 SPECIFIC_RIGHTS_ALL = 0x0000FFFF; 123 124 125 const DWORD INVALID_FILE_ATTRIBUTES = -1; 126 127 // MinGW: Also in ddk/winddk.h 128 const DWORD 129 FILE_LIST_DIRECTORY = 0x00000001, 130 FILE_READ_DATA = 0x00000001, 131 FILE_ADD_FILE = 0x00000002, 132 FILE_WRITE_DATA = 0x00000002, 133 FILE_ADD_SUBDIRECTORY = 0x00000004, 134 FILE_APPEND_DATA = 0x00000004, 135 FILE_CREATE_PIPE_INSTANCE = 0x00000004, 136 FILE_READ_EA = 0x00000008, 137 FILE_READ_PROPERTIES = 0x00000008, 138 FILE_WRITE_EA = 0x00000010, 139 FILE_WRITE_PROPERTIES = 0x00000010, 140 FILE_EXECUTE = 0x00000020, 141 FILE_TRAVERSE = 0x00000020, 142 FILE_DELETE_CHILD = 0x00000040, 143 FILE_READ_ATTRIBUTES = 0x00000080, 144 FILE_WRITE_ATTRIBUTES = 0x00000100; 145 146 const DWORD 147 FILE_SHARE_READ = 0x00000001, 148 FILE_SHARE_WRITE = 0x00000002, 149 FILE_SHARE_DELETE = 0x00000004, 150 FILE_SHARE_VALID_FLAGS = 0x00000007; 151 152 const DWORD 153 FILE_ATTRIBUTE_READONLY = 0x00000001, 154 FILE_ATTRIBUTE_HIDDEN = 0x00000002, 155 FILE_ATTRIBUTE_SYSTEM = 0x00000004, 156 FILE_ATTRIBUTE_DIRECTORY = 0x00000010, 157 FILE_ATTRIBUTE_ARCHIVE = 0x00000020, 158 FILE_ATTRIBUTE_DEVICE = 0x00000040, 159 FILE_ATTRIBUTE_NORMAL = 0x00000080, 160 FILE_ATTRIBUTE_TEMPORARY = 0x00000100, 161 FILE_ATTRIBUTE_SPARSE_FILE = 0x00000200, 162 FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400, 163 FILE_ATTRIBUTE_COMPRESSED = 0x00000800, 164 FILE_ATTRIBUTE_OFFLINE = 0x00001000, 165 FILE_ATTRIBUTE_NOT_CONTENT_INDEXED = 0x00002000, 166 FILE_ATTRIBUTE_ENCRYPTED = 0x00004000, 167 FILE_ATTRIBUTE_VALID_FLAGS = 0x00007fb7, 168 FILE_ATTRIBUTE_VALID_SET_FLAGS = 0x000031a7; 169 170 // These are not documented on MSDN 171 const FILE_COPY_STRUCTURED_STORAGE = 0x00000041; 172 const FILE_STRUCTURED_STORAGE = 0x00000441; 173 174 // Nor are these 175 const FILE_VALID_OPTION_FLAGS = 0x00ffffff; 176 const FILE_VALID_PIPE_OPTION_FLAGS = 0x00000032; 177 const FILE_VALID_MAILSLOT_OPTION_FLAGS = 0x00000032; 178 const FILE_VALID_SET_FLAGS = 0x00000036; 179 180 const ULONG 181 FILE_SUPERSEDE = 0x00000000, 182 FILE_OPEN = 0x00000001, 183 FILE_CREATE = 0x00000002, 184 FILE_OPEN_IF = 0x00000003, 185 FILE_OVERWRITE = 0x00000004, 186 FILE_OVERWRITE_IF = 0x00000005, 187 FILE_MAXIMUM_DISPOSITION = 0x00000005; 188 189 const ULONG 190 FILE_DIRECTORY_FILE = 0x00000001, 191 FILE_WRITE_THROUGH = 0x00000002, 192 FILE_SEQUENTIAL_ONLY = 0x00000004, 193 FILE_NO_INTERMEDIATE_BUFFERING = 0x00000008, 194 FILE_SYNCHRONOUS_IO_ALERT = 0x00000010, 195 FILE_SYNCHRONOUS_IO_NONALERT = 0x00000020, 196 FILE_NON_DIRECTORY_FILE = 0x00000040, 197 FILE_CREATE_TREE_CONNECTION = 0x00000080, 198 FILE_COMPLETE_IF_OPLOCKED = 0x00000100, 199 FILE_NO_EA_KNOWLEDGE = 0x00000200, 200 FILE_OPEN_FOR_RECOVERY = 0x00000400, 201 FILE_RANDOM_ACCESS = 0x00000800, 202 FILE_DELETE_ON_CLOSE = 0x00001000, 203 FILE_OPEN_BY_FILE_ID = 0x00002000, 204 FILE_OPEN_FOR_BACKUP_INTENT = 0x00004000, 205 FILE_NO_COMPRESSION = 0x00008000, 206 FILE_RESERVE_OPFILTER = 0x00100000, 207 FILE_OPEN_REPARSE_POINT = 0x00200000, 208 FILE_OPEN_NO_RECALL = 0x00400000, 209 FILE_OPEN_FOR_FREE_SPACE_QUERY = 0x00800000; 210 211 212 const ACCESS_MASK 213 FILE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x01FF, 214 FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES 215 | FILE_EXECUTE | SYNCHRONIZE, 216 FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA 217 | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE, 218 FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA 219 | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA 220 | SYNCHRONIZE; 221 222 // MinGW: end winddk.h 223 // MinGW: also in ddk/ntifs.h 224 const DWORD 225 FILE_NOTIFY_CHANGE_FILE_NAME = 0x00000001, 226 FILE_NOTIFY_CHANGE_DIR_NAME = 0x00000002, 227 FILE_NOTIFY_CHANGE_NAME = 0x00000003, 228 FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x00000004, 229 FILE_NOTIFY_CHANGE_SIZE = 0x00000008, 230 FILE_NOTIFY_CHANGE_LAST_WRITE = 0x00000010, 231 FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x00000020, 232 FILE_NOTIFY_CHANGE_CREATION = 0x00000040, 233 FILE_NOTIFY_CHANGE_EA = 0x00000080, 234 FILE_NOTIFY_CHANGE_SECURITY = 0x00000100, 235 FILE_NOTIFY_CHANGE_STREAM_NAME = 0x00000200, 236 FILE_NOTIFY_CHANGE_STREAM_SIZE = 0x00000400, 237 FILE_NOTIFY_CHANGE_STREAM_WRITE = 0x00000800, 238 FILE_NOTIFY_VALID_MASK = 0x00000fff; 239 240 const DWORD 241 FILE_CASE_SENSITIVE_SEARCH = 0x00000001, 242 FILE_CASE_PRESERVED_NAMES = 0x00000002, 243 FILE_UNICODE_ON_DISK = 0x00000004, 244 FILE_PERSISTENT_ACLS = 0x00000008, 245 FILE_FILE_COMPRESSION = 0x00000010, 246 FILE_VOLUME_QUOTAS = 0x00000020, 247 FILE_SUPPORTS_SPARSE_FILES = 0x00000040, 248 FILE_SUPPORTS_REPARSE_POINTS = 0x00000080, 249 FILE_SUPPORTS_REMOTE_STORAGE = 0x00000100, 250 FS_LFN_APIS = 0x00004000, 251 FILE_VOLUME_IS_COMPRESSED = 0x00008000, 252 FILE_SUPPORTS_OBJECT_IDS = 0x00010000, 253 FILE_SUPPORTS_ENCRYPTION = 0x00020000, 254 FILE_NAMED_STREAMS = 0x00040000, 255 FILE_READ_ONLY_VOLUME = 0x00080000, 256 FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000, 257 FILE_SUPPORTS_TRANSACTIONS = 0x00200000; 258 259 // These are not documented on MSDN 260 const ACCESS_MASK 261 IO_COMPLETION_QUERY_STATE = 1, 262 IO_COMPLETION_MODIFY_STATE = 2, 263 IO_COMPLETION_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 3; 264 // MinGW: end ntifs.h 265 266 // MinGW: also in ddk/winddk.h 267 const DWORD 268 DUPLICATE_CLOSE_SOURCE = 1, 269 DUPLICATE_SAME_ACCESS = 2, 270 DUPLICATE_SAME_ATTRIBUTES = 4; 271 // MinGW: end winddk.k 272 273 const DWORD 274 MAILSLOT_NO_MESSAGE = -1, 275 MAILSLOT_WAIT_FOREVER = -1; 276 277 const ACCESS_MASK 278 PROCESS_TERMINATE = 0x0001, 279 PROCESS_CREATE_THREAD = 0x0002, 280 PROCESS_SET_SESSIONID = 0x0004, 281 PROCESS_VM_OPERATION = 0x0008, 282 PROCESS_VM_READ = 0x0010, 283 PROCESS_VM_WRITE = 0x0020, 284 PROCESS_DUP_HANDLE = 0x0040, 285 PROCESS_CREATE_PROCESS = 0x0080, 286 PROCESS_SET_QUOTA = 0x0100, 287 PROCESS_SET_INFORMATION = 0x0200, 288 PROCESS_QUERY_INFORMATION = 0x0400, 289 PROCESS_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | 0x0FFF; 290 291 const ACCESS_MASK 292 THREAD_TERMINATE = 0x0001, 293 THREAD_SUSPEND_RESUME = 0x0002, 294 THREAD_GET_CONTEXT = 0x0008, 295 THREAD_SET_CONTEXT = 0x0010, 296 THREAD_SET_INFORMATION = 0x0020, 297 THREAD_QUERY_INFORMATION = 0x0040, 298 THREAD_SET_THREAD_TOKEN = 0x0080, 299 THREAD_IMPERSONATE = 0x0100, 300 THREAD_DIRECT_IMPERSONATION = 0x0200, 301 THREAD_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF; 302 303 // These are not documented on MSDN 304 const THREAD_BASE_PRIORITY_LOWRT = 15; 305 const THREAD_BASE_PRIORITY_MAX = 2; 306 const THREAD_BASE_PRIORITY_MIN = -2; 307 const THREAD_BASE_PRIORITY_IDLE = -15; 308 309 const DWORD EXCEPTION_NONCONTINUABLE = 1; 310 const size_t EXCEPTION_MAXIMUM_PARAMETERS = 15; 311 312 // These are not documented on MSDN 313 const ACCESS_MASK 314 MUTANT_QUERY_STATE = 1, 315 MUTANT_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | MUTANT_QUERY_STATE; 316 317 const ACCESS_MASK 318 TIMER_QUERY_STATE = 1, 319 TIMER_MODIFY_STATE = 2, 320 TIMER_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SYNCHRONIZE | TIMER_QUERY_STATE 321 | TIMER_MODIFY_STATE; 322 323 const SID_IDENTIFIER_AUTHORITY 324 SECURITY_NULL_SID_AUTHORITY = {[5: 0]}, 325 SECURITY_WORLD_SID_AUTHORITY = {[5: 1]}, 326 SECURITY_LOCAL_SID_AUTHORITY = {[5: 2]}, 327 SECURITY_CREATOR_SID_AUTHORITY = {[5: 3]}, 328 SECURITY_NON_UNIQUE_AUTHORITY = {[5: 4]}, 329 SECURITY_NT_AUTHORITY = {[5: 5]}, 330 SECURITY_MANDATORY_LABEL_AUTHORITY = {[5: 6]}; 331 332 const DWORD 333 SECURITY_NULL_RID = 0, 334 SECURITY_WORLD_RID = 0, 335 SECURITY_LOCAL_RID = 0, 336 SECURITY_CREATOR_OWNER_RID = 0, 337 SECURITY_CREATOR_GROUP_RID = 1, 338 SECURITY_DIALUP_RID = 1, 339 SECURITY_NETWORK_RID = 2, 340 SECURITY_BATCH_RID = 3, 341 SECURITY_INTERACTIVE_RID = 4, 342 SECURITY_LOGON_IDS_RID = 5, 343 SECURITY_SERVICE_RID = 6, 344 SECURITY_LOCAL_SYSTEM_RID = 18, 345 SECURITY_BUILTIN_DOMAIN_RID = 32, 346 SECURITY_PRINCIPAL_SELF_RID = 10, 347 SECURITY_CREATOR_OWNER_SERVER_RID = 2, 348 SECURITY_CREATOR_GROUP_SERVER_RID = 3, 349 SECURITY_LOGON_IDS_RID_COUNT = 3, 350 SECURITY_ANONYMOUS_LOGON_RID = 7, 351 SECURITY_PROXY_RID = 8, 352 SECURITY_ENTERPRISE_CONTROLLERS_RID = 9, 353 SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID, 354 SECURITY_AUTHENTICATED_USER_RID = 11, 355 SECURITY_RESTRICTED_CODE_RID = 12, 356 SECURITY_NT_NON_UNIQUE_RID = 21, 357 SID_REVISION = 1; 358 359 enum : DWORD { 360 DOMAIN_USER_RID_ADMIN = 0x01F4, 361 DOMAIN_USER_RID_GUEST = 0x01F5, 362 DOMAIN_GROUP_RID_ADMINS = 0x0200, 363 DOMAIN_GROUP_RID_USERS = 0x0201, 364 DOMAIN_ALIAS_RID_ADMINS = 0x0220, 365 DOMAIN_ALIAS_RID_USERS = 0x0221, 366 DOMAIN_ALIAS_RID_GUESTS = 0x0222, 367 DOMAIN_ALIAS_RID_POWER_USERS = 0x0223, 368 DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x0224, 369 DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x0225, 370 DOMAIN_ALIAS_RID_PRINT_OPS = 0x0226, 371 DOMAIN_ALIAS_RID_BACKUP_OPS = 0x0227, 372 DOMAIN_ALIAS_RID_REPLICATOR = 0x0228 373 } 374 375 enum : WORD { 376 SECURITY_MANDATORY_UNTRUSTED_RID = 0, 377 SECURITY_MANDATORY_LOW_RID = 0x1000, 378 SECURITY_MANDATORY_MEDIUM_RID = 0x2000, 379 SECURITY_MANDATORY_HIGH_RID = 0x3000, 380 SECURITY_MANDATORY_SYSTEM_RID = 0x4000, 381 SECURITY_MANDATORY_PROTECTED_PROCESS_RID = 0x5000, 382 SECURITY_MANDATORY_MAXIMUM_USER_RID = SECURITY_MANDATORY_SYSTEM_RID 383 } 384 385 const TCHAR[] 386 SE_CREATE_TOKEN_NAME = "SeCreateTokenPrivilege", 387 SE_ASSIGNPRIMARYTOKEN_NAME = "SeAssignPrimaryTokenPrivilege", 388 SE_LOCK_MEMORY_NAME = "SeLockMemoryPrivilege", 389 SE_INCREASE_QUOTA_NAME = "SeIncreaseQuotaPrivilege", 390 SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege", 391 SE_MACHINE_ACCOUNT_NAME = "SeMachineAccountPrivilege", 392 SE_TCB_NAME = "SeTcbPrivilege", 393 SE_SECURITY_NAME = "SeSecurityPrivilege", 394 SE_TAKE_OWNERSHIP_NAME = "SeTakeOwnershipPrivilege", 395 SE_LOAD_DRIVER_NAME = "SeLoadDriverPrivilege", 396 SE_SYSTEM_PROFILE_NAME = "SeSystemProfilePrivilege", 397 SE_SYSTEMTIME_NAME = "SeSystemtimePrivilege", 398 SE_PROF_SINGLE_PROCESS_NAME = "SeProfileSingleProcessPrivilege", 399 SE_INC_BASE_PRIORITY_NAME = "SeIncreaseBasePriorityPrivilege", 400 SE_CREATE_PAGEFILE_NAME = "SeCreatePagefilePrivilege", 401 SE_CREATE_PERMANENT_NAME = "SeCreatePermanentPrivilege", 402 SE_BACKUP_NAME = "SeBackupPrivilege", 403 SE_RESTORE_NAME = "SeRestorePrivilege", 404 SE_SHUTDOWN_NAME = "SeShutdownPrivilege", 405 SE_DEBUG_NAME = "SeDebugPrivilege", 406 SE_AUDIT_NAME = "SeAuditPrivilege", 407 SE_SYSTEM_ENVIRONMENT_NAME = "SeSystemEnvironmentPrivilege", 408 SE_CHANGE_NOTIFY_NAME = "SeChangeNotifyPrivilege", 409 SE_REMOTE_SHUTDOWN_NAME = "SeRemoteShutdownPrivilege", 410 SE_CREATE_GLOBAL_NAME = "SeCreateGlobalPrivilege", 411 SE_UNDOCK_NAME = "SeUndockPrivilege", 412 SE_MANAGE_VOLUME_NAME = "SeManageVolumePrivilege", 413 SE_IMPERSONATE_NAME = "SeImpersonatePrivilege", 414 SE_ENABLE_DELEGATION_NAME = "SeEnableDelegationPrivilege", 415 SE_SYNC_AGENT_NAME = "SeSyncAgentPrivilege", 416 SE_TRUSTED_CREDMAN_ACCESS_NAME = "SeTrustedCredManAccessPrivilege", 417 SE_RELABEL_NAME = "SeRelabelPrivilege", 418 SE_INCREASE_WORKING_SET_NAME = "SeIncreaseWorkingSetPrivilege", 419 SE_TIME_ZONE_NAME = "SeTimeZonePrivilege", 420 SE_CREATE_SYMBOLIC_LINK_NAME = "SeCreateSymbolicLinkPrivilege"; 421 422 const DWORD 423 SE_GROUP_MANDATORY = 0x00000001, 424 SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002, 425 SE_GROUP_ENABLED = 0x00000004, 426 SE_GROUP_OWNER = 0x00000008, 427 SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010, 428 SE_GROUP_INTEGRITY = 0x00000020, 429 SE_GROUP_INTEGRITY_ENABLED = 0x00000040, 430 SE_GROUP_RESOURCE = 0x20000000, 431 SE_GROUP_LOGON_ID = 0xC0000000; 432 433 // Primary language identifiers 434 enum : USHORT { 435 LANG_NEUTRAL, 436 LANG_ARABIC, 437 LANG_BULGARIAN, 438 LANG_CATALAN, 439 LANG_CHINESE, 440 LANG_CZECH, 441 LANG_DANISH, 442 LANG_GERMAN, 443 LANG_GREEK, 444 LANG_ENGLISH, 445 LANG_SPANISH, 446 LANG_FINNISH, 447 LANG_FRENCH, 448 LANG_HEBREW, 449 LANG_HUNGARIAN, 450 LANG_ICELANDIC, 451 LANG_ITALIAN, 452 LANG_JAPANESE, 453 LANG_KOREAN, 454 LANG_DUTCH, 455 LANG_NORWEGIAN, 456 LANG_POLISH, 457 LANG_PORTUGUESE, // = 0x16 458 LANG_ROMANIAN = 0x18, 459 LANG_RUSSIAN, 460 LANG_CROATIAN, // = 0x1A 461 LANG_SERBIAN = 0x1A, 462 LANG_BOSNIAN = 0x1A, 463 LANG_SLOVAK, 464 LANG_ALBANIAN, 465 LANG_SWEDISH, 466 LANG_THAI, 467 LANG_TURKISH, 468 LANG_URDU, 469 LANG_INDONESIAN, 470 LANG_UKRAINIAN, 471 LANG_BELARUSIAN, 472 LANG_SLOVENIAN, 473 LANG_ESTONIAN, 474 LANG_LATVIAN, 475 LANG_LITHUANIAN, // = 0x27 476 LANG_FARSI = 0x29, 477 LANG_PERSIAN = 0x29, 478 LANG_VIETNAMESE, 479 LANG_ARMENIAN, 480 LANG_AZERI, 481 LANG_BASQUE, 482 LANG_LOWER_SORBIAN, // = 0x2E 483 LANG_UPPER_SORBIAN = 0x2E, 484 LANG_MACEDONIAN, // = 0x2F 485 LANG_TSWANA = 0x32, 486 LANG_XHOSA = 0x34, 487 LANG_ZULU, 488 LANG_AFRIKAANS, 489 LANG_GEORGIAN, 490 LANG_FAEROESE, 491 LANG_HINDI, 492 LANG_MALTESE, 493 LANG_SAMI, 494 LANG_IRISH, // = 0x3C 495 LANG_MALAY = 0x3E, 496 LANG_KAZAK, 497 LANG_KYRGYZ, 498 LANG_SWAHILI, // = 0x41 499 LANG_UZBEK = 0x43, 500 LANG_TATAR, 501 LANG_BENGALI, 502 LANG_PUNJABI, 503 LANG_GUJARATI, 504 LANG_ORIYA, 505 LANG_TAMIL, 506 LANG_TELUGU, 507 LANG_KANNADA, 508 LANG_MALAYALAM, 509 LANG_ASSAMESE, 510 LANG_MARATHI, 511 LANG_SANSKRIT, 512 LANG_MONGOLIAN, 513 LANG_TIBETAN, 514 LANG_WELSH, 515 LANG_KHMER, 516 LANG_LAO, // = 0x54 517 LANG_GALICIAN = 0x56, 518 LANG_KONKANI, 519 LANG_MANIPURI, 520 LANG_SINDHI, 521 LANG_SYRIAC, 522 LANG_SINHALESE, // = 0x5B 523 LANG_INUKTITUT = 0x5D, 524 LANG_AMHARIC, 525 LANG_TAMAZIGHT, 526 LANG_KASHMIRI, 527 LANG_NEPALI, 528 LANG_FRISIAN, 529 LANG_PASHTO, 530 LANG_FILIPINO, 531 LANG_DIVEHI, // = 0x65 532 LANG_HAUSA = 0x68, 533 LANG_YORUBA = 0x6A, 534 LANG_QUECHUA, 535 LANG_SOTHO, 536 LANG_BASHKIR, 537 LANG_LUXEMBOURGISH, 538 LANG_GREENLANDIC, 539 LANG_IGBO, // = 0x70 540 LANG_TIGRIGNA = 0x73, 541 LANG_YI = 0x78, 542 LANG_MAPUDUNGUN = 0x7A, 543 LANG_MOHAWK = 0x7C, 544 LANG_BRETON = 0x7E, 545 LANG_UIGHUR = 0x80, 546 LANG_MAORI, 547 LANG_OCCITAN, 548 LANG_CORSICAN, 549 LANG_ALSATIAN, 550 LANG_YAKUT, 551 LANG_KICHE, 552 LANG_KINYARWANDA, 553 LANG_WOLOF, // = 0x88 554 LANG_DARI = 0x8C, 555 LANG_MALAGASY, // = 0x8D 556 557 LANG_SERBIAN_NEUTRAL = 0x7C1A, 558 LANG_BOSNIAN_NEUTRAL = 0x781A, 559 560 LANG_INVARIANT = 0x7F 561 } 562 563 564 // Sublanguage identifiers 565 enum : USHORT { 566 SUBLANG_NEUTRAL, 567 SUBLANG_DEFAULT, 568 SUBLANG_SYS_DEFAULT, 569 SUBLANG_CUSTOM_DEFAULT, // = 3 570 SUBLANG_UI_CUSTOM_DEFAULT = 3, 571 SUBLANG_CUSTOM_UNSPECIFIED, // = 4 572 573 SUBLANG_AFRIKAANS_SOUTH_AFRICA = 1, 574 SUBLANG_ALBANIAN_ALBANIA = 1, 575 SUBLANG_ALSATIAN_FRANCE = 1, 576 SUBLANG_AMHARIC_ETHIOPIA = 1, 577 578 SUBLANG_ARABIC_SAUDI_ARABIA = 1, 579 SUBLANG_ARABIC_IRAQ, 580 SUBLANG_ARABIC_EGYPT, 581 SUBLANG_ARABIC_LIBYA, 582 SUBLANG_ARABIC_ALGERIA, 583 SUBLANG_ARABIC_MOROCCO, 584 SUBLANG_ARABIC_TUNISIA, 585 SUBLANG_ARABIC_OMAN, 586 SUBLANG_ARABIC_YEMEN, 587 SUBLANG_ARABIC_SYRIA, 588 SUBLANG_ARABIC_JORDAN, 589 SUBLANG_ARABIC_LEBANON, 590 SUBLANG_ARABIC_KUWAIT, 591 SUBLANG_ARABIC_UAE, 592 SUBLANG_ARABIC_BAHRAIN, 593 SUBLANG_ARABIC_QATAR, // = 16 594 595 SUBLANG_ARMENIAN_ARMENIA = 1, 596 SUBLANG_ASSAMESE_INDIA = 1, 597 598 SUBLANG_AZERI_LATIN = 1, 599 SUBLANG_AZERI_CYRILLIC, // = 2 600 601 SUBLANG_BASHKIR_RUSSIA = 1, 602 SUBLANG_BASQUE_BASQUE = 1, 603 SUBLANG_BELARUSIAN_BELARUS = 1, 604 SUBLANG_BENGALI_INDIA = 1, 605 606 SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_LATIN = 5, 607 SUBLANG_BOSNIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 8, 608 609 SUBLANG_BRETON_FRANCE = 1, 610 SUBLANG_BULGARIAN_BULGARIA = 1, 611 SUBLANG_CATALAN_CATALAN = 1, 612 613 SUBLANG_CHINESE_TRADITIONAL = 1, 614 SUBLANG_CHINESE_SIMPLIFIED, 615 SUBLANG_CHINESE_HONGKONG, 616 SUBLANG_CHINESE_SINGAPORE, 617 SUBLANG_CHINESE_MACAU, // = 5 618 619 SUBLANG_CORSICAN_FRANCE = 1, 620 621 SUBLANG_CROATIAN_CROATIA = 1, 622 SUBLANG_CROATIAN_BOSNIA_HERZEGOVINA_LATIN = 4, 623 624 SUBLANG_CZECH_CZECH_REPUBLIC = 1, 625 SUBLANG_DANISH_DENMARK = 1, 626 SUBLANG_DIVEHI_MALDIVES = 1, 627 628 SUBLANG_DUTCH = 1, 629 SUBLANG_DUTCH_BELGIAN, // = 2 630 631 SUBLANG_ENGLISH_US = 1, 632 SUBLANG_ENGLISH_UK, 633 SUBLANG_ENGLISH_AUS, 634 SUBLANG_ENGLISH_CAN, 635 SUBLANG_ENGLISH_NZ, 636 SUBLANG_ENGLISH_EIRE, // = 6 637 SUBLANG_ENGLISH_IRELAND = 6, 638 SUBLANG_ENGLISH_SOUTH_AFRICA, 639 SUBLANG_ENGLISH_JAMAICA, 640 SUBLANG_ENGLISH_CARIBBEAN, 641 SUBLANG_ENGLISH_BELIZE, 642 SUBLANG_ENGLISH_TRINIDAD, 643 SUBLANG_ENGLISH_ZIMBABWE, 644 SUBLANG_ENGLISH_PHILIPPINES, // = 13 645 SUBLANG_ENGLISH_INDIA = 16, 646 SUBLANG_ENGLISH_MALAYSIA, 647 SUBLANG_ENGLISH_SINGAPORE, // = 18 648 649 SUBLANG_ESTONIAN_ESTONIA = 1, 650 SUBLANG_FAEROESE_FAROE_ISLANDS = 1, 651 SUBLANG_FILIPINO_PHILIPPINES = 1, 652 SUBLANG_FINNISH_FINLAND = 1, 653 654 SUBLANG_FRENCH = 1, 655 SUBLANG_FRENCH_BELGIAN, 656 SUBLANG_FRENCH_CANADIAN, 657 SUBLANG_FRENCH_SWISS, 658 SUBLANG_FRENCH_LUXEMBOURG, 659 SUBLANG_FRENCH_MONACO, // = 6 660 661 SUBLANG_FRISIAN_NETHERLANDS = 1, 662 SUBLANG_GALICIAN_GALICIAN = 1, 663 SUBLANG_GEORGIAN_GEORGIA = 1, 664 665 SUBLANG_GERMAN = 1, 666 SUBLANG_GERMAN_SWISS, 667 SUBLANG_GERMAN_AUSTRIAN, 668 SUBLANG_GERMAN_LUXEMBOURG, 669 SUBLANG_GERMAN_LIECHTENSTEIN, // = 5 670 671 SUBLANG_GREEK_GREECE = 1, 672 SUBLANG_GREENLANDIC_GREENLAND = 1, 673 SUBLANG_GUJARATI_INDIA = 1, 674 SUBLANG_HAUSA_NIGERIA = 1, 675 SUBLANG_HEBREW_ISRAEL = 1, 676 SUBLANG_HINDI_INDIA = 1, 677 SUBLANG_HUNGARIAN_HUNGARY = 1, 678 SUBLANG_ICELANDIC_ICELAND = 1, 679 SUBLANG_IGBO_NIGERIA = 1, 680 SUBLANG_INDONESIAN_INDONESIA = 1, 681 682 SUBLANG_INUKTITUT_CANADA = 1, 683 SUBLANG_INUKTITUT_CANADA_LATIN = 1, 684 685 SUBLANG_IRISH_IRELAND = 1, 686 687 SUBLANG_ITALIAN = 1, 688 SUBLANG_ITALIAN_SWISS, // = 2 689 690 SUBLANG_JAPANESE_JAPAN = 1, 691 692 SUBLANG_KASHMIRI_INDIA = 2, 693 SUBLANG_KASHMIRI_SASIA = 2, 694 695 SUBLANG_KAZAK_KAZAKHSTAN = 1, 696 SUBLANG_KHMER_CAMBODIA = 1, 697 SUBLANG_KICHE_GUATEMALA = 1, 698 SUBLANG_KINYARWANDA_RWANDA = 1, 699 SUBLANG_KONKANI_INDIA = 1, 700 SUBLANG_KOREAN = 1, 701 SUBLANG_KYRGYZ_KYRGYZSTAN = 1, 702 SUBLANG_LAO_LAO_PDR = 1, 703 SUBLANG_LATVIAN_LATVIA = 1, 704 705 SUBLANG_LITHUANIAN = 1, 706 SUBLANG_LITHUANIAN_LITHUANIA = 1, 707 708 SUBLANG_LOWER_SORBIAN_GERMANY = 1, 709 SUBLANG_LUXEMBOURGISH_LUXEMBOURG = 1, 710 SUBLANG_MACEDONIAN_MACEDONIA = 1, 711 SUBLANG_MALAYALAM_INDIA = 1, 712 SUBLANG_MALTESE_MALTA = 1, 713 SUBLANG_MAORI_NEW_ZEALAND = 1, 714 SUBLANG_MAPUDUNGUN_CHILE = 1, 715 SUBLANG_MARATHI_INDIA = 1, 716 SUBLANG_MOHAWK_MOHAWK = 1, 717 718 SUBLANG_MONGOLIAN_CYRILLIC_MONGOLIA = 1, 719 SUBLANG_MONGOLIAN_PRC, // = 2 720 721 SUBLANG_MALAY_MALAYSIA = 1, 722 SUBLANG_MALAY_BRUNEI_DARUSSALAM, // = 2 723 724 SUBLANG_NEPALI_NEPAL = 1, 725 SUBLANG_NEPALI_INDIA, // = 2 726 727 SUBLANG_NORWEGIAN_BOKMAL = 1, 728 SUBLANG_NORWEGIAN_NYNORSK, // = 2 729 730 SUBLANG_OCCITAN_FRANCE = 1, 731 SUBLANG_ORIYA_INDIA = 1, 732 SUBLANG_PASHTO_AFGHANISTAN = 1, 733 SUBLANG_PERSIAN_IRAN = 1, 734 SUBLANG_POLISH_POLAND = 1, 735 736 SUBLANG_PORTUGUESE_BRAZILIAN = 1, 737 SUBLANG_PORTUGUESE = 2, 738 SUBLANG_PORTUGUESE_PORTUGAL, // = 2 739 740 SUBLANG_PUNJABI_INDIA = 1, 741 742 SUBLANG_QUECHUA_BOLIVIA = 1, 743 SUBLANG_QUECHUA_ECUADOR, 744 SUBLANG_QUECHUA_PERU, // = 3 745 746 SUBLANG_ROMANIAN_ROMANIA = 1, 747 SUBLANG_ROMANSH_SWITZERLAND = 1, 748 SUBLANG_RUSSIAN_RUSSIA = 1, 749 750 SUBLANG_SAMI_NORTHERN_NORWAY = 1, 751 SUBLANG_SAMI_NORTHERN_SWEDEN, 752 SUBLANG_SAMI_NORTHERN_FINLAND, // = 3 753 SUBLANG_SAMI_SKOLT_FINLAND = 3, 754 SUBLANG_SAMI_INARI_FINLAND = 3, 755 SUBLANG_SAMI_LULE_NORWAY, 756 SUBLANG_SAMI_LULE_SWEDEN, 757 SUBLANG_SAMI_SOUTHERN_NORWAY, 758 SUBLANG_SAMI_SOUTHERN_SWEDEN, // = 7 759 760 SUBLANG_SANSKRIT_INDIA = 1, 761 762 SUBLANG_SERBIAN_LATIN = 2, 763 SUBLANG_SERBIAN_CYRILLIC, // = 3 764 SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_LATIN = 6, 765 SUBLANG_SERBIAN_BOSNIA_HERZEGOVINA_CYRILLIC = 7, 766 767 SUBLANG_SINDHI_AFGHANISTAN = 2, 768 SUBLANG_SINHALESE_SRI_LANKA = 1, 769 SUBLANG_SOTHO_NORTHERN_SOUTH_AFRICA = 1, 770 SUBLANG_SLOVAK_SLOVAKIA = 1, 771 SUBLANG_SLOVENIAN_SLOVENIA = 1, 772 773 SUBLANG_SPANISH = 1, 774 SUBLANG_SPANISH_MEXICAN, 775 SUBLANG_SPANISH_MODERN, 776 SUBLANG_SPANISH_GUATEMALA, 777 SUBLANG_SPANISH_COSTA_RICA, 778 SUBLANG_SPANISH_PANAMA, 779 SUBLANG_SPANISH_DOMINICAN_REPUBLIC, 780 SUBLANG_SPANISH_VENEZUELA, 781 SUBLANG_SPANISH_COLOMBIA, 782 SUBLANG_SPANISH_PERU, 783 SUBLANG_SPANISH_ARGENTINA, 784 SUBLANG_SPANISH_ECUADOR, 785 SUBLANG_SPANISH_CHILE, 786 SUBLANG_SPANISH_URUGUAY, 787 SUBLANG_SPANISH_PARAGUAY, 788 SUBLANG_SPANISH_BOLIVIA, 789 SUBLANG_SPANISH_EL_SALVADOR, 790 SUBLANG_SPANISH_HONDURAS, 791 SUBLANG_SPANISH_NICARAGUA, 792 SUBLANG_SPANISH_PUERTO_RICO, 793 SUBLANG_SPANISH_US, // = 21 794 795 SUBLANG_SWEDISH = 1, 796 SUBLANG_SWEDISH_SWEDEN = 1, 797 SUBLANG_SWEDISH_FINLAND, // = 2 798 799 SUBLANG_SYRIAC = 1, 800 SUBLANG_TAJIK_TAJIKISTAN = 1, 801 SUBLANG_TAMAZIGHT_ALGERIA_LATIN = 2, 802 SUBLANG_TAMIL_INDIA = 1, 803 SUBLANG_TATAR_RUSSIA = 1, 804 SUBLANG_TELUGU_INDIA = 1, 805 SUBLANG_THAI_THAILAND = 1, 806 SUBLANG_TIBETAN_PRC = 1, 807 SUBLANG_TIBETAN_BHUTAN = 2, 808 SUBLANG_TIGRIGNA_ERITREA = 1, 809 SUBLANG_TSWANA_SOUTH_AFRICA = 1, 810 SUBLANG_TURKISH_TURKEY = 1, 811 SUBLANG_TURKMEN_TURKMENISTAN = 1, 812 SUBLANG_UIGHUR_PRC = 1, 813 SUBLANG_UKRAINIAN_UKRAINE = 1, 814 SUBLANG_UPPER_SORBIAN_GERMANY = 1, 815 816 SUBLANG_URDU_PAKISTAN = 1, 817 SUBLANG_URDU_INDIA, // = 2 818 819 SUBLANG_UZBEK_LATIN = 1, 820 SUBLANG_UZBEK_CYRILLIC, // = 2 821 822 SUBLANG_VIETNAMESE_VIETNAM = 1, 823 SUBLANG_WELSH_UNITED_KINGDOM = 1, 824 SUBLANG_WOLOF_SENEGAL = 1, 825 SUBLANG_YORUBA_NIGERIA = 1, 826 SUBLANG_XHOSA_SOUTH_AFRICA = 1, 827 SUBLANG_YAKUT_RUSSIA = 1, 828 SUBLANG_YI_PRC = 1, 829 SUBLANG_ZULU_SOUTH_AFRICA = 1 830 } 831 832 // This is not documented on MSDN 833 const NLS_VALID_LOCALE_MASK = 1048575; 834 835 // Sorting identifiers 836 enum : WORD { 837 SORT_DEFAULT = 0, 838 SORT_JAPANESE_XJIS = 0, 839 SORT_JAPANESE_UNICODE = 1, 840 SORT_CHINESE_BIG5 = 0, 841 SORT_CHINESE_PRCP = 0, 842 SORT_CHINESE_UNICODE = 1, 843 SORT_CHINESE_PRC = 2, 844 SORT_CHINESE_BOPOMOFO = 3, 845 SORT_KOREAN_KSC = 0, 846 SORT_KOREAN_UNICODE = 1, 847 SORT_GERMAN_PHONE_BOOK = 1, 848 SORT_HUNGARIAN_DEFAULT = 0, 849 SORT_HUNGARIAN_TECHNICAL = 1, 850 SORT_GEORGIAN_TRADITIONAL = 0, 851 SORT_GEORGIAN_MODERN = 1 852 } 853 854 WORD MAKELANGID(USHORT p, USHORT s) { return cast(WORD)((s << 10) | p); } 855 WORD PRIMARYLANGID(WORD lgid) { return cast(WORD)(lgid & 0x3FF); } 856 WORD SUBLANGID(WORD lgid) { return cast(WORD)(lgid >>> 10); } 857 858 DWORD MAKELCID(WORD lgid, WORD srtid) { return (cast(DWORD) srtid << 16) | cast(DWORD) lgid; } 859 // ??? 860 //DWORD MAKESORTLCID(WORD lgid, WORD srtid, WORD ver) { return (MAKELCID(lgid, srtid)) | ((cast(DWORD)ver) << 20); } 861 WORD LANGIDFROMLCID(LCID lcid) { return cast(WORD) lcid; } 862 WORD SORTIDFROMLCID(LCID lcid) { return cast(WORD) ((lcid >>> 16) & 0x0F); } 863 WORD SORTVERSIONFROMLCID(LCID lcid) { return cast(WORD) ((lcid >>> 20) & 0x0F); } 864 865 const WORD LANG_SYSTEM_DEFAULT = (SUBLANG_SYS_DEFAULT << 10) | LANG_NEUTRAL; 866 const WORD LANG_USER_DEFAULT = (SUBLANG_DEFAULT << 10) | LANG_NEUTRAL; 867 const DWORD LOCALE_NEUTRAL = (SORT_DEFAULT << 16) 868 | (SUBLANG_NEUTRAL << 10) | LANG_NEUTRAL; 869 870 // --- 871 enum : BYTE { 872 ACL_REVISION = 2, 873 ACL_REVISION_DS = 4 874 } 875 876 // These are not documented on MSDN 877 enum : BYTE { 878 ACL_REVISION1 = 1, 879 ACL_REVISION2, 880 ACL_REVISION3, 881 ACL_REVISION4 // = 4 882 } 883 884 const BYTE 885 MIN_ACL_REVISION = 2, 886 MAX_ACL_REVISION = 4; 887 888 /+ 889 // These aren't necessary for D. 890 const MINCHAR=0x80; 891 const MAXCHAR=0x7f; 892 const MINSHORT=0x8000; 893 const MAXSHORT=0x7fff; 894 const MINLONG=0x80000000; 895 const MAXLONG=0x7fffffff; 896 const MAXBYTE=0xff; 897 const MAXWORD=0xffff; 898 const MAXDWORD=0xffffffff; 899 +/ 900 901 // SYSTEM_INFO.dwProcessorType 902 enum : DWORD { 903 PROCESSOR_INTEL_386 = 386, 904 PROCESSOR_INTEL_486 = 486, 905 PROCESSOR_INTEL_PENTIUM = 586, 906 PROCESSOR_MIPS_R4000 = 4000, 907 PROCESSOR_ALPHA_21064 = 21064, 908 PROCESSOR_INTEL_IA64 = 2200 909 } 910 911 // SYSTEM_INFO.wProcessorArchitecture 912 enum : WORD { 913 PROCESSOR_ARCHITECTURE_INTEL, 914 PROCESSOR_ARCHITECTURE_MIPS, 915 PROCESSOR_ARCHITECTURE_ALPHA, 916 PROCESSOR_ARCHITECTURE_PPC, 917 PROCESSOR_ARCHITECTURE_SHX, 918 PROCESSOR_ARCHITECTURE_ARM, 919 PROCESSOR_ARCHITECTURE_IA64, 920 PROCESSOR_ARCHITECTURE_ALPHA64, 921 PROCESSOR_ARCHITECTURE_MSIL, 922 PROCESSOR_ARCHITECTURE_AMD64, 923 PROCESSOR_ARCHITECTURE_IA32_ON_WIN64, // = 10 924 PROCESSOR_ARCHITECTURE_UNKNOWN = 0xFFFF 925 } 926 927 // IsProcessorFeaturePresent() 928 enum : DWORD { 929 PF_FLOATING_POINT_PRECISION_ERRATA, 930 PF_FLOATING_POINT_EMULATED, 931 PF_COMPARE_EXCHANGE_DOUBLE, 932 PF_MMX_INSTRUCTIONS_AVAILABLE, 933 PF_PPC_MOVEMEM_64BIT_OK, 934 PF_ALPHA_BYTE_INSTRUCTIONS, 935 PF_XMMI_INSTRUCTIONS_AVAILABLE, 936 PF_3DNOW_INSTRUCTIONS_AVAILABLE, 937 PF_RDTSC_INSTRUCTION_AVAILABLE, 938 PF_PAE_ENABLED, 939 PF_XMMI64_INSTRUCTIONS_AVAILABLE 940 } 941 942 // MinGW: also in ddk/ntifs.h 943 enum : DWORD { 944 FILE_ACTION_ADDED = 1, 945 FILE_ACTION_REMOVED, 946 FILE_ACTION_MODIFIED, 947 FILE_ACTION_RENAMED_OLD_NAME, 948 FILE_ACTION_RENAMED_NEW_NAME, 949 FILE_ACTION_ADDED_STREAM, 950 FILE_ACTION_REMOVED_STREAM, 951 FILE_ACTION_MODIFIED_STREAM, 952 FILE_ACTION_REMOVED_BY_DELETE, 953 FILE_ACTION_ID_NOT_TUNNELLED, 954 FILE_ACTION_TUNNELLED_ID_COLLISION // = 11 955 } 956 // MinGW: end ntifs.h 957 958 const DWORD 959 HEAP_NO_SERIALIZE = 0x01, 960 HEAP_GROWABLE = 0x02, 961 HEAP_GENERATE_EXCEPTIONS = 0x04, 962 HEAP_ZERO_MEMORY = 0x08, 963 HEAP_REALLOC_IN_PLACE_ONLY = 0x10, 964 HEAP_TAIL_CHECKING_ENABLED = 0x20, 965 HEAP_FREE_CHECKING_ENABLED = 0x40, 966 HEAP_DISABLE_COALESCE_ON_FREE = 0x80; 967 968 // These are not documented on MSDN 969 const HEAP_CREATE_ALIGN_16 = 0; 970 const HEAP_CREATE_ENABLE_TRACING = 0x020000; 971 const HEAP_MAXIMUM_TAG = 0x000FFF; 972 const HEAP_PSEUDO_TAG_FLAG = 0x008000; 973 const HEAP_TAG_SHIFT = 16; 974 // ??? 975 //MACRO #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16))) 976 977 const ACCESS_MASK 978 KEY_QUERY_VALUE = 0x000001, 979 KEY_SET_VALUE = 0x000002, 980 KEY_CREATE_SUB_KEY = 0x000004, 981 KEY_ENUMERATE_SUB_KEYS = 0x000008, 982 KEY_NOTIFY = 0x000010, 983 KEY_CREATE_LINK = 0x000020, 984 KEY_WRITE = 0x020006, 985 KEY_EXECUTE = 0x020019, 986 KEY_READ = 0x020019, 987 KEY_ALL_ACCESS = 0x0F003F; 988 989 static if (_WIN32_WINNT >= 0x502) { 990 const ACCESS_MASK 991 KEY_WOW64_64KEY = 0x000100, 992 KEY_WOW64_32KEY = 0x000200; 993 } 994 995 const DWORD 996 REG_WHOLE_HIVE_VOLATILE = 1, 997 REG_REFRESH_HIVE = 2, 998 REG_NO_LAZY_FLUSH = 4; 999 1000 const DWORD 1001 REG_OPTION_RESERVED = 0, 1002 REG_OPTION_NON_VOLATILE = 0, 1003 REG_OPTION_VOLATILE = 1, 1004 REG_OPTION_CREATE_LINK = 2, 1005 REG_OPTION_BACKUP_RESTORE = 4, 1006 REG_OPTION_OPEN_LINK = 8, 1007 REG_LEGAL_OPTION = 15; 1008 1009 const SECURITY_INFORMATION 1010 OWNER_SECURITY_INFORMATION = 0x00000001, 1011 GROUP_SECURITY_INFORMATION = 0x00000002, 1012 DACL_SECURITY_INFORMATION = 0x00000004, 1013 SACL_SECURITY_INFORMATION = 0x00000008, 1014 LABEL_SECURITY_INFORMATION = 0x00000010, 1015 UNPROTECTED_SACL_SECURITY_INFORMATION = 0x10000000, 1016 UNPROTECTED_DACL_SECURITY_INFORMATION = 0x20000000, 1017 PROTECTED_SACL_SECURITY_INFORMATION = 0x40000000, 1018 PROTECTED_DACL_SECURITY_INFORMATION = 0x80000000; 1019 1020 const DWORD MAXIMUM_PROCESSORS = 32; 1021 1022 // VirtualAlloc(), etc 1023 // ------------------- 1024 1025 enum : DWORD { 1026 PAGE_NOACCESS = 0x0001, 1027 PAGE_READONLY = 0x0002, 1028 PAGE_READWRITE = 0x0004, 1029 PAGE_WRITECOPY = 0x0008, 1030 PAGE_EXECUTE = 0x0010, 1031 PAGE_EXECUTE_READ = 0x0020, 1032 PAGE_EXECUTE_READWRITE = 0x0040, 1033 PAGE_EXECUTE_WRITECOPY = 0x0080, 1034 PAGE_GUARD = 0x0100, 1035 PAGE_NOCACHE = 0x0200 1036 } 1037 1038 enum : DWORD { 1039 MEM_COMMIT = 0x00001000, 1040 MEM_RESERVE = 0x00002000, 1041 MEM_DECOMMIT = 0x00004000, 1042 MEM_RELEASE = 0x00008000, 1043 MEM_FREE = 0x00010000, 1044 MEM_PRIVATE = 0x00020000, 1045 MEM_MAPPED = 0x00040000, 1046 MEM_RESET = 0x00080000, 1047 MEM_TOP_DOWN = 0x00100000, 1048 MEM_WRITE_WATCH = 0x00200000, // MinGW (???): 98/Me 1049 MEM_PHYSICAL = 0x00400000, 1050 MEM_4MB_PAGES = 0x80000000 1051 } 1052 1053 // MinGW: also in ddk/ntifs.h 1054 // CreateFileMapping() 1055 const DWORD 1056 SEC_BASED = 0x00200000, 1057 SEC_NO_CHANGE = 0x00400000, 1058 SEC_FILE = 0x00800000, 1059 SEC_IMAGE = 0x01000000, 1060 SEC_VLM = 0x02000000, 1061 SEC_RESERVE = 0x04000000, 1062 SEC_COMMIT = 0x08000000, 1063 SEC_NOCACHE = 0x10000000, 1064 MEM_IMAGE = SEC_IMAGE; 1065 // MinGW: end ntifs.h 1066 1067 // ??? 1068 const ACCESS_MASK 1069 SECTION_QUERY = 0x000001, 1070 SECTION_MAP_WRITE = 0x000002, 1071 SECTION_MAP_READ = 0x000004, 1072 SECTION_MAP_EXECUTE = 0x000008, 1073 SECTION_EXTEND_SIZE = 0x000010, 1074 SECTION_ALL_ACCESS = 0x0F001F; 1075 1076 // These are not documented on MSDN 1077 const MESSAGE_RESOURCE_UNICODE = 1; 1078 const RTL_CRITSECT_TYPE = 0; 1079 const RTL_RESOURCE_TYPE = 1; 1080 1081 // COFF file format 1082 // ---------------- 1083 1084 // IMAGE_FILE_HEADER.Characteristics 1085 const WORD 1086 IMAGE_FILE_RELOCS_STRIPPED = 0x0001, 1087 IMAGE_FILE_EXECUTABLE_IMAGE = 0x0002, 1088 IMAGE_FILE_LINE_NUMS_STRIPPED = 0x0004, 1089 IMAGE_FILE_LOCAL_SYMS_STRIPPED = 0x0008, 1090 IMAGE_FILE_AGGRESIVE_WS_TRIM = 0x0010, 1091 IMAGE_FILE_LARGE_ADDRESS_AWARE = 0x0020, 1092 IMAGE_FILE_BYTES_REVERSED_LO = 0x0080, 1093 IMAGE_FILE_32BIT_MACHINE = 0x0100, 1094 IMAGE_FILE_DEBUG_STRIPPED = 0x0200, 1095 IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP = 0x0400, 1096 IMAGE_FILE_NET_RUN_FROM_SWAP = 0x0800, 1097 IMAGE_FILE_SYSTEM = 0x1000, 1098 IMAGE_FILE_DLL = 0x2000, 1099 IMAGE_FILE_UP_SYSTEM_ONLY = 0x4000, 1100 IMAGE_FILE_BYTES_REVERSED_HI = 0x8000; 1101 1102 // IMAGE_FILE_HEADER.Machine 1103 enum : WORD { 1104 IMAGE_FILE_MACHINE_UNKNOWN = 0x0000, 1105 IMAGE_FILE_MACHINE_I386 = 0x014C, 1106 IMAGE_FILE_MACHINE_R3000 = 0x0162, 1107 IMAGE_FILE_MACHINE_R4000 = 0x0166, 1108 IMAGE_FILE_MACHINE_R10000 = 0x0168, 1109 IMAGE_FILE_MACHINE_WCEMIPSV2 = 0x0169, 1110 IMAGE_FILE_MACHINE_ALPHA = 0x0184, 1111 IMAGE_FILE_MACHINE_SH3 = 0x01A2, 1112 IMAGE_FILE_MACHINE_SH3DSP = 0x01A3, 1113 IMAGE_FILE_MACHINE_SH4 = 0x01A6, 1114 IMAGE_FILE_MACHINE_SH5 = 0x01A8, 1115 IMAGE_FILE_MACHINE_ARM = 0x01C0, 1116 IMAGE_FILE_MACHINE_THUMB = 0x01C2, 1117 IMAGE_FILE_MACHINE_AM33 = 0x01D3, 1118 IMAGE_FILE_MACHINE_POWERPC = 0x01F0, 1119 IMAGE_FILE_MACHINE_POWERPCFP = 0x01F1, 1120 IMAGE_FILE_MACHINE_IA64 = 0x0200, 1121 IMAGE_FILE_MACHINE_MIPS16 = 0x0266, 1122 IMAGE_FILE_MACHINE_MIPSFPU = 0x0366, 1123 IMAGE_FILE_MACHINE_MIPSFPU16 = 0x0466, 1124 IMAGE_FILE_MACHINE_EBC = 0x0EBC, 1125 IMAGE_FILE_MACHINE_AMD64 = 0x8664, 1126 IMAGE_FILE_MACHINE_M32R = 0x9041 1127 } 1128 1129 // ??? 1130 enum { 1131 IMAGE_DOS_SIGNATURE = 0x5A4D, 1132 IMAGE_OS2_SIGNATURE = 0x454E, 1133 IMAGE_OS2_SIGNATURE_LE = 0x454C, 1134 IMAGE_VXD_SIGNATURE = 0x454C, 1135 IMAGE_NT_SIGNATURE = 0x4550 1136 } 1137 1138 // IMAGE_OPTIONAL_HEADER.Magic 1139 enum : WORD { 1140 IMAGE_NT_OPTIONAL_HDR32_MAGIC = 0x010B, 1141 IMAGE_ROM_OPTIONAL_HDR_MAGIC = 0x0107, 1142 IMAGE_NT_OPTIONAL_HDR64_MAGIC = 0x020B 1143 } 1144 1145 // IMAGE_OPTIONAL_HEADER.Subsystem 1146 enum : WORD { 1147 IMAGE_SUBSYSTEM_UNKNOWN = 0, 1148 IMAGE_SUBSYSTEM_NATIVE, 1149 IMAGE_SUBSYSTEM_WINDOWS_GUI, 1150 IMAGE_SUBSYSTEM_WINDOWS_CUI, // = 3 1151 IMAGE_SUBSYSTEM_OS2_CUI = 5, 1152 IMAGE_SUBSYSTEM_POSIX_CUI = 7, 1153 IMAGE_SUBSYSTEM_NATIVE_WINDOWS, 1154 IMAGE_SUBSYSTEM_WINDOWS_CE_GUI, 1155 IMAGE_SUBSYSTEM_EFI_APPLICATION, 1156 IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER, 1157 IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER, 1158 IMAGE_SUBSYSTEM_EFI_ROM, 1159 IMAGE_SUBSYSTEM_XBOX, // = 14 1160 IMAGE_SUBSYSTEM_WINDOWS_BOOT_APPLICATION = 16 1161 } 1162 1163 // IMAGE_OPTIONAL_HEADER.DllCharacteristics 1164 const WORD 1165 IMAGE_DLL_CHARACTERISTICS_DYNAMIC_BASE = 0x0040, 1166 IMAGE_DLL_CHARACTERISTICS_FORCE_INTEGRITY = 0x0080, 1167 IMAGE_DLL_CHARACTERISTICS_NX_COMPAT = 0x0100, 1168 IMAGE_DLLCHARACTERISTICS_NO_ISOLATION = 0x0200, 1169 IMAGE_DLLCHARACTERISTICS_NO_SEH = 0x0400, 1170 IMAGE_DLLCHARACTERISTICS_NO_BIND = 0x0800, 1171 IMAGE_DLLCHARACTERISTICS_WDM_DRIVER = 0x2000, 1172 IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE = 0x8000; 1173 1174 // ??? 1175 const IMAGE_SEPARATE_DEBUG_SIGNATURE = 0x4944; 1176 1177 const size_t 1178 IMAGE_NUMBEROF_DIRECTORY_ENTRIES = 16, 1179 IMAGE_SIZEOF_ROM_OPTIONAL_HEADER = 56, 1180 IMAGE_SIZEOF_STD_OPTIONAL_HEADER = 28, 1181 IMAGE_SIZEOF_NT_OPTIONAL_HEADER = 224, 1182 IMAGE_SIZEOF_SHORT_NAME = 8, 1183 IMAGE_SIZEOF_SECTION_HEADER = 40, 1184 IMAGE_SIZEOF_SYMBOL = 18, 1185 IMAGE_SIZEOF_AUX_SYMBOL = 18, 1186 IMAGE_SIZEOF_RELOCATION = 10, 1187 IMAGE_SIZEOF_BASE_RELOCATION = 8, 1188 IMAGE_SIZEOF_LINENUMBER = 6, 1189 IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR = 60, 1190 SIZEOF_RFPO_DATA = 16; 1191 1192 PIMAGE_SECTION_HEADER IMAGE_FIRST_SECTION(PIMAGE_NT_HEADERS h) { 1193 return cast(PIMAGE_SECTION_HEADER) 1194 (&h.OptionalHeader + h.FileHeader.SizeOfOptionalHeader); 1195 } 1196 1197 // ImageDirectoryEntryToDataEx() 1198 enum : USHORT { 1199 IMAGE_DIRECTORY_ENTRY_EXPORT = 0, 1200 IMAGE_DIRECTORY_ENTRY_IMPORT, 1201 IMAGE_DIRECTORY_ENTRY_RESOURCE, 1202 IMAGE_DIRECTORY_ENTRY_EXCEPTION, 1203 IMAGE_DIRECTORY_ENTRY_SECURITY, 1204 IMAGE_DIRECTORY_ENTRY_BASERELOC, 1205 IMAGE_DIRECTORY_ENTRY_DEBUG, 1206 IMAGE_DIRECTORY_ENTRY_COPYRIGHT, // = 7 1207 IMAGE_DIRECTORY_ENTRY_ARCHITECTURE = 7, 1208 IMAGE_DIRECTORY_ENTRY_GLOBALPTR, 1209 IMAGE_DIRECTORY_ENTRY_TLS, 1210 IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG, 1211 IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT, 1212 IMAGE_DIRECTORY_ENTRY_IAT, 1213 IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT, 1214 IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR, // = 14 1215 } 1216 1217 // IMAGE_SECTION_HEADER.Characteristics 1218 const DWORD 1219 IMAGE_SCN_TYPE_REG = 0x00000000, 1220 IMAGE_SCN_TYPE_DSECT = 0x00000001, 1221 IMAGE_SCN_TYPE_NOLOAD = 0x00000002, 1222 IMAGE_SCN_TYPE_GROUP = 0x00000004, 1223 IMAGE_SCN_TYPE_NO_PAD = 0x00000008, 1224 IMAGE_SCN_TYPE_COPY = 0x00000010, 1225 IMAGE_SCN_CNT_CODE = 0x00000020, 1226 IMAGE_SCN_CNT_INITIALIZED_DATA = 0x00000040, 1227 IMAGE_SCN_CNT_UNINITIALIZED_DATA = 0x00000080, 1228 IMAGE_SCN_LNK_OTHER = 0x00000100, 1229 IMAGE_SCN_LNK_INFO = 0x00000200, 1230 IMAGE_SCN_TYPE_OVER = 0x00000400, 1231 IMAGE_SCN_LNK_REMOVE = 0x00000800, 1232 IMAGE_SCN_LNK_COMDAT = 0x00001000, 1233 IMAGE_SCN_MEM_FARDATA = 0x00008000, 1234 IMAGE_SCN_GPREL = 0x00008000, 1235 IMAGE_SCN_MEM_PURGEABLE = 0x00020000, 1236 IMAGE_SCN_MEM_16BIT = 0x00020000, 1237 IMAGE_SCN_MEM_LOCKED = 0x00040000, 1238 IMAGE_SCN_MEM_PRELOAD = 0x00080000, 1239 IMAGE_SCN_ALIGN_1BYTES = 0x00100000, 1240 IMAGE_SCN_ALIGN_2BYTES = 0x00200000, 1241 IMAGE_SCN_ALIGN_4BYTES = 0x00300000, 1242 IMAGE_SCN_ALIGN_8BYTES = 0x00400000, 1243 IMAGE_SCN_ALIGN_16BYTES = 0x00500000, 1244 IMAGE_SCN_ALIGN_32BYTES = 0x00600000, 1245 IMAGE_SCN_ALIGN_64BYTES = 0x00700000, 1246 IMAGE_SCN_ALIGN_128BYTES = 0x00800000, 1247 IMAGE_SCN_ALIGN_256BYTES = 0x00900000, 1248 IMAGE_SCN_ALIGN_512BYTES = 0x00A00000, 1249 IMAGE_SCN_ALIGN_1024BYTES = 0x00B00000, 1250 IMAGE_SCN_ALIGN_2048BYTES = 0x00C00000, 1251 IMAGE_SCN_ALIGN_4096BYTES = 0x00D00000, 1252 IMAGE_SCN_ALIGN_8192BYTES = 0x00E00000, 1253 IMAGE_SCN_LNK_NRELOC_OVFL = 0x01000000, 1254 IMAGE_SCN_MEM_DISCARDABLE = 0x02000000, 1255 IMAGE_SCN_MEM_NOT_CACHED = 0x04000000, 1256 IMAGE_SCN_MEM_NOT_PAGED = 0x08000000, 1257 IMAGE_SCN_MEM_SHARED = 0x10000000, 1258 IMAGE_SCN_MEM_EXECUTE = 0x20000000, 1259 IMAGE_SCN_MEM_READ = 0x40000000, 1260 IMAGE_SCN_MEM_WRITE = 0x80000000; 1261 1262 /* The following constants are mostlydocumented at 1263 * http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/pecoff.doc 1264 * but don't seem to be defined in the HTML docs. 1265 */ 1266 enum : SHORT { 1267 IMAGE_SYM_UNDEFINED = 0, 1268 IMAGE_SYM_ABSOLUTE = -1, 1269 IMAGE_SYM_DEBUG = -2 1270 } 1271 1272 enum : ubyte { 1273 IMAGE_SYM_TYPE_NULL, 1274 IMAGE_SYM_TYPE_VOID, 1275 IMAGE_SYM_TYPE_CHAR, 1276 IMAGE_SYM_TYPE_SHORT, 1277 IMAGE_SYM_TYPE_INT, 1278 IMAGE_SYM_TYPE_LONG, 1279 IMAGE_SYM_TYPE_FLOAT, 1280 IMAGE_SYM_TYPE_DOUBLE, 1281 IMAGE_SYM_TYPE_STRUCT, 1282 IMAGE_SYM_TYPE_UNION, 1283 IMAGE_SYM_TYPE_ENUM, 1284 IMAGE_SYM_TYPE_MOE, 1285 IMAGE_SYM_TYPE_BYTE, 1286 IMAGE_SYM_TYPE_WORD, 1287 IMAGE_SYM_TYPE_UINT, 1288 IMAGE_SYM_TYPE_DWORD // = 15 1289 } 1290 const IMAGE_SYM_TYPE_PCODE = 32768; // ??? 1291 1292 enum : ubyte { 1293 IMAGE_SYM_DTYPE_NULL, 1294 IMAGE_SYM_DTYPE_POINTER, 1295 IMAGE_SYM_DTYPE_FUNCTION, 1296 IMAGE_SYM_DTYPE_ARRAY 1297 } 1298 1299 enum : BYTE { 1300 IMAGE_SYM_CLASS_END_OF_FUNCTION = 0xFF, 1301 IMAGE_SYM_CLASS_NULL = 0, 1302 IMAGE_SYM_CLASS_AUTOMATIC, 1303 IMAGE_SYM_CLASS_EXTERNAL, 1304 IMAGE_SYM_CLASS_STATIC, 1305 IMAGE_SYM_CLASS_REGISTER, 1306 IMAGE_SYM_CLASS_EXTERNAL_DEF, 1307 IMAGE_SYM_CLASS_LABEL, 1308 IMAGE_SYM_CLASS_UNDEFINED_LABEL, 1309 IMAGE_SYM_CLASS_MEMBER_OF_STRUCT, 1310 IMAGE_SYM_CLASS_ARGUMENT, 1311 IMAGE_SYM_CLASS_STRUCT_TAG, 1312 IMAGE_SYM_CLASS_MEMBER_OF_UNION, 1313 IMAGE_SYM_CLASS_UNION_TAG, 1314 IMAGE_SYM_CLASS_TYPE_DEFINITION, 1315 IMAGE_SYM_CLASS_UNDEFINED_STATIC, 1316 IMAGE_SYM_CLASS_ENUM_TAG, 1317 IMAGE_SYM_CLASS_MEMBER_OF_ENUM, 1318 IMAGE_SYM_CLASS_REGISTER_PARAM, 1319 IMAGE_SYM_CLASS_BIT_FIELD, // = 18 1320 IMAGE_SYM_CLASS_FAR_EXTERNAL = 68, 1321 IMAGE_SYM_CLASS_BLOCK = 100, 1322 IMAGE_SYM_CLASS_FUNCTION, 1323 IMAGE_SYM_CLASS_END_OF_STRUCT, 1324 IMAGE_SYM_CLASS_FILE, 1325 IMAGE_SYM_CLASS_SECTION, 1326 IMAGE_SYM_CLASS_WEAK_EXTERNAL,// = 105 1327 IMAGE_SYM_CLASS_CLR_TOKEN = 107 1328 } 1329 1330 enum : BYTE { 1331 IMAGE_COMDAT_SELECT_NODUPLICATES = 1, 1332 IMAGE_COMDAT_SELECT_ANY, 1333 IMAGE_COMDAT_SELECT_SAME_SIZE, 1334 IMAGE_COMDAT_SELECT_EXACT_MATCH, 1335 IMAGE_COMDAT_SELECT_ASSOCIATIVE, 1336 IMAGE_COMDAT_SELECT_LARGEST, 1337 IMAGE_COMDAT_SELECT_NEWEST // = 7 1338 } 1339 1340 enum : DWORD { 1341 IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY = 1, 1342 IMAGE_WEAK_EXTERN_SEARCH_LIBRARY, 1343 IMAGE_WEAK_EXTERN_SEARCH_ALIAS 1344 } 1345 1346 enum : WORD { 1347 IMAGE_REL_I386_ABSOLUTE = 0x0000, 1348 IMAGE_REL_I386_DIR16 = 0x0001, 1349 IMAGE_REL_I386_REL16 = 0x0002, 1350 IMAGE_REL_I386_DIR32 = 0x0006, 1351 IMAGE_REL_I386_DIR32NB = 0x0007, 1352 IMAGE_REL_I386_SEG12 = 0x0009, 1353 IMAGE_REL_I386_SECTION = 0x000A, 1354 IMAGE_REL_I386_SECREL = 0x000B, 1355 IMAGE_REL_I386_TOKEN = 0x000C, 1356 IMAGE_REL_I386_SECREL7 = 0x000D, 1357 IMAGE_REL_I386_REL32 = 0x0014 1358 } 1359 1360 enum : WORD { 1361 IMAGE_REL_AMD64_ABSOLUTE = 0x0000, 1362 IMAGE_REL_AMD64_ADDR64 = 0x0001, 1363 IMAGE_REL_AMD64_ADDR32 = 0x0002, 1364 IMAGE_REL_AMD64_ADDR32NB = 0x0003, 1365 IMAGE_REL_AMD64_REL32 = 0x0004, 1366 IMAGE_REL_AMD64_REL32_1 = 0x0005, 1367 IMAGE_REL_AMD64_REL32_2 = 0x0006, 1368 IMAGE_REL_AMD64_REL32_3 = 0x0007, 1369 IMAGE_REL_AMD64_REL32_4 = 0x0008, 1370 IMAGE_REL_AMD64_REL32_5 = 0x0009, 1371 IMAGE_REL_AMD64_SECTION = 0x000A, 1372 IMAGE_REL_AMD64_SECREL = 0x000B, 1373 IMAGE_REL_AMD64_SECREL7 = 0x000C, 1374 IMAGE_REL_AMD64_TOKEN = 0x000D, 1375 IMAGE_REL_AMD64_SREL32 = 0x000E, 1376 IMAGE_REL_AMD64_PAIR = 0x000F, 1377 IMAGE_REL_AMD64_SSPAN32 = 0x0010 1378 } 1379 1380 enum : WORD { 1381 IMAGE_REL_IA64_ABSOLUTE = 0x0000, 1382 IMAGE_REL_IA64_IMM14 = 0x0001, 1383 IMAGE_REL_IA64_IMM22 = 0x0002, 1384 IMAGE_REL_IA64_IMM64 = 0x0003, 1385 IMAGE_REL_IA64_DIR32 = 0x0004, 1386 IMAGE_REL_IA64_DIR64 = 0x0005, 1387 IMAGE_REL_IA64_PCREL21B = 0x0006, 1388 IMAGE_REL_IA64_PCREL21M = 0x0007, 1389 IMAGE_REL_IA64_PCREL21F = 0x0008, 1390 IMAGE_REL_IA64_GPREL22 = 0x0009, 1391 IMAGE_REL_IA64_LTOFF22 = 0x000A, 1392 IMAGE_REL_IA64_SECTION = 0x000B, 1393 IMAGE_REL_IA64_SECREL22 = 0x000C, 1394 IMAGE_REL_IA64_SECREL64I = 0x000D, 1395 IMAGE_REL_IA64_SECREL32 = 0x000E, 1396 IMAGE_REL_IA64_DIR32NB = 0x0010, 1397 IMAGE_REL_IA64_SREL14 = 0x0011, 1398 IMAGE_REL_IA64_SREL22 = 0x0012, 1399 IMAGE_REL_IA64_SREL32 = 0x0013, 1400 IMAGE_REL_IA64_UREL32 = 0x0014, 1401 IMAGE_REL_IA64_PCREL60X = 0x0015, 1402 IMAGE_REL_IA64_PCREL60B = 0x0016, 1403 IMAGE_REL_IA64_PCREL60F = 0x0017, 1404 IMAGE_REL_IA64_PCREL60I = 0x0018, 1405 IMAGE_REL_IA64_PCREL60M = 0x0019, 1406 IMAGE_REL_IA64_IMMGPREL64 = 0x001A, 1407 IMAGE_REL_IA64_TOKEN = 0x001B, 1408 IMAGE_REL_IA64_GPREL32 = 0x001C, 1409 IMAGE_REL_IA64_ADDEND = 0x001F 1410 } 1411 1412 enum : WORD { 1413 IMAGE_REL_SH3_ABSOLUTE = 0x0000, 1414 IMAGE_REL_SH3_DIRECT16 = 0x0001, 1415 IMAGE_REL_SH3_DIRECT32 = 0x0002, 1416 IMAGE_REL_SH3_DIRECT8 = 0x0003, 1417 IMAGE_REL_SH3_DIRECT8_WORD = 0x0004, 1418 IMAGE_REL_SH3_DIRECT8_LONG = 0x0005, 1419 IMAGE_REL_SH3_DIRECT4 = 0x0006, 1420 IMAGE_REL_SH3_DIRECT4_WORD = 0x0007, 1421 IMAGE_REL_SH3_DIRECT4_LONG = 0x0008, 1422 IMAGE_REL_SH3_PCREL8_WORD = 0x0009, 1423 IMAGE_REL_SH3_PCREL8_LONG = 0x000A, 1424 IMAGE_REL_SH3_PCREL12_WORD = 0x000B, 1425 IMAGE_REL_SH3_STARTOF_SECTION = 0x000C, 1426 IMAGE_REL_SH3_SIZEOF_SECTION = 0x000D, 1427 IMAGE_REL_SH3_SECTION = 0x000E, 1428 IMAGE_REL_SH3_SECREL = 0x000F, 1429 IMAGE_REL_SH3_DIRECT32_NB = 0x0010, 1430 IMAGE_REL_SH3_GPREL4_LONG = 0x0011, 1431 IMAGE_REL_SH3_TOKEN = 0x0012, 1432 IMAGE_REL_SHM_PCRELPT = 0x0013, 1433 IMAGE_REL_SHM_REFLO = 0x0014, 1434 IMAGE_REL_SHM_REFHALF = 0x0015, 1435 IMAGE_REL_SHM_RELLO = 0x0016, 1436 IMAGE_REL_SHM_RELHALF = 0x0017, 1437 IMAGE_REL_SHM_PAIR = 0x0018, 1438 IMAGE_REL_SHM_NOMODE = 0x8000 1439 } 1440 1441 enum : WORD { 1442 IMAGE_REL_M32R_ABSOLUTE = 0x0000, 1443 IMAGE_REL_M32R_ADDR32 = 0x0001, 1444 IMAGE_REL_M32R_ADDR32NB = 0x0002, 1445 IMAGE_REL_M32R_ADDR24 = 0x0003, 1446 IMAGE_REL_M32R_GPREL16 = 0x0004, 1447 IMAGE_REL_M32R_PCREL24 = 0x0005, 1448 IMAGE_REL_M32R_PCREL16 = 0x0006, 1449 IMAGE_REL_M32R_PCREL8 = 0x0007, 1450 IMAGE_REL_M32R_REFHALF = 0x0008, 1451 IMAGE_REL_M32R_REFHI = 0x0009, 1452 IMAGE_REL_M32R_REFLO = 0x000A, 1453 IMAGE_REL_M32R_PAIR = 0x000B, 1454 IMAGE_REL_M32R_SECTION = 0x000C, 1455 IMAGE_REL_M32R_SECREL = 0x000D, 1456 IMAGE_REL_M32R_TOKEN = 0x000E 1457 } 1458 1459 enum : WORD { 1460 IMAGE_REL_MIPS_ABSOLUTE = 0x0000, 1461 IMAGE_REL_MIPS_REFHALF = 0x0001, 1462 IMAGE_REL_MIPS_REFWORD = 0x0002, 1463 IMAGE_REL_MIPS_JMPADDR = 0x0003, 1464 IMAGE_REL_MIPS_REFHI = 0x0004, 1465 IMAGE_REL_MIPS_REFLO = 0x0005, 1466 IMAGE_REL_MIPS_GPREL = 0x0006, 1467 IMAGE_REL_MIPS_LITERAL = 0x0007, 1468 IMAGE_REL_MIPS_SECTION = 0x000A, 1469 IMAGE_REL_MIPS_SECREL = 0x000B, 1470 IMAGE_REL_MIPS_SECRELLO = 0x000C, 1471 IMAGE_REL_MIPS_SECRELHI = 0x000D, 1472 IMAGE_REL_MIPS_JMPADDR16 = 0x0010, 1473 IMAGE_REL_MIPS_REFWORDNB = 0x0022, 1474 IMAGE_REL_MIPS_PAIR = 0x0025 1475 } 1476 1477 1478 enum : WORD { 1479 IMAGE_REL_ALPHA_ABSOLUTE, 1480 IMAGE_REL_ALPHA_REFLONG, 1481 IMAGE_REL_ALPHA_REFQUAD, 1482 IMAGE_REL_ALPHA_GPREL32, 1483 IMAGE_REL_ALPHA_LITERAL, 1484 IMAGE_REL_ALPHA_LITUSE, 1485 IMAGE_REL_ALPHA_GPDISP, 1486 IMAGE_REL_ALPHA_BRADDR, 1487 IMAGE_REL_ALPHA_HINT, 1488 IMAGE_REL_ALPHA_INLINE_REFLONG, 1489 IMAGE_REL_ALPHA_REFHI, 1490 IMAGE_REL_ALPHA_REFLO, 1491 IMAGE_REL_ALPHA_PAIR, 1492 IMAGE_REL_ALPHA_MATCH, 1493 IMAGE_REL_ALPHA_SECTION, 1494 IMAGE_REL_ALPHA_SECREL, 1495 IMAGE_REL_ALPHA_REFLONGNB, 1496 IMAGE_REL_ALPHA_SECRELLO, 1497 IMAGE_REL_ALPHA_SECRELHI // = 18 1498 } 1499 1500 enum : WORD { 1501 IMAGE_REL_PPC_ABSOLUTE, 1502 IMAGE_REL_PPC_ADDR64, 1503 IMAGE_REL_PPC_ADDR32, 1504 IMAGE_REL_PPC_ADDR24, 1505 IMAGE_REL_PPC_ADDR16, 1506 IMAGE_REL_PPC_ADDR14, 1507 IMAGE_REL_PPC_REL24, 1508 IMAGE_REL_PPC_REL14, 1509 IMAGE_REL_PPC_TOCREL16, 1510 IMAGE_REL_PPC_TOCREL14, 1511 IMAGE_REL_PPC_ADDR32NB, 1512 IMAGE_REL_PPC_SECREL, 1513 IMAGE_REL_PPC_SECTION, 1514 IMAGE_REL_PPC_IFGLUE, 1515 IMAGE_REL_PPC_IMGLUE, 1516 IMAGE_REL_PPC_SECREL16, 1517 IMAGE_REL_PPC_REFHI, 1518 IMAGE_REL_PPC_REFLO, 1519 IMAGE_REL_PPC_PAIR // = 18 1520 } 1521 1522 // ??? 1523 const IMAGE_REL_PPC_TYPEMASK = 0x00FF; 1524 const IMAGE_REL_PPC_NEG = 0x0100; 1525 const IMAGE_REL_PPC_BRTAKEN = 0x0200; 1526 const IMAGE_REL_PPC_BRNTAKEN = 0x0400; 1527 const IMAGE_REL_PPC_TOCDEFN = 0x0800; 1528 1529 enum { 1530 IMAGE_REL_BASED_ABSOLUTE, 1531 IMAGE_REL_BASED_HIGH, 1532 IMAGE_REL_BASED_LOW, 1533 IMAGE_REL_BASED_HIGHLOW, 1534 IMAGE_REL_BASED_HIGHADJ, 1535 IMAGE_REL_BASED_MIPS_JMPADDR 1536 } 1537 // End of constants documented in pecoff.doc 1538 1539 const size_t IMAGE_ARCHIVE_START_SIZE = 8; 1540 1541 const TCHAR[] 1542 IMAGE_ARCHIVE_START = "!<arch>\n", 1543 IMAGE_ARCHIVE_END = "`\n", 1544 IMAGE_ARCHIVE_PAD = "\n", 1545 IMAGE_ARCHIVE_LINKER_MEMBER = "/ ", 1546 IMAGE_ARCHIVE_LONGNAMES_MEMBER = "// "; 1547 1548 const IMAGE_ORDINAL_FLAG32 = 0x80000000; 1549 1550 ulong IMAGE_ORDINAL64(ulong Ordinal) { return Ordinal & 0xFFFF; } 1551 uint IMAGE_ORDINAL32(uint Ordinal) { return Ordinal & 0xFFFF; } 1552 1553 bool IMAGE_SNAP_BY_ORDINAL32(uint Ordinal) { 1554 return (Ordinal & IMAGE_ORDINAL_FLAG32) != 0; 1555 } 1556 1557 const ulong IMAGE_ORDINAL_FLAG64 = 0x8000000000000000; 1558 1559 bool IMAGE_SNAP_BY_ORDINAL64(ulong Ordinal) { 1560 return (Ordinal & IMAGE_ORDINAL_FLAG64) != 0; 1561 } 1562 1563 // ??? 1564 const IMAGE_RESOURCE_NAME_IS_STRING = 0x80000000; 1565 const IMAGE_RESOURCE_DATA_IS_DIRECTORY = 0x80000000; 1566 1567 enum : DWORD { 1568 IMAGE_DEBUG_TYPE_UNKNOWN, 1569 IMAGE_DEBUG_TYPE_COFF, 1570 IMAGE_DEBUG_TYPE_CODEVIEW, 1571 IMAGE_DEBUG_TYPE_FPO, 1572 IMAGE_DEBUG_TYPE_MISC, 1573 IMAGE_DEBUG_TYPE_EXCEPTION, 1574 IMAGE_DEBUG_TYPE_FIXUP, 1575 IMAGE_DEBUG_TYPE_OMAP_TO_SRC, 1576 IMAGE_DEBUG_TYPE_OMAP_FROM_SRC, 1577 IMAGE_DEBUG_TYPE_BORLAND // = 9 1578 } 1579 1580 enum : ubyte { 1581 FRAME_FPO, 1582 FRAME_TRAP, 1583 FRAME_TSS, 1584 FRAME_NONFPO 1585 } 1586 1587 // ??? 1588 const IMAGE_DEBUG_MISC_EXENAME = 1; 1589 1590 // ??? 1591 const N_BTMASK = 0x000F; 1592 const N_TMASK = 0x0030; 1593 const N_TMASK1 = 0x00C0; 1594 const N_TMASK2 = 0x00F0; 1595 const N_BTSHFT = 4; 1596 const N_TSHIFT = 2; 1597 1598 const int 1599 IS_TEXT_UNICODE_ASCII16 = 0x0001, 1600 IS_TEXT_UNICODE_STATISTICS = 0x0002, 1601 IS_TEXT_UNICODE_CONTROLS = 0x0004, 1602 IS_TEXT_UNICODE_SIGNATURE = 0x0008, 1603 IS_TEXT_UNICODE_REVERSE_ASCII16 = 0x0010, 1604 IS_TEXT_UNICODE_REVERSE_STATISTICS = 0x0020, 1605 IS_TEXT_UNICODE_REVERSE_CONTROLS = 0x0040, 1606 IS_TEXT_UNICODE_REVERSE_SIGNATURE = 0x0080, 1607 IS_TEXT_UNICODE_ILLEGAL_CHARS = 0x0100, 1608 IS_TEXT_UNICODE_ODD_LENGTH = 0x0200, 1609 IS_TEXT_UNICODE_NULL_BYTES = 0x1000, 1610 IS_TEXT_UNICODE_UNICODE_MASK = 0x000F, 1611 IS_TEXT_UNICODE_REVERSE_MASK = 0x00F0, 1612 IS_TEXT_UNICODE_NOT_UNICODE_MASK = 0x0F00, 1613 IS_TEXT_UNICODE_NOT_ASCII_MASK = 0xF000; 1614 1615 const DWORD 1616 SERVICE_KERNEL_DRIVER = 0x0001, 1617 SERVICE_FILE_SYSTEM_DRIVER = 0x0002, 1618 SERVICE_ADAPTER = 0x0004, 1619 SERVICE_RECOGNIZER_DRIVER = 0x0008, 1620 SERVICE_WIN32_OWN_PROCESS = 0x0010, 1621 SERVICE_WIN32_SHARE_PROCESS = 0x0020, 1622 SERVICE_INTERACTIVE_PROCESS = 0x0100, 1623 SERVICE_DRIVER = 0x000B, 1624 SERVICE_WIN32 = 0x0030, 1625 SERVICE_TYPE_ALL = 0x013F; 1626 1627 enum : DWORD { 1628 SERVICE_BOOT_START = 0, 1629 SERVICE_SYSTEM_START = 1, 1630 SERVICE_AUTO_START = 2, 1631 SERVICE_DEMAND_START = 3, 1632 SERVICE_DISABLED = 4 1633 } 1634 1635 enum : DWORD { 1636 SERVICE_ERROR_IGNORE = 0, 1637 SERVICE_ERROR_NORMAL = 1, 1638 SERVICE_ERROR_SEVERE = 2, 1639 SERVICE_ERROR_CRITICAL = 3 1640 } 1641 1642 1643 const uint 1644 SE_OWNER_DEFAULTED = 0x0001, 1645 SE_GROUP_DEFAULTED = 0x0002, 1646 SE_DACL_PRESENT = 0x0004, 1647 SE_DACL_DEFAULTED = 0x0008, 1648 SE_SACL_PRESENT = 0x0010, 1649 SE_SACL_DEFAULTED = 0x0020, 1650 SE_DACL_AUTO_INHERIT_REQ = 0x0100, 1651 SE_SACL_AUTO_INHERIT_REQ = 0x0200, 1652 SE_DACL_AUTO_INHERITED = 0x0400, 1653 SE_SACL_AUTO_INHERITED = 0x0800, 1654 SE_DACL_PROTECTED = 0x1000, 1655 SE_SACL_PROTECTED = 0x2000, 1656 SE_SELF_RELATIVE = 0x8000; 1657 enum SECURITY_IMPERSONATION_LEVEL { 1658 SecurityAnonymous, 1659 SecurityIdentification, 1660 SecurityImpersonation, 1661 SecurityDelegation 1662 } 1663 alias SECURITY_IMPERSONATION_LEVEL* PSECURITY_IMPERSONATION_LEVEL; 1664 1665 alias BOOLEAN SECURITY_CONTEXT_TRACKING_MODE; 1666 alias BOOLEAN* PSECURITY_CONTEXT_TRACKING_MODE; 1667 1668 const size_t SECURITY_DESCRIPTOR_MIN_LENGTH = 20; 1669 1670 const DWORD 1671 SECURITY_DESCRIPTOR_REVISION = 1, 1672 SECURITY_DESCRIPTOR_REVISION1 = 1; 1673 1674 const DWORD 1675 SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001, 1676 SE_PRIVILEGE_ENABLED = 0x00000002, 1677 SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000; 1678 1679 const DWORD PRIVILEGE_SET_ALL_NECESSARY = 1; 1680 1681 const SECURITY_IMPERSONATION_LEVEL 1682 SECURITY_MAX_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL.SecurityDelegation, 1683 DEFAULT_IMPERSONATION_LEVEL = SECURITY_IMPERSONATION_LEVEL.SecurityImpersonation; 1684 1685 const BOOLEAN 1686 SECURITY_DYNAMIC_TRACKING = true, 1687 SECURITY_STATIC_TRACKING = false; 1688 1689 // also in ddk/ntifs.h 1690 const DWORD 1691 TOKEN_ASSIGN_PRIMARY = 0x0001, 1692 TOKEN_DUPLICATE = 0x0002, 1693 TOKEN_IMPERSONATE = 0x0004, 1694 TOKEN_QUERY = 0x0008, 1695 TOKEN_QUERY_SOURCE = 0x0010, 1696 TOKEN_ADJUST_PRIVILEGES = 0x0020, 1697 TOKEN_ADJUST_GROUPS = 0x0040, 1698 TOKEN_ADJUST_DEFAULT = 0x0080, 1699 1700 TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED 1701 | TOKEN_ASSIGN_PRIMARY 1702 | TOKEN_DUPLICATE 1703 | TOKEN_IMPERSONATE 1704 | TOKEN_QUERY 1705 | TOKEN_QUERY_SOURCE 1706 | TOKEN_ADJUST_PRIVILEGES 1707 | TOKEN_ADJUST_GROUPS 1708 | TOKEN_ADJUST_DEFAULT, 1709 TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY, 1710 TOKEN_WRITE = STANDARD_RIGHTS_WRITE 1711 | TOKEN_ADJUST_PRIVILEGES 1712 | TOKEN_ADJUST_GROUPS 1713 | TOKEN_ADJUST_DEFAULT, 1714 TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE; 1715 1716 const size_t TOKEN_SOURCE_LENGTH = 8; 1717 // end ddk/ntifs.h 1718 1719 enum : DWORD { 1720 DLL_PROCESS_DETACH, 1721 DLL_PROCESS_ATTACH, 1722 DLL_THREAD_ATTACH, 1723 DLL_THREAD_DETACH 1724 } 1725 1726 enum : DWORD { 1727 DBG_CONTINUE = 0x00010002, 1728 DBG_TERMINATE_THREAD = 0x40010003, 1729 DBG_TERMINATE_PROCESS = 0x40010004, 1730 DBG_CONTROL_C = 0x40010005, 1731 DBG_CONTROL_BREAK = 0x40010008, 1732 DBG_EXCEPTION_NOT_HANDLED = 0x80010001 1733 } 1734 1735 enum : DWORD { 1736 TAPE_ABSOLUTE_POSITION, 1737 TAPE_LOGICAL_POSITION, 1738 TAPE_PSEUDO_LOGICAL_POSITION 1739 } 1740 1741 enum : DWORD { 1742 TAPE_REWIND, 1743 TAPE_ABSOLUTE_BLOCK, 1744 TAPE_LOGICAL_BLOCK, 1745 TAPE_PSEUDO_LOGICAL_BLOCK, 1746 TAPE_SPACE_END_OF_DATA, 1747 TAPE_SPACE_RELATIVE_BLOCKS, 1748 TAPE_SPACE_FILEMARKS, 1749 TAPE_SPACE_SEQUENTIAL_FMKS, 1750 TAPE_SPACE_SETMARKS, 1751 TAPE_SPACE_SEQUENTIAL_SMKS 1752 } 1753 1754 const DWORD 1755 TAPE_DRIVE_FIXED = 0x00000001, 1756 TAPE_DRIVE_SELECT = 0x00000002, 1757 TAPE_DRIVE_INITIATOR = 0x00000004, 1758 TAPE_DRIVE_ERASE_SHORT = 0x00000010, 1759 TAPE_DRIVE_ERASE_LONG = 0x00000020, 1760 TAPE_DRIVE_ERASE_BOP_ONLY = 0x00000040, 1761 TAPE_DRIVE_ERASE_IMMEDIATE = 0x00000080, 1762 TAPE_DRIVE_TAPE_CAPACITY = 0x00000100, 1763 TAPE_DRIVE_TAPE_REMAINING = 0x00000200, 1764 TAPE_DRIVE_FIXED_BLOCK = 0x00000400, 1765 TAPE_DRIVE_VARIABLE_BLOCK = 0x00000800, 1766 TAPE_DRIVE_WRITE_PROTECT = 0x00001000, 1767 TAPE_DRIVE_EOT_WZ_SIZE = 0x00002000, 1768 TAPE_DRIVE_ECC = 0x00010000, 1769 TAPE_DRIVE_COMPRESSION = 0x00020000, 1770 TAPE_DRIVE_PADDING = 0x00040000, 1771 TAPE_DRIVE_REPORT_SMKS = 0x00080000, 1772 TAPE_DRIVE_GET_ABSOLUTE_BLK = 0x00100000, 1773 TAPE_DRIVE_GET_LOGICAL_BLK = 0x00200000, 1774 TAPE_DRIVE_SET_EOT_WZ_SIZE = 0x00400000, 1775 TAPE_DRIVE_EJECT_MEDIA = 0x01000000, 1776 TAPE_DRIVE_CLEAN_REQUESTS = 0x02000000, 1777 TAPE_DRIVE_SET_CMP_BOP_ONLY = 0x04000000, 1778 TAPE_DRIVE_RESERVED_BIT = 0x80000000; 1779 1780 const DWORD 1781 TAPE_DRIVE_LOAD_UNLOAD = 0x80000001, 1782 TAPE_DRIVE_TENSION = 0x80000002, 1783 TAPE_DRIVE_LOCK_UNLOCK = 0x80000004, 1784 TAPE_DRIVE_REWIND_IMMEDIATE = 0x80000008, 1785 TAPE_DRIVE_SET_BLOCK_SIZE = 0x80000010, 1786 TAPE_DRIVE_LOAD_UNLD_IMMED = 0x80000020, 1787 TAPE_DRIVE_TENSION_IMMED = 0x80000040, 1788 TAPE_DRIVE_LOCK_UNLK_IMMED = 0x80000080, 1789 TAPE_DRIVE_SET_ECC = 0x80000100, 1790 TAPE_DRIVE_SET_COMPRESSION = 0x80000200, 1791 TAPE_DRIVE_SET_PADDING = 0x80000400, 1792 TAPE_DRIVE_SET_REPORT_SMKS = 0x80000800, 1793 TAPE_DRIVE_ABSOLUTE_BLK = 0x80001000, 1794 TAPE_DRIVE_ABS_BLK_IMMED = 0x80002000, 1795 TAPE_DRIVE_LOGICAL_BLK = 0x80004000, 1796 TAPE_DRIVE_LOG_BLK_IMMED = 0x80008000, 1797 TAPE_DRIVE_END_OF_DATA = 0x80010000, 1798 TAPE_DRIVE_RELATIVE_BLKS = 0x80020000, 1799 TAPE_DRIVE_FILEMARKS = 0x80040000, 1800 TAPE_DRIVE_SEQUENTIAL_FMKS = 0x80080000, 1801 TAPE_DRIVE_SETMARKS = 0x80100000, 1802 TAPE_DRIVE_SEQUENTIAL_SMKS = 0x80200000, 1803 TAPE_DRIVE_REVERSE_POSITION = 0x80400000, 1804 TAPE_DRIVE_SPACE_IMMEDIATE = 0x80800000, 1805 TAPE_DRIVE_WRITE_SETMARKS = 0x81000000, 1806 TAPE_DRIVE_WRITE_FILEMARKS = 0x82000000, 1807 TAPE_DRIVE_WRITE_SHORT_FMKS = 0x84000000, 1808 TAPE_DRIVE_WRITE_LONG_FMKS = 0x88000000, 1809 TAPE_DRIVE_WRITE_MARK_IMMED = 0x90000000, 1810 TAPE_DRIVE_FORMAT = 0xA0000000, 1811 TAPE_DRIVE_FORMAT_IMMEDIATE = 0xC0000000, 1812 TAPE_DRIVE_HIGH_FEATURES = 0x80000000; 1813 1814 enum : DWORD { 1815 TAPE_FIXED_PARTITIONS = 0, 1816 TAPE_SELECT_PARTITIONS = 1, 1817 TAPE_INITIATOR_PARTITIONS = 2 1818 } 1819 1820 enum : DWORD { 1821 TAPE_SETMARKS, 1822 TAPE_FILEMARKS, 1823 TAPE_SHORT_FILEMARKS, 1824 TAPE_LONG_FILEMARKS 1825 } 1826 1827 enum : DWORD { 1828 TAPE_ERASE_SHORT, 1829 TAPE_ERASE_LONG 1830 } 1831 1832 enum : DWORD { 1833 TAPE_LOAD, 1834 TAPE_UNLOAD, 1835 TAPE_TENSION, 1836 TAPE_LOCK, 1837 TAPE_UNLOCK, 1838 TAPE_FORMAT 1839 } 1840 1841 enum : ULONG32 { 1842 VER_PLATFORM_WIN32s, 1843 VER_PLATFORM_WIN32_WINDOWS, 1844 VER_PLATFORM_WIN32_NT 1845 } 1846 1847 enum : UCHAR { 1848 VER_NT_WORKSTATION = 1, 1849 VER_NT_DOMAIN_CONTROLLER, 1850 VER_NT_SERVER 1851 } 1852 1853 const USHORT 1854 VER_SUITE_SMALLBUSINESS = 0x0001, 1855 VER_SUITE_ENTERPRISE = 0x0002, 1856 VER_SUITE_BACKOFFICE = 0x0004, 1857 VER_SUITE_TERMINAL = 0x0010, 1858 VER_SUITE_SMALLBUSINESS_RESTRICTED = 0x0020, 1859 VER_SUITE_EMBEDDEDNT = 0x0040, 1860 VER_SUITE_DATACENTER = 0x0080, 1861 VER_SUITE_SINGLEUSERTS = 0x0100, 1862 VER_SUITE_PERSONAL = 0x0200, 1863 VER_SUITE_BLADE = 0x0400, 1864 VER_SUITE_STORAGE_SERVER = 0x2000, 1865 VER_SUITE_COMPUTE_SERVER = 0x4000; 1866 1867 const ULONG 1868 WT_EXECUTEDEFAULT = 0x00000000, 1869 WT_EXECUTEINIOTHREAD = 0x00000001, 1870 WT_EXECUTEINWAITTHREAD = 0x00000004, 1871 WT_EXECUTEONLYONCE = 0x00000008, 1872 WT_EXECUTELONGFUNCTION = 0x00000010, 1873 WT_EXECUTEINTIMERTHREAD = 0x00000020, 1874 WT_EXECUTEINPERSISTENTTHREAD = 0x00000080, 1875 WT_TRANSFER_IMPERSONATION = 0x00000100; 1876 1877 static if (_WIN32_WINNT >= 0x500) { 1878 const DWORD 1879 VER_MINORVERSION = 0x01, 1880 VER_MAJORVERSION = 0x02, 1881 VER_BUILDNUMBER = 0x04, 1882 VER_PLATFORMID = 0x08, 1883 VER_SERVICEPACKMINOR = 0x10, 1884 VER_SERVICEPACKMAJOR = 0x20, 1885 VER_SUITENAME = 0x40, 1886 VER_PRODUCT_TYPE = 0x80; 1887 1888 enum : DWORD { 1889 VER_EQUAL = 1, 1890 VER_GREATER, 1891 VER_GREATER_EQUAL, 1892 VER_LESS, 1893 VER_LESS_EQUAL, 1894 VER_AND, 1895 VER_OR // = 7 1896 } 1897 } 1898 1899 static if (_WIN32_WINNT >= 0x501) { 1900 enum : ULONG { 1901 ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION = 1, 1902 ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, 1903 ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION, 1904 ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, 1905 ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, 1906 ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION, 1907 ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION, // = 7 1908 ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES = 9 1909 } 1910 } 1911 1912 // Macros 1913 BYTE BTYPE(BYTE x) { return cast(BYTE) (x & N_BTMASK); } 1914 bool ISPTR(uint x) { return (x & N_TMASK) == (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT); } 1915 bool ISFCN(uint x) { return (x & N_TMASK) == (IMAGE_SYM_DTYPE_FUNCTION << N_BTSHFT); } 1916 bool ISARY(uint x) { return (x & N_TMASK) == (IMAGE_SYM_DTYPE_ARRAY << N_BTSHFT); } 1917 bool ISTAG(uint x) { 1918 return x == IMAGE_SYM_CLASS_STRUCT_TAG 1919 || x == IMAGE_SYM_CLASS_UNION_TAG 1920 || x == IMAGE_SYM_CLASS_ENUM_TAG; 1921 } 1922 uint INCREF(uint x) { 1923 return ((x & ~N_BTMASK) << N_TSHIFT) | (IMAGE_SYM_DTYPE_POINTER << N_BTSHFT) 1924 | (x & N_BTMASK); 1925 } 1926 uint DECREF(uint x) { return ((x >>> N_TSHIFT) & ~N_BTMASK) | (x & N_BTMASK); } 1927 1928 const DWORD TLS_MINIMUM_AVAILABLE = 64; 1929 1930 const ULONG 1931 IO_REPARSE_TAG_RESERVED_ZERO = 0, 1932 IO_REPARSE_TAG_RESERVED_ONE = 1, 1933 IO_REPARSE_TAG_RESERVED_RANGE = IO_REPARSE_TAG_RESERVED_ONE, 1934 IO_REPARSE_TAG_SYMBOLIC_LINK = IO_REPARSE_TAG_RESERVED_ZERO, 1935 IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003, 1936 IO_REPARSE_TAG_SYMLINK = 0xA000000C, 1937 IO_REPARSE_TAG_VALID_VALUES = 0xE000FFFF; 1938 1939 /* Although these are semantically boolean, they are documented and 1940 * implemented to return ULONG; this behaviour is preserved for compatibility 1941 */ 1942 ULONG IsReparseTagMicrosoft(ULONG x) { return x & 0x80000000; } 1943 ULONG IsReparseTagHighLatency(ULONG x) { return x & 0x40000000; } 1944 ULONG IsReparseTagNameSurrogate(ULONG x) { return x & 0x20000000; } 1945 1946 bool IsReparseTagValid(ULONG x) { 1947 return !(x & ~IO_REPARSE_TAG_VALID_VALUES) && (x > IO_REPARSE_TAG_RESERVED_RANGE); 1948 } 1949 1950 // Doesn't seem to make sense, but anyway.... 1951 ULONG WT_SET_MAX_THREADPOOL_THREADS(ref ULONG Flags, ushort Limit) { 1952 return Flags |= Limit << 16; 1953 } 1954 1955 /* also in windows.basetyps 1956 struct GUID { 1957 uint Data1; 1958 ushort Data2; 1959 ushort Data3; 1960 ubyte Data4[8]; 1961 } 1962 alias GUID* REFGUID, LPGUID; 1963 */ 1964 1965 struct GENERIC_MAPPING { 1966 ACCESS_MASK GenericRead; 1967 ACCESS_MASK GenericWrite; 1968 ACCESS_MASK GenericExecute; 1969 ACCESS_MASK GenericAll; 1970 } 1971 alias GENERIC_MAPPING* PGENERIC_MAPPING; 1972 1973 struct ACE_HEADER { 1974 BYTE AceType; 1975 BYTE AceFlags; 1976 WORD AceSize; 1977 } 1978 alias ACE_HEADER* PACE_HEADER; 1979 1980 struct ACCESS_ALLOWED_ACE { 1981 ACE_HEADER Header; 1982 ACCESS_MASK Mask; 1983 DWORD SidStart; 1984 } 1985 alias ACCESS_ALLOWED_ACE* PACCESS_ALLOWED_ACE; 1986 1987 struct ACCESS_DENIED_ACE { 1988 ACE_HEADER Header; 1989 ACCESS_MASK Mask; 1990 DWORD SidStart; 1991 } 1992 alias ACCESS_DENIED_ACE* PACCESS_DENIED_ACE; 1993 1994 struct SYSTEM_AUDIT_ACE { 1995 ACE_HEADER Header; 1996 ACCESS_MASK Mask; 1997 DWORD SidStart; 1998 } 1999 alias SYSTEM_AUDIT_ACE *PSYSTEM_AUDIT_ACE; 2000 2001 struct SYSTEM_ALARM_ACE { 2002 ACE_HEADER Header; 2003 ACCESS_MASK Mask; 2004 DWORD SidStart; 2005 } 2006 alias SYSTEM_ALARM_ACE* PSYSTEM_ALARM_ACE; 2007 2008 struct ACCESS_ALLOWED_OBJECT_ACE { 2009 ACE_HEADER Header; 2010 ACCESS_MASK Mask; 2011 DWORD Flags; 2012 GUID ObjectType; 2013 GUID InheritedObjectType; 2014 DWORD SidStart; 2015 } 2016 alias ACCESS_ALLOWED_OBJECT_ACE* PACCESS_ALLOWED_OBJECT_ACE; 2017 2018 struct ACCESS_DENIED_OBJECT_ACE { 2019 ACE_HEADER Header; 2020 ACCESS_MASK Mask; 2021 DWORD Flags; 2022 GUID ObjectType; 2023 GUID InheritedObjectType; 2024 DWORD SidStart; 2025 } 2026 alias ACCESS_DENIED_OBJECT_ACE* PACCESS_DENIED_OBJECT_ACE; 2027 2028 struct SYSTEM_AUDIT_OBJECT_ACE { 2029 ACE_HEADER Header; 2030 ACCESS_MASK Mask; 2031 DWORD Flags; 2032 GUID ObjectType; 2033 GUID InheritedObjectType; 2034 DWORD SidStart; 2035 } 2036 alias SYSTEM_AUDIT_OBJECT_ACE* PSYSTEM_AUDIT_OBJECT_ACE; 2037 2038 struct SYSTEM_ALARM_OBJECT_ACE { 2039 ACE_HEADER Header; 2040 ACCESS_MASK Mask; 2041 DWORD Flags; 2042 GUID ObjectType; 2043 GUID InheritedObjectType; 2044 DWORD SidStart; 2045 } 2046 alias SYSTEM_ALARM_OBJECT_ACE* PSYSTEM_ALARM_OBJECT_ACE; 2047 2048 struct ACL { 2049 BYTE AclRevision; 2050 BYTE Sbz1; 2051 WORD AclSize; 2052 WORD AceCount; 2053 WORD Sbz2; 2054 } 2055 alias ACL* PACL; 2056 2057 struct ACL_REVISION_INFORMATION { 2058 DWORD AclRevision; 2059 } 2060 2061 struct ACL_SIZE_INFORMATION { 2062 DWORD AceCount; 2063 DWORD AclBytesInUse; 2064 DWORD AclBytesFree; 2065 } 2066 2067 version (X86) { 2068 // ??? 2069 const SIZE_OF_80387_REGISTERS = 80; 2070 const CONTEXT_i386 = 0x010000; 2071 const CONTEXT_i486 = 0x010000; 2072 const CONTEXT_CONTROL = CONTEXT_i386 | 0x01; 2073 const CONTEXT_INTEGER = CONTEXT_i386 | 0x02; 2074 const CONTEXT_SEGMENTS = CONTEXT_i386 | 0x04; 2075 const CONTEXT_FLOATING_POINT = CONTEXT_i386 | 0x08; 2076 const CONTEXT_DEBUG_REGISTERS = CONTEXT_i386 | 0x10; 2077 const CONTEXT_EXTENDED_REGISTERS = CONTEXT_i386 | 0x20; 2078 const CONTEXT_FULL = CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS; 2079 const MAXIMUM_SUPPORTED_EXTENSION = 512; 2080 2081 struct FLOATING_SAVE_AREA { 2082 DWORD ControlWord; 2083 DWORD StatusWord; 2084 DWORD TagWord; 2085 DWORD ErrorOffset; 2086 DWORD ErrorSelector; 2087 DWORD DataOffset; 2088 DWORD DataSelector; 2089 BYTE[80] RegisterArea; 2090 DWORD Cr0NpxState; 2091 } 2092 2093 struct CONTEXT { 2094 DWORD ContextFlags; 2095 DWORD Dr0; 2096 DWORD Dr1; 2097 DWORD Dr2; 2098 DWORD Dr3; 2099 DWORD Dr6; 2100 DWORD Dr7; 2101 FLOATING_SAVE_AREA FloatSave; 2102 DWORD SegGs; 2103 DWORD SegFs; 2104 DWORD SegEs; 2105 DWORD SegDs; 2106 DWORD Edi; 2107 DWORD Esi; 2108 DWORD Ebx; 2109 DWORD Edx; 2110 DWORD Ecx; 2111 DWORD Eax; 2112 DWORD Ebp; 2113 DWORD Eip; 2114 DWORD SegCs; 2115 DWORD EFlags; 2116 DWORD Esp; 2117 DWORD SegSs; 2118 BYTE[MAXIMUM_SUPPORTED_EXTENSION] ExtendedRegisters; 2119 } 2120 2121 } else version(X86_64) 2122 { 2123 const CONTEXT_AMD64 = 0x100000; 2124 2125 const CONTEXT_CONTROL = (CONTEXT_AMD64 | 0x1L); 2126 const CONTEXT_INTEGER = (CONTEXT_AMD64 | 0x2L); 2127 const CONTEXT_SEGMENTS = (CONTEXT_AMD64 | 0x4L); 2128 const CONTEXT_FLOATING_POINT = (CONTEXT_AMD64 | 0x8L); 2129 const CONTEXT_DEBUG_REGISTERS = (CONTEXT_AMD64 | 0x10L); 2130 2131 const CONTEXT_FULL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT); 2132 const CONTEXT_ALL = (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS); 2133 2134 const CONTEXT_EXCEPTION_ACTIVE = 0x8000000; 2135 const CONTEXT_SERVICE_ACTIVE = 0x10000000; 2136 const CONTEXT_EXCEPTION_REQUEST = 0x40000000; 2137 const CONTEXT_EXCEPTION_REPORTING = 0x80000000; 2138 2139 const INITIAL_MXCSR = 0x1f80; 2140 const INITIAL_FPCSR = 0x027f; 2141 2142 align(16) struct M128A 2143 { 2144 ULONGLONG Low; 2145 LONGLONG High; 2146 } 2147 alias M128A* PM128A; 2148 2149 struct XMM_SAVE_AREA32 2150 { 2151 WORD ControlWord; 2152 WORD StatusWord; 2153 BYTE TagWord; 2154 BYTE Reserved1; 2155 WORD ErrorOpcode; 2156 DWORD ErrorOffset; 2157 WORD ErrorSelector; 2158 WORD Reserved2; 2159 DWORD DataOffset; 2160 WORD DataSelector; 2161 WORD Reserved3; 2162 DWORD MxCsr; 2163 DWORD MxCsr_Mask; 2164 M128A[8] FloatRegisters; 2165 M128A[16] XmmRegisters; 2166 BYTE[96] Reserved4; 2167 } 2168 alias XMM_SAVE_AREA32 PXMM_SAVE_AREA32; 2169 const LEGACY_SAVE_AREA_LENGTH = XMM_SAVE_AREA32.sizeof; 2170 2171 align(16) struct CONTEXT 2172 { 2173 DWORD64 P1Home; 2174 DWORD64 P2Home; 2175 DWORD64 P3Home; 2176 DWORD64 P4Home; 2177 DWORD64 P5Home; 2178 DWORD64 P6Home; 2179 DWORD ContextFlags; 2180 DWORD MxCsr; 2181 WORD SegCs; 2182 WORD SegDs; 2183 WORD SegEs; 2184 WORD SegFs; 2185 WORD SegGs; 2186 WORD SegSs; 2187 DWORD EFlags; 2188 DWORD64 Dr0; 2189 DWORD64 Dr1; 2190 DWORD64 Dr2; 2191 DWORD64 Dr3; 2192 DWORD64 Dr6; 2193 DWORD64 Dr7; 2194 DWORD64 Rax; 2195 DWORD64 Rcx; 2196 DWORD64 Rdx; 2197 DWORD64 Rbx; 2198 DWORD64 Rsp; 2199 DWORD64 Rbp; 2200 DWORD64 Rsi; 2201 DWORD64 Rdi; 2202 DWORD64 R8; 2203 DWORD64 R9; 2204 DWORD64 R10; 2205 DWORD64 R11; 2206 DWORD64 R12; 2207 DWORD64 R13; 2208 DWORD64 R14; 2209 DWORD64 R15; 2210 DWORD64 Rip; 2211 union 2212 { 2213 XMM_SAVE_AREA32 FltSave; 2214 XMM_SAVE_AREA32 FloatSave; 2215 struct 2216 { 2217 M128A[2] Header; 2218 M128A[8] Legacy; 2219 M128A Xmm0; 2220 M128A Xmm1; 2221 M128A Xmm2; 2222 M128A Xmm3; 2223 M128A Xmm4; 2224 M128A Xmm5; 2225 M128A Xmm6; 2226 M128A Xmm7; 2227 M128A Xmm8; 2228 M128A Xmm9; 2229 M128A Xmm10; 2230 M128A Xmm11; 2231 M128A Xmm12; 2232 M128A Xmm13; 2233 M128A Xmm14; 2234 M128A Xmm15; 2235 }; 2236 }; 2237 M128A[26] VectorRegister; 2238 DWORD64 VectorControl; 2239 DWORD64 DebugControl; 2240 DWORD64 LastBranchToRip; 2241 DWORD64 LastBranchFromRip; 2242 DWORD64 LastExceptionToRip; 2243 DWORD64 LastExceptionFromRip; 2244 } 2245 2246 } else { 2247 static assert(false, "Unsupported CPU"); 2248 // Versions for PowerPC, Alpha, SHX, and MIPS removed. 2249 } 2250 2251 alias CONTEXT* PCONTEXT, LPCONTEXT; 2252 2253 struct EXCEPTION_RECORD { 2254 DWORD ExceptionCode; 2255 DWORD ExceptionFlags; 2256 EXCEPTION_RECORD* ExceptionRecord; 2257 PVOID ExceptionAddress; 2258 DWORD NumberParameters; 2259 DWORD[EXCEPTION_MAXIMUM_PARAMETERS] ExceptionInformation; 2260 } 2261 alias EXCEPTION_RECORD* PEXCEPTION_RECORD, LPEXCEPTION_RECORD; 2262 2263 struct EXCEPTION_POINTERS { 2264 PEXCEPTION_RECORD ExceptionRecord; 2265 PCONTEXT ContextRecord; 2266 } 2267 alias EXCEPTION_POINTERS* PEXCEPTION_POINTERS, LPEXCEPTION_POINTERS; 2268 2269 union LARGE_INTEGER { 2270 struct { 2271 uint LowPart; 2272 int HighPart; 2273 } 2274 long QuadPart; 2275 } 2276 alias LARGE_INTEGER* PLARGE_INTEGER; 2277 2278 union ULARGE_INTEGER { 2279 struct { 2280 uint LowPart; 2281 uint HighPart; 2282 } 2283 ulong QuadPart; 2284 } 2285 alias ULARGE_INTEGER* PULARGE_INTEGER; 2286 2287 alias LARGE_INTEGER LUID; 2288 alias LUID* PLUID; 2289 2290 const LUID SYSTEM_LUID = { QuadPart:999 }; 2291 2292 align(4) struct LUID_AND_ATTRIBUTES { 2293 LUID Luid; 2294 DWORD Attributes; 2295 } 2296 alias LUID_AND_ATTRIBUTES* PLUID_AND_ATTRIBUTES; 2297 2298 struct PRIVILEGE_SET { 2299 DWORD PrivilegeCount; 2300 DWORD Control; 2301 LUID_AND_ATTRIBUTES _Privilege; 2302 2303 LUID_AND_ATTRIBUTES* Privilege() return scope { return &_Privilege; } 2304 } 2305 alias PRIVILEGE_SET* PPRIVILEGE_SET; 2306 2307 struct SECURITY_ATTRIBUTES { 2308 DWORD nLength; 2309 LPVOID lpSecurityDescriptor; 2310 BOOL bInheritHandle; 2311 } 2312 alias SECURITY_ATTRIBUTES* PSECURITY_ATTRIBUTES, LPSECURITY_ATTRIBUTES; 2313 2314 struct SECURITY_QUALITY_OF_SERVICE { 2315 DWORD Length; 2316 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 2317 SECURITY_CONTEXT_TRACKING_MODE ContextTrackingMode; 2318 BOOLEAN EffectiveOnly; 2319 } 2320 alias SECURITY_QUALITY_OF_SERVICE* PSECURITY_QUALITY_OF_SERVICE; 2321 2322 alias PVOID PACCESS_TOKEN; 2323 2324 struct SE_IMPERSONATION_STATE { 2325 PACCESS_TOKEN Token; 2326 BOOLEAN CopyOnOpen; 2327 BOOLEAN EffectiveOnly; 2328 SECURITY_IMPERSONATION_LEVEL Level; 2329 } 2330 alias SE_IMPERSONATION_STATE* PSE_IMPERSONATION_STATE; 2331 2332 struct SID_IDENTIFIER_AUTHORITY { 2333 BYTE[6] Value; 2334 } 2335 alias SID_IDENTIFIER_AUTHORITY* PSID_IDENTIFIER_AUTHORITY, LPSID_IDENTIFIER_AUTHORITY; 2336 2337 alias PVOID PSID; 2338 2339 struct SID { 2340 BYTE Revision; 2341 BYTE SubAuthorityCount; 2342 SID_IDENTIFIER_AUTHORITY IdentifierAuthority; 2343 DWORD _SubAuthority; 2344 2345 DWORD* SubAuthority() return scope { return &_SubAuthority; } 2346 } 2347 alias SID* PISID; 2348 2349 struct SID_AND_ATTRIBUTES { 2350 PSID Sid; 2351 DWORD Attributes; 2352 } 2353 alias SID_AND_ATTRIBUTES* PSID_AND_ATTRIBUTES; 2354 2355 struct TOKEN_SOURCE { 2356 CHAR[TOKEN_SOURCE_LENGTH] SourceName; 2357 LUID SourceIdentifier; 2358 } 2359 alias TOKEN_SOURCE* PTOKEN_SOURCE; 2360 2361 struct TOKEN_CONTROL { 2362 LUID TokenId; 2363 LUID AuthenticationId; 2364 LUID ModifiedId; 2365 TOKEN_SOURCE TokenSource; 2366 } 2367 alias TOKEN_CONTROL* PTOKEN_CONTROL; 2368 2369 struct TOKEN_DEFAULT_DACL { 2370 PACL DefaultDacl; 2371 } 2372 alias TOKEN_DEFAULT_DACL* PTOKEN_DEFAULT_DACL; 2373 2374 struct TOKEN_GROUPS { 2375 DWORD GroupCount; 2376 SID_AND_ATTRIBUTES _Groups; 2377 2378 SID_AND_ATTRIBUTES* Groups() return { return &_Groups; } 2379 } 2380 alias TOKEN_GROUPS* PTOKEN_GROUPS, LPTOKEN_GROUPS; 2381 2382 struct TOKEN_OWNER { 2383 PSID Owner; 2384 } 2385 alias TOKEN_OWNER* PTOKEN_OWNER; 2386 const int SECURITY_MAX_SID_SIZE = 68; 2387 struct TOKEN_PRIMARY_GROUP { 2388 PSID PrimaryGroup; 2389 } 2390 alias TOKEN_PRIMARY_GROUP* PTOKEN_PRIMARY_GROUP; 2391 2392 struct TOKEN_PRIVILEGES { 2393 DWORD PrivilegeCount; 2394 LUID_AND_ATTRIBUTES _Privileges; 2395 2396 LUID_AND_ATTRIBUTES* Privileges() return scope { return &_Privileges; } 2397 } 2398 alias TOKEN_PRIVILEGES* PTOKEN_PRIVILEGES, LPTOKEN_PRIVILEGES; 2399 alias TOKEN_TYPE = int; 2400 enum : TOKEN_TYPE { 2401 TokenPrimary = 1, 2402 TokenImpersonation 2403 } 2404 alias TOKEN_TYPE* PTOKEN_TYPE; 2405 2406 struct TOKEN_STATISTICS { 2407 LUID TokenId; 2408 LUID AuthenticationId; 2409 LARGE_INTEGER ExpirationTime; 2410 TOKEN_TYPE TokenType; 2411 SECURITY_IMPERSONATION_LEVEL ImpersonationLevel; 2412 DWORD DynamicCharged; 2413 DWORD DynamicAvailable; 2414 DWORD GroupCount; 2415 DWORD PrivilegeCount; 2416 LUID ModifiedId; 2417 } 2418 alias TOKEN_STATISTICS* PTOKEN_STATISTICS; 2419 2420 struct TOKEN_USER { 2421 SID_AND_ATTRIBUTES User; 2422 } 2423 alias TOKEN_USER* PTOKEN_USER; 2424 2425 struct TOKEN_MANDATORY_LABEL { 2426 SID_AND_ATTRIBUTES Label; 2427 } 2428 alias PTOKEN_MANDATORY_LABEL = TOKEN_MANDATORY_LABEL*; 2429 2430 alias DWORD SECURITY_INFORMATION; 2431 alias SECURITY_INFORMATION* PSECURITY_INFORMATION; 2432 alias WORD SECURITY_DESCRIPTOR_CONTROL; 2433 alias SECURITY_DESCRIPTOR_CONTROL* PSECURITY_DESCRIPTOR_CONTROL; 2434 2435 struct SECURITY_DESCRIPTOR { 2436 BYTE Revision; 2437 BYTE Sbz1; 2438 SECURITY_DESCRIPTOR_CONTROL Control; 2439 PSID Owner; 2440 PSID Group; 2441 PACL Sacl; 2442 PACL Dacl; 2443 } 2444 alias SECURITY_DESCRIPTOR* PSECURITY_DESCRIPTOR, PISECURITY_DESCRIPTOR; 2445 alias TOKEN_ELEVATION_TYPE = int; 2446 enum : TOKEN_ELEVATION_TYPE { 2447 TokenElevationTypeDefault = 1, 2448 TokenElevationTypeFull, 2449 TokenElevationTypeLimited 2450 } 2451 2452 alias PTOKEN_ELEVATION_TYPE = TOKEN_ELEVATION_TYPE*; 2453 2454 struct TOKEN_ELEVATION { 2455 DWORD TokenIsElevated; 2456 } 2457 alias PTOKEN_ELEVATION = TOKEN_ELEVATION*; 2458 2459 alias TOKEN_INFORMATION_CLASS = int; 2460 enum : TOKEN_INFORMATION_CLASS { 2461 TokenUser = 1, 2462 TokenGroups, 2463 TokenPrivileges, 2464 TokenOwner, 2465 TokenPrimaryGroup, 2466 TokenDefaultDacl, 2467 TokenSource, 2468 TokenType, 2469 TokenImpersonationLevel, 2470 TokenStatistics, 2471 TokenRestrictedSids, 2472 TokenSessionId, 2473 TokenGroupsAndPrivileges, 2474 TokenSessionReference, 2475 TokenSandBoxInert, 2476 TokenAuditPolicy, 2477 TokenOrigin, 2478 TokenElevationType, 2479 TokenLinkedToken, 2480 TokenElevation, 2481 TokenHasRestrictions, 2482 TokenAccessInformation, 2483 TokenVirtualizationAllowed, 2484 TokenVirtualizationEnabled, 2485 TokenIntegrityLevel, 2486 TokenUIAccess, 2487 TokenMandatoryPolicy, 2488 TokenLogonSid, 2489 TokenIsAppContainer, 2490 TokenCapabilities, 2491 TokenAppContainerSid, 2492 TokenAppContainerNumber, 2493 TokenUserClaimAttributes, 2494 TokenDeviceClaimAttributes, 2495 TokenRestrictedUserClaimAttributes, 2496 TokenRestrictedDeviceClaimAttributes, 2497 TokenDeviceGroups, 2498 TokenRestrictedDeviceGroups, 2499 TokenSecurityAttributes, 2500 TokenIsRestricted, 2501 TokenProcessTrustLevel, 2502 MaxTokenInfoClass // MaxTokenInfoClass should always be the last enum 2503 2504 } 2505 2506 enum SID_NAME_USE { 2507 SidTypeUser = 1, 2508 SidTypeGroup, 2509 SidTypeDomain, 2510 SidTypeAlias, 2511 SidTypeWellKnownGroup, 2512 SidTypeDeletedAccount, 2513 SidTypeInvalid, 2514 SidTypeUnknown, 2515 SidTypeComputer 2516 } 2517 alias SID_NAME_USE* PSID_NAME_USE; 2518 2519 alias WELL_KNOWN_SID_TYPE = int; 2520 enum : WELL_KNOWN_SID_TYPE { 2521 WinNullSid = 0, 2522 WinWorldSid = 1, 2523 WinLocalSid = 2, 2524 WinCreatorOwnerSid = 3, 2525 WinCreatorGroupSid = 4, 2526 WinCreatorOwnerServerSid = 5, 2527 WinCreatorGroupServerSid = 6, 2528 WinNtAuthoritySid = 7, 2529 WinDialupSid = 8, 2530 WinNetworkSid = 9, 2531 WinBatchSid = 10, 2532 WinInteractiveSid = 11, 2533 WinServiceSid = 12, 2534 WinAnonymousSid = 13, 2535 WinProxySid = 14, 2536 WinEnterpriseControllersSid = 15, 2537 WinSelfSid = 16, 2538 WinAuthenticatedUserSid = 17, 2539 WinRestrictedCodeSid = 18, 2540 WinTerminalServerSid = 19, 2541 WinRemoteLogonIdSid = 20, 2542 WinLogonIdsSid = 21, 2543 WinLocalSystemSid = 22, 2544 WinLocalServiceSid = 23, 2545 WinNetworkServiceSid = 24, 2546 WinBuiltinDomainSid = 25, 2547 WinBuiltinAdministratorsSid = 26, 2548 WinBuiltinUsersSid = 27, 2549 WinBuiltinGuestsSid = 28, 2550 WinBuiltinPowerUsersSid = 29, 2551 WinBuiltinAccountOperatorsSid = 30, 2552 WinBuiltinSystemOperatorsSid = 31, 2553 WinBuiltinPrintOperatorsSid = 32, 2554 WinBuiltinBackupOperatorsSid = 33, 2555 WinBuiltinReplicatorSid = 34, 2556 WinBuiltinPreWindows2000CompatibleAccessSid = 35, 2557 WinBuiltinRemoteDesktopUsersSid = 36, 2558 WinBuiltinNetworkConfigurationOperatorsSid = 37, 2559 WinAccountAdministratorSid = 38, 2560 WinAccountGuestSid = 39, 2561 WinAccountKrbtgtSid = 40, 2562 WinAccountDomainAdminsSid = 41, 2563 WinAccountDomainUsersSid = 42, 2564 WinAccountDomainGuestsSid = 43, 2565 WinAccountComputersSid = 44, 2566 WinAccountControllersSid = 45, 2567 WinAccountCertAdminsSid = 46, 2568 WinAccountSchemaAdminsSid = 47, 2569 WinAccountEnterpriseAdminsSid = 48, 2570 WinAccountPolicyAdminsSid = 49, 2571 WinAccountRasAndIasServersSid = 50, 2572 WinNTLMAuthenticationSid = 51, 2573 WinDigestAuthenticationSid = 52, 2574 WinSChannelAuthenticationSid = 53, 2575 WinThisOrganizationSid = 54, 2576 WinOtherOrganizationSid = 55, 2577 WinBuiltinIncomingForestTrustBuildersSid = 56, 2578 WinBuiltinPerfMonitoringUsersSid = 57, 2579 WinBuiltinPerfLoggingUsersSid = 58, 2580 WinBuiltinAuthorizationAccessSid = 59, 2581 WinBuiltinTerminalServerLicenseServersSid = 60, 2582 WinBuiltinDCOMUsersSid = 61, 2583 WinBuiltinIUsersSid = 62, 2584 WinIUserSid = 63, 2585 WinBuiltinCryptoOperatorsSid = 64, 2586 WinUntrustedLabelSid = 65, 2587 WinLowLabelSid = 66, 2588 WinMediumLabelSid = 67, 2589 WinHighLabelSid = 68, 2590 WinSystemLabelSid = 69, 2591 WinWriteRestrictedCodeSid = 70, 2592 WinCreatorOwnerRightsSid = 71, 2593 WinCacheablePrincipalsGroupSid = 72, 2594 WinNonCacheablePrincipalsGroupSid = 73, 2595 WinEnterpriseReadonlyControllersSid = 74, 2596 WinAccountReadonlyControllersSid = 75, 2597 WinBuiltinEventLogReadersGroup = 76, 2598 WinNewEnterpriseReadonlyControllersSid = 77, 2599 WinBuiltinCertSvcDComAccessGroup = 78, 2600 WinMediumPlusLabelSid = 79, 2601 WinLocalLogonSid = 80, 2602 WinConsoleLogonSid = 81, 2603 WinThisOrganizationCertificateSid = 82, 2604 WinApplicationPackageAuthoritySid = 83, 2605 WinBuiltinAnyPackageSid = 84, 2606 WinCapabilityInternetClientSid = 85, 2607 WinCapabilityInternetClientServerSid = 86, 2608 WinCapabilityPrivateNetworkClientServerSid = 87, 2609 WinCapabilityPicturesLibrarySid = 88, 2610 WinCapabilityVideosLibrarySid = 89, 2611 WinCapabilityMusicLibrarySid = 90, 2612 WinCapabilityDocumentsLibrarySid = 91, 2613 WinCapabilitySharedUserCertificatesSid = 92, 2614 WinCapabilityEnterpriseAuthenticationSid = 93, 2615 WinCapabilityRemovableStorageSid = 94 2616 } 2617 2618 struct QUOTA_LIMITS { 2619 SIZE_T PagedPoolLimit; 2620 SIZE_T NonPagedPoolLimit; 2621 SIZE_T MinimumWorkingSetSize; 2622 SIZE_T MaximumWorkingSetSize; 2623 SIZE_T PagefileLimit; 2624 LARGE_INTEGER TimeLimit; 2625 } 2626 alias QUOTA_LIMITS* PQUOTA_LIMITS; 2627 2628 struct IO_COUNTERS { 2629 ULONGLONG ReadOperationCount; 2630 ULONGLONG WriteOperationCount; 2631 ULONGLONG OtherOperationCount; 2632 ULONGLONG ReadTransferCount; 2633 ULONGLONG WriteTransferCount; 2634 ULONGLONG OtherTransferCount; 2635 } 2636 alias IO_COUNTERS* PIO_COUNTERS; 2637 2638 struct FILE_NOTIFY_INFORMATION { 2639 DWORD NextEntryOffset; 2640 DWORD Action; 2641 DWORD FileNameLength; 2642 WCHAR _FileName; 2643 2644 WCHAR* FileName() return scope { return &_FileName; } 2645 } 2646 alias FILE_NOTIFY_INFORMATION* PFILE_NOTIFY_INFORMATION; 2647 2648 struct TAPE_ERASE { 2649 DWORD Type; 2650 BOOLEAN Immediate; 2651 } 2652 alias TAPE_ERASE* PTAPE_ERASE; 2653 2654 struct TAPE_GET_DRIVE_PARAMETERS { 2655 BOOLEAN ECC; 2656 BOOLEAN Compression; 2657 BOOLEAN DataPadding; 2658 BOOLEAN ReportSetmarks; 2659 DWORD DefaultBlockSize; 2660 DWORD MaximumBlockSize; 2661 DWORD MinimumBlockSize; 2662 DWORD MaximumPartitionCount; 2663 DWORD FeaturesLow; 2664 DWORD FeaturesHigh; 2665 DWORD EOTWarningZoneSize; 2666 } 2667 alias TAPE_GET_DRIVE_PARAMETERS* PTAPE_GET_DRIVE_PARAMETERS; 2668 2669 struct TAPE_GET_MEDIA_PARAMETERS { 2670 LARGE_INTEGER Capacity; 2671 LARGE_INTEGER Remaining; 2672 DWORD BlockSize; 2673 DWORD PartitionCount; 2674 BOOLEAN WriteProtected; 2675 } 2676 alias TAPE_GET_MEDIA_PARAMETERS* PTAPE_GET_MEDIA_PARAMETERS; 2677 2678 struct TAPE_GET_POSITION { 2679 ULONG Type; 2680 ULONG Partition; 2681 ULONG OffsetLow; 2682 ULONG OffsetHigh; 2683 } 2684 alias TAPE_GET_POSITION* PTAPE_GET_POSITION; 2685 2686 struct TAPE_PREPARE { 2687 DWORD Operation; 2688 BOOLEAN Immediate; 2689 } 2690 alias TAPE_PREPARE* PTAPE_PREPARE; 2691 2692 struct TAPE_SET_DRIVE_PARAMETERS { 2693 BOOLEAN ECC; 2694 BOOLEAN Compression; 2695 BOOLEAN DataPadding; 2696 BOOLEAN ReportSetmarks; 2697 ULONG EOTWarningZoneSize; 2698 } 2699 alias TAPE_SET_DRIVE_PARAMETERS* PTAPE_SET_DRIVE_PARAMETERS; 2700 2701 struct TAPE_SET_MEDIA_PARAMETERS { 2702 ULONG BlockSize; 2703 } 2704 alias TAPE_SET_MEDIA_PARAMETERS* PTAPE_SET_MEDIA_PARAMETERS; 2705 2706 struct TAPE_SET_POSITION { 2707 DWORD Method; 2708 DWORD Partition; 2709 LARGE_INTEGER Offset; 2710 BOOLEAN Immediate; 2711 } 2712 alias TAPE_SET_POSITION* PTAPE_SET_POSITION; 2713 2714 struct TAPE_WRITE_MARKS { 2715 DWORD Type; 2716 DWORD Count; 2717 BOOLEAN Immediate; 2718 } 2719 alias TAPE_WRITE_MARKS* PTAPE_WRITE_MARKS; 2720 2721 struct TAPE_CREATE_PARTITION { 2722 DWORD Method; 2723 DWORD Count; 2724 DWORD Size; 2725 } 2726 alias TAPE_CREATE_PARTITION* PTAPE_CREATE_PARTITION; 2727 2728 struct MEMORY_BASIC_INFORMATION { 2729 PVOID BaseAddress; 2730 PVOID AllocationBase; 2731 DWORD AllocationProtect; 2732 DWORD RegionSize; 2733 DWORD State; 2734 DWORD Protect; 2735 DWORD Type; 2736 } 2737 alias MEMORY_BASIC_INFORMATION* PMEMORY_BASIC_INFORMATION; 2738 2739 struct MESSAGE_RESOURCE_ENTRY { 2740 WORD Length; 2741 WORD Flags; 2742 BYTE _Text; 2743 2744 BYTE* Text() return scope { return &_Text; } 2745 } 2746 alias MESSAGE_RESOURCE_ENTRY* PMESSAGE_RESOURCE_ENTRY; 2747 2748 struct MESSAGE_RESOURCE_BLOCK { 2749 DWORD LowId; 2750 DWORD HighId; 2751 DWORD OffsetToEntries; 2752 } 2753 alias MESSAGE_RESOURCE_BLOCK* PMESSAGE_RESOURCE_BLOCK; 2754 2755 struct MESSAGE_RESOURCE_DATA { 2756 DWORD NumberOfBlocks; 2757 MESSAGE_RESOURCE_BLOCK _Blocks; 2758 2759 MESSAGE_RESOURCE_BLOCK* Blocks() return scope { return &_Blocks; } 2760 } 2761 alias MESSAGE_RESOURCE_DATA* PMESSAGE_RESOURCE_DATA; 2762 2763 struct LIST_ENTRY { 2764 LIST_ENTRY* Flink; 2765 LIST_ENTRY* Blink; 2766 } 2767 alias LIST_ENTRY* PLIST_ENTRY; 2768 2769 struct SINGLE_LIST_ENTRY { 2770 SINGLE_LIST_ENTRY* Next; 2771 } 2772 alias SINGLE_LIST_ENTRY SLIST_ENTRY; 2773 alias SINGLE_LIST_ENTRY* PSINGLE_LIST_ENTRY, PSLIST_ENTRY; 2774 2775 union SLIST_HEADER { 2776 ULONGLONG Alignment; 2777 struct { 2778 SLIST_ENTRY Next; 2779 WORD Depth; 2780 WORD Sequence; 2781 } 2782 } 2783 alias SLIST_HEADER* PSLIST_HEADER; 2784 2785 struct RTL_CRITICAL_SECTION_DEBUG { 2786 WORD Type; 2787 WORD CreatorBackTraceIndex; 2788 RTL_CRITICAL_SECTION* CriticalSection; 2789 LIST_ENTRY ProcessLocksList; 2790 DWORD EntryCount; 2791 DWORD ContentionCount; 2792 DWORD[2] Spare; 2793 } 2794 alias RTL_CRITICAL_SECTION_DEBUG* PRTL_CRITICAL_SECTION_DEBUG; 2795 2796 struct RTL_CRITICAL_SECTION { 2797 PRTL_CRITICAL_SECTION_DEBUG DebugInfo; 2798 LONG LockCount; 2799 LONG RecursionCount; 2800 HANDLE OwningThread; 2801 HANDLE LockSemaphore; 2802 DWORD Reserved; 2803 } 2804 alias RTL_CRITICAL_SECTION* PRTL_CRITICAL_SECTION; 2805 2806 struct EVENTLOGRECORD { 2807 DWORD Length; 2808 DWORD Reserved; 2809 DWORD RecordNumber; 2810 DWORD TimeGenerated; 2811 DWORD TimeWritten; 2812 DWORD EventID; 2813 WORD EventType; 2814 WORD NumStrings; 2815 WORD EventCategory; 2816 WORD ReservedFlags; 2817 DWORD ClosingRecordNumber; 2818 DWORD StringOffset; 2819 DWORD UserSidLength; 2820 DWORD UserSidOffset; 2821 DWORD DataLength; 2822 DWORD DataOffset; 2823 } 2824 alias EVENTLOGRECORD* PEVENTLOGRECORD; 2825 2826 struct OSVERSIONINFOA { 2827 DWORD dwOSVersionInfoSize = OSVERSIONINFOA.sizeof; 2828 DWORD dwMajorVersion; 2829 DWORD dwMinorVersion; 2830 DWORD dwBuildNumber; 2831 DWORD dwPlatformId; 2832 CHAR[128] szCSDVersion; 2833 } 2834 alias OSVERSIONINFOA* POSVERSIONINFOA, LPOSVERSIONINFOA; 2835 2836 struct OSVERSIONINFOW { 2837 DWORD dwOSVersionInfoSize = OSVERSIONINFOW.sizeof; 2838 DWORD dwMajorVersion; 2839 DWORD dwMinorVersion; 2840 DWORD dwBuildNumber; 2841 DWORD dwPlatformId; 2842 WCHAR[128] szCSDVersion; 2843 } 2844 alias OSVERSIONINFOW* POSVERSIONINFOW, LPOSVERSIONINFOW; 2845 2846 struct OSVERSIONINFOEXA { 2847 DWORD dwOSVersionInfoSize; 2848 DWORD dwMajorVersion; 2849 DWORD dwMinorVersion; 2850 DWORD dwBuildNumber; 2851 DWORD dwPlatformId; 2852 CHAR[128] szCSDVersion; 2853 WORD wServicePackMajor; 2854 WORD wServicePackMinor; 2855 WORD wSuiteMask; 2856 BYTE wProductType; 2857 BYTE wReserved; 2858 } 2859 alias OSVERSIONINFOEXA* POSVERSIONINFOEXA, LPOSVERSIONINFOEXA; 2860 2861 struct OSVERSIONINFOEXW { 2862 DWORD dwOSVersionInfoSize = OSVERSIONINFOEXW.sizeof; 2863 DWORD dwMajorVersion; 2864 DWORD dwMinorVersion; 2865 DWORD dwBuildNumber; 2866 DWORD dwPlatformId; 2867 WCHAR[128] szCSDVersion; 2868 WORD wServicePackMajor; 2869 WORD wServicePackMinor; 2870 WORD wSuiteMask; 2871 BYTE wProductType; 2872 BYTE wReserved; 2873 } 2874 alias OSVERSIONINFOEXW* POSVERSIONINFOEXW, LPOSVERSIONINFOEXW; 2875 2876 align(2) struct IMAGE_VXD_HEADER { 2877 WORD e32_magic; 2878 BYTE e32_border; 2879 BYTE e32_worder; 2880 DWORD e32_level; 2881 WORD e32_cpu; 2882 WORD e32_os; 2883 DWORD e32_ver; 2884 DWORD e32_mflags; 2885 DWORD e32_mpages; 2886 DWORD e32_startobj; 2887 DWORD e32_eip; 2888 DWORD e32_stackobj; 2889 DWORD e32_esp; 2890 DWORD e32_pagesize; 2891 DWORD e32_lastpagesize; 2892 DWORD e32_fixupsize; 2893 DWORD e32_fixupsum; 2894 DWORD e32_ldrsize; 2895 DWORD e32_ldrsum; 2896 DWORD e32_objtab; 2897 DWORD e32_objcnt; 2898 DWORD e32_objmap; 2899 DWORD e32_itermap; 2900 DWORD e32_rsrctab; 2901 DWORD e32_rsrccnt; 2902 DWORD e32_restab; 2903 DWORD e32_enttab; 2904 DWORD e32_dirtab; 2905 DWORD e32_dircnt; 2906 DWORD e32_fpagetab; 2907 DWORD e32_frectab; 2908 DWORD e32_impmod; 2909 DWORD e32_impmodcnt; 2910 DWORD e32_impproc; 2911 DWORD e32_pagesum; 2912 DWORD e32_datapage; 2913 DWORD e32_preload; 2914 DWORD e32_nrestab; 2915 DWORD e32_cbnrestab; 2916 DWORD e32_nressum; 2917 DWORD e32_autodata; 2918 DWORD e32_debuginfo; 2919 DWORD e32_debuglen; 2920 DWORD e32_instpreload; 2921 DWORD e32_instdemand; 2922 DWORD e32_heapsize; 2923 BYTE[12] e32_res3; 2924 DWORD e32_winresoff; 2925 DWORD e32_winreslen; 2926 WORD e32_devid; 2927 WORD e32_ddkver; 2928 } 2929 alias IMAGE_VXD_HEADER* PIMAGE_VXD_HEADER; 2930 2931 align(4): 2932 struct IMAGE_FILE_HEADER { 2933 WORD Machine; 2934 WORD NumberOfSections; 2935 DWORD TimeDateStamp; 2936 DWORD PointerToSymbolTable; 2937 DWORD NumberOfSymbols; 2938 WORD SizeOfOptionalHeader; 2939 WORD Characteristics; 2940 } 2941 alias IMAGE_FILE_HEADER* PIMAGE_FILE_HEADER; 2942 // const IMAGE_SIZEOF_FILE_HEADER = IMAGE_FILE_HEADER.sizeof; 2943 2944 struct IMAGE_DATA_DIRECTORY { 2945 DWORD VirtualAddress; 2946 DWORD Size; 2947 } 2948 alias IMAGE_DATA_DIRECTORY* PIMAGE_DATA_DIRECTORY; 2949 2950 struct IMAGE_OPTIONAL_HEADER32 { 2951 WORD Magic; 2952 BYTE MajorLinkerVersion; 2953 BYTE MinorLinkerVersion; 2954 DWORD SizeOfCode; 2955 DWORD SizeOfInitializedData; 2956 DWORD SizeOfUninitializedData; 2957 DWORD AddressOfEntryPoint; 2958 DWORD BaseOfCode; 2959 DWORD BaseOfData; 2960 DWORD ImageBase; 2961 DWORD SectionAlignment; 2962 DWORD FileAlignment; 2963 WORD MajorOperatingSystemVersion; 2964 WORD MinorOperatingSystemVersion; 2965 WORD MajorImageVersion; 2966 WORD MinorImageVersion; 2967 WORD MajorSubsystemVersion; 2968 WORD MinorSubsystemVersion; 2969 DWORD Win32VersionValue; 2970 DWORD SizeOfImage; 2971 DWORD SizeOfHeaders; 2972 DWORD CheckSum; 2973 WORD Subsystem; 2974 WORD DllCharacteristics; 2975 DWORD SizeOfStackReserve; 2976 DWORD SizeOfStackCommit; 2977 DWORD SizeOfHeapReserve; 2978 DWORD SizeOfHeapCommit; 2979 DWORD LoaderFlags; 2980 DWORD NumberOfRvaAndSizes; 2981 IMAGE_DATA_DIRECTORY[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] DataDirectory; 2982 } 2983 alias IMAGE_OPTIONAL_HEADER32* PIMAGE_OPTIONAL_HEADER32; 2984 2985 struct IMAGE_OPTIONAL_HEADER64 { 2986 WORD Magic; 2987 BYTE MajorLinkerVersion; 2988 BYTE MinorLinkerVersion; 2989 DWORD SizeOfCode; 2990 DWORD SizeOfInitializedData; 2991 DWORD SizeOfUninitializedData; 2992 DWORD AddressOfEntryPoint; 2993 DWORD BaseOfCode; 2994 ULONGLONG ImageBase; 2995 DWORD SectionAlignment; 2996 DWORD FileAlignment; 2997 WORD MajorOperatingSystemVersion; 2998 WORD MinorOperatingSystemVersion; 2999 WORD MajorImageVersion; 3000 WORD MinorImageVersion; 3001 WORD MajorSubsystemVersion; 3002 WORD MinorSubsystemVersion; 3003 DWORD Win32VersionValue; 3004 DWORD SizeOfImage; 3005 DWORD SizeOfHeaders; 3006 DWORD CheckSum; 3007 WORD Subsystem; 3008 WORD DllCharacteristics; 3009 ULONGLONG SizeOfStackReserve; 3010 ULONGLONG SizeOfStackCommit; 3011 ULONGLONG SizeOfHeapReserve; 3012 ULONGLONG SizeOfHeapCommit; 3013 DWORD LoaderFlags; 3014 DWORD NumberOfRvaAndSizes; 3015 IMAGE_DATA_DIRECTORY[IMAGE_NUMBEROF_DIRECTORY_ENTRIES] DataDirectory; 3016 } 3017 alias IMAGE_OPTIONAL_HEADER64* PIMAGE_OPTIONAL_HEADER64; 3018 3019 struct IMAGE_ROM_OPTIONAL_HEADER { 3020 WORD Magic; 3021 BYTE MajorLinkerVersion; 3022 BYTE MinorLinkerVersion; 3023 DWORD SizeOfCode; 3024 DWORD SizeOfInitializedData; 3025 DWORD SizeOfUninitializedData; 3026 DWORD AddressOfEntryPoint; 3027 DWORD BaseOfCode; 3028 DWORD BaseOfData; 3029 DWORD BaseOfBss; 3030 DWORD GprMask; 3031 DWORD[4] CprMask; 3032 DWORD GpValue; 3033 } 3034 alias IMAGE_ROM_OPTIONAL_HEADER* PIMAGE_ROM_OPTIONAL_HEADER; 3035 3036 align(2): 3037 struct IMAGE_DOS_HEADER { 3038 WORD e_magic; 3039 WORD e_cblp; 3040 WORD e_cp; 3041 WORD e_crlc; 3042 WORD e_cparhdr; 3043 WORD e_minalloc; 3044 WORD e_maxalloc; 3045 WORD e_ss; 3046 WORD e_sp; 3047 WORD e_csum; 3048 WORD e_ip; 3049 WORD e_cs; 3050 WORD e_lfarlc; 3051 WORD e_ovno; 3052 WORD[4] e_res; 3053 WORD e_oemid; 3054 WORD e_oeminfo; 3055 WORD[10] e_res2; 3056 LONG e_lfanew; 3057 } 3058 alias IMAGE_DOS_HEADER* PIMAGE_DOS_HEADER; 3059 3060 struct IMAGE_OS2_HEADER { 3061 WORD ne_magic; 3062 CHAR ne_ver; 3063 CHAR ne_rev; 3064 WORD ne_enttab; 3065 WORD ne_cbenttab; 3066 LONG ne_crc; 3067 WORD ne_flags; 3068 WORD ne_autodata; 3069 WORD ne_heap; 3070 WORD ne_stack; 3071 LONG ne_csip; 3072 LONG ne_sssp; 3073 WORD ne_cseg; 3074 WORD ne_cmod; 3075 WORD ne_cbnrestab; 3076 WORD ne_segtab; 3077 WORD ne_rsrctab; 3078 WORD ne_restab; 3079 WORD ne_modtab; 3080 WORD ne_imptab; 3081 LONG ne_nrestab; 3082 WORD ne_cmovent; 3083 WORD ne_align; 3084 WORD ne_cres; 3085 BYTE ne_exetyp; 3086 BYTE ne_flagsothers; 3087 WORD ne_pretthunks; 3088 WORD ne_psegrefbytes; 3089 WORD ne_swaparea; 3090 WORD ne_expver; 3091 } 3092 alias IMAGE_OS2_HEADER* PIMAGE_OS2_HEADER; 3093 3094 align(4) struct IMAGE_NT_HEADERS32 { 3095 DWORD Signature; 3096 IMAGE_FILE_HEADER FileHeader; 3097 IMAGE_OPTIONAL_HEADER OptionalHeader; 3098 } 3099 alias IMAGE_NT_HEADERS32* PIMAGE_NT_HEADERS32; 3100 3101 align(4) struct IMAGE_NT_HEADERS64 { 3102 DWORD Signature; 3103 IMAGE_FILE_HEADER FileHeader; 3104 IMAGE_OPTIONAL_HEADER OptionalHeader; 3105 } 3106 alias IMAGE_NT_HEADERS64* PIMAGE_NT_HEADERS64; 3107 3108 struct IMAGE_ROM_HEADERS { 3109 IMAGE_FILE_HEADER FileHeader; 3110 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; 3111 } 3112 alias IMAGE_ROM_HEADERS* PIMAGE_ROM_HEADERS; 3113 3114 struct IMAGE_SECTION_HEADER { 3115 BYTE[IMAGE_SIZEOF_SHORT_NAME] Name; 3116 union _Misc { 3117 DWORD PhysicalAddress; 3118 DWORD VirtualSize; 3119 } 3120 _Misc Misc; 3121 DWORD VirtualAddress; 3122 DWORD SizeOfRawData; 3123 DWORD PointerToRawData; 3124 DWORD PointerToRelocations; 3125 DWORD PointerToLinenumbers; 3126 WORD NumberOfRelocations; 3127 WORD NumberOfLinenumbers; 3128 DWORD Characteristics; 3129 } 3130 alias IMAGE_SECTION_HEADER* PIMAGE_SECTION_HEADER; 3131 3132 struct IMAGE_SYMBOL { 3133 union _N { 3134 BYTE[8] ShortName; 3135 struct Name { 3136 DWORD Short; 3137 DWORD Long; 3138 } 3139 PBYTE[2] LongName; 3140 } 3141 _N N; 3142 DWORD Value; 3143 SHORT SectionNumber; 3144 WORD Type; 3145 BYTE StorageClass; 3146 BYTE NumberOfAuxSymbols; 3147 } 3148 alias IMAGE_SYMBOL* PIMAGE_SYMBOL; 3149 3150 union IMAGE_AUX_SYMBOL { 3151 struct _Sym { 3152 DWORD TagIndex; 3153 union _Misc { 3154 struct _LnSz { 3155 WORD Linenumber; 3156 WORD Size; 3157 } 3158 _LnSz LnSz; 3159 DWORD TotalSize; 3160 } 3161 _Misc Misc; 3162 union _FcnAry { 3163 struct _Function { 3164 DWORD PointerToLinenumber; 3165 DWORD PointerToNextFunction; 3166 } 3167 _Function Function; 3168 struct _Array { 3169 WORD[4] Dimension; 3170 } 3171 _Array Array; 3172 } 3173 _FcnAry FcnAry; 3174 WORD TvIndex; 3175 } 3176 _Sym Sym; 3177 struct _File { 3178 BYTE[IMAGE_SIZEOF_SYMBOL] Name; 3179 } 3180 _File File; 3181 struct _Section { 3182 DWORD Length; 3183 WORD NumberOfRelocations; 3184 WORD NumberOfLinenumbers; 3185 DWORD CheckSum; 3186 SHORT Number; 3187 BYTE Selection; 3188 } 3189 _Section Section; 3190 } 3191 alias IMAGE_AUX_SYMBOL* PIMAGE_AUX_SYMBOL; 3192 3193 struct IMAGE_COFF_SYMBOLS_HEADER { 3194 DWORD NumberOfSymbols; 3195 DWORD LvaToFirstSymbol; 3196 DWORD NumberOfLinenumbers; 3197 DWORD LvaToFirstLinenumber; 3198 DWORD RvaToFirstByteOfCode; 3199 DWORD RvaToLastByteOfCode; 3200 DWORD RvaToFirstByteOfData; 3201 DWORD RvaToLastByteOfData; 3202 } 3203 alias IMAGE_COFF_SYMBOLS_HEADER* PIMAGE_COFF_SYMBOLS_HEADER; 3204 3205 struct IMAGE_RELOCATION { 3206 union { 3207 DWORD VirtualAddress; 3208 DWORD RelocCount; 3209 } 3210 DWORD SymbolTableIndex; 3211 WORD Type; 3212 } 3213 alias IMAGE_RELOCATION* PIMAGE_RELOCATION; 3214 3215 align(4) struct IMAGE_BASE_RELOCATION { 3216 DWORD VirtualAddress; 3217 DWORD SizeOfBlock; 3218 } 3219 alias IMAGE_BASE_RELOCATION* PIMAGE_BASE_RELOCATION; 3220 3221 align(2) struct IMAGE_LINENUMBER { 3222 union _Type { 3223 DWORD SymbolTableIndex; 3224 DWORD VirtualAddress; 3225 } 3226 _Type Type; 3227 WORD Linenumber; 3228 } 3229 alias IMAGE_LINENUMBER* PIMAGE_LINENUMBER; 3230 3231 align(4): 3232 struct IMAGE_ARCHIVE_MEMBER_HEADER { 3233 BYTE[16] Name; 3234 BYTE[12] Date; 3235 BYTE[6] UserID; 3236 BYTE[6] GroupID; 3237 BYTE[8] Mode; 3238 BYTE[10] Size; 3239 BYTE[2] EndHeader; 3240 } 3241 alias IMAGE_ARCHIVE_MEMBER_HEADER* PIMAGE_ARCHIVE_MEMBER_HEADER; 3242 3243 struct IMAGE_EXPORT_DIRECTORY { 3244 DWORD Characteristics; 3245 DWORD TimeDateStamp; 3246 WORD MajorVersion; 3247 WORD MinorVersion; 3248 DWORD Name; 3249 DWORD Base; 3250 DWORD NumberOfFunctions; 3251 DWORD NumberOfNames; 3252 DWORD AddressOfFunctions; 3253 DWORD AddressOfNames; 3254 DWORD AddressOfNameOrdinals; 3255 } 3256 alias IMAGE_EXPORT_DIRECTORY* PIMAGE_EXPORT_DIRECTORY; 3257 3258 struct IMAGE_IMPORT_BY_NAME { 3259 WORD Hint; 3260 BYTE _Name; 3261 3262 BYTE* Name() return scope { 3263 return &_Name; 3264 } 3265 } 3266 alias IMAGE_IMPORT_BY_NAME* PIMAGE_IMPORT_BY_NAME; 3267 3268 struct IMAGE_THUNK_DATA32 { 3269 union _u1 { 3270 DWORD ForwarderString; 3271 DWORD Function; 3272 DWORD Ordinal; 3273 DWORD AddressOfData; 3274 } 3275 _u1 u1; 3276 } 3277 alias IMAGE_THUNK_DATA32* PIMAGE_THUNK_DATA32; 3278 3279 struct IMAGE_THUNK_DATA64 { 3280 union _u1 { 3281 ULONGLONG ForwarderString; 3282 ULONGLONG Function; 3283 ULONGLONG Ordinal; 3284 ULONGLONG AddressOfData; 3285 } 3286 _u1 u1; 3287 } 3288 alias IMAGE_THUNK_DATA64* PIMAGE_THUNK_DATA64; 3289 3290 struct IMAGE_IMPORT_DESCRIPTOR { 3291 union { 3292 DWORD Characteristics; 3293 DWORD OriginalFirstThunk; 3294 } 3295 DWORD TimeDateStamp; 3296 DWORD ForwarderChain; 3297 DWORD Name; 3298 DWORD FirstThunk; 3299 } 3300 alias IMAGE_IMPORT_DESCRIPTOR* PIMAGE_IMPORT_DESCRIPTOR; 3301 3302 struct IMAGE_BOUND_IMPORT_DESCRIPTOR { 3303 DWORD TimeDateStamp; 3304 WORD OffsetModuleName; 3305 WORD NumberOfModuleForwarderRefs; 3306 } 3307 alias IMAGE_BOUND_IMPORT_DESCRIPTOR* PIMAGE_BOUND_IMPORT_DESCRIPTOR; 3308 3309 struct IMAGE_BOUND_FORWARDER_REF { 3310 DWORD TimeDateStamp; 3311 WORD OffsetModuleName; 3312 WORD Reserved; 3313 } 3314 alias IMAGE_BOUND_FORWARDER_REF* PIMAGE_BOUND_FORWARDER_REF; 3315 3316 struct IMAGE_TLS_DIRECTORY32 { 3317 DWORD StartAddressOfRawData; 3318 DWORD EndAddressOfRawData; 3319 DWORD AddressOfIndex; 3320 DWORD AddressOfCallBacks; 3321 DWORD SizeOfZeroFill; 3322 DWORD Characteristics; 3323 } 3324 alias IMAGE_TLS_DIRECTORY32* PIMAGE_TLS_DIRECTORY32; 3325 3326 struct IMAGE_TLS_DIRECTORY64 { 3327 ULONGLONG StartAddressOfRawData; 3328 ULONGLONG EndAddressOfRawData; 3329 ULONGLONG AddressOfIndex; 3330 ULONGLONG AddressOfCallBacks; 3331 DWORD SizeOfZeroFill; 3332 DWORD Characteristics; 3333 } 3334 alias IMAGE_TLS_DIRECTORY64* PIMAGE_TLS_DIRECTORY64; 3335 3336 struct IMAGE_RESOURCE_DIRECTORY { 3337 DWORD Characteristics; 3338 DWORD TimeDateStamp; 3339 WORD MajorVersion; 3340 WORD MinorVersion; 3341 WORD NumberOfNamedEntries; 3342 WORD NumberOfIdEntries; 3343 } 3344 alias IMAGE_RESOURCE_DIRECTORY* PIMAGE_RESOURCE_DIRECTORY; 3345 3346 struct IMAGE_RESOURCE_DIRECTORY_ENTRY { 3347 union { 3348 /+struct { 3349 DWORD NameOffset:31; 3350 DWORD NameIsString:1; 3351 }+/ 3352 DWORD Name; 3353 WORD Id; 3354 } 3355 DWORD OffsetToData; 3356 /+struct { 3357 DWORD OffsetToDirectory:31; 3358 DWORD DataIsDirectory:1; 3359 }+/ 3360 3361 uint NameOffset() { return Name & 0x7FFFFFFF; } 3362 bool NameIsString() { return cast(bool)(Name & 0x80000000); } 3363 uint OffsetToDirectory() { return OffsetToData & 0x7FFFFFFF; } 3364 bool DataIsDirectory() { return cast(bool)(OffsetToData & 0x80000000); } 3365 3366 uint NameOffset(uint n) { 3367 Name = (Name & 0x80000000) | (n & 0x7FFFFFFF); 3368 return n & 0x7FFFFFFF; 3369 } 3370 3371 bool NameIsString(bool n) { 3372 Name = (Name & 0x7FFFFFFF) | (n << 31); return n; 3373 } 3374 3375 uint OffsetToDirectory(uint o) { 3376 OffsetToData = (OffsetToData & 0x80000000) | (o & 0x7FFFFFFF); 3377 return o & 0x7FFFFFFF; 3378 } 3379 3380 bool DataIsDirectory(bool d) { 3381 OffsetToData = (OffsetToData & 0x7FFFFFFF) | (d << 31); return d; 3382 } 3383 } 3384 alias IMAGE_RESOURCE_DIRECTORY_ENTRY* PIMAGE_RESOURCE_DIRECTORY_ENTRY; 3385 3386 struct IMAGE_RESOURCE_DIRECTORY_STRING { 3387 WORD Length; 3388 CHAR _NameString; 3389 3390 CHAR* NameString() return scope { return &_NameString; } 3391 } 3392 alias IMAGE_RESOURCE_DIRECTORY_STRING* PIMAGE_RESOURCE_DIRECTORY_STRING; 3393 3394 struct IMAGE_RESOURCE_DIR_STRING_U { 3395 WORD Length; 3396 WCHAR _NameString; 3397 3398 WCHAR* NameString() return scope { return &_NameString; } 3399 } 3400 alias IMAGE_RESOURCE_DIR_STRING_U* PIMAGE_RESOURCE_DIR_STRING_U; 3401 3402 struct IMAGE_RESOURCE_DATA_ENTRY { 3403 DWORD OffsetToData; 3404 DWORD Size; 3405 DWORD CodePage; 3406 DWORD Reserved; 3407 } 3408 alias IMAGE_RESOURCE_DATA_ENTRY* PIMAGE_RESOURCE_DATA_ENTRY; 3409 3410 struct IMAGE_LOAD_CONFIG_DIRECTORY { 3411 DWORD Characteristics; 3412 DWORD TimeDateStamp; 3413 WORD MajorVersion; 3414 WORD MinorVersion; 3415 DWORD GlobalFlagsClear; 3416 DWORD GlobalFlagsSet; 3417 DWORD CriticalSectionDefaultTimeout; 3418 DWORD DeCommitFreeBlockThreshold; 3419 DWORD DeCommitTotalFreeThreshold; 3420 PVOID LockPrefixTable; 3421 DWORD MaximumAllocationSize; 3422 DWORD VirtualMemoryThreshold; 3423 DWORD ProcessHeapFlags; 3424 DWORD[4] Reserved; 3425 } 3426 alias IMAGE_LOAD_CONFIG_DIRECTORY* PIMAGE_LOAD_CONFIG_DIRECTORY; 3427 3428 struct IMAGE_LOAD_CONFIG_DIRECTORY64 { 3429 DWORD Characteristics; 3430 DWORD TimeDateStamp; 3431 WORD MajorVersion; 3432 WORD MinorVersion; 3433 DWORD GlobalFlagsClear; 3434 DWORD GlobalFlagsSet; 3435 DWORD CriticalSectionDefaultTimeout; 3436 ULONGLONG DeCommitFreeBlockThreshold; 3437 ULONGLONG DeCommitTotalFreeThreshold; 3438 ULONGLONG LockPrefixTable; 3439 ULONGLONG MaximumAllocationSize; 3440 ULONGLONG VirtualMemoryThreshold; 3441 ULONGLONG ProcessAffinityMask; 3442 DWORD ProcessHeapFlags; 3443 WORD CSDFlags; 3444 WORD Reserved1; 3445 ULONGLONG EditList; 3446 DWORD[2] Reserved; 3447 } 3448 alias IMAGE_LOAD_CONFIG_DIRECTORY64* PIMAGE_LOAD_CONFIG_DIRECTORY64; 3449 3450 struct IMAGE_RUNTIME_FUNCTION_ENTRY { 3451 DWORD BeginAddress; 3452 DWORD EndAddress; 3453 PVOID ExceptionHandler; 3454 PVOID HandlerData; 3455 DWORD PrologEndAddress; 3456 } 3457 alias IMAGE_RUNTIME_FUNCTION_ENTRY* PIMAGE_RUNTIME_FUNCTION_ENTRY; 3458 3459 struct IMAGE_CE_RUNTIME_FUNCTION_ENTRY { 3460 uint FuncStart; 3461 union { 3462 ubyte PrologLen; 3463 uint _bf; 3464 } 3465 /+ 3466 unsigned int FuncLen:22; 3467 unsigned int ThirtyTwoBit:1; 3468 unsigned int ExceptionFlag:1; 3469 +/ 3470 uint FuncLen() { return (_bf >> 8) & 0x3FFFFF; } 3471 bool ThirtyTwoBit() { return cast(bool)(_bf & 0x40000000); } 3472 bool ExceptionFlag() { return cast(bool)(_bf & 0x80000000); } 3473 3474 uint FuncLen(uint f) { 3475 _bf = (_bf & ~0x3FFFFF00) | ((f & 0x3FFFFF) << 8); return f & 0x3FFFFF; 3476 } 3477 3478 bool ThirtyTwoBit(bool t) { 3479 _bf = (_bf & ~0x40000000) | (t << 30); return t; 3480 } 3481 3482 bool ExceptionFlag(bool e) { 3483 _bf = (_bf & ~0x80000000) | (e << 31); return e; 3484 } 3485 } 3486 alias IMAGE_CE_RUNTIME_FUNCTION_ENTRY* PIMAGE_CE_RUNTIME_FUNCTION_ENTRY; 3487 3488 struct IMAGE_DEBUG_DIRECTORY { 3489 DWORD Characteristics; 3490 DWORD TimeDateStamp; 3491 WORD MajorVersion; 3492 WORD MinorVersion; 3493 DWORD Type; 3494 DWORD SizeOfData; 3495 DWORD AddressOfRawData; 3496 DWORD PointerToRawData; 3497 } 3498 alias IMAGE_DEBUG_DIRECTORY* PIMAGE_DEBUG_DIRECTORY; 3499 3500 struct FPO_DATA { 3501 DWORD ulOffStart; 3502 DWORD cbProcSize; 3503 DWORD cdwLocals; 3504 WORD cdwParams; 3505 ubyte cbProlog; 3506 ubyte _bf; 3507 /+ 3508 WORD cbRegs:3; 3509 WORD fHasSEH:1; 3510 WORD fUseBP:1; 3511 WORD reserved:1; 3512 WORD cbFrame:2; 3513 +/ 3514 ubyte cbRegs() { return cast(ubyte)(_bf & 0x07); } 3515 bool fHasSEH() { return cast(bool)(_bf & 0x08); } 3516 bool fUseBP() { return cast(bool)(_bf & 0x10); } 3517 bool reserved() { return cast(bool)(_bf & 0x20); } 3518 ubyte cbFrame() { return cast(ubyte)(_bf >> 6); } 3519 3520 ubyte cbRegs(ubyte c) { 3521 _bf = cast(ubyte) ((_bf & ~0x07) | (c & 0x07)); 3522 return cast(ubyte)(c & 0x07); 3523 } 3524 3525 bool fHasSEH(bool f) { _bf = cast(ubyte)((_bf & ~0x08) | (f << 3)); return f; } 3526 bool fUseBP(bool f) { _bf = cast(ubyte)((_bf & ~0x10) | (f << 4)); return f; } 3527 bool reserved(bool r) { _bf = cast(ubyte)((_bf & ~0x20) | (r << 5)); return r; } 3528 3529 ubyte cbFrame(ubyte c) { 3530 _bf = cast(ubyte) ((_bf & ~0xC0) | ((c & 0x03) << 6)); 3531 return cast(ubyte)(c & 0x03); 3532 } 3533 } 3534 alias FPO_DATA* PFPO_DATA; 3535 3536 struct IMAGE_DEBUG_MISC { 3537 DWORD DataType; 3538 DWORD Length; 3539 BOOLEAN Unicode; 3540 BYTE[3] Reserved; 3541 BYTE _Data; 3542 3543 BYTE* Data() return scope { return &_Data; } 3544 } 3545 alias IMAGE_DEBUG_MISC* PIMAGE_DEBUG_MISC; 3546 3547 struct IMAGE_FUNCTION_ENTRY { 3548 DWORD StartingAddress; 3549 DWORD EndingAddress; 3550 DWORD EndOfPrologue; 3551 } 3552 alias IMAGE_FUNCTION_ENTRY* PIMAGE_FUNCTION_ENTRY; 3553 3554 struct IMAGE_FUNCTION_ENTRY64 { 3555 ULONGLONG StartingAddress; 3556 ULONGLONG EndingAddress; 3557 union { 3558 ULONGLONG EndOfPrologue; 3559 ULONGLONG UnwindInfoAddress; 3560 } 3561 } 3562 alias IMAGE_FUNCTION_ENTRY64* PIMAGE_FUNCTION_ENTRY64; 3563 3564 struct IMAGE_SEPARATE_DEBUG_HEADER { 3565 WORD Signature; 3566 WORD Flags; 3567 WORD Machine; 3568 WORD Characteristics; 3569 DWORD TimeDateStamp; 3570 DWORD CheckSum; 3571 DWORD ImageBase; 3572 DWORD SizeOfImage; 3573 DWORD NumberOfSections; 3574 DWORD ExportedNamesSize; 3575 DWORD DebugDirectorySize; 3576 DWORD SectionAlignment; 3577 DWORD[2] Reserved; 3578 } 3579 alias IMAGE_SEPARATE_DEBUG_HEADER* PIMAGE_SEPARATE_DEBUG_HEADER; 3580 3581 enum SERVICE_NODE_TYPE { 3582 DriverType = SERVICE_KERNEL_DRIVER, 3583 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, 3584 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, 3585 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, 3586 AdapterType = SERVICE_ADAPTER, 3587 RecognizerType = SERVICE_RECOGNIZER_DRIVER 3588 } 3589 3590 enum SERVICE_LOAD_TYPE { 3591 BootLoad = SERVICE_BOOT_START, 3592 SystemLoad = SERVICE_SYSTEM_START, 3593 AutoLoad = SERVICE_AUTO_START, 3594 DemandLoad = SERVICE_DEMAND_START, 3595 DisableLoad = SERVICE_DISABLED 3596 } 3597 3598 enum SERVICE_ERROR_TYPE { 3599 IgnoreError = SERVICE_ERROR_IGNORE, 3600 NormalError = SERVICE_ERROR_NORMAL, 3601 SevereError = SERVICE_ERROR_SEVERE, 3602 CriticalError = SERVICE_ERROR_CRITICAL 3603 } 3604 alias SERVICE_ERROR_TYPE _CM_ERROR_CONTROL_TYPE; 3605 3606 //DAC: According to MSJ, 'UnderTheHood', May 1996, this 3607 // structure is not documented in any official Microsoft header file. 3608 alias void EXCEPTION_REGISTRATION_RECORD; 3609 3610 align: 3611 struct NT_TIB { 3612 EXCEPTION_REGISTRATION_RECORD *ExceptionList; 3613 PVOID StackBase; 3614 PVOID StackLimit; 3615 PVOID SubSystemTib; 3616 union { 3617 PVOID FiberData; 3618 DWORD Version; 3619 } 3620 PVOID ArbitraryUserPointer; 3621 NT_TIB *Self; 3622 } 3623 alias NT_TIB* PNT_TIB; 3624 3625 struct REPARSE_DATA_BUFFER { 3626 DWORD ReparseTag; 3627 WORD ReparseDataLength; 3628 WORD Reserved; 3629 union { 3630 struct _GenericReparseBuffer { 3631 BYTE _DataBuffer; 3632 3633 BYTE* DataBuffer() return scope { return &_DataBuffer; } 3634 } 3635 _GenericReparseBuffer GenericReparseBuffer; 3636 struct _SymbolicLinkReparseBuffer { 3637 WORD SubstituteNameOffset; 3638 WORD SubstituteNameLength; 3639 WORD PrintNameOffset; 3640 WORD PrintNameLength; 3641 // ??? This is in MinGW, but absent in MSDN docs 3642 ULONG Flags; 3643 WCHAR _PathBuffer; 3644 3645 WCHAR* PathBuffer() return scope { return &_PathBuffer; } 3646 } 3647 _SymbolicLinkReparseBuffer SymbolicLinkReparseBuffer; 3648 struct _MountPointReparseBuffer { 3649 WORD SubstituteNameOffset; 3650 WORD SubstituteNameLength; 3651 WORD PrintNameOffset; 3652 WORD PrintNameLength; 3653 WCHAR _PathBuffer; 3654 3655 WCHAR* PathBuffer() return scope { return &_PathBuffer; } 3656 } 3657 _MountPointReparseBuffer MountPointReparseBuffer; 3658 } 3659 } 3660 alias REPARSE_DATA_BUFFER *PREPARSE_DATA_BUFFER; 3661 3662 struct REPARSE_GUID_DATA_BUFFER { 3663 DWORD ReparseTag; 3664 WORD ReparseDataLength; 3665 WORD Reserved; 3666 GUID ReparseGuid; 3667 struct _GenericReparseBuffer { 3668 BYTE _DataBuffer; 3669 3670 BYTE* DataBuffer() return scope { return &_DataBuffer; } 3671 } 3672 _GenericReparseBuffer GenericReparseBuffer; 3673 } 3674 alias REPARSE_GUID_DATA_BUFFER* PREPARSE_GUID_DATA_BUFFER; 3675 3676 const size_t 3677 REPARSE_DATA_BUFFER_HEADER_SIZE = REPARSE_DATA_BUFFER.GenericReparseBuffer.offsetof, 3678 REPARSE_GUID_DATA_BUFFER_HEADER_SIZE = REPARSE_GUID_DATA_BUFFER.GenericReparseBuffer.offsetof, 3679 MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16384; 3680 3681 3682 struct REPARSE_POINT_INFORMATION { 3683 WORD ReparseDataLength; 3684 WORD UnparsedNameLength; 3685 } 3686 alias REPARSE_POINT_INFORMATION* PREPARSE_POINT_INFORMATION; 3687 3688 union FILE_SEGMENT_ELEMENT { 3689 PVOID64 Buffer; 3690 ULONGLONG Alignment; 3691 } 3692 alias FILE_SEGMENT_ELEMENT* PFILE_SEGMENT_ELEMENT; 3693 3694 // JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants 3695 const DWORD 3696 JOB_OBJECT_LIMIT_WORKINGSET = 0x0001, 3697 JOB_OBJECT_LIMIT_PROCESS_TIME = 0x0002, 3698 JOB_OBJECT_LIMIT_JOB_TIME = 0x0004, 3699 JOB_OBJECT_LIMIT_ACTIVE_PROCESS = 0x0008, 3700 JOB_OBJECT_LIMIT_AFFINITY = 0x0010, 3701 JOB_OBJECT_LIMIT_PRIORITY_CLASS = 0x0020, 3702 JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME = 0x0040, 3703 JOB_OBJECT_LIMIT_SCHEDULING_CLASS = 0x0080, 3704 JOB_OBJECT_LIMIT_PROCESS_MEMORY = 0x0100, 3705 JOB_OBJECT_LIMIT_JOB_MEMORY = 0x0200, 3706 JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION = 0x0400, 3707 JOB_OBJECT_BREAKAWAY_OK = 0x0800, 3708 JOB_OBJECT_SILENT_BREAKAWAY = 0x1000; 3709 3710 // JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants 3711 const DWORD 3712 JOB_OBJECT_UILIMIT_HANDLES = 0x0001, 3713 JOB_OBJECT_UILIMIT_READCLIPBOARD = 0x0002, 3714 JOB_OBJECT_UILIMIT_WRITECLIPBOARD = 0x0004, 3715 JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS = 0x0008, 3716 JOB_OBJECT_UILIMIT_DISPLAYSETTINGS = 0x0010, 3717 JOB_OBJECT_UILIMIT_GLOBALATOMS = 0x0020, 3718 JOB_OBJECT_UILIMIT_DESKTOP = 0x0040, 3719 JOB_OBJECT_UILIMIT_EXITWINDOWS = 0x0080; 3720 3721 // JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants 3722 const DWORD 3723 JOB_OBJECT_SECURITY_NO_ADMIN = 0x0001, 3724 JOB_OBJECT_SECURITY_RESTRICTED_TOKEN = 0x0002, 3725 JOB_OBJECT_SECURITY_ONLY_TOKEN = 0x0004, 3726 JOB_OBJECT_SECURITY_FILTER_TOKENS = 0x0008; 3727 3728 // JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants 3729 enum : DWORD { 3730 JOB_OBJECT_TERMINATE_AT_END_OF_JOB, 3731 JOB_OBJECT_POST_AT_END_OF_JOB 3732 } 3733 3734 enum : DWORD { 3735 JOB_OBJECT_MSG_END_OF_JOB_TIME = 1, 3736 JOB_OBJECT_MSG_END_OF_PROCESS_TIME, 3737 JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT, 3738 JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO, 3739 JOB_OBJECT_MSG_NEW_PROCESS, 3740 JOB_OBJECT_MSG_EXIT_PROCESS, 3741 JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS, 3742 JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT, 3743 JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 3744 } 3745 3746 enum JOBOBJECTINFOCLASS { 3747 JobObjectBasicAccountingInformation = 1, 3748 JobObjectBasicLimitInformation, 3749 JobObjectBasicProcessIdList, 3750 JobObjectBasicUIRestrictions, 3751 JobObjectSecurityLimitInformation, 3752 JobObjectEndOfJobTimeInformation, 3753 JobObjectAssociateCompletionPortInformation, 3754 JobObjectBasicAndIoAccountingInformation, 3755 JobObjectExtendedLimitInformation, 3756 JobObjectJobSetInformation, 3757 MaxJobObjectInfoClass 3758 } 3759 3760 struct JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { 3761 LARGE_INTEGER TotalUserTime; 3762 LARGE_INTEGER TotalKernelTime; 3763 LARGE_INTEGER ThisPeriodTotalUserTime; 3764 LARGE_INTEGER ThisPeriodTotalKernelTime; 3765 DWORD TotalPageFaultCount; 3766 DWORD TotalProcesses; 3767 DWORD ActiveProcesses; 3768 DWORD TotalTerminatedProcesses; 3769 } 3770 alias JOBOBJECT_BASIC_ACCOUNTING_INFORMATION* PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; 3771 3772 struct JOBOBJECT_BASIC_LIMIT_INFORMATION { 3773 LARGE_INTEGER PerProcessUserTimeLimit; 3774 LARGE_INTEGER PerJobUserTimeLimit; 3775 DWORD LimitFlags; 3776 SIZE_T MinimumWorkingSetSize; 3777 SIZE_T MaximumWorkingSetSize; 3778 DWORD ActiveProcessLimit; 3779 ULONG_PTR Affinity; 3780 DWORD PriorityClass; 3781 DWORD SchedulingClass; 3782 } 3783 alias JOBOBJECT_BASIC_LIMIT_INFORMATION* PJOBOBJECT_BASIC_LIMIT_INFORMATION; 3784 3785 struct JOBOBJECT_BASIC_PROCESS_ID_LIST { 3786 DWORD NumberOfAssignedProcesses; 3787 DWORD NumberOfProcessIdsInList; 3788 ULONG_PTR _ProcessIdList; 3789 3790 ULONG_PTR* ProcessIdList() return scope { return &_ProcessIdList; } 3791 } 3792 alias JOBOBJECT_BASIC_PROCESS_ID_LIST* PJOBOBJECT_BASIC_PROCESS_ID_LIST; 3793 3794 struct JOBOBJECT_BASIC_UI_RESTRICTIONS { 3795 DWORD UIRestrictionsClass; 3796 } 3797 alias JOBOBJECT_BASIC_UI_RESTRICTIONS* PJOBOBJECT_BASIC_UI_RESTRICTIONS; 3798 3799 struct JOBOBJECT_SECURITY_LIMIT_INFORMATION { 3800 DWORD SecurityLimitFlags; 3801 HANDLE JobToken; 3802 PTOKEN_GROUPS SidsToDisable; 3803 PTOKEN_PRIVILEGES PrivilegesToDelete; 3804 PTOKEN_GROUPS RestrictedSids; 3805 } 3806 alias JOBOBJECT_SECURITY_LIMIT_INFORMATION* PJOBOBJECT_SECURITY_LIMIT_INFORMATION; 3807 3808 struct JOBOBJECT_END_OF_JOB_TIME_INFORMATION { 3809 DWORD EndOfJobTimeAction; 3810 } 3811 alias JOBOBJECT_END_OF_JOB_TIME_INFORMATION* PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; 3812 3813 struct JOBOBJECT_ASSOCIATE_COMPLETION_PORT { 3814 PVOID CompletionKey; 3815 HANDLE CompletionPort; 3816 } 3817 alias JOBOBJECT_ASSOCIATE_COMPLETION_PORT* PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; 3818 3819 struct JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { 3820 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; 3821 IO_COUNTERS IoInfo; 3822 } 3823 alias JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION *PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; 3824 3825 struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION { 3826 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; 3827 IO_COUNTERS IoInfo; 3828 SIZE_T ProcessMemoryLimit; 3829 SIZE_T JobMemoryLimit; 3830 SIZE_T PeakProcessMemoryUsed; 3831 SIZE_T PeakJobMemoryUsed; 3832 } 3833 alias JOBOBJECT_EXTENDED_LIMIT_INFORMATION* PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; 3834 3835 struct JOBOBJECT_JOBSET_INFORMATION { 3836 DWORD MemberLevel; 3837 } 3838 alias JOBOBJECT_JOBSET_INFORMATION* PJOBOBJECT_JOBSET_INFORMATION; 3839 3840 // MinGW: Making these defines conditional on _WIN32_WINNT will break ddk includes 3841 //static if (_WIN32_WINNT >= 0x500) { 3842 3843 const DWORD 3844 ES_AWAYMODE_REQUIRED = 0x00000040, 3845 ES_SYSTEM_REQUIRED = 0x00000001, 3846 ES_DISPLAY_REQUIRED = 0x00000002, 3847 ES_USER_PRESENT = 0x00000004, 3848 ES_CONTINUOUS = 0x80000000; 3849 3850 enum LATENCY_TIME { 3851 LT_DONT_CARE, 3852 LT_LOWEST_LATENCY 3853 } 3854 alias LATENCY_TIME* PLATENCY_TIME; 3855 3856 enum SYSTEM_POWER_STATE { 3857 PowerSystemUnspecified, 3858 PowerSystemWorking, 3859 PowerSystemSleeping1, 3860 PowerSystemSleeping2, 3861 PowerSystemSleeping3, 3862 PowerSystemHibernate, 3863 PowerSystemShutdown, 3864 PowerSystemMaximum 3865 } 3866 alias SYSTEM_POWER_STATE* PSYSTEM_POWER_STATE; 3867 3868 const POWER_SYSTEM_MAXIMUM = SYSTEM_POWER_STATE.PowerSystemMaximum; 3869 3870 enum POWER_ACTION { 3871 PowerActionNone, 3872 PowerActionReserved, 3873 PowerActionSleep, 3874 PowerActionHibernate, 3875 PowerActionShutdown, 3876 PowerActionShutdownReset, 3877 PowerActionShutdownOff, 3878 PowerActionWarmEject 3879 } 3880 alias POWER_ACTION* PPOWER_ACTION; 3881 3882 static if (_WIN32_WINNT >= 0x600) { 3883 enum SYSTEM_POWER_CONDITION { 3884 PoAc, 3885 PoDc, 3886 PoHot, 3887 PoConditionMaximum 3888 } 3889 alias SYSTEM_POWER_CONDITION* PSYSTEM_POWER_CONDITION; 3890 } 3891 3892 enum DEVICE_POWER_STATE { 3893 PowerDeviceUnspecified, 3894 PowerDeviceD0, 3895 PowerDeviceD1, 3896 PowerDeviceD2, 3897 PowerDeviceD3, 3898 PowerDeviceMaximum 3899 } 3900 alias DEVICE_POWER_STATE* PDEVICE_POWER_STATE; 3901 3902 align(4): 3903 struct BATTERY_REPORTING_SCALE { 3904 DWORD Granularity; 3905 DWORD Capacity; 3906 } 3907 alias BATTERY_REPORTING_SCALE* PBATTERY_REPORTING_SCALE; 3908 3909 struct POWER_ACTION_POLICY { 3910 POWER_ACTION Action; 3911 ULONG Flags; 3912 ULONG EventCode; 3913 } 3914 alias POWER_ACTION_POLICY* PPOWER_ACTION_POLICY; 3915 3916 // POWER_ACTION_POLICY.Flags constants 3917 const ULONG 3918 POWER_ACTION_QUERY_ALLOWED = 0x00000001, 3919 POWER_ACTION_UI_ALLOWED = 0x00000002, 3920 POWER_ACTION_OVERRIDE_APPS = 0x00000004, 3921 POWER_ACTION_LIGHTEST_FIRST = 0x10000000, 3922 POWER_ACTION_LOCK_CONSOLE = 0x20000000, 3923 POWER_ACTION_DISABLE_WAKES = 0x40000000, 3924 POWER_ACTION_CRITICAL = 0x80000000; 3925 3926 // POWER_ACTION_POLICY.EventCode constants 3927 const ULONG 3928 POWER_LEVEL_USER_NOTIFY_TEXT = 0x00000001, 3929 POWER_LEVEL_USER_NOTIFY_SOUND = 0x00000002, 3930 POWER_LEVEL_USER_NOTIFY_EXEC = 0x00000004, 3931 POWER_USER_NOTIFY_BUTTON = 0x00000008, 3932 POWER_USER_NOTIFY_SHUTDOWN = 0x00000010, 3933 POWER_FORCE_TRIGGER_RESET = 0x80000000; 3934 3935 const size_t 3936 DISCHARGE_POLICY_CRITICAL = 0, 3937 DISCHARGE_POLICY_LOW = 1, 3938 NUM_DISCHARGE_POLICIES = 4; 3939 3940 enum : BYTE { 3941 PO_THROTTLE_NONE, 3942 PO_THROTTLE_CONSTANT, 3943 PO_THROTTLE_DEGRADE, 3944 PO_THROTTLE_ADAPTIVE, 3945 PO_THROTTLE_MAXIMUM 3946 } 3947 3948 struct SYSTEM_POWER_LEVEL { 3949 BOOLEAN Enable; 3950 UCHAR[3] Spare; 3951 ULONG BatteryLevel; 3952 POWER_ACTION_POLICY PowerPolicy; 3953 SYSTEM_POWER_STATE MinSystemState; 3954 } 3955 alias SYSTEM_POWER_LEVEL* PSYSTEM_POWER_LEVEL; 3956 3957 struct SYSTEM_POWER_POLICY { 3958 ULONG Revision; 3959 POWER_ACTION_POLICY PowerButton; 3960 POWER_ACTION_POLICY SleepButton; 3961 POWER_ACTION_POLICY LidClose; 3962 SYSTEM_POWER_STATE LidOpenWake; 3963 ULONG Reserved; 3964 POWER_ACTION_POLICY Idle; 3965 ULONG IdleTimeout; 3966 UCHAR IdleSensitivity; 3967 UCHAR DynamicThrottle; 3968 UCHAR[2] Spare2; 3969 SYSTEM_POWER_STATE MinSleep; 3970 SYSTEM_POWER_STATE MaxSleep; 3971 SYSTEM_POWER_STATE ReducedLatencySleep; 3972 ULONG WinLogonFlags; 3973 ULONG Spare3; 3974 ULONG DozeS4Timeout; 3975 ULONG BroadcastCapacityResolution; 3976 SYSTEM_POWER_LEVEL[NUM_DISCHARGE_POLICIES] DischargePolicy; 3977 ULONG VideoTimeout; 3978 BOOLEAN VideoDimDisplay; 3979 ULONG[3] VideoReserved; 3980 ULONG SpindownTimeout; 3981 BOOLEAN OptimizeForPower; 3982 UCHAR FanThrottleTolerance; 3983 UCHAR ForcedThrottle; 3984 UCHAR MinThrottle; 3985 POWER_ACTION_POLICY OverThrottled; 3986 } 3987 alias SYSTEM_POWER_POLICY* PSYSTEM_POWER_POLICY; 3988 3989 struct SYSTEM_POWER_CAPABILITIES { 3990 BOOLEAN PowerButtonPresent; 3991 BOOLEAN SleepButtonPresent; 3992 BOOLEAN LidPresent; 3993 BOOLEAN SystemS1; 3994 BOOLEAN SystemS2; 3995 BOOLEAN SystemS3; 3996 BOOLEAN SystemS4; 3997 BOOLEAN SystemS5; 3998 BOOLEAN HiberFilePresent; 3999 BOOLEAN FullWake; 4000 BOOLEAN VideoDimPresent; 4001 BOOLEAN ApmPresent; 4002 BOOLEAN UpsPresent; 4003 BOOLEAN ThermalControl; 4004 BOOLEAN ProcessorThrottle; 4005 UCHAR ProcessorMinThrottle; 4006 UCHAR ProcessorMaxThrottle; 4007 UCHAR[4] spare2; 4008 BOOLEAN DiskSpinDown; 4009 UCHAR[8] spare3; 4010 BOOLEAN SystemBatteriesPresent; 4011 BOOLEAN BatteriesAreShortTerm; 4012 BATTERY_REPORTING_SCALE[3] BatteryScale; 4013 SYSTEM_POWER_STATE AcOnLineWake; 4014 SYSTEM_POWER_STATE SoftLidWake; 4015 SYSTEM_POWER_STATE RtcWake; 4016 SYSTEM_POWER_STATE MinDeviceWakeState; 4017 SYSTEM_POWER_STATE DefaultLowLatencyWake; 4018 } 4019 alias SYSTEM_POWER_CAPABILITIES* PSYSTEM_POWER_CAPABILITIES; 4020 4021 struct SYSTEM_BATTERY_STATE { 4022 BOOLEAN AcOnLine; 4023 BOOLEAN BatteryPresent; 4024 BOOLEAN Charging; 4025 BOOLEAN Discharging; 4026 BOOLEAN[4] Spare1; 4027 ULONG MaxCapacity; 4028 ULONG RemainingCapacity; 4029 ULONG Rate; 4030 ULONG EstimatedTime; 4031 ULONG DefaultAlert1; 4032 ULONG DefaultAlert2; 4033 } 4034 alias SYSTEM_BATTERY_STATE* PSYSTEM_BATTERY_STATE; 4035 4036 enum POWER_INFORMATION_LEVEL { 4037 SystemPowerPolicyAc, 4038 SystemPowerPolicyDc, 4039 VerifySystemPolicyAc, 4040 VerifySystemPolicyDc, 4041 SystemPowerCapabilities, 4042 SystemBatteryState, 4043 SystemPowerStateHandler, 4044 ProcessorStateHandler, 4045 SystemPowerPolicyCurrent, 4046 AdministratorPowerPolicy, 4047 SystemReserveHiberFile, 4048 ProcessorInformation, 4049 SystemPowerInformation, 4050 ProcessorStateHandler2, 4051 LastWakeTime, 4052 LastSleepTime, 4053 SystemExecutionState, 4054 SystemPowerStateNotifyHandler, 4055 ProcessorPowerPolicyAc, 4056 ProcessorPowerPolicyDc, 4057 VerifyProcessorPowerPolicyAc, 4058 VerifyProcessorPowerPolicyDc, 4059 ProcessorPowerPolicyCurrent 4060 } 4061 4062 //#if 1 /* (WIN32_WINNT >= 0x0500) */ 4063 struct SYSTEM_POWER_INFORMATION { 4064 ULONG MaxIdlenessAllowed; 4065 ULONG Idleness; 4066 ULONG TimeRemaining; 4067 UCHAR CoolingMode; 4068 } 4069 alias SYSTEM_POWER_INFORMATION* PSYSTEM_POWER_INFORMATION; 4070 //#endif 4071 4072 struct PROCESSOR_POWER_POLICY_INFO { 4073 ULONG TimeCheck; 4074 ULONG DemoteLimit; 4075 ULONG PromoteLimit; 4076 UCHAR DemotePercent; 4077 UCHAR PromotePercent; 4078 UCHAR[2] Spare; 4079 uint _bf; 4080 4081 bool AllowDemotion() { return cast(bool)(_bf & 1); } 4082 bool AllowPromotion() { return cast(bool)(_bf & 2); } 4083 4084 bool AllowDemotion(bool a) { _bf = (_bf & ~1) | a; return a; } 4085 bool AllowPromotion(bool a) { _bf = (_bf & ~2) | (a << 1); return a; } 4086 /+ 4087 ULONG AllowDemotion : 1; 4088 ULONG AllowPromotion : 1; 4089 ULONG Reserved : 30; 4090 +/ 4091 } 4092 alias PROCESSOR_POWER_POLICY_INFO* PPROCESSOR_POWER_POLICY_INFO; 4093 4094 struct PROCESSOR_POWER_POLICY { 4095 ULONG Revision; 4096 UCHAR DynamicThrottle; 4097 UCHAR[3] Spare; 4098 ULONG Reserved; 4099 ULONG PolicyCount; 4100 PROCESSOR_POWER_POLICY_INFO[3] Policy; 4101 } 4102 alias PROCESSOR_POWER_POLICY* PPROCESSOR_POWER_POLICY; 4103 4104 struct ADMINISTRATOR_POWER_POLICY { 4105 SYSTEM_POWER_STATE MinSleep; 4106 SYSTEM_POWER_STATE MaxSleep; 4107 ULONG MinVideoTimeout; 4108 ULONG MaxVideoTimeout; 4109 ULONG MinSpindownTimeout; 4110 ULONG MaxSpindownTimeout; 4111 } 4112 alias ADMINISTRATOR_POWER_POLICY* PADMINISTRATOR_POWER_POLICY; 4113 4114 //}//#endif /* _WIN32_WINNT >= 0x500 */ 4115 4116 extern (Windows) { 4117 alias void function(PVOID, DWORD, PVOID) PIMAGE_TLS_CALLBACK; 4118 4119 static if (_WIN32_WINNT >= 0x500) { 4120 alias LONG function(PEXCEPTION_POINTERS) PVECTORED_EXCEPTION_HANDLER; 4121 alias void function(PVOID, BOOLEAN) WAITORTIMERCALLBACKFUNC; 4122 } 4123 } 4124 4125 static if (_WIN32_WINNT >= 0x501) { 4126 enum HEAP_INFORMATION_CLASS { 4127 HeapCompatibilityInformation 4128 } 4129 4130 enum ACTIVATION_CONTEXT_INFO_CLASS { 4131 ActivationContextBasicInformation = 1, 4132 ActivationContextDetailedInformation, 4133 AssemblyDetailedInformationInActivationContext, 4134 FileInformationInAssemblyOfAssemblyInActivationContext 4135 } 4136 4137 struct ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { 4138 DWORD ulFlags; 4139 DWORD ulEncodedAssemblyIdentityLength; 4140 DWORD ulManifestPathType; 4141 DWORD ulManifestPathLength; 4142 LARGE_INTEGER liManifestLastWriteTime; 4143 DWORD ulPolicyPathType; 4144 DWORD ulPolicyPathLength; 4145 LARGE_INTEGER liPolicyLastWriteTime; 4146 DWORD ulMetadataSatelliteRosterIndex; 4147 DWORD ulManifestVersionMajor; 4148 DWORD ulManifestVersionMinor; 4149 DWORD ulPolicyVersionMajor; 4150 DWORD ulPolicyVersionMinor; 4151 DWORD ulAssemblyDirectoryNameLength; 4152 PCWSTR lpAssemblyEncodedAssemblyIdentity; 4153 PCWSTR lpAssemblyManifestPath; 4154 PCWSTR lpAssemblyPolicyPath; 4155 PCWSTR lpAssemblyDirectoryName; 4156 } 4157 alias ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION* 4158 PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; 4159 alias const(ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION)* 4160 PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; 4161 4162 struct ACTIVATION_CONTEXT_DETAILED_INFORMATION { 4163 DWORD dwFlags; 4164 DWORD ulFormatVersion; 4165 DWORD ulAssemblyCount; 4166 DWORD ulRootManifestPathType; 4167 DWORD ulRootManifestPathChars; 4168 DWORD ulRootConfigurationPathType; 4169 DWORD ulRootConfigurationPathChars; 4170 DWORD ulAppDirPathType; 4171 DWORD ulAppDirPathChars; 4172 PCWSTR lpRootManifestPath; 4173 PCWSTR lpRootConfigurationPath; 4174 PCWSTR lpAppDirPath; 4175 } 4176 alias ACTIVATION_CONTEXT_DETAILED_INFORMATION* 4177 PACTIVATION_CONTEXT_DETAILED_INFORMATION; 4178 alias const(ACTIVATION_CONTEXT_DETAILED_INFORMATION)* 4179 PCACTIVATION_CONTEXT_DETAILED_INFORMATION; 4180 4181 struct ACTIVATION_CONTEXT_QUERY_INDEX { 4182 ULONG ulAssemblyIndex; 4183 ULONG ulFileIndexInAssembly; 4184 } 4185 alias ACTIVATION_CONTEXT_QUERY_INDEX* PACTIVATION_CONTEXT_QUERY_INDEX; 4186 alias const(ACTIVATION_CONTEXT_QUERY_INDEX)* PCACTIVATION_CONTEXT_QUERY_INDEX; 4187 4188 struct ASSEMBLY_FILE_DETAILED_INFORMATION { 4189 DWORD ulFlags; 4190 DWORD ulFilenameLength; 4191 DWORD ulPathLength; 4192 PCWSTR lpFileName; 4193 PCWSTR lpFilePath; 4194 } 4195 alias ASSEMBLY_FILE_DETAILED_INFORMATION* 4196 PASSEMBLY_FILE_DETAILED_INFORMATION; 4197 alias const(ASSEMBLY_FILE_DETAILED_INFORMATION)* 4198 PCASSEMBLY_FILE_DETAILED_INFORMATION; 4199 } 4200 4201 version (Unicode) { 4202 alias OSVERSIONINFOW OSVERSIONINFO; 4203 alias OSVERSIONINFOEXW OSVERSIONINFOEX; 4204 } else { 4205 alias OSVERSIONINFOA OSVERSIONINFO; 4206 alias OSVERSIONINFOEXA OSVERSIONINFOEX; 4207 } 4208 4209 alias OSVERSIONINFO* POSVERSIONINFO, LPOSVERSIONINFO; 4210 alias OSVERSIONINFOEX* POSVERSIONINFOEX, LPOSVERSIONINFOEX; 4211 4212 4213 static if (_WIN32_WINNT >= 0x500) { 4214 extern (Windows) ULONGLONG VerSetConditionMask(ULONGLONG, DWORD, BYTE); 4215 } 4216 4217 version (Win64) { 4218 const WORD IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR64_MAGIC; 4219 4220 alias IMAGE_ORDINAL_FLAG64 IMAGE_ORDINAL_FLAG; 4221 alias IMAGE_SNAP_BY_ORDINAL64 IMAGE_SNAP_BY_ORDINAL; 4222 alias IMAGE_ORDINAL64 IMAGE_ORDINAL; 4223 alias IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; 4224 alias IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; 4225 alias IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; 4226 alias IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; 4227 } else { 4228 const WORD IMAGE_NT_OPTIONAL_HDR_MAGIC = IMAGE_NT_OPTIONAL_HDR32_MAGIC; 4229 4230 alias IMAGE_ORDINAL_FLAG32 IMAGE_ORDINAL_FLAG; 4231 alias IMAGE_ORDINAL32 IMAGE_ORDINAL; 4232 alias IMAGE_SNAP_BY_ORDINAL32 IMAGE_SNAP_BY_ORDINAL; 4233 alias IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; 4234 alias IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; 4235 alias IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; 4236 alias IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; 4237 } 4238 4239 alias IMAGE_OPTIONAL_HEADER* PIMAGE_OPTIONAL_HEADER; 4240 alias IMAGE_NT_HEADERS* PIMAGE_NT_HEADERS; 4241 alias IMAGE_THUNK_DATA* PIMAGE_THUNK_DATA; 4242 alias IMAGE_TLS_DIRECTORY* PIMAGE_TLS_DIRECTORY; 4243 4244 // TODO: MinGW implements these in assembly. How to translate? 4245 PVOID GetCurrentFiber(); 4246 PVOID GetFiberData();