Add BeingDebugged debugger detection

This commit is contained in:
Alberto Ortega 2021-11-08 19:26:39 +01:00
parent d69f67157f
commit c6c28ab896
3 changed files with 12 additions and 0 deletions

View File

@ -4,6 +4,7 @@
#include <windows.h>
#include "debuggers.h"
#include "utils.h"
#include "types.h"
int debug_isdebuggerpresent() {
@ -26,3 +27,9 @@ int debug_outputdebugstring() {
return FALSE;
}
}
int debug_beingdebugged_peb() {
struct _PEB_wine * PEB;
PEB = pafish_get_PEB();
return PEB->BeingDebugged == 1 ? TRUE : FALSE;
}

View File

@ -6,4 +6,6 @@ int debug_isdebuggerpresent();
int debug_outputdebugstring();
int debug_beingdebugged_peb();
#endif

View File

@ -99,6 +99,9 @@ int main(void)
exec_check("Using IsDebuggerPresent()", &debug_isdebuggerpresent,
"Debugger traced using IsDebuggerPresent()",
"hi_debugger_isdebuggerpresent");
exec_check("Using BeingDebugged via PEB access", &debug_beingdebugged_peb,
"Debugger traced using PEB BeingDebugged",
"hi_debugger_beingdebugged_PEB");
/* This is only working on MS Windows systems prior to Vista */
if (winver.dwMajorVersion < 6) {
exec_check("Using OutputDebugString()",