Ka-lolek
September 1st, 2009, 08:02 AM
Hello,
i have problem cause when i try to write to hkey_local_machine, i get an exception with message
The parameter is incorrect.
the code looks like this:
objReg = Registry.LocalMachine;
RegistryKey obj = objReg.OpenSubKey(Key, true);
if (obj == null)
{
objReg.CreateSubKey(Key).SetValue(Value, "");
}
else
{
objReg.SetValue(Value, "");
}
i was looking for the solution in the internet, but i only found that the couse can be the lack of administrator privileges..
i added this part:
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_LOCAL_MACHINE")]
With no result
do you know what cases this problem?
Cheers
i have problem cause when i try to write to hkey_local_machine, i get an exception with message
The parameter is incorrect.
the code looks like this:
objReg = Registry.LocalMachine;
RegistryKey obj = objReg.OpenSubKey(Key, true);
if (obj == null)
{
objReg.CreateSubKey(Key).SetValue(Value, "");
}
else
{
objReg.SetValue(Value, "");
}
i was looking for the solution in the internet, but i only found that the couse can be the lack of administrator privileges..
i added this part:
[assembly: RegistryPermissionAttribute(SecurityAction.RequestMinimum, ViewAndModify = "HKEY_LOCAL_MACHINE")]
With no result
do you know what cases this problem?
Cheers