luigimarmo / psutil

Automatically exported from code.google.com/p/psutil
Other
0 stars 0 forks source link

AccessDenied raised when getting attributes for non-user-owned processes on Windows 7 (running as admin) #481

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Reproducing the problem:
1. Try to get attributes ('name', 'username' and maybe others) of processes not 
owned by the user (while running as an admin)

Expected result:
It should return the requested values

Actual result:
It raises AccessDenied

psutil version 1.2.1
Python version 2.7.3 and 2.6.6

OS: Windows 7 x86/x64

If I run the following script:

for proc in psutil.process_iter():
    try:
        print proc.pid, proc.name
    except psutil.AccessDenied:
        print "denied"

It prints:

0 0 System Idle Process
4 0 System
428 0 denied
444 0 denied
632 3 chrome.exe
648 0 denied
676 0 explorer.exe
704 0 denied
748 0 denied
772 0 denied
804 0 denied
824 0 denied
832 0 denied
880 0 dwm.exe
920 0 denied
988 0 denied
1052 0 denied
1092 0 denied
1128 0 denied
1156 0 denied
1280 0 denied
1336 0 denied
1440 0 denied
1620 0 denied
1712 0 denied
1772 0 denied
1800 0 denied
1888 0 denied
1924 0 denied
1948 0 denied
1992 0 denied
2040 0 denied
2116 0 denied
2136 0 denied
2188 0 denied
2212 0 denied
2220 0 denied
2248 11 vmware-vmrc.exe
2284 0 denied
2320 0 denied
2372 0 denied
2540 0 denied
2700 0 denied
2780 11 vmware-vmrc.exe
2900 1 VpxClient.exe
2908 0 denied
2932 0 denied
2952 0 denied
...

Original issue reported on code.google.com by grisha...@gmail.com on 17 Feb 2014 at 7:08

GoogleCodeExporter commented 8 years ago
Sorry, wrong printout
This is the correct one:
0 System Idle Process
4 System
428 denied
444 denied
632 chrome.exe
648 denied
676 explorer.exe
704 denied
748 denied
772 denied
804 denied
824 denied
832 denied
880 dwm.exe
920 denied
988 denied
1052 denied
1092 denied
1128 denied
1156 denied
1280 denied
1336 denied
1440 denied
1620 denied
1712 denied
1772 denied
1800 denied
1888 denied
1924 denied
1948 denied
1992 denied
2040 denied
2116 denied
2136 denied
2188 denied
2212 denied
2220 denied
2248 vmware-vmrc.exe
2284 denied
2320 denied
2372 denied
2540 denied
2700 denied
2780 vmware-vmrc.exe
2900 VpxClient.exe
2908 denied
...

Original comment by grisha...@gmail.com on 17 Feb 2014 at 11:33

GoogleCodeExporter commented 8 years ago
Unfortunately there's nothing you can do about that. The error comes directly 
from OpenProcess 
(http://msdn.microsoft.com/en-us/library/windows/desktop/ms684320(v=vs.85).aspx)
.
We already investigated the issue and the only solution appears to be 
installing a system driver.

Original comment by g.rodola on 17 Feb 2014 at 1:34

GoogleCodeExporter commented 8 years ago
Closing this out as there's nothing we can do about it.

Original comment by g.rodola on 21 Apr 2014 at 4:01