Fixed an UnauthorizedAccessException when modifying the auto-startup registry entry.

This commit is contained in:
Michael Möller
2010-09-14 19:23:11 +00:00
parent 56ce10022a
commit 4158415801
2 changed files with 22 additions and 9 deletions

View File

@@ -198,7 +198,13 @@ namespace OpenHardwareMonitor.GUI {
autoStart = new UserOption(null, startupManager.Startup, startupMenuItem, settings);
autoStart.Changed += delegate(object sender, EventArgs e) {
startupManager.Startup = autoStart.Value;
try {
startupManager.Startup = autoStart.Value;
} catch (InvalidOperationException) {
MessageBox.Show("Updating the auto-startup option failed.", "Error",
MessageBoxButtons.OK, MessageBoxIcon.Error);
autoStart.Value = startupManager.Startup;
}
};
readHddSensors = new UserOption("hddMenuItem", true, hddMenuItem, settings);