summaryrefslogtreecommitdiffstats
path: root/host/windows/usb/api/adb_api.cpp
diff options
context:
space:
mode:
authorvchtchetkine <vchtchetkine@google.com>2009-08-05 16:57:18 -0700
committervchtchetkine <vchtchetkine@google.com>2009-08-07 11:07:53 -0700
commitacc6f826433e639b1ba00c021ab5f9161eb56e59 (patch)
treeb1f9776b8efc330892e5331304b1d56b3fa389e3 /host/windows/usb/api/adb_api.cpp
parent3e44f3b231c027f01290367049f2244514f22d16 (diff)
downloadandroid_development-acc6f826433e639b1ba00c021ab5f9161eb56e59.tar.gz
android_development-acc6f826433e639b1ba00c021ab5f9161eb56e59.tar.bz2
android_development-acc6f826433e639b1ba00c021ab5f9161eb56e59.zip
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
Diffstat (limited to 'host/windows/usb/api/adb_api.cpp')
-rw-r--r--host/windows/usb/api/adb_api.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/host/windows/usb/api/adb_api.cpp b/host/windows/usb/api/adb_api.cpp
index f9bd94e6c..e58bcf17a 100644
--- a/host/windows/usb/api/adb_api.cpp
+++ b/host/windows/usb/api/adb_api.cpp
@@ -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