Can anyone explain me what is going on when I call
RegQueryValueExW(HKEY_PERFORMANCE_DATA, L"Counter 009", NULL, dwType,
pDataBuffer, &dwDataBufferSize); ?
Why the value of "Counter" value is changed under
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\019
key (I have system default locale set to Russian) when I change my locale?
Configuration: I have WindowsNT4.0 Server, SP4.
Thanks,
Jury
"Counter 009" does not seem to be a correct value; first, it must be just
"009"; second, if I remember correctly, counter values are even; the odd
values are reserved for descriptions.
> Why the value of "Counter" value is changed under
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows
NT\CurrentVersion\Perflib\019
> key (I have system default locale set to Russian) when I change my locale?
Sorry, could you explain in more details what and how is changed?
--
Slava
Please send any replies to this newsgroup.
> Why the value of "Counter" value is changed under
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\019
> key (I have system default locale set to Russian) when I change my locale?
Counter IDs (which, as Slava said, are even) are assigned on a
first-come, first-served base. Different perflibs may choose to install
different counters for different language IDs. Do not rely on their
values, look in the registry instead.
--
Cheers,
Felix.
If you post a reply, kindly refrain from emailing it, too.
Note to spammers: fel...@mvps.org is my real email address.
No anti-spam address here. Just one comment: IN YOUR FACE!
The real question is: How should I register my counter names that they could
be seen under perfmon independ of what locale is set? Writing to Couter
value under each subkey of HKLM\.....\Perflib does not seem to be the right
way.
Perhaps you can advise me more appropriate conference?
Thanks for answering.
Felix Kasza [MVP] wrote in message <376118c5....@207.46.180.23>...
> 1. As Slava wrote according to documentation I can call RegQueryValueEx
> passing HKEY_PERFORMANCE_DATA and a string "Global" or string with counter
> numbers divided with spaces etc. But if you look at Perfmon code (it is
> shiped with VC++ 5.0 SAMPLES\SDK\SDKTOOLS\WINNT\PERFMON) it calls
> RegQueryValueEx passes HKEY_PERFORMANCE_DATA and string "Counter 009" (the
> number depends on user locale) to get the counter names if the Version is
> greater then 0x10000 (HKLM\.......\Perflib key). If version is equal or
less
> then 0x10000 it opens 009 subkey and reads Counter value.
Interesting. Time to look into the perfmon code again...
> 2. I have very strange behavior. Here the steps I performed to test:
> 1) Change locale to German(Standart), append "Test" string to Counter
value
> under each subkey (009 and 019 subkeys; 009 contains full set of counter
> names, but Counter value is empty under 019 subkey) of
> HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib
key.
> 2) Change locale to English(U.S.), look at Couter value. Under 009 subkey
it
> the same as it was, but under 019 subkey Counter value contains full set
of
> counter names. Now remove the "Test" string from Counter value under each
> subkey (009 and 019)
> 3) Again change locale to German(Standart). Now Counter value under 009
> subkey does not contain "Test" string, but under 019 subkey Counter value
> contains the only string "Test". Why can this happen?
No idea. Looks like some piece of code tracks changes of counter
names/descriptions across locale changes.
> The real question is: How should I register my counter names that they
could
> be seen under perfmon independ of what locale is set? Writing to Couter
> value under each subkey of HKLM\.....\Perflib does not seem to be the
right
> way.
Re-read the article "Adding Counter Names and Descriptions to the Registry"
in the Platform SDK.
1. It suggest using "lodctr.exe" or "LoadPerf.dll" to add counters.
2. The .ini file that contains data on objects/counters you're adding must
contain info for ANY language that should be supported; there is NO way to
support ALL languages without actually providing info for ALL of them.
So, I guess you'll be OK if you just create names/descriptions for US
English and Russian and register them via lodctr.exe.
Ok, thanks a lot. Since documentation says to use lodctr.exe may be it is
incorrect to modify land subkey with register function. I'll try the with
lodctr.exe
> Now Counter value under 009 subkey does not contain "Test"
> string, but under 019 subkey Counter value contains the
> only string "Test". Why can this happen?
I concur with Slava -- use documented methods for adding counters. Doing
it any other way, I got burned.
> But if you look at Perfmon code [...] it calls RegQueryValueEx
> passes HKEY_PERFORMANCE_DATA and string "Counter 009" (the
> number depends on user locale)
That's nice. However, my SDK documentation says nothing about this, so
I'll stay away from it.