From 1a61a9d4bf37183282de8a09431ed1baaf049999 Mon Sep 17 00:00:00 2001 From: Michael Freundorfer Date: Fri, 27 Nov 2020 19:21:29 +0100 Subject: [PATCH] Fix WindowsDynLib.openW trying to strip the \??\ prefix when it does not exist --- lib/std/dynamic_library.zig | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/std/dynamic_library.zig b/lib/std/dynamic_library.zig index aca6cf958c..c1123f6eb7 100644 --- a/lib/std/dynamic_library.zig +++ b/lib/std/dynamic_library.zig @@ -344,9 +344,14 @@ pub const WindowsDynLib = struct { } pub fn openW(path_w: [*:0]const u16) !WindowsDynLib { - return WindowsDynLib{ + var offset: usize = 0; + if (path_w[0] == '\\' and path_w[1] == '?' and path_w[2] == '?' and path_w[3] == '\\') { // + 4 to skip over the \??\ - .dll = try windows.LoadLibraryW(path_w + 4), + offset = 4; + } + + return WindowsDynLib{ + .dll = try windows.LoadLibraryW(path_w + offset), }; }