Skip to content

Commit

Permalink
fix2
Browse files Browse the repository at this point in the history
  • Loading branch information
altalk23 committed Apr 21, 2024
1 parent 87bcac0 commit 0880f26
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/generator/ArmV7Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ Result<ArmV7HandlerGenerator::RelocateReturn> ArmV7HandlerGenerator::relocateOri
auto relocatedBuffer = m_trampoline;

TULIP_HOOK_UNWRAP_INTO(auto protection, Target::get().getProtection(m_trampoline));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, target, Target::get().getWritableProtection()));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, 0x100, Target::get().getWritableProtection()));

GenRelocateCodeAndBranch(originBuffer, relocatedBuffer, origin, relocated);

TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, target, protection));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, 0x100, protection));

if (relocated->size == 0) {
return Err("Failed to relocate original function");
Expand Down
4 changes: 2 additions & 2 deletions src/generator/ArmV8Generator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ Result<ArmV8HandlerGenerator::RelocateReturn> ArmV8HandlerGenerator::relocateOri
auto relocatedBuffer = m_trampoline;

TULIP_HOOK_UNWRAP_INTO(auto protection, Target::get().getProtection(m_trampoline));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, target, Target::get().getWritableProtection()));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, 0x100, Target::get().getWritableProtection()));

GenRelocateCodeAndBranch(originBuffer, relocatedBuffer, origin, relocated);

TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, target, protection));
TULIP_HOOK_UNWRAP(Target::get().protectMemory(m_trampoline, 0x100, protection));

if (relocated->size == 0) {
return Err("Failed to relocate original function");
Expand Down
2 changes: 1 addition & 1 deletion test/Hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ TEST(HookTest, NoHandler) {
TEST(HookTest, NoHooks) {
HandlerHandle handlerHandle;
makeHandler<1>(handlerHandle);
EXPECT_EQ(3, 3);
EXPECT_EQ(callFunction<1>(), 1);
}

TEST(HookTest, MakeWrapper) {
Expand Down

0 comments on commit 0880f26

Please sign in to comment.