Split AdbWinApi.dll into two dlls to remove dependency on WINUSB.DLL

Move all WINUSB-dependent functionality into AdbWinUsbApi.dll in order to
enable ADB on condition that WINUSB has not been installed.
This commit is contained in:
vchtchetkine
2009-08-05 16:57:18 -07:00
parent bf27d6e2f8
commit f855c4e846
24 changed files with 674 additions and 24 deletions

View File

@@ -24,12 +24,19 @@
#include "adb_object_handle.h"
#include "adb_interface_enum.h"
#include "adb_interface.h"
#include "adb_winusb_interface.h"
#include "adb_legacy_interface.h"
#include "adb_endpoint_object.h"
#include "adb_io_completion.h"
#include "adb_helper_routines.h"
/** \brief Points to InstantiateWinUsbInterface exported from AdbWinUsbApi.dll.
This variable is initialized with the actual address in DllMain routine for
this DLL on DLL_PROCESS_ATTACH event.
@see PFN_INSTWINUSBINTERFACE for more information.
*/
PFN_INSTWINUSBINTERFACE InstantiateWinUsbInterface = NULL;
ADBAPIHANDLE __cdecl AdbEnumInterfaces(GUID class_id,
bool exclude_not_present,
bool exclude_removed,
@@ -101,11 +108,22 @@ ADBAPIHANDLE __cdecl AdbCreateInterfaceByName(
ADBAPIHANDLE ret = NULL;
try {
// Instantiate object
// Instantiate interface object, depending on the USB driver type.
if (IsLegacyInterface(interface_name)) {
// We have legacy USB driver underneath us.
obj = new AdbLegacyInterfaceObject(interface_name);
} else {
obj = new AdbWinUsbInterfaceObject(interface_name);
// We have WinUsb driver underneath us. Make sure that AdbWinUsbApi.dll
// is loaded and its InstantiateWinUsbInterface routine address has
// been cached.
if (NULL != InstantiateWinUsbInterface) {
obj = InstantiateWinUsbInterface(interface_name);
if (NULL == obj) {
return NULL;
}
} else {
return NULL;
}
}
// Create handle for it