Archive: Deleting a registry key from HKLM in vista w/ UAC


Deleting a registry key from HKLM in vista w/ UAC
I've been using NSIS for awhile with no problems, but the last week or two I have been completely defeated.

I recently discovered that our COM registration occasionally writes to HKLM instead of HKCU, due to some legacy code that we didn't realize was active. The problem with that is that under certain circumstances, the CLSID is still registered in HKLM and thus installs to HKCU aren't detected until it is deleted from HKLM.

So, I set my installer to request elevation if it detects that the registry key is there. No errors, everything says it's working, but the key doesn't get deleted. So, I set "RequestEexecutionLevel admin"; no luck. Tried running the installer explicitely as Administrator; no luck.

I have used the DeleteRegKey NSIS function, SHDeleteKey windows API function, and the RegDeleteTree windows API function introduced in Vista. None of them work. I can write to or delete from anywhere else in the registry except HKLM/SOFTWARE/Classes/CLSID; HKCU doesn't seem to even work, and HKCR accesses HKCU/SOFTWARE/Classes.

I'm completely running out of ideas; it looks like perhaps the registry virtualization is messing me up, but I can't figure out how to fix it. I am always setting RequestExecutionLevel.

Any ideas?


I feel your pain.


have u made any progress? do you have access to the source code of the COM component? where you can put a condition to take care of it in there for vista users