Core/Misc: added support for OpenSSL 3, dropped support for OpenSSL 1.0 and fixed build for Fixed build for MariaDB

This commit is contained in:
Daniel S. Reichenbach authored and Ovahlord committed 2023-07-07 21:01:49 +02:00
1 parent 2c94bf0a16
commit a7527a8698
19 files changed
+267 -213

No files matched your search

+73 -76
View File
@@ -7,15 +7,29 @@ FindOpenSSL
Find the OpenSSL encryption library. Find the OpenSSL encryption library.
This module finds an installed OpenSSL library and determines its version.
.. versionadded:: 3.19
When a version is requested, it can be specified as a simple value or as a
range. For a detailed description of version range usage and capabilities,
refer to the :command:`find_package` command.
.. versionadded:: 3.18
Support for OpenSSL 3.0.
Optional COMPONENTS Optional COMPONENTS
^^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^^
.. versionadded:: 3.12
This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both This module supports two optional COMPONENTS: ``Crypto`` and ``SSL``. Both
components have associated imported targets, as described below. components have associated imported targets, as described below.
Imported Targets Imported Targets
^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^
.. versionadded:: 3.4
This module defines the following :prop_tgt:`IMPORTED` targets: This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenSSL::SSL`` ``OpenSSL::SSL``
@@ -23,6 +37,8 @@ This module defines the following :prop_tgt:`IMPORTED` targets:
``OpenSSL::Crypto`` ``OpenSSL::Crypto``
The OpenSSL ``crypto`` library, if found. The OpenSSL ``crypto`` library, if found.
``OpenSSL::applink`` ``OpenSSL::applink``
.. versionadded:: 3.18
The OpenSSL ``applink`` components that might be need to be compiled into The OpenSSL ``applink`` components that might be need to be compiled into
projects under MSVC. This target is available only if found OpenSSL version projects under MSVC. This target is available only if found OpenSSL version
is not less than 0.9.8. By linking this target the above OpenSSL targets can is not less than 0.9.8. By linking this target the above OpenSSL targets can
@@ -75,12 +91,13 @@ Hints
^^^^^ ^^^^^
Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation. Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#]=======================================================================]
set(OPENSSL_EXPECTED_VERSION "1.0") .. versionadded:: 3.4
set(OPENSSL_MAX_VERSION "1.2") Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
.. versionadded:: 3.5
Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#]=======================================================================]
macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library) macro(_OpenSSL_test_and_find_dependencies ssl_library crypto_library)
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND
@@ -106,6 +123,14 @@ function(_OpenSSL_target_add_dependencies target)
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads ) set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES Threads::Threads )
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} ) set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${CMAKE_DL_LIBS} )
endif() endif()
if(WIN32 AND OPENSSL_USE_STATIC_LIBS)
if(WINCE)
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2 )
else()
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ws2_32 )
endif()
set_property( TARGET ${target} APPEND PROPERTY INTERFACE_LINK_LIBRARIES crypt32 )
endif()
endfunction() endfunction()
if (UNIX) if (UNIX)
@@ -126,42 +151,45 @@ endif()
if (WIN32) if (WIN32)
# http://www.slproweb.com/products/Win32OpenSSL.html # http://www.slproweb.com/products/Win32OpenSSL.html
set(_OPENSSL_MSI_INSTALL_GUID "") set(_OPENSSL_MSI_INSTALL_GUID "")
if(PLATFORM EQUAL 64) set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR}
ENV OPENSSL_ROOT_DIR
)
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8")
set(_arch "Win64")
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
list(APPEND _OPENSSL_ROOT_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]")
set(_OPENSSL_MSI_INSTALL_GUID "117551DB-A110-4BBD-BB05-CFE0BCB3ED31") set(_OPENSSL_MSI_INSTALL_GUID "117551DB-A110-4BBD-BB05-CFE0BCB3ED31")
set(_OPENSSL_ROOT_HINTS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (64-bit)_is1;Inno Setup: App Path]"
${OPENSSL_ROOT_DIR}
ENV OPENSSL_ROOT_DIR
)
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles)
set(_OPENSSL_ROOT_PATHS
"${_programfiles}/OpenSSL"
"${_programfiles}/OpenSSL-Win64"
"C:/OpenSSL/"
"C:/OpenSSL-Win64/"
)
else() else()
set(_OPENSSL_MSI_INSTALL_GUID "A1EEC576-43B9-4E75-9E02-03DA542D2A38") set(_arch "Win32")
set(_OPENSSL_ROOT_HINTS set(_progfiles_x86 "ProgramFiles(x86)")
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]" if(NOT "$ENV{${_progfiles_x86}}" STREQUAL "")
${OPENSSL_ROOT_DIR} # under windows 64 bit machine
ENV OPENSSL_ROOT_DIR file(TO_CMAKE_PATH "$ENV{${_progfiles_x86}}" _programfiles)
) else()
file(TO_CMAKE_PATH "$ENV{PROGRAMFILES}" _programfiles) # under windows 32 bit machine
set(_OPENSSL_ROOT_PATHS file(TO_CMAKE_PATH "$ENV{ProgramFiles}" _programfiles)
"${_programfiles}/OpenSSL"
"${_programfiles}/OpenSSL-Win32"
"C:/OpenSSL/"
"C:/OpenSSL-Win32/"
)
endif() endif()
unset(_programfiles) list(APPEND _OPENSSL_ROOT_HINTS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]")
set(_OPENSSL_MSI_INSTALL_GUID "A1EEC576-43B9-4E75-9E02-03DA542D2A38")
endif()
# If OpenSSL was installed using .msi package instead of .exe, Inno Setup registry values are not written to Uninstall\OpenSSL # If OpenSSL was installed using .msi package instead of .exe, Inno Setup registry values are not written to Uninstall\OpenSSL
# but because it is only a shim around Inno Setup it does write the location of uninstaller which we can use to determine path # but because it is only a shim around Inno Setup it does write the location of uninstaller which we can use to determine path
get_filename_component(_OPENSSL_MSI_INSTALL_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Inno Setup MSIs\\${_OPENSSL_MSI_INSTALL_GUID};]" DIRECTORY) get_filename_component(_OPENSSL_MSI_INSTALL_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Inno Setup MSIs\\${_OPENSSL_MSI_INSTALL_GUID};]" DIRECTORY)
if(NOT _OPENSSL_MSI_INSTALL_PATH STREQUAL "/") if(NOT _OPENSSL_MSI_INSTALL_PATH STREQUAL "/")
list(INSERT _OPENSSL_ROOT_HINTS 0 ${_OPENSSL_MSI_INSTALL_PATH}) list(INSERT _OPENSSL_ROOT_HINTS 2 ${_OPENSSL_MSI_INSTALL_PATH})
endif() endif()
set(_OPENSSL_ROOT_PATHS
"${_programfiles}/OpenSSL"
"${_programfiles}/OpenSSL-${_arch}"
"C:/OpenSSL/"
"C:/OpenSSL-${_arch}/"
)
unset(_programfiles)
unset(_arch)
else () else ()
set(_OPENSSL_ROOT_HINTS set(_OPENSSL_ROOT_HINTS
${OPENSSL_ROOT_DIR} ${OPENSSL_ROOT_DIR}
@@ -169,6 +197,12 @@ else ()
) )
endif () endif ()
if(HOMEBREW_PREFIX)
list(APPEND _OPENSSL_ROOT_HINTS
"${HOMEBREW_PREFIX}/opt/openssl@1.1"
"${HOMEBREW_PREFIX}/opt/openssl@3")
endif()
set(_OPENSSL_ROOT_HINTS_AND_PATHS set(_OPENSSL_ROOT_HINTS_AND_PATHS
HINTS ${_OPENSSL_ROOT_HINTS} HINTS ${_OPENSSL_ROOT_HINTS}
PATHS ${_OPENSSL_ROOT_PATHS} PATHS ${_OPENSSL_ROOT_PATHS}
@@ -210,7 +244,7 @@ if(WIN32 AND NOT CYGWIN)
endif () endif ()
# Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib # Since OpenSSL 1.1, lib names are like libcrypto32MTd.lib and libssl32MTd.lib
if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") if( "${CMAKE_SIZEOF_VOID_P}" STREQUAL "8" )
set(_OPENSSL_MSVC_ARCH_SUFFIX "64") set(_OPENSSL_MSVC_ARCH_SUFFIX "64")
else() else()
set(_OPENSSL_MSVC_ARCH_SUFFIX "32") set(_OPENSSL_MSVC_ARCH_SUFFIX "32")
@@ -421,7 +455,7 @@ else()
${_OPENSSL_LIBDIR} ${_OPENSSL_LIBDIR}
${_OPENSSL_LIBRARY_DIRS} ${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES PATH_SUFFIXES
lib lib lib64
) )
find_library(OPENSSL_CRYPTO_LIBRARY find_library(OPENSSL_CRYPTO_LIBRARY
@@ -433,42 +467,12 @@ else()
${_OPENSSL_LIBDIR} ${_OPENSSL_LIBDIR}
${_OPENSSL_LIBRARY_DIRS} ${_OPENSSL_LIBRARY_DIRS}
PATH_SUFFIXES PATH_SUFFIXES
lib lib lib64
) )
mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY) mark_as_advanced(OPENSSL_CRYPTO_LIBRARY OPENSSL_SSL_LIBRARY)
endif() endif()
function(from_hex HEX DEC)
string(TOUPPER "${HEX}" HEX)
set(_res 0)
string(LENGTH "${HEX}" _strlen)
while (_strlen GREATER 0)
math(EXPR _res "${_res} * 16")
string(SUBSTRING "${HEX}" 0 1 NIBBLE)
string(SUBSTRING "${HEX}" 1 -1 HEX)
if (NIBBLE STREQUAL "A")
math(EXPR _res "${_res} + 10")
elseif (NIBBLE STREQUAL "B")
math(EXPR _res "${_res} + 11")
elseif (NIBBLE STREQUAL "C")
math(EXPR _res "${_res} + 12")
elseif (NIBBLE STREQUAL "D")
math(EXPR _res "${_res} + 13")
elseif (NIBBLE STREQUAL "E")
math(EXPR _res "${_res} + 14")
elseif (NIBBLE STREQUAL "F")
math(EXPR _res "${_res} + 15")
else()
math(EXPR _res "${_res} + ${NIBBLE}")
endif()
string(LENGTH "${HEX}" _strlen)
endwhile()
set(${DEC} ${_res} PARENT_SCOPE)
endfunction(from_hex)
set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY}) set(OPENSSL_SSL_LIBRARIES ${OPENSSL_SSL_LIBRARY})
set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY}) set(OPENSSL_CRYPTO_LIBRARIES ${OPENSSL_CRYPTO_LIBRARY})
@@ -532,7 +536,7 @@ if(OPENSSL_INCLUDE_DIR AND EXISTS "${OPENSSL_INCLUDE_DIR}/openssl/opensslv.h")
from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX) from_hex("${OPENSSL_VERSION_FIX}" OPENSSL_VERSION_FIX)
list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH) list(GET OPENSSL_VERSION_LIST 3 OPENSSL_VERSION_PATCH)
if(NOT OPENSSL_VERSION_PATCH STREQUAL "00") if (NOT OPENSSL_VERSION_PATCH STREQUAL "00")
from_hex("${OPENSSL_VERSION_PATCH}" _tmp) from_hex("${OPENSSL_VERSION_PATCH}" _tmp)
# 96 is the ASCII code of 'a' minus 1 # 96 is the ASCII code of 'a' minus 1
math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96") math(EXPR OPENSSL_VERSION_PATCH_ASCII "${_tmp} + 96")
@@ -593,6 +597,7 @@ find_package_handle_standard_args(OpenSSL
OPENSSL_INCLUDE_DIR OPENSSL_INCLUDE_DIR
VERSION_VAR VERSION_VAR
OPENSSL_VERSION OPENSSL_VERSION
HANDLE_VERSION_RANGE
HANDLE_COMPONENTS HANDLE_COMPONENTS
FAIL_MESSAGE FAIL_MESSAGE
"Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR" "Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the system variable OPENSSL_ROOT_DIR"
@@ -601,14 +606,6 @@ find_package_handle_standard_args(OpenSSL
mark_as_advanced(OPENSSL_INCLUDE_DIR) mark_as_advanced(OPENSSL_INCLUDE_DIR)
if(OPENSSL_FOUND) if(OPENSSL_FOUND)
message(STATUS "Found OpenSSL library: ${OPENSSL_LIBRARIES}")
message(STATUS "Found OpenSSL headers: ${OPENSSL_INCLUDE_DIR}")
include(EnsureVersion)
ENSURE_VERSION_RANGE("${OPENSSL_EXPECTED_VERSION}" "${OPENSSL_VERSION}" "${OPENSSL_MAX_VERSION}" OPENSSL_VERSION_OK)
if(NOT OPENSSL_VERSION_OK)
message(FATAL_ERROR "TrinityCore needs OpenSSL version ${OPENSSL_EXPECTED_VERSION} but found too new version ${OPENSSL_VERSION}. TrinityCore needs OpenSSL 1.0.x or 1.1.x to work properly. If you still have problems please install OpenSSL 1.0.x if you still have problems search on forum for TCE00022")
endif()
if(NOT TARGET OpenSSL::Crypto AND if(NOT TARGET OpenSSL::Crypto AND
(EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR (EXISTS "${OPENSSL_CRYPTO_LIBRARY}" OR
EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR EXISTS "${LIB_EAY_LIBRARY_DEBUG}" OR
@@ -673,7 +670,7 @@ if(OPENSSL_FOUND)
_OpenSSL_target_add_dependencies(OpenSSL::SSL) _OpenSSL_target_add_dependencies(OpenSSL::SSL)
endif() endif()
if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8") if("${OPENSSL_VERSION_MAJOR}.${OPENSSL_VERSION_MINOR}.${OPENSSL_VERSION_FIX}" VERSION_GREATER_EQUAL "0.9.8")
if(MSVC) if(MSVC)
if(EXISTS "${OPENSSL_INCLUDE_DIR}") if(EXISTS "${OPENSSL_INCLUDE_DIR}")
set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR}) set(_OPENSSL_applink_paths PATHS ${OPENSSL_INCLUDE_DIR})
+38 -33
View File
@@ -1,16 +1,21 @@
TrinityCore uses (parts of or in whole) the following opensource software: TrinityCore uses (parts of or in whole) the following opensource software:
Boost (external) argon2
http://www.boost.org https://github.com/P-H-C/phc-winner-argon2
Version: 1.55 Version: 62358ba
Boost Process (Proposed for boost, but its not an official part of it yet. Used to start child processes.) Boost (a set of C++ libraries)
http://www.highscore.de/boost/process0.5/ http://www.boost.org
Version: 0.5 Version: external
bzip2 (a freely available, patent free, high-quality data compressor) bzip2 (a freely available, patent free, high-quality data compressor)
http://www.bzip.org/ http://www.bzip.org/
Version: 1.0.6 Version: 1.0.6
catch2
https://github.com/catchorg/Catch2
Version: v2.13.0
efws (Entropia File System Watcher - crossplatform file system watcher) efws (Entropia File System Watcher - crossplatform file system watcher)
https://bitbucket.org/SpartanJ/efsw https://bitbucket.org/SpartanJ/efsw
Version: 1.0.0 e6afbec564e249771046c714b0c7f2154e4c7fef Version: 1.0.0 e6afbec564e249771046c714b0c7f2154e4c7fef
@@ -23,33 +28,37 @@ G3D (a commercial-grade C++ 3D engine available as Open Source (BSD License)
http://g3d.sourceforge.net/ http://g3d.sourceforge.net/
Version: 9.0-Release r4036 Version: 9.0-Release r4036
gSOAP (a portable development toolkit for C and C++ XML Web services and XML data bindings)
http://gsoap2.sourceforge.net/
Version: 2.8.117
jemalloc (a general-purpose scalable concurrent malloc-implementation) jemalloc (a general-purpose scalable concurrent malloc-implementation)
http://www.canonware.com/jemalloc/ http://www.canonware.com/jemalloc/
Version: 5.2.1 Version: 5.2.1
libreadline (command line editing library) libMPQ (a library for reading MPQ files)
https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html https://github.com/mbroemme/libmpq/
Version: d59b4cf1d107b5f6a0f67d6bc545c6c6ebef3d74
libzmq (ZeroMQ core engine in C++, implements ZMTP/3.1)
https://github.com/zeromq/libzmq
Version: 4.2.3 stable
MariaDB:
https://mariadb.org/
Version: external Version: external
OpenSSL (general-purpose cryptography library) OpenSSL (general-purpose cryptography library)
https://www.openssl.org/ https://www.openssl.org/
Version: external Version: external
SFMT (SIMD-oriented Fast Mersenne Twister) rapidjson (A fast JSON parser/generator for C++ with both SAX/DOM style API http://rapidjson.org/)
https://github.com/MersenneTwister-Lab/SFMT https://github.com/Tencent/rapidjson
Version: 73bcba2e483640b8d50c1275514326dd4c1b0ca4 Version: 27c3a8dc0e2c9218fe94986d249a12b5ed838f1d
utf8-cpp (UTF-8 with C++ in a Portable Way) readline (command line editing library)
http://utfcpp.sourceforge.net/ https://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Version: 2.3.4 Version: external
zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library)
http://www.zlib.net/
Version: 1.2.12
gSOAP (a portable development toolkit for C and C++ XML Web services and XML data bindings)
http://gsoap2.sourceforge.net/
Version: 2.8.117
recastnavigation (Recast is state of the art navigation mesh construction toolset for games) recastnavigation (Recast is state of the art navigation mesh construction toolset for games)
https://github.com/recastnavigation/recastnavigation https://github.com/recastnavigation/recastnavigation
@@ -60,18 +69,14 @@ StormLib (a pack of modules, written in C++, which are able to read and also to
http://www.zezula.net/en/mpq/stormlib.html http://www.zezula.net/en/mpq/stormlib.html
Version: 8.04 Version: 8.04
libzmq (ZeroMQ core engine in C++, implements ZMTP/3.1) utf8-cpp (UTF-8 with C++ in a Portable Way)
https://github.com/zeromq/libzmq http://utfcpp.sourceforge.net/
Version: 4.2.3 stable Version: 2.3.4
zlib (A Massively Spiffy Yet Delicately Unobtrusive Compression Library)
http://www.zlib.net/
Version: 1.2.12
zmqpp (C++ binding for 0mq/zmq is a 'high-level' library that hides most of the c-style interface core 0mq provides.) zmqpp (C++ binding for 0mq/zmq is a 'high-level' library that hides most of the c-style interface core 0mq provides.)
https://github.com/zeromq/zmqpp https://github.com/zeromq/zmqpp
Version: 3.2.0 17e9f6afa98f56ecac1e3f3eecbfc112357a6732 Version: 3.2.0 17e9f6afa98f56ecac1e3f3eecbfc112357a6732
rapidjson (A fast JSON parser/generator for C++ with both SAX/DOM style API http://rapidjson.org/)
https://github.com/Tencent/rapidjson
Version: 27c3a8dc0e2c9218fe94986d249a12b5ed838f1d
catch2
https://github.com/catchorg/Catch2
Version: v2.13.0
+1 -7
View File
@@ -18,15 +18,9 @@ target_include_directories(gsoap
PUBLIC PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}) ${CMAKE_CURRENT_SOURCE_DIR})
target_compile_definitions(gsoap
PUBLIC
-DWITH_OPENSSL)
target_link_libraries(gsoap target_link_libraries(gsoap
PRIVATE PRIVATE
trinity-dependency-interface trinity-dependency-interface)
PUBLIC
openssl)
set_target_properties(gsoap set_target_properties(gsoap
PROPERTIES PROPERTIES
+1 -3
View File
@@ -11,9 +11,7 @@
# basic packagesearching and setup # basic packagesearching and setup
# (further support will be needed, this is a preliminary release!) # (further support will be needed, this is a preliminary release!)
set(OPENSSL_EXPECTED_VERSION 1.0.0) find_package(OpenSSL 1.1 REQUIRED COMPONENTS Crypto SSL)
find_package(OpenSSL REQUIRED COMPONENTS Crypto SSL)
add_library(openssl INTERFACE) add_library(openssl INTERFACE)
+1 -1
View File
@@ -30,7 +30,7 @@ class TC_COMMON_API ConfigMgr
~ConfigMgr() = default; ~ConfigMgr() = default;
public: public:
/// Method used only for loading main configuration files (authserver.conf and worldserver.conf) /// Method used only for loading main configuration files (bnetserver.conf and worldserver.conf)
bool LoadInitial(std::string const& file, std::vector<std::string> args, std::string& error); bool LoadInitial(std::string const& file, std::vector<std::string> args, std::string& error);
static ConfigMgr* instance(); static ConfigMgr* instance();
+30 -13
View File
@@ -16,35 +16,52 @@
*/ */
#include "ARC4.h" #include "ARC4.h"
#include "Errors.h"
ARC4::ARC4(uint32 len) : m_ctx(EVP_CIPHER_CTX_new()) ARC4::ARC4(uint32 len) : _ctx(EVP_CIPHER_CTX_new())
{ {
EVP_CIPHER_CTX_init(m_ctx); #if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); _cipher = EVP_CIPHER_fetch(nullptr, "RC4", nullptr);
EVP_CIPHER_CTX_set_key_length(m_ctx, len); #else
EVP_CIPHER const *_cipher = EVP_rc4();
#endif
EVP_CIPHER_CTX_init(_ctx);
EVP_EncryptInit_ex(_ctx, EVP_rc4(), nullptr, nullptr, nullptr);
EVP_CIPHER_CTX_set_key_length(_ctx, len);
} }
ARC4::ARC4(uint8* seed, uint32 len) : m_ctx(EVP_CIPHER_CTX_new()) ARC4::ARC4(uint8* seed, uint32 len) : _ctx(EVP_CIPHER_CTX_new())
{ {
EVP_CIPHER_CTX_init(m_ctx); #if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_EncryptInit_ex(m_ctx, EVP_rc4(), nullptr, nullptr, nullptr); _cipher = EVP_CIPHER_fetch(nullptr, "RC4", nullptr);
EVP_CIPHER_CTX_set_key_length(m_ctx, len); #else
EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr); EVP_CIPHER const *_cipher = EVP_rc4();
#endif
EVP_CIPHER_CTX_init(_ctx);
EVP_EncryptInit_ex(_ctx, EVP_rc4(), nullptr, nullptr, nullptr);
EVP_CIPHER_CTX_set_key_length(_ctx, len);
EVP_EncryptInit_ex(_ctx, nullptr, nullptr, seed, nullptr);
} }
ARC4::~ARC4() ARC4::~ARC4()
{ {
EVP_CIPHER_CTX_free(m_ctx); EVP_CIPHER_CTX_free(_ctx);
#if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_CIPHER_free(_cipher);
#endif
} }
void ARC4::Init(uint8* seed) void ARC4::Init(uint8* seed)
{ {
EVP_EncryptInit_ex(m_ctx, nullptr, nullptr, seed, nullptr); EVP_EncryptInit_ex(_ctx, nullptr, nullptr, seed, nullptr);
} }
void ARC4::UpdateData(int len, uint8* data) void ARC4::UpdateData(int len, uint8* data)
{ {
int outlen = 0; int outlen = 0;
EVP_EncryptUpdate(m_ctx, data, &outlen, data, len); EVP_EncryptUpdate(_ctx, data, &outlen, data, len);
EVP_EncryptFinal_ex(m_ctx, data, &outlen); EVP_EncryptFinal_ex(_ctx, data, &outlen);
} }
+5 -1
View File
@@ -19,6 +19,7 @@
#define _AUTH_SARC4_H #define _AUTH_SARC4_H
#include "Define.h" #include "Define.h"
#include <array>
#include <openssl/evp.h> #include <openssl/evp.h>
class TC_COMMON_API ARC4 class TC_COMMON_API ARC4
@@ -30,7 +31,10 @@ class TC_COMMON_API ARC4
void Init(uint8* seed); void Init(uint8* seed);
void UpdateData(int len, uint8* data); void UpdateData(int len, uint8* data);
private: private:
EVP_CIPHER_CTX* m_ctx; #if OPENSSL_VERSION_NUMBER >= 0x30000000L
EVP_CIPHER *_cipher;
#endif
EVP_CIPHER_CTX* _ctx;
}; };
#endif #endif
+18 -41
View File
@@ -18,51 +18,28 @@
#include "OpenSSLCrypto.h" #include "OpenSSLCrypto.h"
#include <openssl/crypto.h> #include <openssl/crypto.h>
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL #if OPENSSL_VERSION_NUMBER >= 0x30000000L
#include <vector> #include <openssl/provider.h>
#include <thread> OSSL_PROVIDER* LegacyProvider;
#include <mutex> OSSL_PROVIDER* DefaultProvider;
#endif
std::vector<std::mutex*> cryptoLocks; void OpenSSLCrypto::threadsSetup([[maybe_unused]] boost::filesystem::path const &providerModulePath)
static void lockingCallback(int mode, int type, char const* /*file*/, int /*line*/)
{ {
if (mode & CRYPTO_LOCK) #if OPENSSL_VERSION_NUMBER >= 0x30000000L
cryptoLocks[type]->lock(); #if TRINITY_PLATFORM == TRINITY_PLATFORM_WINDOWS
else OSSL_PROVIDER_set_default_search_path(nullptr, providerModulePath.string().c_str());
cryptoLocks[type]->unlock(); #endif
} LegacyProvider = OSSL_PROVIDER_load(nullptr, "legacy");
DefaultProvider = OSSL_PROVIDER_load(nullptr, "default");
static void threadIdCallback(CRYPTO_THREADID* id) #endif
{
(void)id;
CRYPTO_THREADID_set_numeric(id, std::hash<std::thread::id>()(std::this_thread::get_id()));
}
void OpenSSLCrypto::threadsSetup()
{
cryptoLocks.resize(CRYPTO_num_locks());
for(int i = 0 ; i < CRYPTO_num_locks(); ++i)
{
cryptoLocks[i] = new std::mutex();
}
(void)&threadIdCallback;
CRYPTO_THREADID_set_callback(threadIdCallback);
(void)&lockingCallback;
CRYPTO_set_locking_callback(lockingCallback);
} }
void OpenSSLCrypto::threadsCleanup() void OpenSSLCrypto::threadsCleanup()
{ {
CRYPTO_set_locking_callback(nullptr); #if OPENSSL_VERSION_NUMBER >= 0x30000000L
CRYPTO_THREADID_set_callback(nullptr); OSSL_PROVIDER_unload(LegacyProvider);
for(int i = 0 ; i < CRYPTO_num_locks(); ++i) OSSL_PROVIDER_unload(DefaultProvider);
{ OSSL_PROVIDER_set_default_search_path(nullptr, nullptr);
delete cryptoLocks[i];
}
cryptoLocks.resize(0);
}
#endif #endif
}
+2 -8
View File
@@ -19,7 +19,7 @@
#define TRINITY_OPENSSL_CRYPTO_H #define TRINITY_OPENSSL_CRYPTO_H
#include "Define.h" #include "Define.h"
#include <openssl/opensslv.h> #include <boost/filesystem/path.hpp>
/** /**
* A group of functions which setup openssl crypto module to work properly in multithreaded enviroment * A group of functions which setup openssl crypto module to work properly in multithreaded enviroment
@@ -27,16 +27,10 @@
*/ */
namespace OpenSSLCrypto namespace OpenSSLCrypto
{ {
#if defined(OPENSSL_VERSION_NUMBER) && OPENSSL_VERSION_NUMBER < 0x1010000fL
/// Needs to be called before threads using openssl are spawned /// Needs to be called before threads using openssl are spawned
TC_COMMON_API void threadsSetup(); TC_COMMON_API void threadsSetup(boost::filesystem::path const& providerModulePath);
/// Needs to be called after threads using openssl are despawned /// Needs to be called after threads using openssl are despawned
TC_COMMON_API void threadsCleanup(); TC_COMMON_API void threadsCleanup();
#else
void threadsSetup() { };
void threadsCleanup() { };
#endif
} }
#endif #endif
+30 -6
View File
@@ -23,18 +23,41 @@
SHA1Hash::SHA1Hash() SHA1Hash::SHA1Hash()
{ {
SHA1_Init(&mC); m_ctx = EVP_MD_CTX_new();
memset(mDigest, 0, SHA_DIGEST_LENGTH * sizeof(uint8)); EVP_DigestInit_ex(m_ctx, EVP_sha1(), nullptr);
}
SHA1Hash::SHA1Hash(const SHA1Hash &other) : SHA1Hash() // copy
{
EVP_MD_CTX_copy_ex(m_ctx, other.m_ctx);
std::memcpy(m_digest, other.m_digest, SHA_DIGEST_LENGTH);
}
SHA1Hash::SHA1Hash(SHA1Hash &&other) : SHA1Hash() // move
{
Swap(other);
}
SHA1Hash &SHA1Hash::operator=(SHA1Hash other) // assign
{
Swap(other);
return *this;
} }
SHA1Hash::~SHA1Hash() SHA1Hash::~SHA1Hash()
{ {
SHA1_Init(&mC); EVP_MD_CTX_free(m_ctx);
}
void SHA1Hash::Swap(SHA1Hash &other) throw()
{
std::swap(m_ctx, other.m_ctx);
std::swap(m_digest, other.m_digest);
} }
void SHA1Hash::UpdateData(const uint8 *dta, int len) void SHA1Hash::UpdateData(const uint8 *dta, int len)
{ {
SHA1_Update(&mC, dta, len); EVP_DigestUpdate(m_ctx, dta, len);
} }
void SHA1Hash::UpdateData(const std::string &str) void SHA1Hash::UpdateData(const std::string &str)
@@ -59,12 +82,13 @@ void SHA1Hash::UpdateBigNumbers(BigNumber* bn0, ...)
void SHA1Hash::Initialize() void SHA1Hash::Initialize()
{ {
SHA1_Init(&mC); EVP_DigestInit(m_ctx, EVP_sha1());
} }
void SHA1Hash::Finalize(void) void SHA1Hash::Finalize(void)
{ {
SHA1_Final(mDigest, &mC); uint32 length = SHA_DIGEST_LENGTH;
EVP_DigestFinal_ex(m_ctx, m_digest, &length);
} }
std::string CalculateSHA1Hash(std::string const& content) std::string CalculateSHA1Hash(std::string const& content)
+11 -4
View File
@@ -21,6 +21,7 @@
#include "Define.h" #include "Define.h"
#include <string> #include <string>
#include <openssl/sha.h> #include <openssl/sha.h>
#include <openssl/evp.h>
class BigNumber; class BigNumber;
@@ -28,8 +29,14 @@ class TC_COMMON_API SHA1Hash
{ {
public: public:
SHA1Hash(); SHA1Hash();
SHA1Hash(SHA1Hash const &other); // copy
SHA1Hash(SHA1Hash &&other); // move
SHA1Hash &operator=(SHA1Hash other); // assign
~SHA1Hash(); ~SHA1Hash();
void Swap(SHA1Hash &other) throw();
friend void Swap(SHA1Hash &left, SHA1Hash &right) { left.Swap(right); }
void UpdateBigNumbers(BigNumber* bn0, ...); void UpdateBigNumbers(BigNumber* bn0, ...);
void UpdateData(const uint8 *dta, int len); void UpdateData(const uint8 *dta, int len);
@@ -38,12 +45,12 @@ class TC_COMMON_API SHA1Hash
void Initialize(); void Initialize();
void Finalize(); void Finalize();
uint8 *GetDigest(void) { return mDigest; } uint8 *GetDigest(void) { return m_digest; }
int GetLength(void) const { return SHA_DIGEST_LENGTH; } int GetLength() const { return SHA_DIGEST_LENGTH; }
private: private:
SHA_CTX mC; EVP_MD_CTX *m_ctx;
uint8 mDigest[SHA_DIGEST_LENGTH]; uint8 m_digest[SHA_DIGEST_LENGTH];
}; };
/// Returns the SHA1 hash of the given content as hex string. /// Returns the SHA1 hash of the given content as hex string.
+10 -1
View File
@@ -35,13 +35,18 @@
#include "IoContext.h" #include "IoContext.h"
#include "MySQLThreading.h" #include "MySQLThreading.h"
#include "ModuleManager.h" #include "ModuleManager.h"
#include "OpenSSLCrypto.h"
#include "ProcessPriority.h" #include "ProcessPriority.h"
#include "SessionManager.h" #include "SessionManager.h"
#include "Util.h" #include "Util.h"
#include "ZmqContext.h" #include "ZmqContext.h"
#include <boost/asio/signal_set.hpp> #include <boost/asio/signal_set.hpp>
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
#include <openssl/provider.h>
#endif
#include <csignal> #include <csignal>
#include <iostream> #include <iostream>
@@ -119,11 +124,15 @@ int main(int argc, char** argv)
[]() []()
{ {
TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str()); TC_LOG_INFO("server.bnetserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); TC_LOG_INFO("server.bnetserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION));
TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); TC_LOG_INFO("server.bnetserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
} }
); );
OpenSSLCrypto::threadsSetup(boost::dll::program_location().remove_filename());
std::shared_ptr<void> opensslHandle(nullptr, [](void*) { OpenSSLCrypto::threadsCleanup(); });
// Seed the OpenSSL's PRNG here. // Seed the OpenSSL's PRNG here.
// That way it won't auto-seed when calling BigNumber::SetRand and slow down the first world login // That way it won't auto-seed when calling BigNumber::SetRand and slow down the first world login
BigNumber seed; BigNumber seed;
@@ -108,7 +108,7 @@ void BNetRealmList::UpdateRealms(boost::system::error_code const& error)
if (error) if (error)
return; return;
TC_LOG_DEBUG("server.authserver", "Updating Realm List..."); TC_LOG_DEBUG("server.bnetserver", "Updating Realm List...");
LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST); LoginDatabasePreparedStatement* stmt = LoginDatabase.GetPreparedStatement(LOGIN_SEL_REALMLIST);
PreparedQueryResult result = LoginDatabase.Query(stmt); PreparedQueryResult result = LoginDatabase.Query(stmt);
+1 -1
View File
@@ -180,7 +180,7 @@ void Battlenet::Session::HandleLogonRequest(Authentication::LogonRequest const&
else else
logonResponse->SetAuthResult(AUTH_USE_GRUNT_LOGON); logonResponse->SetAuthResult(AUTH_USE_GRUNT_LOGON);
TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component version %u!", GetClientInfo().c_str(), component.Build); TC_LOG_DEBUG("session", "[Battlenet::LogonRequest] %s is using unsupported component %s version %u!", GetClientInfo().c_str(), component.Program.c_str(), component.Build);
} }
AsyncWrite(logonResponse); AsyncWrite(logonResponse);
@@ -35,8 +35,15 @@
#include "MySQLWorkaround.h" #include "MySQLWorkaround.h"
#include <mysqld_error.h> #include <mysqld_error.h>
#define MIN_MYSQL_SERVER_VERSION 50100u #define MIN_MYSQL_SERVER_VERSION 50700u
#define MIN_MYSQL_CLIENT_VERSION 50100u #define MIN_MYSQL_SERVER_VERSION_STRING "5.7"
#define MIN_MYSQL_CLIENT_VERSION 50700u
#define MIN_MYSQL_CLIENT_VERSION_STRING "5.7"
#define MIN_MARIADB_SERVER_VERSION 100209u
#define MIN_MARIADB_SERVER_VERSION_STRING "10.2.9"
#define MIN_MARIADB_CLIENT_VERSION 30003u
#define MIN_MARIADB_CLIENT_VERSION_STRING "3.0.3"
class PingOperation : public SQLOperation class PingOperation : public SQLOperation
{ {
@@ -54,9 +61,14 @@ DatabaseWorkerPool<T>::DatabaseWorkerPool()
_async_threads(0), _synch_threads(0) _async_threads(0), _synch_threads(0)
{ {
WPFatal(mysql_thread_safe(), "Used MySQL library isn't thread-safe."); WPFatal(mysql_thread_safe(), "Used MySQL library isn't thread-safe.");
WPFatal(mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below 5.1");
WPFatal(mysql_get_client_version() == MYSQL_VERSION_ID, "Used MySQL library version (%s id %lu) does not match the version id used to compile TrinityCore (id %u). Search on forum for TCE00011.", #if defined(LIBMARIADB) && MARIADB_PACKAGE_VERSION_ID >= 30200
mysql_get_client_info(), mysql_get_client_version(), MYSQL_VERSION_ID); WPFatal(mysql_get_client_version() >= MIN_MARIADB_CLIENT_VERSION, "TrinityCore does not support MariaDB versions below " MIN_MARIADB_CLIENT_VERSION_STRING " (found %s id %lu, need id >= %u), please update your MariaDB client library", mysql_get_client_info(), mysql_get_client_version(), MIN_MARIADB_CLIENT_VERSION);
WPFatal(mysql_get_client_version() == MARIADB_PACKAGE_VERSION_ID, "Used MariaDB library version (%s id %lu) does not match the version id used to compile TrinityCore (id %u). Search on forum for TCE00011.", mysql_get_client_info(), mysql_get_client_version(), MARIADB_PACKAGE_VERSION_ID);
#else
WPFatal(mysql_get_client_version() >= MIN_MYSQL_CLIENT_VERSION, "TrinityCore does not support MySQL versions below " MIN_MYSQL_CLIENT_VERSION_STRING " (found %s id %lu, need id >= %u), please update your MySQL client library", mysql_get_client_info(), mysql_get_client_version(), MIN_MYSQL_CLIENT_VERSION);
WPFatal(mysql_get_client_version() == MYSQL_VERSION_ID, "Used MySQL library version (%s id %lu) does not match the version id used to compile TrinityCore (id %u). Search on forum for TCE00011.", mysql_get_client_info(), mysql_get_client_version(), MYSQL_VERSION_ID);
#endif
} }
template <class T> template <class T>
@@ -380,9 +392,17 @@ uint32 DatabaseWorkerPool<T>::OpenConnections(InternalIndex type, uint8 numConne
_connections[type].clear(); _connections[type].clear();
return error; return error;
} }
#ifndef LIBMARIADB
else if (connection->GetServerVersion() < MIN_MYSQL_SERVER_VERSION) else if (connection->GetServerVersion() < MIN_MYSQL_SERVER_VERSION)
#else
else if (connection->GetServerVersion() < MIN_MARIADB_SERVER_VERSION)
#endif
{ {
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below 5.1"); #ifndef LIBMARIADB
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MySQL versions below " MIN_MYSQL_SERVER_VERSION_STRING " (found id %u, need id >= %u), please update your MySQL server", connection->GetServerVersion(), MIN_MYSQL_SERVER_VERSION);
#else
TC_LOG_ERROR("sql.driver", "TrinityCore does not support MariaDB versions below " MIN_MARIADB_SERVER_VERSION_STRING " (found id %u, need id >= %u), please update your MySQL server", connection->GetServerVersion(), MIN_MARIADB_SERVER_VERSION);
#endif
return 1; return 1;
} }
else else
+5 -4
View File
@@ -80,10 +80,11 @@ ClientWardenModule* WardenMac::GetModuleForClient()
memcpy(mod->Key, Module_0DBBF209A27B1E279A9FEC5C168A15F7_Key, 16); memcpy(mod->Key, Module_0DBBF209A27B1E279A9FEC5C168A15F7_Key, 16);
// md5 hash // md5 hash
MD5_CTX ctx; EVP_MD_CTX *md5 = EVP_MD_CTX_new();
MD5_Init(&ctx); EVP_DigestInit_ex(md5, EVP_md5(), nullptr);
MD5_Update(&ctx, mod->CompressedData, len); EVP_DigestUpdate(md5, mod->CompressedData, len);
MD5_Final((uint8*)&mod->Id, &ctx); EVP_DigestFinal_ex(md5, (uint8 *)&mod->Id, &len);
EVP_MD_CTX_free(md5);
return mod; return mod;
} }
+5 -4
View File
@@ -76,10 +76,11 @@ ClientWardenModule* WardenWin::GetModuleForClient()
memcpy(mod->Key, Module.ModuleKey, 16); memcpy(mod->Key, Module.ModuleKey, 16);
// md5 hash // md5 hash
MD5_CTX ctx; EVP_MD_CTX *md5 = EVP_MD_CTX_new();
MD5_Init(&ctx); EVP_DigestInit_ex(md5, EVP_md5(), nullptr);
MD5_Update(&ctx, mod->CompressedData, length); EVP_DigestUpdate(md5, mod->CompressedData, length);
MD5_Final((uint8*)&mod->Id, &ctx); EVP_DigestFinal_ex(md5, (uint8 *)&mod->Id, &length);
EVP_MD_CTX_free(md5);
return mod; return mod;
} }
+7 -3
View File
@@ -53,8 +53,12 @@
#include "WorldSocket.h" #include "WorldSocket.h"
#include "WorldSocketMgr.h" #include "WorldSocketMgr.h"
#include "ZmqContext.h" #include "ZmqContext.h"
#include <openssl/opensslv.h>
#include <openssl/crypto.h> #include <openssl/crypto.h>
#include <openssl/opensslv.h>
#if defined(OPENSSL_VERSION_MAJOR) && (OPENSSL_VERSION_MAJOR >= 3)
#include <openssl/provider.h>
#endif
#include <boost/dll/runtime_symbol_info.hpp>
#include <boost/asio/signal_set.hpp> #include <boost/asio/signal_set.hpp>
#include <boost/filesystem/operations.hpp> #include <boost/filesystem/operations.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
@@ -207,12 +211,12 @@ extern int main(int argc, char** argv)
[]() []()
{ {
TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str()); TC_LOG_INFO("server.worldserver", "Using configuration file %s.", sConfigMgr->GetFilename().c_str());
TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, SSLeay_version(SSLEAY_VERSION)); TC_LOG_INFO("server.worldserver", "Using SSL version: %s (library: %s)", OPENSSL_VERSION_TEXT, OpenSSL_version(OPENSSL_VERSION));
TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100); TC_LOG_INFO("server.worldserver", "Using Boost version: %i.%i.%i", BOOST_VERSION / 100000, BOOST_VERSION / 100 % 1000, BOOST_VERSION % 100);
} }
); );
OpenSSLCrypto::threadsSetup(); OpenSSLCrypto::threadsSetup(boost::dll::program_location().remove_filename());
std::shared_ptr<void> opensslHandle(nullptr, [](void*) { OpenSSLCrypto::threadsCleanup(); }); std::shared_ptr<void> opensslHandle(nullptr, [](void*) { OpenSSLCrypto::threadsCleanup(); });
+2
View File
@@ -258,6 +258,8 @@ int main(int argc, char** argv)
#ifdef _WIN32 #ifdef _WIN32
wchar_t* commonAppData(nullptr); wchar_t* commonAppData(nullptr);
SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, &commonAppData); SHGetKnownFolderPath(FOLDERID_ProgramData, 0, nullptr, &commonAppData);
#else
const wchar_t* commonAppData(L".");
#endif #endif
std::cout << "Creating patched binary..." << std::endl; std::cout << "Creating patched binary..." << std::endl;