Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion HookingLib/HookingLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 4 additions & 2 deletions HookingLib/HookingLib.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>StaticLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
Expand Down Expand Up @@ -57,6 +57,7 @@
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<LanguageStandard>stdcpp23</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
Expand All @@ -78,6 +79,7 @@
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<WholeProgramOptimization>false</WholeProgramOptimization>
<LanguageStandard>stdcpp23</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
Expand Down
10 changes: 9 additions & 1 deletion HookingLib/hooking_internal.h
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
#pragma once
#include <windows.h>
void* LhAllocateMemoryEx(void* InEntryPoint, ULONG* OutPageSize);
#ifdef __cplusplus
extern "C" {
#endif

void* LhAllocateMemoryEx(void* InEntryPoint, ULONG* OutPageSize);

#ifdef __cplusplus
}
#endif