| 10 | #include "../ProgramLog/error/win32.hpp" |
| 11 | |
| 12 | class LoadableDll { |
| 13 | wil::unique_hmodule m_hMod; |
| 14 | |
| 15 | static std::filesystem::path GetDllPath(const std::optional<std::filesystem::path>& storageFolder, bool copyDll, std::wstring_view dll); |
| 16 | static wil::unique_hmodule LoadDll(const std::filesystem::path &location); |
| 17 | |
| 18 | public: |
| 19 | LoadableDll(const std::optional<std::filesystem::path> &storagePath, bool copyDll, std::wstring_view dll); |
| 20 | |
| 21 | template<typename T> |
| 22 | T GetProc(Util::null_terminated_string_view proc) |
| 23 | { |
| 24 | if (const auto ptr = GetProcAddress(m_hMod.get(), proc.c_str())) |
| 25 | { |
| 26 | return reinterpret_cast<T>(ptr); |
| 27 | } |
| 28 | else |
| 29 | { |
| 30 | LastErrorHandle(spdlog::level::critical, L"Failed to get address of procedure"); |
| 31 | } |
| 32 | } |
| 33 | }; |
nothing calls this directly
no outgoing calls
no test coverage detected