From c52fa4b2b1049a2a53f3fcffdb41fa9cde232b90 Mon Sep 17 00:00:00 2001 From: Toni Uhlig Date: Wed, 18 Sep 2019 21:40:27 +0200 Subject: added VAlloc, VUnlink and VFree test --- CMD/CMD.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'CMD/CMD.cpp') diff --git a/CMD/CMD.cpp b/CMD/CMD.cpp index eb2b270..980b165 100644 --- a/CMD/CMD.cpp +++ b/CMD/CMD.cpp @@ -122,6 +122,25 @@ int wmain(int argc, wchar_t **argv) value = KMemory::Rpm(targetPID, rdata); std::cout << "Value: " << std::hex << value << std::endl; + PVOID targetAddr = (PVOID)((UINT64)NULL); + SIZE_T targetSize = 4096; + try { + if (!ki.VAlloc(targetPID, &targetAddr, &targetSize, PAGE_EXECUTE_READWRITE)) { + std::wcout << L"VAlloc failed" << std::endl; + } +#if 0 + if (!ki.VUnlink(targetPID, targetAddr)) { + std::wcout << L"VUnlink failed" << std::endl; + } +#endif + if (!ki.VFree(targetPID, targetAddr, targetSize)) { + std::wcout << L"VFree failed" << std::endl; + } + } + catch (std::runtime_error& err) { + std::wcout << err.what() << std::endl; + } + std::this_thread::sleep_for(std::chrono::microseconds(2500000)); } else -- cgit v1.2.3