-
Notifications
You must be signed in to change notification settings - Fork 6
Example: Get Current Process List
Hanjun Kim edited this page Mar 11, 2019
·
4 revisions
This example demonstrates how to get current process list. Basically, you have two choices to do that:
- Using
WTSEnumerateProcesses
- Using
CreateToolhelp32Snapshot
,Process32First
andProcess32Next
Here's how to choose which one to use.
Using WTSEnumerateProcesses
is bit easier, but has a limitation:
can get only limited information about process: session id, process id, process name, user sid.
If you're just gonna check if process exists by its name, it's totally fine to use this approach.
But if you want to check its parent process' id, you should use the other one and this time
you have to do more job with session id.
Personally I prefer to use WTSEnumerateProcesses
because it's simple and in my work
I need to know which session the process belongs to.
See example/processlist for details.
(WIP)