Skip to content

en_scan_memory

伏秋洛 edited this page Jun 17, 2023 · 1 revision

Preface

The goal is to make a modifier like GG(GameGuardian), and the essential feature is to scan memory!

Example

#include "process.h"
#include "searcher.h"

using namespace hak;

auto process = std::make_shared<hak::process>(pid);
process->set_memory_mode(memory_mode::SYSCALL);
auto searcher = hak::memory_searcher(process);

The above code creates a memory scanner called searcher.

We used the searcher execution method searchNumber to search for a combination '1D;2D;0D;1D', unlike the GG, we do not intend to support the maximum size of custom combinations. By default, we believe that a combination should be on consecutive memory pages, and we also do not support unordered search by the GG. The combination data we require is ordered.(If necessary, you can submit an issue and we can make certain modifications or support it)

The content returned by searchNumber or filterNumber is the number of search/filter results.

std::unordered_set<pointer> results = searcher.get_results();
searcher.clear_results();

We can use get_results() method retrieves all search results, and can also execute clear_results() to clear search results.


Set Memory Range

searcher.set_memory_range(memory_range::A | memory_range::XS);

We can set the search scope through the above code. Unlike other so-called MemoryTools, our memory scope definition is almost consistent with the GG.


Specify pointer range search

searcher.set_search_range(0, 0xfffffffff);

We can set the pointer range to search through the above code.

searcher.set_search_range(0, 0);

This will clear the limit of the pointer range.


Allow scanning missing page addresses

searcher.set_ignore_missing_page(true);
searcher.set_ignore_swapped_page(true);

The appeal code ignores the detection of missing or swapped out memory pages. When set to true, the searcher will scan these memory addresses.