From 013b635524a73d376a8e9c145ebcaea96ad9ade2 Mon Sep 17 00:00:00 2001 From: Alex Date: Sat, 17 Dec 2022 19:02:07 +0200 Subject: [PATCH] Memory Tracker: If PageTable is nullptr, read the current one --- Core/Memory/Tracker.cpp | 5 ++++- include/memory.hpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/Memory/Tracker.cpp b/Core/Memory/Tracker.cpp index 2ad7adf..6ab6740 100644 --- a/Core/Memory/Tracker.cpp +++ b/Core/Memory/Tracker.cpp @@ -36,7 +36,10 @@ namespace Memory Tracker::Tracker(PageTable4 *PageTable) { - this->PageTable = PageTable; + if (PageTable) + this->PageTable = PageTable; + else + this->PageTable = (PageTable4 *)CPU::x64::readcr3().raw; debug("Tracker initialized."); } diff --git a/include/memory.hpp b/include/memory.hpp index 8a8bb1a..469dc71 100644 --- a/include/memory.hpp +++ b/include/memory.hpp @@ -651,7 +651,7 @@ namespace Memory void *RequestPages(uint64_t Count); void FreePages(void *Address, uint64_t Count); - Tracker(PageTable4 *PageTable); + Tracker(PageTable4 *PageTable = nullptr); ~Tracker(); }; }