diff --git a/src/driver/driver_main.cpp b/src/driver/driver_main.cpp index 19143a9..9a67bbb 100644 --- a/src/driver/driver_main.cpp +++ b/src/driver/driver_main.cpp @@ -7,8 +7,8 @@ #include "globals.hpp" #include "process_callback.hpp" -#define DOS_DEV_NAME L"\\DosDevices\\HelloDev" -#define DEV_NAME L"\\Device\\HelloDev" +#define DOS_DEV_NAME L"\\DosDevices\\HyperHook" +#define DEV_NAME L"\\Device\\HyperHook" class global_driver { diff --git a/src/driver/irp.cpp b/src/driver/irp.cpp index e0250f7..7b98fbb 100644 --- a/src/driver/irp.cpp +++ b/src/driver/irp.cpp @@ -123,7 +123,7 @@ namespace void watch_regions(const watch_request& watch_request) { - auto* hypervisor = hypervisor::get_instance(); + const auto* hypervisor = hypervisor::get_instance(); if (!hypervisor) { throw std::runtime_error("Hypervisor not installed"); diff --git a/src/runner/main.cpp b/src/runner/main.cpp index a36bd8d..5b7a874 100644 --- a/src/runner/main.cpp +++ b/src/runner/main.cpp @@ -213,86 +213,21 @@ void report_records(const std::atomic_bool& flag, const driver_device& driver_de void unsafe_main(const int /*argc*/, char* /*argv*/[]) { - //{ - const auto driver_file = extract_driver(); + const auto driver_file = extract_driver(); - driver driver{driver_file, "MomoLul"}; - const driver_device driver_device{R"(\\.\HelloDev)"}; + driver driver{driver_file, "HyperHook"}; + const driver_device driver_device{R"(\\.\HyperHook)"}; - const auto pid = get_process_id(); + const auto pid = get_process_id(); - printf("Opening process...\n"); - auto proc = process::open(pid, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ); - if (!proc) - { - printf("Failed to open process...\n"); - return; - } - - /*printf("Reading modules...\n"); - const auto modules = process::get_modules(proc); - printf("Found %zu modules:\n", modules.size()); - - std::vector module_files{}; - module_files.reserve(modules.size()); - - int i = 0; - for (const auto& module : modules) - { - auto name = process::get_module_filename(proc, module); - printf("(%i)\t%p: %s\n", i++, static_cast(module), name.data()); - module_files.emplace_back(std::move(name)); - } - - // We don't need this anymore - proc = {}; - - std::string module_str{}; - printf("\nPlease enter the module number: "); - std::getline(std::cin, module_str); - - const auto module_num = atoi(module_str.data()); - - if (module_num < 0 || static_cast(module_num) >= modules.size()) - { - printf("Invalid module num\n"); - _getch(); - return; - } - - const auto target_module = modules[module_num]; - const auto module_base = reinterpret_cast(target_module); - const auto& file = module_files[module_num]; - printf("Analyzing %s...\n", file.data()); - const auto regions = find_executable_regions(file); - - printf("Executable regions:\n"); - for (const auto& region : regions) - { - printf("%p - %zu\n", module_base + region.first, region.second); - } - - watch_regions(driver_device, pid, target_module, regions); - - std::atomic_bool terminate{false}; - std::thread t([&]() - { - printf("\nWatching access:\n"); - report_records(terminate, driver_device, pid, target_module, regions); - }); - - - _getch(); - - terminate = true; - t.join(); + printf("Opening process...\n"); + auto proc = process::open(pid, PROCESS_QUERY_INFORMATION | PROCESS_VM_READ); + if (!proc) + { + printf("Failed to open process...\n"); + return; } - printf("\nWatching stopped.\n"); - _getch(); - - return;*/ - // IW5 insert_nop(driver_device, pid, 0x4488A8, 2); // Force calling CG_DrawFriendOrFoeTargetBoxes @@ -312,18 +247,6 @@ void unsafe_main(const int /*argc*/, char* /*argv*/[]) patch_data(driver_device, pid, 0x443A2A, data3, sizeof(data3)); patch_data(driver_device, pid, 0x443978, data3, sizeof(data3)); - - /* - insert_nop(driver_device, pid, 0x441D5A, 6); - insert_nop(driver_device, pid, 0x525104, 2); - insert_nop(driver_device, pid, 0x525121, 2); - - constexpr uint8_t data3[] = {0xEB}; - patch_data(driver_device, pid, 0x525087, data3, sizeof(data3)); - patch_data(driver_device, pid, 0x524E7F, data3, sizeof(data3)); - patch_data(driver_device, pid, 0x52512C, data3, sizeof(data3)); - */ - printf("Press any key to disable all hooks!\n"); (void)_getch();