9 MEMORY_BASIC_INFORMATION page_info = { 0 };
11 if (out !=
sizeof(page_info)) {
12 if (GetLastError() == ERROR_INVALID_PARAMETER) {
16 std::cout <<
"Could not query page: " << std::hex <<
start_va <<
". Error: " << GetLastError() << std::endl;
23 alloc_base = (ULONGLONG) page_info.AllocationBase;
64 std::cerr <<
"Could not retrieve name" << std::endl;
68 PVOID old_val =
nullptr;
70 HANDLE file = CreateFileA(this->
mapped_name.c_str(), GENERIC_READ, FILE_SHARE_READ, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
72 if(file == INVALID_HANDLE_VALUE) {
74 std::cerr <<
"Could not open file!" << std::endl;
78 HANDLE mapping = CreateFileMapping(file, 0, PAGE_READONLY, 0, 0, 0);
81 std::cerr <<
"Could not create mapping!" << std::endl;
86 BYTE *rawData = (BYTE*) MapViewOfFile(mapping, FILE_MAP_READ, 0, 0, 0);
87 if (rawData ==
nullptr) {
89 std::cerr <<
"Could not map view of file: " << this->
mapped_name << std::endl;
98 size_t r_size = GetFileSize(file, 0);
99 is_same = this->
loadedData.isDataContained(rawData, r_size);
103 std::cerr <<
"[" << std::hex <<
start_va <<
"] Page not loaded!" << std::endl;
106 UnmapViewOfFile(rawData);
107 CloseHandle(mapping);
util::ByteBuffer loadedData
const bool is_process_refl
ULONGLONG stop_va
the VA at which the read will stop
std::string mapped_name
if the region is mapped from a file, stores its file name
ULONGLONG start_va
VA that was requested. May not be beginning of the region.
std::string module_name
if the region is on the list of loaded PEs, stores its module name