From b5e7b6214be5bdcc8b7685310f16eb2ae3ee7b68 Mon Sep 17 00:00:00 2001 From: hero Date: Sun, 18 Aug 2024 16:20:33 +0200 Subject: [PATCH] reorganize stuff, wildcards for build, fix module map --- .gitmodules | 3 + Makefile | 4 +- example-mod/src/photon-example-mod.vcxproj | 14 +- .../src/photon-example-mod.vcxproj.filters | 45 --- src/core/shared/signal.cpp | 2 +- src/deps/subhook/libsubhook.a | Bin 9978 -> 0 bytes src/deps/subhook/subhook.h | 315 ------------------ src/deps/subhook/subhook.lib | Bin 7142 -> 0 bytes src/photon.vcxproj | 57 +--- src/photon.vcxproj.filters | 135 -------- src/util/util.cpp | 4 +- src/util/util.h | 5 +- vendor/subhook | 1 + 13 files changed, 31 insertions(+), 554 deletions(-) create mode 100644 .gitmodules delete mode 100644 example-mod/src/photon-example-mod.vcxproj.filters delete mode 100644 src/deps/subhook/libsubhook.a delete mode 100644 src/deps/subhook/subhook.h delete mode 100644 src/deps/subhook/subhook.lib delete mode 100644 src/photon.vcxproj.filters create mode 160000 vendor/subhook diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..1cdabcc --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "vendor/subhook"] + path = vendor/subhook + url = https://github.com/Zeex/subhook diff --git a/Makefile b/Makefile index 22849af..6e1d517 100644 --- a/Makefile +++ b/Makefile @@ -22,8 +22,8 @@ OBJS=$(patsubst $(SDIR)/%.cpp, $(ODIR)/%.o, $(SRCS)) DEPS=$(OBJS:%.o=%.d) WARNINGS=-Wall -Wno-parentheses -Wno-unknown-pragmas -Wno-delete-non-virtual-dtor -CXXFLAGS=-std=c++20 -m32 $(WARNINGS) -I$(SDIR) -fPIC -D_GNU_SOURCE -I$(SDIR)/deps/subhook -LDFLAGS=-m32 -shared -lstdc++fs -L$(SDIR)/deps/subhook -lsubhook +CXXFLAGS=-std=c++20 -m32 $(WARNINGS) -I$(SDIR) -fPIC -D_GNU_SOURCE -Ivendor +LDFLAGS=-m32 -shared -lstdc++fs # Import config.mk, which can be used for optional config -include config.mk diff --git a/example-mod/src/photon-example-mod.vcxproj b/example-mod/src/photon-example-mod.vcxproj index 233c830..549efdf 100644 --- a/example-mod/src/photon-example-mod.vcxproj +++ b/example-mod/src/photon-example-mod.vcxproj @@ -10,16 +10,12 @@ - - - - + <_WildCardClCompile Include=".\**\*.cpp" /> + <_WildCardClInclude Include=".\**\*.h" /> - - - - + + 16.0 @@ -113,4 +109,4 @@ - \ No newline at end of file + diff --git a/example-mod/src/photon-example-mod.vcxproj.filters b/example-mod/src/photon-example-mod.vcxproj.filters deleted file mode 100644 index 67d4302..0000000 --- a/example-mod/src/photon-example-mod.vcxproj.filters +++ /dev/null @@ -1,45 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/core/shared/signal.cpp b/src/core/shared/signal.cpp index 64cd6fe..a1684f5 100644 --- a/src/core/shared/signal.cpp +++ b/src/core/shared/signal.cpp @@ -2,9 +2,9 @@ #include "sdk/signal.h" -#include "deps/subhook/subhook.h" #include "sdk/photon.h" +#include #include static std::unordered_map< std::string, signal_t* > signals; diff --git a/src/deps/subhook/libsubhook.a b/src/deps/subhook/libsubhook.a deleted file mode 100644 index 40b6cfbdbff3b7fb9883cb14a2841b3820c7c711..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9978 zcmcIqe{fXA9pAfL$dMi-Mx0`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$pVlmnQbYs1uE%i@Qj>YH~ zO8!eFKS4R17?fizs#4gb@F^mO^&pXx;=kRKr`m7%t#vBhr??kCjV4UC7xTEmZGcTA zW!ve!n0Dy)wB2NT@mc6~($7owUi=*TGyo&|Lst63@LjPN8`=SMOqwl5p7t!uG?iT` zbS$IySlY3DI%$8^5IF7TPhrP-K|A_oS_o#5ot3}Tksehjh4`tV(2+FT4H@&8dNR@O zXDUz7vF=6QxyKHn;R_*ijvM>K=?koMJPP1*g5$FER|upp-FL{!^A6Vqo#=-tdyg$d MK+oDL`K#^z1D8@882|tP diff --git a/src/deps/subhook/subhook.h b/src/deps/subhook/subhook.h deleted file mode 100644 index ef9d8b8..0000000 --- a/src/deps/subhook/subhook.h +++ /dev/null @@ -1,315 +0,0 @@ -/* - * Copyright (c) 2012-2018 Zeex - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation - * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE - * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR - * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF - * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN - * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE - * POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SUBHOOK_H -#define SUBHOOK_H - -#include - -#if defined _M_IX86 || defined __i386__ - #define SUBHOOK_X86 - #define SUBHOOK_BITS 32 -#elif defined _M_AMD64 || defined __amd64__ - #define SUBHOOK_X86_64 - #define SUBHOOK_BITS 64 -#else - #error Unsupported architecture -#endif - -#if defined _WIN32 || defined __CYGWIN__ - #define SUBHOOK_WINDOWS -#elif defined __linux__ \ - || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ - #define SUBHOOK_UNIX -#elif defined __APPLE__ - #define SUBHOOK_APPLE - #define SUBHOOK_UNIX -#else - #error Unsupported operating system -#endif - -#if !defined SUBHOOK_EXTERN - #if defined __cplusplus - #define SUBHOOK_EXTERN extern "C" - #else - #define SUBHOOK_EXTERN extern - #endif -#endif - -#if defined SUBHOOK_STATIC - #define SUBHOOK_API - #define SUBHOOK_EXPORT SUBHOOK_EXTERN -#endif - -#if !defined SUBHOOK_API - #if defined SUBHOOK_X86 - #if defined SUBHOOK_WINDOWS - #define SUBHOOK_API __cdecl - #elif defined SUBHOOK_UNIX - #define SUBHOOK_API __attribute__((cdecl)) - #endif - #else - #define SUBHOOK_API - #endif -#endif - -#if !defined SUBHOOK_EXPORT - #if defined SUBHOOK_WINDOWS - #if defined SUBHOOK_IMPLEMENTATION - #define SUBHOOK_EXPORT SUBHOOK_EXTERN __declspec(dllexport) - #else - #define SUBHOOK_EXPORT SUBHOOK_EXTERN __declspec(dllimport) - #endif - #elif defined SUBHOOK_UNIX - #if defined SUBHOOK_IMPLEMENTATION - #define SUBHOOK_EXPORT SUBHOOK_EXTERN __attribute__((visibility("default"))) - #else - #define SUBHOOK_EXPORT SUBHOOK_EXTERN - #endif - #endif -#endif - -typedef enum subhook_flags { - /* - * Use the 64-bit jump method on x86-64. Unlike the classical 32-bit JMP, - * this approach ensures that the destination code can be reached from any - * point in the 64-bit address space, even if the source and destination are - * more than 4GB away from each other (meaning we are not limited to using - * JMP 32-bit offsets). - * - * Keep in mind that it requires overwriting a few more leading instructions - * inside the target code, thus it may not work with extremely short - * functions (14 bytes vs 5 bytes). - * - * Credits to @Ozymandias117 and @RomanHargrave on GitHub for implementing - * this in subhook. - */ - SUBHOOK_64BIT_OFFSET = 0x01, - /* - * Generate a trampoline for jumping back to the original code faster (without - * removing the hook each time). - * - * In some scenarios, trampolines cannot be created. See "Known limitations" - * in the README file. - */ - SUBHOOK_TRAMPOLINE = 0x02, - /* - * Windows x64 only: Try to allocate a trampoline buffer within +/- 2GB range - * of the original function to overcome a possible issue with relocating memory - * referencing instructions, particularly those which use RIP-relative - * addresses (i.e. with 32-bit offsets). - * - * Caution: this feature may slow down your code. - */ - SUBHOOK_TRAMPOLINE_ALLOC_NEARBY = 0x04 -} subhook_flags_t; - -struct subhook_struct; -typedef struct subhook_struct *subhook_t; - -typedef int (SUBHOOK_API *subhook_disasm_handler_t)( - void *src, - int *reloc_op_offset); - -SUBHOOK_EXPORT subhook_t SUBHOOK_API subhook_new( - void *src, - void *dst, - subhook_flags_t flags); -SUBHOOK_EXPORT void SUBHOOK_API subhook_free(subhook_t hook); - -SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_src(subhook_t hook); -SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_dst(subhook_t hook); -SUBHOOK_EXPORT void *SUBHOOK_API subhook_get_trampoline(subhook_t hook); - -SUBHOOK_EXPORT int SUBHOOK_API subhook_install(subhook_t hook); -SUBHOOK_EXPORT int SUBHOOK_API subhook_is_installed(subhook_t hook); -SUBHOOK_EXPORT int SUBHOOK_API subhook_remove(subhook_t hook); - -/* - * Reads hook destination address from code. - * - * This function may be useful when you don't know the address or want to - * check whether src is already hooked. - */ -SUBHOOK_EXPORT void *SUBHOOK_API subhook_read_dst(void *src); - -/* - * Returns the length of the first instruction in src. You can replace it with - * a custom function via subhook_set_disasm_handler. - */ -SUBHOOK_EXPORT int SUBHOOK_API subhook_disasm(void *src, int *reloc_op_offset); - -/* - * Sets a custom disassmbler function to use in place of the default one - * (subhook_disasm). - * - * The default function can recognize only a small subset of x86 instructions - * commonly used in prologues. If it fails in your situation, you might want - * to use a more advanced disassembler library. - */ -SUBHOOK_EXPORT void SUBHOOK_API subhook_set_disasm_handler( - subhook_disasm_handler_t handler); - -#ifdef __cplusplus - -namespace subhook { - -enum HookFlags { - HookNoFlags = 0, - HookFlag64BitOffset = SUBHOOK_64BIT_OFFSET, - HookFlagTrampoline = SUBHOOK_TRAMPOLINE, - HookFlagTrampolineAllocNearby = SUBHOOK_TRAMPOLINE_ALLOC_NEARBY -}; - -inline HookFlags operator|(HookFlags o1, HookFlags o2) { - return static_cast( - static_cast(o1) | static_cast(o2)); -} - -inline HookFlags operator&(HookFlags o1, HookFlags o2) { - return static_cast( - static_cast(o1) & static_cast(o2)); -} - -inline void *ReadHookDst(void *src) { - return subhook_read_dst(src); -} - -inline void SetDisasmHandler(subhook_disasm_handler_t handler) { - subhook_set_disasm_handler(handler); -} - -class Hook { - public: - Hook() : hook_(NULL) {} - Hook(void *src, void *dst, HookFlags flags = HookNoFlags) - : hook_(subhook_new(src, dst, (subhook_flags_t)flags)) - { - } - - ~Hook() { - subhook_remove(hook_); - subhook_free(hook_); - } - - void *GetSrc() const { return subhook_get_src(hook_); } - void *GetDst() const { return subhook_get_dst(hook_); } - void *GetTrampoline() const { return subhook_get_trampoline(hook_); } - - bool Install() { - return subhook_install(hook_) == 0; - } - - bool Install(void *src, - void *dst, - HookFlags flags = HookNoFlags) { - if (hook_ != NULL) { - subhook_remove(hook_); - subhook_free(hook_); - } - hook_ = subhook_new(src, dst, (subhook_flags_t)flags); - if (hook_ == NULL) { - return false; - } - return Install(); - } - - bool Remove() { - return subhook_remove(hook_) == 0; - } - - bool IsInstalled() const { - return !!subhook_is_installed(hook_); - } - - private: - Hook(const Hook &); - void operator=(const Hook &); - - private: - subhook_t hook_; -}; - -class ScopedHookRemove { - public: - ScopedHookRemove(Hook *hook) - : hook_(hook), - removed_(hook_->Remove()) - { - } - - ~ScopedHookRemove() { - if (removed_) { - hook_->Install(); - } - } - - private: - ScopedHookRemove(const ScopedHookRemove &); - void operator=(const ScopedHookRemove &); - - private: - Hook *hook_; - bool removed_; -}; - -class ScopedHookInstall { - public: - ScopedHookInstall(Hook *hook) - : hook_(hook), - installed_(hook_->Install()) - { - } - - ScopedHookInstall(Hook *hook, - void *src, - void *dst, - HookFlags flags = HookNoFlags) - : hook_(hook), - installed_(hook_->Install(src, dst, flags)) - { - } - - ~ScopedHookInstall() { - if (installed_) { - hook_->Remove(); - } - } - - private: - ScopedHookInstall(const ScopedHookInstall &); - void operator=(const ScopedHookInstall &); - - private: - Hook *hook_; - bool installed_; -}; - -} // namespace subhook - -#endif /* __cplusplus */ - -#endif /* SUBHOOK_H */ diff --git a/src/deps/subhook/subhook.lib b/src/deps/subhook/subhook.lib deleted file mode 100644 index 99333d0be170955f4ef03970c07eb8a6f4882de2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7142 zcmcgx4RBP|6~1qGvsuFGMolG3ghvRi3gmA?ASuEUvjiO?0ZifmVOf$*vN6e~yKfVu z{%mHm9X799e`}puYi)IkgMXcIrdp?VNm5tZ>M)i%TKc1{tst}&#h46CU%&HycHjOm z;NbM^oOkX$_q+Gqch9-!y!&?1YPY|$cTGVBpH5Y^b+z`DRV(YN)Af~V)n2noE$u2` zjM*47K9^$4AY-}s%3;Q`*%b)x?)CX@ce(rfeVwjOUzdj^b=`iCCqoq+9P;}FPp6PV zb$J8sz(A@_y;3#rU_ijwDaD{?BvtWy++D7&fNnIuXTUeC>#vON>U9rx^?UrOo;@BR zy(1|C{?2rS;CBxU`TD(sx)HqrmpUm=R|*}V@#H5--s=n7#a@%NixGx-4wpd-W5ZX< zMq(T@Fe8}5m3~UiAWJSalU$a_T;q(HrdcdCQV#oF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0MnTnze1x^F>8tAmp+XN~Ua%uCMnU?0->wnsOs^i%n zYA5>Dyhl!~n!4hfY;j1~^u3ktV9mV?3T}Lo>mA*@?6U=%D - - - - - - - - - - - - - - - - - - - - - + <_WildCardClCompile Include="..\vendor\subhook\subhook.c" /> + <_WildCardClCompile Include=".\**\*.cpp" /> + <_WildCardClInclude Include=".\**\*.h" /> - - - - - - - - - - - - - - - - - + + 16.0 @@ -85,13 +52,13 @@ true $(SolutionDir)bin\ - $(SolutionDir)src;$(IncludePath) + $(SolutionDir)src;$(SolutionDir)vendor;$(IncludePath) $(LibraryPath) false $(SolutionDir)bin\ - $(SolutionDir)src;$(IncludePath) + $(SolutionDir)src;$(SolutionDir)vendor;$(IncludePath) $(LibraryPath) @@ -109,8 +76,8 @@ Console true - $(SolutionDir)src\deps\subhook;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;subhook.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) call ..\copy.bat @@ -135,8 +102,8 @@ true true true - $(SolutionDir)src\deps\subhook;%(AdditionalLibraryDirectories) - kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;subhook.lib;%(AdditionalDependencies) + %(AdditionalLibraryDirectories) + kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies) call ..\copy.bat @@ -144,4 +111,4 @@ - \ No newline at end of file + diff --git a/src/photon.vcxproj.filters b/src/photon.vcxproj.filters deleted file mode 100644 index a3739b6..0000000 --- a/src/photon.vcxproj.filters +++ /dev/null @@ -1,135 +0,0 @@ - - - - - {4FC737F1-C7A5-4376-A066-2A32D752A2FF} - cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx - - - {93995380-89BD-4b04-88EB-625FBE52EBFB} - h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd - - - {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} - rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms - - - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - Header Files - - - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - Source Files - - - \ No newline at end of file diff --git a/src/util/util.cpp b/src/util/util.cpp index 3368860..b99599f 100644 --- a/src/util/util.cpp +++ b/src/util/util.cpp @@ -35,6 +35,8 @@ void util::console::free( ) { #endif } +static std::vector< util::module_info_t > g_module_info; + bool util::get_module_info( const char* module_name, module_info_t* module_info ) { if ( g_module_info.empty( ) ) { #ifdef _WIN32 @@ -89,7 +91,7 @@ bool util::get_module_info( const char* module_name, module_info_t* module_info } for ( const auto& info : g_module_info ) { - if ( std::strcmp( info.name, module_name ) ) + if ( _stricmp( info.name, module_name ) ) continue; if ( module_info != nullptr ) { diff --git a/src/util/util.h b/src/util/util.h index 3c5ab65..8fbb2cc 100644 --- a/src/util/util.h +++ b/src/util/util.h @@ -16,6 +16,10 @@ #define MAX_PATH 4096 #endif +#ifndef _WIN32 +#define _stricmp strcasecmp +#endif + #include "math.h" #include "sdk/platform.h" @@ -36,7 +40,6 @@ namespace util { std::uintptr_t addr; std::size_t size; }; - static std::vector< module_info_t > g_module_info; bool get_module_info( const char* module_name, module_info_t* module_info ); std::uint8_t* pattern_scan( const char* module_name, const char* signature ) noexcept; diff --git a/vendor/subhook b/vendor/subhook new file mode 160000 index 0000000..e935959 --- /dev/null +++ b/vendor/subhook @@ -0,0 +1 @@ +Subproject commit e935959d2f9cc642bcbb5e7759b2b1e7196b0947