You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1.1 KiB
42 lines
1.1 KiB
#include <Windows.h>
|
|
#include <psapi.h>
|
|
#include "fdelete.hpp"
|
|
|
|
int main()
|
|
{
|
|
auto [drv_handle, drv_key, drv_status] = vdm::load_drv();
|
|
if (drv_status != STATUS_SUCCESS or drv_handle == INVALID_HANDLE_VALUE)
|
|
{
|
|
std::printf("load driver failed... reason: 0x%x\n", drv_status);
|
|
return -1;
|
|
}
|
|
|
|
vdm::read_phys_t _read_phys =
|
|
[&](void* addr, void* buffer, std::size_t size) -> bool
|
|
{
|
|
return vdm::read_phys(addr, buffer, size);
|
|
};
|
|
|
|
vdm::write_phys_t _write_phys =
|
|
[&](void* addr, void* buffer, std::size_t size) -> bool
|
|
{
|
|
return vdm::write_phys(addr, buffer, size);
|
|
};
|
|
|
|
wchar_t process_name[MAX_PATH];
|
|
memset(process_name, NULL, MAX_PATH);
|
|
|
|
GetProcessImageFileNameW(GetCurrentProcess(), process_name, MAX_PATH);
|
|
std::printf("file path: %ws\n", process_name);
|
|
|
|
vdm::vdm_ctx vdm(_read_phys, _write_phys);
|
|
std::printf("delete file result: %d\n", fdelete::remove(&vdm, process_name));
|
|
std::getchar();
|
|
|
|
if ((drv_status = vdm::unload_drv(drv_handle, drv_key)) != STATUS_SUCCESS)
|
|
{
|
|
std::printf("failed to unload driver... reason: 0x%x\n", drv_status);
|
|
return -1;
|
|
}
|
|
}
|