I spent tons of time searching the web for how to use .NET 2.0 and C# to
modify Registry key security. After finally finding an example, and once I
knew the function names a few other small examples.. I can still find
nothing that demonstrates how to take ownership of a Registry key if one
has (potentially) *only* "write owner"
The problem, of course is that normally, to read or change permissions, one
needs to "open" the registry key to get a handle to it.. but of course if
you do not have permission to do that, it fails and you get a null handle
which is pretty much useless for changing registry key access ;)
I open a root key:
RegistryKey myKey = Registry.ClassesRoot; // or whichever..
And try to open my sub key, which I only have "write owner" permission
(with "true" for write, since I want to write a new owner):
myKey = myKey.OpenSubKey("mySubKeyName", true);
Which, of course.. fails.
The issue is obviously known to MS, since they have a page specifically on
how to solve the problem in C++ (I think?) at:
http://support.microsoft.com/default...b;en-us;111546
Any help very much appreciated! -- Thanks!
--
Andrew