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.
In this patch set new file (adb_winusb_api.h) has been added where I moved
typedef that broke the build. Aso, adb_api.cpp and AdbWinApi.cpp were changed
to include that new header file.
BUG 2033924
This commit is contained in:
vchtchetkine
2009-08-05 16:57:18 -07:00
parent 3e44f3b231
commit acc6f82643
25 changed files with 700 additions and 24 deletions

View File

@@ -24,11 +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"
#include "adb_winusb_api.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,
@@ -101,11 +109,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