Strange problem with pdh.dll

Hi!
Something very strange is happening with pdh.dll functions. Here’s the code:

HQUERY hCPUQuery = NULL;
HCOUNTER hCPUCounter = NULL;

::PdhOpenQuery(NULL, 0, &hCPUQuery);
::PdhAddCounter(
hCPUQuery,
“\Processor(0#0)\% Processor Time”,
0,
&m_hCPUCounter);

::PdhRemoveCounter(hCPUCounter);
::PdhCloseQuery(hCPUQuery);

If I run this from the debugger, the code crashes during a call to
PdhAddCounter (access violation somwhere inside PDH.DLL) If I run this from a
command line (also debug version), everything works fine…

Can anyone tell me what’s happening?

Env: W2k SP1, VC 6.0 SP4

TIA,

Marko
ICQ: 5990814

FORTUNE PROVIDES QUESTIONS FOR THE GREAT ANSWERS: #21
A: Dr. Livingston I. Presume.
Q: What’s Dr. Presume’s full name?


You are currently subscribed to ntdev as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntdev-$subst(‘Recip.MemberIDChar’)@lists.osr.com