Re: take ownership of registry key with .NET 2.0?
- From: "Willy Denoyette [MVP]" <willy.denoyette@xxxxxxxxxx>
- Date: Thu, 1 Sep 2005 11:10:29 +0200
"Andrew" <notes_at_shaw_dot_ca@xxxxxxxxxxxxxx> wrote in message
news:17zobtalexvrc.5m3vl5sdzly4$.dlg@xxxxxxxxxxxxx
>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.aspx?scid=kb;en-us;111546
>
> Any help very much appreciated! -- Thanks!
>
> --
> Andrew
Only "admlinistrators" can do this, are you running as an administrator?.
Willy.
.
- Follow-Ups:
- Re: take ownership of registry key with .NET 2.0?
- From: Andrew
- Re: take ownership of registry key with .NET 2.0?
- References:
- take ownership of registry key with .NET 2.0?
- From: Andrew
- take ownership of registry key with .NET 2.0?
- Prev by Date: Re: marshalling a byte array to an unmanaged unsigned char*
- Next by Date: Re: datagridview control easy filtering ?
- Previous by thread: take ownership of registry key with .NET 2.0?
- Next by thread: Re: take ownership of registry key with .NET 2.0?
- Index(es):
Relevant Pages
|