Jump to content

Remotely modifying Registry ACL using RegistrySecurity (and Access


Recommended Posts

Posted

I have been trying to add a readonly permission to a key in in HKLM using the

following code (simplified)

 

================================

RegistrySecurity security = new RegistrySecurity( );

security.AddAccessRule( new RegistryAccessRule( Read ) );

RegistryKey key = RegistryKey.OpenRemoteBaseKey( HKLM, "computer" );

key = key.OpenSubKey( @"SOFTWARE\Test", true );

key.SetAccessControl( security );

================================

 

This currently throws the following error "The supplied handle is invalid.

This can happen when trying to set an ACL on an anonymous kernel object"

 

If I modify the code to perform the task on the local machine everything is

fine. I'm guessing the security token is not being initialised from my local

machine. I've added Impersonation code around and this did not help.

 

Is it possible to remotely change registry permissions using managed code?

or do I have to revert to P/Invokes?

 

Thanks

 

/J

 

 

--

/Jonny

  • Replies 0
  • Created
  • Last Reply

Popular Days

Popular Days

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...