How do I add/change OEMInformation registry keys using C#?
I tried to use this code but it returns an error :
RegistryKey myKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\Windows\CurrentVersion\OEMInformation", true);
myKey.SetValue("manufacturer", "Asus", RegistryValueKind.String);
This error is being returned :
An unhandled exception of type 'System.Security.SecurityException' occurred in mscorlib.dll
Additional information: Requested registry access is not allowed.
EDIT :
Also tried this code :
Microsoft.Win32.RegistryKey key;
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(@"SOFTWARE\\Microsoft\Windows\CurrentVersion\OEMInformation");
key.SetValue("manufacturer", "Asus");
key.Close();
but this code returns also an error :
An unhandled exception of type 'System.UnauthorizedAccessException' occurred in mscorlib.dll
Additional information: Cannot write to the registry key.
And my application already runs as admin using this code :
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />