MCPcopy Create free account
hub / github.com/TranslucentTB/TranslucentTB / LoadableDll

Class LoadableDll

TranslucentTB/loadabledll.hpp:12–33  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10#include "../ProgramLog/error/win32.hpp"
11
12class 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
18public:
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};

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected