[python-win32] RE : win32pdhutil.ShowAllProcesses() fails

Charles BROSSOLLET cbrossollet at imagine-optic.com
Sat Jul 15 14:31:02 CEST 2006


I think I found the problem : the object name that is passed to EnumObjectItems must be localized in the system language!!
damned Windows...
 
I used win32process functions to get the work done, I post it so in case it can help somebody...
 
import win32process, win32api, winnt, os
def GetProcessNames():
    id_list = win32process.EnumProcesses()
    result = []
    for id in id_list:
        try:
            try:
                proc_handle =win32api.OpenProcess(
                        winnt.PROCESS_QUERY_INFORMATION | winnt.PROCESS_VM_READ,
                        False, id)
                module_handle = win32process.EnumProcessModules(proc_handle)[0]
                process_path = win32process.GetModuleFileNameEx(proc_handle, module_handle)
                result.append(os.path.basename(process_path))
            finally:
                win32api.CloseHandle(proc_handle)
        except:
            pass
    return result


________________________________

De: python-win32-bounces at python.org de la part de Charles BROSSOLLET
Date: sam. 15/07/2006 11:45
À: Mark Hammond; python-win32
Objet : [python-win32] RE : win32pdhutil.ShowAllProcesses() fails


when I looked again in the archives, I looks that people who have the problem are on non-english OSes... Maybe it is related? 
 
Cheers
 
Charles

________________________________

De: Mark Hammond [mailto:mhammond at skippinet.com.au]
Date: sam. 15/07/2006 03:00
À: Charles BROSSOLLET; 'python-win32'
Objet : RE: [python-win32] win32pdhutil.ShowAllProcesses() fails


I'm afraid I can't help much.  It looks like the API function is failing with PDH_CSTATUS_NO_OBJECT.  A quick google for this shows a win2k related knowledge-base article, but nothing specific to Windows XP - but hopefully knowing the exact error code being returned by PDH is useful.
 
Cheers,
 
Mark
 
 -----Original Message-----
From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org]On Behalf Of Charles BROSSOLLET
Sent: Saturday, 15 July 2006 3:16 AM
To: python-win32
Subject: [python-win32] win32pdhutil.ShowAllProcesses() fails



	Hello,
	 
	I cannot manage to use the ShowAllProcesses() function, it returns the following error :
	 
	>>> win32pdhutil.ShowAllProcesses()
	Traceback (most recent call last):
	  File "<input>", line 1, in ?
	  File "C:\Python24\Lib\site-packages\win32\lib\win32pdhutil.py", line 95, in ShowAllProcesses
	    items, instances = win32pdh.EnumObjectItems(None,None,object, win32pdh.PERF_DETAIL_WIZARD)
	error: (-1073738824, 'EnumObjectItems for buffer size', 'No error message is available')
	
	I'm using ActivePython 2.4.3 with win32all build 208, on WinXP SP2.
	 
	Thanks in advance for your support!
	 
	Charles Brossollet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20060715/2753ee9d/attachment.htm 


More information about the Python-win32 mailing list