Cannot read registry keys under HKLM with UAC enabled on Vista?


I have a program that worked successfully for quite some time and just recently it stopped working. I tracked it down to a reading of a registry key located in HKLM\Software where I get an error from the Win32 API `RegOpenKeyEx' which returns with a value of 2 (that is to say there is no such entries). But there is such an entry so this is very puzzling.

What is happening? Why was it working before and not now? The same program works fine under another vista machine which is more or less configured the same way.

Of course disabling UAC works but that's out of the question.