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