From 1e74904aa27da423bcfe804a9b06fe8c0a0620ba Mon Sep 17 00:00:00 2001 From: Lucas Santos Date: Sun, 21 Jul 2024 17:25:28 -0300 Subject: [PATCH] Replace some dynamic functions with static ones. PR [19271](https://github.com/ziglang/zig/pull/19271) added some static function implementations from kernel32, but some parts of the library still used the dynamically loaded versions. --- lib/std/Thread.zig | 2 +- lib/std/debug.zig | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/std/Thread.zig b/lib/std/Thread.zig index b3bb79db59e8f20dcdb3582f05068a55179e4d6f..c3802cc1feaf1bf9eb62bd1935559ceba9c6aa65 100644 --- a/lib/std/Thread.zig +++ b/lib/std/Thread.zig @@ -484,7 +484,7 @@ const WindowsThreadImpl = struct { pub const ThreadHandle = windows.HANDLE; fn getCurrentId() windows.DWORD { - return windows.kernel32.GetCurrentThreadId(); + return windows.GetCurrentThreadId(); } fn getCpuCount() !usize { diff --git a/lib/std/debug.zig b/lib/std/debug.zig index a6bc929cfda5006e682cb37e2af09558f74d74b1..31321d62fd03d15e6b7f1fa845500ef4baf9f245 100644 --- a/lib/std/debug.zig +++ b/lib/std/debug.zig @@ -1750,7 +1750,7 @@ pub const WindowsModuleInfo = struct { section_view: []const u8, pub fn deinit(self: @This()) void { - const process_handle = windows.kernel32.GetCurrentProcess(); + const process_handle = windows.GetCurrentProcess(); assert(windows.ntdll.NtUnmapViewOfSection(process_handle, @constCast(@ptrCast(self.section_view.ptr))) == .SUCCESS); windows.CloseHandle(self.section_handle); self.file.close(); @@ -1980,7 +1980,7 @@ pub const DebugInfo = struct { // openFileAbsoluteW requires the prefix to be present @memcpy(name_buffer[0..4], &[_]u16{ '\\', '?', '?', '\\' }); - const process_handle = windows.kernel32.GetCurrentProcess(); + const process_handle = windows.GetCurrentProcess(); const len = windows.kernel32.GetModuleFileNameExW( process_handle, module.handle, -- 2.54.0