1 /*
2  * Copyright (C) 2006 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef ANDROID_USB_API_ADBWINUSBAPI_H__
18 #define ANDROID_USB_API_ADBWINUSBAPI_H__
19 
20 /** \file
21   Contains declarations required to link AdbWinApi and AdbWinUsbApi DLLs.
22 */
23 
24 /** \brief Function prototype for InstantiateWinUsbInterface routine exported
25   from AdbWinUsbApi.dll
26 
27   In order to provide backward compatibility with the systems that still run
28   legacy (custom) USB drivers, and have not installed WINUSB.DLL we need to
29   split functionality of our ADB API on Windows between two DLLs: AdbWinApi,
30   and AdbWinUsbApi. AdbWinApi is fully capable of working on top of the legacy
31   driver, but has no traces to WinUsb. AdbWinUsbApi is capable of working on
32   top of WinUsb API. We are forced to do this split, because we can have
33   dependency on WINUSB.DLL in the DLL that implements legacy API. The problem
34   is that customers may have a legacy driver that they don't want to upgrade
35   to WinUsb, so they may not have WINUSB.DLL installed on their machines, but
36   they still must be able to use ADB. So, the idea behind the split is as
37   such. When AdbWinApi.dll is loaded into a process, it will check WINUSB.DLL
38   installation (by checking existance of C:\Windows\System32\winusb.dll). If
39   WINUSB.DLL is installed, AdbWinApi will also load AdbWinUsbApi.dll (by
40   calling LoadLibrary), and will extract address of InstantiateWinUsbInterface
41   routine exported from AdbWinUsbApi.dll. Then this routine will be used to
42   instantiate AdbInterfaceObject instance on condition that it is confirmed
43   that USB driver underneath us is in deed WinUsb.
44 */
45 typedef class AdbInterfaceObject* \
46     (__cdecl *PFN_INSTWINUSBINTERFACE)(const wchar_t*);
47 
48 #endif  // ANDROID_USB_API_ADBWINUSBAPI_H__
49