Registry permissions revisited

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have read numerous messages that state (or imply) that permissions to
manipulate registry entries cannot be managed from .NET code. (I have a
requirement to check and possibly modify the SQL Server LoginMode key for my
application to work, and this key's permission is only granted to
Administrators.)

However, there is a help topic in .NET that states that it is possible to
grant permission. The class is RegistryPermission. I have tried but failed to
get this class to work. Can anyone out there help me?

Thanks!
 
mfdatsw1 said:
I have read numerous messages that state (or imply) that permissions to
manipulate registry entries cannot be managed from .NET code. (I have a
requirement to check and possibly modify the SQL Server LoginMode key for
my
application to work, and this key's permission is only granted to
Administrators.)

However, there is a help topic in .NET that states that it is possible to
grant permission. The class is RegistryPermission. I have tried but failed
to
get this class to work. Can anyone out there help me?

RegistryPermission is a CodeAccessPermission, which means it applies to what
your code is allowed to rather than what the user running your code is
allowed to do. Basically, the permissions your program has are the
intersection of the code permissions and the user permissions.

You use RegistryPermission (or RegistryPermissionAttribute) to allow your
code to request the ability to be able to modify the registry:
[RegistryPermissionAttribute(SecurityAction.RequestMinimum,
Read="HKEY_LOCAL_MACHINE\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor")]

You must also give the user the permissions to access the relevant key, via
Windows. .NET 1.1 does not have a way of manipulating these permissions.
 
Back
Top