Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Retrieving a complete list of Windows processes in C

I am developing a simple process statistics collection library for Windows. I'm enumerating the processes with EnumProcesses() function, and I try to open them with OpenProcess() call with PROCESS_QUERY_INFORMATION flag. The latter one fails for a bunch of system processes, though. At the same time, I see that similar applications (sysinternals tools, task manager, etc) seem to be able to retrieve information about these processes even without requiring Administrator privileges. I tried enabling the SeDebugPrivilege privilege, but it did help only when I ran my program as an Administrator -- and still, I could not open the Idle process, the System process and the audiodg process (I would like to be able to retrieve their information for consistency as well).

So the question is: how can I get information about all the processes (I see it done by 3rd-party applications, but I don't see how)? Is it possible to do it without Administrator privileges?

like image 815
Roman Dmitrienko Avatar asked Apr 14 '12 20:04

Roman Dmitrienko


1 Answers

Are you familiar with CreateToolhelp32Snapshot and this function as well Process32First.

I have found this code-project When I used it a while ago it helped me a lot ...

like image 81
0x90 Avatar answered Oct 26 '22 09:10

0x90