mirror of
https://github.com/openhardwaremonitor/openhardwaremonitor
synced 2025-09-05 00:35:18 +00:00
Fixed ADL dll loading. The name of the dll is always atiadlxx, except when running as 32-bit app on 64-bit systems (atiadlxy in that case).
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
/*
|
||||
/*
|
||||
|
||||
Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
|
||||
@@ -54,55 +54,59 @@ namespace OpenHardwareMonitor.Hardware.SMBIOS {
|
||||
int p = (int)System.Environment.OSVersion.Platform;
|
||||
if ((p == 4) || (p == 128))
|
||||
return;
|
||||
|
||||
ManagementObjectCollection collection = new ManagementObjectSearcher(
|
||||
"root\\WMI", "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables").Get();
|
||||
|
||||
byte[] raw = null;
|
||||
foreach (ManagementObject mo in collection) {
|
||||
raw = (byte[])mo["SMBiosData"];
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
List<Structure> structureList = new List<Structure>();
|
||||
if (raw != null && raw.Length > 0) {
|
||||
int offset = 0;
|
||||
byte type = raw[offset];
|
||||
while (offset < raw.Length && type != 127) {
|
||||
|
||||
type = raw[offset]; offset++;
|
||||
int length = raw[offset]; offset++;
|
||||
ushort handle = (ushort)((raw[offset] << 8) | raw[offset + 1]);
|
||||
offset += 2;
|
||||
|
||||
byte[] data = new byte[length];
|
||||
Array.Copy(raw, offset - 4, data, 0, length); offset += length - 4;
|
||||
|
||||
List<string> stringsList = new List<string>();
|
||||
if (raw[offset] == 0)
|
||||
offset++;
|
||||
while (raw[offset] != 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (raw[offset] != 0) {
|
||||
sb.Append((char)raw[offset]); offset++;
|
||||
|
||||
try {
|
||||
ManagementObjectCollection collection = new ManagementObjectSearcher(
|
||||
"root\\WMI", "SELECT SMBiosData FROM MSSMBios_RawSMBiosTables").Get();
|
||||
|
||||
byte[] raw = null;
|
||||
foreach (ManagementObject mo in collection) {
|
||||
raw = (byte[])mo["SMBiosData"];
|
||||
break;
|
||||
}
|
||||
|
||||
if (raw != null && raw.Length > 0) {
|
||||
int offset = 0;
|
||||
byte type = raw[offset];
|
||||
while (offset < raw.Length && type != 127) {
|
||||
|
||||
type = raw[offset]; offset++;
|
||||
int length = raw[offset]; offset++;
|
||||
ushort handle = (ushort)((raw[offset] << 8) | raw[offset + 1]);
|
||||
offset += 2;
|
||||
|
||||
byte[] data = new byte[length];
|
||||
Array.Copy(raw, offset - 4, data, 0, length); offset += length - 4;
|
||||
|
||||
List<string> stringsList = new List<string>();
|
||||
if (raw[offset] == 0)
|
||||
offset++;
|
||||
while (raw[offset] != 0) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
while (raw[offset] != 0) {
|
||||
sb.Append((char)raw[offset]); offset++;
|
||||
}
|
||||
offset++;
|
||||
stringsList.Add(sb.ToString());
|
||||
}
|
||||
offset++;
|
||||
stringsList.Add(sb.ToString());
|
||||
}
|
||||
offset++;
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
this.biosInformation = new BIOSInformation(
|
||||
type, handle, data, stringsList.ToArray());
|
||||
structureList.Add(this.biosInformation); break;
|
||||
case 0x02: this.baseBoardInformation = new BaseBoardInformation(
|
||||
type, handle, data, stringsList.ToArray());
|
||||
structureList.Add(this.baseBoardInformation); break;
|
||||
default: structureList.Add(new Structure(
|
||||
type, handle, data, stringsList.ToArray())); break;
|
||||
switch (type) {
|
||||
case 0x00:
|
||||
this.biosInformation = new BIOSInformation(
|
||||
type, handle, data, stringsList.ToArray());
|
||||
structureList.Add(this.biosInformation); break;
|
||||
case 0x02: this.baseBoardInformation = new BaseBoardInformation(
|
||||
type, handle, data, stringsList.ToArray());
|
||||
structureList.Add(this.baseBoardInformation); break;
|
||||
default: structureList.Add(new Structure(
|
||||
type, handle, data, stringsList.ToArray())); break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (NotImplementedException) { }
|
||||
|
||||
table = structureList.ToArray();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user