util/library: Force specific search directories

This commit is contained in:
Michael Fabian 'Xaymar' Dirks 2021-09-28 23:24:26 +02:00
parent 5c0a371cf1
commit a56f3816a1

View file

@ -39,7 +39,8 @@ streamfx::util::library::library(std::filesystem::path file) : _library(nullptr)
#if defined(ST_WINDOWS)
SetLastError(ERROR_SUCCESS);
file = ::streamfx::util::platform::utf8_to_native(file);
_library = reinterpret_cast<void*>(LoadLibraryW(file.wstring().c_str()));
_library = reinterpret_cast<void*>(LoadLibraryExW(
file.wstring().c_str(), nullptr, LOAD_LIBRARY_SEARCH_DLL_LOAD_DIR | LOAD_LIBRARY_SEARCH_DEFAULT_DIRS));
if (!_library) {
DWORD error = GetLastError();
if (error != ERROR_PROC_NOT_FOUND) {