mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-04-19 13:42:55 +00:00
More cleanup
This commit is contained in:
parent
1b14d5f657
commit
40b6f5efae
@ -138,9 +138,6 @@ namespace
|
||||
|
||||
switch (ioctr_code)
|
||||
{
|
||||
case HELLO_DRV_IOCTL:
|
||||
debug_log("Hello from the Driver!\n");
|
||||
break;
|
||||
case HOOK_DRV_IOCTL:
|
||||
try_apply_hook(irp_sp);
|
||||
break;
|
||||
|
@ -46,17 +46,17 @@ void insert_nop(const driver_device& driver_device, const uint32_t pid, const ui
|
||||
patch_data(driver_device, pid, addr, buffer.data(), buffer.size());
|
||||
}
|
||||
|
||||
void remove_hooks(const driver_device& driver_device)
|
||||
{
|
||||
(void)driver_device.send(UNHOOK_DRV_IOCTL, driver_device::data{});
|
||||
}
|
||||
|
||||
void unsafe_main(const int /*argc*/, char* /*argv*/[])
|
||||
{
|
||||
printf("Pid: %lu\n", GetCurrentProcessId());
|
||||
|
||||
driver driver{get_current_path() / "driver.sys", "MomoLul"};
|
||||
driver_device driver_device{"\\\\.\\HelloDev"};
|
||||
|
||||
driver_device::data input{};
|
||||
input.resize(4);
|
||||
|
||||
(void)driver_device.send(HELLO_DRV_IOCTL, input);
|
||||
const driver_device driver_device{R"(\\.\HelloDev)"};
|
||||
|
||||
std::string pid;
|
||||
std::cout << "Please, enter the pid: ";
|
||||
@ -84,8 +84,7 @@ void unsafe_main(const int /*argc*/, char* /*argv*/[])
|
||||
printf("Press any key to disable all hooks!\n");
|
||||
_getch();
|
||||
|
||||
input.resize(0);
|
||||
(void)driver_device.send(UNHOOK_DRV_IOCTL, input);
|
||||
remove_hooks(driver_device);
|
||||
|
||||
printf("Press any key to exit!\n");
|
||||
_getch();
|
||||
|
@ -1,8 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#define HELLO_DRV_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define HOOK_DRV_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define UNHOOK_DRV_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x802, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define HOOK_DRV_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
#define UNHOOK_DRV_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x801, METHOD_NEITHER, FILE_ANY_ACCESS)
|
||||
|
||||
static_assert(sizeof(void*) == 8);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user