| ... | ... | @@ -31,7 +31,7 @@ pub const DynLib = struct { |
| 31 | 31 | |
| 32 | 32 | /// Trusts the file. Malicious file will be able to execute arbitrary code. |
| 33 | 33 | pub fn openZ(path_c: [*:0]const u8) Error!DynLib { |
| 34 | | return .{ .inner = try InnerType.open(path_c) }; |
| 34 | return .{ .inner = try InnerType.openZ(path_c) }; |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /// Trusts the file. |
| ... | ... | @@ -376,7 +376,7 @@ pub const WindowsDynLib = struct { |
| 376 | 376 | /// WindowsDynLib specific |
| 377 | 377 | /// Opens dynamic library with specified library loading flags. |
| 378 | 378 | pub fn openExZ(path_c: [*:0]const u8, flags: windows.LoadLibraryFlags) Error!WindowsDynLib { |
| 379 | | const path_w = try windows.cStrToPrefixedFileW(null, path_c); |
| 379 | const path_w = windows.cStrToPrefixedFileW(null, path_c) catch return error.InvalidPath; |
| 380 | 380 | return openExW(path_w.span().ptr, flags); |
| 381 | 381 | } |
| 382 | 382 | |
| ... | ... | @@ -466,4 +466,5 @@ test "dynamic_library" { |
| 466 | 466 | }; |
| 467 | 467 | |
| 468 | 468 | try testing.expectError(error.FileNotFound, DynLib.open(libname)); |
| 469 | try testing.expectError(error.FileNotFound, DynLib.openZ(libname.ptr)); |
| 469 | 470 | } |