From 2ccbd76c02b6378ebaa4298b3c7be442baa842cf Mon Sep 17 00:00:00 2001 From: Michael Fabian 'Xaymar' Dirks Date: Sun, 7 Nov 2021 07:08:23 +0100 Subject: [PATCH] util/library: Don't mix incompatible parameters --- source/util/util-library.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/util/util-library.cpp b/source/util/util-library.cpp index 0f1ce7a7..b6ba2d0a 100644 --- a/source/util/util-library.cpp +++ b/source/util/util-library.cpp @@ -39,8 +39,11 @@ streamfx::util::library::library(std::filesystem::path file) : _library(nullptr) #if defined(ST_WINDOWS) SetLastError(ERROR_SUCCESS); auto wfile = ::streamfx::util::platform::utf8_to_native(file.u8string()); - _library = reinterpret_cast( - LoadLibraryExW(wfile.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)); + if (file.is_absolute()) { + _library = reinterpret_cast(LoadLibraryExW(wfile.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR)); + } else { + _library = reinterpret_cast(LoadLibraryExW(wfile.c_str(), nullptr, LOAD_LIBRARY_SEARCH_DEFAULT_DIRS)); + } if (!_library) { DWORD error = GetLastError(); if (error != ERROR_PROC_NOT_FOUND) {