Solved

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

Posted on 2003-11-02
7
571 Views
Last Modified: 2010-05-18
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
0
Comment
Question by:HoratioH
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 5

Expert Comment

by:Hypoviax
ID: 9675673
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
0
 

Author Comment

by:HoratioH
ID: 9676622
I know how to do this :(

I need to know how to identify that this process in the list is being debuged.
0
 

Author Comment

by:HoratioH
ID: 9681526
Well now I need to know if this thread and process in the list is being Suspended?
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 5

Expert Comment

by:Hypoviax
ID: 9692324
Sorry mate.
0
 
LVL 6

Accepted Solution

by:
GloomyFriar earned 150 total points
ID: 9721651
Here is a small addition to the code I've sent to you before.
It'll give you suspended threads.

scnt: DWORD;

...
        if (Thread32First(hSnapshoot, the32)) then
        repeat
            ShowMessage('Got thread!');
            hDestTh := _imp_OpenThread(THREAD_ALL_ACCESS, False, the32.th32ThreadID);
            scnt := SuspendThread(hDestTh);
            if scnt > 0 then begin
              ShowMessage('The thread is suspended !');
            end;
            ResumeThread(hDestTh);
        until not Thread32Next(hSnapshoot, the32);
...
0
 
LVL 20

Expert Comment

by:Madshi
ID: 9797668
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
0
 
LVL 20

Expert Comment

by:Madshi
ID: 9797677
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>
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
If you're a developer or IT admin, you’re probably tasked with managing multiple websites, servers, applications, and levels of security on a daily basis. While this can be extremely time consuming, it can also be frustrating when systems aren't wor…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

687 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question