Process '& Module Enumeration Class
Posted
by JaeKi Lee
on February 9th, 2000
This article presents a class (CPSAPI) which can be used to enumerate all of the processes, modules and even device drivers currently executing on either a Windows 9x or Windows NT machine.
As you can see in the provided demo application, this class is extremely easy to use. All you need to is the following:
- Derive a class from the CPSAPI base class
- Implement the derived class' OnXXX method that correlates to the desired function:
- virtual BOOL OnDeviceDriver(LPVOID lpImageBase);
- virtual BOOL OnProcess(LPCTSTR lpszFileName, DWORD ProcessID);
- virtual BOOL OnModule(HMODULE hModule, LPCTSTR lpszModuleName, LPCTSTR lpszPathName);
- Instantiate your object
- Call the object's Initialize method
- Call the desired enumeration function:
- BOOL EnumDeviceDrivers(void);
- BOOL EnumProcesses(void);
- BOOL EnumProcessModules(DWORD dwProcessId);
If this sounds a bit difficult, not to worry. A demo application I included with this article illustrates how to do all this.

Comments
Process ID & ATTRIBUTES ???
Posted by Legacy on 12/23/2003 12:00amOriginally posted by: Dino
Hello im an IT student & currently following OS as a subject... I would like to know how to get da Process ID & process attributes of a running process. Is thereAny methods to be used ?? in windows 2000 ofcourse Thankx in advance !!
Replyhow to get parent process ID on Winnt 4.0
Posted by Legacy on 07/15/2003 12:00amOriginally posted by: Joseph
how to get parent process ID on Winnt 4.0
Replywelcome provide a solution...... wait for Hi cracke
Minor bug in 'EnumProcessModules()'
Posted by Legacy on 06/09/2003 12:00amOriginally posted by: Robert
Replyhow can I know a port is opened by which process ?
Posted by Legacy on 05/24/2003 12:00amOriginally posted by: woo
There is a lot's of applitcation started when my OS boot. Some of these app open a TCP port on my computer, I wish somebody tell me how can I know a port is opened by which process ?
I wish I Know any answer for this question,too.
ReplyHow to enumerate the currently opened windows?
Posted by Legacy on 02/25/2003 12:00amOriginally posted by: John Lu
I have a exe file, and I want to know whether it is running, if it is running, I also want to get it's hwnd. How to do it?
ReplyHow to find the status of an Application/Process
Posted by Legacy on 10/04/2001 12:00amOriginally posted by: Ovais
ReplyAbout process and it's open port...
Posted by Legacy on 08/20/2001 12:00amOriginally posted by: Billy
Hi all
There is a lot's of applitcation started when my OS boot. Some of these app open a TCP port on my computer, I wish somebody tell me how can I know a port is opened by which process ?
ReplyHow can I end tasks?
Posted by Legacy on 12/15/2000 12:00amOriginally posted by: ThoWa
I'm looking for a solution to end a task under WinNT4.0 like it is possible with the task manager.
ReplySlight modification needed for Windows 2000
Posted by Legacy on 11/24/2000 12:00amOriginally posted by: Sarbendu Paul
ReplyWMI and processes
Posted by Legacy on 05/25/2000 12:00amOriginally posted by: tig
Reply
Loading, Please Wait ...