Registry Permissions

P

Paul Remblance

The following code fails due to security:

Dim regKey As RegistryKey
Dim strEvent As String
Dim index As Integer
Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess,
"HKEY_LOCAL_MACHINE\SOFTWARE")
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey("TulipLtd")
regKey.Close()
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\TulipLtd", True)
regKey.CreateSubKey("KLCost")
regKey.Close()
regKey =
Registry.LocalMachine.OpenSubKey("SOFTWARE\TulipLtd\KLCost", True)
SQLSvr = regKey.GetValue("SQLSvr", "NotSet")
SQLDb = regKey.GetValue("SQLDb", "NotSet")
regKey.Close()
connString = "SERVER=" & SQLSvr & ";DATABASE=" & SQLDb &
";Trusted_Connection=True;Connection Timeout=15"

Is there a way to give ordinary users permission to create/read/write these
registry keys?
 
K

Ken Tucker [MVP]

Hi,

http://msdn.microsoft.com/library/d...typermissionsregistrypermissionclasstopic.asp

Ken
------------------
The following code fails due to security:

Dim regKey As RegistryKey
Dim strEvent As String
Dim index As Integer
Dim f As New RegistryPermission(RegistryPermissionAccess.AllAccess,
"HKEY_LOCAL_MACHINE\SOFTWARE")
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE", True)
regKey.CreateSubKey("TulipLtd")
regKey.Close()
regKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\TulipLtd", True)
regKey.CreateSubKey("KLCost")
regKey.Close()
regKey =
Registry.LocalMachine.OpenSubKey("SOFTWARE\TulipLtd\KLCost", True)
SQLSvr = regKey.GetValue("SQLSvr", "NotSet")
SQLDb = regKey.GetValue("SQLDb", "NotSet")
regKey.Close()
connString = "SERVER=" & SQLSvr & ";DATABASE=" & SQLDb &
";Trusted_Connection=True;Connection Timeout=15"

Is there a way to give ordinary users permission to create/read/write these
registry keys?
 

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