
(C++) CloseHandle, NtClose by External
June 22, 2022, 4:14 a.m. | 2 weeks
Description:
Original source code is available here: https://anti-debug.checkpoint.com/techniques/object-handles.html#closehandle
Code
bool Check()
{
__try
{
CloseHandle((HANDLE)0xDEADBEEF);
return false;
}
__except (EXCEPTION_INVALID_HANDLE == GetExceptionCode()
? EXCEPTION_EXECUTE_HANDLER
: EXCEPTION_CONTINUE_SEARCH)
{
return true;
}
}