| 69 | } |
| 70 | |
| 71 | wil::unique_hmodule LoadableDll::LoadDll(const std::filesystem::path &location) |
| 72 | { |
| 73 | wil::unique_hmodule hmod(LoadLibraryEx(location.c_str(), nullptr, LOAD_LIBRARY_SEARCH_SYSTEM32)); |
| 74 | if (!hmod) |
| 75 | { |
| 76 | LastErrorHandle(spdlog::level::critical, std::format(L"Failed to load {}", location.filename().native())); |
| 77 | } |
| 78 | |
| 79 | return hmod; |
| 80 | } |
| 81 | |
| 82 | LoadableDll::LoadableDll(const std::optional<std::filesystem::path> &storagePath, bool copyDll, std::wstring_view dll) : |
| 83 | m_hMod(LoadDll(GetDllPath(storagePath, copyDll, dll))) |