mirror of https://github.com/rusefi/RomRaider.git
Fixed bug where unknown transport protocol threw regKey Error
This commit is contained in:
parent
fe3933a09d
commit
0a37d32240
|
@ -20,9 +20,10 @@
|
|||
<classpathentry kind="lib" path="lib/common/cmutimelex.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/en_us.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/freetts.jar"/>
|
||||
<classpathentry kind="lib" path="lib/common/RXTXcomm.jar">
|
||||
<classpathentry exported="true" kind="lib" path="lib/common/RXTXcomm.jar">
|
||||
<attributes>
|
||||
<attribute name="javadoc_location" value="http://users.frii.com/jarvi/rxtx/doc/"/>
|
||||
<attribute name="org.eclipse.jdt.launching.CLASSPATH_ATTR_LIBRARY_PATH_ENTRY" value="romraider/lib/windows"/>
|
||||
</attributes>
|
||||
</classpathentry>
|
||||
<classpathentry kind="lib" path="lib/windows/jdic_stub.jar"/>
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
<!-- java compiler properties -->
|
||||
<property name="javac.source" value="1.6" />
|
||||
<property name="javac.target" value="1.6" />
|
||||
<property name="bootclasspath.dir" value="C:\Program Files (x86)\Java\jdk1.6.0_45\jre\lib" />
|
||||
<property name="bootclasspath.dir" value="D:\Documents\EclipseProjects\RomRaider"/>
|
||||
<property name="debug" value="off" />
|
||||
<property name="deprecation" value="on" />
|
||||
<property name="javac.verbose" value="off" />
|
||||
|
|
|
@ -58,26 +58,28 @@ public class J2534DllLocator {
|
|||
HKEY hklm = HKEY_LOCAL_MACHINE;
|
||||
String passThru = "SOFTWARE\\PassThruSupport.04.04";
|
||||
HKEYByReference passThruHandle = getHandle(hklm, passThru);
|
||||
|
||||
List<String> vendors = getKeys(passThruHandle.getValue());
|
||||
for (String vendor : vendors) {
|
||||
HKEYByReference vendorKey =
|
||||
getHandle(passThruHandle.getValue(), vendor);
|
||||
int supported = getDWord(vendorKey.getValue(), protocol);
|
||||
if (supported == 0 ) continue;
|
||||
String library = getSZ(vendorKey.getValue(), FUNCTIONLIBRARY);
|
||||
LOGGER.debug(String.format("Found J2534 Vendor:%s | Library:%s",
|
||||
vendor, library));
|
||||
if (ParamChecker.isNullOrEmpty(library)) continue;
|
||||
libraries.add(new J2534Library(vendor, library));
|
||||
advapi32.RegCloseKey(vendorKey.getValue());
|
||||
|
||||
if(passThruHandle != null) {
|
||||
List<String> vendors = getKeys(passThruHandle.getValue());
|
||||
for (String vendor : vendors) {
|
||||
HKEYByReference vendorKey =
|
||||
getHandle(passThruHandle.getValue(), vendor);
|
||||
int supported = getDWord(vendorKey.getValue(), protocol);
|
||||
if (supported == 0 ) continue;
|
||||
String library = getSZ(vendorKey.getValue(), FUNCTIONLIBRARY);
|
||||
LOGGER.debug(String.format("Found J2534 Vendor:%s | Library:%s",
|
||||
vendor, library));
|
||||
if (ParamChecker.isNullOrEmpty(library)) continue;
|
||||
libraries.add(new J2534Library(vendor, library));
|
||||
advapi32.RegCloseKey(vendorKey.getValue());
|
||||
}
|
||||
advapi32.RegCloseKey(passThruHandle.getValue());
|
||||
}
|
||||
advapi32.RegCloseKey(passThruHandle.getValue());
|
||||
|
||||
return libraries;
|
||||
}
|
||||
|
||||
private static HKEYByReference getHandle(HKEY hKey, String lpSubKey)
|
||||
throws Exception {
|
||||
private static HKEYByReference getHandle(HKEY hKey, String lpSubKey){
|
||||
|
||||
HKEYByReference phkResult = new HKEYByReference();
|
||||
int ret = advapi32.RegOpenKeyEx(
|
||||
|
@ -88,7 +90,8 @@ public class J2534DllLocator {
|
|||
phkResult);
|
||||
|
||||
if(ret != ERROR_SUCCESS) {
|
||||
handleError("RegOpenKeyEx", ret);
|
||||
//handleError("RegOpenKeyEx", ret);
|
||||
return null;
|
||||
}
|
||||
return phkResult;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue