Load openssl libs from executable directory and update logging (#5078)
Some checks are pending
Build / Linux (push) Waiting to run
Build / Windows (push) Waiting to run

This commit is contained in:
Knightly 2026-05-07 17:25:01 -10:00 committed by GitHub
parent d7e010a3ec
commit ef6dfe0469
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 23 additions and 6 deletions

View File

@ -37,3 +37,13 @@ target_include_directories(loginserver PRIVATE ..)
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
set_property(TARGET loginserver PROPERTY FOLDER executables/servers)
# vcpkg doesn't copy legacy.dll automatically because it is loaded at runtime, not via the import table.
if(WIN32 AND DEFINED VCPKG_INSTALLED_DIR AND DEFINED VCPKG_TARGET_TRIPLET)
add_custom_command(TARGET loginserver POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"$<IF:$<CONFIG:Debug>,${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/bin/legacy.dll,${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/bin/legacy.dll>"
"$<TARGET_FILE_DIR:loginserver>/legacy.dll"
VERBATIM
)
endif()

View File

@ -182,6 +182,18 @@ static OSSL_PROVIDER *s_default_provider = nullptr;
bool eqcrypt_init()
{
#ifdef EQEMU_USE_OPENSSL
#ifdef _WIN32
// Set OpenSSL default provider search path to the executable directory.
char* exe_path = nullptr;
if (_get_pgmptr(&exe_path) == 0 && exe_path != nullptr && *exe_path != '\0') {
std::string exe_dir{exe_path};
if (auto sep = exe_dir.find_last_of("\\/"); sep != std::string::npos) {
exe_dir.resize(sep);
OSSL_PROVIDER_set_default_search_path(nullptr, exe_dir.c_str());
}
}
#endif
if (!s_default_provider) {
s_default_provider = OSSL_PROVIDER_load(nullptr, "default");
}

View File

@ -159,6 +159,7 @@ void start_web_server()
int main(int argc, char **argv)
{
RegisterExecutablePlatform(ExePlatformLogin);
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
set_exception_handler();
if (!eqcrypt_init()) {
@ -166,12 +167,6 @@ int main(int argc, char **argv)
return 1;
}
LogInfo("Logging System Init");
if (argc == 1) {
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
}
PathManager::Instance()->Init();
// command handler