From 1acedb294cf3e94a5fb7456739535570c5d4863a Mon Sep 17 00:00:00 2001 From: Rostu13 Date: Tue, 1 Sep 2020 18:02:18 +1000 Subject: [PATCH 1/3] Fix sig scanner for windows --- extensions/sdktools/vcaller.cpp | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index 2b5b16b98f..d6b9d2182d 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -119,9 +119,17 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p char *sig; pContext->LocalToString(params[2], &sig); -#if defined PLATFORM_POSIX if (sig[0] == '@') { + #if defined PLATFORM_WINDOWS + MEMORY_BASIC_INFORMATION mem; + if(VirtualQuery(addrInBase, &mem, sizeof(mem))) + { + s_call_addr = memutils->ResolveSymbol(mem.AllocationBase, &sig[1]); + } + #endif + + #if defined PLATFORM_POSIX Dl_info info; if (dladdr(addrInBase, &info) == 0) { @@ -132,28 +140,21 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p { return 0; } -#if SOURCE_ENGINE == SE_CSS \ - || SOURCE_ENGINE == SE_HL2DM \ - || SOURCE_ENGINE == SE_DODS \ - || SOURCE_ENGINE == SE_SDK2013 \ - || SOURCE_ENGINE == SE_BMS \ - || SOURCE_ENGINE == SE_TF2 \ - || SOURCE_ENGINE == SE_LEFT4DEAD \ - || SOURCE_ENGINE == SE_LEFT4DEAD2 \ - || SOURCE_ENGINE == SE_NUCLEARDAWN \ - || SOURCE_ENGINE == SE_BLADE \ - || SOURCE_ENGINE == SE_INSURGENCY \ - || SOURCE_ENGINE == SE_DOI \ - || SOURCE_ENGINE == SE_CSGO - s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); -#else - s_call_addr = dlsym(handle, &sig[1]); -#endif + + if (bridge->SymbolsAreHidden()) + { + s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); + } + else + { + s_call_addr = dlsym(handle, &sig[1]); + } + dlclose(handle); + #endif return (s_call_addr != NULL) ? 1 : 0; } -#endif s_call_addr = memutils->FindPattern(addrInBase, sig, params[3]); From df0789577cbfd10ad732c8efdf588493691b5cf6 Mon Sep 17 00:00:00 2001 From: Rostu13 Date: Tue, 1 Sep 2020 23:51:18 +1000 Subject: [PATCH 2/3] fix linux build --- extensions/sdktools/vcaller.cpp | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index d6b9d2182d..2ee1871522 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -141,14 +141,23 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p return 0; } - if (bridge->SymbolsAreHidden()) - { - s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); - } - else - { - s_call_addr = dlsym(handle, &sig[1]); - } +#if SOURCE_ENGINE == SE_CSS \ + || SOURCE_ENGINE == SE_HL2DM \ + || SOURCE_ENGINE == SE_DODS \ + || SOURCE_ENGINE == SE_SDK2013 \ + || SOURCE_ENGINE == SE_BMS \ + || SOURCE_ENGINE == SE_TF2 \ + || SOURCE_ENGINE == SE_LEFT4DEAD \ + || SOURCE_ENGINE == SE_LEFT4DEAD2 \ + || SOURCE_ENGINE == SE_NUCLEARDAWN \ + || SOURCE_ENGINE == SE_BLADE \ + || SOURCE_ENGINE == SE_INSURGENCY \ + || SOURCE_ENGINE == SE_DOI \ + || SOURCE_ENGINE == SE_CSGO + s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); +#else + s_call_addr = dlsym(handle, &sig[1]); +#endif dlclose(handle); #endif From b2746c6d2335afe78aac50dfd0de081bb3fd3c51 Mon Sep 17 00:00:00 2001 From: Kyle Sanderson Date: Fri, 2 Oct 2020 16:33:24 -0700 Subject: [PATCH 3/3] Update vcaller.cpp --- extensions/sdktools/vcaller.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/extensions/sdktools/vcaller.cpp b/extensions/sdktools/vcaller.cpp index 2ee1871522..f823ee409b 100644 --- a/extensions/sdktools/vcaller.cpp +++ b/extensions/sdktools/vcaller.cpp @@ -121,15 +121,13 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p if (sig[0] == '@') { - #if defined PLATFORM_WINDOWS +#if defined PLATFORM_WINDOWS MEMORY_BASIC_INFORMATION mem; - if(VirtualQuery(addrInBase, &mem, sizeof(mem))) + if (VirtualQuery(addrInBase, &mem, sizeof(mem))) { s_call_addr = memutils->ResolveSymbol(mem.AllocationBase, &sig[1]); } - #endif - - #if defined PLATFORM_POSIX +#elif defined PLATFORM_POSIX Dl_info info; if (dladdr(addrInBase, &info) == 0) { @@ -157,10 +155,10 @@ static cell_t PrepSDKCall_SetSignature(IPluginContext *pContext, const cell_t *p s_call_addr = memutils->ResolveSymbol(handle, &sig[1]); #else s_call_addr = dlsym(handle, &sig[1]); -#endif +#endif /* SOURCE_ENGINE */ dlclose(handle); - #endif +#endif return (s_call_addr != NULL) ? 1 : 0; }