July 09, 2007

Fixing my performance counter library for Vista

So, back in June I discovered that my performance counter library code didn't work on my new Vista x64 development box... The problem seems to be that the code has always been doing things in an undocumented/unsupported way and it's only now that the old way doesn't actually work at all any more...

I think I know what I need to do to fix the counter installation problem, use the wonderfully unixy named "lodctr" program (or the API alternative) to load the strings for the performance counters rather than simply shoving them into the registry myself... That means that the library code I have needs to be changed so that it writes out the appropriate files (an .ini file and a header file with #defines in it) and then calls LoadPerfCounterTextStrings()...

So I finally have to dive into this code to make some more changes, and since I've been avoiding this for over 7 years now I expect I'll finally do it properly. I expect that means the following need to be done: bring the code into line with my coding standards, remove all of the nasty asserts, protect the kernel objects that we use for IPC with appropriate security descriptors that make use of the new vista defined groups and add some tests.

The main thing that has put me off of changing this code before was that I wanted to add tests to it and the main area that I wanted to have some tests for was the registry updates... This desire spawned the work that I did for Mock32 but never quite got to the point where I could run tests on code with a mock registry underneath them. Now that the code needs to use LoadPerfCounterTextStrings() rather than accessing the registry I can intercept this one API call and check that everything is as it should be...


Share this entry: Email it! | bookmark it! | digg it! | reddit!

Posted by Len at July 9, 2007 11:43 AM | Comments (4) | Categories : Geek Speak
Comments

As if by conincidence, does this have anything to do with your Vista Perflib woes? http://blogs.technet.com/markrussinovich/archive/2007/07/09/1449341.aspx

Posted by: Sean Pearce at July 9, 2007 04:41 PM

No, though I thought it would be permissions to start with. It seems like the registry key concerned is now 'special' and you cant write to it (which is good really as it was easy to screw it up and render the whole system's perfmon system inoperable).

Posted by: Len at July 10, 2007 10:36 AM

Have you considered to use ATL for performance counters?

Posted by: andrey at July 18, 2007 03:07 AM

I did, but it's a dependency that I didn't want to introduce.

Posted by: Len at July 18, 2007 07:40 AM
Post a comment









Remember personal info?




Enter this code in the box below to prove that you're not some kind of automated spam robot...