How can set that both limited users and privileged users can write to a registrykey in c#

M

marcussilfver

How can I set write permissions for a limited user to write values to
a certain registrykey. This registrykey is also written to by a
administrator (which probably also created the key in the first
place).
I have looked at the RegistryPermission class but would really like to
see a code sample on this.

How can it be done, simplest way possible?

thanx
 
V

Vadym Stetsiak

Hello, (e-mail address removed)!

To secure separate registy key, you need to setup Access Control List (ACL)
on that key.

Here's the example how to set ACL on the files -
http://west-wind.com/weblog/posts/4072.aspx.
The same is valid for registry keys.

Here's also the example in MC++ -
http://www.codeproject.com/dotnet/SecureRegistryKey.asp

--
With best regards, Vadym Stetsiak.
Blog: http://vadmyst.blogspot.com

You wrote on Mon, 03 Sep 2007 00:34:05 -0700:

m> How can I set write permissions for a limited user to write values to
m> a certain registrykey. This registrykey is also written to by a
m> administrator (which probably also created the key in the first
m> place).
m> I have looked at the RegistryPermission class but would really like
m> to see a code sample on this.

m> How can it be done, simplest way possible?

m> thanx
 
M

marcussilfver

Hello, (e-mail address removed)!

To secure separate registy key, you need to setup Access Control List (ACL)
on that key.

Here's the example how to set ACL on the files -http://west-wind.com/weblog/posts/4072.aspx.
The same is valid for registry keys.

Here's also the example in MC++ -http://www.codeproject.com/dotnet/SecureRegistryKey.asp

Thanks for answering, however I have to use .Net 1.1 so the solution
described in the first link is not available to me unfourtunately.
I have not looked so much on the 2nd link yet, but I guess I could use
that unmanaged code for the task.

I rather do it purely in c# though (if possible)

Is there a way to enable a limited user to write to a certain
registrykey in c# in .Net 1.x or do I have to resort to unmanaged code
for this when developing .Net 1.x applications?

RegistryPermission class exist in .Net 1.x could this class solve this
issue?
 
V

Vadym Stetsiak

Hello, (e-mail address removed)!

RegistryPermission won't help you, since they're regulate registry
permissions within your code, and not in the OS.

IMO the only way left is the unmanaged way (see link 2 from the previous
answer)

You wrote on Mon, 03 Sep 2007 04:43:58 -0700:



m> Thanks for answering, however I have to use .Net 1.1 so the solution
m> described in the first link is not available to me unfourtunately.
m> I have not looked so much on the 2nd link yet, but I guess I could
m> use that unmanaged code for the task.

m> I rather do it purely in c# though (if possible)

m> Is there a way to enable a limited user to write to a certain
m> registrykey in c# in .Net 1.x or do I have to resort to unmanaged
m> code for this when developing .Net 1.x applications?

m> RegistryPermission class exist in .Net 1.x could this class solve
m> this issue?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top