1
0
mirror of https://github.com/momo5502/hypervisor.git synced 2025-07-05 18:51:53 +00:00

More progress

This commit is contained in:
momo5502
2022-04-14 20:47:40 +02:00
parent 2acac5bee2
commit e2f73e0aeb
10 changed files with 60 additions and 28 deletions

View File

@ -47,12 +47,27 @@ namespace process
bool process_handle::is_alive() const
{
if(!this->handle_)
{
return false;
}
LARGE_INTEGER zero_time{};
zero_time.QuadPart = 0;
return KeWaitForSingleObject(this->handle_, Executive, KernelMode, FALSE, &zero_time) != STATUS_WAIT_0;
}
HANDLE process_handle::get_id() const
{
if(!this->handle_)
{
return 0;
}
PsGetProcessId(this->handle_);
}
const char* process_handle::get_image_filename() const
{
if (!this->handle_)
@ -77,7 +92,8 @@ namespace process
process_handle find_process_by_id(const uint32_t process_id)
{
PEPROCESS process{};
if (PsLookupProcessByProcessId(HANDLE(process_id), &process) != STATUS_SUCCESS)
const uint64_t process_id_long = process_id;
if (PsLookupProcessByProcessId(HANDLE(process_id_long), &process) != STATUS_SUCCESS)
{
return {};
}