Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.
Path: blob/master/external/source/include/windows/definitions.h
Views: 11779
#pragma once12#include <windows.h>3#include <ntstatus.h>45#ifndef NTSTATUS6typedef long NTSTATUS;7#endif89// https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ex/sysinfo/handle_table_entry.htm?ts=0,8010typedef struct _SYSTEM_HANDLE_TABLE_ENTRY_INFO {11USHORT UniqueProcessId;12USHORT CreatorBackTraceIndex;13UCHAR ObjectTypeIndex;14UCHAR HandleAttributes;15USHORT HandleValue;16PVOID Object;17ULONG GrantedAccess;18} SYSTEM_HANDLE_TABLE_ENTRY_INFO;19typedef SYSTEM_HANDLE_TABLE_ENTRY_INFO* PSYSTEM_HANDLE_TABLE_ENTRY_INFO;2021typedef struct _SYSTEM_HANDLE_INFORMATION {22ULONG NumberOfHandles;23SYSTEM_HANDLE_TABLE_ENTRY_INFO Handles[];24} SYSTEM_HANDLE_INFORMATION;25typedef SYSTEM_HANDLE_INFORMATION* PSYSTEM_HANDLE_INFORMATION;2627typedef enum _SYSTEM_INFORMATION_CLASS // this is an incomplete definition28{29SystemBasicInformation = 0, // 3.10 and higher30SystemProcessorInformation = 1, // 3.10 and higher31SystemPerformanceInformation = 2, // 3.10 and higher32SystemTimeOfDayInformation = 3, // 3.10 and higher33SystemPathInformation = 4, // 3.10 and higher34SystemProcessInformation = 5, // 3.10 and higher35SystemCallCountInformation = 6, // 3.10 and higher36SystemDeviceInformation = 7, // 3.10 and higher37SystemProcessorPerformanceInformation = 8, // 3.10 and higher38SystemFlagsInformation = 9, // 3.10 and higher39SystemCallTimeInformation = 10, // 3.10 and higher40SystemModuleInformation = 11, // 3.10 and higher41SystemLocksInformation = 12, // 3.10 and higher42SystemStackTraceInformation = 13, // 3.10 and higher43SystemPagedPoolInformation = 14, // 3.10 and higher44SystemNonPagedPoolInformation = 15, // 3.10 and higher45SystemHandleInformation = 16, // 3.10 and higher46SystemObjectInformation = 17, // 3.10 and higher47SystemPageFileInformation = 18, // 3.10 and higher48SystemVdmInstemulInformation = 19, // 3.10 and higher49SystemVdmBopInformation = 20, // 3.10 and higher50SystemFileCacheInformation = 21, // 3.10 and higher51SystemPoolTagInformation = 22, // 3.50 and higher52SystemInterruptInformation = 23, // 3.51 and higher53SystemExceptionInformation = 33, // 3.50 and higher54SystemRegistryQuotaInformation = 37, // 3.51 and higher55SystemLookasideInformation = 45, // 4.0 and higher56SystemBigPoolInformation = 66, // 5.2 and higher57SystemCodeIntegrityInformation = 103, // 6.0 and higher58SystemQueryPerformanceCounterInformation = 124, // 6.1 and higher59SystemPolicyInformation = 134, // 6.2 and higher, was known as SystemThrottleNotificationInformation in 6.260SystemKernelVaShadowInformation = 196, // 1803 and higher61SystemSpeculationControlInformation = 201, // 1803 and higher62SystemDmaGuardPolicyInformation = 202, // 1803 and higher63SystemEnclaveLaunchControlInformation = 203 // 1803 and higher64} SYSTEM_INFORMATION_CLASS;6566// Definitions taken from https://www.geoffchappell.com/studies/windows/km/ntoskrnl/api/ps/psquery/class.htm67typedef enum _THREADINFOCLASS {68ThreadBasicInformation = 0x0, // All versions69ThreadTimes = 0x1, // All versions70ThreadPriority = 0x2, // All versions71ThreadBasePriority = 0x3, // All versions72ThreadAffinityMask = 0x4, // All versions73ThreadImpersonationToken = 0x5, // All versions74ThreadDescriptorTableEntry = 0x6, // All versions75ThreadEnableAlignmentFaultFixup = 0x7, // All versions76ThreadEventPair = 0x8, // 3.10 to 4.077ThreadEventPair_Reuseable = 0x8, // 5.0 and higher78ThreadQuerySetWin32StartAddress = 0x9, // All versions79ThreadZeroTlsCell = 0x0A, // All versions minus 3.10 where it was 0xB80ThreadPerformanceCount = 0x0B, // 3.51 and higher81ThreadAmILastThread = 0x0C, // 3.51 and higher82ThreadIdealProcessor = 0x0D, // 4.0 and higher83ThreadPriorityBoost = 0x0E, // 4.0 and higher84ThreadSetTlsArrayAddress = 0x0F, // 4.0 and higher85ThreadIsIoPending = 0x10, // 5.0 and higher86ThreadHideFromDebugger = 0x11, // 5.0 and higher87ThreadBreakOnTermination = 0x12, // 5.2 and higher88ThreadSwitchLegacyState = 0x13, // 5.2 and higher from Windows Server 2003 SP189ThreadIsTerminated = 0x14, // 5.2 and higher from Windows Server 2003 SP190ThreadLastSystemCall = 0x15, // 6.0 and higher91ThreadIoPriority = 0x16, // 6.0 and higher92ThreadCycleTime = 0x17, // 6.0 and higher93ThreadPagePriority = 0x18, // 6.0 and higher94ThreadActualBasePriority = 0x19, // 6.0 and higher95ThreadTebInformation = 0x1A, // 6.0 and higher96ThreadCSwitchMon = 0x1B, // 6.0 and higher97ThreadCSwitchPmu = 0x1C, // 6.1 and higher98ThreadWow64Context = 0x1D, // 6.1 and higher99ThreadGroupInformation = 0x1E, // 6.1 and higher100ThreadUmsInformation = 0x1F, // 6.1 and higher101ThreadCounterProfiling = 0x20, // 6.1 and higher102ThreadIdealProcessorEx = 0x21, // 6.1 and higher103ThreadCpuAccountingInformation = 0x22, // 6.2 and higher104ThreadSuspendCount = 0x23, // 6.3 and higher105ThreadHeterogeneousCpuPolicy = 0x24, // 10.0 and higher106ThreadContainerId = 0x25, // 10.0 and higher107ThreadNameInformation = 0x26, // 10.0 and higher108ThreadSelectedCpuSets = 0x27, // 10.0 and higher109ThreadSystemThreadInformation = 0x28, // 10.0 and higher110ThreadActualGroupAffinity = 0x29 // 10.0 and higher111} THREADINFOCLASS;112113typedef NTSTATUS(__stdcall* fNtQuerySystemInformation)(114SYSTEM_INFORMATION_CLASS SystemInformationClass,115PVOID SystemInformation,116ULONG SystemInformationLength,117PULONG ReturnLength118);119120typedef NTSTATUS(__stdcall* fNtCallbackReturn)(121PVOID Result,122ULONG ResultLength,123NTSTATUS CallbackStateus124);125126typedef NTSTATUS(__stdcall* fNtUserConsoleControl)(127DWORD ConsoleCtrl,128PVOID ConsoleCtrlInfo,129ULONG ConsoleCtrlInfoLength130);131132typedef NTSTATUS(__stdcall* fNtUserMessageCall)(133HWND hWnd,134UINT msg,135WPARAM wParam,136LPARAM lParam,137ULONG_PTR ResultInfo,138DWORD dwType,139BOOL bAscii140);141142typedef PVOID(__stdcall* fRtlAllocateHeap)(143PVOID HeapHandle,144ULONG Flags,145SIZE_T Size146);147148typedef VOID(__stdcall* fRtlGetNtVersionNumbers)(149DWORD* MajorVersion,150DWORD* MinorVersion,151DWORD* BuildNumber152);153154#define TYPE_WINDOW 1155typedef PVOID(__stdcall* fHMValidateHandle)(HANDLE hHandle, DWORD dwType);156157//158// Taken from ntdef.h159//160161// Unicode strings are counted 16-bit character strings. If they are162// NULL terminated, Length does not include trailing NULL.163typedef struct _UNICODE_STRING {164USHORT Length;165USHORT MaximumLength;166#ifdef MIDL_PASS167[size_is(MaximumLength / 2), length_is((Length) / 2)] USHORT* Buffer;168#else // MIDL_PASS169_Field_size_bytes_part_opt_(MaximumLength, Length) PWCH Buffer;170#endif // MIDL_PASS171} UNICODE_STRING, *PUNICODE_STRING;172173typedef struct _OBJECT_ATTRIBUTES {174ULONG Length;175HANDLE RootDirectory;176PUNICODE_STRING ObjectName;177ULONG Attributes;178PVOID SecurityDescriptor; // Points to type SECURITY_DESCRIPTOR179PVOID SecurityQualityOfService; // Points to type SECURITY_QUALITY_OF_SERVICE180} OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES;181182//183// Taken from wdm.h184//185typedef struct _IO_STATUS_BLOCK {186union {187NTSTATUS Status;188PVOID Pointer;189};190ULONG_PTR Information;191} IO_STATUS_BLOCK, * PIO_STATUS_BLOCK;192193typedef NTSTATUS(__stdcall* fNtCreateFile)(194PHANDLE FileHandle,195ACCESS_MASK DesiredAccess,196POBJECT_ATTRIBUTES ObjectAttributes,197PIO_STATUS_BLOCK IoStatusBlock,198PLARGE_INTEGER AllocationSize,199ULONG FileAttributes,200ULONG ShareAccess,201ULONG CreateDisposition,202ULONG CreateOptions,203PVOID EaBuffer,204ULONG EaLength205);206207typedef NTSTATUS(__stdcall* fNtDeviceIoControlFile)(208HANDLE FileHandle,209HANDLE Event,210PVOID ApcRoutine, // PIO_APC_ROUTINE is just a pointer to a function211PVOID ApcContext,212PIO_STATUS_BLOCK IoStatusBlock,213ULONG IoControlCode,214PVOID InputBuffer,215ULONG InputBufferLength,216PVOID OutputBuffer,217ULONG OutputBufferLength218);219220typedef NTSTATUS(__stdcall* fNtCreateIoCompletion)(221PHANDLE IoCompletionHandle,222ACCESS_MASK DesiredAccess,223POBJECT_ATTRIBUTES ObjectAttributes,224ULONG NumberOfConcurrentThreads225);226227typedef NTSTATUS(__stdcall* fNtSetIoCompletion)(228HANDLE IoCompletionHandle,229ULONG CompletionKey,230PIO_STATUS_BLOCK IoStatusBlock,231NTSTATUS CompletionStatus,232ULONG NumberOfBytesTransferred233);234235236