Try and find a sensible video driver to report on rather than assuming it's video0.
This commit is contained in:
parent
c3d6d43d2a
commit
cb925a91e9
|
@ -341,18 +341,33 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
|
|
||||||
public String getAdapter() {
|
public String getAdapter() {
|
||||||
try {
|
try {
|
||||||
|
String maxObjNo = WindowsRegistry.queryRegistrationKey(
|
||||||
|
WindowsRegistry.HKEY_LOCAL_MACHINE,
|
||||||
|
"HARDWARE\\DeviceMap\\Video",
|
||||||
|
"MaxObjectNumber");
|
||||||
|
int maxObjectNumber = maxObjNo.charAt(0);
|
||||||
|
String vga_driver_value = "";
|
||||||
|
for(int i=0;i<maxObjectNumber;i++) {
|
||||||
String adapter_string = WindowsRegistry.queryRegistrationKey(
|
String adapter_string = WindowsRegistry.queryRegistrationKey(
|
||||||
WindowsRegistry.HKEY_LOCAL_MACHINE,
|
WindowsRegistry.HKEY_LOCAL_MACHINE,
|
||||||
"HARDWARE\\DeviceMap\\Video",
|
"HARDWARE\\DeviceMap\\Video",
|
||||||
"\\Device\\Video0");
|
"\\Device\\Video" + i);
|
||||||
String root_key = "\\registry\\machine\\";
|
String root_key = "\\registry\\machine\\";
|
||||||
if (adapter_string.toLowerCase().startsWith(root_key)) {
|
if (adapter_string.toLowerCase().startsWith(root_key)) {
|
||||||
String driver_value = WindowsRegistry.queryRegistrationKey(
|
String driver_value = WindowsRegistry.queryRegistrationKey(
|
||||||
WindowsRegistry.HKEY_LOCAL_MACHINE,
|
WindowsRegistry.HKEY_LOCAL_MACHINE,
|
||||||
adapter_string.substring(root_key.length()),
|
adapter_string.substring(root_key.length()),
|
||||||
"InstalledDisplayDrivers");
|
"InstalledDisplayDrivers");
|
||||||
|
if(driver_value.toUpperCase().startsWith("VGA")) {
|
||||||
|
vga_driver_value = driver_value;
|
||||||
|
} else if(!driver_value.toUpperCase().startsWith("RDP") && !driver_value.toUpperCase().startsWith("NMNDD")) {
|
||||||
return driver_value;
|
return driver_value;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(!vga_driver_value.equals("")) {
|
||||||
|
return vga_driver_value;
|
||||||
|
}
|
||||||
} catch (LWJGLException e) {
|
} catch (LWJGLException e) {
|
||||||
LWJGLUtil.log("Exception occurred while querying registry: " + e);
|
LWJGLUtil.log("Exception occurred while querying registry: " + e);
|
||||||
}
|
}
|
||||||
|
@ -362,10 +377,13 @@ final class WindowsDisplay implements DisplayImplementation {
|
||||||
public String getVersion() {
|
public String getVersion() {
|
||||||
String driver = getAdapter();
|
String driver = getAdapter();
|
||||||
if (driver != null) {
|
if (driver != null) {
|
||||||
WindowsFileVersion version = nGetVersion(driver + ".dll");
|
String[] drivers = driver.split(",");
|
||||||
|
if(drivers.length>0) {
|
||||||
|
WindowsFileVersion version = nGetVersion(drivers[0] + ".dll");
|
||||||
if (version != null)
|
if (version != null)
|
||||||
return version.toString();
|
return version.toString();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
private native WindowsFileVersion nGetVersion(String driver);
|
private native WindowsFileVersion nGetVersion(String driver);
|
||||||
|
|
Loading…
Reference in New Issue