processlist
Similar to how enumerating registry values works, listing processes also works on the same concept. Since the processes in real-time change fast, a snapshot of the process list needs to be taken. The snapshot contains a list of process information at the time the snapshot was taken. The snapshot can be taken using CreateToolhelp32Snapshot. The result is stored in hSnapshot, which is the snapshot handle.
To begin enumerating the list, Process32First is used to acquire the first process information from the list. This information is stored in the pe32 variable, which is a PROCESSENTRY32 type. Subsequent process information is retrieved by calling Process32Next. CloseHandle is finally used when done with the list.
Again, printf ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access