WIN32PDH EnumObjects Error

Mark Hammond mhammond at skippinet.com.au
Sat Jan 26 19:33:34 EST 2002


pirx at mail.com wrote:
> "Dean Houghton" <Wideawake at btopenworld.com> wrote in message news:<a2rlev$dlg$1 at knossos.btinternet.com>...
> 

>>objects =
>>win32pdh.EnumObjects(None,system_name,win32pdh.PERF_DETAIL_WIZARD,1)

>>pywintypes.api_error: (-1073738789, 'EnumObjects for buffer size', 'No error
>>message is available')

>>Any ideas ?? the same code is getting the counters from other machines with
>>no problem but this machine seems to have more counters....

> that's probably it. The win32 api call for that has a pointer to a
> memory chunk allocated earlier (see the example in the pdh help). I
> don't know how Python's wrap-up is doing that, but there must be a
> way...

It is common for these API functions to allow you to pass NULL to the 
function, and its return value is the number of bytes needed in the 
buffer.  So you can call the function twice - once with NULL to get the 
size, then alloc the buffer, then call again with the real buffer.

This is what the Python wrappers do.  The error message "... for buffer 
size" implies that this first call is failing rather than the second 
(ie, the call to determine the buffer size).

A little digging shows that hex(-1073738789) is 0xc0000bdb, and 
PdhMsg.txt has:

//  Unable to access the desired machine or service. Check
// the permissions and authentication of the log service
// or the interactive user session against those on
// the machine or service being monitored.
#define PDH_ACCESS_DENIED                ((DWORD)0xC0000BDBL)

Mark.




More information about the Python-list mailing list