Skip to content

Commit

Permalink
Add the ability to seach modules with path (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nukoooo authored Apr 11, 2024
1 parent eb21639 commit efcaf43
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/ReGenny.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1029,11 +1029,14 @@ void ReGenny::update_address() {
m_address = m_parsed_address.offsets.front();

if (!m_parsed_address.name.empty()) {
auto& modname = m_parsed_address.name;
auto modname = m_parsed_address.name;
std::transform(modname.begin(), modname.end(), modname.begin(), tolower);

for (auto&& mod : m_process->modules()) {
if (std::equal(modname.begin(), modname.end(), mod.name.begin(), mod.name.end(),
[](auto a, auto b) { return std::tolower(a) == std::tolower(b); })) {
std::string name = mod.name;
std::transform(name.begin(), name.end(), name.begin(), tolower);

if (name.ends_with(modname)) {
m_address += mod.start;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ using namespace tao::pegtl;
struct HexNum : seq<one<'0'>, one<'x'>, plus<xdigit>> {};
struct DecNum : plus<digit> {};
struct Num : sor<HexNum, DecNum> {};
struct NameChar : sor<alnum, one<' ', '(', ')', '_', '-', ',', '.'>> {};
struct NameChar : sor<alnum, one<' ', '(', ')', '_', '-', ',', '.', '/', '\\'>> {};
struct Name : seq<plus<NameChar>> {};
struct Offset : seq<Num, opt<one<'-'>, one<'>'>, struct Offset>> {};
struct ModOffset : seq<one<'<'>, Name, one<'>'>, opt<one<'+'>, Offset>> {};
Expand Down
2 changes: 1 addition & 1 deletion src/arch/Windows.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ WindowsProcess::WindowsProcess(DWORD process_id) : Process{} {
do {
Module m{};

m.name = entry.szModule;
m.name = entry.szExePath;
m.start = (uintptr_t)entry.modBaseAddr;
m.size = entry.modBaseSize;
m.end = m.start + m.size;
Expand Down

0 comments on commit efcaf43

Please sign in to comment.