I'm playing with Visual Basic .Net 2005. I wanted to create a program that can write to the registry.
This gives me an UnauthorizedAccessException:
Dim myKey, softwareKey As Microsoft.Win32.RegistryKey
softwareKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey("SOFTWARE")
myKey = softwareKey.CreateSubKey("mykey")
But this works:
Dim p as Process
p = Process.Start("reg.exe", "add HKCU\Software\mykey")
I'm on XP SP3 and my user is an Admin. What needs to be changed in order for my software to write to the registry through the .Net Framework?