Skip to content

Commit 6838e6a

Browse files
committed
Initial commit
0 parents  commit 6838e6a

File tree

247 files changed

+1016327
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

247 files changed

+1016327
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
bin/
2+
gen/

LICENSE

Lines changed: 674 additions & 0 deletions
Large diffs are not rendered by default.

Makefile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
.PHONY: clean libwdi
2+
3+
CFLAGS=-std=c11 -Wall -Wextra -Werror
4+
5+
WIN_TOOLCHAIN=x86_64-w64-mingw32
6+
WIN_CFLAGS=-Wl,-Bstatic
7+
8+
INSTALLER_IN=driver_installer.c deps/libwdi-1.4.1/libwdi/.libs/libwdi.a gen/driver_installer.res
9+
INSTALLER_LIBS=-I deps/libwdi-1.4.1/libwdi/ -lsetupapi -lole32 -lntdll
10+
11+
installer: $(INSTALLER_IN)
12+
mkdir -p bin
13+
$(WIN_TOOLCHAIN)-gcc $(WIN_CFLAGS) $(INSTALLER_IN) $(INSTALLER_LIBS) -o bin/driver_installer
14+
15+
libwdi:
16+
cd deps/libwdi-1.4.1/ &&\
17+
export CC_FOR_BUILD=gcc &&\
18+
./autogen.sh --disable-shared --enable-static --disable-32bit --enable-64bit --host=x86_64-w64-mingw32 --with-libusb0=../../drivers/libusb-win32-bin-1.2.6.0/ --with-userdir=../../drivers/kedacom_adb/ --with-wdkdir=../../drivers/wdk-8.0 --with-wdfver=1011 --with-libusbk=../../drivers/libusbK-3.1.0.0-bin/bin/ &&\
19+
make
20+
21+
gen/driver_installer.res: driver_installer.rc driver_installer.exe.manifest
22+
mkdir -p gen
23+
x86_64-w64-mingw32-windres --input driver_installer.rc --output gen/driver_installer.res --output-format=coff
24+
25+
clean:
26+
rm -rf bin/*
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
name: CodeQL
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.gitignore'
7+
- '.gitattributes'
8+
- '**.cmd'
9+
- '**.md'
10+
- 'AUTHORS'
11+
- 'NEWS'
12+
- 'ChangeLog'
13+
pull_request:
14+
paths-ignore:
15+
- '.gitignore'
16+
- '.gitattributes'
17+
- '**.cmd'
18+
- '**.md'
19+
- 'AUTHORS'
20+
- 'NEWS'
21+
- 'ChangeLog'
22+
23+
env:
24+
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
25+
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download
26+
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
27+
SOLUTION_FILE_PATH: ./libwdi.sln
28+
TARGET_PLATFORM: x64
29+
BUILD_CONFIGURATION: Debug
30+
BUILD_MACROS: '"WDK_DIR=\"../wdk/Windows Kits/8.0\";LIBUSB0_DIR=\"../libusb0\";LIBUSBK_DIR=\"../libusbk/bin\""'
31+
32+
jobs:
33+
CodeQL-Build:
34+
runs-on: windows-latest
35+
36+
permissions:
37+
security-events: write
38+
39+
steps:
40+
- name: Checkout repository
41+
uses: actions/checkout@v2
42+
with:
43+
fetch-depth: 0
44+
submodules: recursive
45+
46+
- name: Download support files
47+
shell: cmd
48+
run: |
49+
curl -L ${{ env.WDK_URL }} -o wdk-redist.msi
50+
curl -L ${{ env.LIBUSB0_URL }} -o libusb0-redist.zip
51+
curl -L ${{ env.LIBUSBK_URL }} -o libusbk-redist.7z
52+
msiexec /a wdk-redist.msi /qn TARGETDIR=%CD%\wdk
53+
7z x libusb0-redist.zip
54+
7z x libusbk-redist.7z
55+
del *.zip
56+
del *.7z
57+
move libusb-win32* libusb0
58+
move libusbK* libusbk
59+
60+
- name: Initialize CodeQL
61+
uses: github/codeql-action/init@v1
62+
with:
63+
languages: cpp
64+
65+
- name: Add MSBuild to PATH
66+
uses: microsoft/setup-msbuild@v1
67+
68+
- name: Build
69+
shell: cmd
70+
run: msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=${{ env.BUILD_CONFIGURATION}},Platform=${{ env.TARGET_PLATFORM }},BuildMacros=${{ env.BUILD_MACROS }}
71+
72+
- name: Perform CodeQL Analysis
73+
uses: github/codeql-action/analyze@v1
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
name: Coverity
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.gitignore'
7+
- '.gitattributes'
8+
- '**.cmd'
9+
- '**.md'
10+
- 'AUTHORS'
11+
- 'NEWS'
12+
- 'ChangeLog'
13+
14+
env:
15+
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
16+
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download
17+
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
18+
SOLUTION_FILE_PATH: ./libwdi.sln
19+
20+
BUILD_MACROS: '"WDK_DIR=\"../wdk/Windows Kits/8.0\";LIBUSB0_DIR=\"../libusb0\";LIBUSBK_DIR=\"../libusbk/bin\""'
21+
22+
jobs:
23+
Coverity-Build:
24+
runs-on: windows-latest
25+
26+
steps:
27+
- name: Checkout repository
28+
uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
submodules: recursive
32+
- name: Download Coverity
33+
run: |
34+
curl -d "token=${{ secrets.COVERITY_SCAN_TOKEN }}&project=pbatard%2Flibwdi" -L https://scan.coverity.com/download/cxx/win64 -o cov-analysis-win64.zip
35+
7z x cov-analysis-win64.zip
36+
del cov-analysis-win64.zip
37+
move cov-analysis-win64* cov-analysis-win64
38+
- name: Add Coverity to PATH
39+
shell: bash
40+
run: echo "${{ github.workspace }}/cov-analysis-win64/bin" >> $GITHUB_PATH
41+
- name: Download support files
42+
shell: cmd
43+
run: |
44+
curl -L ${{ env.WDK_URL }} -o wdk-redist.msi
45+
curl -L ${{ env.LIBUSB0_URL }} -o libusb0-redist.zip
46+
curl -L ${{ env.LIBUSBK_URL }} -o libusbk-redist.7z
47+
msiexec /a wdk-redist.msi /qn TARGETDIR=%CD%\wdk
48+
7z x libusb0-redist.zip
49+
7z x libusbk-redist.7z
50+
del *.zip
51+
del *.7z
52+
move libusb-win32* libusb0
53+
move libusbK* libusbk
54+
- name: Add MSBuild to PATH
55+
uses: microsoft/setup-msbuild@v1
56+
- name: Build with Coverity
57+
shell: cmd
58+
run: cov-build.exe --dir cov-int msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=Release,Platform=x64,BuildMacros=${{ env.BUILD_MACROS }}
59+
- name: Upload Coverity build for analysis
60+
run: |
61+
7z a -r cov-int.zip cov-int
62+
curl --form email=${{ env.EMAIL }} --form token=${{ secrets.COVERITY_SCAN_TOKEN }} --form [email protected] --form version="${{ env.GITHUB_SHA }}" --form description="libwdi" https://scan.coverity.com/builds?project=pbatard%2Flibwdi
Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: MinGW
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.gitignore'
7+
- '.gitattributes'
8+
- '**.cmd'
9+
- '**.md'
10+
- 'AUTHORS'
11+
- 'NEWS'
12+
- 'ChangeLog'
13+
pull_request:
14+
paths-ignore:
15+
- '.gitignore'
16+
- '.gitattributes'
17+
- '**.cmd'
18+
- '**.md'
19+
- 'AUTHORS'
20+
- 'NEWS'
21+
- 'ChangeLog'
22+
23+
env:
24+
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
25+
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download
26+
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
27+
BUILD_OPTIONS: '--enable-toggable-debug --enable-examples-build --disable-debug --disable-shared'
28+
DRIVERS_PATHS: '--with-wdkdir="wdk/Windows Kits/8.0" --with-wdfver=1011 --with-libusb0="libusb0" --with-libusbk="libusbk/bin"'
29+
30+
jobs:
31+
MinGW-Build:
32+
runs-on: windows-latest
33+
34+
strategy:
35+
matrix:
36+
include:
37+
- { sys: mingw64, env: x86_64 }
38+
- { sys: mingw32, env: i686 }
39+
40+
defaults:
41+
run:
42+
shell: msys2 {0}
43+
44+
steps:
45+
- name: Install MinGW
46+
uses: msys2/setup-msys2@v2
47+
with:
48+
msystem: ${{ matrix.sys }}
49+
update: true
50+
install: >-
51+
mingw-w64-${{ matrix.env }}-toolchain
52+
base-devel
53+
git
54+
- name: Checkout repository
55+
uses: actions/checkout@v2
56+
with:
57+
fetch-depth: 0
58+
submodules: recursive
59+
- name: Download support files
60+
shell: cmd
61+
run: |
62+
curl -L ${{ env.WDK_URL }} -o wdk-redist.msi
63+
curl -L ${{ env.LIBUSB0_URL }} -o libusb0-redist.zip
64+
curl -L ${{ env.LIBUSBK_URL }} -o libusbk-redist.7z
65+
msiexec /a wdk-redist.msi /qn TARGETDIR=%CD%\wdk
66+
7z x libusb0-redist.zip
67+
7z x libusbk-redist.7z
68+
del *.zip
69+
del *.7z
70+
move libusb-win32* libusb0
71+
move libusbK* libusbk
72+
- name: Build
73+
run: |
74+
./bootstrap.sh
75+
[ "${{ matrix.env }}" == "x86_64" ] && EXTRA_OPTION=--disable-32bit
76+
./configure --build=${{ matrix.env }}-w64-mingw32 --host=${{ matrix.env }}-w64-mingw32 ${{ env.BUILD_OPTIONS }} $EXTRA_OPTION ${{ env.DRIVERS_PATHS }}
77+
make
78+
mkdir -p artifacts/${{ matrix.env }}
79+
mv examples/*.exe artifacts/${{ matrix.env }}
80+
- name: Display SHA-256
81+
if: ${{ github.event_name == 'push' }}
82+
run: sha256sum artifacts/${{ matrix.env }}/*.exe
83+
- name: Upload artifacts
84+
uses: actions/upload-artifact@v2
85+
if: ${{ github.event_name == 'push' }}
86+
with:
87+
name: MinGW
88+
path: ./artifacts/*/*.exe
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
name: VS2019
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- '.gitignore'
7+
- '.gitattributes'
8+
- '**.cmd'
9+
- '**.md'
10+
- 'AUTHORS'
11+
- 'NEWS'
12+
- 'ChangeLog'
13+
pull_request:
14+
paths-ignore:
15+
- '.gitignore'
16+
- '.gitattributes'
17+
- '**.cmd'
18+
- '**.md'
19+
- 'AUTHORS'
20+
- 'NEWS'
21+
- 'ChangeLog'
22+
23+
env:
24+
WDK_URL: https://go.microsoft.com/fwlink/p/?LinkID=253170
25+
LIBUSB0_URL: https://sourceforge.net/projects/libusb-win32/files/libusb-win32-releases/1.2.6.0/libusb-win32-bin-1.2.6.0.zip/download
26+
LIBUSBK_URL: https://github.com/mcuee/libusbk/releases/download/V3.1.0.0/libusbK-3.1.0.0-bin.7z
27+
SOLUTION_FILE_PATH: ./libwdi.sln
28+
BUILD_MACROS: '"WDK_DIR=\"../wdk/Windows Kits/8.0\";LIBUSB0_DIR=\"../libusb0\";LIBUSBK_DIR=\"../libusbk/bin\""'
29+
30+
jobs:
31+
VS2019-Build:
32+
runs-on: windows-latest
33+
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v2
37+
with:
38+
fetch-depth: 0
39+
submodules: recursive
40+
41+
- name: Download support files
42+
shell: cmd
43+
run: |
44+
curl -L ${{ env.WDK_URL }} -o wdk-redist.msi
45+
curl -L ${{ env.LIBUSB0_URL }} -o libusb0-redist.zip
46+
curl -L ${{ env.LIBUSBK_URL }} -o libusbk-redist.7z
47+
msiexec /a wdk-redist.msi /qn TARGETDIR=%CD%\wdk
48+
7z x libusb0-redist.zip
49+
7z x libusbk-redist.7z
50+
del *.zip
51+
del *.7z
52+
move libusb-win32* libusb0
53+
move libusbK* libusbk
54+
55+
- name: Add MSBuild to PATH
56+
uses: microsoft/setup-msbuild@v1
57+
58+
- name: Build
59+
shell: cmd
60+
run: |
61+
for %%P in (Win32 x64) do (
62+
for %%B in (Debug Release) do (
63+
msbuild ${{ env.SOLUTION_FILE_PATH }} /m /p:Configuration=%%B,Platform=%%P,BuildMacros=${{ env.BUILD_MACROS }}
64+
)
65+
)
66+
67+
- name: Upload artifacts
68+
uses: actions/upload-artifact@v2
69+
if: ${{ github.event_name == 'push' }}
70+
with:
71+
name: VS2019
72+
path: ./*/*/examples/*.exe
73+
74+
- name: Display SHA-256
75+
if: ${{ github.event_name == 'push' }}
76+
run: sha256sum ./*/*/examples/*.exe
77+
78+
- name: Compress release-ready version of Zadig
79+
uses: crazy-max/ghaction-upx@v1
80+
if: startsWith(github.ref, 'refs/tags/')
81+
with:
82+
version: latest
83+
files: ./Win32/Release/examples/zadig.exe
84+
args: --lzma --best
85+
86+
- name: Rename release-ready version of Zadig
87+
if: startsWith(github.ref, 'refs/tags/')
88+
shell: cmd
89+
run: |
90+
for /f "tokens=3" %%i in ('findstr FileVersion examples\zadig.rc') do set "ver=%%i"
91+
set ver=%ver:"=%
92+
for /f "tokens=1,2 delims=." %%i in ("%ver%") do set "ZADIG_VERSION=%%i.%%j"
93+
copy Win32\Release\examples\zadig.exe zadig-%ZADIG_VERSION%.exe
94+
sha256sum zadig-*.exe
95+
96+
- name: Upload release-ready version of Zadig
97+
uses: actions/upload-artifact@v2
98+
if: startsWith(github.ref, 'refs/tags/')
99+
with:
100+
name: Zadig
101+
path: ./zadig-*.exe

deps/libwdi-1.4.1/AUTHORS

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
Copyright © 2010-2021 Pete Batard <[email protected]>
2+
Copyright © 2010-2011 Travis Robinson <[email protected]>
3+
4+
Other contributors:
5+
Alexander Sashnov
6+
Bob Paddock
7+
Fred Sundvik
8+
Georg Vienna
9+
Jacob Alexander
10+
JaggedJax
11+
Jasper van Bourgognie
12+
Jeorg Fischer
13+
Jerome-PS
14+
Joseph Marshall
15+
Karel Bilek
16+
Liam Staskawicz
17+
Louie Caulfield
18+
PhracturedBlue
19+
Ryan Pavlik
20+
Stanley Elliott
21+
Uri Lublin
22+
Vitali Lovich
23+
Xiaofan Chen

0 commit comments

Comments
 (0)