Commit 40bd93e2a2

expikr <77922942+expikr@users.noreply.github.com>
2023-11-03 12:16:35
replace qpf and qpc
Update windows.zig Update windows.zig Update windows.zig Update windows.zig Update windows.zig Update windows.zig Update windows.zig Update ntdll.zig Update windows.zig Update ntdll.zig Update kernel32.zig
1 parent c25f2fa
Changed files (3)
lib/std/os/windows/kernel32.zig
@@ -276,10 +276,6 @@ pub extern "kernel32" fn MoveFileExW(
 
 pub extern "kernel32" fn PostQueuedCompletionStatus(CompletionPort: HANDLE, dwNumberOfBytesTransferred: DWORD, dwCompletionKey: ULONG_PTR, lpOverlapped: ?*OVERLAPPED) callconv(WINAPI) BOOL;
 
-pub extern "kernel32" fn QueryPerformanceCounter(lpPerformanceCount: *LARGE_INTEGER) callconv(WINAPI) BOOL;
-
-pub extern "kernel32" fn QueryPerformanceFrequency(lpFrequency: *LARGE_INTEGER) callconv(WINAPI) BOOL;
-
 pub extern "kernel32" fn ReadDirectoryChangesW(
     hDirectory: HANDLE,
     lpBuffer: [*]align(@alignOf(FILE_NOTIFY_INFORMATION)) u8,
lib/std/os/windows/ntdll.zig
@@ -113,6 +113,13 @@ pub extern "ntdll" fn NtQueryAttributesFile(
     FileAttributes: *FILE_BASIC_INFORMATION,
 ) callconv(WINAPI) NTSTATUS;
 
+pub extern "ntdll" fn RtlQueryPerformanceCounter(PerformanceCounter: *LARGE_INTEGER) callconv(WINAPI) BOOL;
+pub extern "ntdll" fn RtlQueryPerformanceFrequency(PerformanceFrequency: *LARGE_INTEGER) callconv(WINAPI) BOOL;
+pub extern "ntdll" fn NtQueryPerformanceCounter(
+    PerformanceCounter: *LARGE_INTEGER,
+    PerformanceFrequency: ?*LARGE_INTEGER,
+) callconv(WINAPI) NTSTATUS;
+
 pub extern "ntdll" fn NtCreateFile(
     FileHandle: *HANDLE,
     DesiredAccess: ACCESS_MASK,
lib/std/os/windows.zig
@@ -1812,7 +1812,7 @@ pub fn QueryPerformanceFrequency() u64 {
     // "On systems that run Windows XP or later, the function will always succeed"
     // https://docs.microsoft.com/en-us/windows/desktop/api/profileapi/nf-profileapi-queryperformancefrequency
     var result: LARGE_INTEGER = undefined;
-    assert(kernel32.QueryPerformanceFrequency(&result) != 0);
+    assert(ntdll.RtlQueryPerformanceFrequency(&result) != 0);
     // The kernel treats this integer as unsigned.
     return @as(u64, @bitCast(result));
 }
@@ -1821,7 +1821,7 @@ pub fn QueryPerformanceCounter() u64 {
     // "On systems that run Windows XP or later, the function will always succeed"
     // https://docs.microsoft.com/en-us/windows/desktop/api/profileapi/nf-profileapi-queryperformancecounter
     var result: LARGE_INTEGER = undefined;
-    assert(kernel32.QueryPerformanceCounter(&result) != 0);
+    assert(ntdll.RtlQueryPerformanceCounter(&result) != 0);
     // The kernel treats this integer as unsigned.
     return @as(u64, @bitCast(result));
 }