Link to home
Start Free TrialLog in
Avatar of HoratioH
HoratioH

asked on

How do I find a list of all processes currently being debuged?

If I want to get a list of all the processes currently being debuged, how would I do that?

I am looking for all the thread IDs that are involved in the debug process linked to the ProcessID.

So... I am looking for the ProcessID + ThreadIDs of processes being debuged

Please help!!!

Thank you
Avatar of Hypoviax
Hypoviax
Flag of Australia image

Try this modifying this to get a list of running processes. I do not exactly no what you are refering to so i hope this leads ou in the direction you want to head:

function KillTask(ExeFileName: string): integer;
const
  PROCESS_TERMINATE=$0001;
var
  ContinueLoop: BOOL;
  FSnapshotHandle: THandle;
  FProcessEntry32: TProcessEntry32;
begin
  result := 0;
  FSnapshotHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  FProcessEntry32.dwSize := Sizeof(FProcessEntry32); //use FProcessEntry32.szPID to
                                                                                   //get PID
  ContinueLoop := Process32First(FSnapshotHandle, FProcessEntry32);
  while integer(ContinueLoop) <> 0 do begin
    if (StrIComp(PChar(ExtractFileName(FProcessEntry32.szExeFile)), PChar(ExeFileName)) = 0)
       or (StrIComp(FProcessEntry32.szExeFile, PChar(ExeFileName)) = 0)  then
      Result := Integer(TerminateProcess(OpenProcess(
                        PROCESS_TERMINATE, BOOL(0), // BOOL(0) means 'false'
                        FProcessEntry32.th32ProcessID), 0));
    ContinueLoop := Process32Next(FSnapshotHandle, FProcessEntry32);
  end;
  CloseHandle(FSnapshotHandle);
end;

procedure TForm1.Button2Click(Sender: TObject);
begin
  KillTask(Edit1.Text); // 'notepad.exe' for example
end;

Regards,

Hypoviax
Avatar of HoratioH
HoratioH

ASKER

I know how to do this :(

I need to know how to identify that this process in the list is being debuged.
Well now I need to know if this thread and process in the list is being Suspended?
Sorry mate.
ASKER CERTIFIED SOLUTION
Avatar of GloomyFriar
GloomyFriar

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You could call "IsDebuggerPresent" in the context of each process. Not easy to do, though. Maybe my components can help you a bit. E.g. calling madRemote's RemoteExecute can let you execute a function in the context of another process. So you could call "IsDebuggerPresent" there.

http://help.madshi.net
P.S: I think in win9x debugged processes have some special flags in the process database. But first of all you would need to get access to the process database. <sigh>