mirror of
https://github.com/momo5502/hypervisor.git
synced 2025-07-05 10:41:50 +00:00
Cleanup hook irp
This commit is contained in:
@ -104,4 +104,24 @@ namespace memory
|
||||
ExFreePool(memory);
|
||||
}
|
||||
}
|
||||
|
||||
bool prope_for_read(const void* address, const size_t length, const uint64_t alignment)
|
||||
{
|
||||
__try
|
||||
{
|
||||
ProbeForRead(const_cast<volatile void*>(address), length, static_cast<ULONG>(alignment));
|
||||
return true;
|
||||
}
|
||||
__except (EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
void assert_readability(const void* address, const size_t length, const uint64_t alignment)
|
||||
{
|
||||
if(!prope_for_read(address, length, alignment)) {
|
||||
throw std::runtime_error("Access violation");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user