// AdbWinApi.cpp : Implementation of DLL Exports.\r
\r
#include "stdafx.h"\r
-#include "adb_api.h"\r
\r
extern "C" {\r
int _forceCRTManifest;\r
int _forceAtlDllManifest;\r
};\r
\r
-/// References InstantiateWinUsbInterface declared in adb_api.cpp\r
-extern PFN_INSTWINUSBINTERFACE InstantiateWinUsbInterface;\r
-\r
class CAdbWinApiModule : public CAtlDllModuleT< CAdbWinApiModule > {\r
- public:\r
- CAdbWinApiModule()\r
- : CAtlDllModuleT< CAdbWinApiModule >(),\r
- adbwinusbapi_handle_(NULL),\r
- is_initialized_(false) {\r
- }\r
-\r
- ~CAdbWinApiModule() {\r
- // Unload AdbWinUsbApi.dll before we exit\r
- if (NULL != adbwinusbapi_handle_) {\r
- FreeLibrary(adbwinusbapi_handle_);\r
- }\r
- }\r
-\r
- /** \brief Loads AdbWinUsbApi.dll and caches its InstantiateWinUsbInterface\r
- export.\r
-\r
- This method is called from DllMain on DLL_PROCESS_ATTACH event. In this\r
- method we will check if WINUSB.DLL required by AdbWinUsbApi.dll is\r
- installed, and if it is we will load AdbWinUsbApi.dll and cache address of\r
- InstantiateWinUsbInterface routine exported from AdbWinUsbApi.dll\r
- */\r
- void AttachToAdbWinUsbApi() {\r
- // We only need to run this only once.\r
- if (is_initialized_) {\r
- return;\r
- }\r
-\r
- // Just mark that we have ran initialization.\r
- is_initialized_ = true;\r
-\r
- // Before we can load AdbWinUsbApi.dll we must make sure that WINUSB.DLL\r
- // has been installed. Build path to the file.\r
- wchar_t path_to_winusb_dll[MAX_PATH+1];\r
- if (!GetSystemDirectory(path_to_winusb_dll, MAX_PATH)) {\r
- return;\r
- }\r
- wcscat(path_to_winusb_dll, L"\\WINUSB.DLL");\r
-\r
- if (0xFFFFFFFF == GetFileAttributes(path_to_winusb_dll)) {\r
- // WINUSB.DLL is not installed. We don't (in fact, can't) load\r
- // AdbWinUsbApi.dll\r
- return;\r
- }\r
-\r
- // WINUSB.DLL is installed. Lets load AdbWinUsbApi.dll and cache its\r
- // InstantiateWinUsbInterface export.\r
- // We require that AdbWinUsbApi.dll is located in the same folder\r
- // where AdbWinApi.dll and adb.exe are located, so by Windows\r
- // conventions we can pass just module name, and not the full path.\r
- adbwinusbapi_handle_ = LoadLibrary(L"AdbWinUsbApi.dll");\r
- if (NULL != adbwinusbapi_handle_) {\r
- InstantiateWinUsbInterface = reinterpret_cast<PFN_INSTWINUSBINTERFACE>\r
- (GetProcAddress(adbwinusbapi_handle_, "InstantiateWinUsbInterface"));\r
- }\r
- }\r
-\r
- protected:\r
- /// Handle to the loaded AdbWinUsbApi.dll\r
- HINSTANCE adbwinusbapi_handle_;\r
-\r
- /// Flags whether or not this module has been initialized.\r
- bool is_initialized_;\r
+public:\r
};\r
\r
CAdbWinApiModule _AtlModule;\r
extern "C" BOOL WINAPI DllMain(HINSTANCE instance,\r
DWORD reason,\r
LPVOID reserved) {\r
- // Lets see if we need to initialize InstantiateWinUsbInterface\r
- // variable. We do that only once, on condition that this DLL is\r
- // being attached to the process and InstantiateWinUsbInterface\r
- // address has not been calculated yet.\r
- if (DLL_PROCESS_ATTACH == reason) {\r
- _AtlModule.AttachToAdbWinUsbApi();\r
- }\r
- return _AtlModule.DllMain(reason, reserved);\r
+ return _AtlModule.DllMain(reason, reserved); \r
}\r
$(SDK_LIB_PATH)\wbemuuid.lib \\r
$(SDK_LIB_PATH)\uuid.lib \\r
$(SDK_LIB_PATH)\setupapi.lib \\r
- $(SDK_LIB_PATH)\usbd.lib\r
+ $(SDK_LIB_PATH)\usbd.lib \\r
+ $(SDK_LIB_PATH)\winusb.lib\r
\r
!IF "$(DDKBUILDENV)" == "fre"
# Libraries for release (free) builds
# Define source files for AdbWinApi.dll\r
SOURCES = adb_api.cpp \\r
adb_endpoint_object.cpp \\r
+ adb_winusb_endpoint_object.cpp \\r
adb_legacy_endpoint_object.cpp \\r
adb_helper_routines.cpp \\r
adb_interface.cpp \\r
+ adb_winusb_interface.cpp \\r
adb_legacy_interface.cpp \\r
adb_interface_enum.cpp \\r
adb_io_completion.cpp \\r
+ adb_winusb_io_completion.cpp \\r
adb_legacy_io_completion.cpp \\r
adb_object_handle.cpp \\r
AdbWinApi.cpp \\r
#include "adb_object_handle.h"\r
#include "adb_interface_enum.h"\r
#include "adb_interface.h"\r
+#include "adb_winusb_interface.h"\r
#include "adb_legacy_interface.h"\r
#include "adb_endpoint_object.h"\r
#include "adb_io_completion.h"\r
#include "adb_helper_routines.h"\r
\r
-/** \brief Points to InstantiateWinUsbInterface exported from AdbWinUsbApi.dll.\r
-\r
- This variable is initialized with the actual address in DllMain routine for\r
- this DLL on DLL_PROCESS_ATTACH event.\r
- @see PFN_INSTWINUSBINTERFACE for more information.\r
-*/\r
-PFN_INSTWINUSBINTERFACE InstantiateWinUsbInterface = NULL;\r
-\r
ADBAPIHANDLE __cdecl AdbEnumInterfaces(GUID class_id,\r
bool exclude_not_present,\r
bool exclude_removed,\r
ADBAPIHANDLE ret = NULL;\r
\r
try {\r
- // Instantiate interface object, depending on the USB driver type.\r
+ // Instantiate object\r
if (IsLegacyInterface(interface_name)) {\r
- // We have legacy USB driver underneath us.\r
obj = new AdbLegacyInterfaceObject(interface_name);\r
} else {\r
- // We have WinUsb driver underneath us. Make sure that AdbWinUsbApi.dll\r
- // is loaded and its InstantiateWinUsbInterface routine address has\r
- // been cached.\r
- if (NULL != InstantiateWinUsbInterface) {\r
- obj = InstantiateWinUsbInterface(interface_name);\r
- if (NULL == obj) {\r
- return NULL;\r
- }\r
- } else {\r
- return NULL;\r
- }\r
+ obj = new AdbWinUsbInterfaceObject(interface_name);\r
}\r
\r
// Create handle for it\r
/// the driver in isolation from hardware.\r
#define DEVICE_EMULATOR_PROD_ID 0xDDDD\r
\r
-/** \brief Function prototype for InstantiateWinUsbInterface routine exported\r
- from AdbWinUsbApi.dll\r
-\r
- In order to provide backward compatibility with the systems that still run\r
- legacy (custom) USB drivers, and have not installed WINUSB.DLL we need to\r
- split functionality of our ADB API on Windows between two DLLs: AdbWinApi,\r
- and AdbWinUsbApi. AdbWinApi is fully capable of working on top of the legacy\r
- driver, but has no traces to WinUsb. AdbWinUsbApi is capable of working on\r
- top of WinUsb API. We are forced to do this split, because we can have\r
- dependency on WINUSB.DLL in the DLL that implements legacy API. The problem\r
- is that customers may have a legacy driver that they don't want to upgrade\r
- to WinUsb, so they may not have WINUSB.DLL installed on their machines, but\r
- they still must be able to use ADB. So, the idea behind the split is as\r
- such. When AdbWinApi.dll is loaded into a process, it will check WINUSB.DLL\r
- installation (by checking existance of C:\Windows\System32\winusb.dll). If\r
- WINUSB.DLL is installed, AdbWinApi will also load AdbWinUsbApi.dll (by\r
- calling LoadLibrary), and will extract address of InstantiateWinUsbInterface\r
- routine exported from AdbWinUsbApi.dll. Then this routine will be used to\r
- instantiate AdbInterfaceObject instance on condition that it is confirmed\r
- that USB driver underneath us is in deed WinUsb.\r
-*/\r
-typedef class AdbInterfaceObject* \\r
- (__cdecl *PFN_INSTWINUSBINTERFACE)(const wchar_t*);\r
-\r
// The following ifdef block is the standard way of creating macros which make\r
// exporting from a DLL simpler. All files within this DLL are compiled with\r
// the ADBWIN_EXPORTS symbol defined on the command line. this symbol should\r
// as being exported.\r
#ifdef ADBWIN_EXPORTS\r
#define ADBWIN_API EXTERN_C __declspec(dllexport)\r
-#define ADBWIN_API_CLASS __declspec(dllexport)\r
#else\r
#define ADBWIN_API EXTERN_C __declspec(dllimport)\r
-#define ADBWIN_API_CLASS __declspec(dllimport)\r
#endif\r
\r
/** \brief Handle to an API object.\r
This class implement functionality that is common for both, WinUsb and\r
legacy APIs.\r
*/\r
-class ADBWIN_API_CLASS AdbEndpointObject : public AdbObjectHandle {\r
+class AdbEndpointObject : public AdbObjectHandle {\r
public:\r
/** \brief Constructs the object\r
\r
\r
#include "adb_object_handle.h"\r
\r
-// 'AdbInterfaceObject::interface_name_' : class 'std::basic_string<_E,_Tr,_A>'\r
-// needs to have dll-interface to be used by clients of class\r
-// 'AdbInterfaceObject' We're ok with that, since interface_name_ will not\r
-// be referenced by name from outside of this class.\r
-#pragma warning(disable: 4251)\r
/** \brief Encapsulates an interface on our USB device.\r
\r
This is an abstract class that implements functionality common for both,\r
legacy, and WinUsb based interfaces.\r
*/\r
-class ADBWIN_API_CLASS AdbInterfaceObject : public AdbObjectHandle {\r
+class AdbInterfaceObject : public AdbObjectHandle {\r
public:\r
/** \brief Constructs the object.\r
\r
}\r
\r
protected:\r
+ /// Name of the USB interface (device name) for this object\r
+ std::wstring interface_name_;\r
+\r
/// Cached usb device descriptor\r
USB_DEVICE_DESCRIPTOR usb_device_descriptor_;\r
\r
\r
/// Cached usb interface descriptor\r
USB_INTERFACE_DESCRIPTOR usb_interface_descriptor_;\r
-\r
- private:\r
- /// Name of the USB interface (device name) for this object\r
- std::wstring interface_name_;\r
};\r
-#pragma warning(default: 4251)\r
\r
#endif // ANDROID_USB_API_ADB_INTERFACE_H__\r
like all other handles this handle must be closed after it's no longer\r
needed.\r
*/\r
-class ADBWIN_API_CLASS AdbIOCompletion : public AdbObjectHandle {\r
+class AdbIOCompletion : public AdbObjectHandle {\r
public:\r
/** \brief Constructs the object\r
\r
of the API through a handle.\r
*/\r
\r
-#include "adb_api.h"\r
#include "adb_api_private_defines.h"\r
\r
/** \brief Defines types of internal API objects\r
All API objects that have handles that are sent back to API client must be\r
derived from this class.\r
*/\r
-class ADBWIN_API_CLASS AdbObjectHandle {\r
+class AdbObjectHandle {\r
public:\r
/** \brief Constructs the object\r
\r
#include "stdafx.h"\r
#include "adb_winusb_endpoint_object.h"\r
#include "adb_winusb_io_completion.h"\r
+#include "adb_helper_routines.h"\r
\r
AdbWinUsbEndpointObject::AdbWinUsbEndpointObject(\r
AdbWinUsbInterfaceObject* parent_interf,\r
AdbWinUsbEndpointObject::~AdbWinUsbEndpointObject() {\r
}\r
\r
-LONG AdbWinUsbEndpointObject::Release() {\r
- ATLASSERT(ref_count_ > 0);\r
- LONG ret = InterlockedDecrement(&ref_count_);\r
- ATLASSERT(ret >= 0);\r
- if (0 == ret) {\r
- LastReferenceReleased();\r
- delete this;\r
- }\r
- return ret;\r
-}\r
-\r
ADBAPIHANDLE AdbWinUsbEndpointObject::CommonAsyncReadWrite(\r
bool is_read,\r
void* buffer,\r
encapsulates a handle opened to a WinUsb endpoint on our device.\r
*/\r
\r
-#include "..\api\adb_endpoint_object.h"\r
+#include "adb_endpoint_object.h"\r
#include "adb_winusb_interface.h"\r
\r
/** Class AdbWinUsbEndpointObject encapsulates a handle opened to an endpoint on\r
virtual ~AdbWinUsbEndpointObject();\r
\r
//\r
- // Virtual overrides\r
- //\r
-\r
- public:\r
- /** \brief Releases the object.\r
-\r
- If refcount drops to zero as the result of this release, the object is\r
- destroyed in this method. As a general rule, objects must not be touched\r
- after this method returns even if returned value is not zero. We override\r
- this method in order to make sure that objects of this class are deleted\r
- in contect of the DLL they were created in. The problem is that since\r
- objects of this class were created in context of AdbWinUsbApi module, they\r
- are allocated from the heap assigned to that module. Now, if these objects\r
- are deleted outside of AdbWinUsbApi module, this will lead to the heap\r
- corruption in the module that deleted these objects. Since all objects of\r
- this class are deleted in the Release method only, by overriding it we make\r
- sure that we free memory in the context of the module where it was\r
- allocated.\r
- @return Value of the reference counter after object is released in this\r
- method.\r
- */\r
- virtual LONG Release();\r
-\r
- //\r
// Abstract overrides\r
//\r
\r
ATLASSERT(INVALID_HANDLE_VALUE == usb_device_handle_);\r
}\r
\r
-LONG AdbWinUsbInterfaceObject::Release() {\r
- ATLASSERT(ref_count_ > 0);\r
- LONG ret = InterlockedDecrement(&ref_count_);\r
- ATLASSERT(ret >= 0);\r
- if (0 == ret) {\r
- LastReferenceReleased();\r
- delete this;\r
- }\r
- return ret;\r
-}\r
-\r
ADBAPIHANDLE AdbWinUsbInterfaceObject::CreateHandle() {\r
// Open USB device for this inteface Note that WinUsb API\r
// requires the handle to be opened for overlapped I/O.\r
via WinUsb API.\r
*/\r
\r
-#include "..\api\adb_interface.h"\r
+#include "adb_interface.h"\r
\r
/** \brief Encapsulates an interface on our USB device that is accessible\r
via WinUsb API.\r
//\r
\r
public:\r
- /** \brief Releases the object.\r
-\r
- If refcount drops to zero as the result of this release, the object is\r
- destroyed in this method. As a general rule, objects must not be touched\r
- after this method returns even if returned value is not zero. We override\r
- this method in order to make sure that objects of this class are deleted\r
- in contect of the DLL they were created in. The problem is that since\r
- objects of this class were created in context of AdbWinUsbApi module, they\r
- are allocated from the heap assigned to that module. Now, if these objects\r
- are deleted outside of AdbWinUsbApi module, this will lead to the heap\r
- corruption in the module that deleted these objects. Since all objects of\r
- this class are deleted in the Release method only, by overriding it we make\r
- sure that we free memory in the context of the module where it was\r
- allocated.\r
- @return Value of the reference counter after object is released in this\r
- method.\r
- */\r
- virtual LONG Release();\r
-\r
/** \brief Creates handle to this object.\r
\r
In this call a handle for this object is generated and object is added\r
AdbWinUsbIOCompletion::~AdbWinUsbIOCompletion() {\r
}\r
\r
-LONG AdbWinUsbIOCompletion::Release() {\r
- ATLASSERT(ref_count_ > 0);\r
- LONG ret = InterlockedDecrement(&ref_count_);\r
- ATLASSERT(ret >= 0);\r
- if (0 == ret) {\r
- LastReferenceReleased();\r
- delete this;\r
- }\r
- return ret;\r
-}\r
-\r
bool AdbWinUsbIOCompletion::GetOvelappedIoResult(LPOVERLAPPED ovl_data,\r
ULONG* bytes_transferred,\r
bool wait) {\r
asynchronous I/O requests issued via WinUsb API.\r
*/\r
\r
-#include "..\api\adb_io_completion.h"\r
+#include "adb_io_completion.h"\r
#include "adb_winusb_endpoint_object.h"\r
\r
/** \brief Encapsulates encapsulates a wrapper around OVERLAPPED Win32\r
virtual ~AdbWinUsbIOCompletion();\r
\r
//\r
- // Virtual overrides\r
- //\r
-\r
- public:\r
- /** \brief Releases the object.\r
-\r
- If refcount drops to zero as the result of this release, the object is\r
- destroyed in this method. As a general rule, objects must not be touched\r
- after this method returns even if returned value is not zero. We override\r
- this method in order to make sure that objects of this class are deleted\r
- in contect of the DLL they were created in. The problem is that since\r
- objects of this class were created in context of AdbWinUsbApi module, they\r
- are allocated from the heap assigned to that module. Now, if these objects\r
- are deleted outside of AdbWinUsbApi module, this will lead to the heap\r
- corruption in the module that deleted these objects. Since all objects of\r
- this class are deleted in the Release method only, by overriding it we make\r
- sure that we free memory in the context of the module where it was\r
- allocated.\r
- @return Value of the reference counter after object is released in this\r
- method.\r
- */\r
- virtual LONG Release();\r
-\r
- //\r
// Abstract overrides\r
//\r
\r
#include <string>\r
#pragma warning(default: 4201)\r
#pragma warning(disable: 4200)\r
+extern "C" {\r
#include <usbdi.h>\r
+#include <winusb.h>\r
#include <usb100.h>\r
+}\r
\r
#include "resource.h"\r
\r
+++ /dev/null
-/*\r
- * Copyright (C) 2009 The Android Open Source Project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-// AdbWinUsbApi.cpp : Implementation of DLL Exports.\r
-\r
-#include "stdafx.h"\r
-#include "adb_winusb_interface.h"\r
-\r
-class CAdbWinApiModule : public CAtlDllModuleT< CAdbWinApiModule > {\r
-public:\r
-};\r
-\r
-CAdbWinApiModule _AtlModule;\r
-\r
-// DLL Entry Point\r
-extern "C" BOOL WINAPI DllMain(HINSTANCE instance,\r
- DWORD reason,\r
- LPVOID reserved) {\r
- return _AtlModule.DllMain(reason, reserved);\r
-}\r
-\r
-/** \brief Instantiates interface instance that uses WinUsb API to communicate\r
- with USB driver.\r
-\r
- This is the only exported routine from this DLL. This routine instantiates an\r
- object of AdbWinUsbInterfaceObject on request from AdbWinApi.dll when it is\r
- detected that underlying USB driver is WinUsb.sys.\r
- @param[in] interface_name Name of the interface.\r
- @return AdbInterfaceObject - casted instance of AdbWinUsbInterfaceObject\r
- object on success, or NULL on failure with GetLastError providing\r
- information on an error that occurred.\r
-*/\r
-extern "C" __declspec(dllexport)\r
-AdbInterfaceObject* __cdecl InstantiateWinUsbInterface(\r
- const wchar_t* interface_name) {\r
- // Validate parameter.\r
- if (NULL == interface_name) {\r
- return NULL;\r
- }\r
-\r
- // Instantiate requested object.\r
- try {\r
- return new AdbWinUsbInterfaceObject(interface_name);\r
- } catch (...) {\r
- // We expect only OOM exceptions here.\r
- SetLastError(ERROR_OUTOFMEMORY);\r
- return NULL;\r
- }\r
-}\r
+++ /dev/null
-; AdbWinUsbApi.def : Declares the module parameters.\r
-\r
-LIBRARY "AdbWinUsbApi.DLL"\r
-\r
-EXPORTS\r
+++ /dev/null
-/*\r
- * Copyright (C) 2009 The Android Open Source Project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-//Microsoft Visual C++ generated resource script.\r
-//\r
-#include "resource.h"\r
-\r
-#define APSTUDIO_READONLY_SYMBOLS\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Generated from the TEXTINCLUDE 2 resource.\r
-//\r
-#include "winres.h"\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-#undef APSTUDIO_READONLY_SYMBOLS\r
-\r
-#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)\r
-LANGUAGE 9, 1\r
-#pragma code_page(1252)\r
-#ifdef APSTUDIO_INVOKED\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// TEXTINCLUDE\r
-//\r
-\r
-1 TEXTINCLUDE\r
-BEGIN\r
- "resource.h\0"\r
-END\r
-\r
-2 TEXTINCLUDE\r
-BEGIN\r
- "#include ""winres.h""\r\n"\r
- "\0"\r
-END\r
-\r
-#endif // APSTUDIO_INVOKED\r
-\r
-#ifndef _MAC\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// Version\r
-//\r
-\r
-VS_VERSION_INFO VERSIONINFO\r
- FILEVERSION 2,0,0,0\r
- PRODUCTVERSION 2,0,0,0\r
- FILEFLAGSMASK 0x3fL\r
-#ifdef _DEBUG\r
- FILEFLAGS 0x1L\r
-#else\r
- FILEFLAGS 0x0L\r
-#endif\r
- FILEOS 0x4L\r
- FILETYPE 0x2L\r
- FILESUBTYPE 0x0L\r
-BEGIN\r
- BLOCK "StringFileInfo"\r
- BEGIN\r
- BLOCK "040904e4"\r
- BEGIN\r
- VALUE "CompanyName", "Google, inc"\r
- VALUE "FileDescription", "Android ADB API (WinUsb)"\r
- VALUE "FileVersion", "2.0.0.0"\r
- VALUE "LegalCopyright", "Copyright (C) 2006 The Android Open Source Project"\r
- VALUE "InternalName", "AdbWinUsbApi.dll"\r
- VALUE "OriginalFilename", "AdbWinUsbApi.dll"\r
- VALUE "ProductName", "Android SDK"\r
- VALUE "ProductVersion", "2.0.0.0"\r
- VALUE "OLESelfRegister", ""\r
- END\r
- END\r
- BLOCK "VarFileInfo"\r
- BEGIN\r
- VALUE "Translation", 0x0409, 1252\r
- END\r
-END\r
-\r
-#endif // !_MAC\r
-\r
-/////////////////////////////////////////////////////////////////////////////\r
-//\r
-// String Table\r
-//\r
-\r
-STRINGTABLE\r
-BEGIN\r
- IDS_PROJNAME "AdbWinUsbApi"\r
-END\r
-\r
-////////////////////////////////////////////////////////////////////////////\r
-\r
-\r
-#endif\r
-\r
-#ifndef APSTUDIO_INVOKED\r
-#endif // not APSTUDIO_INVOKED\r
+++ /dev/null
-In order to build AdbWinUsbApi.dll you will need to install Windows Driver Kit,\r
-which can be obtained from Microsoft. Assuming that WDK is installed, you\r
-need to set one of the WDK's build environments, "cd" back into this directory,\r
-and execute "build -cbeEIFZ" to clean and rebuild this project, or you can\r
-execute "build -befEIF" to do a minimal build.\r
-Note that you need to build AdbWinApi.dll (..\api) before you build\r
-AdbWinUsbApi.dll, as it depends on AdbWinApi.lib library.\r
+++ /dev/null
-#\r
-# Copyright (C) 2009 The Android Open Source Project\r
-# \r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-# \r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-# \r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-\r
-#\r
-# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source\r
-# file to this component. This file merely indirects to the real make file\r
-# that is shared by all the components of NT OS/2\r
-#\r
-!INCLUDE $(NTMAKEENV)\makefile.def\r
+++ /dev/null
-/*\r
- * Copyright (C) 2009 The Android Open Source Project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-//{{NO_DEPENDENCIES}}\r
-// Microsoft Visual C++ generated include file.\r
-// Used by AdbWinApi.rc\r
-//\r
-\r
-#define IDS_PROJNAME 100\r
-#define IDR_ADBWINAPI 101\r
-\r
-// Next default values for new objects\r
-//\r
-#ifdef APSTUDIO_INVOKED\r
-#ifndef APSTUDIO_READONLY_SYMBOLS\r
-#define _APS_NEXT_RESOURCE_VALUE 201\r
-#define _APS_NEXT_COMMAND_VALUE 32768\r
-#define _APS_NEXT_CONTROL_VALUE 201\r
-#define _APS_NEXT_SYMED_VALUE 102\r
-#endif\r
-#endif\r
+++ /dev/null
-#\r
-# Copyright (C) 2009 The Android Open Source Project\r
-# \r
-# Licensed under the Apache License, Version 2.0 (the "License");\r
-# you may not use this file except in compliance with the License.\r
-# You may obtain a copy of the License at\r
-# \r
-# http://www.apache.org/licenses/LICENSE-2.0\r
-# \r
-# Unless required by applicable law or agreed to in writing, software\r
-# distributed under the License is distributed on an "AS IS" BASIS,\r
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
-# See the License for the specific language governing permissions and\r
-# limitations under the License.\r
-#\r
-\r
-TARGETNAME = AdbWinUsbApi\r
-TARGETPATH = obj\r
-TARGETTYPE = DYNLINK\r
-\r
-UMTYPE = windows\r
-DLLDEF = AdbWinUsbApi.def\r
-\r
-# Use statically linked atl libraries:\r
-# - atls.lib for free build\r
-# - atlsd.lib for checked build\r
-USE_STATIC_ATL = 1\r
-# Use ATL v. 7.1\r
-ATL_VER = 71\r
-# Use STL v. 6.0\r
-USE_STL = 1\r
-STL_VER = 60\r
-# Use multithreaded libraries\r
-USE_LIBCMT = 1\r
-\r
-# Include directories\r
-INCLUDES = $(DDK_INC_PATH); \\r
- $(SDK_INC_PATH); \\r
- $(CRT_INC_PATH); \\r
- $(SDK_INC_PATH)\crt; \\r
- $(CRT_INC_PATH)\atl71; \\r
- $(SDK_INC_PATH)\crt\stl60\r
-\r
-# Common target libraries\r
-TARGETLIBS = $(SDK_LIB_PATH)\ole32.lib \\r
- $(SDK_LIB_PATH)\Advapi32.lib \\r
- $(SDK_LIB_PATH)\Kernel32.lib \\r
- $(SDK_LIB_PATH)\User32.lib \\r
- $(SDK_LIB_PATH)\oleaut32.lib \\r
- $(SDK_LIB_PATH)\wbemuuid.lib \\r
- $(SDK_LIB_PATH)\uuid.lib \\r
- $(SDK_LIB_PATH)\setupapi.lib \\r
- $(SDK_LIB_PATH)\usbd.lib \\r
- $(SDK_LIB_PATH)\winusb.lib \\r
- ..\api\obj$(BUILD_ALT_DIR)\i386\AdbWinApi.lib\r
-\r
-!IF "$(DDKBUILDENV)" == "fre"
-# Libraries for release (free) builds
-TARGETLIBS = $(TARGETLIBS) $(ATL_LIB_PATH)\atls.lib\r
-!ELSE\r
-# Libraries for debug (checked) builds
-TARGETLIBS = $(TARGETLIBS) $(ATL_LIB_PATH)\atlsd.lib\r
-!ENDIF\r
-\r
-# Common C defines\r
-C_DEFINES= $(C_DEFINES) -DADBWINUSB_EXPORTS -D_UNICODE \\r
- -DUNICODE -DWIN32 -D_WINDOWS -D_USRDLL -D_WINDLL\r
-\r
-!IF "$(DDKBUILDENV)" == "fre"
-# C defines for release (free) builds
-C_DEFINES = $(C_DEFINES) -DNDEBUG\r
-!ELSE\r
-# C defines for debug (checked) builds
-C_DEFINES = $(C_DEFINES) -D_DEBUG\r
-!ENDIF\r
-\r
-# Turn on all warnings, and treat warnings as errors\r
-MSC_WARNING_LEVEL = /W4 /Wp64 /WX
-
-# Common C defines\r
-USER_C_FLAGS = $(USER_C_FLAGS) /FD /EHsc /wd4100 /wd4200 /wd4702 /nologo
-
-# Set precompiled header information
-PRECOMPILED_CXX = 1\r
-PRECOMPILED_INCLUDE = stdafx.h\r
-PRECOMPILED_SOURCEFILE = stdafx.cpp\r
-\r
-# Define source files for AdbWinUsbApi.dll\r
-SOURCES = adb_winusb_endpoint_object.cpp \\r
- adb_winusb_interface.cpp \\r
- adb_winusb_io_completion.cpp \\r
- AdbWinUsbApi.cpp \\r
- AdbWinUsbApi.rc\r
+++ /dev/null
-/*\r
- * Copyright (C) 2009 The Android Open Source Project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-// stdafx.cpp : source file that includes just the standard includes\r
-// AdbWinUsbApi.pch will be the pre-compiled header\r
-// stdafx.obj will contain the pre-compiled type information\r
-\r
-#include "stdafx.h"\r
+++ /dev/null
-/*\r
- * Copyright (C) 2009 The Android Open Source Project\r
- *\r
- * Licensed under the Apache License, Version 2.0 (the "License");\r
- * you may not use this file except in compliance with the License.\r
- * You may obtain a copy of the License at\r
- *\r
- * http://www.apache.org/licenses/LICENSE-2.0\r
- *\r
- * Unless required by applicable law or agreed to in writing, software\r
- * distributed under the License is distributed on an "AS IS" BASIS,\r
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
- * See the License for the specific language governing permissions and\r
- * limitations under the License.\r
- */\r
-\r
-/** \file\r
- Visual Studio generated include file for standard system include files, or\r
- project specific include files that are used frequently, but are changed\r
- infrequently.\r
-*/\r
-\r
-#pragma once\r
-\r
-#ifndef STRICT\r
-#define STRICT\r
-#endif\r
-\r
-// Modify the following defines if you have to target a platform prior to the ones specified below.\r
-// Refer to MSDN for the latest info on corresponding values for different platforms.\r
-#ifndef WINVER // Allow use of features specific to Windows 95 and Windows NT 4 or later.\r
-#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.\r
-#endif\r
-\r
-#ifndef _WIN32_WINNT // Allow use of features specific to Windows NT 4 or later.\r
-#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 2000 or later.\r
-#endif\r
-\r
-#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later.\r
-#define _WIN32_WINDOWS 0x0500 // Change this to the appropriate value to target Windows Me or later.\r
-#endif\r
-\r
-#ifndef _WIN32_IE // Allow use of features specific to IE 4.0 or later.\r
-#define _WIN32_IE 0x0501 // Change this to the appropriate value to target IE 5.0 or later.\r
-#endif\r
-\r
-// These defines prevent the MS header files from ejecting #pragma comment\r
-// statements with the manifest information of the used ATL, STL, and CRT\r
-#define _ATL_NOFORCE_MANIFEST\r
-#define _STL_NOFORCE_MANIFEST\r
-#define _CRT_NOFORCE_MANIFEST\r
-\r
-#define _ATL_APARTMENT_THREADED\r
-#define _ATL_NO_AUTOMATIC_NAMESPACE\r
-\r
-#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // some CString constructors will be explicit\r
-\r
-// turns off ATL's hiding of some common and often safely ignored warning messages\r
-#define _ATL_ALL_WARNINGS\r
-\r
-// #define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers\r
-\r
-#include <windows.h>\r
-#pragma warning(disable: 4702)\r
-#pragma warning(disable: 4201)\r
-#include <atlbase.h>\r
-#include <winioctl.h>\r
-#include <setupapi.h>\r
-#include <vector>\r
-#include <map>\r
-#include <string>\r
-#pragma warning(default: 4201)\r
-#pragma warning(disable: 4200)\r
-#include <winusb.h>\r
-\r
-#include "resource.h"\r
-\r
-using namespace ATL;\r