aboutsummaryrefslogtreecommitdiff
path: root/primedev
diff options
context:
space:
mode:
authorJack <66967891+ASpoonPlaysGames@users.noreply.github.com>2024-08-31 10:31:08 +0100
committerGitHub <noreply@github.com>2024-08-31 11:31:08 +0200
commita60c2738a2a0247ef46db8bae55f5dfd0c0f14c3 (patch)
tree95cb8e97867060fc0ee6b590f4e9be0d8f826057 /primedev
parente73ede2ef871b4d48805d6e4e187e2b8d5df343f (diff)
downloadNorthstarLauncher-a60c2738a2a0247ef46db8bae55f5dfd0c0f14c3.tar.gz
NorthstarLauncher-a60c2738a2a0247ef46db8bae55f5dfd0c0f14c3.zip
core: Remove uses of Autohook from `hooks.cpp` (#796)
Removes AUTOHOOK macro from `hooks.cpp`.
Diffstat (limited to 'primedev')
-rw-r--r--primedev/core/hooks.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/primedev/core/hooks.cpp b/primedev/core/hooks.cpp
index a57340cf..6146c93c 100644
--- a/primedev/core/hooks.cpp
+++ b/primedev/core/hooks.cpp
@@ -12,8 +12,6 @@
namespace fs = std::filesystem;
-AUTOHOOK_INIT()
-
// called from the ON_DLL_LOAD macros
__dllLoadCallback::__dllLoadCallback(
eDllLoadCallbackSide side, const std::string dllName, DllLoadCallbackFuncType callback, std::string uniqueStr, std::string reliesOn)
@@ -223,14 +221,15 @@ void MakeHook(LPVOID pTarget, LPVOID pDetour, void* ppOriginal, const char* pFun
spdlog::error("MH_CreateHook failed for function {}", pStrippedFuncName);
}
-AUTOHOOK_ABSOLUTEADDR(_GetCommandLineA, (LPVOID)GetCommandLineA, LPSTR, WINAPI, ())
+static LPSTR(WINAPI* o_pGetCommandLineA)() = nullptr;
+static LPSTR WINAPI h_GetCommandLineA()
{
static char* cmdlineModified;
static char* cmdlineOrg;
if (cmdlineOrg == nullptr || cmdlineModified == nullptr)
{
- cmdlineOrg = _GetCommandLineA();
+ cmdlineOrg = o_pGetCommandLineA();
bool isDedi = strstr(cmdlineOrg, "-dedicated"); // well, this one has to be a real argument
bool ignoreStartupArgs = strstr(cmdlineOrg, "-nostartupargs");
@@ -394,6 +393,7 @@ void HookSys_Init()
{
spdlog::error("MH_Initialize (minhook initialization) failed");
}
- // todo: remove remaining instances of autohook in this file
- AUTOHOOK_DISPATCH()
+
+ o_pGetCommandLineA = GetCommandLineA;
+ HookAttach(&(PVOID&)o_pGetCommandLineA, (PVOID)h_GetCommandLineA);
}