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
This commit is contained in:
expikr
2023-11-03 19:16:35 +08:00
committed by Veikka Tuominen
parent c25f2fa561
commit 40bd93e2a2
3 changed files with 9 additions and 6 deletions

View File

@@ -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));
}

View File

@@ -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,

View File

@@ -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,