diff --git a/pafish/debuggers.c b/pafish/debuggers.c index 2b52473..b7badf9 100644 --- a/pafish/debuggers.c +++ b/pafish/debuggers.c @@ -4,6 +4,7 @@ #include #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; +} diff --git a/pafish/debuggers.h b/pafish/debuggers.h index 2d35a0c..664692a 100644 --- a/pafish/debuggers.h +++ b/pafish/debuggers.h @@ -6,4 +6,6 @@ int debug_isdebuggerpresent(); int debug_outputdebugstring(); +int debug_beingdebugged_peb(); + #endif diff --git a/pafish/main.c b/pafish/main.c index 093a761..cca16fa 100644 --- a/pafish/main.c +++ b/pafish/main.c @@ -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()",