1 2 #if defined(__ROS_LONG64__) 3 #undef InterlockedExchange 4 #define InterlockedExchange(a,b) _InterlockedExchange((long*)a,b) 5 #undef InterlockedExchangeAdd 6 #define InterlockedExchangeAdd(a,b) _InterlockedExchangeAdd((long*)a,b) 7 #undef InterlockedCompareExchange 8 #define InterlockedCompareExchange(a,b,c) _InterlockedCompareExchange((long*)a,b,c) 9 #undef InterlockedIncrement 10 #define InterlockedIncrement(a) _InterlockedIncrement((long*)a) 11 #undef InterlockedDecrement 12 #define InterlockedDecrement(a) _InterlockedDecrement((long*)a) 13 #endif 14 15 #undef __C89_NAMELESS 16 #undef __C89_NAMELESSSTRUCTNAME 17 #undef __C89_NAMELESSSTRUCTNAME1 18 #undef __C89_NAMELESSSTRUCTNAME2 19 #undef __C89_NAMELESSSTRUCTNAME3 20 #undef __C89_NAMELESSSTRUCTNAME4 21 #undef __C89_NAMELESSSTRUCTNAME5 22 #undef __C89_NAMELESSUNIONNAME 23 #undef __C89_NAMELESSUNIONNAME1 24 #undef __C89_NAMELESSUNIONNAME2 25 #undef __C89_NAMELESSUNIONNAME3 26 #undef __C89_NAMELESSUNIONNAME4 27 #undef __C89_NAMELESSUNIONNAME5 28 #undef __C89_NAMELESSUNIONNAME6 29 #undef __C89_NAMELESSUNIONNAME7 30 #undef __C89_NAMELESSUNIONNAME8 31 32 #if !defined(__WINESRC__) && !defined(WINE_NO_NAMELESS_EXTENSION) 33 # ifdef __GNUC__ 34 /* Anonymous structs support starts with gcc 2.96/g++ 2.95 */ 35 # if (__GNUC__ > 2) || ((__GNUC__ == 2) && ((__GNUC_MINOR__ > 95) || ((__GNUC_MINOR__ == 95) && defined(__cplusplus)))) 36 # define __C89_NAMELESS __extension__ 37 # endif 38 # elif defined(_MSC_VER) 39 # define __C89_NAMELESS 40 # endif 41 #endif 42 43 #ifdef __C89_NAMELESS 44 # define __C89_NAMELESSSTRUCTNAME 45 # define __C89_NAMELESSSTRUCTNAME1 46 # define __C89_NAMELESSSTRUCTNAME2 47 # define __C89_NAMELESSSTRUCTNAME3 48 # define __C89_NAMELESSSTRUCTNAME4 49 # define __C89_NAMELESSSTRUCTNAME5 50 # define __C89_NAMELESSUNIONNAME 51 # define __C89_NAMELESSUNIONNAME1 52 # define __C89_NAMELESSUNIONNAME2 53 # define __C89_NAMELESSUNIONNAME3 54 # define __C89_NAMELESSUNIONNAME4 55 # define __C89_NAMELESSUNIONNAME5 56 # define __C89_NAMELESSUNIONNAME6 57 # define __C89_NAMELESSUNIONNAME7 58 # define __C89_NAMELESSUNIONNAME8 59 #else 60 # define __C89_NAMELESS 61 # define __C89_NAMELESSSTRUCTNAME DUMMYSTRUCTNAME 62 # define __C89_NAMELESSSTRUCTNAME1 DUMMYSTRUCTNAME1 63 # define __C89_NAMELESSSTRUCTNAME2 DUMMYSTRUCTNAME2 64 # define __C89_NAMELESSSTRUCTNAME3 DUMMYSTRUCTNAME3 65 # define __C89_NAMELESSSTRUCTNAME4 DUMMYSTRUCTNAME4 66 # define __C89_NAMELESSSTRUCTNAME5 DUMMYSTRUCTNAME5 67 # define __C89_NAMELESSUNIONNAME DUMMYUNIONNAME 68 # define __C89_NAMELESSUNIONNAME1 DUMMYUNIONNAME1 69 # define __C89_NAMELESSUNIONNAME2 DUMMYUNIONNAME2 70 # define __C89_NAMELESSUNIONNAME3 DUMMYUNIONNAME3 71 # define __C89_NAMELESSUNIONNAME4 DUMMYUNIONNAME4 72 # define __C89_NAMELESSUNIONNAME5 DUMMYUNIONNAME5 73 # define __C89_NAMELESSUNIONNAME6 DUMMYUNIONNAME6 74 # define __C89_NAMELESSUNIONNAME7 DUMMYUNIONNAME7 75 # define __C89_NAMELESSUNIONNAME8 DUMMYUNIONNAME8 76 #endif 77 78 #define DECLSPEC_HIDDEN 79 80 /*#ifdef _WINE*/ 81 #if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3))) 82 # define __WINE_ALLOC_SIZE(x) __attribute__((__alloc_size__(x))) 83 #else 84 # define __WINE_ALLOC_SIZE(x) 85 #endif 86 /*#endif*/ 87 88 #ifdef __GNUC__ 89 # define _HAVE_INT64 90 # ifndef _INTEGRAL_MAX_BITS 91 # define _INTEGRAL_MAX_BITS 64 92 # endif 93 # undef __int64 94 # define __int64 long long 95 #elif (defined(__WATCOMC__) || defined(_MSC_VER)) && (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64 ) 96 # define _HAVE_INT64 97 #endif /* __GNUC__/__WATCOMC */ 98 99 #ifdef _MSC_VER 100 # pragma warning(push) 101 # pragma warning(disable:4201) 102 # pragma warning(disable:4214) 103 # pragma warning(disable:4820) 104 #endif 105 106 #define ACE_OBJECT_TYPE_PRESENT 0x00000001 107 #define ACE_INHERITED_OBJECT_TYPE_PRESENT 0x00000002 108 109 /* also in ddk/ntifs.h */ 110 #define COMPRESSION_FORMAT_NONE (0x0000) 111 #define COMPRESSION_FORMAT_DEFAULT (0x0001) 112 #define COMPRESSION_FORMAT_LZNT1 (0x0002) 113 #define COMPRESSION_ENGINE_STANDARD (0x0000) 114 #define COMPRESSION_ENGINE_MAXIMUM (0x0100) 115 #define COMPRESSION_ENGINE_HIBER (0x0200) 116 #define ACCESS_ALLOWED_ACE_TYPE (0x0) 117 #define ACCESS_DENIED_ACE_TYPE (0x1) 118 #define SYSTEM_AUDIT_ACE_TYPE (0x2) 119 #define SYSTEM_ALARM_ACE_TYPE (0x3) 120 /*end ntifs.h */ 121 122 #define REG_STANDARD_FORMAT 1 123 #define REG_LATEST_FORMAT 2 124 #define REG_NO_COMPRESSION 4 125 126 #ifndef WIN32_NO_STATUS 127 128 #define STATUS_WAIT_0 ((DWORD)0x00000000) 129 #define STATUS_ABANDONED_WAIT_0 ((DWORD)0x00000080) 130 #define STATUS_USER_APC ((DWORD)0x000000C0) 131 #define STATUS_TIMEOUT ((DWORD)0x00000102) 132 #define STATUS_PENDING ((DWORD)0x00000103) 133 #define STATUS_SEGMENT_NOTIFICATION ((DWORD)0x40000005) 134 #define STATUS_GUARD_PAGE_VIOLATION ((DWORD)0x80000001) 135 #define STATUS_DATATYPE_MISALIGNMENT ((DWORD)0x80000002) 136 #define STATUS_BREAKPOINT ((DWORD)0x80000003) 137 #define STATUS_SINGLE_STEP ((DWORD)0x80000004) 138 #define STATUS_ACCESS_VIOLATION ((DWORD)0xC0000005) 139 #define STATUS_IN_PAGE_ERROR ((DWORD)0xC0000006) 140 #define STATUS_INVALID_HANDLE ((DWORD)0xC0000008) 141 #define STATUS_NO_MEMORY ((DWORD)0xC0000017) 142 #define STATUS_ILLEGAL_INSTRUCTION ((DWORD)0xC000001D) 143 #define STATUS_NONCONTINUABLE_EXCEPTION ((DWORD)0xC0000025) 144 #define STATUS_INVALID_DISPOSITION ((DWORD)0xC0000026) 145 #define STATUS_ARRAY_BOUNDS_EXCEEDED ((DWORD)0xC000008C) 146 #define STATUS_FLOAT_DENORMAL_OPERAND ((DWORD)0xC000008D) 147 #define STATUS_FLOAT_DIVIDE_BY_ZERO ((DWORD)0xC000008E) 148 #define STATUS_FLOAT_INEXACT_RESULT ((DWORD)0xC000008F) 149 #define STATUS_FLOAT_INVALID_OPERATION ((DWORD)0xC0000090) 150 #define STATUS_FLOAT_OVERFLOW ((DWORD)0xC0000091) 151 #define STATUS_FLOAT_STACK_CHECK ((DWORD)0xC0000092) 152 #define STATUS_FLOAT_UNDERFLOW ((DWORD)0xC0000093) 153 #define STATUS_INTEGER_DIVIDE_BY_ZERO ((DWORD)0xC0000094) 154 #define STATUS_INTEGER_OVERFLOW ((DWORD)0xC0000095) 155 #define STATUS_PRIVILEGED_INSTRUCTION ((DWORD)0xC0000096) 156 #define STATUS_STACK_OVERFLOW ((DWORD)0xC00000FD) 157 #define STATUS_CONTROL_C_EXIT ((DWORD)0xC000013A) 158 #define STATUS_FLOAT_MULTIPLE_FAULTS ((DWORD)0xC00002B4) 159 #define STATUS_FLOAT_MULTIPLE_TRAPS ((DWORD)0xC00002B5) 160 #define STATUS_REG_NAT_CONSUMPTION ((DWORD)0xC00002C9) 161 #define STATUS_SXS_EARLY_DEACTIVATION ((DWORD)0xC015000F) 162 #define STATUS_SXS_INVALID_DEACTIVATION ((DWORD)0xC0150010) 163 164 #define DBG_EXCEPTION_HANDLED ((DWORD)0x00010001) 165 #define DBG_CONTINUE ((DWORD)0x00010002) 166 #define DBG_TERMINATE_THREAD ((DWORD)0x40010003) 167 #define DBG_TERMINATE_PROCESS ((DWORD)0x40010004) 168 #define DBG_CONTROL_C ((DWORD)0x40010005) 169 #define DBG_CONTROL_BREAK ((DWORD)0x40010008) 170 #define DBG_COMMAND_EXCEPTION ((DWORD)0x40010009) 171 #define DBG_EXCEPTION_NOT_HANDLED ((DWORD)0x80010001) 172 173 #endif /* WIN32_NO_STATUS */ 174 175 #define INVALID_FILE_ATTRIBUTES ((DWORD)-1) 176 177 /* Also in ddk/winddk.h */ 178 #define FILE_LIST_DIRECTORY 0x00000001 179 #define FILE_READ_DATA 0x00000001 180 #define FILE_ADD_FILE 0x00000002 181 #define FILE_WRITE_DATA 0x00000002 182 #define FILE_ADD_SUBDIRECTORY 0x00000004 183 #define FILE_APPEND_DATA 0x00000004 184 #define FILE_CREATE_PIPE_INSTANCE 0x00000004 185 #define FILE_READ_EA 0x00000008 186 #define FILE_READ_PROPERTIES 0x00000008 187 #define FILE_WRITE_EA 0x00000010 188 #define FILE_WRITE_PROPERTIES 0x00000010 189 #define FILE_EXECUTE 0x00000020 190 #define FILE_TRAVERSE 0x00000020 191 #define FILE_DELETE_CHILD 0x00000040 192 #define FILE_READ_ATTRIBUTES 0x00000080 193 #define FILE_WRITE_ATTRIBUTES 0x00000100 194 195 #define FILE_SHARE_READ 0x00000001 196 #define FILE_SHARE_WRITE 0x00000002 197 #define FILE_SHARE_DELETE 0x00000004 198 #define FILE_SHARE_VALID_FLAGS 0x00000007 199 200 #define FILE_ATTRIBUTE_READONLY 0x00000001 201 #define FILE_ATTRIBUTE_HIDDEN 0x00000002 202 #define FILE_ATTRIBUTE_SYSTEM 0x00000004 203 #define FILE_ATTRIBUTE_DIRECTORY 0x00000010 204 #define FILE_ATTRIBUTE_ARCHIVE 0x00000020 205 #define FILE_ATTRIBUTE_DEVICE 0x00000040 206 #define FILE_ATTRIBUTE_NORMAL 0x00000080 207 #define FILE_ATTRIBUTE_TEMPORARY 0x00000100 208 #define FILE_ATTRIBUTE_SPARSE_FILE 0x00000200 209 #define FILE_ATTRIBUTE_REPARSE_POINT 0x00000400 210 #define FILE_ATTRIBUTE_COMPRESSED 0x00000800 211 #define FILE_ATTRIBUTE_OFFLINE 0x00001000 212 #define FILE_ATTRIBUTE_NOT_CONTENT_INDEXED 0x00002000 213 #define FILE_ATTRIBUTE_ENCRYPTED 0x00004000 214 #define FILE_ATTRIBUTE_INTEGRITY_STREAM 0x00008000 215 #define FILE_ATTRIBUTE_VIRTUAL 0x00010000 216 #define FILE_ATTRIBUTE_VALID_FLAGS 0x00007fb7 217 #define FILE_ATTRIBUTE_VALID_SET_FLAGS 0x000031a7 218 219 #define FILE_COPY_STRUCTURED_STORAGE 0x00000041 220 #define FILE_STRUCTURED_STORAGE 0x00000441 221 222 #define FILE_VALID_OPTION_FLAGS 0x00ffffff 223 #define FILE_VALID_PIPE_OPTION_FLAGS 0x00000032 224 #define FILE_VALID_MAILSLOT_OPTION_FLAGS 0x00000032 225 #define FILE_VALID_SET_FLAGS 0x00000036 226 227 #define FILE_DIRECTORY_FILE 0x00000001 228 #define FILE_WRITE_THROUGH 0x00000002 229 #define FILE_SEQUENTIAL_ONLY 0x00000004 230 #define FILE_NO_INTERMEDIATE_BUFFERING 0x00000008 231 #define FILE_SYNCHRONOUS_IO_ALERT 0x00000010 232 #define FILE_SYNCHRONOUS_IO_NONALERT 0x00000020 233 #define FILE_NON_DIRECTORY_FILE 0x00000040 234 #define FILE_CREATE_TREE_CONNECTION 0x00000080 235 #define FILE_COMPLETE_IF_OPLOCKED 0x00000100 236 #define FILE_NO_EA_KNOWLEDGE 0x00000200 237 #define FILE_OPEN_REMOTE_INSTANCE 0x00000400 238 #define FILE_RANDOM_ACCESS 0x00000800 239 #define FILE_DELETE_ON_CLOSE 0x00001000 240 #define FILE_OPEN_BY_FILE_ID 0x00002000 241 #define FILE_OPEN_FOR_BACKUP_INTENT 0x00004000 242 #define FILE_NO_COMPRESSION 0x00008000 243 #define FILE_RESERVE_OPFILTER 0x00100000 244 #define FILE_OPEN_REPARSE_POINT 0x00200000 245 #define FILE_OPEN_NO_RECALL 0x00400000 246 #define FILE_OPEN_FOR_FREE_SPACE_QUERY 0x00800000 247 248 #define FILE_ALL_ACCESS \ 249 (STANDARD_RIGHTS_REQUIRED | \ 250 SYNCHRONIZE | \ 251 0x1FF) 252 253 #define FILE_GENERIC_EXECUTE \ 254 (STANDARD_RIGHTS_EXECUTE | \ 255 FILE_READ_ATTRIBUTES | \ 256 FILE_EXECUTE | \ 257 SYNCHRONIZE) 258 259 #define FILE_GENERIC_READ \ 260 (STANDARD_RIGHTS_READ | \ 261 FILE_READ_DATA | \ 262 FILE_READ_ATTRIBUTES | \ 263 FILE_READ_EA | \ 264 SYNCHRONIZE) 265 266 #define FILE_GENERIC_WRITE \ 267 (STANDARD_RIGHTS_WRITE | \ 268 FILE_WRITE_DATA | \ 269 FILE_WRITE_ATTRIBUTES | \ 270 FILE_WRITE_EA | \ 271 FILE_APPEND_DATA | \ 272 SYNCHRONIZE) 273 /* end winddk.h */ 274 /* also in ddk/ntifs.h */ 275 #define FILE_NOTIFY_CHANGE_FILE_NAME 0x00000001 276 #define FILE_NOTIFY_CHANGE_DIR_NAME 0x00000002 277 #define FILE_NOTIFY_CHANGE_NAME 0x00000003 278 #define FILE_NOTIFY_CHANGE_ATTRIBUTES 0x00000004 279 #define FILE_NOTIFY_CHANGE_SIZE 0x00000008 280 #define FILE_NOTIFY_CHANGE_LAST_WRITE 0x00000010 281 #define FILE_NOTIFY_CHANGE_LAST_ACCESS 0x00000020 282 #define FILE_NOTIFY_CHANGE_CREATION 0x00000040 283 #define FILE_NOTIFY_CHANGE_EA 0x00000080 284 #define FILE_NOTIFY_CHANGE_SECURITY 0x00000100 285 #define FILE_NOTIFY_CHANGE_STREAM_NAME 0x00000200 286 #define FILE_NOTIFY_CHANGE_STREAM_SIZE 0x00000400 287 #define FILE_NOTIFY_CHANGE_STREAM_WRITE 0x00000800 288 #define FILE_NOTIFY_VALID_MASK 0x00000fff 289 290 #define FILE_CASE_SENSITIVE_SEARCH 0x00000001 291 #define FILE_CASE_PRESERVED_NAMES 0x00000002 292 #define FILE_UNICODE_ON_DISK 0x00000004 293 #define FILE_PERSISTENT_ACLS 0x00000008 294 #define FILE_FILE_COMPRESSION 0x00000010 295 #define FILE_VOLUME_QUOTAS 0x00000020 296 #define FILE_SUPPORTS_SPARSE_FILES 0x00000040 297 #define FILE_SUPPORTS_REPARSE_POINTS 0x00000080 298 #define FILE_SUPPORTS_REMOTE_STORAGE 0x00000100 299 #define FS_LFN_APIS 0x00004000 300 #define FILE_VOLUME_IS_COMPRESSED 0x00008000 301 #define FILE_SUPPORTS_OBJECT_IDS 0x00010000 302 #define FILE_SUPPORTS_ENCRYPTION 0x00020000 303 #define FILE_NAMED_STREAMS 0x00040000 304 #define FILE_READ_ONLY_VOLUME 0x00080000 305 #define FILE_SEQUENTIAL_WRITE_ONCE 0x00100000 306 #define FILE_SUPPORTS_TRANSACTIONS 0x00200000 307 #define FILE_SUPPORTS_HARD_LINKS 0x00400000 308 #define FILE_SUPPORTS_EXTENDED_ATTRIBUTES 0x00800000 309 #define FILE_SUPPORTS_OPEN_BY_FILE_ID 0x01000000 310 #define FILE_SUPPORTS_USN_JOURNAL 0x02000000 311 #define FILE_SUPPORTS_INTEGRITY_STREAMS 0x04000000 312 #define FILE_SUPPORTS_BLOCK_REFCOUNTING 0x08000000 313 #define FILE_SUPPORTS_SPARSE_VDL 0x10000000 314 #define FILE_DAX_VOLUME 0x20000000 315 316 #define IO_COMPLETION_QUERY_STATE 0x0001 317 #define IO_COMPLETION_MODIFY_STATE 0x0002 318 #define IO_COMPLETION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3) 319 /* end ntifs.h */ 320 321 /* also in ddk/winddk.h */ 322 #define DUPLICATE_CLOSE_SOURCE 0x00000001 323 #define DUPLICATE_SAME_ACCESS 0x00000002 324 /* end winddk.k */ 325 326 #define MAILSLOT_NO_MESSAGE ((DWORD)-1) 327 #define MAILSLOT_WAIT_FOREVER ((DWORD)-1) 328 #define PROCESS_TERMINATE 1 329 #define PROCESS_CREATE_THREAD 2 330 #define PROCESS_SET_SESSIONID 4 331 #define PROCESS_VM_OPERATION 8 332 #define PROCESS_VM_READ 16 333 #define PROCESS_VM_WRITE 32 334 #define PROCESS_CREATE_PROCESS 128 335 #define PROCESS_SET_QUOTA 256 336 #define PROCESS_SET_INFORMATION 512 337 #define PROCESS_QUERY_INFORMATION 1024 338 #define PROCESS_SUSPEND_RESUME 2048 339 #define PROCESS_QUERY_LIMITED_INFORMATION 0x1000 340 #define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xFFF) 341 #define PROCESS_DUP_HANDLE 64 342 #define THREAD_TERMINATE 1 343 #define THREAD_SUSPEND_RESUME 2 344 #define THREAD_GET_CONTEXT 8 345 #define THREAD_SET_CONTEXT 16 346 #define THREAD_SET_INFORMATION 32 347 #define THREAD_QUERY_INFORMATION 64 348 #define THREAD_SET_THREAD_TOKEN 128 349 #define THREAD_IMPERSONATE 256 350 #define THREAD_DIRECT_IMPERSONATION 0x200 351 #define THREAD_QUERY_LIMITED_INFORMATION 0x0800 352 #define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3FF) 353 #define MUTANT_QUERY_STATE 0x0001 354 #define MUTANT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|MUTANT_QUERY_STATE) 355 #define TIMER_QUERY_STATE 0x0001 356 #define TIMER_MODIFY_STATE 0x0002 357 #define TIMER_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|TIMER_QUERY_STATE|TIMER_MODIFY_STATE) 358 #define THREAD_BASE_PRIORITY_LOWRT 15 359 #define THREAD_BASE_PRIORITY_MAX 2 360 #define THREAD_BASE_PRIORITY_MIN (-2) 361 #define THREAD_BASE_PRIORITY_IDLE (-15) 362 363 #define PROCESS_SET_LIMITED_INFORMATION 0x2000 364 #define THREAD_RESUME 0x1000 365 366 #define SE_CREATE_TOKEN_NAME TEXT("SeCreateTokenPrivilege") 367 #define SE_ASSIGNPRIMARYTOKEN_NAME TEXT("SeAssignPrimaryTokenPrivilege") 368 #define SE_LOCK_MEMORY_NAME TEXT("SeLockMemoryPrivilege") 369 #define SE_INCREASE_QUOTA_NAME TEXT("SeIncreaseQuotaPrivilege") 370 #define SE_UNSOLICITED_INPUT_NAME TEXT("SeUnsolicitedInputPrivilege") 371 #define SE_MACHINE_ACCOUNT_NAME TEXT("SeMachineAccountPrivilege") 372 #define SE_TCB_NAME TEXT("SeTcbPrivilege") 373 #define SE_SECURITY_NAME TEXT("SeSecurityPrivilege") 374 #define SE_TAKE_OWNERSHIP_NAME TEXT("SeTakeOwnershipPrivilege") 375 #define SE_LOAD_DRIVER_NAME TEXT("SeLoadDriverPrivilege") 376 #define SE_SYSTEM_PROFILE_NAME TEXT("SeSystemProfilePrivilege") 377 #define SE_SYSTEMTIME_NAME TEXT("SeSystemtimePrivilege") 378 #define SE_PROF_SINGLE_PROCESS_NAME TEXT("SeProfileSingleProcessPrivilege") 379 #define SE_INC_BASE_PRIORITY_NAME TEXT("SeIncreaseBasePriorityPrivilege") 380 #define SE_CREATE_PAGEFILE_NAME TEXT("SeCreatePagefilePrivilege") 381 #define SE_CREATE_PERMANENT_NAME TEXT("SeCreatePermanentPrivilege") 382 #define SE_BACKUP_NAME TEXT("SeBackupPrivilege") 383 #define SE_RESTORE_NAME TEXT("SeRestorePrivilege") 384 #define SE_SHUTDOWN_NAME TEXT("SeShutdownPrivilege") 385 #define SE_DEBUG_NAME TEXT("SeDebugPrivilege") 386 #define SE_AUDIT_NAME TEXT("SeAuditPrivilege") 387 #define SE_SYSTEM_ENVIRONMENT_NAME TEXT("SeSystemEnvironmentPrivilege") 388 #define SE_CHANGE_NOTIFY_NAME TEXT("SeChangeNotifyPrivilege") 389 #define SE_REMOTE_SHUTDOWN_NAME TEXT("SeRemoteShutdownPrivilege") 390 #define SE_UNDOCK_NAME TEXT("SeUndockPrivilege") 391 #define SE_SYNC_AGENT_NAME TEXT("SeSyncAgentPrivilege") 392 #define SE_ENABLE_DELEGATION_NAME TEXT("SeEnableDelegationPrivilege") 393 #define SE_MANAGE_VOLUME_NAME TEXT("SeManageVolumePrivilege") 394 #define SE_IMPERSONATE_NAME TEXT("SeImpersonatePrivilege") 395 #define SE_CREATE_GLOBAL_NAME TEXT("SeCreateGlobalPrivilege") 396 397 #define SE_GROUP_MANDATORY 0x00000001 398 #define SE_GROUP_ENABLED_BY_DEFAULT 0x00000002 399 #define SE_GROUP_ENABLED 0x00000004 400 #define SE_GROUP_OWNER 0x00000008 401 #define SE_GROUP_USE_FOR_DENY_ONLY 0x00000010 402 #define SE_GROUP_INTEGRITY 0x00000020 403 #define SE_GROUP_INTEGRITY_ENABLED 0x00000040 404 #define SE_GROUP_LOGON_ID 0xC0000000 405 #define SE_GROUP_RESOURCE 0x20000000 406 #define SE_GROUP_VALID_ATTRIBUTES 0xE000007F 407 408 /* FIXME: non-standard */ 409 #define LANG_ESPERANTO 0x8f 410 #define LANG_WALON 0x90 411 #define LANG_CORNISH 0x92 412 413 /* FIXME: not present in the official headers */ 414 #define LANG_MALAGASY 0x8d 415 #define LANG_GAELIC 0x94 416 #define LANG_SAAMI 0x3b 417 #define LANG_SUTU 0x30 418 #define LANG_TSONGA 0x31 419 #define LANG_VENDA 0x33 420 #define LANG_MANX_GAELIC 0x94 421 #define SUBLANG_PORTUGUESE_PORTUGAL 0x02 422 423 #define PROCESSOR_INTEL_386 386 424 #define PROCESSOR_INTEL_486 486 425 #define PROCESSOR_INTEL_PENTIUM 586 426 #define PROCESSOR_MIPS_R4000 4000 427 #define PROCESSOR_ALPHA_21064 21064 428 #define PROCESSOR_INTEL_IA64 2200 429 #define PROCESSOR_PPC_601 601 430 #define PROCESSOR_PPC_603 603 431 #define PROCESSOR_PPC_604 604 432 #define PROCESSOR_PPC_620 620 433 #define PROCESSOR_INTEL_860 860 434 #define PROCESSOR_AMD_X8664 8664 435 #define PROCESSOR_MIPS_R2000 2000 436 #define PROCESSOR_MIPS_R3000 3000 437 #define PROCESSOR_HITACHI_SH3 10003 438 #define PROCESSOR_HITACHI_SH3E 10004 439 #define PROCESSOR_HITACHI_SH4 10005 440 #define PROCESSOR_MOTOROLA_821 821 441 #define PROCESSOR_SHx_SH3 103 442 #define PROCESSOR_SHx_SH4 104 443 #define PROCESSOR_STRONGARM 2577 444 #define PROCESSOR_ARM720 1824 445 #define PROCESSOR_ARM820 2080 446 #define PROCESSOR_ARM920 2336 447 #define PROCESSOR_ARM_7TDMI 70001 448 #define PROCESSOR_ARCHITECTURE_INTEL 0 449 #define PROCESSOR_ARCHITECTURE_MIPS 1 450 #define PROCESSOR_ARCHITECTURE_ALPHA 2 451 #define PROCESSOR_ARCHITECTURE_PPC 3 452 #define PROCESSOR_ARCHITECTURE_SHX 4 453 #define PROCESSOR_ARCHITECTURE_ARM 5 454 #define PROCESSOR_ARCHITECTURE_IA64 6 455 #define PROCESSOR_ARCHITECTURE_ALPHA64 7 456 #define PROCESSOR_ARCHITECTURE_MSIL 8 457 #define PROCESSOR_ARCHITECTURE_AMD64 9 458 #define PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF 459 460 /* Processor features */ 461 #define PF_FLOATING_POINT_PRECISION_ERRATA 0 462 #define PF_FLOATING_POINT_EMULATED 1 463 #define PF_COMPARE_EXCHANGE_DOUBLE 2 464 #define PF_MMX_INSTRUCTIONS_AVAILABLE 3 465 #define PF_PPC_MOVEMEM_64BIT_OK 4 466 #define PF_ALPHA_BYTE_INSTRUCTIONS 5 467 #define PF_XMMI_INSTRUCTIONS_AVAILABLE 6 468 #define PF_3DNOW_INSTRUCTIONS_AVAILABLE 7 469 #define PF_RDTSC_INSTRUCTION_AVAILABLE 8 470 #define PF_PAE_ENABLED 9 471 #define PF_XMMI64_INSTRUCTIONS_AVAILABLE 10 472 #define PF_SSE_DAZ_MODE_AVAILABLE 11 473 #define PF_NX_ENABLED 12 474 #define PF_SSE3_INSTRUCTIONS_AVAILABLE 13 475 #define PF_COMPARE_EXCHANGE128 14 476 #define PF_COMPARE64_EXCHANGE128 15 477 #define PF_CHANNELS_ENABLED 16 478 #define PF_XSAVE_ENABLED 17 479 #define PF_ARM_VFP_32_REGISTERS_AVAILABLE 18 480 #define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19 481 #define PF_SECOND_LEVEL_ADDRESS_TRANSLATION 20 482 #define PF_VIRT_FIRMWARE_ENABLED 21 483 #define PF_RDWRFSGSBASE_AVAILABLE 22 484 #define PF_FASTFAIL_AVAILABLE 23 485 #define PF_ARM_DIVIDE_INSTRUCTION_AVAILABLE 24 486 #define PF_ARM_64BIT_LOADSTORE_ATOMIC 25 487 #define PF_ARM_EXTERNAL_CACHE_AVAILABLE 26 488 #define PF_ARM_FMAC_INSTRUCTIONS_AVAILABLE 27 489 #define PF_RDRAND_INSTRUCTION_AVAILABLE 28 490 #define PF_ARM_V8_INSTRUCTIONS_AVAILABLE 29 491 #define PF_ARM_V8_CRYPTO_INSTRUCTIONS_AVAILABLE 30 492 #define PF_ARM_V8_CRC32_INSTRUCTIONS_AVAILABLE 31 493 494 /* also in ddk/ntifs.h */ 495 #define FILE_ACTION_ADDED 0x00000001 496 #define FILE_ACTION_REMOVED 0x00000002 497 #define FILE_ACTION_MODIFIED 0x00000003 498 #define FILE_ACTION_RENAMED_OLD_NAME 0x00000004 499 #define FILE_ACTION_RENAMED_NEW_NAME 0x00000005 500 #define FILE_ACTION_ADDED_STREAM 0x00000006 501 #define FILE_ACTION_REMOVED_STREAM 0x00000007 502 #define FILE_ACTION_MODIFIED_STREAM 0x00000008 503 #define FILE_ACTION_REMOVED_BY_DELETE 0x00000009 504 #define FILE_ACTION_ID_NOT_TUNNELLED 0x0000000A 505 #define FILE_ACTION_TUNNELLED_ID_COLLISION 0x0000000B 506 /* end ntifs.h */ 507 #define HEAP_NO_SERIALIZE 1 508 #define HEAP_GROWABLE 2 509 #define HEAP_GENERATE_EXCEPTIONS 4 510 #define HEAP_ZERO_MEMORY 8 511 #define HEAP_REALLOC_IN_PLACE_ONLY 16 512 #define HEAP_TAIL_CHECKING_ENABLED 32 513 #define HEAP_FREE_CHECKING_ENABLED 64 514 #define HEAP_DISABLE_COALESCE_ON_FREE 128 515 #define HEAP_CREATE_ALIGN_16 0x10000 516 #define HEAP_CREATE_ENABLE_TRACING 0x20000 517 #define HEAP_CREATE_ENABLE_EXECUTE 0x00040000 518 #define HEAP_MAXIMUM_TAG 0xFFF 519 #define HEAP_PSEUDO_TAG_FLAG 0x8000 520 #define HEAP_TAG_SHIFT 16 521 #define HEAP_MAKE_TAG_FLAGS(b,o) ((DWORD)((b)+(o)<<16))) 522 523 #define KEY_QUERY_VALUE 1 524 #define KEY_SET_VALUE 2 525 #define KEY_CREATE_SUB_KEY 4 526 #define KEY_ENUMERATE_SUB_KEYS 8 527 #define KEY_NOTIFY 16 528 #define KEY_CREATE_LINK 32 529 #define KEY_WOW64_64KEY 0x00000100 530 #define KEY_WOW64_32KEY 0x00000200 531 #define KEY_WOW64_RES 0x00000300 532 533 #define KEY_WRITE 0x20006 534 #define KEY_EXECUTE 0x20019 535 #define KEY_READ 0x20019 536 #define KEY_ALL_ACCESS 0xf003f 537 #define REG_WHOLE_HIVE_VOLATILE 1 538 #define REG_REFRESH_HIVE 2 539 #define REG_NO_LAZY_FLUSH 4 540 #define REG_FORCE_RESTORE 8 541 #define REG_OPTION_RESERVED 0 542 #define REG_OPTION_NON_VOLATILE 0 543 #define REG_OPTION_VOLATILE 1 544 #define REG_OPTION_CREATE_LINK 2 545 #define REG_OPTION_BACKUP_RESTORE 4 546 #define REG_OPTION_OPEN_LINK 8 547 #define REG_LEGAL_OPTION 15 548 #define MAXIMUM_PROCESSORS 32 549 #define PAGE_NOACCESS 0x0001 550 #define PAGE_READONLY 0x0002 551 #define PAGE_READWRITE 0x0004 552 #define PAGE_WRITECOPY 0x0008 553 #define PAGE_EXECUTE 0x0010 554 #define PAGE_EXECUTE_READ 0x0020 555 #define PAGE_EXECUTE_READWRITE 0x0040 556 #define PAGE_EXECUTE_WRITECOPY 0x0080 557 #define PAGE_GUARD 0x0100 558 #define PAGE_NOCACHE 0x0200 559 #define PAGE_WRITECOMBINE 0x0400 560 #define MEM_COMMIT 0x1000 561 #define MEM_RESERVE 0x2000 562 #define MEM_DECOMMIT 0x4000 563 #define MEM_RELEASE 0x8000 564 #define MEM_FREE 0x10000 565 #define MEM_PRIVATE 0x20000 566 #define MEM_MAPPED 0x40000 567 #define MEM_RESET 0x80000 568 #define MEM_TOP_DOWN 0x100000 569 #define MEM_WRITE_WATCH 0x200000 /* 98/Me */ 570 #define MEM_PHYSICAL 0x400000 571 #define MEM_4MB_PAGES 0x80000000 572 #define MEM_IMAGE SEC_IMAGE 573 #define SEC_NO_CHANGE 0x00400000 574 #define SEC_FILE 0x00800000 575 #define SEC_IMAGE 0x01000000 576 #define SEC_VLM 0x02000000 577 #define SEC_RESERVE 0x04000000 578 #define SEC_COMMIT 0x08000000 579 #define SEC_NOCACHE 0x10000000 580 #define SEC_WRITECOMBINE 0x40000000 581 #define SEC_LARGE_PAGES 0x80000000 582 #define SEC_IMAGE_NO_EXECUTE (SEC_IMAGE | SEC_NOCACHE) 583 #define SECTION_MAP_EXECUTE_EXPLICIT 0x0020 584 #define SECTION_EXTEND_SIZE 16 585 #define SECTION_MAP_READ 4 586 #define SECTION_MAP_WRITE 2 587 #define SECTION_QUERY 1 588 #define SECTION_MAP_EXECUTE 8 589 #define SECTION_ALL_ACCESS 0xf001f 590 #define WRITE_WATCH_FLAG_RESET 0x01 591 #define MESSAGE_RESOURCE_UNICODE 1 592 #define RTL_CRITSECT_TYPE 0 593 #define RTL_RESOURCE_TYPE 1 594 595 #define AT_ROUND_TO_PAGE 0x40000000 596 597 #define IMAGE_SIZEOF_FILE_HEADER 20 598 #define IMAGE_FILE_RELOCS_STRIPPED 1 599 #define IMAGE_FILE_EXECUTABLE_IMAGE 2 600 #define IMAGE_FILE_LINE_NUMS_STRIPPED 4 601 #define IMAGE_FILE_LOCAL_SYMS_STRIPPED 8 602 #define IMAGE_FILE_AGGRESIVE_WS_TRIM 16 603 #define IMAGE_FILE_LARGE_ADDRESS_AWARE 32 604 #define IMAGE_FILE_BYTES_REVERSED_LO 128 605 #define IMAGE_FILE_32BIT_MACHINE 256 606 #define IMAGE_FILE_DEBUG_STRIPPED 512 607 #define IMAGE_FILE_REMOVABLE_RUN_FROM_SWAP 1024 608 #define IMAGE_FILE_NET_RUN_FROM_SWAP 2048 609 #define IMAGE_FILE_SYSTEM 4096 610 #define IMAGE_FILE_DLL 8192 611 #define IMAGE_FILE_UP_SYSTEM_ONLY 16384 612 #define IMAGE_FILE_BYTES_REVERSED_HI 32768 613 #define IMAGE_FILE_MACHINE_UNKNOWN 0 614 615 #define IMAGE_FILE_MACHINE_AM33 0x1d3 616 #define IMAGE_FILE_MACHINE_AMD64 0x8664 617 #define IMAGE_FILE_MACHINE_ARM 0x1c0 618 #define IMAGE_FILE_MACHINE_ARMNT 0x1c4 619 #define IMAGE_FILE_MACHINE_EBC 0xebc 620 #define IMAGE_FILE_MACHINE_I386 0x14c 621 #define IMAGE_FILE_MACHINE_IA64 0x200 622 #define IMAGE_FILE_MACHINE_M32R 0x9041 623 #define IMAGE_FILE_MACHINE_MIPS16 0x266 624 #define IMAGE_FILE_MACHINE_MIPSFPU 0x366 625 #define IMAGE_FILE_MACHINE_MIPSFPU16 0x466 626 #define IMAGE_FILE_MACHINE_POWERPC 0x1f0 627 #define IMAGE_FILE_MACHINE_POWERPCFP 0x1f1 628 #define IMAGE_FILE_MACHINE_R4000 0x166 629 #define IMAGE_FILE_MACHINE_SH3 0x1a2 630 #define IMAGE_FILE_MACHINE_SH3E 0x01a4 631 #define IMAGE_FILE_MACHINE_SH3DSP 0x1a3 632 #define IMAGE_FILE_MACHINE_SH4 0x1a6 633 #define IMAGE_FILE_MACHINE_SH5 0x1a8 634 #define IMAGE_FILE_MACHINE_THUMB 0x1c2 635 #define IMAGE_FILE_MACHINE_WCEMIPSV2 0x169 636 #define IMAGE_FILE_MACHINE_R3000 0x162 637 #define IMAGE_FILE_MACHINE_R10000 0x168 638 #define IMAGE_FILE_MACHINE_ALPHA 0x184 639 #define IMAGE_FILE_MACHINE_ALPHA64 0x0284 640 #define IMAGE_FILE_MACHINE_AXP64 IMAGE_FILE_MACHINE_ALPHA64 641 #define IMAGE_FILE_MACHINE_CEE 0xC0EE 642 #define IMAGE_FILE_MACHINE_TRICORE 0x0520 643 #define IMAGE_FILE_MACHINE_CEF 0x0CEF 644 #define IMAGE_FILE_MACHINE_ARM64 0xAA64 645 646 #define IMAGE_FILE_EXPORT_DIRECTORY 0 647 #define IMAGE_FILE_IMPORT_DIRECTORY 1 648 #define IMAGE_FILE_RESOURCE_DIRECTORY 2 649 #define IMAGE_FILE_EXCEPTION_DIRECTORY 3 650 #define IMAGE_FILE_SECURITY_DIRECTORY 4 651 #define IMAGE_FILE_BASE_RELOCATION_TABLE 5 652 #define IMAGE_FILE_DEBUG_DIRECTORY 6 653 #define IMAGE_FILE_DESCRIPTION_STRING 7 654 #define IMAGE_FILE_MACHINE_VALUE 8 /* Mips */ 655 #define IMAGE_FILE_THREAD_LOCAL_STORAGE 9 656 #define IMAGE_FILE_CALLBACK_DIRECTORY 10 657 658 #define IMAGE_DOS_SIGNATURE 0x5A4D 659 #define IMAGE_OS2_SIGNATURE 0x454E 660 #define IMAGE_OS2_SIGNATURE_LE 0x454C 661 #define IMAGE_VXD_SIGNATURE 0x454C 662 #define IMAGE_NT_SIGNATURE 0x00004550 663 #define IMAGE_NT_OPTIONAL_HDR32_MAGIC 0x10b 664 #define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b 665 #ifdef _WIN64 666 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR64_MAGIC 667 #else 668 #define IMAGE_NT_OPTIONAL_HDR_MAGIC IMAGE_NT_OPTIONAL_HDR32_MAGIC 669 #endif 670 #define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107 671 #define IMAGE_SEPARATE_DEBUG_SIGNATURE 0x4944 672 #define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16 673 #define IMAGE_SIZEOF_ROM_OPTIONAL_HEADER 56 674 #define IMAGE_SIZEOF_STD_OPTIONAL_HEADER 28 675 #define IMAGE_SIZEOF_NT_OPTIONAL_HEADER 224 676 #define IMAGE_SIZEOF_SHORT_NAME 8 677 #define IMAGE_SIZEOF_SECTION_HEADER 40 678 #define IMAGE_SIZEOF_SYMBOL 18 679 #define IMAGE_SIZEOF_AUX_SYMBOL 18 680 #define IMAGE_SIZEOF_RELOCATION 10 681 #define IMAGE_SIZEOF_BASE_RELOCATION 8 682 #define IMAGE_SIZEOF_LINENUMBER 6 683 #define IMAGE_SIZEOF_ARCHIVE_MEMBER_HDR 60 684 #define SIZEOF_RFPO_DATA 16 685 686 #define IMAGE_SUBSYSTEM_UNKNOWN 0 687 #define IMAGE_SUBSYSTEM_NATIVE 1 688 #define IMAGE_SUBSYSTEM_WINDOWS_GUI 2 689 #define IMAGE_SUBSYSTEM_WINDOWS_CUI 3 690 #define IMAGE_SUBSYSTEM_OS2_CUI 5 691 #define IMAGE_SUBSYSTEM_POSIX_CUI 7 692 #define IMAGE_SUBSYSTEM_NATIVE_WINDOWS 8 693 #define IMAGE_SUBSYSTEM_WINDOWS_CE_GUI 9 694 #define IMAGE_SUBSYSTEM_EFI_APPLICATION 10 695 #define IMAGE_SUBSYSTEM_EFI_BOOT_SERVICE_DRIVER 11 696 #define IMAGE_SUBSYSTEM_EFI_RUNTIME_DRIVER 12 697 #define IMAGE_SUBSYSTEM_EFI_ROM 13 698 #define IMAGE_SUBSYSTEM_XBOX 14 699 700 #define IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE 0x0040 701 #define IMAGE_DLLCHARACTERISTICS_FORCE_INTEGRITY 0x0080 702 #define IMAGE_DLLCHARACTERISTICS_NX_COMPAT 0x0100 703 #define IMAGE_DLLCHARACTERISTICS_NO_ISOLATION 0x0200 704 #define IMAGE_DLLCHARACTERISTICS_NO_SEH 0x0400 705 #define IMAGE_DLLCHARACTERISTICS_NO_BIND 0x0800 706 #define IMAGE_DLLCHARACTERISTICS_WDM_DRIVER 0x2000 707 #define IMAGE_DLLCHARACTERISTICS_TERMINAL_SERVER_AWARE 0x8000 708 #define IMAGE_FIRST_SECTION(h) ((PIMAGE_SECTION_HEADER) ((ULONG_PTR)h+FIELD_OFFSET(IMAGE_NT_HEADERS,OptionalHeader)+((PIMAGE_NT_HEADERS)(h))->FileHeader.SizeOfOptionalHeader)) 709 #define IMAGE_DIRECTORY_ENTRY_EXPORT 0 710 #define IMAGE_DIRECTORY_ENTRY_IMPORT 1 711 #define IMAGE_DIRECTORY_ENTRY_RESOURCE 2 712 #define IMAGE_DIRECTORY_ENTRY_EXCEPTION 3 713 #define IMAGE_DIRECTORY_ENTRY_SECURITY 4 714 #define IMAGE_DIRECTORY_ENTRY_BASERELOC 5 715 #define IMAGE_DIRECTORY_ENTRY_DEBUG 6 716 #define IMAGE_DIRECTORY_ENTRY_COPYRIGHT 7 717 #define IMAGE_DIRECTORY_ENTRY_GLOBALPTR 8 718 #define IMAGE_DIRECTORY_ENTRY_TLS 9 719 #define IMAGE_DIRECTORY_ENTRY_LOAD_CONFIG 10 720 #define IMAGE_DIRECTORY_ENTRY_BOUND_IMPORT 11 721 #define IMAGE_DIRECTORY_ENTRY_IAT 12 722 #define IMAGE_DIRECTORY_ENTRY_DELAY_IMPORT 13 723 #define IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR 14 724 #define IMAGE_SCN_TYPE_REG 0 725 #define IMAGE_SCN_TYPE_DSECT 1 726 //#define IMAGE_SCN_TYPE_NOLOAD 2 727 #define IMAGE_SCN_TYPE_GROUP 4 728 #define IMAGE_SCN_TYPE_NO_PAD 8 729 #define IMAGE_SCN_CNT_CODE 32 730 #define IMAGE_SCN_CNT_INITIALIZED_DATA 64 731 #define IMAGE_SCN_CNT_UNINITIALIZED_DATA 128 732 #define IMAGE_SCN_LNK_OTHER 256 733 #define IMAGE_SCN_LNK_INFO 512 734 #define IMAGE_SCN_LNK_REMOVE 2048 735 #define IMAGE_SCN_LNK_COMDAT 4096 736 #define IMAGE_SCN_MEM_FARDATA 0x8000 737 #define IMAGE_SCN_MEM_PURGEABLE 0x20000 738 #define IMAGE_SCN_MEM_16BIT 0x20000 739 #define IMAGE_SCN_MEM_LOCKED 0x40000 740 #define IMAGE_SCN_MEM_PRELOAD 0x80000 741 #define IMAGE_SCN_ALIGN_1BYTES 0x100000 742 #define IMAGE_SCN_ALIGN_2BYTES 0x200000 743 #define IMAGE_SCN_ALIGN_4BYTES 0x300000 744 #define IMAGE_SCN_ALIGN_8BYTES 0x400000 745 #define IMAGE_SCN_ALIGN_16BYTES 0x500000 746 #define IMAGE_SCN_ALIGN_32BYTES 0x600000 747 #define IMAGE_SCN_ALIGN_64BYTES 0x700000 748 #define IMAGE_SCN_LNK_NRELOC_OVFL 0x1000000 749 #define IMAGE_SCN_MEM_DISCARDABLE 0x2000000 750 #define IMAGE_SCN_MEM_NOT_CACHED 0x4000000 751 #define IMAGE_SCN_MEM_NOT_PAGED 0x8000000 752 #define IMAGE_SCN_MEM_SHARED 0x10000000 753 #define IMAGE_SCN_MEM_EXECUTE 0x20000000 754 #define IMAGE_SCN_MEM_READ 0x40000000 755 #define IMAGE_SCN_MEM_WRITE 0x80000000 756 #define IMAGE_SYM_UNDEFINED 0 757 #define IMAGE_SYM_ABSOLUTE (-1) 758 #define IMAGE_SYM_DEBUG (-2) 759 #define IMAGE_SYM_TYPE_NULL 0 760 #define IMAGE_SYM_TYPE_VOID 1 761 #define IMAGE_SYM_TYPE_CHAR 2 762 #define IMAGE_SYM_TYPE_SHORT 3 763 #define IMAGE_SYM_TYPE_INT 4 764 #define IMAGE_SYM_TYPE_LONG 5 765 #define IMAGE_SYM_TYPE_FLOAT 6 766 #define IMAGE_SYM_TYPE_DOUBLE 7 767 #define IMAGE_SYM_TYPE_STRUCT 8 768 #define IMAGE_SYM_TYPE_UNION 9 769 #define IMAGE_SYM_TYPE_ENUM 10 770 #define IMAGE_SYM_TYPE_MOE 11 771 #define IMAGE_SYM_TYPE_BYTE 12 772 #define IMAGE_SYM_TYPE_WORD 13 773 #define IMAGE_SYM_TYPE_UINT 14 774 #define IMAGE_SYM_TYPE_DWORD 15 775 #define IMAGE_SYM_TYPE_PCODE 32768 776 #define IMAGE_SYM_DTYPE_NULL 0 777 #define IMAGE_SYM_DTYPE_POINTER 1 778 #define IMAGE_SYM_DTYPE_FUNCTION 2 779 #define IMAGE_SYM_DTYPE_ARRAY 3 780 #define IMAGE_SYM_CLASS_END_OF_FUNCTION (-1) 781 #define IMAGE_SYM_CLASS_NULL 0 782 #define IMAGE_SYM_CLASS_AUTOMATIC 1 783 #define IMAGE_SYM_CLASS_EXTERNAL 2 784 #define IMAGE_SYM_CLASS_STATIC 3 785 #define IMAGE_SYM_CLASS_REGISTER 4 786 #define IMAGE_SYM_CLASS_EXTERNAL_DEF 5 787 #define IMAGE_SYM_CLASS_LABEL 6 788 #define IMAGE_SYM_CLASS_UNDEFINED_LABEL 7 789 #define IMAGE_SYM_CLASS_MEMBER_OF_STRUCT 8 790 #define IMAGE_SYM_CLASS_ARGUMENT 9 791 #define IMAGE_SYM_CLASS_STRUCT_TAG 10 792 #define IMAGE_SYM_CLASS_MEMBER_OF_UNION 11 793 #define IMAGE_SYM_CLASS_UNION_TAG 12 794 #define IMAGE_SYM_CLASS_TYPE_DEFINITION 13 795 #define IMAGE_SYM_CLASS_UNDEFINED_STATIC 14 796 #define IMAGE_SYM_CLASS_ENUM_TAG 15 797 #define IMAGE_SYM_CLASS_MEMBER_OF_ENUM 16 798 #define IMAGE_SYM_CLASS_REGISTER_PARAM 17 799 #define IMAGE_SYM_CLASS_BIT_FIELD 18 800 #define IMAGE_SYM_CLASS_FAR_EXTERNAL 68 801 #define IMAGE_SYM_CLASS_BLOCK 100 802 #define IMAGE_SYM_CLASS_FUNCTION 101 803 #define IMAGE_SYM_CLASS_END_OF_STRUCT 102 804 #define IMAGE_SYM_CLASS_FILE 103 805 #define IMAGE_SYM_CLASS_SECTION 104 806 #define IMAGE_SYM_CLASS_WEAK_EXTERNAL 105 807 #define IMAGE_COMDAT_SELECT_NODUPLICATES 1 808 #define IMAGE_COMDAT_SELECT_ANY 2 809 #define IMAGE_COMDAT_SELECT_SAME_SIZE 3 810 #define IMAGE_COMDAT_SELECT_EXACT_MATCH 4 811 #define IMAGE_COMDAT_SELECT_ASSOCIATIVE 5 812 #define IMAGE_COMDAT_SELECT_LARGEST 6 813 #define IMAGE_COMDAT_SELECT_NEWEST 7 814 #define IMAGE_WEAK_EXTERN_SEARCH_NOLIBRARY 1 815 #define IMAGE_WEAK_EXTERN_SEARCH_LIBRARY 2 816 #define IMAGE_WEAK_EXTERN_SEARCH_ALIAS 3 817 #define IMAGE_REL_I386_ABSOLUTE 0 818 #define IMAGE_REL_I386_DIR16 1 819 #define IMAGE_REL_I386_REL16 2 820 #define IMAGE_REL_I386_DIR32 6 821 #define IMAGE_REL_I386_DIR32NB 7 822 #define IMAGE_REL_I386_SEG12 9 823 #define IMAGE_REL_I386_SECTION 10 824 #define IMAGE_REL_I386_SECREL 11 825 #define IMAGE_REL_I386_REL32 20 826 #define IMAGE_REL_MIPS_ABSOLUTE 0 827 #define IMAGE_REL_MIPS_REFHALF 1 828 #define IMAGE_REL_MIPS_REFWORD 2 829 #define IMAGE_REL_MIPS_JMPADDR 3 830 #define IMAGE_REL_MIPS_REFHI 4 831 #define IMAGE_REL_MIPS_REFLO 5 832 #define IMAGE_REL_MIPS_GPREL 6 833 #define IMAGE_REL_MIPS_LITERAL 7 834 #define IMAGE_REL_MIPS_SECTION 10 835 #define IMAGE_REL_MIPS_SECREL 11 836 #define IMAGE_REL_MIPS_SECRELLO 12 837 #define IMAGE_REL_MIPS_SECRELHI 13 838 #define IMAGE_REL_MIPS_REFWORDNB 34 839 #define IMAGE_REL_MIPS_PAIR 35 840 #define IMAGE_REL_ALPHA_ABSOLUTE 0 841 #define IMAGE_REL_ALPHA_REFLONG 1 842 #define IMAGE_REL_ALPHA_REFQUAD 2 843 #define IMAGE_REL_ALPHA_GPREL32 3 844 #define IMAGE_REL_ALPHA_LITERAL 4 845 #define IMAGE_REL_ALPHA_LITUSE 5 846 #define IMAGE_REL_ALPHA_GPDISP 6 847 #define IMAGE_REL_ALPHA_BRADDR 7 848 #define IMAGE_REL_ALPHA_HINT 8 849 #define IMAGE_REL_ALPHA_INLINE_REFLONG 9 850 #define IMAGE_REL_ALPHA_REFHI 10 851 #define IMAGE_REL_ALPHA_REFLO 11 852 #define IMAGE_REL_ALPHA_PAIR 12 853 #define IMAGE_REL_ALPHA_MATCH 13 854 #define IMAGE_REL_ALPHA_SECTION 14 855 #define IMAGE_REL_ALPHA_SECREL 15 856 #define IMAGE_REL_ALPHA_REFLONGNB 16 857 #define IMAGE_REL_ALPHA_SECRELLO 17 858 #define IMAGE_REL_ALPHA_SECRELHI 18 859 #define IMAGE_REL_PPC_ABSOLUTE 0 860 #define IMAGE_REL_PPC_ADDR64 1 861 #define IMAGE_REL_PPC_ADDR32 2 862 #define IMAGE_REL_PPC_ADDR24 3 863 #define IMAGE_REL_PPC_ADDR16 4 864 #define IMAGE_REL_PPC_ADDR14 5 865 #define IMAGE_REL_PPC_REL24 6 866 #define IMAGE_REL_PPC_REL14 7 867 #define IMAGE_REL_PPC_TOCREL16 8 868 #define IMAGE_REL_PPC_TOCREL14 9 869 #define IMAGE_REL_PPC_ADDR32NB 10 870 #define IMAGE_REL_PPC_SECREL 11 871 #define IMAGE_REL_PPC_SECTION 12 872 #define IMAGE_REL_PPC_IFGLUE 13 873 #define IMAGE_REL_PPC_IMGLUE 14 874 #define IMAGE_REL_PPC_SECREL16 15 875 #define IMAGE_REL_PPC_REFHI 16 876 #define IMAGE_REL_PPC_REFLO 17 877 #define IMAGE_REL_PPC_PAIR 18 878 #define IMAGE_REL_PPC_TYPEMASK 255 879 #define IMAGE_REL_PPC_NEG 256 880 #define IMAGE_REL_PPC_BRTAKEN 512 881 #define IMAGE_REL_PPC_BRNTAKEN 1024 882 #define IMAGE_REL_PPC_TOCDEFN 2048 883 #define IMAGE_REL_BASED_ABSOLUTE 0 884 #define IMAGE_REL_BASED_HIGH 1 885 #define IMAGE_REL_BASED_LOW 2 886 #define IMAGE_REL_BASED_HIGHLOW 3 887 #define IMAGE_REL_BASED_HIGHADJ 4 888 #define IMAGE_REL_BASED_MIPS_JMPADDR 5 889 #define IMAGE_REL_BASED_MIPS_JMPADDR16 9 890 #define IMAGE_REL_BASED_IA64_IMM64 9 891 #define IMAGE_REL_BASED_DIR64 10 892 #define IMAGE_ARCHIVE_START_SIZE 8 893 #define IMAGE_ARCHIVE_START "!<arch>\n" 894 #define IMAGE_ARCHIVE_END "`\n" 895 #define IMAGE_ARCHIVE_PAD "\n" 896 #define IMAGE_ARCHIVE_LINKER_MEMBER "/ " 897 #define IMAGE_ARCHIVE_LONGNAMES_MEMBER "// " 898 #define IMAGE_RESOURCE_NAME_IS_STRING 0x80000000 899 #define IMAGE_RESOURCE_DATA_IS_DIRECTORY 0x80000000 900 #define IMAGE_DEBUG_TYPE_UNKNOWN 0 901 #define IMAGE_DEBUG_TYPE_COFF 1 902 #define IMAGE_DEBUG_TYPE_CODEVIEW 2 903 #define IMAGE_DEBUG_TYPE_FPO 3 904 #define IMAGE_DEBUG_TYPE_MISC 4 905 #define IMAGE_DEBUG_TYPE_EXCEPTION 5 906 #define IMAGE_DEBUG_TYPE_FIXUP 6 907 #define IMAGE_DEBUG_TYPE_OMAP_TO_SRC 7 908 #define IMAGE_DEBUG_TYPE_OMAP_FROM_SRC 8 909 #define FRAME_FPO 0 910 #define FRAME_TRAP 1 911 #define FRAME_TSS 2 912 #define FRAME_NONFPO 3 913 #define IMAGE_DEBUG_MISC_EXENAME 1 914 #define N_BTMASK 0x000F 915 #define N_TMASK 0x0030 916 #define N_TMASK1 0x00C0 917 #define N_TMASK2 0x00F0 918 #define N_BTSHFT 4 919 #define N_TSHIFT 2 920 #define IS_TEXT_UNICODE_ASCII16 1 921 #define IS_TEXT_UNICODE_REVERSE_ASCII16 16 922 #define IS_TEXT_UNICODE_STATISTICS 2 923 #define IS_TEXT_UNICODE_REVERSE_STATISTICS 32 924 #define IS_TEXT_UNICODE_CONTROLS 4 925 #define IS_TEXT_UNICODE_REVERSE_CONTROLS 64 926 #define IS_TEXT_UNICODE_SIGNATURE 8 927 #define IS_TEXT_UNICODE_REVERSE_SIGNATURE 128 928 #define IS_TEXT_UNICODE_ILLEGAL_CHARS 256 929 #define IS_TEXT_UNICODE_ODD_LENGTH 512 930 #define IS_TEXT_UNICODE_DBCS_LEADBYTE 1024 931 #define IS_TEXT_UNICODE_NULL_BYTES 4096 932 #define IS_TEXT_UNICODE_UNICODE_MASK 15 933 #define IS_TEXT_UNICODE_REVERSE_MASK 240 934 #define IS_TEXT_UNICODE_NOT_UNICODE_MASK 3840 935 #define IS_TEXT_UNICODE_NOT_ASCII_MASK 61440 936 #define SERVICE_KERNEL_DRIVER 1 937 #define SERVICE_FILE_SYSTEM_DRIVER 2 938 #define SERVICE_ADAPTER 4 939 #define SERVICE_RECOGNIZER_DRIVER 8 940 #define SERVICE_DRIVER (SERVICE_KERNEL_DRIVER|SERVICE_FILE_SYSTEM_DRIVER|SERVICE_RECOGNIZER_DRIVER) 941 #define SERVICE_WIN32_OWN_PROCESS 16 942 #define SERVICE_WIN32_SHARE_PROCESS 32 943 #define SERVICE_WIN32 (SERVICE_WIN32_OWN_PROCESS|SERVICE_WIN32_SHARE_PROCESS) 944 #define SERVICE_INTERACTIVE_PROCESS 256 945 #define SERVICE_TYPE_ALL (SERVICE_WIN32|SERVICE_ADAPTER|SERVICE_DRIVER|SERVICE_INTERACTIVE_PROCESS) 946 #define SERVICE_BOOT_START 0 947 #define SERVICE_SYSTEM_START 1 948 #define SERVICE_AUTO_START 2 949 #define SERVICE_DEMAND_START 3 950 #define SERVICE_DISABLED 4 951 #define SERVICE_ERROR_IGNORE 0 952 #define SERVICE_ERROR_NORMAL 1 953 #define SERVICE_ERROR_SEVERE 2 954 #define SERVICE_ERROR_CRITICAL 3 955 956 #define DLL_PROCESS_DETACH 0 957 #define DLL_PROCESS_ATTACH 1 958 #define DLL_THREAD_ATTACH 2 959 #define DLL_THREAD_DETACH 3 960 #ifdef __WINESRC__ 961 #define DLL_WINE_PREATTACH 8 /* Never called, but defined for compatibility with Wine source */ 962 #endif 963 #define TAPE_ABSOLUTE_POSITION 0 964 #define TAPE_LOGICAL_POSITION 1 965 #define TAPE_PSEUDO_LOGICAL_POSITION 2 966 #define TAPE_REWIND 0 967 #define TAPE_ABSOLUTE_BLOCK 1 968 #define TAPE_LOGICAL_BLOCK 2 969 #define TAPE_PSEUDO_LOGICAL_BLOCK 3 970 #define TAPE_SPACE_END_OF_DATA 4 971 #define TAPE_SPACE_RELATIVE_BLOCKS 5 972 #define TAPE_SPACE_FILEMARKS 6 973 #define TAPE_SPACE_SEQUENTIAL_FMKS 7 974 #define TAPE_SPACE_SETMARKS 8 975 #define TAPE_SPACE_SEQUENTIAL_SMKS 9 976 #define TAPE_DRIVE_FIXED 1 977 #define TAPE_DRIVE_SELECT 2 978 #define TAPE_DRIVE_INITIATOR 4 979 #define TAPE_DRIVE_ERASE_SHORT 16 980 #define TAPE_DRIVE_ERASE_LONG 32 981 #define TAPE_DRIVE_ERASE_BOP_ONLY 64 982 #define TAPE_DRIVE_ERASE_IMMEDIATE 128 983 #define TAPE_DRIVE_TAPE_CAPACITY 256 984 #define TAPE_DRIVE_TAPE_REMAINING 512 985 #define TAPE_DRIVE_FIXED_BLOCK 1024 986 #define TAPE_DRIVE_VARIABLE_BLOCK 2048 987 #define TAPE_DRIVE_WRITE_PROTECT 4096 988 #define TAPE_DRIVE_EOT_WZ_SIZE 8192 989 #define TAPE_DRIVE_ECC 0x10000 990 #define TAPE_DRIVE_COMPRESSION 0x20000 991 #define TAPE_DRIVE_PADDING 0x40000 992 #define TAPE_DRIVE_REPORT_SMKS 0x80000 993 #define TAPE_DRIVE_GET_ABSOLUTE_BLK 0x100000 994 #define TAPE_DRIVE_GET_LOGICAL_BLK 0x200000 995 #define TAPE_DRIVE_SET_EOT_WZ_SIZE 0x400000 996 #define TAPE_DRIVE_EJECT_MEDIA 0x1000000 997 #define TAPE_DRIVE_CLEAN_REQUESTS 0x2000000 998 #define TAPE_DRIVE_SET_CMP_BOP_ONLY 0x4000000 999 #define TAPE_DRIVE_RESERVED_BIT 0x80000000 1000 #define TAPE_DRIVE_LOAD_UNLOAD 0x80000001 1001 #define TAPE_DRIVE_TENSION 0x80000002 1002 #define TAPE_DRIVE_LOCK_UNLOCK 0x80000004 1003 #define TAPE_DRIVE_REWIND_IMMEDIATE 0x80000008 1004 #define TAPE_DRIVE_SET_BLOCK_SIZE 0x80000010 1005 #define TAPE_DRIVE_LOAD_UNLD_IMMED 0x80000020 1006 #define TAPE_DRIVE_TENSION_IMMED 0x80000040 1007 #define TAPE_DRIVE_LOCK_UNLK_IMMED 0x80000080 1008 #define TAPE_DRIVE_SET_ECC 0x80000100 1009 #define TAPE_DRIVE_SET_COMPRESSION 0x80000200 1010 #define TAPE_DRIVE_SET_PADDING 0x80000400 1011 #define TAPE_DRIVE_SET_REPORT_SMKS 0x80000800 1012 #define TAPE_DRIVE_ABSOLUTE_BLK 0x80001000 1013 #define TAPE_DRIVE_ABS_BLK_IMMED 0x80002000 1014 #define TAPE_DRIVE_LOGICAL_BLK 0x80004000 1015 #define TAPE_DRIVE_LOG_BLK_IMMED 0x80008000 1016 #define TAPE_DRIVE_END_OF_DATA 0x80010000 1017 #define TAPE_DRIVE_RELATIVE_BLKS 0x80020000 1018 #define TAPE_DRIVE_FILEMARKS 0x80040000 1019 #define TAPE_DRIVE_SEQUENTIAL_FMKS 0x80080000 1020 #define TAPE_DRIVE_SETMARKS 0x80100000 1021 #define TAPE_DRIVE_SEQUENTIAL_SMKS 0x80200000 1022 #define TAPE_DRIVE_REVERSE_POSITION 0x80400000 1023 #define TAPE_DRIVE_SPACE_IMMEDIATE 0x80800000 1024 #define TAPE_DRIVE_WRITE_SETMARKS 0x81000000 1025 #define TAPE_DRIVE_WRITE_FILEMARKS 0x82000000 1026 #define TAPE_DRIVE_WRITE_SHORT_FMKS 0x84000000 1027 #define TAPE_DRIVE_WRITE_LONG_FMKS 0x88000000 1028 #define TAPE_DRIVE_WRITE_MARK_IMMED 0x90000000 1029 #define TAPE_DRIVE_FORMAT 0xA0000000 1030 #define TAPE_DRIVE_FORMAT_IMMEDIATE 0xC0000000 1031 #define TAPE_DRIVE_HIGH_FEATURES 0x80000000 1032 #define TAPE_FIXED_PARTITIONS 0 1033 #define TAPE_INITIATOR_PARTITIONS 2 1034 #define TAPE_SELECT_PARTITIONS 1 1035 #define TAPE_FILEMARKS 1 1036 #define TAPE_LONG_FILEMARKS 3 1037 #define TAPE_SETMARKS 0 1038 #define TAPE_SHORT_FILEMARKS 2 1039 #define TAPE_ERASE_LONG 1 1040 #define TAPE_ERASE_SHORT 0 1041 #define TAPE_LOAD 0 1042 #define TAPE_UNLOAD 1 1043 #define TAPE_TENSION 2 1044 #define TAPE_LOCK 3 1045 #define TAPE_UNLOCK 4 1046 #define TAPE_FORMAT 5 1047 #if (_WIN32_WINNT >= 0x0500) 1048 #define VER_MINORVERSION 0x0000001 1049 #define VER_MAJORVERSION 0x0000002 1050 #define VER_BUILDNUMBER 0x0000004 1051 #define VER_PLATFORMID 0x0000008 1052 #define VER_SERVICEPACKMINOR 0x0000010 1053 #define VER_SERVICEPACKMAJOR 0x0000020 1054 #define VER_SUITENAME 0x0000040 1055 #define VER_PRODUCT_TYPE 0x0000080 1056 #define VER_EQUAL 1 1057 #define VER_GREATER 2 1058 #define VER_GREATER_EQUAL 3 1059 #define VER_LESS 4 1060 #define VER_LESS_EQUAL 5 1061 #define VER_AND 6 1062 #define VER_OR 7 1063 #endif 1064 1065 #define VER_PLATFORM_WIN32s 0 1066 #define VER_PLATFORM_WIN32_WINDOWS 1 1067 #define VER_PLATFORM_WIN32_NT 2 1068 #define VER_NT_WORKSTATION 1 1069 #define VER_NT_DOMAIN_CONTROLLER 2 1070 #define VER_NT_SERVER 3 1071 1072 #define WT_EXECUTEDEFAULT 0x00000000 1073 #define WT_EXECUTEINIOTHREAD 0x00000001 1074 #define WT_EXECUTEINUITHREAD 0x00000002 1075 #define WT_EXECUTEINWAITTHREAD 0x00000004 1076 #define WT_EXECUTEONLYONCE 0x00000008 1077 #define WT_EXECUTELONGFUNCTION 0x00000010 1078 #define WT_EXECUTEINTIMERTHREAD 0x00000020 1079 #define WT_EXECUTEINPERSISTENTIOTHREAD 0x00000040 1080 #define WT_EXECUTEINPERSISTENTTHREAD 0x00000080 1081 #define WT_TRANSFER_IMPERSONATION 0x00000100 1082 #define WT_SET_MAX_THREADPOOL_THREADS(flags,limit) ((flags)|=(limit)<<16) 1083 typedef VOID (NTAPI *WORKERCALLBACKFUNC)(PVOID); 1084 #if (_WIN32_WINNT >= 0x0501) 1085 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1 1086 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2 1087 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3 1088 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4 1089 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5 1090 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6 1091 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7 1092 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9 1093 #define ACTIVATION_CONTEXT_SECTION_APPLICATION_SETTINGS 10 1094 #define ACTIVATION_CONTEXT_SECTION_COMPATIBILITY_INFO 11 1095 #endif /* (_WIN32_WINNT >= 0x0501) */ 1096 #define BTYPE(x) ((x)&N_BTMASK) 1097 #define ISPTR(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)) 1098 #define ISFCN(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_FUNCTION<<N_BTSHFT)) 1099 #define ISARY(x) (((x)&N_TMASK)==(IMAGE_SYM_DTYPE_ARRAY<<N_BTSHFT)) 1100 #define ISTAG(x) ((x)==IMAGE_SYM_CLASS_STRUCT_TAG||(x)==IMAGE_SYM_CLASS_UNION_TAG||(x)==IMAGE_SYM_CLASS_ENUM_TAG) 1101 #define INCREF(x) ((((x)&~N_BTMASK)<<N_TSHIFT)|(IMAGE_SYM_DTYPE_POINTER<<N_BTSHFT)|((x)&N_BTMASK)) 1102 #define DECREF(x) ((((x)>>N_TSHIFT)&~N_BTMASK)|((x)&N_BTMASK)) 1103 #define TLS_MINIMUM_AVAILABLE 64 1104 #define FLS_MAXIMUM_AVAILABLE 128 1105 #define REPARSE_GUID_DATA_BUFFER_HEADER_SIZE FIELD_OFFSET(REPARSE_GUID_DATA_BUFFER, GenericReparseBuffer) 1106 #define MAXIMUM_REPARSE_DATA_BUFFER_SIZE 16384 1107 #define IO_REPARSE_TAG_RESERVED_ZERO 0 1108 #define IO_REPARSE_TAG_RESERVED_ONE 1 1109 #define IO_REPARSE_TAG_RESERVED_RANGE IO_REPARSE_TAG_RESERVED_ONE 1110 #define IsReparseTagMicrosoft(x) ((x)&0x80000000) 1111 #define IsReparseTagHighLatency(x) ((x)&0x40000000) 1112 #define IsReparseTagNameSurrogate(x) ((x)&0x20000000) 1113 #define IO_REPARSE_TAG_VALID_VALUES 0xE000FFFF 1114 #define IsReparseTagValid(x) (!((x)&~IO_REPARSE_TAG_VALID_VALUES)&&((x)>IO_REPARSE_TAG_RESERVED_RANGE)) 1115 #define IO_REPARSE_TAG_SYMBOLIC_LINK IO_REPARSE_TAG_RESERVED_ZERO 1116 #define IO_REPARSE_TAG_MOUNT_POINT 0xA0000003 1117 #define IO_REPARSE_TAG_SYMLINK 0xA000000CL 1118 1119 #define RTL_CRITICAL_SECTION_FLAG_NO_DEBUG_INFO 0x01000000 1120 1121 #ifndef RC_INVOKED 1122 1123 #ifdef _GUID_DEFINED 1124 # warning _GUID_DEFINED is deprecated, use GUID_DEFINED instead 1125 #endif 1126 1127 #if ! (defined _GUID_DEFINED || defined GUID_DEFINED) /* also defined in basetyps.h */ 1128 #define GUID_DEFINED 1129 typedef struct _GUID { 1130 unsigned long Data1; 1131 unsigned short Data2; 1132 unsigned short Data3; 1133 unsigned char Data4[8]; 1134 } GUID, *REFGUID, *LPGUID; 1135 #endif /* GUID_DEFINED */ 1136 1137 typedef enum _ACL_INFORMATION_CLASS { 1138 AclRevisionInformation = 1, 1139 AclSizeInformation 1140 } ACL_INFORMATION_CLASS; 1141 1142 typedef struct _ACL_REVISION_INFORMATION { 1143 DWORD AclRevision; 1144 } ACL_REVISION_INFORMATION, *PACL_REVISION_INFORMATION; 1145 1146 typedef struct _ACL_SIZE_INFORMATION { 1147 DWORD AceCount; 1148 DWORD AclBytesInUse; 1149 DWORD AclBytesFree; 1150 } ACL_SIZE_INFORMATION, *PACL_SIZE_INFORMATION; 1151 1152 #ifndef _LDT_ENTRY_DEFINED 1153 #define _LDT_ENTRY_DEFINED 1154 1155 typedef struct _LDT_ENTRY { 1156 WORD LimitLow; 1157 WORD BaseLow; 1158 union { 1159 struct { 1160 BYTE BaseMid; 1161 BYTE Flags1; 1162 BYTE Flags2; 1163 BYTE BaseHi; 1164 } Bytes; 1165 struct { 1166 DWORD BaseMid:8; 1167 DWORD Type:5; 1168 DWORD Dpl:2; 1169 DWORD Pres:1; 1170 DWORD LimitHi:4; 1171 DWORD Sys:1; 1172 DWORD Reserved_0:1; 1173 DWORD Default_Big:1; 1174 DWORD Granularity:1; 1175 DWORD BaseHi:8; 1176 } Bits; 1177 } HighWord; 1178 } LDT_ENTRY, *PLDT_ENTRY, *LPLDT_ENTRY; 1179 1180 #endif /* _LDT_ENTRY_DEFINED */ 1181 1182 /* FIXME: add more machines */ 1183 #if defined(_X86_) 1184 #define SIZE_OF_80387_REGISTERS 80 1185 #define CONTEXT_i386 0x10000 1186 #define CONTEXT_i486 0x10000 1187 #define CONTEXT_CONTROL (CONTEXT_i386|0x00000001L) 1188 #define CONTEXT_INTEGER (CONTEXT_i386|0x00000002L) 1189 #define CONTEXT_SEGMENTS (CONTEXT_i386|0x00000004L) 1190 #define CONTEXT_FLOATING_POINT (CONTEXT_i386|0x00000008L) 1191 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_i386|0x00000010L) 1192 #define CONTEXT_EXTENDED_REGISTERS (CONTEXT_i386|0x00000020L) 1193 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_INTEGER|CONTEXT_SEGMENTS) 1194 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | \ 1195 CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS | \ 1196 CONTEXT_EXTENDED_REGISTERS) 1197 #define MAXIMUM_SUPPORTED_EXTENSION 512 1198 1199 #define EXCEPTION_READ_FAULT 0 1200 #define EXCEPTION_WRITE_FAULT 1 1201 #define EXCEPTION_EXECUTE_FAULT 8 1202 1203 typedef struct _FLOATING_SAVE_AREA { 1204 DWORD ControlWord; 1205 DWORD StatusWord; 1206 DWORD TagWord; 1207 DWORD ErrorOffset; 1208 DWORD ErrorSelector; 1209 DWORD DataOffset; 1210 DWORD DataSelector; 1211 BYTE RegisterArea[SIZE_OF_80387_REGISTERS]; 1212 DWORD Cr0NpxState; 1213 } FLOATING_SAVE_AREA, *PFLOATING_SAVE_AREA; 1214 1215 typedef struct _CONTEXT { 1216 DWORD ContextFlags; 1217 DWORD Dr0; 1218 DWORD Dr1; 1219 DWORD Dr2; 1220 DWORD Dr3; 1221 DWORD Dr6; 1222 DWORD Dr7; 1223 FLOATING_SAVE_AREA FloatSave; 1224 DWORD SegGs; 1225 DWORD SegFs; 1226 DWORD SegEs; 1227 DWORD SegDs; 1228 DWORD Edi; 1229 DWORD Esi; 1230 DWORD Ebx; 1231 DWORD Edx; 1232 DWORD Ecx; 1233 DWORD Eax; 1234 DWORD Ebp; 1235 DWORD Eip; 1236 DWORD SegCs; 1237 DWORD EFlags; 1238 DWORD Esp; 1239 DWORD SegSs; 1240 BYTE ExtendedRegisters[MAXIMUM_SUPPORTED_EXTENSION]; 1241 } CONTEXT; 1242 #elif defined(_AMD64_) 1243 1244 #define CONTEXT_AMD64 0x100000 1245 1246 #if !defined(RC_INVOKED) 1247 #define CONTEXT_CONTROL (CONTEXT_AMD64 | 0x1L) 1248 #define CONTEXT_INTEGER (CONTEXT_AMD64 | 0x2L) 1249 #define CONTEXT_SEGMENTS (CONTEXT_AMD64 | 0x4L) 1250 #define CONTEXT_FLOATING_POINT (CONTEXT_AMD64 | 0x8L) 1251 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_AMD64 | 0x10L) 1252 1253 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) 1254 #define CONTEXT_ALL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_SEGMENTS | CONTEXT_FLOATING_POINT | CONTEXT_DEBUG_REGISTERS) 1255 1256 #define CONTEXT_EXCEPTION_ACTIVE 0x8000000 1257 #define CONTEXT_SERVICE_ACTIVE 0x10000000 1258 #define CONTEXT_EXCEPTION_REQUEST 0x40000000 1259 #define CONTEXT_EXCEPTION_REPORTING 0x80000000 1260 #endif 1261 1262 #define INITIAL_MXCSR 0x1f80 1263 #define INITIAL_FPCSR 0x027f 1264 #define EXCEPTION_READ_FAULT 0 1265 #define EXCEPTION_WRITE_FAULT 1 1266 #define EXCEPTION_EXECUTE_FAULT 8 1267 1268 typedef struct DECLSPEC_ALIGN(16) _M128A { 1269 ULONGLONG Low; 1270 LONGLONG High; 1271 } M128A, *PM128A; 1272 1273 typedef struct _XMM_SAVE_AREA32 { 1274 WORD ControlWord; 1275 WORD StatusWord; 1276 BYTE TagWord; 1277 BYTE Reserved1; 1278 WORD ErrorOpcode; 1279 DWORD ErrorOffset; 1280 WORD ErrorSelector; 1281 WORD Reserved2; 1282 DWORD DataOffset; 1283 WORD DataSelector; 1284 WORD Reserved3; 1285 DWORD MxCsr; 1286 DWORD MxCsr_Mask; 1287 M128A FloatRegisters[8]; 1288 M128A XmmRegisters[16]; 1289 BYTE Reserved4[96]; 1290 } XMM_SAVE_AREA32, *PXMM_SAVE_AREA32; 1291 1292 typedef struct DECLSPEC_ALIGN(16) _CONTEXT { 1293 DWORD64 P1Home; 1294 DWORD64 P2Home; 1295 DWORD64 P3Home; 1296 DWORD64 P4Home; 1297 DWORD64 P5Home; 1298 DWORD64 P6Home; 1299 1300 /* Control flags */ 1301 DWORD ContextFlags; 1302 DWORD MxCsr; 1303 1304 /* Segment */ 1305 WORD SegCs; 1306 WORD SegDs; 1307 WORD SegEs; 1308 WORD SegFs; 1309 WORD SegGs; 1310 WORD SegSs; 1311 DWORD EFlags; 1312 1313 /* Debug */ 1314 DWORD64 Dr0; 1315 DWORD64 Dr1; 1316 DWORD64 Dr2; 1317 DWORD64 Dr3; 1318 DWORD64 Dr6; 1319 DWORD64 Dr7; 1320 1321 /* Integer */ 1322 DWORD64 Rax; 1323 DWORD64 Rcx; 1324 DWORD64 Rdx; 1325 DWORD64 Rbx; 1326 DWORD64 Rsp; 1327 DWORD64 Rbp; 1328 DWORD64 Rsi; 1329 DWORD64 Rdi; 1330 DWORD64 R8; 1331 DWORD64 R9; 1332 DWORD64 R10; 1333 DWORD64 R11; 1334 DWORD64 R12; 1335 DWORD64 R13; 1336 DWORD64 R14; 1337 DWORD64 R15; 1338 1339 /* Counter */ 1340 DWORD64 Rip; 1341 1342 /* Floating point */ 1343 union { 1344 XMM_SAVE_AREA32 FltSave; 1345 struct { 1346 M128A Header[2]; 1347 M128A Legacy[8]; 1348 M128A Xmm0; 1349 M128A Xmm1; 1350 M128A Xmm2; 1351 M128A Xmm3; 1352 M128A Xmm4; 1353 M128A Xmm5; 1354 M128A Xmm6; 1355 M128A Xmm7; 1356 M128A Xmm8; 1357 M128A Xmm9; 1358 M128A Xmm10; 1359 M128A Xmm11; 1360 M128A Xmm12; 1361 M128A Xmm13; 1362 M128A Xmm14; 1363 M128A Xmm15; 1364 } DUMMYSTRUCTNAME; 1365 } DUMMYUNIONNAME; 1366 1367 /* Vector */ 1368 M128A VectorRegister[26]; 1369 DWORD64 VectorControl; 1370 1371 /* Debug control */ 1372 DWORD64 DebugControl; 1373 DWORD64 LastBranchToRip; 1374 DWORD64 LastBranchFromRip; 1375 DWORD64 LastExceptionToRip; 1376 DWORD64 LastExceptionFromRip; 1377 } CONTEXT; 1378 1379 1380 typedef struct _KNONVOLATILE_CONTEXT_POINTERS { 1381 union { 1382 PM128A FloatingContext[16]; 1383 struct { 1384 PM128A Xmm0; 1385 PM128A Xmm1; 1386 PM128A Xmm2; 1387 PM128A Xmm3; 1388 PM128A Xmm4; 1389 PM128A Xmm5; 1390 PM128A Xmm6; 1391 PM128A Xmm7; 1392 PM128A Xmm8; 1393 PM128A Xmm9; 1394 PM128A Xmm10; 1395 PM128A Xmm11; 1396 PM128A Xmm12; 1397 PM128A Xmm13; 1398 PM128A Xmm14; 1399 PM128A Xmm15; 1400 } DUMMYSTRUCTNAME; 1401 } DUMMYUNIONNAME; 1402 1403 union { 1404 PULONG64 IntegerContext[16]; 1405 struct { 1406 PULONG64 Rax; 1407 PULONG64 Rcx; 1408 PULONG64 Rdx; 1409 PULONG64 Rbx; 1410 PULONG64 Rsp; 1411 PULONG64 Rbp; 1412 PULONG64 Rsi; 1413 PULONG64 Rdi; 1414 PULONG64 R8; 1415 PULONG64 R9; 1416 PULONG64 R10; 1417 PULONG64 R11; 1418 PULONG64 R12; 1419 PULONG64 R13; 1420 PULONG64 R14; 1421 PULONG64 R15; 1422 } DUMMYSTRUCTNAME; 1423 } DUMMYUNIONNAME2; 1424 } KNONVOLATILE_CONTEXT_POINTERS, *PKNONVOLATILE_CONTEXT_POINTERS; 1425 1426 #define UNW_FLAG_NHANDLER 0x0 1427 #define UNW_FLAG_EHANDLER 0x1 1428 #define UNW_FLAG_UHANDLER 0x2 1429 #define UNW_FLAG_CHAININFO 0x4 1430 #define UNW_FLAG_NO_EPILOGUE 0x80000000UL 1431 1432 #define RUNTIME_FUNCTION_INDIRECT 0x1 1433 1434 typedef struct _RUNTIME_FUNCTION { 1435 DWORD BeginAddress; 1436 DWORD EndAddress; 1437 DWORD UnwindData; 1438 } RUNTIME_FUNCTION,*PRUNTIME_FUNCTION; 1439 1440 #define UNWIND_HISTORY_TABLE_SIZE 12 1441 1442 typedef struct _UNWIND_HISTORY_TABLE_ENTRY 1443 { 1444 DWORD64 ImageBase; 1445 PRUNTIME_FUNCTION FunctionEntry; 1446 } UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY; 1447 1448 typedef struct _UNWIND_HISTORY_TABLE 1449 { 1450 DWORD Count; 1451 BYTE LocalHint; 1452 BYTE GlobalHint; 1453 BYTE Search; 1454 BYTE Once; 1455 ULONG64 LowAddress; 1456 ULONG64 HighAddress; 1457 UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE]; 1458 } UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE; 1459 1460 typedef 1461 _Function_class_(GET_RUNTIME_FUNCTION_CALLBACK) 1462 PRUNTIME_FUNCTION 1463 GET_RUNTIME_FUNCTION_CALLBACK( 1464 _In_ DWORD64 ControlPc, 1465 _In_opt_ PVOID Context); 1466 typedef GET_RUNTIME_FUNCTION_CALLBACK *PGET_RUNTIME_FUNCTION_CALLBACK; 1467 1468 typedef 1469 _Function_class_(OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK) 1470 DWORD 1471 OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK( 1472 _In_ HANDLE Process, 1473 _In_ PVOID TableAddress, 1474 _Out_ PDWORD Entries, 1475 _Out_ PRUNTIME_FUNCTION* Functions); 1476 typedef OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK *POUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK; 1477 1478 struct _EXCEPTION_POINTERS; 1479 typedef 1480 LONG 1481 (*PEXCEPTION_FILTER) ( 1482 struct _EXCEPTION_POINTERS *ExceptionPointers, 1483 PVOID EstablisherFrame); 1484 1485 typedef 1486 VOID 1487 (*PTERMINATION_HANDLER) ( 1488 BOOLEAN AbnormalTermination, 1489 PVOID EstablisherFrame); 1490 1491 typedef struct _DISPATCHER_CONTEXT 1492 { 1493 ULONG64 ControlPc; 1494 ULONG64 ImageBase; 1495 PRUNTIME_FUNCTION FunctionEntry; 1496 ULONG64 EstablisherFrame; 1497 ULONG64 TargetIp; 1498 struct _CONTEXT *ContextRecord; 1499 PEXCEPTION_ROUTINE LanguageHandler; 1500 PVOID HandlerData; 1501 PUNWIND_HISTORY_TABLE HistoryTable; 1502 ULONG ScopeIndex; 1503 ULONG Fill0; 1504 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; 1505 1506 typedef struct _SCOPE_TABLE_AMD64 1507 { 1508 DWORD Count; 1509 struct 1510 { 1511 DWORD BeginAddress; 1512 DWORD EndAddress; 1513 DWORD HandlerAddress; 1514 DWORD JumpTarget; 1515 } ScopeRecord[1]; 1516 } SCOPE_TABLE_AMD64, *PSCOPE_TABLE_AMD64; 1517 typedef SCOPE_TABLE_AMD64 SCOPE_TABLE, *PSCOPE_TABLE; 1518 1519 #define OUT_OF_PROCESS_FUNCTION_TABLE_CALLBACK_EXPORT_NAME "OutOfProcessFunctionTableCallback" 1520 1521 NTSYSAPI 1522 VOID 1523 __cdecl 1524 RtlRestoreContext(struct _CONTEXT *ContextRecord, 1525 struct _EXCEPTION_RECORD *ExceptionRecord); 1526 1527 NTSYSAPI 1528 BOOLEAN 1529 __cdecl 1530 RtlAddFunctionTable(PRUNTIME_FUNCTION FunctionTable, 1531 DWORD EntryCount, 1532 DWORD64 BaseAddress); 1533 1534 NTSYSAPI 1535 BOOLEAN 1536 __cdecl 1537 RtlInstallFunctionTableCallback(DWORD64 TableIdentifier, 1538 DWORD64 BaseAddress, 1539 DWORD Length, 1540 PGET_RUNTIME_FUNCTION_CALLBACK Callback, 1541 PVOID Context, 1542 PCWSTR OutOfProcessCallbackDll); 1543 1544 NTSYSAPI 1545 BOOLEAN 1546 __cdecl 1547 RtlDeleteFunctionTable(PRUNTIME_FUNCTION FunctionTable); 1548 1549 NTSYSAPI 1550 PRUNTIME_FUNCTION 1551 NTAPI 1552 RtlLookupFunctionEntry( 1553 _In_ DWORD64 ControlPc, 1554 _Out_ PDWORD64 ImageBase, 1555 _Inout_opt_ PUNWIND_HISTORY_TABLE HistoryTable); 1556 1557 NTSYSAPI 1558 PEXCEPTION_ROUTINE 1559 NTAPI 1560 RtlVirtualUnwind( 1561 _In_ DWORD HandlerType, 1562 _In_ DWORD64 ImageBase, 1563 _In_ DWORD64 ControlPc, 1564 _In_ PRUNTIME_FUNCTION FunctionEntry, 1565 _Inout_ struct _CONTEXT *ContextRecord, 1566 _Out_ PVOID *HandlerData, 1567 _Out_ PDWORD64 EstablisherFrame, 1568 _Inout_opt_ PKNONVOLATILE_CONTEXT_POINTERS ContextPointers); 1569 1570 NTSYSAPI 1571 VOID 1572 NTAPI 1573 RtlUnwindEx( 1574 _In_opt_ PVOID TargetFrame, 1575 _In_opt_ PVOID TargetIp, 1576 _In_opt_ struct _EXCEPTION_RECORD *ExceptionRecord, 1577 _In_ PVOID ReturnValue, 1578 _In_ struct _CONTEXT *ContextRecord, 1579 _In_opt_ PUNWIND_HISTORY_TABLE HistoryTable); 1580 1581 #elif defined(_PPC_) 1582 #define CONTEXT_CONTROL 1L 1583 #define CONTEXT_FLOATING_POINT 2L 1584 #define CONTEXT_INTEGER 4L 1585 #define CONTEXT_DEBUG_REGISTERS 8L 1586 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER) 1587 typedef struct _FLOATING_SAVE_AREA 1588 { 1589 double Fpr0; 1590 double Fpr1; 1591 double Fpr2; 1592 double Fpr3; 1593 double Fpr4; 1594 double Fpr5; 1595 double Fpr6; 1596 double Fpr7; 1597 double Fpr8; 1598 double Fpr9; 1599 double Fpr10; 1600 double Fpr11; 1601 double Fpr12; 1602 double Fpr13; 1603 double Fpr14; 1604 double Fpr15; 1605 double Fpr16; 1606 double Fpr17; 1607 double Fpr18; 1608 double Fpr19; 1609 double Fpr20; 1610 double Fpr21; 1611 double Fpr22; 1612 double Fpr23; 1613 double Fpr24; 1614 double Fpr25; 1615 double Fpr26; 1616 double Fpr27; 1617 double Fpr28; 1618 double Fpr29; 1619 double Fpr30; 1620 double Fpr31; 1621 double Fpscr; 1622 } FLOATING_SAVE_AREA; 1623 1624 typedef struct _CONTEXT { 1625 FLOATING_SAVE_AREA FloatSave; 1626 DWORD Gpr0; 1627 DWORD Gpr1; 1628 DWORD Gpr2; 1629 DWORD Gpr3; 1630 DWORD Gpr4; 1631 DWORD Gpr5; 1632 DWORD Gpr6; 1633 DWORD Gpr7; 1634 DWORD Gpr8; 1635 DWORD Gpr9; 1636 DWORD Gpr10; 1637 DWORD Gpr11; 1638 DWORD Gpr12; 1639 DWORD Gpr13; 1640 DWORD Gpr14; 1641 DWORD Gpr15; 1642 DWORD Gpr16; 1643 DWORD Gpr17; 1644 DWORD Gpr18; 1645 DWORD Gpr19; 1646 DWORD Gpr20; 1647 DWORD Gpr21; 1648 DWORD Gpr22; 1649 DWORD Gpr23; 1650 DWORD Gpr24; 1651 DWORD Gpr25; 1652 DWORD Gpr26; 1653 DWORD Gpr27; 1654 DWORD Gpr28; 1655 DWORD Gpr29; 1656 DWORD Gpr30; 1657 DWORD Gpr31; 1658 DWORD Cr; 1659 DWORD Xer; 1660 DWORD Msr; 1661 DWORD Iar; 1662 DWORD Lr; 1663 DWORD Ctr; 1664 DWORD ContextFlags; 1665 DWORD Fill[3]; 1666 DWORD Dr0; 1667 DWORD Dr1; 1668 DWORD Dr2; 1669 DWORD Dr3; 1670 DWORD Dr4; 1671 DWORD Dr5; 1672 DWORD Dr6; 1673 DWORD Dr7; 1674 } CONTEXT; 1675 #elif defined(_ALPHA_) 1676 #define CONTEXT_ALPHA 0x20000 1677 #define CONTEXT_CONTROL (CONTEXT_ALPHA|1L) 1678 #define CONTEXT_FLOATING_POINT (CONTEXT_ALPHA|2L) 1679 #define CONTEXT_INTEGER (CONTEXT_ALPHA|4L) 1680 #define CONTEXT_FULL (CONTEXT_CONTROL|CONTEXT_FLOATING_POINT|CONTEXT_INTEGER) 1681 typedef struct _CONTEXT { 1682 ULONGLONG FltF0; 1683 ULONGLONG FltF1; 1684 ULONGLONG FltF2; 1685 ULONGLONG FltF3; 1686 ULONGLONG FltF4; 1687 ULONGLONG FltF5; 1688 ULONGLONG FltF6; 1689 ULONGLONG FltF7; 1690 ULONGLONG FltF8; 1691 ULONGLONG FltF9; 1692 ULONGLONG FltF10; 1693 ULONGLONG FltF11; 1694 ULONGLONG FltF12; 1695 ULONGLONG FltF13; 1696 ULONGLONG FltF14; 1697 ULONGLONG FltF15; 1698 ULONGLONG FltF16; 1699 ULONGLONG FltF17; 1700 ULONGLONG FltF18; 1701 ULONGLONG FltF19; 1702 ULONGLONG FltF20; 1703 ULONGLONG FltF21; 1704 ULONGLONG FltF22; 1705 ULONGLONG FltF23; 1706 ULONGLONG FltF24; 1707 ULONGLONG FltF25; 1708 ULONGLONG FltF26; 1709 ULONGLONG FltF27; 1710 ULONGLONG FltF28; 1711 ULONGLONG FltF29; 1712 ULONGLONG FltF30; 1713 ULONGLONG FltF31; 1714 ULONGLONG IntV0; 1715 ULONGLONG IntT0; 1716 ULONGLONG IntT1; 1717 ULONGLONG IntT2; 1718 ULONGLONG IntT3; 1719 ULONGLONG IntT4; 1720 ULONGLONG IntT5; 1721 ULONGLONG IntT6; 1722 ULONGLONG IntT7; 1723 ULONGLONG IntS0; 1724 ULONGLONG IntS1; 1725 ULONGLONG IntS2; 1726 ULONGLONG IntS3; 1727 ULONGLONG IntS4; 1728 ULONGLONG IntS5; 1729 ULONGLONG IntFp; 1730 ULONGLONG IntA0; 1731 ULONGLONG IntA1; 1732 ULONGLONG IntA2; 1733 ULONGLONG IntA3; 1734 ULONGLONG IntA4; 1735 ULONGLONG IntA5; 1736 ULONGLONG IntT8; 1737 ULONGLONG IntT9; 1738 ULONGLONG IntT10; 1739 ULONGLONG IntT11; 1740 ULONGLONG IntRa; 1741 ULONGLONG IntT12; 1742 ULONGLONG IntAt; 1743 ULONGLONG IntGp; 1744 ULONGLONG IntSp; 1745 ULONGLONG IntZero; 1746 ULONGLONG Fpcr; 1747 ULONGLONG SoftFpcr; 1748 ULONGLONG Fir; 1749 DWORD Psr; 1750 DWORD ContextFlags; 1751 DWORD Fill[4]; 1752 } CONTEXT; 1753 #elif defined(_SH_) 1754 1755 /* These are the debug or break registers on the SH3 */ 1756 typedef struct _DEBUG_REGISTERS { 1757 DWORD BarA; 1758 UCHAR BasrA; 1759 UCHAR BamrA; 1760 USHORT BbrA; 1761 DWORD BarB; 1762 UCHAR BasrB; 1763 UCHAR BamrB; 1764 USHORT BbrB; 1765 DWORD BdrB; 1766 DWORD BdmrB; 1767 USHORT Brcr; 1768 USHORT Align; 1769 } DEBUG_REGISTERS, *PDEBUG_REGISTERS; 1770 1771 /* The following flags control the contents of the CONTEXT structure. */ 1772 1773 #define CONTEXT_SH3 0x00000040 1774 #define CONTEXT_SH4 0x000000c0 /* CONTEXT_SH3 | 0x80 - must contain the SH3 bits */ 1775 1776 #ifdef SH3 1777 #define CONTEXT_CONTROL (CONTEXT_SH3 | 0x00000001L) 1778 #define CONTEXT_INTEGER (CONTEXT_SH3 | 0x00000002L) 1779 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH3 | 0x00000008L) 1780 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS) 1781 #else /* SH4 */ 1782 #define CONTEXT_CONTROL (CONTEXT_SH4 | 0x00000001L) 1783 #define CONTEXT_INTEGER (CONTEXT_SH4 | 0x00000002L) 1784 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_SH4 | 0x00000008L) 1785 #define CONTEXT_FLOATING_POINT (CONTEXT_SH4 | 0x00000004L) 1786 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_DEBUG_REGISTERS | CONTEXT_FLOATING_POINT) 1787 #endif 1788 1789 /* Context Frame */ 1790 1791 /* This frame is used to store a limited processor context into the */ 1792 /* Thread structure for CPUs which have no floating point support. */ 1793 1794 typedef struct _CONTEXT { 1795 /* The flags values within this flag control the contents of */ 1796 /* a CONTEXT record. */ 1797 1798 /* If the context record is used as an input parameter, then */ 1799 /* for each portion of the context record controlled by a flag */ 1800 /* whose value is set, it is assumed that that portion of the */ 1801 /* context record contains valid context. If the context record */ 1802 /* is being used to modify a thread's context, then only that */ 1803 /* portion of the threads context will be modified. */ 1804 1805 /* If the context record is used as an IN OUT parameter to capture */ 1806 /* the context of a thread, then only those portions of the thread's */ 1807 /* context corresponding to set flags will be returned. */ 1808 1809 /* The context record is never used as an OUT only parameter. */ 1810 1811 1812 DWORD ContextFlags; 1813 1814 /* This section is specified/returned if the ContextFlags word contains */ 1815 /* the flag CONTEXT_INTEGER. */ 1816 1817 /* N.B. The registers RA and R15 are defined in this section, but are */ 1818 /* considered part of the control context rather than part of the integer */ 1819 /* context. */ 1820 1821 DWORD PR; 1822 DWORD MACH; 1823 DWORD MACL; 1824 DWORD GBR; 1825 DWORD R0; 1826 DWORD R1; 1827 DWORD R2; 1828 DWORD R3; 1829 DWORD R4; 1830 DWORD R5; 1831 DWORD R6; 1832 DWORD R7; 1833 DWORD R8; 1834 DWORD R9; 1835 DWORD R10; 1836 DWORD R11; 1837 DWORD R12; 1838 DWORD R13; 1839 DWORD R14; 1840 DWORD R15; 1841 1842 /* This section is specified/returned if the ContextFlags word contains */ 1843 /* the flag CONTEXT_CONTROL. */ 1844 1845 /* N.B. The registers r15 and ra are defined in the integer section, */ 1846 /* but are considered part of the control context rather than part of */ 1847 /* the integer context. */ 1848 1849 DWORD Fir; 1850 DWORD Psr; 1851 1852 #if !defined(SH3e) && !defined(SH4) 1853 DWORD OldStuff[2]; 1854 DEBUG_REGISTERS DebugRegisters; 1855 #else 1856 DWORD Fpscr; 1857 DWORD Fpul; 1858 DWORD FRegs[16]; 1859 #if defined(SH4) 1860 DWORD xFRegs[16]; 1861 #endif 1862 #endif 1863 } CONTEXT; 1864 1865 #elif defined(_MIPS_) 1866 1867 /* The following flags control the contents of the CONTEXT structure. */ 1868 1869 #define CONTEXT_R4000 0x00010000 /* r4000 context */ 1870 1871 #define CONTEXT_CONTROL (CONTEXT_R4000 | 0x00000001L) 1872 #define CONTEXT_FLOATING_POINT (CONTEXT_R4000 | 0x00000002L) 1873 #define CONTEXT_INTEGER (CONTEXT_R4000 | 0x00000004L) 1874 1875 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_FLOATING_POINT | CONTEXT_INTEGER) 1876 1877 /* Context Frame */ 1878 1879 /* N.B. This frame must be exactly a multiple of 16 bytes in length. */ 1880 1881 /* This frame has a several purposes: 1) it is used as an argument to */ 1882 /* NtContinue, 2) it is used to constuct a call frame for APC delivery, */ 1883 /* 3) it is used to construct a call frame for exception dispatching */ 1884 /* in user mode, and 4) it is used in the user level thread creation */ 1885 /* routines. */ 1886 1887 /* The layout of the record conforms to a standard call frame. */ 1888 1889 1890 typedef struct _CONTEXT { 1891 1892 /* This section is always present and is used as an argument build */ 1893 /* area. */ 1894 1895 DWORD Argument[4]; 1896 1897 /* This section is specified/returned if the ContextFlags word contains */ 1898 /* the flag CONTEXT_FLOATING_POINT. */ 1899 1900 DWORD FltF0; 1901 DWORD FltF1; 1902 DWORD FltF2; 1903 DWORD FltF3; 1904 DWORD FltF4; 1905 DWORD FltF5; 1906 DWORD FltF6; 1907 DWORD FltF7; 1908 DWORD FltF8; 1909 DWORD FltF9; 1910 DWORD FltF10; 1911 DWORD FltF11; 1912 DWORD FltF12; 1913 DWORD FltF13; 1914 DWORD FltF14; 1915 DWORD FltF15; 1916 DWORD FltF16; 1917 DWORD FltF17; 1918 DWORD FltF18; 1919 DWORD FltF19; 1920 DWORD FltF20; 1921 DWORD FltF21; 1922 DWORD FltF22; 1923 DWORD FltF23; 1924 DWORD FltF24; 1925 DWORD FltF25; 1926 DWORD FltF26; 1927 DWORD FltF27; 1928 DWORD FltF28; 1929 DWORD FltF29; 1930 DWORD FltF30; 1931 DWORD FltF31; 1932 1933 /* This section is specified/returned if the ContextFlags word contains */ 1934 /* the flag CONTEXT_INTEGER. */ 1935 1936 /* N.B. The registers gp, sp, and ra are defined in this section, but are */ 1937 /* considered part of the control context rather than part of the integer */ 1938 /* context. */ 1939 1940 /* N.B. Register zero is not stored in the frame. */ 1941 1942 DWORD IntZero; 1943 DWORD IntAt; 1944 DWORD IntV0; 1945 DWORD IntV1; 1946 DWORD IntA0; 1947 DWORD IntA1; 1948 DWORD IntA2; 1949 DWORD IntA3; 1950 DWORD IntT0; 1951 DWORD IntT1; 1952 DWORD IntT2; 1953 DWORD IntT3; 1954 DWORD IntT4; 1955 DWORD IntT5; 1956 DWORD IntT6; 1957 DWORD IntT7; 1958 DWORD IntS0; 1959 DWORD IntS1; 1960 DWORD IntS2; 1961 DWORD IntS3; 1962 DWORD IntS4; 1963 DWORD IntS5; 1964 DWORD IntS6; 1965 DWORD IntS7; 1966 DWORD IntT8; 1967 DWORD IntT9; 1968 DWORD IntK0; 1969 DWORD IntK1; 1970 DWORD IntGp; 1971 DWORD IntSp; 1972 DWORD IntS8; 1973 DWORD IntRa; 1974 DWORD IntLo; 1975 DWORD IntHi; 1976 1977 /* This section is specified/returned if the ContextFlags word contains */ 1978 /* the flag CONTEXT_FLOATING_POINT. */ 1979 1980 DWORD Fsr; 1981 1982 /* This section is specified/returned if the ContextFlags word contains */ 1983 /* the flag CONTEXT_CONTROL. */ 1984 1985 /* N.B. The registers gp, sp, and ra are defined in the integer section, */ 1986 /* but are considered part of the control context rather than part of */ 1987 /* the integer context. */ 1988 1989 DWORD Fir; 1990 DWORD Psr; 1991 1992 /* The flags values within this flag control the contents of */ 1993 /* a CONTEXT record. */ 1994 1995 /* If the context record is used as an input parameter, then */ 1996 /* for each portion of the context record controlled by a flag */ 1997 /* whose value is set, it is assumed that that portion of the */ 1998 /* context record contains valid context. If the context record */ 1999 /* is being used to modify a thread's context, then only that */ 2000 /* portion of the threads context will be modified. */ 2001 2002 /* If the context record is used as an IN OUT parameter to capture */ 2003 /* the context of a thread, then only those portions of the thread's */ 2004 /* context corresponding to set flags will be returned. */ 2005 2006 /* The context record is never used as an OUT only parameter. */ 2007 2008 DWORD ContextFlags; 2009 2010 DWORD Fill[2]; 2011 2012 } CONTEXT; 2013 #elif defined(_ARM_) 2014 2015 #ifndef PAGE_SIZE 2016 #define PAGE_SIZE 0x1000 // FIXME: This should probably go elsewhere 2017 #endif 2018 2019 /* The following flags control the contents of the CONTEXT structure. */ 2020 2021 #define CONTEXT_ARM 0x200000L 2022 #define CONTEXT_CONTROL (CONTEXT_ARM | 0x00000001L) 2023 #define CONTEXT_INTEGER (CONTEXT_ARM | 0x00000002L) 2024 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM | 0x00000004L) 2025 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM | 0x00000008L) 2026 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) 2027 2028 #define EXCEPTION_READ_FAULT 0 2029 #define EXCEPTION_WRITE_FAULT 1 2030 #define EXCEPTION_EXECUTE_FAULT 8 2031 2032 typedef struct _NEON128 2033 { 2034 ULONGLONG Low; 2035 LONGLONG High; 2036 } NEON128, *PNEON128; 2037 2038 #define ARM_MAX_BREAKPOINTS 8 2039 #define ARM_MAX_WATCHPOINTS 1 2040 2041 typedef struct _CONTEXT 2042 { 2043 /* The flags values within this flag control the contents of 2044 a CONTEXT record. 2045 2046 If the context record is used as an input parameter, then 2047 for each portion of the context record controlled by a flag 2048 whose value is set, it is assumed that that portion of the 2049 context record contains valid context. If the context record 2050 is being used to modify a thread's context, then only that 2051 portion of the threads context will be modified. 2052 2053 If the context record is used as an IN OUT parameter to capture 2054 the context of a thread, then only those portions of the thread's 2055 context corresponding to set flags will be returned. 2056 2057 The context record is never used as an OUT only parameter. */ 2058 DWORD ContextFlags; 2059 2060 /* This section is specified/returned if the ContextFlags word contains 2061 the flag CONTEXT_INTEGER. */ 2062 DWORD R0; 2063 DWORD R1; 2064 DWORD R2; 2065 DWORD R3; 2066 DWORD R4; 2067 DWORD R5; 2068 DWORD R6; 2069 DWORD R7; 2070 DWORD R8; 2071 DWORD R9; 2072 DWORD R10; 2073 DWORD R11; 2074 DWORD R12; 2075 2076 DWORD Sp; 2077 DWORD Lr; 2078 DWORD Pc; 2079 DWORD Cpsr; 2080 2081 /* Floating Point/NEON Registers */ 2082 DWORD Fpscr; 2083 DWORD Padding; 2084 union 2085 { 2086 NEON128 Q[16]; 2087 ULONGLONG D[32]; 2088 DWORD S[32]; 2089 } DUMMYUNIONNAME; 2090 2091 /* Debug registers */ 2092 DWORD Bvr[ARM_MAX_BREAKPOINTS]; 2093 DWORD Bcr[ARM_MAX_BREAKPOINTS]; 2094 DWORD Wvr[ARM_MAX_WATCHPOINTS]; 2095 DWORD Wcr[ARM_MAX_WATCHPOINTS]; 2096 2097 DWORD Padding2[2]; 2098 } CONTEXT, *PCONTEXT; 2099 2100 typedef struct _IMAGE_ARM_RUNTIME_FUNCTION_ENTRY 2101 { 2102 DWORD BeginAddress; 2103 union 2104 { 2105 DWORD UnwindData; 2106 struct 2107 { 2108 DWORD Flag : 2; 2109 DWORD FunctionLength : 11; 2110 DWORD Ret : 2; 2111 DWORD H : 1; 2112 DWORD Reg : 3; 2113 DWORD R : 1; 2114 DWORD L : 1; 2115 DWORD C : 1; 2116 DWORD StackAdjust : 10; 2117 } DUMMYSTRUCTNAME; 2118 } DUMMYUNIONNAME; 2119 } IMAGE_ARM_RUNTIME_FUNCTION_ENTRY, *PIMAGE_ARM_RUNTIME_FUNCTION_ENTRY; 2120 typedef IMAGE_ARM_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; 2121 2122 typedef struct _SCOPE_TABLE_ARM 2123 { 2124 DWORD Count; 2125 struct 2126 { 2127 DWORD BeginAddress; 2128 DWORD EndAddress; 2129 DWORD HandlerAddress; 2130 DWORD JumpTarget; 2131 } ScopeRecord[1]; 2132 } SCOPE_TABLE_ARM, *PSCOPE_TABLE_ARM; 2133 typedef SCOPE_TABLE_ARM SCOPE_TABLE, *PSCOPE_TABLE; 2134 2135 typedef struct _DISPATCHER_CONTEXT 2136 { 2137 DWORD ControlPc; 2138 DWORD ImageBase; 2139 PRUNTIME_FUNCTION FunctionEntry; 2140 DWORD EstablisherFrame; 2141 DWORD TargetPc; 2142 PCONTEXT ContextRecord; 2143 PEXCEPTION_ROUTINE LanguageHandler; 2144 PVOID HandlerData; 2145 struct _UNWIND_HISTORY_TABLE *HistoryTable; 2146 DWORD ScopeIndex; 2147 BOOLEAN ControlPcIsUnwound; 2148 PBYTE NonVolatileRegisters; 2149 DWORD Reserved; 2150 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; 2151 2152 #elif defined(_ARM64_) 2153 2154 #define CONTEXT_ARM64 0x00400000L 2155 #define CONTEXT_CONTROL (CONTEXT_ARM64 | 0x1L) 2156 #define CONTEXT_INTEGER (CONTEXT_ARM64 | 0x2L) 2157 #define CONTEXT_FLOATING_POINT (CONTEXT_ARM64 | 0x4L) 2158 #define CONTEXT_DEBUG_REGISTERS (CONTEXT_ARM64 | 0x8L) 2159 #define CONTEXT_X18 (CONTEXT_ARM64 | 0x10L) 2160 #define CONTEXT_FULL (CONTEXT_CONTROL | CONTEXT_INTEGER | CONTEXT_FLOATING_POINT) 2161 2162 2163 #define EXCEPTION_READ_FAULT 0 2164 #define EXCEPTION_WRITE_FAULT 1 2165 #define EXCEPTION_EXECUTE_FAULT 8 2166 2167 typedef union NEON128 { 2168 struct { 2169 ULONGLONG Low; 2170 LONGLONG High; 2171 } DUMMYSTRUCTNAME; 2172 double D[2]; 2173 float S[4]; 2174 WORD H[8]; 2175 BYTE B[16]; 2176 } NEON128, *PNEON128; 2177 2178 #define ARM64_MAX_BREAKPOINTS 8 2179 #define ARM64_MAX_WATCHPOINTS 2 2180 2181 typedef struct _CONTEXT { 2182 2183 // 2184 // Control flags. 2185 // 2186 2187 DWORD ContextFlags; 2188 2189 // 2190 // Integer registers 2191 // 2192 2193 DWORD Cpsr; 2194 union { 2195 struct { 2196 DWORD64 X0; 2197 DWORD64 X1; 2198 DWORD64 X2; 2199 DWORD64 X3; 2200 DWORD64 X4; 2201 DWORD64 X5; 2202 DWORD64 X6; 2203 DWORD64 X7; 2204 DWORD64 X8; 2205 DWORD64 X9; 2206 DWORD64 X10; 2207 DWORD64 X11; 2208 DWORD64 X12; 2209 DWORD64 X13; 2210 DWORD64 X14; 2211 DWORD64 X15; 2212 DWORD64 X16; 2213 DWORD64 X17; 2214 DWORD64 X18; 2215 DWORD64 X19; 2216 DWORD64 X20; 2217 DWORD64 X21; 2218 DWORD64 X22; 2219 DWORD64 X23; 2220 DWORD64 X24; 2221 DWORD64 X25; 2222 DWORD64 X26; 2223 DWORD64 X27; 2224 DWORD64 X28; 2225 DWORD64 Fp; 2226 DWORD64 Lr; 2227 } DUMMYSTRUCTNAME; 2228 DWORD64 X[31]; 2229 } DUMMYUNIONNAME; 2230 2231 DWORD64 Sp; 2232 DWORD64 Pc; 2233 2234 // 2235 // Floating Point/NEON Registers 2236 // 2237 2238 NEON128 V[32]; 2239 DWORD Fpcr; 2240 DWORD Fpsr; 2241 2242 // 2243 // Debug registers 2244 // 2245 2246 DWORD Bcr[ARM64_MAX_BREAKPOINTS]; 2247 DWORD64 Bvr[ARM64_MAX_BREAKPOINTS]; 2248 DWORD Wcr[ARM64_MAX_WATCHPOINTS]; 2249 DWORD64 Wvr[ARM64_MAX_WATCHPOINTS]; 2250 2251 } _CONTEXT, *P_CONTEXT; 2252 typedef _CONTEXT CONTEXT, *PCONTEXT; 2253 2254 typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY { 2255 DWORD BeginAddress; 2256 union { 2257 DWORD UnwindData; 2258 struct { 2259 DWORD Flag : 2; 2260 DWORD FunctionLength : 11; 2261 DWORD RegF : 3; 2262 DWORD RegI : 4; 2263 DWORD H : 1; 2264 DWORD CR : 2; 2265 DWORD FrameSize : 9; 2266 } DUMMYSTRUCTNAME; 2267 } DUMMYUNIONNAME; 2268 } IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY, * PIMAGE_ARM64_RUNTIME_FUNCTION_ENTRY; 2269 typedef struct _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY RUNTIME_FUNCTION, *PRUNTIME_FUNCTION; 2270 2271 typedef struct _SCOPE_TABLE_ARM64 { 2272 DWORD Count; 2273 struct 2274 { 2275 DWORD BeginAddress; 2276 DWORD EndAddress; 2277 DWORD HandlerAddress; 2278 DWORD JumpTarget; 2279 } ScopeRecord[1]; 2280 } SCOPE_TABLE_ARM64, *PSCOPE_TABLE_ARM64; 2281 typedef SCOPE_TABLE_ARM64 SCOPE_TABLE, *PSCOPE_TABLE; 2282 2283 typedef struct _DISPATCHER_CONTEXT { 2284 ULONG_PTR ControlPc; 2285 ULONG_PTR ImageBase; 2286 PRUNTIME_FUNCTION FunctionEntry; 2287 ULONG_PTR EstablisherFrame; 2288 ULONG_PTR TargetPc; 2289 PCONTEXT ContextRecord; 2290 PEXCEPTION_ROUTINE LanguageHandler; 2291 PVOID HandlerData; 2292 struct _UNWIND_HISTORY_TABLE *HistoryTable; 2293 DWORD ScopeIndex; 2294 BOOLEAN ControlPcIsUnwound; 2295 PBYTE NonVolatileRegisters; 2296 } DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT; 2297 #else 2298 #error "undefined processor type" 2299 #endif 2300 typedef CONTEXT *PCONTEXT; 2301 2302 /* The WoW64 context */ 2303 #define WOW64_CONTEXT_i386 0x00010000 2304 #define WOW64_CONTEXT_i486 0x00010000 2305 #define WOW64_CONTEXT_CONTROL (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000001)) 2306 #define WOW64_CONTEXT_INTEGER (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000002)) 2307 #define WOW64_CONTEXT_SEGMENTS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000004)) 2308 #define WOW64_CONTEXT_FLOATING_POINT (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000008)) 2309 #define WOW64_CONTEXT_DEBUG_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000010)) 2310 #define WOW64_CONTEXT_EXTENDED_REGISTERS (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000020)) 2311 #define WOW64_CONTEXT_FULL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | WOW64_CONTEXT_SEGMENTS) 2312 #define WOW64_CONTEXT_ALL (WOW64_CONTEXT_CONTROL | WOW64_CONTEXT_INTEGER | \ 2313 WOW64_CONTEXT_SEGMENTS | WOW64_CONTEXT_FLOATING_POINT | \ 2314 WOW64_CONTEXT_DEBUG_REGISTERS | WOW64_CONTEXT_EXTENDED_REGISTERS) 2315 2316 #define WOW64_CONTEXT_XSTATE (WOW64_CONTEXT_i386 | __MSABI_LONG(0x00000040)) 2317 2318 #define WOW64_CONTEXT_EXCEPTION_ACTIVE 0x08000000 2319 #define WOW64_CONTEXT_SERVICE_ACTIVE 0x10000000 2320 #define WOW64_CONTEXT_EXCEPTION_REQUEST 0x40000000 2321 #define WOW64_CONTEXT_EXCEPTION_REPORTING 0x80000000 2322 2323 #define WOW64_SIZE_OF_80387_REGISTERS 80 2324 #define WOW64_MAXIMUM_SUPPORTED_EXTENSION 512 2325 2326 typedef struct _WOW64_FLOATING_SAVE_AREA 2327 { 2328 DWORD ControlWord; 2329 DWORD StatusWord; 2330 DWORD TagWord; 2331 DWORD ErrorOffset; 2332 DWORD ErrorSelector; 2333 DWORD DataOffset; 2334 DWORD DataSelector; 2335 BYTE RegisterArea[WOW64_SIZE_OF_80387_REGISTERS]; 2336 DWORD Cr0NpxState; 2337 } WOW64_FLOATING_SAVE_AREA, *PWOW64_FLOATING_SAVE_AREA; 2338 2339 #include "pshpack4.h" 2340 typedef struct _WOW64_CONTEXT 2341 { 2342 DWORD ContextFlags; 2343 DWORD Dr0; 2344 DWORD Dr1; 2345 DWORD Dr2; 2346 DWORD Dr3; 2347 DWORD Dr6; 2348 DWORD Dr7; 2349 WOW64_FLOATING_SAVE_AREA FloatSave; 2350 DWORD SegGs; 2351 DWORD SegFs; 2352 DWORD SegEs; 2353 DWORD SegDs; 2354 DWORD Edi; 2355 DWORD Esi; 2356 DWORD Ebx; 2357 DWORD Edx; 2358 DWORD Ecx; 2359 DWORD Eax; 2360 DWORD Ebp; 2361 DWORD Eip; 2362 DWORD SegCs; 2363 DWORD EFlags; 2364 DWORD Esp; 2365 DWORD SegSs; 2366 BYTE ExtendedRegisters[WOW64_MAXIMUM_SUPPORTED_EXTENSION]; 2367 } WOW64_CONTEXT, *PWOW64_CONTEXT; 2368 #include "poppack.h" 2369 2370 2371 #define EXCEPTION_MAXIMUM_PARAMETERS 15 2372 #define EXCEPTION_NONCONTINUABLE 0x01 2373 #define EXCEPTION_UNWINDING 0x02 2374 #define EXCEPTION_EXIT_UNWIND 0x04 2375 #define EXCEPTION_STACK_INVALID 0x08 2376 #define EXCEPTION_NESTED_CALL 0x10 2377 #define EXCEPTION_TARGET_UNWIND 0x20 2378 #define EXCEPTION_COLLIDED_UNWIND 0x40 2379 #define EXCEPTION_UNWIND (EXCEPTION_UNWINDING | EXCEPTION_EXIT_UNWIND | \ 2380 EXCEPTION_TARGET_UNWIND | EXCEPTION_COLLIDED_UNWIND) 2381 2382 #define IS_UNWINDING(Flag) ((Flag & EXCEPTION_UNWIND) != 0) 2383 #define IS_DISPATCHING(Flag) ((Flag & EXCEPTION_UNWIND) == 0) 2384 #define IS_TARGET_UNWIND(Flag) (Flag & EXCEPTION_TARGET_UNWIND) 2385 2386 typedef struct _EXCEPTION_RECORD { 2387 DWORD ExceptionCode; 2388 DWORD ExceptionFlags; 2389 struct _EXCEPTION_RECORD *ExceptionRecord; 2390 PVOID ExceptionAddress; 2391 DWORD NumberParameters; 2392 ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; 2393 } EXCEPTION_RECORD, *PEXCEPTION_RECORD; 2394 2395 typedef struct _EXCEPTION_RECORD32 { 2396 DWORD ExceptionCode; 2397 DWORD ExceptionFlags; 2398 DWORD ExceptionRecord; 2399 DWORD ExceptionAddress; 2400 DWORD NumberParameters; 2401 DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; 2402 } EXCEPTION_RECORD32,*PEXCEPTION_RECORD32; 2403 2404 typedef struct _EXCEPTION_RECORD64 { 2405 DWORD ExceptionCode; 2406 DWORD ExceptionFlags; 2407 DWORD64 ExceptionRecord; 2408 DWORD64 ExceptionAddress; 2409 DWORD NumberParameters; 2410 DWORD __unusedAlignment; 2411 DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]; 2412 } EXCEPTION_RECORD64,*PEXCEPTION_RECORD64; 2413 2414 typedef struct _EXCEPTION_POINTERS { 2415 PEXCEPTION_RECORD ExceptionRecord; 2416 PCONTEXT ContextRecord; 2417 } EXCEPTION_POINTERS, *PEXCEPTION_POINTERS; 2418 2419 typedef struct _SECURITY_ATTRIBUTES { 2420 DWORD nLength; 2421 LPVOID lpSecurityDescriptor; 2422 BOOL bInheritHandle; 2423 } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; 2424 2425 #define SECURITY_MIN_SID_SIZE (sizeof(SID)) 2426 2427 $include(setypes.h) 2428 2429 typedef struct _SYSTEM_AUDIT_OBJECT_ACE { 2430 ACE_HEADER Header; 2431 ACCESS_MASK Mask; 2432 DWORD Flags; 2433 GUID ObjectType; 2434 GUID InheritedObjectType; 2435 DWORD SidStart; 2436 } SYSTEM_AUDIT_OBJECT_ACE,*PSYSTEM_AUDIT_OBJECT_ACE; 2437 2438 typedef struct _SYSTEM_ALARM_OBJECT_ACE { 2439 ACE_HEADER Header; 2440 ACCESS_MASK Mask; 2441 DWORD Flags; 2442 GUID ObjectType; 2443 GUID InheritedObjectType; 2444 DWORD SidStart; 2445 } SYSTEM_ALARM_OBJECT_ACE,*PSYSTEM_ALARM_OBJECT_ACE; 2446 2447 typedef struct _ACCESS_ALLOWED_CALLBACK_ACE { 2448 ACE_HEADER Header; 2449 ACCESS_MASK Mask; 2450 DWORD SidStart; 2451 } ACCESS_ALLOWED_CALLBACK_ACE, *PACCESS_ALLOWED_CALLBACK_ACE; 2452 2453 typedef struct _ACCESS_DENIED_CALLBACK_ACE { 2454 ACE_HEADER Header; 2455 ACCESS_MASK Mask; 2456 DWORD SidStart; 2457 } ACCESS_DENIED_CALLBACK_ACE, *PACCESS_DENIED_CALLBACK_ACE; 2458 2459 typedef struct _SYSTEM_AUDIT_CALLBACK_ACE { 2460 ACE_HEADER Header; 2461 ACCESS_MASK Mask; 2462 DWORD SidStart; 2463 } SYSTEM_AUDIT_CALLBACK_ACE, *PSYSTEM_AUDIT_CALLBACK_ACE; 2464 2465 typedef struct _SYSTEM_ALARM_CALLBACK_ACE { 2466 ACE_HEADER Header; 2467 ACCESS_MASK Mask; 2468 DWORD SidStart; 2469 } SYSTEM_ALARM_CALLBACK_ACE, *PSYSTEM_ALARM_CALLBACK_ACE; 2470 2471 typedef struct _ACCESS_ALLOWED_CALLBACK_OBJECT_ACE { 2472 ACE_HEADER Header; 2473 ACCESS_MASK Mask; 2474 DWORD Flags; 2475 GUID ObjectType; 2476 GUID InheritedObjectType; 2477 DWORD SidStart; 2478 } ACCESS_ALLOWED_CALLBACK_OBJECT_ACE, *PACCESS_ALLOWED_CALLBACK_OBJECT_ACE; 2479 2480 typedef struct _ACCESS_DENIED_CALLBACK_OBJECT_ACE { 2481 ACE_HEADER Header; 2482 ACCESS_MASK Mask; 2483 DWORD Flags; 2484 GUID ObjectType; 2485 GUID InheritedObjectType; 2486 DWORD SidStart; 2487 } ACCESS_DENIED_CALLBACK_OBJECT_ACE, *PACCESS_DENIED_CALLBACK_OBJECT_ACE; 2488 2489 typedef struct _SYSTEM_AUDIT_CALLBACK_OBJECT_ACE { 2490 ACE_HEADER Header; 2491 ACCESS_MASK Mask; 2492 DWORD Flags; 2493 GUID ObjectType; 2494 GUID InheritedObjectType; 2495 DWORD SidStart; 2496 } SYSTEM_AUDIT_CALLBACK_OBJECT_ACE, *PSYSTEM_AUDIT_CALLBACK_OBJECT_ACE; 2497 2498 typedef struct _SYSTEM_ALARM_CALLBACK_OBJECT_ACE { 2499 ACE_HEADER Header; 2500 ACCESS_MASK Mask; 2501 DWORD Flags; 2502 GUID ObjectType; 2503 GUID InheritedObjectType; 2504 DWORD SidStart; 2505 } SYSTEM_ALARM_CALLBACK_OBJECT_ACE, *PSYSTEM_ALARM_CALLBACK_OBJECT_ACE; 2506 2507 typedef enum _TOKEN_ELEVATION_TYPE { 2508 TokenElevationTypeDefault = 1, 2509 TokenElevationTypeFull, 2510 TokenElevationTypeLimited, 2511 } TOKEN_ELEVATION_TYPE, *PTOKEN_ELEVATION_TYPE; 2512 2513 typedef struct _QUOTA_LIMITS { 2514 SIZE_T PagedPoolLimit; 2515 SIZE_T NonPagedPoolLimit; 2516 SIZE_T MinimumWorkingSetSize; 2517 SIZE_T MaximumWorkingSetSize; 2518 SIZE_T PagefileLimit; 2519 LARGE_INTEGER TimeLimit; 2520 } QUOTA_LIMITS,*PQUOTA_LIMITS; 2521 2522 typedef union _RATE_QUOTA_LIMIT { 2523 DWORD RateData; 2524 struct { 2525 DWORD RatePercent : 7; 2526 DWORD Reserved0 : 25; 2527 } DUMMYSTRUCTNAME; 2528 } RATE_QUOTA_LIMIT, *PRATE_QUOTA_LIMIT; 2529 2530 typedef struct _QUOTA_LIMITS_EX { 2531 SIZE_T PagedPoolLimit; 2532 SIZE_T NonPagedPoolLimit; 2533 SIZE_T MinimumWorkingSetSize; 2534 SIZE_T MaximumWorkingSetSize; 2535 SIZE_T PagefileLimit; 2536 LARGE_INTEGER TimeLimit; 2537 SIZE_T Reserved1; 2538 SIZE_T Reserved2; 2539 SIZE_T Reserved3; 2540 SIZE_T Reserved4; 2541 DWORD Flags; 2542 RATE_QUOTA_LIMIT CpuRateLimit; 2543 } QUOTA_LIMITS_EX, *PQUOTA_LIMITS_EX; 2544 2545 typedef struct _IO_COUNTERS { 2546 ULONGLONG ReadOperationCount; 2547 ULONGLONG WriteOperationCount; 2548 ULONGLONG OtherOperationCount; 2549 ULONGLONG ReadTransferCount; 2550 ULONGLONG WriteTransferCount; 2551 ULONGLONG OtherTransferCount; 2552 } IO_COUNTERS, *PIO_COUNTERS; 2553 2554 typedef struct _FILE_NOTIFY_INFORMATION { 2555 DWORD NextEntryOffset; 2556 DWORD Action; 2557 DWORD FileNameLength; 2558 WCHAR FileName[1]; 2559 } FILE_NOTIFY_INFORMATION,*PFILE_NOTIFY_INFORMATION; 2560 2561 typedef struct _TAPE_ERASE { 2562 DWORD Type; 2563 BOOLEAN Immediate; 2564 } TAPE_ERASE, *PTAPE_ERASE; 2565 2566 typedef struct _TAPE_GET_DRIVE_PARAMETERS { 2567 BOOLEAN ECC; 2568 BOOLEAN Compression; 2569 BOOLEAN DataPadding; 2570 BOOLEAN ReportSetmarks; 2571 DWORD DefaultBlockSize; 2572 DWORD MaximumBlockSize; 2573 DWORD MinimumBlockSize; 2574 DWORD MaximumPartitionCount; 2575 DWORD FeaturesLow; 2576 DWORD FeaturesHigh; 2577 DWORD EOTWarningZoneSize; 2578 } TAPE_GET_DRIVE_PARAMETERS, *PTAPE_GET_DRIVE_PARAMETERS; 2579 2580 typedef struct _TAPE_GET_MEDIA_PARAMETERS { 2581 LARGE_INTEGER Capacity; 2582 LARGE_INTEGER Remaining; 2583 DWORD BlockSize; 2584 DWORD PartitionCount; 2585 BOOLEAN WriteProtected; 2586 } TAPE_GET_MEDIA_PARAMETERS, *PTAPE_GET_MEDIA_PARAMETERS; 2587 2588 typedef struct _TAPE_GET_POSITION { 2589 DWORD Type; 2590 DWORD Partition; 2591 LARGE_INTEGER Offset; 2592 } TAPE_GET_POSITION, *PTAPE_GET_POSITION; 2593 2594 typedef struct _TAPE_PREPARE { 2595 DWORD Operation; 2596 BOOLEAN Immediate; 2597 } TAPE_PREPARE, *PTAPE_PREPARE; 2598 2599 typedef struct _TAPE_SET_DRIVE_PARAMETERS { 2600 BOOLEAN ECC; 2601 BOOLEAN Compression; 2602 BOOLEAN DataPadding; 2603 BOOLEAN ReportSetmarks; 2604 DWORD EOTWarningZoneSize; 2605 } TAPE_SET_DRIVE_PARAMETERS, *PTAPE_SET_DRIVE_PARAMETERS; 2606 2607 typedef struct _TAPE_SET_MEDIA_PARAMETERS { 2608 DWORD BlockSize; 2609 } TAPE_SET_MEDIA_PARAMETERS,*PTAPE_SET_MEDIA_PARAMETERS; 2610 2611 typedef struct _TAPE_SET_POSITION { 2612 DWORD Method; 2613 DWORD Partition; 2614 LARGE_INTEGER Offset; 2615 BOOLEAN Immediate; 2616 } TAPE_SET_POSITION, *PTAPE_SET_POSITION; 2617 2618 typedef struct _TAPE_WRITE_MARKS { 2619 DWORD Type; 2620 DWORD Count; 2621 BOOLEAN Immediate; 2622 } TAPE_WRITE_MARKS, *PTAPE_WRITE_MARKS; 2623 2624 typedef struct _TAPE_CREATE_PARTITION { 2625 DWORD Method; 2626 DWORD Count; 2627 DWORD Size; 2628 } TAPE_CREATE_PARTITION, *PTAPE_CREATE_PARTITION; 2629 2630 typedef struct _MEMORY_BASIC_INFORMATION { 2631 PVOID BaseAddress; 2632 PVOID AllocationBase; 2633 DWORD AllocationProtect; 2634 SIZE_T RegionSize; 2635 DWORD State; 2636 DWORD Protect; 2637 DWORD Type; 2638 } MEMORY_BASIC_INFORMATION, *PMEMORY_BASIC_INFORMATION; 2639 2640 typedef struct _MESSAGE_RESOURCE_ENTRY { 2641 WORD Length; 2642 WORD Flags; 2643 BYTE Text[1]; 2644 } MESSAGE_RESOURCE_ENTRY, *PMESSAGE_RESOURCE_ENTRY; 2645 2646 typedef struct _MESSAGE_RESOURCE_BLOCK { 2647 DWORD LowId; 2648 DWORD HighId; 2649 DWORD OffsetToEntries; 2650 } MESSAGE_RESOURCE_BLOCK, *PMESSAGE_RESOURCE_BLOCK; 2651 2652 typedef struct _MESSAGE_RESOURCE_DATA { 2653 DWORD NumberOfBlocks; 2654 MESSAGE_RESOURCE_BLOCK Blocks[1]; 2655 } MESSAGE_RESOURCE_DATA,*PMESSAGE_RESOURCE_DATA; 2656 2657 // 2658 // Slist Header 2659 // 2660 #ifndef _SLIST_HEADER_ 2661 #define _SLIST_HEADER_ 2662 2663 #if defined(_WIN64) 2664 2665 typedef struct DECLSPEC_ALIGN(16) _SLIST_ENTRY { 2666 struct _SLIST_ENTRY *Next; 2667 } SLIST_ENTRY, *PSLIST_ENTRY; 2668 2669 typedef struct _SLIST_ENTRY32 { 2670 DWORD Next; 2671 } SLIST_ENTRY32, *PSLIST_ENTRY32; 2672 2673 typedef union DECLSPEC_ALIGN(16) _SLIST_HEADER { 2674 _ANONYMOUS_STRUCT struct { 2675 ULONGLONG Alignment; 2676 ULONGLONG Region; 2677 } DUMMYSTRUCTNAME; 2678 struct { 2679 ULONGLONG Depth:16; 2680 ULONGLONG Sequence:9; 2681 ULONGLONG NextEntry:39; 2682 ULONGLONG HeaderType:1; 2683 ULONGLONG Init:1; 2684 ULONGLONG Reserved:59; 2685 ULONGLONG Region:3; 2686 } Header8; 2687 struct { 2688 ULONGLONG Depth:16; 2689 ULONGLONG Sequence:48; 2690 ULONGLONG HeaderType:1; 2691 ULONGLONG Init:1; 2692 ULONGLONG Reserved:2; 2693 ULONGLONG NextEntry:60; 2694 } Header16; 2695 struct { 2696 ULONGLONG Depth:16; 2697 ULONGLONG Sequence:48; 2698 ULONGLONG HeaderType:1; 2699 ULONGLONG Reserved:3; 2700 ULONGLONG NextEntry:60; 2701 } HeaderX64; 2702 } SLIST_HEADER, *PSLIST_HEADER; 2703 2704 typedef union _SLIST_HEADER32{ 2705 ULONGLONG Alignment; 2706 _ANONYMOUS_STRUCT struct { 2707 SLIST_ENTRY32 Next; 2708 WORD Depth; 2709 WORD Sequence; 2710 } DUMMYSTRUCTNAME; 2711 } SLIST_HEADER32, *PSLIST_HEADER32; 2712 2713 #else 2714 2715 #define SLIST_ENTRY SINGLE_LIST_ENTRY 2716 #define _SLIST_ENTRY _SINGLE_LIST_ENTRY 2717 #define PSLIST_ENTRY PSINGLE_LIST_ENTRY 2718 2719 typedef SLIST_ENTRY SLIST_ENTRY32, *PSLIST_ENTRY32; 2720 2721 typedef union _SLIST_HEADER { 2722 ULONGLONG Alignment; 2723 _ANONYMOUS_STRUCT struct { 2724 SLIST_ENTRY Next; 2725 WORD Depth; 2726 WORD Sequence; 2727 } DUMMYSTRUCTNAME; 2728 } SLIST_HEADER, *PSLIST_HEADER; 2729 2730 typedef SLIST_HEADER SLIST_HEADER32, *PSLIST_HEADER32; 2731 2732 #endif /* defined(_WIN64) */ 2733 2734 #endif /* _SLIST_HEADER_ */ 2735 2736 NTSYSAPI 2737 VOID 2738 NTAPI 2739 RtlInitializeSListHead( 2740 _Out_ PSLIST_HEADER ListHead); 2741 2742 _Must_inspect_result_ 2743 NTSYSAPI 2744 PSLIST_ENTRY 2745 NTAPI 2746 RtlFirstEntrySList( 2747 _In_ const SLIST_HEADER *ListHead); 2748 2749 NTSYSAPI 2750 PSLIST_ENTRY 2751 NTAPI 2752 RtlInterlockedPopEntrySList( 2753 _Inout_ PSLIST_HEADER ListHead); 2754 2755 NTSYSAPI 2756 PSLIST_ENTRY 2757 NTAPI 2758 RtlInterlockedPushEntrySList( 2759 _Inout_ PSLIST_HEADER ListHead, 2760 _Inout_ __drv_aliasesMem PSLIST_ENTRY ListEntry); 2761 2762 NTSYSAPI 2763 PSLIST_ENTRY 2764 NTAPI 2765 RtlInterlockedFlushSList( 2766 _Inout_ PSLIST_HEADER ListHead); 2767 2768 NTSYSAPI 2769 WORD 2770 NTAPI 2771 RtlQueryDepthSList( 2772 _In_ PSLIST_HEADER ListHead); 2773 2774 #ifndef _RTL_RUN_ONCE_DEF 2775 #define _RTL_RUN_ONCE_DEF 2776 2777 #define RTL_RUN_ONCE_CHECK_ONLY 0x00000001UL 2778 #define RTL_RUN_ONCE_ASYNC 0x00000002UL 2779 #define RTL_RUN_ONCE_INIT_FAILED 0x00000004UL 2780 2781 #define RTL_RUN_ONCE_INIT {0} 2782 2783 typedef union _RTL_RUN_ONCE { 2784 PVOID Ptr; 2785 } RTL_RUN_ONCE, *PRTL_RUN_ONCE; 2786 2787 typedef DWORD WINAPI RTL_RUN_ONCE_INIT_FN(PRTL_RUN_ONCE, PVOID, PVOID*); 2788 typedef RTL_RUN_ONCE_INIT_FN *PRTL_RUN_ONCE_INIT_FN; 2789 2790 NTSYSAPI 2791 DWORD 2792 WINAPI 2793 RtlRunOnceComplete( 2794 PRTL_RUN_ONCE, 2795 DWORD, 2796 PVOID); 2797 2798 #endif 2799 2800 #define RTL_CONDITION_VARIABLE_INIT {0} 2801 #define RTL_CONDITION_VARIABLE_LOCKMODE_SHARED 0x1 2802 2803 typedef struct _RTL_CONDITION_VARIABLE { 2804 PVOID Ptr; 2805 } RTL_CONDITION_VARIABLE, *PRTL_CONDITION_VARIABLE; 2806 2807 typedef struct _RTL_CRITICAL_SECTION_DEBUG { 2808 WORD Type; 2809 WORD CreatorBackTraceIndex; 2810 struct _RTL_CRITICAL_SECTION *CriticalSection; 2811 LIST_ENTRY ProcessLocksList; 2812 DWORD EntryCount; 2813 DWORD ContentionCount; 2814 DWORD Flags; 2815 WORD CreatorBackTraceIndexHigh; 2816 WORD SpareWORD; 2817 } RTL_CRITICAL_SECTION_DEBUG, *PRTL_CRITICAL_SECTION_DEBUG, RTL_RESOURCE_DEBUG, *PRTL_RESOURCE_DEBUG; 2818 2819 #include "pshpack8.h" 2820 typedef struct _RTL_CRITICAL_SECTION { 2821 PRTL_CRITICAL_SECTION_DEBUG DebugInfo; 2822 LONG LockCount; 2823 LONG RecursionCount; 2824 HANDLE OwningThread; 2825 HANDLE LockSemaphore; 2826 ULONG_PTR SpinCount; 2827 } RTL_CRITICAL_SECTION, *PRTL_CRITICAL_SECTION; 2828 #include "poppack.h" 2829 2830 NTSYSAPI 2831 WORD 2832 NTAPI 2833 RtlCaptureStackBackTrace( 2834 IN DWORD FramesToSkip, 2835 IN DWORD FramesToCapture, 2836 OUT PVOID *BackTrace, 2837 OUT PDWORD BackTraceHash OPTIONAL 2838 ); 2839 2840 NTSYSAPI 2841 VOID 2842 NTAPI 2843 RtlCaptureContext( 2844 _Out_ PCONTEXT ContextRecord 2845 ); 2846 2847 NTSYSAPI 2848 PVOID 2849 NTAPI 2850 RtlPcToFileHeader( 2851 _In_ PVOID PcValue, 2852 _Out_ PVOID* BaseOfImage); 2853 2854 NTSYSAPI 2855 VOID 2856 NTAPI 2857 RtlUnwind( 2858 _In_opt_ PVOID TargetFrame, 2859 _In_opt_ PVOID TargetIp, 2860 _In_opt_ PEXCEPTION_RECORD ExceptionRecord, 2861 _In_ PVOID ReturnValue); 2862 2863 #define RTL_SRWLOCK_INIT {0} 2864 2865 typedef struct _RTL_SRWLOCK { 2866 PVOID Ptr; 2867 } RTL_SRWLOCK, *PRTL_SRWLOCK; 2868 2869 typedef LONG 2870 (NTAPI *PVECTORED_EXCEPTION_HANDLER)( 2871 struct _EXCEPTION_POINTERS *ExceptionInfo 2872 ); 2873 2874 2875 #define EVENTLOG_SEQUENTIAL_READ 1 2876 #define EVENTLOG_SEEK_READ 2 2877 #define EVENTLOG_FORWARDS_READ 4 2878 #define EVENTLOG_BACKWARDS_READ 8 2879 2880 #define EVENTLOG_SUCCESS 0 2881 #define EVENTLOG_ERROR_TYPE 1 2882 #define EVENTLOG_WARNING_TYPE 2 2883 #define EVENTLOG_INFORMATION_TYPE 4 2884 #define EVENTLOG_AUDIT_SUCCESS 8 2885 #define EVENTLOG_AUDIT_FAILURE 16 2886 2887 typedef struct _EVENTLOGRECORD { 2888 DWORD Length; /* Length of full record, including the data portion */ 2889 DWORD Reserved; 2890 DWORD RecordNumber; 2891 DWORD TimeGenerated; 2892 DWORD TimeWritten; 2893 DWORD EventID; 2894 WORD EventType; 2895 WORD NumStrings; /* Number of strings in the 'Strings' array */ 2896 WORD EventCategory; 2897 WORD ReservedFlags; 2898 DWORD ClosingRecordNumber; 2899 DWORD StringOffset; 2900 DWORD UserSidLength; 2901 DWORD UserSidOffset; 2902 DWORD DataLength; /* Length of the data portion */ 2903 DWORD DataOffset; /* Offset from beginning of record */ 2904 /* 2905 * Length-varying data: 2906 * 2907 * WCHAR SourceName[]; 2908 * WCHAR ComputerName[]; 2909 * SID UserSid; // Must be aligned on a DWORD boundary 2910 * WCHAR Strings[]; 2911 * BYTE Data[]; 2912 * CHAR Pad[]; // Padding for DWORD boundary 2913 * DWORD Length; // Same as the first 'Length' member at the beginning 2914 */ 2915 } EVENTLOGRECORD, *PEVENTLOGRECORD; 2916 2917 2918 typedef struct _OSVERSIONINFOA { 2919 DWORD dwOSVersionInfoSize; 2920 DWORD dwMajorVersion; 2921 DWORD dwMinorVersion; 2922 DWORD dwBuildNumber; 2923 DWORD dwPlatformId; 2924 CHAR szCSDVersion[128]; 2925 } OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA; 2926 2927 typedef struct _OSVERSIONINFOW { 2928 DWORD dwOSVersionInfoSize; 2929 DWORD dwMajorVersion; 2930 DWORD dwMinorVersion; 2931 DWORD dwBuildNumber; 2932 DWORD dwPlatformId; 2933 WCHAR szCSDVersion[128]; 2934 } OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW; 2935 2936 typedef struct _OSVERSIONINFOEXA { 2937 DWORD dwOSVersionInfoSize; 2938 DWORD dwMajorVersion; 2939 DWORD dwMinorVersion; 2940 DWORD dwBuildNumber; 2941 DWORD dwPlatformId; 2942 CHAR szCSDVersion[128]; 2943 WORD wServicePackMajor; 2944 WORD wServicePackMinor; 2945 WORD wSuiteMask; 2946 BYTE wProductType; 2947 BYTE wReserved; 2948 } OSVERSIONINFOEXA, *POSVERSIONINFOEXA, *LPOSVERSIONINFOEXA; 2949 2950 typedef struct _OSVERSIONINFOEXW { 2951 DWORD dwOSVersionInfoSize; 2952 DWORD dwMajorVersion; 2953 DWORD dwMinorVersion; 2954 DWORD dwBuildNumber; 2955 DWORD dwPlatformId; 2956 WCHAR szCSDVersion[128]; 2957 WORD wServicePackMajor; 2958 WORD wServicePackMinor; 2959 WORD wSuiteMask; 2960 BYTE wProductType; 2961 BYTE wReserved; 2962 } OSVERSIONINFOEXW, *POSVERSIONINFOEXW, *LPOSVERSIONINFOEXW, RTL_OSVERSIONINFOEXW, *PRTL_OSVERSIONINFOEXW; 2963 2964 #include <pshpack2.h> 2965 2966 typedef struct _IMAGE_VXD_HEADER { 2967 WORD e32_magic; 2968 BYTE e32_border; 2969 BYTE e32_worder; 2970 DWORD e32_level; 2971 WORD e32_cpu; 2972 WORD e32_os; 2973 DWORD e32_ver; 2974 DWORD e32_mflags; 2975 DWORD e32_mpages; 2976 DWORD e32_startobj; 2977 DWORD e32_eip; 2978 DWORD e32_stackobj; 2979 DWORD e32_esp; 2980 DWORD e32_pagesize; 2981 DWORD e32_lastpagesize; 2982 DWORD e32_fixupsize; 2983 DWORD e32_fixupsum; 2984 DWORD e32_ldrsize; 2985 DWORD e32_ldrsum; 2986 DWORD e32_objtab; 2987 DWORD e32_objcnt; 2988 DWORD e32_objmap; 2989 DWORD e32_itermap; 2990 DWORD e32_rsrctab; 2991 DWORD e32_rsrccnt; 2992 DWORD e32_restab; 2993 DWORD e32_enttab; 2994 DWORD e32_dirtab; 2995 DWORD e32_dircnt; 2996 DWORD e32_fpagetab; 2997 DWORD e32_frectab; 2998 DWORD e32_impmod; 2999 DWORD e32_impmodcnt; 3000 DWORD e32_impproc; 3001 DWORD e32_pagesum; 3002 DWORD e32_datapage; 3003 DWORD e32_preload; 3004 DWORD e32_nrestab; 3005 DWORD e32_cbnrestab; 3006 DWORD e32_nressum; 3007 DWORD e32_autodata; 3008 DWORD e32_debuginfo; 3009 DWORD e32_debuglen; 3010 DWORD e32_instpreload; 3011 DWORD e32_instdemand; 3012 DWORD e32_heapsize; 3013 BYTE e32_res3[12]; 3014 DWORD e32_winresoff; 3015 DWORD e32_winreslen; 3016 WORD e32_devid; 3017 WORD e32_ddkver; 3018 } IMAGE_VXD_HEADER, *PIMAGE_VXD_HEADER; 3019 3020 typedef struct _IMAGE_DOS_HEADER { 3021 WORD e_magic; 3022 WORD e_cblp; 3023 WORD e_cp; 3024 WORD e_crlc; 3025 WORD e_cparhdr; 3026 WORD e_minalloc; 3027 WORD e_maxalloc; 3028 WORD e_ss; 3029 WORD e_sp; 3030 WORD e_csum; 3031 WORD e_ip; 3032 WORD e_cs; 3033 WORD e_lfarlc; 3034 WORD e_ovno; 3035 WORD e_res[4]; 3036 WORD e_oemid; 3037 WORD e_oeminfo; 3038 WORD e_res2[10]; 3039 LONG e_lfanew; 3040 } IMAGE_DOS_HEADER, *PIMAGE_DOS_HEADER; 3041 3042 typedef struct _IMAGE_OS2_HEADER { 3043 WORD ne_magic; 3044 CHAR ne_ver; 3045 CHAR ne_rev; 3046 WORD ne_enttab; 3047 WORD ne_cbenttab; 3048 LONG ne_crc; 3049 WORD ne_flags; 3050 WORD ne_autodata; 3051 WORD ne_heap; 3052 WORD ne_stack; 3053 LONG ne_csip; 3054 LONG ne_sssp; 3055 WORD ne_cseg; 3056 WORD ne_cmod; 3057 WORD ne_cbnrestab; 3058 WORD ne_segtab; 3059 WORD ne_rsrctab; 3060 WORD ne_restab; 3061 WORD ne_modtab; 3062 WORD ne_imptab; 3063 LONG ne_nrestab; 3064 WORD ne_cmovent; 3065 WORD ne_align; 3066 WORD ne_cres; 3067 BYTE ne_exetyp; 3068 BYTE ne_flagsothers; 3069 WORD ne_pretthunks; 3070 WORD ne_psegrefbytes; 3071 WORD ne_swaparea; 3072 WORD ne_expver; 3073 } IMAGE_OS2_HEADER, *PIMAGE_OS2_HEADER; 3074 3075 #include <poppack.h> 3076 3077 typedef struct _IMAGE_FILE_HEADER { 3078 WORD Machine; 3079 WORD NumberOfSections; 3080 DWORD TimeDateStamp; 3081 DWORD PointerToSymbolTable; 3082 DWORD NumberOfSymbols; 3083 WORD SizeOfOptionalHeader; 3084 WORD Characteristics; 3085 } IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER; 3086 3087 typedef struct _IMAGE_DATA_DIRECTORY { 3088 DWORD VirtualAddress; 3089 DWORD Size; 3090 } IMAGE_DATA_DIRECTORY, *PIMAGE_DATA_DIRECTORY; 3091 3092 typedef struct _IMAGE_OPTIONAL_HEADER32 { 3093 WORD Magic; 3094 BYTE MajorLinkerVersion; 3095 BYTE MinorLinkerVersion; 3096 DWORD SizeOfCode; 3097 DWORD SizeOfInitializedData; 3098 DWORD SizeOfUninitializedData; 3099 DWORD AddressOfEntryPoint; 3100 DWORD BaseOfCode; 3101 DWORD BaseOfData; 3102 DWORD ImageBase; 3103 DWORD SectionAlignment; 3104 DWORD FileAlignment; 3105 WORD MajorOperatingSystemVersion; 3106 WORD MinorOperatingSystemVersion; 3107 WORD MajorImageVersion; 3108 WORD MinorImageVersion; 3109 WORD MajorSubsystemVersion; 3110 WORD MinorSubsystemVersion; 3111 DWORD Win32VersionValue; 3112 DWORD SizeOfImage; 3113 DWORD SizeOfHeaders; 3114 DWORD CheckSum; 3115 WORD Subsystem; 3116 WORD DllCharacteristics; 3117 DWORD SizeOfStackReserve; 3118 DWORD SizeOfStackCommit; 3119 DWORD SizeOfHeapReserve; 3120 DWORD SizeOfHeapCommit; 3121 DWORD LoaderFlags; 3122 DWORD NumberOfRvaAndSizes; 3123 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; 3124 } IMAGE_OPTIONAL_HEADER32, *PIMAGE_OPTIONAL_HEADER32; 3125 3126 typedef struct _IMAGE_OPTIONAL_HEADER64 { 3127 WORD Magic; 3128 BYTE MajorLinkerVersion; 3129 BYTE MinorLinkerVersion; 3130 DWORD SizeOfCode; 3131 DWORD SizeOfInitializedData; 3132 DWORD SizeOfUninitializedData; 3133 DWORD AddressOfEntryPoint; 3134 DWORD BaseOfCode; 3135 ULONGLONG ImageBase; 3136 DWORD SectionAlignment; 3137 DWORD FileAlignment; 3138 WORD MajorOperatingSystemVersion; 3139 WORD MinorOperatingSystemVersion; 3140 WORD MajorImageVersion; 3141 WORD MinorImageVersion; 3142 WORD MajorSubsystemVersion; 3143 WORD MinorSubsystemVersion; 3144 DWORD Win32VersionValue; 3145 DWORD SizeOfImage; 3146 DWORD SizeOfHeaders; 3147 DWORD CheckSum; 3148 WORD Subsystem; 3149 WORD DllCharacteristics; 3150 ULONGLONG SizeOfStackReserve; 3151 ULONGLONG SizeOfStackCommit; 3152 ULONGLONG SizeOfHeapReserve; 3153 ULONGLONG SizeOfHeapCommit; 3154 DWORD LoaderFlags; 3155 DWORD NumberOfRvaAndSizes; 3156 IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES]; 3157 } IMAGE_OPTIONAL_HEADER64, *PIMAGE_OPTIONAL_HEADER64; 3158 3159 typedef struct _IMAGE_ROM_OPTIONAL_HEADER { 3160 WORD Magic; 3161 BYTE MajorLinkerVersion; 3162 BYTE MinorLinkerVersion; 3163 DWORD SizeOfCode; 3164 DWORD SizeOfInitializedData; 3165 DWORD SizeOfUninitializedData; 3166 DWORD AddressOfEntryPoint; 3167 DWORD BaseOfCode; 3168 DWORD BaseOfData; 3169 DWORD BaseOfBss; 3170 DWORD GprMask; 3171 DWORD CprMask[4]; 3172 DWORD GpValue; 3173 } IMAGE_ROM_OPTIONAL_HEADER, *PIMAGE_ROM_OPTIONAL_HEADER; 3174 3175 typedef struct _IMAGE_NT_HEADERS32 { 3176 DWORD Signature; 3177 IMAGE_FILE_HEADER FileHeader; 3178 IMAGE_OPTIONAL_HEADER32 OptionalHeader; 3179 } IMAGE_NT_HEADERS32, *PIMAGE_NT_HEADERS32; 3180 3181 typedef struct _IMAGE_NT_HEADERS64 { 3182 DWORD Signature; 3183 IMAGE_FILE_HEADER FileHeader; 3184 IMAGE_OPTIONAL_HEADER64 OptionalHeader; 3185 } IMAGE_NT_HEADERS64, *PIMAGE_NT_HEADERS64; 3186 3187 #ifdef _WIN64 3188 typedef IMAGE_OPTIONAL_HEADER64 IMAGE_OPTIONAL_HEADER; 3189 typedef PIMAGE_OPTIONAL_HEADER64 PIMAGE_OPTIONAL_HEADER; 3190 typedef IMAGE_NT_HEADERS64 IMAGE_NT_HEADERS; 3191 typedef PIMAGE_NT_HEADERS64 PIMAGE_NT_HEADERS; 3192 #else 3193 typedef IMAGE_OPTIONAL_HEADER32 IMAGE_OPTIONAL_HEADER; 3194 typedef PIMAGE_OPTIONAL_HEADER32 PIMAGE_OPTIONAL_HEADER; 3195 typedef IMAGE_NT_HEADERS32 IMAGE_NT_HEADERS; 3196 typedef PIMAGE_NT_HEADERS32 PIMAGE_NT_HEADERS; 3197 #endif 3198 3199 typedef struct _IMAGE_ROM_HEADERS { 3200 IMAGE_FILE_HEADER FileHeader; 3201 IMAGE_ROM_OPTIONAL_HEADER OptionalHeader; 3202 } IMAGE_ROM_HEADERS, *PIMAGE_ROM_HEADERS; 3203 3204 typedef struct _IMAGE_SECTION_HEADER { 3205 BYTE Name[IMAGE_SIZEOF_SHORT_NAME]; 3206 union { 3207 DWORD PhysicalAddress; 3208 DWORD VirtualSize; 3209 } Misc; 3210 DWORD VirtualAddress; 3211 DWORD SizeOfRawData; 3212 DWORD PointerToRawData; 3213 DWORD PointerToRelocations; 3214 DWORD PointerToLinenumbers; 3215 WORD NumberOfRelocations; 3216 WORD NumberOfLinenumbers; 3217 DWORD Characteristics; 3218 } IMAGE_SECTION_HEADER, *PIMAGE_SECTION_HEADER; 3219 3220 #include <pshpack2.h> 3221 3222 typedef struct _IMAGE_SYMBOL { 3223 union { 3224 BYTE ShortName[8]; 3225 struct { 3226 DWORD Short; 3227 DWORD Long; 3228 } Name; 3229 PBYTE LongName[2]; 3230 } N; 3231 DWORD Value; 3232 SHORT SectionNumber; 3233 WORD Type; 3234 BYTE StorageClass; 3235 BYTE NumberOfAuxSymbols; 3236 } IMAGE_SYMBOL, *PIMAGE_SYMBOL; 3237 3238 typedef struct _IMAGE_LINENUMBER { 3239 union { 3240 DWORD SymbolTableIndex; 3241 DWORD VirtualAddress; 3242 } Type; 3243 WORD Linenumber; 3244 } IMAGE_LINENUMBER, UNALIGNED *PIMAGE_LINENUMBER; 3245 3246 typedef struct IMAGE_AUX_SYMBOL_TOKEN_DEF { 3247 BYTE bAuxType; 3248 BYTE bReserved; 3249 DWORD SymbolTableIndex; 3250 BYTE rgbReserved[12]; 3251 } IMAGE_AUX_SYMBOL_TOKEN_DEF, UNALIGNED *PIMAGE_AUX_SYMBOL_TOKEN_DEF; 3252 3253 typedef union _IMAGE_AUX_SYMBOL { 3254 struct { 3255 DWORD TagIndex; 3256 union { 3257 struct { 3258 WORD Linenumber; 3259 WORD Size; 3260 } LnSz; 3261 DWORD TotalSize; 3262 } Misc; 3263 union { 3264 struct { 3265 DWORD PointerToLinenumber; 3266 DWORD PointerToNextFunction; 3267 } Function; 3268 struct { 3269 WORD Dimension[4]; 3270 } Array; 3271 } FcnAry; 3272 WORD TvIndex; 3273 } Sym; 3274 struct { 3275 BYTE Name[IMAGE_SIZEOF_SYMBOL]; 3276 } File; 3277 struct { 3278 DWORD Length; 3279 WORD NumberOfRelocations; 3280 WORD NumberOfLinenumbers; 3281 DWORD CheckSum; 3282 SHORT Number; 3283 BYTE Selection; 3284 BYTE bReserved; 3285 SHORT HighNumber; 3286 } Section; 3287 IMAGE_AUX_SYMBOL_TOKEN_DEF TokenDef; 3288 struct { 3289 DWORD crc; 3290 BYTE rgbReserved[14]; 3291 } CRC; 3292 } IMAGE_AUX_SYMBOL, *PIMAGE_AUX_SYMBOL; 3293 3294 typedef struct _IMAGE_RELOCATION { 3295 _ANONYMOUS_UNION union { 3296 DWORD VirtualAddress; 3297 DWORD RelocCount; 3298 } DUMMYUNIONNAME; 3299 DWORD SymbolTableIndex; 3300 WORD Type; 3301 } IMAGE_RELOCATION, UNALIGNED *PIMAGE_RELOCATION; 3302 3303 #include <poppack.h> 3304 3305 #ifndef __IMAGE_COR20_HEADER_DEFINED__ 3306 #define __IMAGE_COR20_HEADER_DEFINED__ 3307 3308 typedef enum ReplacesCorHdrNumericDefines { 3309 COMIMAGE_FLAGS_ILONLY = 0x00000001, 3310 COMIMAGE_FLAGS_32BITREQUIRED = 0x00000002, 3311 COMIMAGE_FLAGS_IL_LIBRARY = 0x00000004, 3312 COMIMAGE_FLAGS_STRONGNAMESIGNED = 0x00000008, 3313 COMIMAGE_FLAGS_NATIVE_ENTRYPOINT = 0x00000010, 3314 COMIMAGE_FLAGS_TRACKDEBUGDATA = 0x00010000, 3315 COMIMAGE_FLAGS_32BITPREFERRED = 0x00020000, 3316 COR_VERSION_MAJOR_V2 = 2, 3317 COR_VERSION_MAJOR = COR_VERSION_MAJOR_V2, 3318 COR_VERSION_MINOR = 0, 3319 COR_DELETED_NAME_LENGTH = 8, 3320 COR_VTABLEGAP_NAME_LENGTH = 8, 3321 NATIVE_TYPE_MAX_CB = 1, 3322 COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE = 0xFF, 3323 IMAGE_COR_MIH_METHODRVA = 0x01, 3324 IMAGE_COR_MIH_EHRVA = 0x02, 3325 IMAGE_COR_MIH_BASICBLOCK = 0x08, 3326 COR_VTABLE_32BIT = 0x01, 3327 COR_VTABLE_64BIT = 0x02, 3328 COR_VTABLE_FROM_UNMANAGED = 0x04, 3329 COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN = 0x08, 3330 COR_VTABLE_CALL_MOST_DERIVED = 0x10, 3331 IMAGE_COR_EATJ_THUNK_SIZE = 32, 3332 MAX_CLASS_NAME = 1024, 3333 MAX_PACKAGE_NAME = 1024 3334 } ReplacesCorHdrNumericDefines; 3335 3336 typedef struct IMAGE_COR20_HEADER { 3337 DWORD cb; 3338 WORD MajorRuntimeVersion; 3339 WORD MinorRuntimeVersion; 3340 IMAGE_DATA_DIRECTORY MetaData; 3341 DWORD Flags; 3342 _ANONYMOUS_UNION union { 3343 DWORD EntryPointToken; 3344 DWORD EntryPointRVA; 3345 } DUMMYUNIONNAME; 3346 IMAGE_DATA_DIRECTORY Resources; 3347 IMAGE_DATA_DIRECTORY StrongNameSignature; 3348 IMAGE_DATA_DIRECTORY CodeManagerTable; 3349 IMAGE_DATA_DIRECTORY VTableFixups; 3350 IMAGE_DATA_DIRECTORY ExportAddressTableJumps; 3351 IMAGE_DATA_DIRECTORY ManagedNativeHeader; 3352 } IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER; 3353 3354 #endif /* __IMAGE_COR20_HEADER_DEFINED__ */ 3355 3356 typedef struct _IMAGE_COFF_SYMBOLS_HEADER { 3357 DWORD NumberOfSymbols; 3358 DWORD LvaToFirstSymbol; 3359 DWORD NumberOfLinenumbers; 3360 DWORD LvaToFirstLinenumber; 3361 DWORD RvaToFirstByteOfCode; 3362 DWORD RvaToLastByteOfCode; 3363 DWORD RvaToFirstByteOfData; 3364 DWORD RvaToLastByteOfData; 3365 } IMAGE_COFF_SYMBOLS_HEADER, *PIMAGE_COFF_SYMBOLS_HEADER; 3366 3367 typedef struct _IMAGE_BASE_RELOCATION { 3368 DWORD VirtualAddress; 3369 DWORD SizeOfBlock; 3370 } IMAGE_BASE_RELOCATION, UNALIGNED *PIMAGE_BASE_RELOCATION; 3371 3372 typedef struct _IMAGE_ARCHIVE_MEMBER_HEADER { 3373 BYTE Name[16]; 3374 BYTE Date[12]; 3375 BYTE UserID[6]; 3376 BYTE GroupID[6]; 3377 BYTE Mode[8]; 3378 BYTE Size[10]; 3379 BYTE EndHeader[2]; 3380 } IMAGE_ARCHIVE_MEMBER_HEADER, *PIMAGE_ARCHIVE_MEMBER_HEADER; 3381 3382 typedef struct _IMAGE_EXPORT_DIRECTORY { 3383 DWORD Characteristics; 3384 DWORD TimeDateStamp; 3385 WORD MajorVersion; 3386 WORD MinorVersion; 3387 DWORD Name; 3388 DWORD Base; 3389 DWORD NumberOfFunctions; 3390 DWORD NumberOfNames; 3391 DWORD AddressOfFunctions; 3392 DWORD AddressOfNames; 3393 DWORD AddressOfNameOrdinals; 3394 } IMAGE_EXPORT_DIRECTORY, *PIMAGE_EXPORT_DIRECTORY; 3395 3396 typedef struct _IMAGE_IMPORT_BY_NAME { 3397 WORD Hint; 3398 BYTE Name[1]; 3399 } IMAGE_IMPORT_BY_NAME, *PIMAGE_IMPORT_BY_NAME; 3400 3401 #include <pshpack8.h> 3402 typedef struct _IMAGE_THUNK_DATA64 { 3403 union { 3404 ULONGLONG ForwarderString; 3405 ULONGLONG Function; 3406 ULONGLONG Ordinal; 3407 ULONGLONG AddressOfData; 3408 } u1; 3409 } IMAGE_THUNK_DATA64, *PIMAGE_THUNK_DATA64; 3410 #include <poppack.h> 3411 3412 typedef struct _IMAGE_THUNK_DATA32 { 3413 union { 3414 DWORD ForwarderString; 3415 DWORD Function; 3416 DWORD Ordinal; 3417 DWORD AddressOfData; 3418 } u1; 3419 } IMAGE_THUNK_DATA32, *PIMAGE_THUNK_DATA32; 3420 3421 #define IMAGE_ORDINAL_FLAG64 0x8000000000000000ULL 3422 #define IMAGE_ORDINAL_FLAG32 0x80000000 3423 #define IMAGE_ORDINAL64(Ordinal) (Ordinal & 0xffff) 3424 #define IMAGE_ORDINAL32(Ordinal) (Ordinal & 0xffff) 3425 #define IMAGE_SNAP_BY_ORDINAL64(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG64)!=0) 3426 #define IMAGE_SNAP_BY_ORDINAL32(Ordinal) ((Ordinal & IMAGE_ORDINAL_FLAG32)!=0) 3427 3428 typedef VOID 3429 (NTAPI *PIMAGE_TLS_CALLBACK)(PVOID DllHandle,DWORD Reason,PVOID Reserved); 3430 3431 typedef struct _IMAGE_TLS_DIRECTORY64 { 3432 ULONGLONG StartAddressOfRawData; 3433 ULONGLONG EndAddressOfRawData; 3434 ULONGLONG AddressOfIndex; 3435 ULONGLONG AddressOfCallBacks; 3436 DWORD SizeOfZeroFill; 3437 DWORD Characteristics; 3438 } IMAGE_TLS_DIRECTORY64, *PIMAGE_TLS_DIRECTORY64; 3439 3440 typedef struct _IMAGE_TLS_DIRECTORY32 { 3441 DWORD StartAddressOfRawData; 3442 DWORD EndAddressOfRawData; 3443 DWORD AddressOfIndex; 3444 DWORD AddressOfCallBacks; 3445 DWORD SizeOfZeroFill; 3446 DWORD Characteristics; 3447 } IMAGE_TLS_DIRECTORY32, *PIMAGE_TLS_DIRECTORY32; 3448 3449 #ifdef _WIN64 3450 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG64 3451 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL64(Ordinal) 3452 typedef IMAGE_THUNK_DATA64 IMAGE_THUNK_DATA; 3453 typedef PIMAGE_THUNK_DATA64 PIMAGE_THUNK_DATA; 3454 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL64(Ordinal) 3455 typedef IMAGE_TLS_DIRECTORY64 IMAGE_TLS_DIRECTORY; 3456 typedef PIMAGE_TLS_DIRECTORY64 PIMAGE_TLS_DIRECTORY; 3457 #else 3458 #define IMAGE_ORDINAL_FLAG IMAGE_ORDINAL_FLAG32 3459 #define IMAGE_ORDINAL(Ordinal) IMAGE_ORDINAL32(Ordinal) 3460 typedef IMAGE_THUNK_DATA32 IMAGE_THUNK_DATA; 3461 typedef PIMAGE_THUNK_DATA32 PIMAGE_THUNK_DATA; 3462 #define IMAGE_SNAP_BY_ORDINAL(Ordinal) IMAGE_SNAP_BY_ORDINAL32(Ordinal) 3463 typedef IMAGE_TLS_DIRECTORY32 IMAGE_TLS_DIRECTORY; 3464 typedef PIMAGE_TLS_DIRECTORY32 PIMAGE_TLS_DIRECTORY; 3465 #endif 3466 3467 typedef struct _IMAGE_IMPORT_DESCRIPTOR { 3468 _ANONYMOUS_UNION union { 3469 DWORD Characteristics; 3470 DWORD OriginalFirstThunk; 3471 } DUMMYUNIONNAME; 3472 DWORD TimeDateStamp; 3473 DWORD ForwarderChain; 3474 DWORD Name; 3475 DWORD FirstThunk; 3476 } IMAGE_IMPORT_DESCRIPTOR, UNALIGNED *PIMAGE_IMPORT_DESCRIPTOR; 3477 3478 typedef struct _IMAGE_BOUND_IMPORT_DESCRIPTOR { 3479 DWORD TimeDateStamp; 3480 WORD OffsetModuleName; 3481 WORD NumberOfModuleForwarderRefs; 3482 } IMAGE_BOUND_IMPORT_DESCRIPTOR, *PIMAGE_BOUND_IMPORT_DESCRIPTOR; 3483 3484 typedef struct _IMAGE_BOUND_FORWARDER_REF { 3485 DWORD TimeDateStamp; 3486 WORD OffsetModuleName; 3487 WORD Reserved; 3488 } IMAGE_BOUND_FORWARDER_REF, *PIMAGE_BOUND_FORWARDER_REF; 3489 3490 typedef struct _IMAGE_DELAYLOAD_DESCRIPTOR { 3491 union { 3492 DWORD AllAttributes; 3493 struct { 3494 DWORD RvaBased:1; 3495 DWORD ReservedAttributes:31; 3496 }; 3497 } Attributes; 3498 DWORD DllNameRVA; 3499 DWORD ModuleHandleRVA; 3500 DWORD ImportAddressTableRVA; 3501 DWORD ImportNameTableRVA; 3502 DWORD BoundImportAddressTableRVA; 3503 DWORD UnloadInformationTableRVA; 3504 DWORD TimeDateStamp; 3505 } IMAGE_DELAYLOAD_DESCRIPTOR, *PIMAGE_DELAYLOAD_DESCRIPTOR; 3506 3507 typedef const IMAGE_DELAYLOAD_DESCRIPTOR *PCIMAGE_DELAYLOAD_DESCRIPTOR; 3508 3509 typedef struct _IMAGE_RESOURCE_DIRECTORY { 3510 DWORD Characteristics; 3511 DWORD TimeDateStamp; 3512 WORD MajorVersion; 3513 WORD MinorVersion; 3514 WORD NumberOfNamedEntries; 3515 WORD NumberOfIdEntries; 3516 } IMAGE_RESOURCE_DIRECTORY, *PIMAGE_RESOURCE_DIRECTORY; 3517 3518 typedef struct _IMAGE_RESOURCE_DIRECTORY_ENTRY { 3519 _ANONYMOUS_UNION union { 3520 _ANONYMOUS_STRUCT struct { 3521 DWORD NameOffset:31; 3522 DWORD NameIsString:1; 3523 } DUMMYSTRUCTNAME; 3524 DWORD Name; 3525 WORD Id; 3526 } DUMMYUNIONNAME; 3527 _ANONYMOUS_UNION union { 3528 DWORD OffsetToData; 3529 _ANONYMOUS_STRUCT struct { 3530 DWORD OffsetToDirectory:31; 3531 DWORD DataIsDirectory:1; 3532 } DUMMYSTRUCTNAME2; 3533 } DUMMYUNIONNAME2; 3534 } IMAGE_RESOURCE_DIRECTORY_ENTRY, *PIMAGE_RESOURCE_DIRECTORY_ENTRY; 3535 3536 typedef struct _IMAGE_RESOURCE_DIRECTORY_STRING { 3537 WORD Length; 3538 CHAR NameString[1]; 3539 } IMAGE_RESOURCE_DIRECTORY_STRING, *PIMAGE_RESOURCE_DIRECTORY_STRING; 3540 3541 typedef struct _IMAGE_RESOURCE_DIR_STRING_U { 3542 WORD Length; 3543 WCHAR NameString[1]; 3544 } IMAGE_RESOURCE_DIR_STRING_U, *PIMAGE_RESOURCE_DIR_STRING_U; 3545 3546 typedef struct _IMAGE_RESOURCE_DATA_ENTRY { 3547 DWORD OffsetToData; 3548 DWORD Size; 3549 DWORD CodePage; 3550 DWORD Reserved; 3551 } IMAGE_RESOURCE_DATA_ENTRY, *PIMAGE_RESOURCE_DATA_ENTRY; 3552 3553 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY32 { 3554 DWORD Size; 3555 DWORD TimeDateStamp; 3556 WORD MajorVersion; 3557 WORD MinorVersion; 3558 DWORD GlobalFlagsClear; 3559 DWORD GlobalFlagsSet; 3560 DWORD CriticalSectionDefaultTimeout; 3561 DWORD DeCommitFreeBlockThreshold; 3562 DWORD DeCommitTotalFreeThreshold; 3563 DWORD LockPrefixTable; 3564 DWORD MaximumAllocationSize; 3565 DWORD VirtualMemoryThreshold; 3566 DWORD ProcessHeapFlags; 3567 DWORD ProcessAffinityMask; 3568 WORD CSDVersion; 3569 WORD Reserved1; 3570 DWORD EditList; 3571 DWORD SecurityCookie; 3572 DWORD SEHandlerTable; 3573 DWORD SEHandlerCount; 3574 } IMAGE_LOAD_CONFIG_DIRECTORY32, *PIMAGE_LOAD_CONFIG_DIRECTORY32; 3575 3576 typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY64 { 3577 DWORD Size; 3578 DWORD TimeDateStamp; 3579 WORD MajorVersion; 3580 WORD MinorVersion; 3581 DWORD GlobalFlagsClear; 3582 DWORD GlobalFlagsSet; 3583 DWORD CriticalSectionDefaultTimeout; 3584 ULONGLONG DeCommitFreeBlockThreshold; 3585 ULONGLONG DeCommitTotalFreeThreshold; 3586 ULONGLONG LockPrefixTable; 3587 ULONGLONG MaximumAllocationSize; 3588 ULONGLONG VirtualMemoryThreshold; 3589 ULONGLONG ProcessAffinityMask; 3590 DWORD ProcessHeapFlags; 3591 WORD CSDVersion; 3592 WORD Reserved1; 3593 ULONGLONG EditList; 3594 ULONGLONG SecurityCookie; 3595 ULONGLONG SEHandlerTable; 3596 ULONGLONG SEHandlerCount; 3597 } IMAGE_LOAD_CONFIG_DIRECTORY64, *PIMAGE_LOAD_CONFIG_DIRECTORY64; 3598 3599 #ifdef _WIN64 3600 typedef IMAGE_LOAD_CONFIG_DIRECTORY64 IMAGE_LOAD_CONFIG_DIRECTORY; 3601 typedef PIMAGE_LOAD_CONFIG_DIRECTORY64 PIMAGE_LOAD_CONFIG_DIRECTORY; 3602 #else 3603 typedef IMAGE_LOAD_CONFIG_DIRECTORY32 IMAGE_LOAD_CONFIG_DIRECTORY; 3604 typedef PIMAGE_LOAD_CONFIG_DIRECTORY32 PIMAGE_LOAD_CONFIG_DIRECTORY; 3605 #endif 3606 3607 typedef struct _IMAGE_RUNTIME_FUNCTION_ENTRY { 3608 DWORD BeginAddress; 3609 DWORD EndAddress; 3610 DWORD UnwindInfoAddress; 3611 } IMAGE_RUNTIME_FUNCTION_ENTRY, *PIMAGE_RUNTIME_FUNCTION_ENTRY; 3612 3613 typedef struct _IMAGE_DEBUG_DIRECTORY { 3614 DWORD Characteristics; 3615 DWORD TimeDateStamp; 3616 WORD MajorVersion; 3617 WORD MinorVersion; 3618 DWORD Type; 3619 DWORD SizeOfData; 3620 DWORD AddressOfRawData; 3621 DWORD PointerToRawData; 3622 } IMAGE_DEBUG_DIRECTORY, *PIMAGE_DEBUG_DIRECTORY; 3623 3624 typedef struct _FPO_DATA { 3625 DWORD ulOffStart; 3626 DWORD cbProcSize; 3627 DWORD cdwLocals; 3628 WORD cdwParams; 3629 WORD cbProlog:8; 3630 WORD cbRegs:3; 3631 WORD fHasSEH:1; 3632 WORD fUseBP:1; 3633 WORD reserved:1; 3634 WORD cbFrame:2; 3635 } FPO_DATA, *PFPO_DATA; 3636 3637 typedef struct _IMAGE_DEBUG_MISC { 3638 DWORD DataType; 3639 DWORD Length; 3640 BOOLEAN Unicode; 3641 BYTE Reserved[3]; 3642 BYTE Data[1]; 3643 } IMAGE_DEBUG_MISC, *PIMAGE_DEBUG_MISC; 3644 3645 typedef struct _IMAGE_FUNCTION_ENTRY { 3646 DWORD StartingAddress; 3647 DWORD EndingAddress; 3648 DWORD EndOfPrologue; 3649 } IMAGE_FUNCTION_ENTRY, *PIMAGE_FUNCTION_ENTRY; 3650 3651 typedef struct _IMAGE_SEPARATE_DEBUG_HEADER { 3652 WORD Signature; 3653 WORD Flags; 3654 WORD Machine; 3655 WORD Characteristics; 3656 DWORD TimeDateStamp; 3657 DWORD CheckSum; 3658 DWORD ImageBase; 3659 DWORD SizeOfImage; 3660 DWORD NumberOfSections; 3661 DWORD ExportedNamesSize; 3662 DWORD DebugDirectorySize; 3663 DWORD SectionAlignment; 3664 DWORD Reserved[2]; 3665 } IMAGE_SEPARATE_DEBUG_HEADER, *PIMAGE_SEPARATE_DEBUG_HEADER; 3666 3667 typedef enum _CM_SERVICE_NODE_TYPE { 3668 DriverType = SERVICE_KERNEL_DRIVER, 3669 FileSystemType = SERVICE_FILE_SYSTEM_DRIVER, 3670 Win32ServiceOwnProcess = SERVICE_WIN32_OWN_PROCESS, 3671 Win32ServiceShareProcess = SERVICE_WIN32_SHARE_PROCESS, 3672 AdapterType = SERVICE_ADAPTER, 3673 RecognizerType = SERVICE_RECOGNIZER_DRIVER 3674 } SERVICE_NODE_TYPE; 3675 3676 typedef enum _CM_SERVICE_LOAD_TYPE { 3677 BootLoad = SERVICE_BOOT_START, 3678 SystemLoad = SERVICE_SYSTEM_START, 3679 AutoLoad = SERVICE_AUTO_START, 3680 DemandLoad = SERVICE_DEMAND_START, 3681 DisableLoad = SERVICE_DISABLED 3682 } SERVICE_LOAD_TYPE; 3683 3684 typedef enum _CM_ERROR_CONTROL_TYPE { 3685 IgnoreError = SERVICE_ERROR_IGNORE, 3686 NormalError = SERVICE_ERROR_NORMAL, 3687 SevereError = SERVICE_ERROR_SEVERE, 3688 CriticalError = SERVICE_ERROR_CRITICAL 3689 } SERVICE_ERROR_TYPE; 3690 3691 typedef struct _NT_TIB { 3692 struct _EXCEPTION_REGISTRATION_RECORD *ExceptionList; 3693 PVOID StackBase; 3694 PVOID StackLimit; 3695 PVOID SubSystemTib; 3696 _ANONYMOUS_UNION union { 3697 PVOID FiberData; 3698 DWORD Version; 3699 } DUMMYUNIONNAME; 3700 PVOID ArbitraryUserPointer; 3701 struct _NT_TIB *Self; 3702 } NT_TIB,*PNT_TIB; 3703 3704 typedef struct _NT_TIB32 { 3705 DWORD ExceptionList; 3706 DWORD StackBase; 3707 DWORD StackLimit; 3708 DWORD SubSystemTib; 3709 _ANONYMOUS_UNION union { 3710 DWORD FiberData; 3711 DWORD Version; 3712 } DUMMYUNIONNAME; 3713 DWORD ArbitraryUserPointer; 3714 DWORD Self; 3715 } NT_TIB32,*PNT_TIB32; 3716 3717 typedef struct _NT_TIB64 { 3718 DWORD64 ExceptionList; 3719 DWORD64 StackBase; 3720 DWORD64 StackLimit; 3721 DWORD64 SubSystemTib; 3722 _ANONYMOUS_UNION union { 3723 DWORD64 FiberData; 3724 DWORD Version; 3725 } DUMMYUNIONNAME; 3726 DWORD64 ArbitraryUserPointer; 3727 DWORD64 Self; 3728 } NT_TIB64,*PNT_TIB64; 3729 3730 typedef struct _REPARSE_GUID_DATA_BUFFER { 3731 DWORD ReparseTag; 3732 WORD ReparseDataLength; 3733 WORD Reserved; 3734 GUID ReparseGuid; 3735 struct { 3736 BYTE DataBuffer[1]; 3737 } GenericReparseBuffer; 3738 } REPARSE_GUID_DATA_BUFFER, *PREPARSE_GUID_DATA_BUFFER; 3739 3740 typedef struct _REPARSE_POINT_INFORMATION { 3741 WORD ReparseDataLength; 3742 WORD UnparsedNameLength; 3743 } REPARSE_POINT_INFORMATION, *PREPARSE_POINT_INFORMATION; 3744 3745 typedef union _FILE_SEGMENT_ELEMENT { 3746 PVOID64 Buffer; 3747 ULONGLONG Alignment; 3748 } FILE_SEGMENT_ELEMENT, *PFILE_SEGMENT_ELEMENT; 3749 3750 /* JOBOBJECT_BASIC_LIMIT_INFORMATION.LimitFlags constants */ 3751 #define JOB_OBJECT_LIMIT_WORKINGSET 0x0001 3752 #define JOB_OBJECT_LIMIT_PROCESS_TIME 0x0002 3753 #define JOB_OBJECT_LIMIT_JOB_TIME 0x0004 3754 #define JOB_OBJECT_LIMIT_ACTIVE_PROCESS 0x0008 3755 #define JOB_OBJECT_LIMIT_AFFINITY 0x0010 3756 #define JOB_OBJECT_LIMIT_PRIORITY_CLASS 0x0020 3757 #define JOB_OBJECT_LIMIT_PRESERVE_JOB_TIME 0x0040 3758 #define JOB_OBJECT_LIMIT_SCHEDULING_CLASS 0x0080 3759 #define JOB_OBJECT_LIMIT_PROCESS_MEMORY 0x0100 3760 #define JOB_OBJECT_LIMIT_JOB_MEMORY 0x0200 3761 #define JOB_OBJECT_LIMIT_DIE_ON_UNHANDLED_EXCEPTION 0x0400 3762 #define JOB_OBJECT_LIMIT_BREAKAWAY_OK 0x0800 3763 #define JOB_OBJECT_LIMIT_SILENT_BREAKAWAY_OK 0x1000 3764 #define JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE 0x2000 3765 3766 /* JOBOBJECT_BASIC_UI_RESTRICTIONS.UIRestrictionsClass constants */ 3767 #define JOB_OBJECT_UILIMIT_HANDLES 0x0001 3768 #define JOB_OBJECT_UILIMIT_READCLIPBOARD 0x0002 3769 #define JOB_OBJECT_UILIMIT_WRITECLIPBOARD 0x0004 3770 #define JOB_OBJECT_UILIMIT_SYSTEMPARAMETERS 0x0008 3771 #define JOB_OBJECT_UILIMIT_DISPLAYSETTINGS 0x0010 3772 #define JOB_OBJECT_UILIMIT_GLOBALATOMS 0x0020 3773 #define JOB_OBJECT_UILIMIT_DESKTOP 0x0040 3774 #define JOB_OBJECT_UILIMIT_EXITWINDOWS 0x0080 3775 3776 /* JOBOBJECT_SECURITY_LIMIT_INFORMATION.SecurityLimitFlags constants */ 3777 #define JOB_OBJECT_SECURITY_NO_ADMIN 0x0001 3778 #define JOB_OBJECT_SECURITY_RESTRICTED_TOKEN 0x0002 3779 #define JOB_OBJECT_SECURITY_ONLY_TOKEN 0x0004 3780 #define JOB_OBJECT_SECURITY_FILTER_TOKENS 0x0008 3781 3782 /* JOBOBJECT_END_OF_JOB_TIME_INFORMATION.EndOfJobTimeAction constants */ 3783 #define JOB_OBJECT_TERMINATE_AT_END_OF_JOB 0 3784 #define JOB_OBJECT_POST_AT_END_OF_JOB 1 3785 3786 #define JOB_OBJECT_MSG_END_OF_JOB_TIME 1 3787 #define JOB_OBJECT_MSG_END_OF_PROCESS_TIME 2 3788 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_LIMIT 3 3789 #define JOB_OBJECT_MSG_ACTIVE_PROCESS_ZERO 4 3790 #define JOB_OBJECT_MSG_NEW_PROCESS 6 3791 #define JOB_OBJECT_MSG_EXIT_PROCESS 7 3792 #define JOB_OBJECT_MSG_ABNORMAL_EXIT_PROCESS 8 3793 #define JOB_OBJECT_MSG_PROCESS_MEMORY_LIMIT 9 3794 #define JOB_OBJECT_MSG_JOB_MEMORY_LIMIT 10 3795 3796 #define JOB_OBJECT_ASSIGN_PROCESS 1 3797 #define JOB_OBJECT_SET_ATTRIBUTES 2 3798 #define JOB_OBJECT_QUERY 4 3799 #define JOB_OBJECT_TERMINATE 8 3800 #define JOB_OBJECT_SET_SECURITY_ATTRIBUTES 16 3801 #define JOB_OBJECT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|31) 3802 3803 typedef enum _JOBOBJECTINFOCLASS { 3804 JobObjectBasicAccountingInformation = 1, 3805 JobObjectBasicLimitInformation, 3806 JobObjectBasicProcessIdList, 3807 JobObjectBasicUIRestrictions, 3808 JobObjectSecurityLimitInformation, 3809 JobObjectEndOfJobTimeInformation, 3810 JobObjectAssociateCompletionPortInformation, 3811 JobObjectBasicAndIoAccountingInformation, 3812 JobObjectExtendedLimitInformation, 3813 JobObjectJobSetInformation, 3814 JobObjectGroupInformation, 3815 MaxJobObjectInfoClass 3816 } JOBOBJECTINFOCLASS; 3817 3818 typedef struct _JOB_SET_ARRAY { 3819 HANDLE JobHandle; 3820 DWORD MemberLevel; 3821 DWORD Flags; 3822 } JOB_SET_ARRAY, *PJOB_SET_ARRAY; 3823 3824 typedef struct _JOBOBJECT_BASIC_ACCOUNTING_INFORMATION { 3825 LARGE_INTEGER TotalUserTime; 3826 LARGE_INTEGER TotalKernelTime; 3827 LARGE_INTEGER ThisPeriodTotalUserTime; 3828 LARGE_INTEGER ThisPeriodTotalKernelTime; 3829 DWORD TotalPageFaultCount; 3830 DWORD TotalProcesses; 3831 DWORD ActiveProcesses; 3832 DWORD TotalTerminatedProcesses; 3833 } JOBOBJECT_BASIC_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_ACCOUNTING_INFORMATION; 3834 3835 typedef struct _JOBOBJECT_BASIC_LIMIT_INFORMATION { 3836 LARGE_INTEGER PerProcessUserTimeLimit; 3837 LARGE_INTEGER PerJobUserTimeLimit; 3838 DWORD LimitFlags; 3839 SIZE_T MinimumWorkingSetSize; 3840 SIZE_T MaximumWorkingSetSize; 3841 DWORD ActiveProcessLimit; 3842 ULONG_PTR Affinity; 3843 DWORD PriorityClass; 3844 DWORD SchedulingClass; 3845 } JOBOBJECT_BASIC_LIMIT_INFORMATION,*PJOBOBJECT_BASIC_LIMIT_INFORMATION; 3846 3847 typedef struct _JOBOBJECT_BASIC_PROCESS_ID_LIST { 3848 DWORD NumberOfAssignedProcesses; 3849 DWORD NumberOfProcessIdsInList; 3850 ULONG_PTR ProcessIdList[1]; 3851 } JOBOBJECT_BASIC_PROCESS_ID_LIST, *PJOBOBJECT_BASIC_PROCESS_ID_LIST; 3852 3853 typedef struct _JOBOBJECT_BASIC_UI_RESTRICTIONS { 3854 DWORD UIRestrictionsClass; 3855 } JOBOBJECT_BASIC_UI_RESTRICTIONS,*PJOBOBJECT_BASIC_UI_RESTRICTIONS; 3856 3857 typedef struct _JOBOBJECT_SECURITY_LIMIT_INFORMATION { 3858 DWORD SecurityLimitFlags; 3859 HANDLE JobToken; 3860 PTOKEN_GROUPS SidsToDisable; 3861 PTOKEN_PRIVILEGES PrivilegesToDelete; 3862 PTOKEN_GROUPS RestrictedSids; 3863 } JOBOBJECT_SECURITY_LIMIT_INFORMATION,*PJOBOBJECT_SECURITY_LIMIT_INFORMATION; 3864 3865 typedef struct _JOBOBJECT_END_OF_JOB_TIME_INFORMATION { 3866 DWORD EndOfJobTimeAction; 3867 } JOBOBJECT_END_OF_JOB_TIME_INFORMATION,*PJOBOBJECT_END_OF_JOB_TIME_INFORMATION; 3868 3869 typedef struct _JOBOBJECT_ASSOCIATE_COMPLETION_PORT { 3870 PVOID CompletionKey; 3871 HANDLE CompletionPort; 3872 } JOBOBJECT_ASSOCIATE_COMPLETION_PORT,*PJOBOBJECT_ASSOCIATE_COMPLETION_PORT; 3873 3874 typedef struct _JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION { 3875 JOBOBJECT_BASIC_ACCOUNTING_INFORMATION BasicInfo; 3876 IO_COUNTERS IoInfo; 3877 } JOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION,*PJOBOBJECT_BASIC_AND_IO_ACCOUNTING_INFORMATION; 3878 3879 typedef struct _JOBOBJECT_EXTENDED_LIMIT_INFORMATION { 3880 JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; 3881 IO_COUNTERS IoInfo; 3882 SIZE_T ProcessMemoryLimit; 3883 SIZE_T JobMemoryLimit; 3884 SIZE_T PeakProcessMemoryUsed; 3885 SIZE_T PeakJobMemoryUsed; 3886 } JOBOBJECT_EXTENDED_LIMIT_INFORMATION,*PJOBOBJECT_EXTENDED_LIMIT_INFORMATION; 3887 3888 typedef struct _JOBOBJECT_JOBSET_INFORMATION { 3889 DWORD MemberLevel; 3890 } JOBOBJECT_JOBSET_INFORMATION,*PJOBOBJECT_JOBSET_INFORMATION; 3891 3892 /* Fixme: Making these defines conditional on WINVER will break ddk includes */ 3893 #if 1 /* (WINVER >= 0x0500) */ 3894 3895 #define ES_SYSTEM_REQUIRED 0x00000001 3896 #define ES_DISPLAY_REQUIRED 0x00000002 3897 #define ES_USER_PRESENT 0x00000004 3898 #define ES_CONTINUOUS 0x80000000 3899 3900 typedef enum _LATENCY_TIME { 3901 LT_DONT_CARE, 3902 LT_LOWEST_LATENCY 3903 } LATENCY_TIME, *PLATENCY_TIME; 3904 3905 typedef enum _SYSTEM_POWER_STATE { 3906 PowerSystemUnspecified = 0, 3907 PowerSystemWorking, 3908 PowerSystemSleeping1, 3909 PowerSystemSleeping2, 3910 PowerSystemSleeping3, 3911 PowerSystemHibernate, 3912 PowerSystemShutdown, 3913 PowerSystemMaximum 3914 } SYSTEM_POWER_STATE, *PSYSTEM_POWER_STATE; 3915 3916 #define POWER_SYSTEM_MAXIMUM PowerSystemMaximum 3917 3918 typedef enum { 3919 PowerActionNone = 0, 3920 PowerActionReserved, 3921 PowerActionSleep, 3922 PowerActionHibernate, 3923 PowerActionShutdown, 3924 PowerActionShutdownReset, 3925 PowerActionShutdownOff, 3926 PowerActionWarmEject 3927 } POWER_ACTION, *PPOWER_ACTION; 3928 3929 typedef enum _DEVICE_POWER_STATE { 3930 PowerDeviceUnspecified = 0, 3931 PowerDeviceD0, 3932 PowerDeviceD1, 3933 PowerDeviceD2, 3934 PowerDeviceD3, 3935 PowerDeviceMaximum 3936 } DEVICE_POWER_STATE, *PDEVICE_POWER_STATE; 3937 3938 #if (NTDDI_VERSION >= NTDDI_WINXP) || !defined(_BATCLASS_) 3939 typedef struct { 3940 DWORD Granularity; 3941 DWORD Capacity; 3942 } BATTERY_REPORTING_SCALE, *PBATTERY_REPORTING_SCALE; 3943 #endif 3944 3945 typedef struct _POWER_ACTION_POLICY { 3946 POWER_ACTION Action; 3947 DWORD Flags; 3948 DWORD EventCode; 3949 } POWER_ACTION_POLICY, *PPOWER_ACTION_POLICY; 3950 3951 /* POWER_ACTION_POLICY.Flags constants */ 3952 #define POWER_ACTION_QUERY_ALLOWED 0x00000001 3953 #define POWER_ACTION_UI_ALLOWED 0x00000002 3954 #define POWER_ACTION_OVERRIDE_APPS 0x00000004 3955 #define POWER_ACTION_LIGHTEST_FIRST 0x10000000 3956 #define POWER_ACTION_LOCK_CONSOLE 0x20000000 3957 #define POWER_ACTION_DISABLE_WAKES 0x40000000 3958 #define POWER_ACTION_CRITICAL 0x80000000 3959 3960 /* POWER_ACTION_POLICY.EventCode constants */ 3961 #define POWER_LEVEL_USER_NOTIFY_TEXT 0x00000001 3962 #define POWER_LEVEL_USER_NOTIFY_SOUND 0x00000002 3963 #define POWER_LEVEL_USER_NOTIFY_EXEC 0x00000004 3964 #define POWER_USER_NOTIFY_BUTTON 0x00000008 3965 #define POWER_USER_NOTIFY_SHUTDOWN 0x00000010 3966 #define POWER_FORCE_TRIGGER_RESET 0x80000000 3967 3968 #define DISCHARGE_POLICY_CRITICAL 0 3969 #define DISCHARGE_POLICY_LOW 1 3970 #define NUM_DISCHARGE_POLICIES 4 3971 3972 #define PO_THROTTLE_NONE 0 3973 #define PO_THROTTLE_CONSTANT 1 3974 #define PO_THROTTLE_DEGRADE 2 3975 #define PO_THROTTLE_ADAPTIVE 3 3976 #define PO_THROTTLE_MAXIMUM 4 3977 3978 typedef struct _SYSTEM_POWER_LEVEL { 3979 BOOLEAN Enable; 3980 BYTE Spare[3]; 3981 DWORD BatteryLevel; 3982 POWER_ACTION_POLICY PowerPolicy; 3983 SYSTEM_POWER_STATE MinSystemState; 3984 } SYSTEM_POWER_LEVEL, *PSYSTEM_POWER_LEVEL; 3985 3986 typedef struct _SYSTEM_POWER_POLICY { 3987 DWORD Revision; 3988 POWER_ACTION_POLICY PowerButton; 3989 POWER_ACTION_POLICY SleepButton; 3990 POWER_ACTION_POLICY LidClose; 3991 SYSTEM_POWER_STATE LidOpenWake; 3992 DWORD Reserved; 3993 POWER_ACTION_POLICY Idle; 3994 DWORD IdleTimeout; 3995 BYTE IdleSensitivity; 3996 BYTE DynamicThrottle; 3997 BYTE Spare2[2]; 3998 SYSTEM_POWER_STATE MinSleep; 3999 SYSTEM_POWER_STATE MaxSleep; 4000 SYSTEM_POWER_STATE ReducedLatencySleep; 4001 DWORD WinLogonFlags; 4002 DWORD Spare3; 4003 DWORD DozeS4Timeout; 4004 DWORD BroadcastCapacityResolution; 4005 SYSTEM_POWER_LEVEL DischargePolicy[NUM_DISCHARGE_POLICIES]; 4006 DWORD VideoTimeout; 4007 BOOLEAN VideoDimDisplay; 4008 DWORD VideoReserved[3]; 4009 DWORD SpindownTimeout; 4010 BOOLEAN OptimizeForPower; 4011 BYTE FanThrottleTolerance; 4012 BYTE ForcedThrottle; 4013 BYTE MinThrottle; 4014 POWER_ACTION_POLICY OverThrottled; 4015 } SYSTEM_POWER_POLICY, *PSYSTEM_POWER_POLICY; 4016 4017 typedef struct _SYSTEM_POWER_CAPABILITIES { 4018 BOOLEAN PowerButtonPresent; 4019 BOOLEAN SleepButtonPresent; 4020 BOOLEAN LidPresent; 4021 BOOLEAN SystemS1; 4022 BOOLEAN SystemS2; 4023 BOOLEAN SystemS3; 4024 BOOLEAN SystemS4; 4025 BOOLEAN SystemS5; 4026 BOOLEAN HiberFilePresent; 4027 BOOLEAN FullWake; 4028 BOOLEAN VideoDimPresent; 4029 BOOLEAN ApmPresent; 4030 BOOLEAN UpsPresent; 4031 BOOLEAN ThermalControl; 4032 BOOLEAN ProcessorThrottle; 4033 BYTE ProcessorMinThrottle; 4034 #if (NTDDI_VERSION < NTDDI_WINXP) 4035 BYTE ProcessorThrottleScale; 4036 BYTE spare2[4]; 4037 #else 4038 BYTE ProcessorMaxThrottle; 4039 BOOLEAN FastSystemS4; 4040 BYTE spare2[3]; 4041 #endif /* (NTDDI_VERSION < NTDDI_WINXP) */ 4042 BOOLEAN DiskSpinDown; 4043 BYTE spare3[8]; 4044 BOOLEAN SystemBatteriesPresent; 4045 BOOLEAN BatteriesAreShortTerm; 4046 BATTERY_REPORTING_SCALE BatteryScale[3]; 4047 SYSTEM_POWER_STATE AcOnLineWake; 4048 SYSTEM_POWER_STATE SoftLidWake; 4049 SYSTEM_POWER_STATE RtcWake; 4050 SYSTEM_POWER_STATE MinDeviceWakeState; 4051 SYSTEM_POWER_STATE DefaultLowLatencyWake; 4052 } SYSTEM_POWER_CAPABILITIES, *PSYSTEM_POWER_CAPABILITIES; 4053 4054 typedef struct _SYSTEM_BATTERY_STATE { 4055 BOOLEAN AcOnLine; 4056 BOOLEAN BatteryPresent; 4057 BOOLEAN Charging; 4058 BOOLEAN Discharging; 4059 BOOLEAN Spare1[4]; 4060 DWORD MaxCapacity; 4061 DWORD RemainingCapacity; 4062 DWORD Rate; 4063 DWORD EstimatedTime; 4064 DWORD DefaultAlert1; 4065 DWORD DefaultAlert2; 4066 } SYSTEM_BATTERY_STATE, *PSYSTEM_BATTERY_STATE; 4067 4068 // FIXME: This should not be here! 4069 typedef struct _PROCESSOR_POWER_INFORMATION { 4070 ULONG Number; 4071 ULONG MaxMhz; 4072 ULONG CurrentMhz; 4073 ULONG MhzLimit; 4074 ULONG MaxIdleState; 4075 ULONG CurrentIdleState; 4076 } PROCESSOR_POWER_INFORMATION, *PPROCESSOR_POWER_INFORMATION; 4077 4078 typedef DWORD EXECUTION_STATE, *PEXECUTION_STATE; 4079 4080 typedef enum _POWER_INFORMATION_LEVEL { 4081 SystemPowerPolicyAc, 4082 SystemPowerPolicyDc, 4083 VerifySystemPolicyAc, 4084 VerifySystemPolicyDc, 4085 SystemPowerCapabilities, 4086 SystemBatteryState, 4087 SystemPowerStateHandler, 4088 ProcessorStateHandler, 4089 SystemPowerPolicyCurrent, 4090 AdministratorPowerPolicy, 4091 SystemReserveHiberFile, 4092 ProcessorInformation, 4093 SystemPowerInformation, 4094 ProcessorStateHandler2, 4095 LastWakeTime, 4096 LastSleepTime, 4097 SystemExecutionState, 4098 SystemPowerStateNotifyHandler, 4099 ProcessorPowerPolicyAc, 4100 ProcessorPowerPolicyDc, 4101 VerifyProcessorPowerPolicyAc, 4102 VerifyProcessorPowerPolicyDc, 4103 ProcessorPowerPolicyCurrent, 4104 SystemPowerStateLogging, 4105 SystemPowerLoggingEntry, 4106 SetPowerSettingValue, 4107 NotifyUserPowerSetting, 4108 PowerInformationLevelUnused0, 4109 PowerInformationLevelUnused1, 4110 SystemVideoState, 4111 TraceApplicationPowerMessage, 4112 TraceApplicationPowerMessageEnd, 4113 ProcessorPerfStates, 4114 ProcessorIdleStates, 4115 ProcessorCap, 4116 SystemWakeSource, 4117 SystemHiberFileInformation, 4118 TraceServicePowerMessage, 4119 ProcessorLoad, 4120 PowerShutdownNotification, 4121 MonitorCapabilities, 4122 SessionPowerInit, 4123 SessionDisplayState, 4124 PowerRequestCreate, 4125 PowerRequestAction, 4126 GetPowerRequestList, 4127 ProcessorInformationEx, 4128 NotifyUserModeLegacyPowerEvent, 4129 GroupPark, 4130 ProcessorIdleDomains, 4131 WakeTimerList, 4132 SystemHiberFileSize, 4133 PowerInformationLevelMaximum 4134 } POWER_INFORMATION_LEVEL; 4135 4136 #if (_WIN32_WINNT >= 0x0501) 4137 4138 typedef enum _ACTIVATION_CONTEXT_INFO_CLASS { 4139 ActivationContextBasicInformation = 1, 4140 ActivationContextDetailedInformation = 2, 4141 AssemblyDetailedInformationInActivationContext = 3, 4142 FileInformationInAssemblyOfAssemblyInActivationContext = 4, 4143 RunlevelInformationInActivationContext = 5, 4144 CompatibilityInformationInActivationContext = 6, 4145 ActivationContextManifestResourceName = 7, 4146 MaxActivationContextInfoClass, 4147 /* For compatibility with the old names */ 4148 AssemblyDetailedInformationInActivationContxt = 3, 4149 FileInformationInAssemblyOfAssemblyInActivationContxt = 4 4150 } ACTIVATION_CONTEXT_INFO_CLASS; 4151 4152 typedef struct _ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION { 4153 DWORD ulFlags; 4154 DWORD ulEncodedAssemblyIdentityLength; 4155 DWORD ulManifestPathType; 4156 DWORD ulManifestPathLength; 4157 LARGE_INTEGER liManifestLastWriteTime; 4158 DWORD ulPolicyPathType; 4159 DWORD ulPolicyPathLength; 4160 LARGE_INTEGER liPolicyLastWriteTime; 4161 DWORD ulMetadataSatelliteRosterIndex; 4162 DWORD ulManifestVersionMajor; 4163 DWORD ulManifestVersionMinor; 4164 DWORD ulPolicyVersionMajor; 4165 DWORD ulPolicyVersionMinor; 4166 DWORD ulAssemblyDirectoryNameLength; 4167 PCWSTR lpAssemblyEncodedAssemblyIdentity; 4168 PCWSTR lpAssemblyManifestPath; 4169 PCWSTR lpAssemblyPolicyPath; 4170 PCWSTR lpAssemblyDirectoryName; 4171 DWORD ulFileCount; 4172 } ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; 4173 typedef const ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION; 4174 4175 typedef struct _ACTIVATION_CONTEXT_DETAILED_INFORMATION { 4176 DWORD dwFlags; 4177 DWORD ulFormatVersion; 4178 DWORD ulAssemblyCount; 4179 DWORD ulRootManifestPathType; 4180 DWORD ulRootManifestPathChars; 4181 DWORD ulRootConfigurationPathType; 4182 DWORD ulRootConfigurationPathChars; 4183 DWORD ulAppDirPathType; 4184 DWORD ulAppDirPathChars; 4185 PCWSTR lpRootManifestPath; 4186 PCWSTR lpRootConfigurationPath; 4187 PCWSTR lpAppDirPath; 4188 } ACTIVATION_CONTEXT_DETAILED_INFORMATION, *PACTIVATION_CONTEXT_DETAILED_INFORMATION; 4189 typedef const ACTIVATION_CONTEXT_DETAILED_INFORMATION *PCACTIVATION_CONTEXT_DETAILED_INFORMATION; 4190 4191 typedef struct _ACTIVATION_CONTEXT_QUERY_INDEX { 4192 DWORD ulAssemblyIndex; 4193 DWORD ulFileIndexInAssembly; 4194 } ACTIVATION_CONTEXT_QUERY_INDEX,*PACTIVATION_CONTEXT_QUERY_INDEX; 4195 typedef const ACTIVATION_CONTEXT_QUERY_INDEX *PCACTIVATION_CONTEXT_QUERY_INDEX; 4196 4197 typedef struct _ASSEMBLY_FILE_DETAILED_INFORMATION { 4198 DWORD ulFlags; 4199 DWORD ulFilenameLength; 4200 DWORD ulPathLength; 4201 PCWSTR lpFileName; 4202 PCWSTR lpFilePath; 4203 } ASSEMBLY_FILE_DETAILED_INFORMATION,*PASSEMBLY_FILE_DETAILED_INFORMATION; 4204 typedef const ASSEMBLY_FILE_DETAILED_INFORMATION *PCASSEMBLY_FILE_DETAILED_INFORMATION; 4205 4206 typedef enum { 4207 ACTCTX_RUN_LEVEL_UNSPECIFIED = 0, 4208 ACTCTX_RUN_LEVEL_AS_INVOKER, 4209 ACTCTX_RUN_LEVEL_HIGHEST_AVAILABLE, 4210 ACTCTX_RUN_LEVEL_REQUIRE_ADMIN, 4211 ACTCTX_RUN_LEVEL_NUMBERS 4212 } ACTCTX_REQUESTED_RUN_LEVEL; 4213 4214 typedef struct _ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION { 4215 DWORD ulFlags; 4216 ACTCTX_REQUESTED_RUN_LEVEL RunLevel; 4217 DWORD UiAccess; 4218 } ACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION, *PACTIVATION_CONTEXT_RUN_LEVEL_INFORMATION; 4219 4220 typedef enum { 4221 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_UNKNOWN = 0, 4222 ACTCTX_COMPATIBILITY_ELEMENT_TYPE_OS 4223 } ACTCTX_COMPATIBILITY_ELEMENT_TYPE; 4224 4225 typedef struct _COMPATIBILITY_CONTEXT_ELEMENT { 4226 GUID Id; 4227 ACTCTX_COMPATIBILITY_ELEMENT_TYPE Type; 4228 } COMPATIBILITY_CONTEXT_ELEMENT, *PCOMPATIBILITY_CONTEXT_ELEMENT; 4229 4230 typedef struct _ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION { 4231 DWORD ElementCount; 4232 COMPATIBILITY_CONTEXT_ELEMENT Elements[]; 4233 } ACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION, *PACTIVATION_CONTEXT_COMPATIBILITY_INFORMATION; 4234 4235 4236 #define ACTIVATION_CONTEXT_PATH_TYPE_NONE 1 4237 #define ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE 2 4238 #define ACTIVATION_CONTEXT_PATH_TYPE_URL 3 4239 #define ACTIVATION_CONTEXT_PATH_TYPE_ASSEMBLYREF 4 4240 4241 #define ACTIVATION_CONTEXT_SECTION_ASSEMBLY_INFORMATION 1 4242 #define ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION 2 4243 #define ACTIVATION_CONTEXT_SECTION_WINDOW_CLASS_REDIRECTION 3 4244 #define ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION 4 4245 #define ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION 5 4246 #define ACTIVATION_CONTEXT_SECTION_COM_TYPE_LIBRARY_REDIRECTION 6 4247 #define ACTIVATION_CONTEXT_SECTION_COM_PROGID_REDIRECTION 7 4248 #define ACTIVATION_CONTEXT_SECTION_GLOBAL_OBJECT_RENAME_TABLE 8 4249 #define ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES 9 4250 4251 #endif /* (_WIN32_WINNT >= 0x0501) */ 4252 4253 typedef struct _PROCESSOR_POWER_POLICY_INFO { 4254 DWORD TimeCheck; 4255 DWORD DemoteLimit; 4256 DWORD PromoteLimit; 4257 BYTE DemotePercent; 4258 BYTE PromotePercent; 4259 BYTE Spare[2]; 4260 DWORD AllowDemotion:1; 4261 DWORD AllowPromotion:1; 4262 DWORD Reserved:30; 4263 } PROCESSOR_POWER_POLICY_INFO, *PPROCESSOR_POWER_POLICY_INFO; 4264 4265 typedef struct _PROCESSOR_POWER_POLICY { 4266 DWORD Revision; 4267 BYTE DynamicThrottle; 4268 BYTE Spare[3]; 4269 DWORD DisableCStates:1; 4270 DWORD Reserved:31; 4271 DWORD PolicyCount; 4272 PROCESSOR_POWER_POLICY_INFO Policy[3]; 4273 } PROCESSOR_POWER_POLICY, *PPROCESSOR_POWER_POLICY; 4274 4275 typedef struct _ADMINISTRATOR_POWER_POLICY { 4276 SYSTEM_POWER_STATE MinSleep; 4277 SYSTEM_POWER_STATE MaxSleep; 4278 DWORD MinVideoTimeout; 4279 DWORD MaxVideoTimeout; 4280 DWORD MinSpindownTimeout; 4281 DWORD MaxSpindownTimeout; 4282 } ADMINISTRATOR_POWER_POLICY, *PADMINISTRATOR_POWER_POLICY; 4283 4284 #endif /* WINVER >= 0x0500 */ 4285 4286 typedef VOID (NTAPI *WAITORTIMERCALLBACKFUNC)(PVOID,BOOLEAN); 4287 4288 #ifdef UNICODE 4289 typedef OSVERSIONINFOW OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; 4290 typedef OSVERSIONINFOEXW OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; 4291 #else 4292 typedef OSVERSIONINFOA OSVERSIONINFO,*POSVERSIONINFO,*LPOSVERSIONINFO; 4293 typedef OSVERSIONINFOEXA OSVERSIONINFOEX,*POSVERSIONINFOEX,*LPOSVERSIONINFOEX; 4294 #endif 4295 4296 #define VER_SET_CONDITION(lc,t,c) ((lc) = VerSetConditionMask((lc),(t),(c))) 4297 4298 #if (_WIN32_WINNT >= 0x0500) 4299 ULONGLONG WINAPI VerSetConditionMask(_In_ ULONGLONG, _In_ DWORD, _In_ BYTE); 4300 #endif 4301 4302 typedef enum _HEAP_INFORMATION_CLASS { 4303 HeapCompatibilityInformation, 4304 HeapEnableTerminationOnCorruption 4305 } HEAP_INFORMATION_CLASS; 4306 4307 #define CACHE_FULLY_ASSOCIATIVE 0xFF 4308 4309 _Check_return_ 4310 NTSYSAPI 4311 SIZE_T 4312 NTAPI 4313 RtlCompareMemory ( 4314 _In_ const VOID *Source1, 4315 _In_ const VOID *Source2, 4316 _In_ SIZE_T Length); 4317 4318 #define RtlMoveMemory(Dest,Source,Length) memmove((Dest),(Source),(Length)) 4319 #define RtlCopyMemory(Dest,Source,Length) memcpy((Dest),(Source),(Length)) 4320 #define RtlFillMemory(Dest,Length,Fill) memset((Dest),(Fill),(Length)) 4321 #define RtlZeroMemory(Dest,Length) RtlFillMemory((Dest),(Length),0) 4322 #define RtlEqualMemory(Dest,Source,Length) (!memcmp((Dest),(Source),(Length))) 4323 4324 FORCEINLINE 4325 PVOID 4326 RtlSecureZeroMemory(_Out_writes_bytes_all_(Length) PVOID Buffer, 4327 _In_ SIZE_T Length) 4328 { 4329 volatile char *VolatilePointer; 4330 4331 /* Get a volatile pointer to prevent any compiler optimizations */ 4332 VolatilePointer = (volatile char *)Buffer; 4333 4334 /* Loop the whole buffer */ 4335 while (Length) 4336 { 4337 /* Zero the current byte and move on */ 4338 *VolatilePointer++ = 0; 4339 Length--; 4340 } 4341 4342 /* Return the pointer to ensure the compiler won't optimize this away */ 4343 return Buffer; 4344 } 4345 4346 #if defined(_M_IX86) 4347 FORCEINLINE struct _TEB * NtCurrentTeb(void) 4348 { 4349 return (struct _TEB *)__readfsdword(0x18); 4350 } 4351 FORCEINLINE PVOID GetCurrentFiber(VOID) 4352 { 4353 return (PVOID)(ULONG_PTR)__readfsdword(0x10); 4354 } 4355 #elif defined (_M_AMD64) 4356 FORCEINLINE struct _TEB * NtCurrentTeb(void) 4357 { 4358 return (struct _TEB *)__readgsqword(FIELD_OFFSET(NT_TIB, Self)); 4359 } 4360 FORCEINLINE PVOID GetCurrentFiber(VOID) 4361 { 4362 #ifdef NONAMELESSUNION 4363 return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, DUMMYUNIONNAME.FiberData)); 4364 #else 4365 return (PVOID)__readgsqword(FIELD_OFFSET(NT_TIB, FiberData)); 4366 #endif 4367 } 4368 #elif defined (_M_ARM) 4369 #define CP15_PMSELR 15, 0, 9, 12, 5 4370 #define CP15_PMXEVCNTR 15, 0, 9, 13, 2 4371 #define CP15_TPIDRURW 15, 0, 13, 0, 2 4372 #define CP15_TPIDRURO 15, 0, 13, 0, 3 4373 #define CP15_TPIDRPRW 15, 0, 13, 0, 4 4374 FORCEINLINE struct _TEB * NtCurrentTeb(void) 4375 { 4376 return (struct _TEB *)(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW); 4377 } 4378 FORCEINLINE PVOID GetCurrentFiber(VOID) 4379 { 4380 #ifdef NONAMELESSUNION 4381 return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->DUMMYUNIONNAME.FiberData; 4382 #else 4383 return ((PNT_TIB )(ULONG_PTR)_MoveFromCoprocessor(CP15_TPIDRURW))->FiberData; 4384 #endif 4385 } 4386 #elif defined (_M_ARM64) 4387 FORCEINLINE struct _TEB * NtCurrentTeb(void) 4388 { 4389 //UNIMPLEMENTED; 4390 return 0; 4391 } 4392 FORCEINLINE PVOID GetCurrentFiber(VOID) 4393 { 4394 //UNIMPLEMENTED; 4395 return 0; 4396 } 4397 #elif defined(_M_PPC) 4398 FORCEINLINE unsigned long _read_teb_dword(const unsigned long Offset) 4399 { 4400 unsigned long result; 4401 __asm__("\tadd 7,13,%1\n" 4402 "\tlwz %0,0(7)\n" 4403 : "=r" (result) 4404 : "r" (Offset) 4405 : "r7"); 4406 return result; 4407 } 4408 FORCEINLINE struct _TEB * NtCurrentTeb(void) 4409 { 4410 return (struct _TEB *)_read_teb_dword(0x18); 4411 } 4412 FORCEINLINE PVOID GetCurrentFiber(void) 4413 { 4414 return _read_teb_dword(0x10); 4415 } 4416 #else 4417 #error Unknown architecture 4418 #endif 4419 4420 FORCEINLINE PVOID GetFiberData(void) 4421 { 4422 return *((PVOID *)GetCurrentFiber()); 4423 } 4424 4425 /* TODO: Other architectures than X86 */ 4426 #if defined(_M_IX86) 4427 #define PF_TEMPORAL_LEVEL_1 4428 #define PF_NON_TEMPORAL_LEVEL_ALL 4429 #define PreFetchCacheLine(l, a) 4430 #elif defined (_M_AMD64) 4431 #define PreFetchCacheLine(l, a) 4432 #elif defined(_M_PPC) 4433 #define PreFetchCacheLine(l, a) 4434 #elif defined(_M_ARM) 4435 #define PreFetchCacheLine(l, a) 4436 #elif defined(_M_ARM64) 4437 #define PreFetchCacheLine(l, a) 4438 #else 4439 #error Unknown architecture 4440 #endif 4441 4442 /* TODO: Other architectures than X86 */ 4443 #if defined(_M_IX86) 4444 #if defined(_MSC_VER) 4445 FORCEINLINE 4446 VOID 4447 MemoryBarrier (VOID) 4448 { 4449 LONG Barrier; 4450 __asm { xchg Barrier, eax } 4451 } 4452 #else 4453 FORCEINLINE 4454 VOID 4455 MemoryBarrier(VOID) 4456 { 4457 LONG Barrier, *Dummy = &Barrier; 4458 (VOID)Dummy; 4459 __asm__ __volatile__("xchgl %%eax, %[Barrier]" : : [Barrier] "m" (Barrier) : "memory"); 4460 } 4461 #endif 4462 #elif defined (_M_AMD64) 4463 #define MemoryBarrier __faststorefence 4464 #elif defined(_M_PPC) 4465 #define MemoryBarrier() 4466 #elif defined(_M_ARM) 4467 #define MemoryBarrier() 4468 #elif defined(_M_ARM64) 4469 #define MemoryBarrier() 4470 #else 4471 #error Unknown architecture 4472 #endif 4473 4474 #if defined(_M_IX86) || defined(_M_AMD64) 4475 4476 #define YieldProcessor _mm_pause 4477 4478 __analysis_noreturn 4479 FORCEINLINE 4480 VOID 4481 DbgRaiseAssertionFailure(VOID) 4482 { 4483 __int2c(); 4484 } 4485 4486 #elif defined(_M_PPC) 4487 #define YieldProcessor() __asm__ __volatile__("nop"); 4488 #elif defined(_M_MIPS) 4489 #define YieldProcessor() __asm__ __volatile__("nop"); 4490 #elif defined(_M_ARM) 4491 #define YieldProcessor __yield 4492 #elif defined(_M_ARM64) 4493 #define YieldProcessor __yield 4494 #else 4495 #error Unknown architecture 4496 #endif 4497 4498 typedef struct _TP_POOL TP_POOL, *PTP_POOL; 4499 typedef struct _TP_WORK TP_WORK, *PTP_WORK; 4500 typedef struct _TP_CALLBACK_INSTANCE TP_CALLBACK_INSTANCE, *PTP_CALLBACK_INSTANCE; 4501 4502 typedef DWORD TP_VERSION, *PTP_VERSION; 4503 4504 typedef enum _TP_CALLBACK_PRIORITY { 4505 TP_CALLBACK_PRIORITY_HIGH, 4506 TP_CALLBACK_PRIORITY_NORMAL, 4507 TP_CALLBACK_PRIORITY_LOW, 4508 TP_CALLBACK_PRIORITY_INVALID, 4509 TP_CALLBACK_PRIORITY_COUNT = TP_CALLBACK_PRIORITY_INVALID 4510 } TP_CALLBACK_PRIORITY; 4511 4512 typedef VOID 4513 (NTAPI *PTP_WORK_CALLBACK)( 4514 _Inout_ PTP_CALLBACK_INSTANCE Instance, 4515 _Inout_opt_ PVOID Context, 4516 _Inout_ PTP_WORK Work); 4517 4518 typedef struct _TP_CLEANUP_GROUP TP_CLEANUP_GROUP, *PTP_CLEANUP_GROUP; 4519 4520 typedef VOID 4521 (NTAPI *PTP_SIMPLE_CALLBACK)( 4522 _Inout_ PTP_CALLBACK_INSTANCE Instance, 4523 _Inout_opt_ PVOID Context); 4524 4525 typedef VOID 4526 (NTAPI *PTP_CLEANUP_GROUP_CANCEL_CALLBACK)( 4527 _Inout_opt_ PVOID ObjectContext, 4528 _Inout_opt_ PVOID CleanupContext); 4529 4530 #if (_WIN32_WINNT >= _WIN32_WINNT_WIN7) 4531 typedef struct _TP_CALLBACK_ENVIRON_V3 { 4532 TP_VERSION Version; 4533 PTP_POOL Pool; 4534 PTP_CLEANUP_GROUP CleanupGroup; 4535 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback; 4536 PVOID RaceDll; 4537 struct _ACTIVATION_CONTEXT *ActivationContext; 4538 PTP_SIMPLE_CALLBACK FinalizationCallback; 4539 union { 4540 DWORD Flags; 4541 struct { 4542 DWORD LongFunction:1; 4543 DWORD Persistent:1; 4544 DWORD Private:30; 4545 } s; 4546 } u; 4547 TP_CALLBACK_PRIORITY CallbackPriority; 4548 DWORD Size; 4549 } TP_CALLBACK_ENVIRON_V3, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; 4550 #else 4551 typedef struct _TP_CALLBACK_ENVIRON_V1 { 4552 TP_VERSION Version; 4553 PTP_POOL Pool; 4554 PTP_CLEANUP_GROUP CleanupGroup; 4555 PTP_CLEANUP_GROUP_CANCEL_CALLBACK CleanupGroupCancelCallback; 4556 PVOID RaceDll; 4557 struct _ACTIVATION_CONTEXT *ActivationContext; 4558 PTP_SIMPLE_CALLBACK FinalizationCallback; 4559 union { 4560 DWORD Flags; 4561 struct { 4562 DWORD LongFunction:1; 4563 DWORD Persistent:1; 4564 DWORD Private:30; 4565 } s; 4566 } u; 4567 } TP_CALLBACK_ENVIRON_V1, TP_CALLBACK_ENVIRON, *PTP_CALLBACK_ENVIRON; 4568 #endif /* (_WIN32_WINNT >= _WIN32_WINNT_WIN7) */ 4569 4570 #ifdef __WINESRC__ 4571 # define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 4572 #endif 4573 4574 #ifdef _MSC_VER 4575 #pragma warning(pop) 4576 #endif 4577 4578 #endif /* RC_INVOKED */ 4579