Recent

Author Topic: IsDebuggerPresent  (Read 4825 times)

jw

  • Full Member
  • ***
  • Posts: 126
IsDebuggerPresent
« on: May 08, 2010, 10:36:45 pm »
This is windows specific

The program lookes to see if a debugger is present or if it's being run in a debugger.  If anyone knows how to check without calling an API I'd love to see some code.

below is a program I wrote it returns a 1 if debugger is present 0 if not
now something for this topic should show up in the forum search.


Code: [Select]

unit Unit1;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, LResources, Forms, Controls, Graphics, Dialogs,
  StdCtrls,windows;




  function IsDebuggerPresent () : integer stdcall; external 'kernel32.dll';



type

  { TForm1 }

  TForm1 = class(TForm)
    Button1: TButton;
    Edit1: TEdit;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
  private
    { private declarations }
  public
    { public declarations }
  end;

var
  Form1: TForm1;

implementation

{ TForm1 }



procedure TForm1.FormCreate(Sender: TObject);
begin

end;

procedure TForm1.Button1Click(Sender: TObject);
begin


edit1.text := inttostr(IsDebuggerPresent);
end;

initialization
  {$I unit1.lrs}

end.
                                               


 

TinyPortal © 2005-2018