[pywin32-bugs] [ pywin32-Feature Requests-3529527 ] add AddEnglishCounter in win32pdh
OLD project page for the Python extensions for Windows
Brought to you by:
mhammond
From: SourceForge.net <no...@so...> - 2012-06-04 23:02:40
|
Feature Requests item #3529527, was opened at 2012-05-24 11:06 Message generated for change (Comment added) made by rupole You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=3529527&group_id=78018 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: win32 Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Sebastian (argos83) Assigned to: Nobody/Anonymous (nobody) Summary: add AddEnglishCounter in win32pdh Initial Comment: Counter paths in win32pdh are language dependent. For instance, the following code will raise a pywintypes.error when run on a not English Windows.: import win32pdh path = win32pdh.MakeCounterPath(( None, 'System', None, None, 0, 'System Up Time')) query = win32pdh.OpenQuery() handle = win32pdh.AddCounter(query, path) E.g., to make that work on a Spanish Windows, the MakeCounterPath line should be: path = win32pdh.MakeCounterPath(( None, 'Sistema', None, None, 0, 'Tiempo de actividad del sistema')) Which makes it real hard to distribute a solution that is supposed to run on different language platforms. To avoid that, there's this PdhAddEnglishCounter function: http://msdn.microsoft.com/en-us/library/windows/desktop/aa372536(v=vs.85).aspx Which is not implemented on pywin. If implemented, this should work on any windows language: import win32pdh path = win32pdh.MakeCounterPath(( None, 'System', None, None, 0, 'System Up Time')) query = win32pdh.OpenQuery() handle = win32pdh.AddEnglishCounter(query, path) AddCounter and AddEnglishCounter functions have the same signature. I guess that adding the following to win32pdhmodule.cpp should be enough: typedef PDH_STATUS (WINAPI * FuncPdhAddEnglishCounter)( HQUERY hQuery, // handle to the query LPCTSTR szFullCounterPath, // path of the counter DWORD_PTR dwUserData, // user-defined value HCOUNTER *phCounter // pointer to the counter handle buffer ); ---------------------------------------------------------------------- >Comment By: Roger Upole (rupole) Date: 2012-06-04 16:02 Message: AddEnglishCounter has been added to win32pdh. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=551957&aid=3529527&group_id=78018 |