We don't display ads so we rely on your Bitcoin donations to 1KWEk9QaiJb2NwP5YFmR24LyUBa4JyuKqZ
Post date: Sep 15, 2010 4:21:12 AM
It is possible to detect whether or not a debugger is present using the Process Environment Block (PEB).
unit uIsDebuggerPresent;//www.delphibasics.infointerfacefunction IsDebuggerPresent : Boolean;implementationtype PPeb = ^TPeb; TPeb = packed record InheritedAddressSpace : Boolean; ReadImageFileExecOptions : Boolean; BeingDebugged : Boolean; end;function IsDebuggerPresent : Boolean;var PEB : PPEB; LPEB : TPEB;beginasmpush eax
mov eax,fs: $30;
mov PEB, eax
pop eax
end; LPEB := TPEB(PEB^); if LPEB.BeingDebugged then Result := True else Result := False;end;end.