diff --git a/HookingLib/HookingLib.cpp b/HookingLib/HookingLib.cpp index fe16a5d..1f6a42d 100644 --- a/HookingLib/HookingLib.cpp +++ b/HookingLib/HookingLib.cpp @@ -384,7 +384,10 @@ bool InsertTrampoline(uintptr_t branchAddress, uintptr_t targetAddress) uint8_t jump[5] = { 0 }; jump[0] = 0xe9; memcpy(jump + 1, &offset, 4); - return WriteForeignMemory(branchAddress, jump, 5); + if (!WriteForeignMemory(branchAddress, jump, 5)) + return false; + trampolineCount++; + return true; } uintptr_t InsertNearHook(uintptr_t address, uintptr_t hook) diff --git a/HookingLib/HookingLib.vcxproj b/HookingLib/HookingLib.vcxproj index 8204783..4b4243b 100644 --- a/HookingLib/HookingLib.vcxproj +++ b/HookingLib/HookingLib.vcxproj @@ -21,13 +21,13 @@ StaticLibrary true - v142 + v143 Unicode StaticLibrary false - v142 + v143 true Unicode @@ -57,6 +57,7 @@ true NotUsing pch.h + stdcpp23 @@ -78,6 +79,7 @@ NotUsing pch.h false + stdcpp23 diff --git a/HookingLib/hooking_internal.h b/HookingLib/hooking_internal.h index 1c654c6..630bac6 100644 --- a/HookingLib/hooking_internal.h +++ b/HookingLib/hooking_internal.h @@ -1,3 +1,11 @@ #pragma once #include -void* LhAllocateMemoryEx(void* InEntryPoint, ULONG* OutPageSize); \ No newline at end of file +#ifdef __cplusplus +extern "C" { +#endif + + void* LhAllocateMemoryEx(void* InEntryPoint, ULONG* OutPageSize); + +#ifdef __cplusplus +} +#endif \ No newline at end of file