Chapter 22. Enumerating Processes and Modules

 

Never let your sense of morals get in the way of doing what’s right.

 
 --Isaac Asimov
 

This is my shiny thing. And if you try and take it off me I may have to eat you.

 
 --Cat, Red Dwarf

The Windows Process Status API (PSAPI) provides several methods for accessing system state information. For processes, the simplest and most common method is via the EnumProcesses() function, defined as follows:

BOOL EnumProcesses( DWORD*  pProcessIds
                  , DWORD   cb
                  , DWORD*  pBytesReturned);

pProcessIds points to an array into which the process identifiers of process objects in the system are returned. cb is the size of this array, measured in bytes. pBytesReturned points to a single variable that receives the number of bytes ...

Get Extended STL, Volume 1: Collections and Iterators now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.