Skip to content

Commit

Permalink
refactor(hook): remove padding
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 12, 2024
1 parent dc52b98 commit b1278f3
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/hooks.hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::uint8_t> 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))
Expand Down

0 comments on commit b1278f3

Please sign in to comment.