windows: retrieve NtQuerySystemInformation at startup
This commit is contained in:
parent
120d997809
commit
87f3530a1e
@ -29,6 +29,7 @@ sRtlNtStatusToDosError pRtlNtStatusToDosError;
|
||||
sNtDeviceIoControlFile pNtDeviceIoControlFile;
|
||||
sNtQueryInformationFile pNtQueryInformationFile;
|
||||
sNtSetInformationFile pNtSetInformationFile;
|
||||
sNtQuerySystemInformation pNtQuerySystemInformation;
|
||||
sGetQueuedCompletionStatusEx pGetQueuedCompletionStatusEx;
|
||||
sSetFileCompletionNotificationModes pSetFileCompletionNotificationModes;
|
||||
sCreateSymbolicLinkW pCreateSymbolicLinkW;
|
||||
@ -79,6 +80,13 @@ void uv_winapi_init() {
|
||||
uv_fatal_error(GetLastError(), "GetProcAddress");
|
||||
}
|
||||
|
||||
pNtQuerySystemInformation = (sNtQuerySystemInformation) GetProcAddress(
|
||||
ntdll_module,
|
||||
"NtQuerySystemInformation");
|
||||
if (pNtQuerySystemInformation == NULL) {
|
||||
uv_fatal_error(GetLastError(), "GetProcAddress");
|
||||
}
|
||||
|
||||
kernel32_module = GetModuleHandleA("kernel32.dll");
|
||||
if (kernel32_module == NULL) {
|
||||
uv_fatal_error(GetLastError(), "GetModuleHandleA");
|
||||
|
||||
@ -4202,6 +4202,19 @@ typedef enum _FILE_INFORMATION_CLASS {
|
||||
FileMaximumInformation
|
||||
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
||||
|
||||
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
|
||||
LARGE_INTEGER IdleTime;
|
||||
LARGE_INTEGER KernelTime;
|
||||
LARGE_INTEGER UserTime;
|
||||
LARGE_INTEGER DpcTime;
|
||||
LARGE_INTEGER InterruptTime;
|
||||
ULONG InterruptCount;
|
||||
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
||||
|
||||
#ifndef SystemProcessorPerformanceInformation
|
||||
# define SystemProcessorPerformanceInformation 8
|
||||
#endif
|
||||
|
||||
#ifndef DEVICE_TYPE
|
||||
# define DEVICE_TYPE DWORD
|
||||
#endif
|
||||
@ -4318,6 +4331,12 @@ typedef NTSTATUS (NTAPI *sNtSetInformationFile)
|
||||
ULONG Length,
|
||||
FILE_INFORMATION_CLASS FileInformationClass);
|
||||
|
||||
typedef NTSTATUS (NTAPI *sNtQuerySystemInformation)
|
||||
(UINT SystemInformationClass,
|
||||
PVOID SystemInformation,
|
||||
ULONG SystemInformationLength,
|
||||
PULONG ReturnLength);
|
||||
|
||||
|
||||
/*
|
||||
* Kernel32 headers
|
||||
@ -4405,6 +4424,7 @@ extern sRtlNtStatusToDosError pRtlNtStatusToDosError;
|
||||
extern sNtDeviceIoControlFile pNtDeviceIoControlFile;
|
||||
extern sNtQueryInformationFile pNtQueryInformationFile;
|
||||
extern sNtSetInformationFile pNtSetInformationFile;
|
||||
extern sNtQuerySystemInformation pNtQuerySystemInformation;
|
||||
|
||||
|
||||
/* Kernel32 function pointers */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user