Im writing a little ProcessViewer for the console. I enumerate all processIDs and open each ID with OpenProcess for getting the name of the process. Open Process uses PROCESS_QUERY_INFORMATION or PROCESS_VM_READ for opening. My Problem is that with this way i can only read my processes, but not f.e. processes of SYSTEM. I know, that when im admin, i can get DEBUG_PRIVILEGES to open all processes. The taskmanager runs not as admin but it can show me all processes. Any idea? Do i need to request for a special privilege to read all processes as normal user?
Posted on 2003-08-03 14:33:35 by belial
Posted on 2003-08-03 14:41:05 by Mecurius

use the ToolHelp32 windows api:

This api is not available in win NT, so you would need tha psapi.dll:
Posted on 2003-08-03 23:41:25 by n u M I T_o r
Yeah, you have to load the psapi via LoadLibrary and GetProcAddress.If you use the lib files your app will fail to run on all versions of Win9x as it will attempt to load the psapi module at start up. This psapi is only necessary if you plan to make your app compatible with NT4 and lower, Win2K and XP both support the ToolHelp api as do all versions of 9x and ME.
Posted on 2003-08-03 23:47:49 by donkey
The Processviewer is at the moment only for for winnt/2k/xp and i use already the psapi dll. I use EnumProcesses() for getting all ProcessIDs and then I open each ID in a loop with OpenProcess. After opening them successfully, I can use EnumProcessModules() and GetModuleBaseName() to get the name. But my problem is that i can only open my own processes with open process. I only want read access, but windows doesnt allow me to open a process which is own by the administrator or system. When i start the taskmanager, i see that it shows me the names of all processes. Why can it do that and my program not?
Posted on 2003-08-04 06:57:48 by belial