Delphi IDE (89)
Windows with Delphi (280)
Visual Basic (1)
About this site
Links to us
New related comments
Number of comments in the last 48 hours
The meaning of Runtime Error 217
2 new comments
How to detect if an application is being debugged
This article has not been rated yet. After reading, feel free to leave comments and rate it.
Have you ever wondered if the user is trying to debug your application? Don�t count on getting feedback from that user, but a registration code, crack, and/or key generator are more likely. Let�s face it: if the user debugging your application is not part of development or testing team chances are he or she is trying to crack it. Of course, your users may feel committed to helping create bug-free programs but don�t count on it =)
There is no need for sophisticated assembly code or any self-written routines. All you need is pretty much provided by Windows API. IsDebuggerPresent() is supported by Windows 98, ME, and of course all new versions of Windows based on the NT kernel (2000, XP). Just call IsDebuggerPresent() and you can use the result of this function to change the behavior of your application if a debugger is present. Also keep in mind that procedure names are stored in the executable, so you might want to change to name of IsDebuggerPresent() to something less obvious like UpdateEditor() or CalculateArray().
function DebuggerPresent : boolean;
TDebugProc = function : boolean;
Result := False;
Kernel32 := GetModuleHandle('kernel32');
if Kernel32<>0 then
@DebugProc := GetProcAddress(Kernel32, 'IsDebuggerPresent');
if Assigned(DebugProc) then
Result := DebugProc
Walesys@yahoo.com from Nigeria
IsDebuggerPresent can be by passed using close to 40 techniques. For instance the debugged application can be moved to Win95 which has no IsDebuggerPresent API, then start a debugging process.
You can visist some of the site that has info on IsDebuggerPresent: