Saltarse truco antidebug con mi clase tdebugger

2 views
Skip to first unread message

aguml

unread,
May 29, 2020, 8:01:54 PM5/29/20
to CyC++ Buenos Aires
Buenas, estoy intentando que mi debugger se salte el nuevo truco que usan en Windows 10 para detectar al debugger. El código que usan es este:
void __stdcall _OutputDebugStringW(LPCWSTR lpOutputString)
{
char outputDebugStringBuffer[1000] = {0};
WideCharToMultiByte(CP_ACP, 0, lpOutputString, -1, outputDebugStringBuffer, sizeof(outputDebugStringBuffer), 0, 0);

ULONG_PTR args[4];

//unicode
args[0] = (ULONG_PTR)wcslen(lpOutputString) + 1;
args[1] = (ULONG_PTR)lpOutputString;

//ansi for compatibility
args[2] = (ULONG_PTR)wcslen(lpOutputString) + 1;
args[3] = (ULONG_PTR)outputDebugStringBuffer;

__try
{
RaiseException(0x4001000A, 0, 4, args);//DBG_PRINTEXCEPTION_WIDE_C
ShowMessageBox("DBG_PRINTEXCEPTION_WIDE_C -> Debugger detected");
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
ShowMessageBox("DBG_PRINTEXCEPTION_WIDE_C -> Debugger NOT detected");
}
}

Si hay un debugger no hay excepción y si no hay debugger si la hay y así es como detecta al debugger. La cosa es que necesito enviarle esa excepción para que vaya al lugar que me interesa pero no sé qué debo hacer para eso. Para en el evento de depuración OutputDebugString ¿Le envío la excepción EXCEPTION_EXECUTE_HANDLER? ¿Eso funcionaria? ¿Como hago que la aplicación reciba esa excepción y la maneje el?

aguml

unread,
Jun 2, 2020, 1:47:59 PM6/2/20
to CyC++ Buenos Aires
Solucionado, el truco es devolverle DBG_EXCEPTION_NOT_HANDLED desde el evento OutputDebugString.
Reply all
Reply to author
Forward
0 new messages