Use utils:nt::handle

This commit is contained in:
jazzwolf 2022-10-07 18:52:50 +02:00 committed by GitHub
parent 5db7334759
commit 69a9d58733

View File

@ -1,5 +1,4 @@
#define WIN32_LEAN_AND_MEAN #include <utils/nt.hpp>
#include <Windows.h>
#include <cstdlib> #include <cstdlib>
int __stdcall WinMain(HINSTANCE, HINSTANCE, PSTR, int) int __stdcall WinMain(HINSTANCE, HINSTANCE, PSTR, int)
@ -10,11 +9,10 @@ int __stdcall WinMain(HINSTANCE, HINSTANCE, PSTR, int)
if (parent_proc) if (parent_proc)
{ {
const auto pid = DWORD(atoi(parent_proc + strlen(command))); const auto pid = DWORD(atoi(parent_proc + strlen(command)));
auto* const process_handle = OpenProcess(SYNCHRONIZE, FALSE, pid); const utils::nt::handle<> process_handle = OpenProcess(SYNCHRONIZE, FALSE, pid);
if (process_handle) if (process_handle)
{ {
WaitForSingleObject(process_handle, INFINITE); WaitForSingleObject(process_handle, INFINITE);
CloseHandle(process_handle);
return 0; return 0;
} }
} }