Skip to content

Commit

Permalink
Bug Fix
Browse files Browse the repository at this point in the history
install GoogleUSBDriver
  • Loading branch information
nerrog committed Aug 16, 2020
1 parent 2576e4f commit 73e5896
Show file tree
Hide file tree
Showing 16 changed files with 229 additions and 7 deletions.
9 changes: 9 additions & 0 deletions Easy ADBuilder/Easy ADBuilder.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@
<PropertyGroup>
<ApplicationIcon>icon.ico</ApplicationIcon>
</PropertyGroup>
<PropertyGroup>
<SignManifests>true</SignManifests>
</PropertyGroup>
<PropertyGroup>
<ManifestCertificateThumbprint>589C890BDAA6CCFC417DDD39E8007AA924882F3A</ManifestCertificateThumbprint>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Reference Include="MetroFramework, Version=1.4.0.0, Culture=neutral, PublicKeyToken=5f91a84759bf584a, processorArchitecture=MSIL">
<HintPath>..\packages\MetroModernUI.1.4.0.0\lib\net\MetroFramework.dll</HintPath>
Expand Down
14 changes: 14 additions & 0 deletions Easy ADBuilder/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

29 changes: 23 additions & 6 deletions Easy ADBuilder/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,27 @@ private void build()
//adb環境構築メソッド

string sourcePath = $@"{(System.Environment.CurrentDirectory)}\platform-tools";
string driverpath = $@"{(System.Environment.CurrentDirectory)}\usb_driver";
string destinationPath = @"C:\adb";
//ディレクトリごとコピーする方法がワカラン
File.Copy($@"{sourcePath}\adb.exe", $@"{destinationPath}\adb.exe", true);
File.Copy($@"{sourcePath}\AdbWinApi.dll", $@"{destinationPath}\AdbWinApi.dll", true);
File.Copy($@"{sourcePath}\AdbWinUsbApi.dll", $@"{destinationPath}\AdbWinUsbApi.dll", true);
File.Copy($@"{sourcePath}\NOTICE.txt", $@"{destinationPath}\NOTICE.txt", true);
//環境変数pathへ追加


System.Diagnostics.Process pro = new System.Diagnostics.Process();

//Google USB Driverをインストール
pro.StartInfo.FileName = @"C:\Windows\System32\rundll32.exe";
pro.StartInfo.Arguments = $@"SETUPAPI.DLL,InstallHinfSection DefaultInstall 132 {driverpath}\android_winusb.inf";
pro.StartInfo.CreateNoWindow = true;
pro.StartInfo.UseShellExecute = false;
pro.StartInfo.RedirectStandardOutput = true;
pro.StartInfo.Verb = "RunAs";
pro.Start();

//環境変数pathへ追加
pro.StartInfo.FileName = "setx";
pro.StartInfo.Arguments = "/M path \" % path %;C:\\adb\"";
pro.StartInfo.CreateNoWindow = true;
Expand All @@ -48,7 +60,7 @@ private void build()
string output = pro.StandardOutput.ReadToEnd();
output.Replace("\r\r\n", "\n"); // 改行コード変換

MessageBox.Show($"{output}\r\nadb環境の構築が完了しました!");
MessageBox.Show($"{output}\r\nadb環境の構築が完了しました!","完了");
thread.Abort();
thread.Join();
}
Expand Down Expand Up @@ -100,21 +112,26 @@ private void metroButton1_Click(object sender, EventArgs e)

if (result == DialogResult.Yes)
{

thread = new Thread(new ThreadStart(build));
thread.Start();
}
else if (result == DialogResult.No)
{
MessageBox.Show("いいえが選択されました\r\nプログラムを終了します");
MessageBox.Show("いいえが選択されました\r\nプログラムを終了します");
Application.Exit();
}
}
else
{
Directory.CreateDirectory(path);
thread = new Thread(new ThreadStart(build));
thread.Start();
}
}

thread = new Thread(new ThreadStart(build));
thread.Start();
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("https://nerrog.net");
}
}
}
2 changes: 1 addition & 1 deletion Easy ADBuilder/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
アプリケーションが下位互換性を保つためにこの仮想化を要求する場合、この要素を
削除します。
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>
Expand Down
4 changes: 4 additions & 0 deletions usb_driver/amd64/NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The .dll files here are distributed by Microsoft Corporation as part of the
Windows Driver Kit (available at
http://www.microsoft.com/whdc/resources/downloads.mspx) and included here as
permitted by the Microsoft Software License Terms.
Binary file added usb_driver/amd64/WUDFUpdate_01009.dll
Binary file not shown.
Binary file added usb_driver/amd64/WdfCoInstaller01009.dll
Binary file not shown.
Binary file added usb_driver/amd64/winusbcoinstaller2.dll
Binary file not shown.
171 changes: 171 additions & 0 deletions usb_driver/android_winusb.inf
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
;
; Android WinUsb driver installation.
;
[Version]
Signature = "$Windows NT$"
Class = AndroidUsbDeviceClass
ClassGuid = {3F966BD9-FA04-4ec5-991C-D326973B5128}
Provider = %ProviderName%
DriverVer = 08/28/2014,11.0.0000.00000
CatalogFile.NTx86 = androidwinusb86.cat
CatalogFile.NTamd64 = androidwinusba64.cat

[ClassInstall32]
Addreg = AndroidWinUsbClassReg

[AndroidWinUsbClassReg]
HKR,,,0,%ClassName%
HKR,,Icon,,-1


[Manufacturer]
%ProviderName% = Google, NTx86, NTamd64


[Google.NTx86]

;Google Nexus One
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E12&MI_01

;Google Nexus S
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E21
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E22&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E23
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E24&MI_01

;Google Nexus 7
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4E40
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E42&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E44&MI_01

;Google Nexus Q
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_2C10
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_2C11

;Google Nexus (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4EE0
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE2&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE4&MI_02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE6&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE7
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_D001

;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01

;Project Tango (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4D00
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D02&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D04&MI_02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D06&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D07


[Google.NTamd64]

;Google Nexus One
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_0D02&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E11
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E12&MI_01

;Google Nexus S
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E21
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E22&MI_01
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_4E23
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E24&MI_01

;Google Nexus 7
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4E40
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E42&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4E44&MI_01

;Google Nexus Q
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_2C10
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_2C11

;Google Nexus (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4EE0
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE2&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE4&MI_02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE6&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4EE7
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_D001

;Google Glass
%SingleAdbInterface% = USB_Install, USB\VID_18D1&PID_9001
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_9001&MI_01

;Project Tango (generic)
%SingleBootLoaderInterface% = USB_Install, USB\VID_18D1&PID_4D00
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D02&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D04&MI_02
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D06&MI_01
%CompositeAdbInterface% = USB_Install, USB\VID_18D1&PID_4D07


[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT

[USB_Install.Services]
Include = winusb.inf
AddService = WinUSB,0x00000002,WinUSB_ServiceInstall

[WinUSB_ServiceInstall]
DisplayName = %WinUSB_SvcDesc%
ServiceType = 1
StartType = 3
ErrorControl = 1
ServiceBinary = %12%\WinUSB.sys

[USB_Install.Wdf]
KmdfService = WINUSB, WinUSB_Install

[WinUSB_Install]
KmdfLibraryVersion = 1.9

[USB_Install.HW]
AddReg = Dev_AddReg

[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{F72FE0D4-CBCB-407d-8814-9ED673D0DD6B}"

[USB_Install.CoInstallers]
AddReg = CoInstallers_AddReg
CopyFiles = CoInstallers_CopyFiles

[CoInstallers_AddReg]
HKR,,CoInstallers32,0x00010000,"WdfCoInstaller01009.dll,WdfCoInstaller","WinUSBCoInstaller2.dll"

[CoInstallers_CopyFiles]
WinUSBCoInstaller2.dll
WdfCoInstaller01009.dll

[DestinationDirs]
CoInstallers_CopyFiles=11

[SourceDisksNames]
1 = %DISK_NAME%,,,\i386
2 = %DISK_NAME%,,,\amd64

[SourceDisksFiles.x86]
WinUSBCoInstaller2.dll = 1
WdfCoInstaller01009.dll = 1

[SourceDisksFiles.amd64]
WinUSBCoInstaller2.dll = 2
WdfCoInstaller01009.dll = 2

[Strings]
ProviderName = "Google, Inc."
SingleAdbInterface = "Android ADB Interface"
CompositeAdbInterface = "Android Composite ADB Interface"
SingleBootLoaderInterface = "Android Bootloader Interface"
WinUSB_SvcDesc = "Android USB Driver"
DISK_NAME = "Android WinUsb installation disk"
ClassName = "Android Device"
Expand Down
Binary file added usb_driver/androidwinusb86.cat
Binary file not shown.
Binary file added usb_driver/androidwinusba64.cat
Binary file not shown.
4 changes: 4 additions & 0 deletions usb_driver/i386/NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
The .dll files here are distributed by Microsoft Corporation as part of the
Windows Driver Kit (available at
http://www.microsoft.com/whdc/resources/downloads.mspx) and included here as
permitted by the Microsoft Software License Terms.
Binary file added usb_driver/i386/WUDFUpdate_01009.dll
Binary file not shown.
Binary file added usb_driver/i386/WdfCoInstaller01009.dll
Binary file not shown.
Binary file added usb_driver/i386/winusbcoinstaller2.dll
Binary file not shown.
3 changes: 3 additions & 0 deletions usb_driver/source.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Pkg.Revision=12
Archive.HostOs=WINDOWS
Extra.Path=usb_driver

0 comments on commit 73e5896

Please sign in to comment.