mirror of
https://github.com/TheCruZ/kdmapper
synced 2026-06-06 16:54:27 +00:00
Fix example build
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
#include <filesystem>
|
||||
|
||||
#include <kdmapper.hpp>
|
||||
#include <utils.hpp>
|
||||
#include <intel_driver.hpp>
|
||||
|
||||
|
||||
HANDLE iqvw64e_device_handle;
|
||||
@@ -46,12 +48,11 @@ void help() {
|
||||
Log(L"[+] Usage: kdmapper.exe [--free][--mdl][--PassAllocationPtr] driver" << std::endl);
|
||||
}
|
||||
|
||||
bool callbackExample(ULONG64* param1, ULONG64* param2, ULONG64 allocationPtr, ULONG64 allocationSize, ULONG64 mdlptr) {
|
||||
bool callbackExample(ULONG64* param1, ULONG64* param2, ULONG64 allocationPtr, ULONG64 allocationSize) {
|
||||
UNREFERENCED_PARAMETER(param1);
|
||||
UNREFERENCED_PARAMETER(param2);
|
||||
UNREFERENCED_PARAMETER(allocationPtr);
|
||||
UNREFERENCED_PARAMETER(allocationSize);
|
||||
UNREFERENCED_PARAMETER(mdlptr);
|
||||
Log("[+] Callback example called" << std::endl);
|
||||
|
||||
/*
|
||||
@@ -68,27 +69,6 @@ bool callbackExample(ULONG64* param1, ULONG64* param2, ULONG64 allocationPtr, UL
|
||||
int wmain(const int argc, wchar_t** argv) {
|
||||
SetUnhandledExceptionFilter(SimplestCrashHandler);
|
||||
|
||||
bool free = paramExists(argc, argv, L"free") > 0;
|
||||
bool mdlMode = paramExists(argc, argv, L"mdl") > 0;
|
||||
bool indPagesMode = paramExists(argc, argv, L"indPages") > 0;
|
||||
bool passAllocationPtr = paramExists(argc, argv, L"PassAllocationPtr") > 0;
|
||||
|
||||
if (free) {
|
||||
Log(L"[+] Free pool memory after usage enabled" << std::endl);
|
||||
}
|
||||
|
||||
if (mdlMode) {
|
||||
Log(L"[+] Mdl memory usage enabled" << std::endl);
|
||||
}
|
||||
|
||||
if (indPagesMode) {
|
||||
Log(L"[+] Allocate Independent Pages mode enabled" << std::endl);
|
||||
}
|
||||
|
||||
if (passAllocationPtr) {
|
||||
Log(L"[+] Pass Allocation Ptr as first param enabled" << std::endl);
|
||||
}
|
||||
|
||||
int drvIndex = -1;
|
||||
for (int i = 1; i < argc; i++) {
|
||||
if (std::filesystem::path(argv[i]).extension().string().compare(".sys") == 0) {
|
||||
@@ -121,22 +101,8 @@ int wmain(const int argc, wchar_t** argv) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
kdmapper::AllocationMode mode = kdmapper::AllocationMode::AllocatePool;
|
||||
|
||||
if (mdlMode && indPagesMode) {
|
||||
Log(L"[-] Too many allocation modes" << std::endl);
|
||||
intel_driver::Unload(iqvw64e_device_handle);
|
||||
return -1;
|
||||
}
|
||||
else if (mdlMode) {
|
||||
mode = kdmapper::AllocationMode::AllocateMdl;
|
||||
}
|
||||
else if (indPagesMode) {
|
||||
mode = kdmapper::AllocationMode::AllocateIndependentPages;
|
||||
}
|
||||
|
||||
NTSTATUS exitCode = 0;
|
||||
if (!kdmapper::MapDriver(iqvw64e_device_handle, raw_image.data(), 0, 0, free, true, mode, passAllocationPtr, callbackExample, &exitCode)) {
|
||||
if (!kdmapper::MapDriver(iqvw64e_device_handle, raw_image.data(), 0, 0, free, true, kdmapper::AllocationMode::AllocatePool, false, callbackExample, &exitCode)) {
|
||||
Log(L"[-] Failed to map " << driver_path << std::endl);
|
||||
intel_driver::Unload(iqvw64e_device_handle);
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user