C
Colin Priest
I am trying to write a program to switch off serial port enumerations
via the associated registry key. My code is:
RegistryPermission permission = new
RegistryPermission(RegistryPermissionAccess.Write,
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\ACPI\\PNP0501");
permission.Demand();
RegistryKey key =
Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\ACPI\\PNP0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?
Colin
via the associated registry key. My code is:
RegistryPermission permission = new
RegistryPermission(RegistryPermissionAccess.Write,
"HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Enum\\ACPI\\PNP0501");
permission.Demand();
RegistryKey key =
Registry.LocalMachine.OpenSubKey("SYSTEM\\CurrentControlSet\\Enum\\ACPI\\PNP0501",
true);
But the last line throws a Security Exception saying "Requested
security access is not allowed". What am I doing wrong?
Colin