Trying to unload a registry hive and finding access is denied?
I was loading in a user hive (NTUSER.DAT in the profile), and then opening the key using RegOpenKey (exposed as Registry.Users.OpenSubKey in .NET) to prove it was successful. However, I'd forgot to close this key, so the handle was staying open and thus you couldn't unload the hive.
Oddly, after some time, the handle would clean itself up, so it seemed more like a time or permissions based issue. Simple fix however.
A working release of ProfileTool isn't far away..
Tags: dotnet, programming, windows