motiejus/zig

fork of https://codeberg.org/ziglang/zig
git clone https://git.jakstys.lt/motiejus/zig.git
Log | Tree | Refs | README | LICENSE

commit 1a61a9d4bf37183282de8a09431ed1baaf049999 (tree)
parent 8f346d9a4bd9c10a76bee0b33b09ac31eb5438fe
Author: Michael Freundorfer <contact@mfreundorfercg.com>
Date:   Fri, 27 Nov 2020 19:21:29 +0100

Fix WindowsDynLib.openW trying to strip the \??\ prefix when it does not exist

Diffstat:
Mlib/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 @@ -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), }; }