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>
12 using System.Collections.Generic;
15 namespace OpenHardwareMonitor.Hardware {
16 public class Identifier : IComparable<Identifier> {
17 private readonly string identifier;
19 private const char Separator = '/';
21 private static void CheckIdentifiers(IEnumerable<string> identifiers) {
22 foreach (string s in identifiers)
23 if (s.Contains(" ") || s.Contains(Separator.ToString()))
24 throw new ArgumentException("Invalid identifier");
27 public Identifier(params string[] identifiers) {
28 CheckIdentifiers(identifiers);
30 StringBuilder s = new StringBuilder();
31 for (int i = 0; i < identifiers.Length; i++) {
33 s.Append(identifiers[i]);
35 this.identifier = s.ToString();
38 public Identifier(Identifier identifier, params string[] extensions) {
39 CheckIdentifiers(extensions);
41 StringBuilder s = new StringBuilder();
42 s.Append(identifier.ToString());
43 for (int i = 0; i < extensions.Length; i++) {
45 s.Append(extensions[i]);
47 this.identifier = s.ToString();
50 public override string ToString() {
54 public override bool Equals(Object obj) {
58 Identifier id = obj as Identifier;
62 return (identifier == id.identifier);
65 public override int GetHashCode() {
66 return identifier.GetHashCode();
69 public int CompareTo(Identifier other) {
73 return string.Compare(this.identifier, other.identifier,
74 StringComparison.Ordinal);
77 public static bool operator ==(Identifier id1, Identifier id2) {
79 return id2.Equals(null);
81 return id1.Equals(id2);
84 public static bool operator !=(Identifier id1, Identifier id2) {
88 public static bool operator <(Identifier id1, Identifier id2) {
92 return (id1.CompareTo(id2) < 0);
95 public static bool operator >(Identifier id1, Identifier id2) {
99 return (id1.CompareTo(id2) > 0);