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…