-
Notifications
You must be signed in to change notification settings - Fork 53
en_get_entry
伏秋洛 edited this page Jun 17, 2023
·
1 revision
It can express the status and offset of the memory page, determine whether there is a page missing or obtain its corresponding physical address.
Please read to obtain MAPS before use
std::string packageName = "bin.mt.plus";
try {
auto pid = hak::find_process(packageName);
std::cout << "pid: " << pid << "\n";
auto process = std::make_shared<hak::process>(pid);
process->set_memory_mode(memory_mode::SYSCALL);
auto maps = process->get_maps();
do {
for (int i = 0; i < ((maps->end() - maps->start()) / getpagesize()); ++i) {
auto entry = process->get_page_entry(maps->start() + i * getpagesize());
std::cout << "present = " << entry.present << "\n";
}
} while ((maps = maps->next()));
} catch (std::exception& e) {
std::cout << "error: " << e.what() << "\n";
}
The above code retrieves the entry for each page and prints the status of its present.
We can read the code in the link to determine the missing page.
Only through learning and communication!