Exemple #1
0
std::vector<J2534Library> J2534_API::getAvailableJ2534Libs()
{
	std::vector<J2534Library> PTlibraries;


	// TODO


#ifdef __J2534_API_DEBUG__
	printLibraryInfo(PTlibraries);
#endif
	return PTlibraries;
}
Exemple #2
0
std::vector<J2534Library> J2534_API::getAvailableJ2534Libs()
{
	std::vector<J2534Library> PTlibraries;
	HKEY hKey1, hKey2;
	DWORD index = 0;
	char KeyName[256] = "";
	long ret = 0;

	ret = RegOpenKeyExA(HKEY_LOCAL_MACHINE, ("Software"), 0, KEY_READ, &hKey1);
	if (ret != ERROR_SUCCESS)
	{
#ifdef __J2534_API_DEBUG__
		std::cout << "J2534interface::getAvailableJ2534Libs():   RegOpenKeyEx(...) for 'HKEY_LOCAL_MACHINE\\Software' failed with error " << ret << "\n";
#endif
		return PTlibraries;
	}
	// Search for keys "PassThruSupport", "PassThruSupport.04.04":
	while ((RegEnumKeyA(hKey1, index, KeyName, 256)) != ERROR_NO_MORE_ITEMS)
	{
		if (!strncmp(KeyName, "PassThruSupport", 15))
		{
			ret = RegOpenKeyExA(hKey1, KeyName, 0, KEY_READ, &hKey2);   // "PassThruSupportXXX"
			if (ret == ERROR_SUCCESS)   // "PassThruSupportXXX"
			{
				// Search for library data in all sub-keys (recursive)
				PTlibraries = searchLibValuesRecursive(hKey2, PTlibraries);
				ret = RegCloseKey(hKey2);
#ifdef __J2534_API_DEBUG__
				if (ret != ERROR_SUCCESS)
					std::cout << "J2534interface::getAvailableJ2534Libs():   RegCloseKey(hKey2) failed with error " << ret << "\n";
#endif
			}
#ifdef __J2534_API_DEBUG__
			else
				std::cout << "J2534interface::getAvailableJ2534Libs():   RegOpenKexEx(...) for key " << KeyName << " failed with error " << ret << "\n";
#endif
		}
		index++;
	}
	ret = RegCloseKey(hKey1);
#ifdef __J2534_API_DEBUG__
	if (ret != ERROR_SUCCESS)
		std::cout << "J2534interface::getAvailableJ2534Libs():   RegCloseKey(hKey1) failed with error " << ret << "\n";
	printLibraryInfo(PTlibraries);
#endif
	return PTlibraries;
}