Getting a complete list of Windows processes in C

I am developing a simple process statistics collection library for Windows. I enumerate processes using the EnumProcesses() function, and I try to open them by calling OpenProcess() with the PROCESS_QUERY_INFORMATION flag. However, the latter fails for a bunch of system processes. At the same time, I see that similar applications (sysinternals tools, task manager, etc.) seem to be able to receive information about these processes without even requiring administrator privileges. I tried to enable the SeDebugPrivilege privilege, but that only helped when I ran my program as an administrator. And yet I could not open the Idle process, the system process and the audiodg process (I would like to get their information for consistency as well).

So, the question is, how can I get information about all processes (I see third-party applications doing it, but I don’t see how)? Is it possible to do this without administrator rights?

+6
source share
1 answer

You are familiar with CreateToolhelp32Snapshot and this function is also Process32First .

I found this code-project. When I used it some time ago, it helped me a lot ...

+2
source

Source: https://habr.com/ru/post/913217/


All Articles