diff --git a/src/tools/connection_patcher/CMakeLists.txt b/src/tools/connection_patcher/CMakeLists.txt
index 8867ec5170b..2c3189adb39 100644
--- a/src/tools/connection_patcher/CMakeLists.txt
+++ b/src/tools/connection_patcher/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Copyright (C) 2008-2014 TrinityCore
+# Copyright (C) 2008-2019 TrinityCore
#
# This file is free software; as a special exception the author gives
# unlimited permission to copy and/or distribute it, with or without
@@ -8,37 +8,21 @@
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-include_directories(
- ${CMAKE_SOURCE_DIR}
- ${CMAKE_SOURCE_DIR}/src/server/shared
- ${CMAKE_SOURCE_DIR}/src/server/shared/Cryptography
- ${CMAKE_SOURCE_DIR}/src/server/shared/Debugging
- ${CMAKE_SOURCE_DIR}/src/server/shared/Utilities
- ${OPENSSL_INCLUDE_DIR}
-)
+CollectSourceFiles(${CMAKE_CURRENT_SOURCE_DIR} PRIVATE_SOURCES)
-set(HEADER_FILES
- Helper.hpp
- Patcher.hpp
- Constants/BinaryTypes.hpp
- Patches/Mac.hpp
- Patches/Windows.hpp
- Patterns/Mac.hpp
- Patterns/Windows.hpp
-)
+if (WIN32)
+ list(APPEND PRIVATE_SOURCES ${sources_windows})
+endif()
-set(SRC_FILES
- Helper.cpp
- Patcher.cpp
- Program.cpp
-)
+GroupSources(${CMAKE_CURRENT_SOURCE_DIR})
-add_executable(connection_patcher ${HEADER_FILES} ${SRC_FILES})
+add_executable(connection_patcher ${PRIVATE_SOURCES})
target_link_libraries(connection_patcher
- shared
- ${OPENSSL_LIBRARIES}
- ${Boost_LIBRARIES}
+ PRIVATE
+ trinity-core-interface
+ PUBLIC
+ common
)
if (UNIX)
diff --git a/src/tools/connection_patcher/Patches/Mac.hpp b/src/tools/connection_patcher/Patches/Mac.hpp
index 70571ae3d25..9ce33b46d42 100644
--- a/src/tools/connection_patcher/Patches/Mac.hpp
+++ b/src/tools/connection_patcher/Patches/Mac.hpp
@@ -30,8 +30,6 @@ namespace Connection_Patcher
struct x86
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { 0x0F, 0x85 }; }
static const std::vector Signature() { return { }; }
};
@@ -39,8 +37,6 @@ namespace Connection_Patcher
struct x64
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { 0x0F, 0x85 }; }
static const std::vector Signature() { return { }; }
};
diff --git a/src/tools/connection_patcher/Patches/Windows.hpp b/src/tools/connection_patcher/Patches/Windows.hpp
index a7d5d1edb6d..7a975a8725f 100644
--- a/src/tools/connection_patcher/Patches/Windows.hpp
+++ b/src/tools/connection_patcher/Patches/Windows.hpp
@@ -30,8 +30,6 @@ namespace Connection_Patcher
struct x86
{
static const std::vector BNet() { return { 0x89, 0x48, 0x08, 0xC7, 0x40, 0x0C, 0xD5, 0xF8, 0x7F, 0x82, 0x90 }; }
- static const std::vector Portal() { return { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { 0x75 }; }
static const std::vector Signature() { return { 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0x90, 0xE9 }; }
};
@@ -39,8 +37,6 @@ namespace Connection_Patcher
struct x64
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { 0x75 }; }
static const std::vector Signature() { return { }; }
};
diff --git a/src/tools/connection_patcher/Patterns/Mac.hpp b/src/tools/connection_patcher/Patterns/Mac.hpp
index bb74c2b0905..c2a2d3e59d7 100644
--- a/src/tools/connection_patcher/Patterns/Mac.hpp
+++ b/src/tools/connection_patcher/Patterns/Mac.hpp
@@ -30,8 +30,6 @@ namespace Connection_Patcher
struct x86
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { '.', 'l', 'o', 'g', 'o', 'n', '.', 'b', 'a', 't', 't', 'l', 'e', '.', 'n', 'e', 't', 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { }; }
static const std::vector Signature() { return { }; }
};
@@ -39,8 +37,6 @@ namespace Connection_Patcher
struct x64
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { '.', 'l', 'o', 'g', 'o', 'n', '.', 'b', 'a', 't', 't', 'l', 'e', '.', 'n', 'e', 't', 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { }; }
static const std::vector Signature() { return { }; }
};
diff --git a/src/tools/connection_patcher/Patterns/Windows.hpp b/src/tools/connection_patcher/Patterns/Windows.hpp
index 572a0c5b5da..dfd1a177af1 100644
--- a/src/tools/connection_patcher/Patterns/Windows.hpp
+++ b/src/tools/connection_patcher/Patterns/Windows.hpp
@@ -30,8 +30,6 @@ namespace Connection_Patcher
struct x86
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { '.', 'l', 'o', 'g', 'o', 'n', '.', 'b', 'a', 't', 't', 'l', 'e', '.', 'n', 'e', 't', 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { }; }
static const std::vector Signature() { return { }; }
};
@@ -39,8 +37,6 @@ namespace Connection_Patcher
struct x64
{
static const std::vector BNet() { return { }; }
- static const std::vector Portal() { return { '.', 'l', 'o', 'g', 'o', 'n', '.', 'b', 'a', 't', 't', 'l', 'e', '.', 'n', 'e', 't', 0x00 }; }
- static const std::vector Connect() { return { }; }
static const std::vector Password() { return { }; }
static const std::vector Signature() { return { }; }
};
diff --git a/src/tools/connection_patcher/Program.cpp b/src/tools/connection_patcher/Program.cpp
index 4b0616d640e..1ea5194a2f6 100644
--- a/src/tools/connection_patcher/Program.cpp
+++ b/src/tools/connection_patcher/Program.cpp
@@ -18,8 +18,10 @@
#include "Helper.hpp"
#include "Patcher.hpp"
+#include "Patches/Common.hpp"
#include "Patches/Mac.hpp"
#include "Patches/Windows.hpp"
+#include "Patterns/Common.hpp"
#include "Patterns/Mac.hpp"
#include "Patterns/Windows.hpp"
@@ -75,18 +77,17 @@ namespace Connection_Patcher
template
void do_patches(Patcher* patcher, boost::filesystem::path output)
{
+ std::cout << "patching Portal\n";
+ patcher->Patch(Patches::Common::Portal(), Patterns::Common::Portal());
+ std::cout << "patching redirect RSA Modulus\n";
+ patcher->Patch(Patches::Common::Modulus(), Patterns::Common::Modulus());
std::cout << "patching BNet\n";
patcher->Patch(PATCH::BNet(), PATTERN::BNet());
- std::cout << "patching Portal\n";
- patcher->Patch(PATCH::Portal(), PATTERN::Portal());
- std::cout << "patching Connect\n";
- patcher->Patch(PATCH::Connect(), PATTERN::Connect());
std::cout << "patching Signature\n";
patcher->Patch(PATCH::Signature(), PATTERN::Signature());
patcher->Finish(output);
std::cout << "Patching done.\n";
-
}
}