Solved

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

Posted on 2003-11-02
7
570 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
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!

 
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

Industry Leaders: 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

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

739 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