diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index efc3f5574d..e5223e93ec 100644 --- a/lib/std/os/windows.zig +++ b/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)); } diff --git a/lib/std/os/windows/kernel32.zig b/lib/std/os/windows/kernel32.zig index 1931d40804..7a1eb2832a 100644 --- a/lib/std/os/windows/kernel32.zig +++ b/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, diff --git a/lib/std/os/windows/ntdll.zig b/lib/std/os/windows/ntdll.zig index cdcb66b8b0..d43657f6f3 100644 --- a/lib/std/os/windows/ntdll.zig +++ b/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,