Performance counter installation on Vista

I’ve been aware that there was a ’need to run as Administrator’ issue with some of my server examples for a while; only the ones that installed/removed performance counter dlls or installed/removed themselves as Windows Services. The service installation problem was obvious, you got a message box saying that the user had insufficient rights and now, on Vista, this message box lets you try again and it relaunches the application with the “run_as” verb and you get a chance to run it as Admin… The performance counter issue seems more complex. Firstly the counters I use are based on some code from Programming Server Side Applications by Jeffrey Richter and I lamented on how code reuse can bite you way back in 2000… I still haven’t got around to rewriting the code to my house style so it still uses assertions and it still doesn’t report errors in a way that I’d like… Anyway… Today I’ve spent a while trying to work out why, on my 64 bit Vista box, I can’t write to HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Perflib\009\Counters even as an Administrator… I still haven’t found the reason, I get a ‘bad key’ error both in the code and when I try and use RegEdt32 on it… It works fine on a 64 bit XP virtual machine so I don’t think it’s anything to do with the 64 bit registry tricks… Ho hum… My list of boring things to try next includes building an VS2005 ATL performance counter object and trying to install that (their code seems to be based on the same Richter original but the string registration bit (the bit that’s broken for me) works differently…), installing a clean VM Vista and seeing if it works in that and building the latest Platform SDK perfmon sample and using LoadCtrs to install it and seeing what it does and where…