Fixed Issue 387. The new implementation does not try to start a ring 0 driver that already exists, but could not be opened. It tries to delete the driver and install it new. The driver is now stored temporarily in the application folder. The driver is not correctly removed on system shutdown.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2010 Michael Möller <mmoeller@openhardwaremonitor.org>
14 using System.Threading;
15 using System.Windows.Forms;
16 using OpenHardwareMonitor.GUI;
18 namespace OpenHardwareMonitor {
19 public static class Program {
22 public static void Main() {
24 Application.ThreadException +=
25 new ThreadExceptionEventHandler(Application_ThreadException);
26 Application.SetUnhandledExceptionMode(
27 UnhandledExceptionMode.CatchException);
29 AppDomain.CurrentDomain.UnhandledException +=
30 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
33 if (!AllRequiredFilesAvailable())
36 Application.EnableVisualStyles();
37 Application.SetCompatibleTextRenderingDefault(false);
38 using (GUI.MainForm form = new GUI.MainForm()) {
39 form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
46 private static bool IsFileAvailable(string fileName) {
47 string path = Path.GetDirectoryName(Application.ExecutablePath) +
48 Path.DirectorySeparatorChar;
50 if (!File.Exists(path + fileName)) {
51 MessageBox.Show("The following file could not be found: " + fileName +
52 "\nPlease extract all files from the archive.", "Error",
53 MessageBoxButtons.OK, MessageBoxIcon.Error);
59 private static bool AllRequiredFilesAvailable() {
60 if (!IsFileAvailable("Aga.Controls.dll"))
62 if (!IsFileAvailable("OpenHardwareMonitorLib.dll"))
68 private static void ReportException(Exception e) {
69 CrashForm form = new CrashForm();
74 public static void Application_ThreadException(object sender,
75 ThreadExceptionEventArgs e)
78 ReportException(e.Exception);
85 public static void CurrentDomain_UnhandledException(object sender,
86 UnhandledExceptionEventArgs args)
89 Exception e = args.ExceptionObject as Exception;