From ffac6ad6d0ee57030e5be513cfb77a385b46c13e Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:12:07 +0800 Subject: [PATCH 01/17] Using EWDK to build libusbK --- .github/workflows/builds_with_ewdk.yml | 82 ++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) create mode 100644 .github/workflows/builds_with_ewdk.yml diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml new file mode 100644 index 0000000..ed8ace1 --- /dev/null +++ b/.github/workflows/builds_with_ewdk.yml @@ -0,0 +1,82 @@ +name: libusbK builds with EWDK + +on: [push, pull_request] + +jobs: + build-all: + name: Build All Targets (EWDK 26100) + runs-on: windows-2022 + + steps: + - name: Checkout Repository + uses: actions/checkout@v4 + + # Step 1: Download and cache the EWDK ISO to save bandwidth on future runs + - name: Cache EWDK ISO + id: cache-ewdk + uses: actions/cache@v4 + with: + path: C:\EWDK_ISO + key: ewdk-26100-v1 + + - name: Download EWDK ISO + if: steps.cache-ewdk.outputs.cache-hit != 'true' + shell: powershell + run: | + New-Item -ItemType Directory -Force -Path C:\EWDK_ISO + # Replace this URL with the official Microsoft EWDK 26100 direct download link + $Url = "https://go.microsoft.com/fwlink/?linkid=2271831" + Invoke-WebRequest -Uri $Url -OutFile "C:\EWDK_ISO\EWDK.iso" + + # Step 2: Mount the ISO to a virtual drive + - name: Mount EWDK ISO + id: mount-iso + shell: powershell + run: | + $MountDrive = (Mount-DiskImage -ImagePath "C:\EWDK_ISO\EWDK.iso" -PassThru | Get-Volume).DriveLetter + echo "EWDK_DRIVE=${MountDrive}:" >> $env:GITHUB_ENV + Write-Output "EWDK successfully mounted to ${MountDrive}:" + + # Step 3: Compile Libraries (x86, x64, ARM64) using the EWDK environment + - name: Build User-space Libraries + shell: cmd + run: | + :: Enter the EWDK environment and pass the build commands + call "%EWDK_DRIVE%\LaunchBuildEnv.cmd" && ( + + echo === Building x86 Library === + msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=Win32 /t:libusbK_dll;libusbK_static /m + + echo === Building x64 Library === + msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=x64 /t:libusbK_dll;libusbK_static /m + + echo === Building ARM64 Library === + msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /t:libusbK_dll;libusbK_static /m + ) + + # Step 4: Compile Drivers (x64, ARM64) using the EWDK environment + - name: Build Drivers + shell: cmd + run: | + call "%EWDK_DRIVE%\LaunchBuildEnv.cmd" && ( + + echo === Building x64 Driver === + msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:DriverTargetPlatform="Universal" /t:libusbK_sys /m + + echo === Building ARM64 Driver === + msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:DriverTargetPlatform="Universal" /t:libusbK_sys /m + ) + + # Step 5: Clean up by unmounting the ISO image + - name: Dismount EWDK ISO + if: always() + shell: powershell + run: | + Dismount-DiskImage -ImagePath "C:\EWDK_ISO\EWDK.iso" + + # Step 6: Package Binaries + - name: Upload Artifacts + uses: actions/upload-artifact@v4 + with: + name: libusbK-EWDK-Output + path: **/Output/ From 52f6f7f20db77c9e78f8288d555279ff6a920312 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:14:24 +0800 Subject: [PATCH 02/17] Update artifact upload paths in workflow to fix syntax errro --- .github/workflows/builds_with_ewdk.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index ed8ace1..95a1ad5 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -79,4 +79,10 @@ jobs: uses: actions/upload-artifact@v4 with: name: libusbK-EWDK-Output - path: **/Output/ + path: | + **\Output\**\*.dll + **\Output\**\*.lib + **\Output\**\*.sys + **\Output\**\*.inf + **\Output\**\*.cat + if-no-files-found: error From 443e96caa825e3d6551e0154ccd573ddef76e722 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:17:39 +0800 Subject: [PATCH 03/17] Refactor EWDK ISO download and mounting steps --- .github/workflows/builds_with_ewdk.yml | 35 ++++++++++++++++++++------ 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 95a1ad5..5aa764b 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -11,7 +11,7 @@ jobs: - name: Checkout Repository uses: actions/checkout@v4 - # Step 1: Download and cache the EWDK ISO to save bandwidth on future runs + # Step 1: Download and cache the EWDK ISO - name: Cache EWDK ISO id: cache-ewdk uses: actions/cache@v4 @@ -19,23 +19,42 @@ jobs: path: C:\EWDK_ISO key: ewdk-26100-v1 - - name: Download EWDK ISO + - name: Download EWDK ISO via BITS if: steps.cache-ewdk.outputs.cache-hit != 'true' shell: powershell run: | New-Item -ItemType Directory -Force -Path C:\EWDK_ISO - # Replace this URL with the official Microsoft EWDK 26100 direct download link - $Url = "https://go.microsoft.com/fwlink/?linkid=2271831" - Invoke-WebRequest -Uri $Url -OutFile "C:\EWDK_ISO\EWDK.iso" + $Url = "https://go.microsoft.com/fwlink/?linkid=2271831" + + Write-Output "Starting high-reliability BITS download for EWDK ISO..." + Start-BitsTransfer -Source $Url -Destination "C:\EWDK_ISO\EWDK.iso" -Priority High + + # Quick sanity check: Ensure the file actually exists and isn't empty + $file = Get-Item "C:\EWDK_ISO\EWDK.iso" + Write-Output "Downloaded file size: (($file.Length / 1GB).ToString('F2')) GB" + if ($file.Length -lt 2GB) { + throw "Download payload seems too small or truncated. Aborting build." + } - # Step 2: Mount the ISO to a virtual drive + # Step 2: Mount the ISO safely, clearing any stale loops - name: Mount EWDK ISO id: mount-iso shell: powershell run: | - $MountDrive = (Mount-DiskImage -ImagePath "C:\EWDK_ISO\EWDK.iso" -PassThru | Get-Volume).DriveLetter + $IsoPath = "C:\EWDK_ISO\EWDK.iso" + + # Clean up any previously stuck or bad mount points first + Get-DiskImage -ImagePath $IsoPath | Dismount-DiskImage -ErrorAction SilentlyContinue + + Write-Output "Mounting clean ISO image..." + $MountDrive = (Mount-DiskImage -ImagePath $IsoPath -PassThru | Get-Volume).DriveLetter + + if (-not $MountDrive) { + throw "Failed to acquire a valid Virtual Drive Letter from the EWDK ISO image." + } + echo "EWDK_DRIVE=${MountDrive}:" >> $env:GITHUB_ENV - Write-Output "EWDK successfully mounted to ${MountDrive}:" + Write-Output "EWDK safely mapped to virtual volume ${MountDrive}:" # Step 3: Compile Libraries (x86, x64, ARM64) using the EWDK environment - name: Build User-space Libraries From eed60c478cfe1212b31f2681f2f7c6162f4142a2 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:19:34 +0800 Subject: [PATCH 04/17] Change EWDK ISO download method to use curl Updated the download method for EWDK ISO to use curl instead of BITS, including URL resolution and validation. --- .github/workflows/builds_with_ewdk.yml | 32 ++++++++++++++++++-------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 5aa764b..1a7668b 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -19,21 +19,33 @@ jobs: path: C:\EWDK_ISO key: ewdk-26100-v1 - - name: Download EWDK ISO via BITS + - name: Download EWDK ISO via Curl if: steps.cache-ewdk.outputs.cache-hit != 'true' shell: powershell run: | New-Item -ItemType Directory -Force -Path C:\EWDK_ISO - $Url = "https://go.microsoft.com/fwlink/?linkid=2271831" - Write-Output "Starting high-reliability BITS download for EWDK ISO..." - Start-BitsTransfer -Source $Url -Destination "C:\EWDK_ISO\EWDK.iso" -Priority High - - # Quick sanity check: Ensure the file actually exists and isn't empty + # 1. Resolve the fwlink redirect to get the true, direct Microsoft download URL + $ShortUrl = "https://go.microsoft.com/fwlink/?linkid=2271831" + Write-Output "Resolving Microsoft shortlink..." + $Request = [System.Net.WebRequest]::Create($ShortUrl) + $Request.Method = "HEAD" + $Response = $Request.GetResponse() + $DirectUrl = $Response.ResponseUri.AbsoluteUri + $Response.Close() + Write-Output "Resolved target address: $DirectUrl" + + # 2. Stream the true large payload directly down using curl.exe + Write-Output "Streaming multi-gigabyte ISO payload via native curl..." + curl.exe -L -o "C:\EWDK_ISO\EWDK.iso" "$DirectUrl" + + # 3. Sanity check validation $file = Get-Item "C:\EWDK_ISO\EWDK.iso" - Write-Output "Downloaded file size: (($file.Length / 1GB).ToString('F2')) GB" + $sizeGB = ($file.Length / 1GB).ToString("F2") + Write-Output "Downloaded clean image file size: $sizeGB GB" + if ($file.Length -lt 2GB) { - throw "Download payload seems too small or truncated. Aborting build." + throw "Download payload size error ($sizeGB GB). The target package was truncated or blocked." } # Step 2: Mount the ISO safely, clearing any stale loops @@ -43,10 +55,10 @@ jobs: run: | $IsoPath = "C:\EWDK_ISO\EWDK.iso" - # Clean up any previously stuck or bad mount points first + # Clean up any leftover mounts from interrupted runs Get-DiskImage -ImagePath $IsoPath | Dismount-DiskImage -ErrorAction SilentlyContinue - Write-Output "Mounting clean ISO image..." + Write-Output "Mounting validated EWDK environment image..." $MountDrive = (Mount-DiskImage -ImagePath $IsoPath -PassThru | Get-Volume).DriveLetter if (-not $MountDrive) { From 0aab1dcf03b113dba8a6d2d9d077a598da9a00fd Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:23:35 +0800 Subject: [PATCH 05/17] Using nuget WDK --- .github/workflows/builds_with_ewdk.yml | 145 ++++++++++--------------- 1 file changed, 55 insertions(+), 90 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 1a7668b..0fd12e4 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -3,117 +3,82 @@ name: libusbK builds with EWDK on: [push, pull_request] jobs: - build-all: - name: Build All Targets (EWDK 26100) + build-project: + name: Build Targets (Windows 11 / 24H2+) runs-on: windows-2022 - + steps: - name: Checkout Repository uses: actions/checkout@v4 - # Step 1: Download and cache the EWDK ISO - - name: Cache EWDK ISO - id: cache-ewdk - uses: actions/cache@v4 + - name: Setup MSBuild Configuration + uses: microsoft/setup-msbuild@v2 with: - path: C:\EWDK_ISO - key: ewdk-26100-v1 + vs-version: '[17.0,18.0)' # Targets Visual Studio 2022 Build Env + + - name: Setup NuGet Environment + uses: NuGet/setup-nuget@v2 - - name: Download EWDK ISO via Curl - if: steps.cache-ewdk.outputs.cache-hit != 'true' + # Injects structural MSBuild hooks directly where the solution file lives + - name: Configure WDK Build Intercepts shell: powershell run: | - New-Item -ItemType Directory -Force -Path C:\EWDK_ISO - - # 1. Resolve the fwlink redirect to get the true, direct Microsoft download URL - $ShortUrl = "https://go.microsoft.com/fwlink/?linkid=2271831" - Write-Output "Resolving Microsoft shortlink..." - $Request = [System.Net.WebRequest]::Create($ShortUrl) - $Request.Method = "HEAD" - $Response = $Request.GetResponse() - $DirectUrl = $Response.ResponseUri.AbsoluteUri - $Response.Close() - Write-Output "Resolved target address: $DirectUrl" - - # 2. Stream the true large payload directly down using curl.exe - Write-Output "Streaming multi-gigabyte ISO payload via native curl..." - curl.exe -L -o "C:\EWDK_ISO\EWDK.iso" "$DirectUrl" - - # 3. Sanity check validation - $file = Get-Item "C:\EWDK_ISO\EWDK.iso" - $sizeGB = ($file.Length / 1GB).ToString("F2") - Write-Output "Downloaded clean image file size: $sizeGB GB" - - if ($file.Length -lt 2GB) { - throw "Download payload size error ($sizeGB GB). The target package was truncated or blocked." - } + $PropsContent = @" + + + Windows10 + 10.0.26100.0 + 10.0.26100.0 + true + + + "@ + # Placed cleanly inside the libusbK subdirectory next to the .sln + $PropsContent | Out-File -FilePath "libusbK\Directory.Build.props" -Encoding utf8 + Write-Output "Injected custom build intercepts configuration profile successfully." - # Step 2: Mount the ISO safely, clearing any stale loops - - name: Mount EWDK ISO - id: mount-iso + # Install WDK targets directly into the libusbK subdirectory + - name: Restore WDK Packages & Build Elements shell: powershell + working-directory: libusbK run: | - $IsoPath = "C:\EWDK_ISO\EWDK.iso" - - # Clean up any leftover mounts from interrupted runs - Get-DiskImage -ImagePath $IsoPath | Dismount-DiskImage -ErrorAction SilentlyContinue - - Write-Output "Mounting validated EWDK environment image..." - $MountDrive = (Mount-DiskImage -ImagePath $IsoPath -PassThru | Get-Volume).DriveLetter - - if (-not $MountDrive) { - throw "Failed to acquire a valid Virtual Drive Letter from the EWDK ISO image." - } - - echo "EWDK_DRIVE=${MountDrive}:" >> $env:GITHUB_ENV - Write-Output "EWDK safely mapped to virtual volume ${MountDrive}:" + nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2451 -OutputDirectory packages + nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2451 -OutputDirectory packages - # Step 3: Compile Libraries (x86, x64, ARM64) using the EWDK environment - - name: Build User-space Libraries + # Build User-space Libraries (x86, x64, ARM64) + - name: Build User Libraries shell: cmd + working-directory: libusbK run: | - :: Enter the EWDK environment and pass the build commands - call "%EWDK_DRIVE%\LaunchBuildEnv.cmd" && ( - - echo === Building x86 Library === - msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=Win32 /t:libusbK_dll;libusbK_static /m - - echo === Building x64 Library === - msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=x64 /t:libusbK_dll;libusbK_static /m - - echo === Building ARM64 Library === - msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /t:libusbK_dll;libusbK_static /m - ) + echo === Building x86 (Win32) User Space Libs === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=Win32 /t:libusbK_dll;libusbK_static /m - # Step 4: Compile Drivers (x64, ARM64) using the EWDK environment - - name: Build Drivers + echo === Building x64 User Space Libs === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /t:libusbK_dll;libusbK_static /m + + echo === Building ARM64 User Space Libs === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /t:libusbK_dll;libusbK_static /m + + # Build Kernel Drivers (x64, ARM64 Only) + - name: Build Kernel Drivers shell: cmd + working-directory: libusbK run: | - call "%EWDK_DRIVE%\LaunchBuildEnv.cmd" && ( - - echo === Building x64 Driver === - msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:DriverTargetPlatform="Universal" /t:libusbK_sys /m - - echo === Building ARM64 Driver === - msbuild ./libusbK/libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:DriverTargetPlatform="Universal" /t:libusbK_sys /m - ) + echo === Building x64 Driver (.sys) === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m - # Step 5: Clean up by unmounting the ISO image - - name: Dismount EWDK ISO - if: always() - shell: powershell - run: | - Dismount-DiskImage -ImagePath "C:\EWDK_ISO\EWDK.iso" + echo === Building ARM64 Driver (.sys) === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m - # Step 6: Package Binaries - - name: Upload Artifacts + # Securely Export Build Output Binaries + - name: Collect and Upload Artifacts uses: actions/upload-artifact@v4 with: - name: libusbK-EWDK-Output + name: libusbK-WDK26100-Output path: | - **\Output\**\*.dll - **\Output\**\*.lib - **\Output\**\*.sys - **\Output\**\*.inf - **\Output\**\*.cat + libusbK\**\Output\**\*.dll + libusbK\**\Output\**\*.lib + libusbK\**\Output\**\*.sys + libusbK\**\Output\**\*.inf + libusbK\**\Output\**\*.cat if-no-files-found: error From 037ad0f3f653c88c245ee55813cad76d982d63de Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:27:40 +0800 Subject: [PATCH 06/17] Update WDK and SDK package versions in workflow --- .github/workflows/builds_with_ewdk.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 0fd12e4..6d0ac9d 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -42,8 +42,8 @@ jobs: shell: powershell working-directory: libusbK run: | - nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2451 -OutputDirectory packages - nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2451 -OutputDirectory packages + nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2454 -OutputDirectory packages + nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2454 -OutputDirectory packages # Build User-space Libraries (x86, x64, ARM64) - name: Build User Libraries From 60ba287122686a47e8da8f95a10d6d607fb7d58f Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:40:01 +0800 Subject: [PATCH 07/17] Update build script for user-space and kernel drivers --- .github/workflows/builds_with_ewdk.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 6d0ac9d..dc1d570 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -45,19 +45,18 @@ jobs: nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2454 -OutputDirectory packages nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2454 -OutputDirectory packages - # Build User-space Libraries (x86, x64, ARM64) - name: Build User Libraries shell: cmd working-directory: libusbK run: | - echo === Building x86 (Win32) User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=Win32 /t:libusbK_dll;libusbK_static /m + echo === Building x86 User Space Libs === + msbuild libusbK.sln /p:Configuration=Release /p:Platform=x86 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m echo === Building x64 User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /t:libusbK_dll;libusbK_static /m + msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m echo === Building ARM64 User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /t:libusbK_dll;libusbK_static /m + msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m # Build Kernel Drivers (x64, ARM64 Only) - name: Build Kernel Drivers @@ -65,10 +64,10 @@ jobs: working-directory: libusbK run: | echo === Building x64 Driver (.sys) === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m + msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m echo === Building ARM64 Driver (.sys) === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m + msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m # Securely Export Build Output Binaries - name: Collect and Upload Artifacts From 8dd983d855db25ebdea6dcd87b579d8c6e52f111 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:45:28 +0800 Subject: [PATCH 08/17] Refactor WDK build process to use vcxproj files --- .github/workflows/builds_with_ewdk.yml | 30 ++++++-------------------- 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index dc1d570..f28235a 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -19,25 +19,7 @@ jobs: - name: Setup NuGet Environment uses: NuGet/setup-nuget@v2 - # Injects structural MSBuild hooks directly where the solution file lives - - name: Configure WDK Build Intercepts - shell: powershell - run: | - $PropsContent = @" - - - Windows10 - 10.0.26100.0 - 10.0.26100.0 - true - - - "@ - # Placed cleanly inside the libusbK subdirectory next to the .sln - $PropsContent | Out-File -FilePath "libusbK\Directory.Build.props" -Encoding utf8 - Write-Output "Injected custom build intercepts configuration profile successfully." - - # Install WDK targets directly into the libusbK subdirectory + # Install exact WDK targets directly into the libusbK subdirectory - name: Restore WDK Packages & Build Elements shell: powershell working-directory: libusbK @@ -50,13 +32,13 @@ jobs: working-directory: libusbK run: | echo === Building x86 User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=x86 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=Win32 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m echo === Building x64 User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m echo === Building ARM64 User Space Libs === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /t:libusbK_dll;libusbK_static /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m # Build Kernel Drivers (x64, ARM64 Only) - name: Build Kernel Drivers @@ -64,10 +46,10 @@ jobs: working-directory: libusbK run: | echo === Building x64 Driver (.sys) === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /m echo === Building ARM64 Driver (.sys) === - msbuild libusbK.sln /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /t:libusbK_sys /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /m # Securely Export Build Output Binaries - name: Collect and Upload Artifacts From 986a6f621ddc68bf2505cb9de98f74ddae161c77 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:50:57 +0800 Subject: [PATCH 09/17] Update build process for kernel drivers Modified build commands for kernel drivers to disable API validation and inf verification. --- .github/workflows/builds_with_ewdk.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index f28235a..e42a6b2 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -41,15 +41,16 @@ jobs: msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m # Build Kernel Drivers (x64, ARM64 Only) + # Added structural bypasses for InfVerif and ApiValidator - name: Build Kernel Drivers shell: cmd working-directory: libusbK run: | echo === Building x64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerifCurrentPlatform=false /m echo === Building ARM64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Windows Driver" /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerifCurrentPlatform=false /m # Securely Export Build Output Binaries - name: Collect and Upload Artifacts From 970fbd557fab8ac87bbfc55dc5a9b8e707522aa5 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 20:59:12 +0800 Subject: [PATCH 10/17] Modify driver build process Updated build commands to disable InfVerif and ApiValidator checks --- .github/workflows/builds_with_ewdk.yml | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index e42a6b2..2d7515c 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -41,26 +41,26 @@ jobs: msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m # Build Kernel Drivers (x64, ARM64 Only) - # Added structural bypasses for InfVerif and ApiValidator - name: Build Kernel Drivers shell: cmd working-directory: libusbK run: | echo === Building x64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerifCurrentPlatform=false /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m echo === Building ARM64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerifCurrentPlatform=false /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m # Securely Export Build Output Binaries + # Widened the pattern matches globally to catch libusbK's output location mapping natively - name: Collect and Upload Artifacts uses: actions/upload-artifact@v4 with: name: libusbK-WDK26100-Output path: | - libusbK\**\Output\**\*.dll - libusbK\**\Output\**\*.lib - libusbK\**\Output\**\*.sys - libusbK\**\Output\**\*.inf - libusbK\**\Output\**\*.cat + libusbK\**\*.dll + libusbK\**\*.lib + libusbK\**\*.sys + libusbK\**\*.inf + libusbK\**\*.cat if-no-files-found: error From 6703d5fb315e172ea156cbc1a8667c25d924bf31 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:16:39 +0800 Subject: [PATCH 11/17] Refactor GitHub Actions workflow for multi-platform builds --- .github/workflows/builds_with_ewdk.yml | 54 +++++++++++++------------- 1 file changed, 26 insertions(+), 28 deletions(-) diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml index 2d7515c..72d3724 100644 --- a/.github/workflows/builds_with_ewdk.yml +++ b/.github/workflows/builds_with_ewdk.yml @@ -4,20 +4,25 @@ on: [push, pull_request] jobs: build-project: - name: Build Targets (Windows 11 / 24H2+) - runs-on: windows-2022 + name: Build (${{ matrix.os }} - ${{ matrix.platform }}) + strategy: + fail-fast: false + matrix: + os: [ "windows-2022", "windows-2025" ] + platform: [ "Win32", "x64", "ARM64" ] + + runs-on: ${{ matrix.os }} steps: - name: Checkout Repository - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: Setup MSBuild Configuration - uses: microsoft/setup-msbuild@v2 - with: - vs-version: '[17.0,18.0)' # Targets Visual Studio 2022 Build Env + uses: microsoft/setup-msbuild@v3 + # Note: We keep NuGet setup at v3 as it is the current release for this ecosystem action - name: Setup NuGet Environment - uses: NuGet/setup-nuget@v2 + uses: NuGet/setup-nuget@v3 # Install exact WDK targets directly into the libusbK subdirectory - name: Restore WDK Packages & Build Elements @@ -27,40 +32,33 @@ jobs: nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2454 -OutputDirectory packages nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2454 -OutputDirectory packages + # Build User-space Libraries (x86, x64, ARM64) - name: Build User Libraries shell: cmd working-directory: libusbK run: | - echo === Building x86 User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=Win32 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m - - echo === Building x64 User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m - - echo === Building ARM64 User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m + echo === Building User Space Libs === + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m # Build Kernel Drivers (x64, ARM64 Only) + # Condition skips driver compilation safely when the matrix selects Win32 (x86) - name: Build Kernel Drivers + if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | - echo === Building x64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=x64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m - - echo === Building ARM64 Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=ARM64 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m + echo === Building Driver (.sys) === + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m # Securely Export Build Output Binaries - # Widened the pattern matches globally to catch libusbK's output location mapping natively - name: Collect and Upload Artifacts - uses: actions/upload-artifact@v4 + uses: actions/upload-artifact@v7 with: - name: libusbK-WDK26100-Output + name: libusbK-${{ matrix.os }}-${{ matrix.platform }}-Output path: | - libusbK\**\*.dll - libusbK\**\*.lib - libusbK\**\*.sys - libusbK\**\*.inf - libusbK\**\*.cat + libusbK/**/*.dll + libusbK/**/*.lib + libusbK/**/*.sys + libusbK/**/*.inf + libusbK/**/*.cat if-no-files-found: error From 2413de6fdaa8f6d090d3edf705368e0984bebbab Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:25:32 +0800 Subject: [PATCH 12/17] Update build workflow for WDK versions and matrix --- .github/workflows/builds.yml | 91 ++++++++++++++++++++++++++ .github/workflows/builds_with_ewdk.yml | 64 ------------------ 2 files changed, 91 insertions(+), 64 deletions(-) create mode 100644 .github/workflows/builds.yml delete mode 100644 .github/workflows/builds_with_ewdk.yml diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml new file mode 100644 index 0000000..9676817 --- /dev/null +++ b/.github/workflows/builds.yml @@ -0,0 +1,91 @@ +name: libusbK builds with nuget WDK + +on: [push, pull_request] + +jobs: + build-project: + name: Build (${{ matrix.os }} - ${{ matrix.platform }}) + strategy: + fail-fast: false + matrix: + # Define OS/Platform variations alongside explicit WDK/SDK matching versions + include: + # --- Windows Server 2022 Matrix Configurations --- + - os: "windows-2022" + platform: "Win32" + wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" + - os: "windows-2022" + platform: "x64" + wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" + - os: "windows-2022" + platform: "ARM64" + wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" + + # --- Windows Server 2025 Matrix Configurations --- + - os: "windows-2025" + platform: "Win32" + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" + - os: "windows-2025" + platform: "x64" + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" + - os: "windows-2025" + platform: "ARM64" + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" + + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + + - name: Setup MSBuild Configuration + uses: microsoft/setup-msbuild@v3 + + - name: Setup NuGet Environment + uses: NuGet/setup-nuget@v3 + + # Restores the modern 28000-series toolkits on Win2025 and 26100-series on Win2022 + - name: Restore WDK Packages & Build Elements + shell: powershell + working-directory: libusbK + run: | + nuget install Microsoft.Windows.WDK.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages + nuget install Microsoft.Windows.SDK.CPP.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages + + # Build User-space Libraries (x86, x64, ARM64) + - name: Build User Libraries + shell: cmd + working-directory: libusbK + run: | + echo === Building User Space Libs === + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /m + + # Build Kernel Drivers (x64, ARM64 Only) + # Native macro mapping allows clean builds without needing folder overrides + - name: Build Kernel Drivers + if: matrix.platform != 'Win32' + shell: cmd + working-directory: libusbK + run: | + echo === Building Driver (.sys) === + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m + + # Securely Export Build Output Binaries + # Formatted name mapping prevents artifacts from overwriting each other in the matrix split + - name: Collect and Upload Artifacts + uses: actions/upload-artifact@v7 + with: + name: libusbK-${{ matrix.os }}-${{ matrix.platform }}-Output + path: | + libusbK/**/*.dll + libusbK/**/*.lib + libusbK/**/*.sys + libusbK/**/*.inf + libusbK/**/*.cat + if-no-files-found: error diff --git a/.github/workflows/builds_with_ewdk.yml b/.github/workflows/builds_with_ewdk.yml deleted file mode 100644 index 72d3724..0000000 --- a/.github/workflows/builds_with_ewdk.yml +++ /dev/null @@ -1,64 +0,0 @@ -name: libusbK builds with EWDK - -on: [push, pull_request] - -jobs: - build-project: - name: Build (${{ matrix.os }} - ${{ matrix.platform }}) - strategy: - fail-fast: false - matrix: - os: [ "windows-2022", "windows-2025" ] - platform: [ "Win32", "x64", "ARM64" ] - - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout Repository - uses: actions/checkout@v6 - - - name: Setup MSBuild Configuration - uses: microsoft/setup-msbuild@v3 - - # Note: We keep NuGet setup at v3 as it is the current release for this ecosystem action - - name: Setup NuGet Environment - uses: NuGet/setup-nuget@v3 - - # Install exact WDK targets directly into the libusbK subdirectory - - name: Restore WDK Packages & Build Elements - shell: powershell - working-directory: libusbK - run: | - nuget install Microsoft.Windows.WDK.x64 -Version 10.0.26100.2454 -OutputDirectory packages - nuget install Microsoft.Windows.SDK.CPP.x64 -Version 10.0.26100.2454 -OutputDirectory packages - - # Build User-space Libraries (x86, x64, ARM64) - - name: Build User Libraries - shell: cmd - working-directory: libusbK - run: | - echo === Building User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /m - - # Build Kernel Drivers (x64, ARM64 Only) - # Condition skips driver compilation safely when the matrix selects Win32 (x86) - - name: Build Kernel Drivers - if: matrix.platform != 'Win32' - shell: cmd - working-directory: libusbK - run: | - echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m - - # Securely Export Build Output Binaries - - name: Collect and Upload Artifacts - uses: actions/upload-artifact@v7 - with: - name: libusbK-${{ matrix.os }}-${{ matrix.platform }}-Output - path: | - libusbK/**/*.dll - libusbK/**/*.lib - libusbK/**/*.sys - libusbK/**/*.inf - libusbK/**/*.cat - if-no-files-found: error From e0ccf417e8e867fb8ae04317fde256cbd941f9b3 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:30:45 +0800 Subject: [PATCH 13/17] Refactor WDK versioning and target settings in builds.yml Updated WDK versions and target platform settings for Windows Server 2022 and 2025 configurations in the build workflow. --- .github/workflows/builds.yml | 44 ++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 17 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 9676817..fbef0f6 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -8,35 +8,28 @@ jobs: strategy: fail-fast: false matrix: - # Define OS/Platform variations alongside explicit WDK/SDK matching versions include: - # --- Windows Server 2022 Matrix Configurations --- + # --- Windows Server 2022 Configurations --- - os: "windows-2022" platform: "Win32" wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - os: "windows-2022" platform: "x64" wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - os: "windows-2022" platform: "ARM64" wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - # --- Windows Server 2025 Matrix Configurations --- + # --- Windows Server 2025 Configurations --- - os: "windows-2025" platform: "Win32" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" + wdk_version: "10.0.26100.2454" # Synced to 26100 to match VS2022 IDE host engine - os: "windows-2025" platform: "x64" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" + wdk_version: "10.0.26100.2454" - os: "windows-2025" platform: "ARM64" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" + wdk_version: "10.0.26100.2454" runs-on: ${{ matrix.os }} @@ -50,7 +43,7 @@ jobs: - name: Setup NuGet Environment uses: NuGet/setup-nuget@v3 - # Restores the modern 28000-series toolkits on Win2025 and 26100-series on Win2022 + # Restores exact WDK elements into the local working directory path - name: Restore WDK Packages & Build Elements shell: powershell working-directory: libusbK @@ -59,25 +52,42 @@ jobs: nuget install Microsoft.Windows.SDK.CPP.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages # Build User-space Libraries (x86, x64, ARM64) + # Added TargetUniversalCRTVersion override to completely bypass local C:\ SDK discovery checks - name: Build User Libraries shell: cmd working-directory: libusbK run: | echo === Building User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /m + msbuild src\lib\libusbK_lib.vcxproj ^ + /p:Configuration=Release ^ + /p:Platform=${{ matrix.platform }} ^ + /p:TargetVersion="Windows10" ^ + /p:TargetPlatformVersion="10.0.26100.0" ^ + /p:TargetUniversalCRTVersion="10.0.26100.0" ^ + /m # Build Kernel Drivers (x64, ARM64 Only) - # Native macro mapping allows clean builds without needing folder overrides + # Combines full path routing variables so both runner images successfully find ntddk.h - name: Build Kernel Drivers if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m + msbuild src\sys\libusbK_sys.vcxproj ^ + /p:Configuration=Release ^ + /p:Platform=${{ matrix.platform }} ^ + /p:TargetVersion="Windows10" ^ + /p:TargetPlatformVersion="10.0.26100.0" ^ + /p:TargetUniversalCRTVersion="10.0.26100.0" ^ + /p:DriverTargetPlatform="Desktop" ^ + /p:ApiValidatorAnalyze=false ^ + /p:InfVerif=false ^ + /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" ^ + /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\" ^ + /m # Securely Export Build Output Binaries - # Formatted name mapping prevents artifacts from overwriting each other in the matrix split - name: Collect and Upload Artifacts uses: actions/upload-artifact@v7 with: From 8aede6c716e6696a405838d9759d2e7c6358b435 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:35:52 +0800 Subject: [PATCH 14/17] Update WDK versions and build configurations --- .github/workflows/builds.yml | 43 +++++++++++++----------------------- 1 file changed, 15 insertions(+), 28 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index fbef0f6..30dec68 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -9,27 +9,33 @@ jobs: fail-fast: false matrix: include: - # --- Windows Server 2022 Configurations --- + # --- Windows Server 2022 (VS2022 / WDK 26100 Ecosystem) --- - os: "windows-2022" platform: "Win32" wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" - os: "windows-2022" platform: "x64" wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" - os: "windows-2022" platform: "ARM64" wdk_version: "10.0.26100.2454" + target_version: "10.0.26100.0" - # --- Windows Server 2025 Configurations --- + # --- Windows Server 2025 (VS2026 / WDK 28000 Ecosystem) --- - os: "windows-2025" platform: "Win32" - wdk_version: "10.0.26100.2454" # Synced to 26100 to match VS2022 IDE host engine + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" - os: "windows-2025" platform: "x64" - wdk_version: "10.0.26100.2454" + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" - os: "windows-2025" platform: "ARM64" - wdk_version: "10.0.26100.2454" + wdk_version: "10.0.28000.1839" + target_version: "10.0.28000.0" runs-on: ${{ matrix.os }} @@ -43,7 +49,6 @@ jobs: - name: Setup NuGet Environment uses: NuGet/setup-nuget@v3 - # Restores exact WDK elements into the local working directory path - name: Restore WDK Packages & Build Elements shell: powershell working-directory: libusbK @@ -51,41 +56,23 @@ jobs: nuget install Microsoft.Windows.WDK.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages nuget install Microsoft.Windows.SDK.CPP.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages - # Build User-space Libraries (x86, x64, ARM64) - # Added TargetUniversalCRTVersion override to completely bypass local C:\ SDK discovery checks + # Build User-space Libraries - name: Build User Libraries shell: cmd working-directory: libusbK run: | echo === Building User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj ^ - /p:Configuration=Release ^ - /p:Platform=${{ matrix.platform }} ^ - /p:TargetVersion="Windows10" ^ - /p:TargetPlatformVersion="10.0.26100.0" ^ - /p:TargetUniversalCRTVersion="10.0.26100.0" ^ - /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsSDK_ExecutablePath_x64="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\tools\bin\x64" /m # Build Kernel Drivers (x64, ARM64 Only) - # Combines full path routing variables so both runner images successfully find ntddk.h + # Removed the trailing backslash from WdkContentRoot to fix the MSB4102 path escape crash - name: Build Kernel Drivers if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj ^ - /p:Configuration=Release ^ - /p:Platform=${{ matrix.platform }} ^ - /p:TargetVersion="Windows10" ^ - /p:TargetPlatformVersion="10.0.26100.0" ^ - /p:TargetUniversalCRTVersion="10.0.26100.0" ^ - /p:DriverTargetPlatform="Desktop" ^ - /p:ApiValidatorAnalyze=false ^ - /p:InfVerif=false ^ - /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" ^ - /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\" ^ - /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}" /m # Securely Export Build Output Binaries - name: Collect and Upload Artifacts From 5bdf59d93e7bd8064b4b0763f201b2ae3e9ea797 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:44:01 +0800 Subject: [PATCH 15/17] Update Windows build configurations and scripts --- .github/workflows/builds.yml | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 30dec68..6e568c8 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -9,7 +9,7 @@ jobs: fail-fast: false matrix: include: - # --- Windows Server 2022 (VS2022 / WDK 26100 Ecosystem) --- + # --- Windows Server 2022 (VS2022 Baseline) --- - os: "windows-2022" platform: "Win32" wdk_version: "10.0.26100.2454" @@ -23,20 +23,6 @@ jobs: wdk_version: "10.0.26100.2454" target_version: "10.0.26100.0" - # --- Windows Server 2025 (VS2026 / WDK 28000 Ecosystem) --- - - os: "windows-2025" - platform: "Win32" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" - - os: "windows-2025" - platform: "x64" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" - - os: "windows-2025" - platform: "ARM64" - wdk_version: "10.0.28000.1839" - target_version: "10.0.28000.0" - runs-on: ${{ matrix.os }} steps: @@ -57,22 +43,22 @@ jobs: nuget install Microsoft.Windows.SDK.CPP.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages # Build User-space Libraries + # Overrode WindowsTargetPlatformVersion & WindowsSDKVersion to force MSBuild to skip local disk checks - name: Build User Libraries shell: cmd working-directory: libusbK run: | echo === Building User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsSDK_ExecutablePath_x64="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\tools\bin\x64" /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsTargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsSDKVersion="${{ matrix.target_version }}\" /m # Build Kernel Drivers (x64, ARM64 Only) - # Removed the trailing backslash from WdkContentRoot to fix the MSB4102 path escape crash - name: Build Kernel Drivers if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}" /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:PlatformToolset=v143 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" /m # Securely Export Build Output Binaries - name: Collect and Upload Artifacts From 0b118aaac648a30d4a4a9ccc33763eb0375afa03 Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:47:39 +0800 Subject: [PATCH 16/17] Refactor GitHub Actions build workflow for Windows --- .github/workflows/builds.yml | 38 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 6e568c8..47ccbc0 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -4,26 +4,12 @@ on: [push, pull_request] jobs: build-project: - name: Build (${{ matrix.os }} - ${{ matrix.platform }}) + name: Build (${{ matrix.platform }}) + runs-on: windows-2022 strategy: fail-fast: false matrix: - include: - # --- Windows Server 2022 (VS2022 Baseline) --- - - os: "windows-2022" - platform: "Win32" - wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - - os: "windows-2022" - platform: "x64" - wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - - os: "windows-2022" - platform: "ARM64" - wdk_version: "10.0.26100.2454" - target_version: "10.0.26100.0" - - runs-on: ${{ matrix.os }} + platform: ["Win32", "x64", "ARM64"] steps: - name: Checkout Repository @@ -35,36 +21,36 @@ jobs: - name: Setup NuGet Environment uses: NuGet/setup-nuget@v3 - - name: Restore WDK Packages & Build Elements + # Pulls down the driver compilation environment directly into the workspace + - name: Restore WDK Packages shell: powershell working-directory: libusbK run: | - nuget install Microsoft.Windows.WDK.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages - nuget install Microsoft.Windows.SDK.CPP.x64 -Version "${{ matrix.wdk_version }}" -OutputDirectory packages + nuget install Microsoft.Windows.WDK.x64 -Version "10.0.26100.2454" -OutputDirectory packages - # Build User-space Libraries - # Overrode WindowsTargetPlatformVersion & WindowsSDKVersion to force MSBuild to skip local disk checks + # Build User-space Libraries (x86, x64, ARM64) - name: Build User Libraries shell: cmd working-directory: libusbK run: | echo === Building User Space Libs === - msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsTargetPlatformVersion="${{ matrix.target_version }}" /p:WindowsSDKVersion="${{ matrix.target_version }}\" /m + msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /m # Build Kernel Drivers (x64, ARM64 Only) + # We explicitly hook the NuGet-restored WDK content path using fixed quotes to prevent command line parsing crashes - name: Build Kernel Drivers if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:PlatformToolset=v143 /p:TargetVersion="Windows10" /p:TargetPlatformVersion="${{ matrix.target_version }}" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.${{ matrix.wdk_version }}\build\native\include" /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.10.0.26100.2454\build\native\include" /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.10.0.26100.2454" /m - # Securely Export Build Output Binaries + # Collect and Securely Export Output Binaries - name: Collect and Upload Artifacts uses: actions/upload-artifact@v7 with: - name: libusbK-${{ matrix.os }}-${{ matrix.platform }}-Output + name: libusbK-windows-2022-${{ matrix.platform }}-Output path: | libusbK/**/*.dll libusbK/**/*.lib From ee1f65b8ac74501ec88796bc0322379d2b82838d Mon Sep 17 00:00:00 2001 From: mcuee Date: Sun, 24 May 2026 21:51:38 +0800 Subject: [PATCH 17/17] Enhance WDK configuration and build steps in CI Added WDK configuration step and updated build process for user-space libraries and kernel drivers. --- .github/workflows/builds.yml | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/builds.yml b/.github/workflows/builds.yml index 47ccbc0..89fe326 100644 --- a/.github/workflows/builds.yml +++ b/.github/workflows/builds.yml @@ -28,7 +28,29 @@ jobs: run: | nuget install Microsoft.Windows.WDK.x64 -Version "10.0.26100.2454" -OutputDirectory packages + # Dynamically maps the restored NuGet WDK paths structurally into the compiler framework + - name: Configure WDK Include Intercepts + shell: powershell + run: | + $PropsContent = @" + + + Windows10 + 10.0.26100.0 + true + + + + `$(SolutionDir)packages\Microsoft.Windows.WDK.x64.10.0.26100.2454\build\native\include;`$(AdditionalIncludeDirectories) + + + + "@ + $PropsContent | Out-File -FilePath "libusbK\Directory.Build.props" -Encoding utf8 + Write-Output "Successfully generated structural Directory.Build.props file." + # Build User-space Libraries (x86, x64, ARM64) + # This step will inherently pick up the TargetPlatformVersion from the props file safely - name: Build User Libraries shell: cmd working-directory: libusbK @@ -37,14 +59,14 @@ jobs: msbuild src\lib\libusbK_lib.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /m # Build Kernel Drivers (x64, ARM64 Only) - # We explicitly hook the NuGet-restored WDK content path using fixed quotes to prevent command line parsing crashes + # The Directory.Build.props file guarantees 'ntddk.h' resolves natively inside the global workspace - name: Build Kernel Drivers if: matrix.platform != 'Win32' shell: cmd working-directory: libusbK run: | echo === Building Driver (.sys) === - msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:TargetVersion="Windows10" /p:TargetPlatformVersion="10.0.26100.0" /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /p:AdditionalIncludeDirectories="%CD%\packages\Microsoft.Windows.WDK.x64.10.0.26100.2454\build\native\include" /p:WdkContentRoot="%CD%\packages\Microsoft.Windows.WDK.x64.10.0.26100.2454" /m + msbuild src\sys\libusbK_sys.vcxproj /p:Configuration=Release /p:Platform=${{ matrix.platform }} /p:DriverTargetPlatform="Desktop" /p:ApiValidatorAnalyze=false /p:InfVerif=false /m # Collect and Securely Export Output Binaries - name: Collect and Upload Artifacts