Skip to content

Commit

Permalink
refactor(hook): cleanup includes, tweak naming
Browse files Browse the repository at this point in the history
  • Loading branch information
Curve committed May 13, 2024
1 parent 102da66 commit cf2ba3c
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/hooks.hook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "address.hpp"
#include "constants.hpp"
#include "instruction.hpp"
#include "tl/expected.hpp"

#include <limits>
#include <cassert>
Expand Down Expand Up @@ -237,10 +236,10 @@ namespace lime
const auto original_rip = source->addr() + i;
const auto original_target = inst.absolute(original_rip).value();

const auto rip = trampoline->start() + i;
const auto reloc_rip = trampoline->start() + content.size();
const auto rip = trampoline->start() + i;
const auto reloc_address = trampoline->start() + content.size();

const auto new_offset = reloc_rip - rip - inst_size;
const auto new_offset = reloc_address - rip - inst_size;
auto offset = offset_of(inst);

if (!offset)
Expand All @@ -258,7 +257,7 @@ namespace lime
}
else
{
std::ranges::move(make_jmp(reloc_rip, original_target, false), std::back_inserter(content));
std::ranges::move(make_jmp(reloc_address, original_target, false), std::back_inserter(content));
}

if (try_redirect(offset.value(), static_cast<std::intptr_t>(new_offset)))
Expand Down

0 comments on commit cf2ba3c

Please sign in to comment.