| 3 | namespace vdm |
| 4 | { |
| 5 | vdm_ctx::vdm_ctx() |
| 6 | { |
| 7 | // already found the syscall's physical page... |
| 8 | if (vdm::syscall_address.load()) |
| 9 | return; |
| 10 | |
| 11 | vdm::ntoskrnl = reinterpret_cast<std::uint8_t*>( |
| 12 | LoadLibraryExA("ntoskrnl.exe", NULL, |
| 13 | DONT_RESOLVE_DLL_REFERENCES)); |
| 14 | |
| 15 | nt_rva = reinterpret_cast<std::uint32_t>( |
| 16 | util::get_kmodule_export( |
| 17 | "ntoskrnl.exe", |
| 18 | syscall_hook.first, |
| 19 | true |
| 20 | )); |
| 21 | |
| 22 | vdm::nt_page_offset = nt_rva % PAGE_4KB; |
| 23 | // for each physical memory range, make a thread to search it |
| 24 | std::vector<std::thread> search_threads; |
| 25 | for (auto ranges : util::pmem_ranges) |
| 26 | search_threads.emplace_back(std::thread( |
| 27 | &vdm_ctx::locate_syscall, |
| 28 | this, |
| 29 | ranges.first, |
| 30 | ranges.second |
| 31 | )); |
| 32 | |
| 33 | for (std::thread& search_thread : search_threads) |
| 34 | search_thread.join(); |
| 35 | } |
| 36 | |
| 37 | void vdm_ctx::set_read(read_phys_t& read_func) |
| 38 | { |
nothing calls this directly
no test coverage detected