Discovery of the DLL
User applications are expected to parse the Windows registry to discover which PassThru devices are installed, and which protocols are supported by each device. Most of the time, our example code should take care of everything appropriately.
For example, the registry may contain information on three J2534-1 devices:
[HKEY_LOCAL_MACHINE\SOFTWARE\PassThruSupport.04.04\Drew Technologies Inc. – CarDAQ PLUS]
“Vendor”=”Drew Technologies Inc.”
“Name”=”CarDAQ PLUS”
“ConfigApplication”=”CDPLSConfig.EXE”
“CAN”=dword:00000001
“ISO15765″=dword:00000001
“J1850VPW”=dword:00000001
“J1850PWM”=dword:00000001
“FunctionLibrary”=”C:\\WINDOWS\\SYSTEM32\\CDPLS432.DLL”
[HKEY_LOCAL_MACHINE\SOFTWARE\PassThruSupport.04.04\Drew Technologies Inc. – Mongoose ISO/CAN]
“Vendor”=”Drew Technologies Inc.”
“Name”=”Mongoose ISO/CAN”
“ConfigApplication”=”MONGOOSEISO.EXE”
“CAN”=dword:00000001
“ISO15765″=dword:00000001
“ISO9141″=dword:00000001
“ISO14230″=dword:00000001
“FunctionLibrary”=”C:\\WINDOWS\\SYSTEM32\\MONGI432.DLL”
[HKEY_LOCAL_MACHINE\SOFTWARE\PassThruSupport.04.04\Alternative J2534 Vendor – OtherBox]
“Vendor”=”Alternative J2534 Vendor”
“Name”=”OtherBox”
“ConfigApplication”=”otherbox_setup.exe”
“CAN”=dword:00000001
“FunctionLibrary”=”mybox32.dll”
Notice: With the J2534-1 (v0404) API, expect multiple vendors and multiple devices. Use a while-loop with RegEnumKeyEx() to enumerate all PassThru interfaces available under the PassThru.0404 key. Each entry will describe the driver DLL, config application, and supported protocols. Please refer to the SAE specification for more details.
The PassThru (J2534) functions must be accessed through run-time dynamic linking. The following example loads and extracts the address for PassThruConnect():
typedef long (CALLBACK* PTOPEN)(void *, unsigned long *);
PTOPEN PassThruOpen;
HINSTANCE hDLL;
hDLL = LoadLibrary(DllLibraryPath);
PassThruOpen = (PTOPEN)(GetProcAddress(hDLL, “PassThruOpen”));