mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-08-31 14:25:16 +00:00
Added code to delete any kernel driver service that can't be opened before reinstalling it.
This commit is contained in:
@@ -112,7 +112,9 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
driver.Open();
|
driver.Open();
|
||||||
|
|
||||||
if (!driver.IsOpen) {
|
if (!driver.IsOpen) {
|
||||||
// driver is not loaded, try to install and open
|
// driver is not loaded, try to reinstall and open
|
||||||
|
|
||||||
|
driver.Delete();
|
||||||
string fileName = Path.GetTempFileName();
|
string fileName = Path.GetTempFileName();
|
||||||
if (ExtractDriver(fileName)) {
|
if (ExtractDriver(fileName)) {
|
||||||
if (driver.Install(fileName)) {
|
if (driver.Install(fileName)) {
|
||||||
@@ -124,7 +126,9 @@ namespace OpenHardwareMonitor.Hardware {
|
|||||||
report.AppendLine("Status: Opening driver failed");
|
report.AppendLine("Status: Opening driver failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
report.AppendLine("Status: Installing driver failed");
|
report.AppendLine("Status: Installing driver \"" +
|
||||||
|
fileName + "\" failed" +
|
||||||
|
(File.Exists(fileName) ? " and file exists" : ""));
|
||||||
report.AppendLine();
|
report.AppendLine();
|
||||||
report.Append("Exception: " + Marshal.GetExceptionForHR(
|
report.Append("Exception: " + Marshal.GetExceptionForHR(
|
||||||
Marshal.GetHRForLastWin32Error()).Message);
|
Marshal.GetHRForLastWin32Error()).Message);
|
||||||
|
@@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
The Initial Developer of the Original Code is
|
The Initial Developer of the Original Code is
|
||||||
Michael Möller <m.moeller@gmx.ch>.
|
Michael Möller <m.moeller@gmx.ch>.
|
||||||
Portions created by the Initial Developer are Copyright (C) 2009-2010
|
Portions created by the Initial Developer are Copyright (C) 2009-2011
|
||||||
the Initial Developer. All Rights Reserved.
|
the Initial Developer. All Rights Reserved.
|
||||||
|
|
||||||
Contributor(s):
|
Contributor(s):
|
||||||
@@ -37,5 +37,5 @@
|
|||||||
|
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
|
||||||
[assembly: AssemblyVersion("0.2.1.12")]
|
[assembly: AssemblyVersion("0.2.1.13")]
|
||||||
[assembly: AssemblyInformationalVersion("0.2.1.12 Alpha")]
|
[assembly: AssemblyInformationalVersion("0.2.1.13 Alpha")]
|
Reference in New Issue
Block a user