From b1278f32b2fbd1baf193593f64888c4cc41486b1 Mon Sep 17 00:00:00 2001 From: Curve Date: Mon, 13 May 2024 01:54:23 +0200 Subject: [PATCH] refactor(hook): remove padding --- src/hooks.hook.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/hooks.hook.cpp b/src/hooks.hook.cpp index 570a176..a8a7825 100644 --- a/src/hooks.hook.cpp +++ b/src/hooks.hook.cpp @@ -125,14 +125,11 @@ namespace lime const auto spring_board = near ? false : rtn->m_impl->create_springboard(); const auto destination = spring_board ? rtn->m_impl->spring_board->start() : target; - auto jump = impl::make_jmp(source, destination, near || spring_board); - const auto prologue = rtn->m_impl->prologue.size(); + const auto jump = impl::make_jmp(start->addr(), destination, near || spring_board); - if (jump.size() < prologue) + if (!rtn->m_impl->source_page->protect(rwx)) { - const auto remaining = prologue - jump.size(); - std::vector padding(remaining, 0x90); - std::ranges::move(padding, std::back_inserter(jump)); + return tl::make_unexpected(hook_error::protect); } if (!rtn->m_impl->source_page->protect(rwx))