aboutsummaryrefslogtreecommitdiff
path: root/src/zenhttp/transports/dlltransport.cpp
diff options
context:
space:
mode:
authorTomasz ObrÄ™bski <[email protected]>2025-12-19 18:55:00 +0100
committerGitHub Enterprise <[email protected]>2025-12-19 18:55:00 +0100
commitb01ad05dcf31c131f25438ca7df3708f0ddd47b4 (patch)
tree52b65394418c475fd13312fc46aad3cab0413076 /src/zenhttp/transports/dlltransport.cpp
parentMerge pull request #696 from ue-foundation/zs/limit-overwrite-default (diff)
downloadzen-b01ad05dcf31c131f25438ca7df3708f0ddd47b4.tar.xz
zen-b01ad05dcf31c131f25438ca7df3708f0ddd47b4.zip
Add base port getter and set the dll directory for plugin dependencies (#692)
* Add base port getter and set the dll directory for plugin dependencies * Use UTF8 for dll paths * Rename BasePort to m_BasePort for consistency
Diffstat (limited to 'src/zenhttp/transports/dlltransport.cpp')
-rw-r--r--src/zenhttp/transports/dlltransport.cpp14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/zenhttp/transports/dlltransport.cpp b/src/zenhttp/transports/dlltransport.cpp
index fb3dd23b5..9135d5425 100644
--- a/src/zenhttp/transports/dlltransport.cpp
+++ b/src/zenhttp/transports/dlltransport.cpp
@@ -6,6 +6,7 @@
#include <zencore/fmtutils.h>
#include <zencore/logging.h>
#include <zencore/scopeguard.h>
+#include <zencore/string.h>
#include <exception>
#include <thread>
@@ -177,7 +178,7 @@ DllTransportPluginImpl::LoadDll(std::string_view Name)
{
RwLock::ExclusiveLockScope _(m_Lock);
- ExtendableStringBuilder<1024> DllPath;
+ WideStringBuilder<1024> DllPath;
DllPath << Name;
if (!Name.ends_with(".dll"))
{
@@ -185,12 +186,15 @@ DllTransportPluginImpl::LoadDll(std::string_view Name)
}
std::string FileName = std::filesystem::path(DllPath.c_str()).filename().replace_extension().string();
+ std::string Path = std::filesystem::path(DllPath.c_str()).parent_path().string();
- HMODULE DllHandle = LoadLibraryA(DllPath.c_str());
+ SetDllDirectoryW(Utf8ToWide(Path).c_str());
+
+ HMODULE DllHandle = LoadLibraryW(DllPath.c_str());
if (!DllHandle)
{
- ZEN_WARN("Failed to load transport DLL from '{}' due to '{}'", DllPath, GetLastErrorAsString())
+ ZEN_WARN("Failed to load transport DLL from '{}' due to '{}'", WideToUtf8(DllPath), GetLastErrorAsString())
return false;
}
@@ -216,14 +220,14 @@ DllTransportPluginImpl::LoadDll(std::string_view Name)
if (GetVersion && !bValidApiVersion)
{
ZEN_WARN("Failed to load transport DLL from '{}' due to invalid API version {}, supported API version is {}",
- DllPath,
+ WideToUtf8(DllPath),
APIVersion,
kTransportApiVersion)
}
else
{
ZEN_WARN("Failed to load transport DLL from '{}' due to not finding GetTransportPluginVersion or CreateTransportPlugin",
- DllPath)
+ WideToUtf8(DllPath))
}
return false;