diff options
Diffstat (limited to 'overlay/HardHook_minhook.cpp')
-rw-r--r-- | overlay/HardHook_minhook.cpp | 34 |
1 files changed, 4 insertions, 30 deletions
diff --git a/overlay/HardHook_minhook.cpp b/overlay/HardHook_minhook.cpp index 443e27aec..b73a45aac 100644 --- a/overlay/HardHook_minhook.cpp +++ b/overlay/HardHook_minhook.cpp @@ -35,32 +35,6 @@ static LONG minhook_init_once = 0; -static const char *minhook_status_string(MH_STATUS status) { - -#define MHS(x) \ - case x: \ - return #x; - - switch (status) { - MHS(MH_UNKNOWN) - MHS(MH_OK) - MHS(MH_ERROR_ALREADY_INITIALIZED) - MHS(MH_ERROR_NOT_INITIALIZED) - MHS(MH_ERROR_ALREADY_CREATED) - MHS(MH_ERROR_NOT_CREATED) - MHS(MH_ERROR_ENABLED) - MHS(MH_ERROR_DISABLED) - MHS(MH_ERROR_NOT_EXECUTABLE) - MHS(MH_ERROR_UNSUPPORTED_FUNCTION) - MHS(MH_ERROR_MEMORY_ALLOC) - MHS(MH_ERROR_MEMORY_PROTECT) - } - -#undef MHS - - return "(unknown)"; -} - // EnsureMinHookInitialized ensures that the MinHook // library is initialized. If MinHook is already // initialized, calling this function is a no-op. @@ -69,7 +43,7 @@ static void EnsureMinHookInitialized() { if (InterlockedCompareExchange(&minhook_init_once, 1, 0) == 0) { MH_STATUS status = MH_Initialize(); if (status != MH_OK && status != MH_ERROR_ALREADY_INITIALIZED) { - fods("HardHook: Failed to initialize minhook; MH_Initialize returned %s", minhook_status_string(status)); + fods("HardHook: Failed to initialize minhook; MH_Initialize returned %s", MH_StatusToString(status)); } } } @@ -113,7 +87,7 @@ void HardHook::setup(voidFunc func, voidFunc replacement) { MH_STATUS status = MH_CreateHook((LPVOID) func, (LPVOID)replacement, (LPVOID *)&call); if (status != MH_OK) { - fods("HardHook: setup failed, MH_CreateHook returned %s", minhook_status_string(status)); + fods("HardHook: setup failed, MH_CreateHook returned %s", MH_StatusToString(status)); } inject(true); @@ -147,7 +121,7 @@ void HardHook::inject(bool force) { MH_STATUS status = MH_EnableHook((LPVOID)m_func); if (status != MH_OK) { - fods("HardHook: inject() failed: MH_EnableHook returned %s", minhook_status_string(status)); + fods("HardHook: inject() failed: MH_EnableHook returned %s", MH_StatusToString(status)); } } @@ -166,7 +140,7 @@ void HardHook::restore(bool force) { MH_STATUS status = MH_DisableHook((LPVOID)m_func); if (status != MH_OK) { - fods("HardHook: restore() failed: MH_DisableHook returned %s", minhook_status_string(status)); + fods("HardHook: restore() failed: MH_DisableHook returned %s", MH_StatusToString(status)); } } |