zig

fork of https://codeberg.org/ziglang/zig
Log | Files | Refs | README | LICENSE

commit 40bd93e2a24e3bdebd4f6454cfcffc51e5aaeeae (tree)
parent c25f2fa561ecfed80e0cc2d0ffa9200ce30bb499
Author: expikr <77922942+expikr@users.noreply.github.com>
Date:   Fri,  3 Nov 2023 19:16:35 +0800

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

Diffstat:
Mlib/std/os/windows.zig | 4++--
Mlib/std/os/windows/kernel32.zig | 4----
Mlib/std/os/windows/ntdll.zig | 7+++++++
3 files changed, 9 insertions(+), 6 deletions(-)

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