Skip to main content

Posts

Showing posts with the label Debugging

IsDebuggerPresent API Vs Process Environment Block

  Sometimes we've seen some application or process that can't be debugged using any debugger. As soon as we attach a debugger, either the application will terminate or pop up a message like a debugger attached with the process, so terminating the application. What so ever, in windows world, there is an API, which detects if the process is being debugged or not.  It's IsDebuggerPresent() Win32 API. You can refer to the  MSDN  link to get more details on it. So, I've written a test sample below: #include <Windows.h> int _tmain(int argc, _TCHAR* argv[]) {     if (IsDebuggerPresent() == TRUE)     {           MessageBox(NULL,            TEXT("Please close your debugging                 application and restart the program"),            TEXT("Debugger Found!"), 0);         ExitProcess(0);     }     MessageBox(NULL, TEXT("Hello World!"), TEXT("Bypassed"), 0);     ExitProcess(0);     return 0; } As usual, I did compile the code usin