From 36b1d1e64acb3c0690b23aca2b87b3317d70ad5b Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 2 Oct 2024 20:01:12 -0700 Subject: [PATCH 01/52] Initial commit: use nuget pkgs --- .github/workflows/{cargo-audit.yaml => cargo-audit.yaml.dnr} | 0 ...{code-formatting-check.yaml => code-formatting-check.yaml.dnr} | 0 .github/workflows/{codeql.yml => codeql.yml.dnr} | 0 .github/workflows/{docs.yaml => docs.yaml.dnr} | 0 ...b-dependency-review.yaml => github-dependency-review.yaml.dnr} | 0 .github/workflows/{lint.yaml => lint.yaml.dnr} | 0 ...elopment-makefile.yaml => local-development-makefile.yaml.dnr} | 0 .github/workflows/{test.yaml => test.yaml.dnr} | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cargo-audit.yaml => cargo-audit.yaml.dnr} (100%) rename .github/workflows/{code-formatting-check.yaml => code-formatting-check.yaml.dnr} (100%) rename .github/workflows/{codeql.yml => codeql.yml.dnr} (100%) rename .github/workflows/{docs.yaml => docs.yaml.dnr} (100%) rename .github/workflows/{github-dependency-review.yaml => github-dependency-review.yaml.dnr} (100%) rename .github/workflows/{lint.yaml => lint.yaml.dnr} (100%) rename .github/workflows/{local-development-makefile.yaml => local-development-makefile.yaml.dnr} (100%) rename .github/workflows/{test.yaml => test.yaml.dnr} (100%) diff --git a/.github/workflows/cargo-audit.yaml b/.github/workflows/cargo-audit.yaml.dnr similarity index 100% rename from .github/workflows/cargo-audit.yaml rename to .github/workflows/cargo-audit.yaml.dnr diff --git a/.github/workflows/code-formatting-check.yaml b/.github/workflows/code-formatting-check.yaml.dnr similarity index 100% rename from .github/workflows/code-formatting-check.yaml rename to .github/workflows/code-formatting-check.yaml.dnr diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml.dnr similarity index 100% rename from .github/workflows/codeql.yml rename to .github/workflows/codeql.yml.dnr diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml.dnr similarity index 100% rename from .github/workflows/docs.yaml rename to .github/workflows/docs.yaml.dnr diff --git a/.github/workflows/github-dependency-review.yaml b/.github/workflows/github-dependency-review.yaml.dnr similarity index 100% rename from .github/workflows/github-dependency-review.yaml rename to .github/workflows/github-dependency-review.yaml.dnr diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml.dnr similarity index 100% rename from .github/workflows/lint.yaml rename to .github/workflows/lint.yaml.dnr diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml.dnr similarity index 100% rename from .github/workflows/local-development-makefile.yaml rename to .github/workflows/local-development-makefile.yaml.dnr diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml.dnr similarity index 100% rename from .github/workflows/test.yaml rename to .github/workflows/test.yaml.dnr From 7e467f6f0d97593e1f618f58c842d3ee24663448 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 2 Oct 2024 20:03:35 -0700 Subject: [PATCH 02/52] Initial commit: use nuget pkgs From b64109608a0f148009b29f2d055baa039a98735a Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Tue, 8 Oct 2024 04:27:54 -0700 Subject: [PATCH 03/52] add NugetWDKContentRoot env variable detection to detect_wdk_content_root --- crates/wdk-build/src/cargo_make.rs | 2 ++ crates/wdk-build/src/utils.rs | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 070d7ca9..fd52ab76 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -516,6 +516,7 @@ pub fn setup_path() -> Result, ConfigError> { return Err(ConfigError::WdkContentRootDetectionError); }; let version = get_latest_windows_sdk_version(&wdk_content_root.join("Lib"))?; + let host_arch = CpuArchitecture::try_from_cargo_str(env::consts::ARCH) .expect("The rust standard library should always set env::consts::ARCH"); @@ -523,6 +524,7 @@ pub fn setup_path() -> Result, ConfigError> { .join(format!("bin/{version}")) .canonicalize()? .strip_extended_length_path_prefix()?; + let host_windows_sdk_ver_bin_path = match host_arch { CpuArchitecture::Amd64 => wdk_bin_root .join(host_arch.as_windows_str()) diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 3785ef17..5fdbfd26 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -87,6 +87,18 @@ where pub fn detect_wdk_content_root() -> Option { // If WDKContentRoot is present in environment(ex. running in an eWDK prompt), // use it + if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") { + let path = Path::new(wdk_content_root.as_str()); + if path.is_dir() { + println!("Using NugetWdkContentRoot: {}", path.display()); + return Some(path.to_path_buf()); + } + eprintln!( + "NugetWdkContentRoot was detected to be {}, but does not exist or is not a valid \ + directory.", + path.display() + ); + } if let Ok(wdk_content_root) = env::var("WDKContentRoot") { let path = Path::new(wdk_content_root.as_str()); if path.is_dir() { From d901e20d3f68184d60f441b20a8c4233aeb30922 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:22:40 -0700 Subject: [PATCH 04/52] Add steps to install Nuget, move signtool to WDK's bin dir and set NugetWDKContentRoot env variable --- .github/workflows/build.yaml | 41 +++++++++++++++++++ crates/wdk-build/src/cargo_make.rs | 17 ++++---- crates/wdk-build/src/utils.rs | 27 +++++------- .../crates/driver/src/lib.rs | 15 +------ 4 files changed, 62 insertions(+), 38 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3c916bf9..f25efe95 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,6 +20,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -45,6 +46,11 @@ jobs: uses: ./.github/actions/winget-install with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Install NuGet + run: | + Install-PackageProvider -Name NuGet -Force -Scope AllUsers + Get-PackageProvider -Name NuGet -ListAvailable - name: Install LLVM ${{ matrix.llvm }} run: | @@ -57,6 +63,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -65,6 +72,40 @@ jobs: Write-Host "Installing ${{ matrix.wdk }}..." Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + + - name: Install WDK using NuGet + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + nuget install Microsoft.Windows.WDK -Version latest -OutputDirectory C:\WDK + Write-Host "WDK installed at C:\WDK" + $folders = @( + "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" + ) + foreach ($folder in $folders) { + if (-Not (Test-Path $folder)) { + Write-Error "Required folder $folder is missing." + exit 1 + } + } + $signtoolX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" + $signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" + $destinationX64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" + $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + if (Test-Path $signtoolX64) { + Copy-Item -Path $signtoolX64 -Destination $destinationX64 -Force + Write-Host "Copied signtool.exe to $destinationX64" + } else { + Write-Error "signtool.exe not found at $signtoolX64" + } + if (Test-Path $signtoolX86) { + Copy-Item -Path $signtoolX86 -Destination $destinationX86 -Force + Write-Host "Copied signtool.exe to $destinationX86" + } else { + Write-Error "signtool.exe not found at $signtoolX86" + } + $env:NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 898e3dba..3413e297 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -26,13 +26,9 @@ use tracing::{instrument, trace}; use crate::{ metadata, utils::{ - detect_wdk_content_root, - get_latest_windows_sdk_version, - get_wdk_version_number, - PathExt, + detect_wdk_content_root, get_latest_windows_sdk_version, get_wdk_version_number, PathExt, }, - ConfigError, - CpuArchitecture, + ConfigError, CpuArchitecture, }; /// The filename of the main makefile for Rust Windows drivers. @@ -516,6 +512,7 @@ pub fn setup_path() -> Result, ConfigError> { let Some(wdk_content_root) = detect_wdk_content_root() else { return Err(ConfigError::WdkContentRootDetectionError); }; + let version = get_latest_windows_sdk_version(&wdk_content_root.join("Lib"))?; let host_arch = CpuArchitecture::try_from_cargo_str(env::consts::ARCH) @@ -523,8 +520,10 @@ pub fn setup_path() -> Result, ConfigError> { let wdk_bin_root = wdk_content_root .join(format!("bin/{version}")) - .canonicalize()? - .strip_extended_length_path_prefix()?; + .canonicalize() + .expect("Failed to canonicalize path") + .strip_extended_length_path_prefix() + .expect("Failed to strip extended length path prefix"); let host_windows_sdk_ver_bin_path = match host_arch { CpuArchitecture::Amd64 => wdk_bin_root @@ -573,6 +572,8 @@ pub fn setup_path() -> Result, ConfigError> { .expect("arch_specific_wdk_tool_root should only contain valid UTF8"), ); + println!("PATH_ENV_VAR={}", env::var(PATH_ENV_VAR).unwrap()); + Ok([PATH_ENV_VAR].map(std::string::ToString::to_string)) } diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 5fdbfd26..3d353068 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -14,13 +14,7 @@ use thiserror::Error; use windows::{ core::{s, PCSTR}, Win32::System::Registry::{ - RegCloseKey, - RegGetValueA, - RegOpenKeyExA, - HKEY, - HKEY_LOCAL_MACHINE, - KEY_READ, - RRF_RT_REG_SZ, + RegCloseKey, RegGetValueA, RegOpenKeyExA, HKEY, HKEY_LOCAL_MACHINE, KEY_READ, RRF_RT_REG_SZ, }, }; @@ -87,25 +81,28 @@ where pub fn detect_wdk_content_root() -> Option { // If WDKContentRoot is present in environment(ex. running in an eWDK prompt), // use it - if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") { + if let Ok(wdk_content_root) = env::var("WDKContentRoot") { let path = Path::new(wdk_content_root.as_str()); if path.is_dir() { - println!("Using NugetWdkContentRoot: {}", path.display()); return Some(path.to_path_buf()); } eprintln!( - "NugetWdkContentRoot was detected to be {}, but does not exist or is not a valid \ - directory.", + "WDKContentRoot was detected to be {}, but does not exist or is not a valid directory.", path.display() ); } - if let Ok(wdk_content_root) = env::var("WDKContentRoot") { + + // If NugetWdkContentRoot is present in environment, use it + if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") { let path = Path::new(wdk_content_root.as_str()); if path.is_dir() { + println!("Using NugetWdkContentRoot: {}", path.display()); + return Some(path.to_path_buf()); } eprintln!( - "WDKContentRoot was detected to be {}, but does not exist or is not a valid directory.", + "NugetWdkContentRoot was detected to be {}, but does not exist or is not a valid \ + directory.", path.display() ); } @@ -427,9 +424,7 @@ mod tests { mod read_registry_key_string_value { use windows::Win32::UI::Shell::{ - FOLDERID_ProgramFiles, - SHGetKnownFolderPath, - KF_FLAG_DEFAULT, + FOLDERID_ProgramFiles, SHGetKnownFolderPath, KF_FLAG_DEFAULT, }; use super::*; diff --git a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs index c7053e02..1a6b0475 100644 --- a/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs +++ b/tests/mixed-package-kmdf-workspace/crates/driver/src/lib.rs @@ -19,20 +19,7 @@ use wdk::println; #[cfg(not(test))] use wdk_alloc::WdkAllocator; use wdk_sys::{ - call_unsafe_wdf_function_binding, - ntddk::DbgPrint, - DRIVER_OBJECT, - NTSTATUS, - PCUNICODE_STRING, - ULONG, - UNICODE_STRING, - WCHAR, - WDFDEVICE, - WDFDEVICE_INIT, - WDFDRIVER, - WDF_DRIVER_CONFIG, - WDF_NO_HANDLE, - WDF_NO_OBJECT_ATTRIBUTES, + call_unsafe_wdf_function_binding, ntddk::DbgPrint, DRIVER_OBJECT, NTSTATUS, PCUNICODE_STRING, PDRIVER_OBJECT, ULONG, UNICODE_STRING, WCHAR, WDFDEVICE, WDFDEVICE_INIT, WDFDRIVER, WDF_DRIVER_CONFIG, WDF_NO_HANDLE, WDF_NO_OBJECT_ATTRIBUTES }; #[cfg(not(test))] From 3038dc2f7eab1c94e8372b91ec699c0077e9dc87 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:30:24 -0700 Subject: [PATCH 05/52] Add action to install Nuget --- .github/actions/nuget-install/action.yaml | 16 ++++++++++++++++ .github/workflows/build.yaml | 3 +++ 2 files changed, 19 insertions(+) create mode 100644 .github/actions/nuget-install/action.yaml diff --git a/.github/actions/nuget-install/action.yaml b/.github/actions/nuget-install/action.yaml new file mode 100644 index 00000000..af3b16ed --- /dev/null +++ b/.github/actions/nuget-install/action.yaml @@ -0,0 +1,16 @@ +name: 'Install NuGet' +description: 'Installs the PackageManagement module and NuGet provider' +runs: + using: 'composite' + steps: + - name: Install PackageManagement Module + run: | + Install-Module -Name PackageManagement -Force -Scope AllUsers + Import-Module PackageManagement + shell: pwsh + + - name: Install NuGet + run: | + Install-PackageProvider -Name NuGet -Force -Scope AllUsers + Get-PackageProvider -Name NuGet -ListAvailable + shell: pwsh \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f25efe95..9868ff80 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -47,6 +47,9 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Install NuGet + uses: ./.github/actions/install-nuget + - name: Install NuGet run: | Install-PackageProvider -Name NuGet -Force -Scope AllUsers From 40441add6b325e8a89b4747b20cd0d480ddb92df Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:43:07 -0700 Subject: [PATCH 06/52] Add action to install Nuget --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9868ff80..7751e767 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,7 +48,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: Install NuGet - uses: ./.github/actions/install-nuget + uses: ./.github/actions/nuget-install - name: Install NuGet run: | From 80996e128b46546244ba115bc60380bb538b1301 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:45:45 -0700 Subject: [PATCH 07/52] Add action to install Nuget --- .github/workflows/build.yaml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 7751e767..d1495301 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -49,11 +49,6 @@ jobs: - name: Install NuGet uses: ./.github/actions/nuget-install - - - name: Install NuGet - run: | - Install-PackageProvider -Name NuGet -Force -Scope AllUsers - Get-PackageProvider -Name NuGet -ListAvailable - name: Install LLVM ${{ matrix.llvm }} run: | From ffc24b3b0c43f31246e0cba7107d82f0a9db9271 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:51:00 -0700 Subject: [PATCH 08/52] Add action to install Nuget --- .github/actions/nuget-install/action.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/nuget-install/action.yaml b/.github/actions/nuget-install/action.yaml index af3b16ed..923ac7f9 100644 --- a/.github/actions/nuget-install/action.yaml +++ b/.github/actions/nuget-install/action.yaml @@ -9,8 +9,8 @@ runs: Import-Module PackageManagement shell: pwsh - - name: Install NuGet + - name: Install NuGet Provider run: | - Install-PackageProvider -Name NuGet -Force -Scope AllUsers - Get-PackageProvider -Name NuGet -ListAvailable + Install-Module -Name NuGet -Force -Scope AllUsers + Import-Module NuGet shell: pwsh \ No newline at end of file From e86b142be0d1760b4b64476935633bd256b9204a Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 06:56:52 -0700 Subject: [PATCH 09/52] Add action to install Nuget --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d1495301..a5009f08 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - Microsoft.Windows.WDK -Version 10.0.26100.1591 # Latest WDK llvm: - 17.0.6 @@ -71,10 +71,10 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } - - name: Install WDK using NuGet + - name: Install WDK ${{ matrix.wdk }} (NuGet) if: matrix.wdk == 'Microsoft.Windows.WDK' run: | - nuget install Microsoft.Windows.WDK -Version latest -OutputDirectory C:\WDK + nuget install ${{ matrix.wdk }} -OutputDirectory C:\WDK Write-Host "WDK installed at C:\WDK" $folders = @( "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", From 3922faf93b3a2a22d526eedae8c24749f80cc6e5 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 07:31:18 -0700 Subject: [PATCH 10/52] Fix condition to run Nuget installation --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a5009f08..66097e92 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -72,7 +72,7 @@ jobs: } - name: Install WDK ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: matrix.wdk == 'Microsoft.Windows.WDK -Version 10.0.26100.1591' run: | nuget install ${{ matrix.wdk }} -OutputDirectory C:\WDK Write-Host "WDK installed at C:\WDK" From 03f6633484fce85e950593fd4fb60a44dba21519 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 07:36:16 -0700 Subject: [PATCH 11/52] Fix WDK version in the matrix --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 66097e92..dd32bd91 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK -Version 10.0.26100.1591 # Latest WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -72,7 +72,7 @@ jobs: } - name: Install WDK ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK -Version 10.0.26100.1591' + if: matrix.wdk == 'Microsoft.Windows.WDK' run: | nuget install ${{ matrix.wdk }} -OutputDirectory C:\WDK Write-Host "WDK installed at C:\WDK" From 7343913a0c4936b85e9f88d4a060ecf0bf233984 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 07:49:29 -0700 Subject: [PATCH 12/52] Fix NuGet command --- .github/workflows/build.yaml | 5 +---- packages.config | 8 ++++++++ 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 packages.config diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index dd32bd91..38d8001d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -46,9 +46,6 @@ jobs: uses: ./.github/actions/winget-install with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Install NuGet - uses: ./.github/actions/nuget-install - name: Install LLVM ${{ matrix.llvm }} run: | @@ -74,7 +71,7 @@ jobs: - name: Install WDK ${{ matrix.wdk }} (NuGet) if: matrix.wdk == 'Microsoft.Windows.WDK' run: | - nuget install ${{ matrix.wdk }} -OutputDirectory C:\WDK + nuget restore .\packages.config -PackagesDirectory C:\WDK Write-Host "WDK installed at C:\WDK" $folders = @( "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", diff --git a/packages.config b/packages.config new file mode 100644 index 00000000..2a84a878 --- /dev/null +++ b/packages.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From 13fd747eb84aa063c8c3127a948ca16f9ebe68ac Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 08:01:57 -0700 Subject: [PATCH 13/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 38d8001d..297c9e73 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -100,7 +100,7 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } - $env:NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" + setx NugetWdkContentRoot "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From 9d1698d01d3cc0f99010b48f9c7c0c914214a0df Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 08:54:48 -0700 Subject: [PATCH 14/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 297c9e73..881bd7f8 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -100,7 +100,8 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } - setx NugetWdkContentRoot "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" + setx NugetWdkContentRoot "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" /M + Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From 52e0ac7e3592ad5cdefb6d20bfddb3f543393468 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 09:03:38 -0700 Subject: [PATCH 15/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 881bd7f8..a18ef6da 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -100,7 +100,8 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } - setx NugetWdkContentRoot "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" /M + $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" + Write-Host "Nuget WDK Content Root: $NugetWdkContentRoot" Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 5e29f194b7601afa0542ac7052511db6cf9af9e7 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 09:15:00 -0700 Subject: [PATCH 16/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a18ef6da..a198256a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - Write-Host "Nuget WDK Content Root: $NugetWdkContentRoot" + Write-Output "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 1046cbfa67088af3846cc405b928097859b787a3 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 09:28:37 -0700 Subject: [PATCH 17/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a198256a..c03da563 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - Write-Output "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV + echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 3b39c40e0e324e4485686a00e9445709f1d4f20b Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 09:37:48 -0700 Subject: [PATCH 18/52] Add command to set NugetWdkContentRoot ENV VAR --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c03da563..b56d663d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV + echo "NugetWdkContentRoot=$$NugetWdkContentRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From dbc2f27b3cb3a8d5efa3c92d799cf9dc6abfb610 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 09:48:03 -0700 Subject: [PATCH 19/52] Replace x64 with ARM64 contents --- .github/workflows/build.yaml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index b56d663d..11eb3395 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,8 +74,8 @@ jobs: nuget restore .\packages.config -PackagesDirectory C:\WDK Write-Host "WDK installed at C:\WDK" $folders = @( - "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.ARM64.10.0.26100.1591", "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" ) foreach ($folder in $folders) { @@ -84,15 +84,15 @@ jobs: exit 1 } } - $signtoolX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" + $signtoolARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\ARM64\signtool.exe" $signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" - $destinationX64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" - $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" - if (Test-Path $signtoolX64) { - Copy-Item -Path $signtoolX64 -Destination $destinationX64 -Force - Write-Host "Copied signtool.exe to $destinationX64" + $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" + $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + if (Test-Path $signtoolARM64) { + Copy-Item -Path $signtoolARM64 -Destination $destinationARM64 -Force + Write-Host "Copied signtool.exe to $destinationARM64" } else { - Write-Error "signtool.exe not found at $signtoolX64" + Write-Error "signtool.exe not found at $signtoolARM64" } if (Test-Path $signtoolX86) { Copy-Item -Path $signtoolX86 -Destination $destinationX86 -Force @@ -100,7 +100,7 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } - $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" + $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" echo "NugetWdkContentRoot=$$NugetWdkContentRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append Get-ChildItem Env: From edcbec917cb92b2a90ea94ae9cde51c615f024c9 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 10:05:40 -0700 Subject: [PATCH 20/52] Replace x64 with ARM64 contents --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 11eb3395..9395b79d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" - echo "NugetWdkContentRoot=$$NugetWdkContentRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV Get-ChildItem Env: - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From c0eeeb8ea8a63beaa7800a93899e9a496b32043e Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 21:56:36 -0700 Subject: [PATCH 21/52] List contents of WDK Root Dir --- .github/workflows/build.yaml | 5 ++++- crates/wdk-build/src/cargo_make.rs | 8 ++++++-- crates/wdk-build/src/utils.rs | 12 ++++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9395b79d..01ec59b2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -100,9 +100,12 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } + $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV - Get-ChildItem Env: + + Get-ChildItem -Path "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" -Recurse + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 3413e297..02736c95 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -26,9 +26,13 @@ use tracing::{instrument, trace}; use crate::{ metadata, utils::{ - detect_wdk_content_root, get_latest_windows_sdk_version, get_wdk_version_number, PathExt, + detect_wdk_content_root, + get_latest_windows_sdk_version, + get_wdk_version_number, + PathExt, }, - ConfigError, CpuArchitecture, + ConfigError, + CpuArchitecture, }; /// The filename of the main makefile for Rust Windows drivers. diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 3d353068..a92a929e 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -14,7 +14,13 @@ use thiserror::Error; use windows::{ core::{s, PCSTR}, Win32::System::Registry::{ - RegCloseKey, RegGetValueA, RegOpenKeyExA, HKEY, HKEY_LOCAL_MACHINE, KEY_READ, RRF_RT_REG_SZ, + RegCloseKey, + RegGetValueA, + RegOpenKeyExA, + HKEY, + HKEY_LOCAL_MACHINE, + KEY_READ, + RRF_RT_REG_SZ, }, }; @@ -424,7 +430,9 @@ mod tests { mod read_registry_key_string_value { use windows::Win32::UI::Shell::{ - FOLDERID_ProgramFiles, SHGetKnownFolderPath, KF_FLAG_DEFAULT, + FOLDERID_ProgramFiles, + SHGetKnownFolderPath, + KF_FLAG_DEFAULT, }; use super::*; From 9b9bb08c1dbd8b98253f800ca6c73eeaf3c88974 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 21:57:43 -0700 Subject: [PATCH 22/52] List contents of WDK Root Dir --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 01ec59b2..ad4285ee 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,11 +27,11 @@ jobs: rust_toolchain: - stable - - beta - - nightly + # - beta + # - nightly cargo_profile: - - dev + # - dev - release target_triple: From 4c5cb6edf9104fde8c61dbad85844a5c483f18e5 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:09:50 -0700 Subject: [PATCH 23/52] Add print stmts for debugging --- crates/wdk-build/src/cargo_make.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 02736c95..090b01c2 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -519,6 +519,8 @@ pub fn setup_path() -> Result, ConfigError> { let version = get_latest_windows_sdk_version(&wdk_content_root.join("Lib"))?; + println!("Version: {}", version); + let host_arch = CpuArchitecture::try_from_cargo_str(env::consts::ARCH) .expect("The rust standard library should always set env::consts::ARCH"); @@ -529,6 +531,8 @@ pub fn setup_path() -> Result, ConfigError> { .strip_extended_length_path_prefix() .expect("Failed to strip extended length path prefix"); + println!("WDK bin root: {}", wdk_bin_root.display()); + let host_windows_sdk_ver_bin_path = match host_arch { CpuArchitecture::Amd64 => wdk_bin_root .join(host_arch.as_windows_str()) @@ -546,6 +550,11 @@ pub fn setup_path() -> Result, ConfigError> { .to_string(), }; + println!( + "Host Windows SDK bin path: {}", + host_windows_sdk_ver_bin_path + ); + // Some tools (ex. inf2cat) are only available in the x86 folder let x86_windows_sdk_ver_bin_path = wdk_bin_root .join("x86") @@ -561,6 +570,8 @@ pub fn setup_path() -> Result, ConfigError> { format!("{host_windows_sdk_ver_bin_path};{x86_windows_sdk_ver_bin_path}",), ); + println!("x86 Windows SDK bin path: {}", x86_windows_sdk_ver_bin_path); + let wdk_tool_root = wdk_content_root .join(format!("Tools/{version}")) .canonicalize()? @@ -576,6 +587,8 @@ pub fn setup_path() -> Result, ConfigError> { .expect("arch_specific_wdk_tool_root should only contain valid UTF8"), ); + println!("WDK tool root: {}", wdk_tool_root.display()); + println!("PATH_ENV_VAR={}", env::var(PATH_ENV_VAR).unwrap()); Ok([PATH_ENV_VAR].map(std::string::ToString::to_string)) From 2e28af7bb10477de33ba971875e1c2e3f886d9fe Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:21:01 -0700 Subject: [PATCH 24/52] Add print stmts for debugging --- crates/wdk-build/src/cargo_make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 090b01c2..4dface8f 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -573,7 +573,7 @@ pub fn setup_path() -> Result, ConfigError> { println!("x86 Windows SDK bin path: {}", x86_windows_sdk_ver_bin_path); let wdk_tool_root = wdk_content_root - .join(format!("Tools/{version}")) + .join(format!("tools/{version}")) .canonicalize()? .strip_extended_length_path_prefix()?; let arch_specific_wdk_tool_root = wdk_tool_root From 860b3378ab787a31dae2fab2496926acf4407eaf Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:37:20 -0700 Subject: [PATCH 25/52] Add print stmts for debugging --- crates/wdk-build/src/cargo_make.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index 4dface8f..a00e1900 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -524,6 +524,8 @@ pub fn setup_path() -> Result, ConfigError> { let host_arch = CpuArchitecture::try_from_cargo_str(env::consts::ARCH) .expect("The rust standard library should always set env::consts::ARCH"); + println!("Host architecture: {}", host_arch.as_windows_str()); + let wdk_bin_root = wdk_content_root .join(format!("bin/{version}")) .canonicalize() From 02e3fbd9a403028b79cfd36d9065260757f47424 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:41:15 -0700 Subject: [PATCH 26/52] Reduce matrix options for faster workflow exec --- .github/workflows/build.yaml | 2 +- crates/wdk-build/src/cargo_make.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ad4285ee..ce27e417 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: strategy: matrix: wdk: - - Microsoft.WindowsWDK.10.0.22621 # NI WDK + # - Microsoft.WindowsWDK.10.0.22621 # NI WDK - Microsoft.Windows.WDK # Latest WDK llvm: diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index a00e1900..a43dd80a 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -575,7 +575,7 @@ pub fn setup_path() -> Result, ConfigError> { println!("x86 Windows SDK bin path: {}", x86_windows_sdk_ver_bin_path); let wdk_tool_root = wdk_content_root - .join(format!("tools/{version}")) + .join(format!("Tools/{version}")) .canonicalize()? .strip_extended_length_path_prefix()?; let arch_specific_wdk_tool_root = wdk_tool_root From abd946e893cca0cb0e27c8b143a17835a04758dd Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:42:12 -0700 Subject: [PATCH 27/52] Fix wdk tool root for nuget package - tools instead of Tools --- crates/wdk-build/src/cargo_make.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index a43dd80a..a00e1900 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -575,7 +575,7 @@ pub fn setup_path() -> Result, ConfigError> { println!("x86 Windows SDK bin path: {}", x86_windows_sdk_ver_bin_path); let wdk_tool_root = wdk_content_root - .join(format!("Tools/{version}")) + .join(format!("tools/{version}")) .canonicalize()? .strip_extended_length_path_prefix()?; let arch_specific_wdk_tool_root = wdk_tool_root From a656057c56d78cc583f4a3426c0163a49a1d1617 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 9 Oct 2024 22:56:52 -0700 Subject: [PATCH 28/52] Replace ARM64 with x64 to match the host arch --- .github/workflows/build.yaml | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ce27e417..3afe0e2c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,8 +74,8 @@ jobs: nuget restore .\packages.config -PackagesDirectory C:\WDK Write-Host "WDK installed at C:\WDK" $folders = @( - "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.ARM64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" ) foreach ($folder in $folders) { @@ -84,15 +84,15 @@ jobs: exit 1 } } - $signtoolARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\ARM64\signtool.exe" + $signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" $signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" - $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" - $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\bin\10.0.26100.0\x86" - if (Test-Path $signtoolARM64) { - Copy-Item -Path $signtoolARM64 -Destination $destinationARM64 -Force - Write-Host "Copied signtool.exe to $destinationARM64" + $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" + $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + if (Test-Path $signtoolx64) { + Copy-Item -Path $signtoolx64 -Destination $destinationx64 -Force + Write-Host "Copied signtool.exe to $destinationx64" } else { - Write-Error "signtool.exe not found at $signtoolARM64" + Write-Error "signtool.exe not found at $signtoolx64" } if (Test-Path $signtoolX86) { Copy-Item -Path $signtoolX86 -Destination $destinationX86 -Force @@ -101,10 +101,10 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } - $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" + $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV - Get-ChildItem -Path "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c" -Recurse + Get-ChildItem -Path "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" -Recurse - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) From 7692e010fa4518a4137540ae1b68562dfce25559 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 01:58:09 -0700 Subject: [PATCH 29/52] Add command to move ARM64 headers to NuGet's x64 root --- .github/workflows/build.yaml | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 3afe0e2c..5655e46d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -100,12 +100,18 @@ jobs: } else { Write-Error "signtool.exe not found at $signtoolX86" } + + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\ARM64" + $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" + if (Test-Path $sourceFolder) { + Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force + Write-Host "Copied $sourceFolder to $destinationFolder" + } else { + Write-Error "Source folder $sourceFolder not found" + } $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV - - Get-ChildItem -Path "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" -Recurse - + echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From 70c7b6b52ae16db176c8eccc2fcd3f0ff768c08c Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 03:15:54 -0700 Subject: [PATCH 30/52] Add command to move ARM64 headers to NuGet's x64 root --- .github/workflows/build.yaml | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5655e46d..78e7ec77 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -101,7 +101,7 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } - $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\ARM64" + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" if (Test-Path $sourceFolder) { Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force @@ -109,7 +109,34 @@ jobs: } else { Write-Error "Source folder $sourceFolder not found" } - + + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\um\arm64" + $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\um" + if (Test-Path $sourceFolder) { + Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force + Write-Host "Copied $sourceFolder to $destinationFolder" + } else { + Write-Error "Source folder $sourceFolder not found" + } + + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\kmdf\ARM64" + $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\kmdf" + if (Test-Path $sourceFolder) { + Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force + Write-Host "Copied $sourceFolder to $destinationFolder" + } else { + Write-Error "Source folder $sourceFolder not found" + } + + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\umdf\ARM64" + $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\umdf" + if (Test-Path $sourceFolder) { + Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force + Write-Host "Copied $sourceFolder to $destinationFolder" + } else { + Write-Error "Source folder $sourceFolder not found" + } + $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV From a7a2fe858b47fc445d64d978ae519a01258eacf0 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 04:09:47 -0700 Subject: [PATCH 31/52] Add debug print to copy to package function --- crates/wdk-build/src/cargo_make.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index a00e1900..d4074ff9 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -741,6 +741,8 @@ pub fn get_current_package_name() -> String { pub fn copy_to_driver_package_folder>(path_to_copy: P) -> Result<(), ConfigError> { let path_to_copy = path_to_copy.as_ref(); + println!("copy_to_driver_package_folder: {}", path_to_copy.display()); + let package_folder_path: PathBuf = get_wdk_build_output_directory().join(format!("{}_package", get_current_package_name())); if !package_folder_path.exists() { From 3c51e273b07deff480859f9563090f9b0e7fbce5 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 04:32:05 -0700 Subject: [PATCH 32/52] Latest WDK, LLVM 17.0.6, stable, dev, x86_64-pc-windows-msvc --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 78e7ec77..a98422e0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -31,8 +31,8 @@ jobs: # - nightly cargo_profile: - # - dev - - release + - dev + # - release target_triple: - x86_64-pc-windows-msvc From 17e02da9125d0a24d288325a44d0e51837c39b2a Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 04:34:20 -0700 Subject: [PATCH 33/52] Latest WDK, LLVM 17.0.6, stable, dev, x86_64-pc-windows-msvc --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a98422e0..1dfaf3f6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: target_triple: - x86_64-pc-windows-msvc - - aarch64-pc-windows-msvc + # - aarch64-pc-windows-msvc steps: - name: Checkout Repository From 72e518d9b99e6e684a827c300b63c4144fa1f945 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 21:21:23 -0700 Subject: [PATCH 34/52] Move certmgr to WDK bin directories --- .github/workflows/build.yaml | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 1dfaf3f6..e7f0e480 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -76,6 +76,8 @@ jobs: $folders = @( "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" ) foreach ($folder in $folders) { @@ -84,10 +86,12 @@ jobs: exit 1 } } + $signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" $signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + if (Test-Path $signtoolx64) { Copy-Item -Path $signtoolx64 -Destination $destinationx64 -Force Write-Host "Copied signtool.exe to $destinationx64" @@ -101,6 +105,34 @@ jobs: Write-Error "signtool.exe not found at $signtoolX86" } + $certmgrx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\certmgr.exe" + $certmgrX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\certmgr.exe" + $certmgrARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\certmgr.exe" + $destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" + $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" + + if (Test-Path $certmgrx86) { + Copy-Item -Path $certmgrx86 -Destination $destinationx86 -Force + Write-Host "Copied certmgr.exe to $destinationx86" + } else { + Write-Error "certmgr.exe not found at $certmgrx86" + } + + if (Test-Path $certmgrX64) { + Copy-Item -Path $certmgrX64 -Destination $destinationx64 -Force + Write-Host "Copied certmgr.exe to $destinationx64" + } else { + Write-Error "certmgr.exe not found at $certmgrX64" + } + + if (Test-Path $certmgrARM64) { + Copy-Item -Path $certmgrARM64 -Destination $destinationARM64 -Force + Write-Host "Copied certmgr.exe to $destinationARM64" + } else { + Write-Error "certmgr.exe not found at $certmgrARM64" + } + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" if (Test-Path $sourceFolder) { From efcb4db5f23fe474a7c95a4f35e14e5a568ddbf2 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 22:40:18 -0700 Subject: [PATCH 35/52] Move MakeCert to respective WDK bin directories --- .github/workflows/build.yaml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index e7f0e480..948d995d 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -133,6 +133,34 @@ jobs: Write-Error "certmgr.exe not found at $certmgrARM64" } + $makecertx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\MakeCert.exe" + $makecertX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\MakeCert.exe" + $makecertARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\MakeCert.exe" + $destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" + $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" + + if (Test-Path $makecertx86) { + Copy-Item -Path $makecertx86 -Destination $destinationx86 -Force + Write-Host "Copied MakeCert.exe to $destinationx86" + } else { + Write-Error "MakeCert.exe not found at $makecertx86" + } + + if (Test-Path $makecertX64) { + Copy-Item -Path $makecertX64 -Destination $destinationx64 -Force + Write-Host "Copied MakeCert.exe to $destinationx64" + } else { + Write-Error "MakeCert.exe not found at $makecertX64" + } + + if (Test-Path $makecertARM64) { + Copy-Item -Path $makecertARM64 -Destination $destinationARM64 -Force + Write-Host "Copied MakeCert.exe to $destinationARM64" + } else { + Write-Error "MakeCert.exe not found at $makecertARM64" + } + $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" if (Test-Path $sourceFolder) { From 2e3024fdd8fce71d74989e5c5de71daf3dafbef7 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 23:17:02 -0700 Subject: [PATCH 36/52] Move nuget-install-wdk to separate script --- .github/actions/nuget-install/action.yaml | 16 --- .github/scripts/nuget-install-wdk.ps1 | 86 ++++++++++++++ .github/workflows/build.yaml | 133 +--------------------- 3 files changed, 89 insertions(+), 146 deletions(-) delete mode 100644 .github/actions/nuget-install/action.yaml create mode 100644 .github/scripts/nuget-install-wdk.ps1 diff --git a/.github/actions/nuget-install/action.yaml b/.github/actions/nuget-install/action.yaml deleted file mode 100644 index 923ac7f9..00000000 --- a/.github/actions/nuget-install/action.yaml +++ /dev/null @@ -1,16 +0,0 @@ -name: 'Install NuGet' -description: 'Installs the PackageManagement module and NuGet provider' -runs: - using: 'composite' - steps: - - name: Install PackageManagement Module - run: | - Install-Module -Name PackageManagement -Force -Scope AllUsers - Import-Module PackageManagement - shell: pwsh - - - name: Install NuGet Provider - run: | - Install-Module -Name NuGet -Force -Scope AllUsers - Import-Module NuGet - shell: pwsh \ No newline at end of file diff --git a/.github/scripts/nuget-install-wdk.ps1 b/.github/scripts/nuget-install-wdk.ps1 new file mode 100644 index 00000000..dcd42ff1 --- /dev/null +++ b/.github/scripts/nuget-install-wdk.ps1 @@ -0,0 +1,86 @@ +nuget restore .\packages.config -PackagesDirectory C:\WDK +Write-Host "WDK installed at C:\WDK" +$folders = @( + "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", + "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" +) +foreach ($folder in $folders) { +if (-Not (Test-Path $folder)) { + Write-Error "Required folder $folder is missing." + exit 1 +} +} +function Copy-File { + param ( + [string]$sourcePath, + [string]$destinationPath, + [string]$fileName + ) + + if (Test-Path $sourcePath) { + Copy-Item -Path $sourcePath -Destination $destinationPath -Force + Write-Host "Copied $fileName to $destinationPath" + } else { + Write-Error "$fileName not found at $sourcePath" + } +} + +# Copying signtool to WDK bin folder +$signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" +$signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" +$destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" + +Copy-File -sourcePath $signtoolX64 -destinationPath $destinationX64 -fileName "signtool.exe" +Copy-File -sourcePath $signtoolX86 -destinationPath $destinationX86 -fileName "signtool.exe" + +# Copying certmgr to WDK bin folder +$certmgrx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\certmgr.exe" +$certmgrX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\certmgr.exe" +$certmgrARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\certmgr.exe" +$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" +$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" + +Copy-File -sourcePath $certmgrx86 -destinationPath $destinationx86 -fileName "certmgr.exe" +Copy-File -sourcePath $certmgrX64 -destinationPath $destinationx64 -fileName "certmgr.exe" +Copy-File -sourcePath $certmgrARM64 -destinationPath $destinationARM64 -fileName "certmgr.exe" + +# Copying makecert to WDK bin folder +$makecertx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\MakeCert.exe" +$makecertX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\MakeCert.exe" +$makecertARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\MakeCert.exe" +$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" +$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" + +Copy-File -sourcePath $makecertx86 -destinationPath $destinationx86 -fileName "MakeCert.exe" +Copy-File -sourcePath $makecertX64 -destinationPath $destinationx64 -fileName "MakeCert.exe" +Copy-File -sourcePath $makecertARM64 -destinationPath $destinationARM64 -fileName "MakeCert.exe" + +function Copy-Folder { + param ( + [string]$sourceFolder, + [string]$destinationFolder + ) + + if (Test-Path $sourceFolder) { + Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force + Write-Host "Copied $sourceFolder to $destinationFolder" + } else { + Write-Error "Source folder $sourceFolder not found" + } +} + +# Copying km, um, kmdf, umdf ARM64 headers to x64 folders +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\um\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\um" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\kmdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\kmdf" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\umdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\umdf" + +# Set NugetWdkContentRoot environment variable +$NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" +Write-Output "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 948d995d..57018641 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -68,137 +68,10 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } - - name: Install WDK ${{ matrix.wdk }} (NuGet) + - name: Install ${{ matrix.wdk }} (NuGet) if: matrix.wdk == 'Microsoft.Windows.WDK' - run: | - nuget restore .\packages.config -PackagesDirectory C:\WDK - Write-Host "WDK installed at C:\WDK" - $folders = @( - "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" - ) - foreach ($folder in $folders) { - if (-Not (Test-Path $folder)) { - Write-Error "Required folder $folder is missing." - exit 1 - } - } - - $signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" - $signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" - $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" - $destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" - - if (Test-Path $signtoolx64) { - Copy-Item -Path $signtoolx64 -Destination $destinationx64 -Force - Write-Host "Copied signtool.exe to $destinationx64" - } else { - Write-Error "signtool.exe not found at $signtoolx64" - } - if (Test-Path $signtoolX86) { - Copy-Item -Path $signtoolX86 -Destination $destinationX86 -Force - Write-Host "Copied signtool.exe to $destinationX86" - } else { - Write-Error "signtool.exe not found at $signtoolX86" - } - - $certmgrx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\certmgr.exe" - $certmgrX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\certmgr.exe" - $certmgrARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\certmgr.exe" - $destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" - $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" - $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" - - if (Test-Path $certmgrx86) { - Copy-Item -Path $certmgrx86 -Destination $destinationx86 -Force - Write-Host "Copied certmgr.exe to $destinationx86" - } else { - Write-Error "certmgr.exe not found at $certmgrx86" - } - - if (Test-Path $certmgrX64) { - Copy-Item -Path $certmgrX64 -Destination $destinationx64 -Force - Write-Host "Copied certmgr.exe to $destinationx64" - } else { - Write-Error "certmgr.exe not found at $certmgrX64" - } - - if (Test-Path $certmgrARM64) { - Copy-Item -Path $certmgrARM64 -Destination $destinationARM64 -Force - Write-Host "Copied certmgr.exe to $destinationARM64" - } else { - Write-Error "certmgr.exe not found at $certmgrARM64" - } - - $makecertx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\MakeCert.exe" - $makecertX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\MakeCert.exe" - $makecertARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\MakeCert.exe" - $destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" - $destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" - $destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" - - if (Test-Path $makecertx86) { - Copy-Item -Path $makecertx86 -Destination $destinationx86 -Force - Write-Host "Copied MakeCert.exe to $destinationx86" - } else { - Write-Error "MakeCert.exe not found at $makecertx86" - } - - if (Test-Path $makecertX64) { - Copy-Item -Path $makecertX64 -Destination $destinationx64 -Force - Write-Host "Copied MakeCert.exe to $destinationx64" - } else { - Write-Error "MakeCert.exe not found at $makecertX64" - } - - if (Test-Path $makecertARM64) { - Copy-Item -Path $makecertARM64 -Destination $destinationARM64 -Force - Write-Host "Copied MakeCert.exe to $destinationARM64" - } else { - Write-Error "MakeCert.exe not found at $makecertARM64" - } - - $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" - $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" - if (Test-Path $sourceFolder) { - Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force - Write-Host "Copied $sourceFolder to $destinationFolder" - } else { - Write-Error "Source folder $sourceFolder not found" - } - - $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\um\arm64" - $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\um" - if (Test-Path $sourceFolder) { - Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force - Write-Host "Copied $sourceFolder to $destinationFolder" - } else { - Write-Error "Source folder $sourceFolder not found" - } - - $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\kmdf\ARM64" - $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\kmdf" - if (Test-Path $sourceFolder) { - Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force - Write-Host "Copied $sourceFolder to $destinationFolder" - } else { - Write-Error "Source folder $sourceFolder not found" - } - - $sourceFolder = "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\umdf\ARM64" - $destinationFolder = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\umdf" - if (Test-Path $sourceFolder) { - Copy-Item -Path $sourceFolder -Destination $destinationFolder -Recurse -Force - Write-Host "Copied $sourceFolder to $destinationFolder" - } else { - Write-Error "Source folder $sourceFolder not found" - } - - $NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" - echo "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV + run: .\scripts\nuget-install-wdk.ps1 + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From 98df970229d84b7ec5a2d835508be5061c63f26d Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 23:31:04 -0700 Subject: [PATCH 37/52] Move nuget-install-wdk to separate script --- .github/workflows/build.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 57018641..a8123a2b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -70,8 +70,8 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: matrix.wdk == 'Microsoft.Windows.WDK' - run: .\scripts\nuget-install-wdk.ps1 - + run: | + .\scripts\nuget-install-wdk.ps1 - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From 30f4fa68f0b3c8c76a63ccb414f6fa1caa7697d0 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Thu, 10 Oct 2024 23:36:50 -0700 Subject: [PATCH 38/52] Move nuget-install-wdk to separate script --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a8123a2b..f556775c 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -71,7 +71,7 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: matrix.wdk == 'Microsoft.Windows.WDK' run: | - .\scripts\nuget-install-wdk.ps1 + ./.github/scripts/nuget-install-wdk.ps1 - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From e156edd587b083a0ddf3af6f2f6008caa75d0eac Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Fri, 11 Oct 2024 00:10:49 -0700 Subject: [PATCH 39/52] Enable WDK NI in the matrix --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f556775c..4b458286 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -19,7 +19,7 @@ jobs: strategy: matrix: wdk: - # - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.WindowsWDK.10.0.22621 # NI WDK - Microsoft.Windows.WDK # Latest WDK llvm: From bf6203cccd2ec5eb333d3405f8411a75c57e8f1d Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Fri, 11 Oct 2024 00:39:46 -0700 Subject: [PATCH 40/52] Remove debug print stmts, Enable target triple, Use Tools/ instead of tools/ for WDK tool root --- .github/workflows/build.yaml | 2 +- crates/wdk-build/src/cargo_make.rs | 21 +-------------------- crates/wdk-build/src/utils.rs | 2 -- 3 files changed, 2 insertions(+), 23 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 4b458286..c8797820 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: target_triple: - x86_64-pc-windows-msvc - # - aarch64-pc-windows-msvc + - aarch64-pc-windows-msvc steps: - name: Checkout Repository diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index d4074ff9..7ccc7f05 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -519,13 +519,9 @@ pub fn setup_path() -> Result, ConfigError> { let version = get_latest_windows_sdk_version(&wdk_content_root.join("Lib"))?; - println!("Version: {}", version); - let host_arch = CpuArchitecture::try_from_cargo_str(env::consts::ARCH) .expect("The rust standard library should always set env::consts::ARCH"); - println!("Host architecture: {}", host_arch.as_windows_str()); - let wdk_bin_root = wdk_content_root .join(format!("bin/{version}")) .canonicalize() @@ -533,8 +529,6 @@ pub fn setup_path() -> Result, ConfigError> { .strip_extended_length_path_prefix() .expect("Failed to strip extended length path prefix"); - println!("WDK bin root: {}", wdk_bin_root.display()); - let host_windows_sdk_ver_bin_path = match host_arch { CpuArchitecture::Amd64 => wdk_bin_root .join(host_arch.as_windows_str()) @@ -552,11 +546,6 @@ pub fn setup_path() -> Result, ConfigError> { .to_string(), }; - println!( - "Host Windows SDK bin path: {}", - host_windows_sdk_ver_bin_path - ); - // Some tools (ex. inf2cat) are only available in the x86 folder let x86_windows_sdk_ver_bin_path = wdk_bin_root .join("x86") @@ -572,10 +561,8 @@ pub fn setup_path() -> Result, ConfigError> { format!("{host_windows_sdk_ver_bin_path};{x86_windows_sdk_ver_bin_path}",), ); - println!("x86 Windows SDK bin path: {}", x86_windows_sdk_ver_bin_path); - let wdk_tool_root = wdk_content_root - .join(format!("tools/{version}")) + .join(format!("Tools/{version}")) .canonicalize()? .strip_extended_length_path_prefix()?; let arch_specific_wdk_tool_root = wdk_tool_root @@ -589,10 +576,6 @@ pub fn setup_path() -> Result, ConfigError> { .expect("arch_specific_wdk_tool_root should only contain valid UTF8"), ); - println!("WDK tool root: {}", wdk_tool_root.display()); - - println!("PATH_ENV_VAR={}", env::var(PATH_ENV_VAR).unwrap()); - Ok([PATH_ENV_VAR].map(std::string::ToString::to_string)) } @@ -741,8 +724,6 @@ pub fn get_current_package_name() -> String { pub fn copy_to_driver_package_folder>(path_to_copy: P) -> Result<(), ConfigError> { let path_to_copy = path_to_copy.as_ref(); - println!("copy_to_driver_package_folder: {}", path_to_copy.display()); - let package_folder_path: PathBuf = get_wdk_build_output_directory().join(format!("{}_package", get_current_package_name())); if !package_folder_path.exists() { diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index a92a929e..e9032871 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -102,8 +102,6 @@ pub fn detect_wdk_content_root() -> Option { if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") { let path = Path::new(wdk_content_root.as_str()); if path.is_dir() { - println!("Using NugetWdkContentRoot: {}", path.display()); - return Some(path.to_path_buf()); } eprintln!( From d3c0fade904719436c698fb3637c5b4848d7b2a0 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Fri, 11 Oct 2024 01:05:05 -0700 Subject: [PATCH 41/52] Enable all profiles, toolchains, targets in the matrix; complete matrix test --- .github/workflows/build.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index c8797820..8a50c5f0 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -27,12 +27,12 @@ jobs: rust_toolchain: - stable - # - beta - # - nightly + - beta + - nightly cargo_profile: - dev - # - release + - release target_triple: - x86_64-pc-windows-msvc From 4df4330240a71eddbe576a32eabb5860092220ec Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Fri, 11 Oct 2024 04:56:54 -0700 Subject: [PATCH 42/52] Enable other workflows --- .github/workflows/{cargo-audit.yaml.dnr => cargo-audit.yaml} | 0 ...{code-formatting-check.yaml.dnr => code-formatting-check.yaml} | 0 .github/workflows/{codeql.yml.dnr => codeql.yml} | 0 .github/workflows/{docs.yaml.dnr => docs.yaml} | 0 ...b-dependency-review.yaml.dnr => github-dependency-review.yaml} | 0 .github/workflows/{lint.yaml.dnr => lint.yaml} | 0 ...elopment-makefile.yaml.dnr => local-development-makefile.yaml} | 0 .github/workflows/{test.yaml.dnr => test.yaml} | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{cargo-audit.yaml.dnr => cargo-audit.yaml} (100%) rename .github/workflows/{code-formatting-check.yaml.dnr => code-formatting-check.yaml} (100%) rename .github/workflows/{codeql.yml.dnr => codeql.yml} (100%) rename .github/workflows/{docs.yaml.dnr => docs.yaml} (100%) rename .github/workflows/{github-dependency-review.yaml.dnr => github-dependency-review.yaml} (100%) rename .github/workflows/{lint.yaml.dnr => lint.yaml} (100%) rename .github/workflows/{local-development-makefile.yaml.dnr => local-development-makefile.yaml} (100%) rename .github/workflows/{test.yaml.dnr => test.yaml} (100%) diff --git a/.github/workflows/cargo-audit.yaml.dnr b/.github/workflows/cargo-audit.yaml similarity index 100% rename from .github/workflows/cargo-audit.yaml.dnr rename to .github/workflows/cargo-audit.yaml diff --git a/.github/workflows/code-formatting-check.yaml.dnr b/.github/workflows/code-formatting-check.yaml similarity index 100% rename from .github/workflows/code-formatting-check.yaml.dnr rename to .github/workflows/code-formatting-check.yaml diff --git a/.github/workflows/codeql.yml.dnr b/.github/workflows/codeql.yml similarity index 100% rename from .github/workflows/codeql.yml.dnr rename to .github/workflows/codeql.yml diff --git a/.github/workflows/docs.yaml.dnr b/.github/workflows/docs.yaml similarity index 100% rename from .github/workflows/docs.yaml.dnr rename to .github/workflows/docs.yaml diff --git a/.github/workflows/github-dependency-review.yaml.dnr b/.github/workflows/github-dependency-review.yaml similarity index 100% rename from .github/workflows/github-dependency-review.yaml.dnr rename to .github/workflows/github-dependency-review.yaml diff --git a/.github/workflows/lint.yaml.dnr b/.github/workflows/lint.yaml similarity index 100% rename from .github/workflows/lint.yaml.dnr rename to .github/workflows/lint.yaml diff --git a/.github/workflows/local-development-makefile.yaml.dnr b/.github/workflows/local-development-makefile.yaml similarity index 100% rename from .github/workflows/local-development-makefile.yaml.dnr rename to .github/workflows/local-development-makefile.yaml diff --git a/.github/workflows/test.yaml.dnr b/.github/workflows/test.yaml similarity index 100% rename from .github/workflows/test.yaml.dnr rename to .github/workflows/test.yaml From b8fdb0d9136c3a59b7ff3081676285315e0dc83d Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Fri, 11 Oct 2024 08:22:11 -0700 Subject: [PATCH 43/52] Enable Latest WDK (uses NuGet) in all workflows --- .github/workflows/codeql.yml | 7 +++++++ .github/workflows/docs.yaml | 7 +++++++ .github/workflows/lint.yaml | 7 +++++++ .github/workflows/local-development-makefile.yaml | 7 +++++++ .github/workflows/test.yaml | 7 +++++++ 5 files changed, 35 insertions(+) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f7b28a66..0672b66d 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,6 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -59,6 +60,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -68,6 +70,11 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + - name: Install ${{ matrix.wdk }} (NuGet) + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + ./.github/scripts/nuget-install-wdk.ps1 + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 56f9412b..10039a50 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -18,6 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -55,6 +56,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -64,6 +66,11 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + - name: Install ${{ matrix.wdk }} (NuGet) + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + ./.github/scripts/nuget-install-wdk.ps1 + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6bef9782..6de78c6c 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,6 +17,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -54,6 +55,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -63,6 +65,11 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + - name: Install ${{ matrix.wdk }} (NuGet) + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + ./.github/scripts/nuget-install-wdk.ps1 + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 79cf5bad..8826ac64 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -18,6 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -46,6 +47,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -55,6 +57,11 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + - name: Install ${{ matrix.wdk }} (NuGet) + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + ./.github/scripts/nuget-install-wdk.ps1 + - name: Install Nightly Rust Toolchain (${{ matrix.target_triple }}) uses: dtolnay/rust-toolchain@nightly with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2f63b1e1..8c920b2e 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,6 +15,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK + - Microsoft.Windows.WDK # Latest WDK llvm: - 17.0.6 @@ -52,6 +53,7 @@ jobs: clang --version - name: Install WDK (${{ matrix.wdk }}) + if: matrix.wdk == 'Microsoft.WindowsWDK.10.0.22621' run: | if ((Get-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals).Id -eq '${{ matrix.wdk }}') { Write-Host "${{ matrix.wdk }} is already installed. Attempting to update..." @@ -61,6 +63,11 @@ jobs: Install-WinGetPackage -Id ${{ matrix.wdk }} -Source winget -MatchOption Equals -Mode Silent -Force } + - name: Install ${{ matrix.wdk }} (NuGet) + if: matrix.wdk == 'Microsoft.Windows.WDK' + run: | + ./.github/scripts/nuget-install-wdk.ps1 + - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master with: From 41a7b7e5773628c1a7c6bd1c5370b38b776ce6a1 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Mon, 14 Oct 2024 10:02:06 -0700 Subject: [PATCH 44/52] Revert to error handling using '?' for canonicalize and strip_extended_length_path_prefix --- crates/wdk-build/src/cargo_make.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/wdk-build/src/cargo_make.rs b/crates/wdk-build/src/cargo_make.rs index c7324821..884af8da 100644 --- a/crates/wdk-build/src/cargo_make.rs +++ b/crates/wdk-build/src/cargo_make.rs @@ -524,10 +524,8 @@ pub fn setup_path() -> Result, ConfigError> { let wdk_bin_root = wdk_content_root .join(format!("bin/{version}")) - .canonicalize() - .expect("Failed to canonicalize path") - .strip_extended_length_path_prefix() - .expect("Failed to strip extended length path prefix"); + .canonicalize()? + .strip_extended_length_path_prefix()?; let host_windows_sdk_ver_bin_path = match host_arch { CpuArchitecture::Amd64 => wdk_bin_root From d2e3a610380a497ccd33c5458045e7b4891309d9 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 09:30:09 -0700 Subject: [PATCH 45/52] Remove NugetWdkContentRoot env var, add logic in nuget-install-wdk.ps1 script to install WDK version based on the matrix input, fix clippy issue --- .github/scripts/nuget-install-wdk.ps1 | 103 +++++++++++++++++--------- .github/workflows/build.yaml | 16 +++- crates/wdk-build/src/utils.rs | 17 +---- 3 files changed, 83 insertions(+), 53 deletions(-) diff --git a/.github/scripts/nuget-install-wdk.ps1 b/.github/scripts/nuget-install-wdk.ps1 index dcd42ff1..01a93d35 100644 --- a/.github/scripts/nuget-install-wdk.ps1 +++ b/.github/scripts/nuget-install-wdk.ps1 @@ -1,17 +1,52 @@ -nuget restore .\packages.config -PackagesDirectory C:\WDK -Write-Host "WDK installed at C:\WDK" +param ( + [string]$wdkVersion +) + +# Extract the first three parts of the version +$majorVersionNum = ($wdkVersion -split '\.')[0..2] -join '.' + +Write-Host "Installing WDK version $wdkVersion" +Write-Host "Major version number: $majorVersionNum" + +# Update the packages.config file with the version passed as parameter +$packagesConfigPath = ".\packages.config" + +if (Test-Path $packagesConfigPath) { + [xml]$packagesConfig = Get-Content $packagesConfigPath + + foreach ($package in $packagesConfig.packages.package) { + if ($package.id -like "Microsoft.Windows.*") { + $package.version = $wdkVersion + } + } + + $packagesConfig.Save($packagesConfigPath) + Write-Host "Updated packages.config with version $wdkVersion" +} else { + Write-Error "packages.config file not found" +} + +# Install NuGet +try { + nuget restore .\packages.config -PackagesDirectory .\packages + Write-Host "WDK installed at .\packages" +} catch { + Write-Error "Failed to restore packages using NuGet. Error: $_" + exit 1 +} + $folders = @( - "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.x64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.arm64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591", - "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591" + ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion", + ".\packages\Microsoft.Windows.SDK.CPP.x64.$wdkVersion", + ".\packages\Microsoft.Windows.SDK.CPP.arm64.$wdkVersion", + ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion", + ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion" ) foreach ($folder in $folders) { if (-Not (Test-Path $folder)) { - Write-Error "Required folder $folder is missing." - exit 1 -} + Write-Error "Required folder $folder is missing." + exit 1 + } } function Copy-File { param ( @@ -29,33 +64,33 @@ function Copy-File { } # Copying signtool to WDK bin folder -$signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\signtool.exe" -$signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\signtool.exe" -$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" -$destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" +$signtoolx64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\signtool.exe" +$signtoolX86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\signtool.exe" +$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationX86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" Copy-File -sourcePath $signtoolX64 -destinationPath $destinationX64 -fileName "signtool.exe" Copy-File -sourcePath $signtoolX86 -destinationPath $destinationX86 -fileName "signtool.exe" # Copying certmgr to WDK bin folder -$certmgrx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\certmgr.exe" -$certmgrX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\certmgr.exe" -$certmgrARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\certmgr.exe" -$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" -$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" -$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" +$certmgrx86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\certmgr.exe" +$certmgrX64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\certmgr.exe" +$certmgrARM64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\certmgr.exe" +$destinationx86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" +$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationARM64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" Copy-File -sourcePath $certmgrx86 -destinationPath $destinationx86 -fileName "certmgr.exe" Copy-File -sourcePath $certmgrX64 -destinationPath $destinationx64 -fileName "certmgr.exe" Copy-File -sourcePath $certmgrARM64 -destinationPath $destinationARM64 -fileName "certmgr.exe" # Copying makecert to WDK bin folder -$makecertx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x86\MakeCert.exe" -$makecertX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\x64\MakeCert.exe" -$makecertARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.10.0.26100.1591\c\bin\10.0.26100.0\arm64\MakeCert.exe" -$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x86" -$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\x64" -$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\bin\10.0.26100.0\ARM64" +$makecertx86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\MakeCert.exe" +$makecertX64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\MakeCert.exe" +$makecertARM64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\MakeCert.exe" +$destinationx86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" +$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationARM64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" Copy-File -sourcePath $makecertx86 -destinationPath $destinationx86 -fileName "MakeCert.exe" Copy-File -sourcePath $makecertX64 -destinationPath $destinationx64 -fileName "MakeCert.exe" @@ -76,11 +111,11 @@ function Copy-Folder { } # Copying km, um, kmdf, umdf ARM64 headers to x64 folders -Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\km\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\km" -Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\10.0.26100.0\um\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\10.0.26100.0\um" -Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\kmdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\kmdf" -Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.10.0.26100.1591\c\Lib\wdf\umdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c\Lib\wdf\umdf" - -# Set NugetWdkContentRoot environment variable -$NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.10.0.26100.1591\c" -Write-Output "NugetWdkContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV \ No newline at end of file +Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\km\arm64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\km" +Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\um\arm64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\um" +Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\kmdf\ARM64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\kmdf" +Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\umdf\ARM64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\umdf" + +# Set WDKContentRoot environment variable +$NugetWdkContentRoot = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c" +Write-Output "WDKContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 8a50c5f0..0c8da98e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -20,7 +20,10 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + # Use versions numbers for NuGet WDK packages + # - 10.0.26100.1882 + # - 10.0.26100.1591 + - 10.0.26100.1 llvm: - 17.0.6 @@ -69,9 +72,16 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi + shell: bash - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 07af01dc..4f4f6351 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -98,19 +98,6 @@ pub fn detect_wdk_content_root() -> Option { ); } - // If NugetWdkContentRoot is present in environment, use it - if let Ok(wdk_content_root) = env::var("NugetWdkContentRoot") { - let path = Path::new(wdk_content_root.as_str()); - if path.is_dir() { - return Some(path.to_path_buf()); - } - eprintln!( - "NugetWdkContentRoot was detected to be {}, but does not exist or is not a valid \ - directory.", - path.display() - ); - } - // If MicrosoftKitRoot environment variable is set, use it to set WDKContentRoot if let Ok(microsoft_kit_root) = env::var("MicrosoftKitRoot") { let path = Path::new(microsoft_kit_root.as_str()); @@ -247,9 +234,7 @@ pub fn validate_wdk_version_format>(version_string: S) -> bool { let version_parts: Vec<&str> = version.split('.').collect(); // First, check if we have "10" as our first value - if !version_parts.first().is_some_and(|first| *first == "10") { - // FIXME: Once is_some_or is stabilized, replace the above with: - // if version_parts.first().is_none_or(|first| *first != "10") { + if version_parts.first().is_none_or(|first| *first != "10") { return false; } From 37b4bd6d0a95dc6ec2cf32f2eb44c876f3f75260 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 10:15:57 -0700 Subject: [PATCH 46/52] Update Install WDK (NuGet) step in other workflows --- .github/workflows/codeql.yml | 12 +++++++++--- .github/workflows/docs.yaml | 12 +++++++++--- .github/workflows/lint.yaml | 12 +++++++++--- .github/workflows/local-development-makefile.yaml | 13 +++++++++---- .github/workflows/test.yaml | 12 +++++++++--- 5 files changed, 45 insertions(+), 16 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 0672b66d..f36611c5 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -18,7 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - 10.0.26100.1 llvm: - 17.0.6 @@ -71,9 +71,15 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 10039a50..70bbb994 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -18,7 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - 10.0.26100.1 llvm: - 17.0.6 @@ -67,9 +67,15 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 6de78c6c..576e8e1a 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -17,7 +17,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - 10.0.26100.1 llvm: - 17.0.6 @@ -66,9 +66,15 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index 8826ac64..b5801a2a 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -18,7 +18,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - 10.0.26100.1 llvm: - 17.0.6 @@ -58,10 +58,15 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 - + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi - name: Install Nightly Rust Toolchain (${{ matrix.target_triple }}) uses: dtolnay/rust-toolchain@nightly with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 8c920b2e..175171c6 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -15,7 +15,7 @@ jobs: matrix: wdk: - Microsoft.WindowsWDK.10.0.22621 # NI WDK - - Microsoft.Windows.WDK # Latest WDK + - 10.0.26100.1 llvm: - 17.0.6 @@ -64,9 +64,15 @@ jobs: } - name: Install ${{ matrix.wdk }} (NuGet) - if: matrix.wdk == 'Microsoft.Windows.WDK' + if: startsWith(matrix.wdk, '10.0.') run: | - ./.github/scripts/nuget-install-wdk.ps1 + wdk="${{ matrix.wdk }}" + if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk + else + echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + exit 1 + fi - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From f4087df7eb663447cb1e2df0ce8114e3c25e0e02 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 10:25:02 -0700 Subject: [PATCH 47/52] Fix Install WDK (NuGet) script's condition in accordance to the powershell shell --- .github/workflows/build.yaml | 11 +++++------ .github/workflows/docs.yaml | 10 +++++----- .github/workflows/lint.yaml | 10 +++++----- .github/workflows/local-development-makefile.yaml | 10 +++++----- .github/workflows/test.yaml | 10 +++++----- 5 files changed, 25 insertions(+), 26 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0c8da98e..7f3a3f55 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -74,14 +74,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi - shell: bash + } - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 70bbb994..d85b30ff 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -69,13 +69,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi + } - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/lint.yaml b/.github/workflows/lint.yaml index 576e8e1a..2c4eff73 100644 --- a/.github/workflows/lint.yaml +++ b/.github/workflows/lint.yaml @@ -68,13 +68,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi + } - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/.github/workflows/local-development-makefile.yaml b/.github/workflows/local-development-makefile.yaml index b5801a2a..377eef39 100644 --- a/.github/workflows/local-development-makefile.yaml +++ b/.github/workflows/local-development-makefile.yaml @@ -60,13 +60,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi + } - name: Install Nightly Rust Toolchain (${{ matrix.target_triple }}) uses: dtolnay/rust-toolchain@nightly with: diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 175171c6..d9e78685 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -66,13 +66,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi + } - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master From a559f6d33e48e8aa9b4add2651dcdb7c279760a1 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 10:53:50 -0700 Subject: [PATCH 48/52] Fix Install WDK (NuGet) script's condition in codeql.yml; Fix is_none_or issue in utils.rs --- .github/workflows/codeql.yml | 10 +++++----- crates/wdk-build/src/utils.rs | 4 +++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index f36611c5..38fe7fd3 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -73,13 +73,13 @@ jobs: - name: Install ${{ matrix.wdk }} (NuGet) if: startsWith(matrix.wdk, '10.0.') run: | - wdk="${{ matrix.wdk }}" - if [[ "$wdk" =~ ^10\.0\.[0-9]{5}\.[0-9]{1,4}$ ]]; then + $wdk = '${{ matrix.wdk }}' + if ($wdk -match '^10\.0\.\d{5}\.\d{1,4}$') { ./.github/scripts/nuget-install-wdk.ps1 -wdkVersion $wdk - else - echo "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" + } else { + Write-Host "WDK version $wdk does not match the required format 10.0.{5 digit number}.{1 to 4 digit number}" exit 1 - fi + } - name: Install Rust Toolchain (${{ matrix.rust_toolchain }}) uses: dtolnay/rust-toolchain@master diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index 4f4f6351..c8b6a3ee 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -234,7 +234,9 @@ pub fn validate_wdk_version_format>(version_string: S) -> bool { let version_parts: Vec<&str> = version.split('.').collect(); // First, check if we have "10" as our first value - if version_parts.first().is_none_or(|first| *first != "10") { + if !version_parts.first().is_some_and(|first| *first == "10") { + // FIXME: Once is_some_or is stabilized, replace the above with: + // if version_parts.first().is_none_or(|first| *first != "10") { return false; } From a350aa518c369cb17225bffb2315d4726934dcde Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 11:13:16 -0700 Subject: [PATCH 49/52] change output directory of NuGet restore to C:\WDK --- .github/scripts/nuget-install-wdk.ps1 | 58 +++++++++++++-------------- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/.github/scripts/nuget-install-wdk.ps1 b/.github/scripts/nuget-install-wdk.ps1 index 01a93d35..3d25ec5a 100644 --- a/.github/scripts/nuget-install-wdk.ps1 +++ b/.github/scripts/nuget-install-wdk.ps1 @@ -9,7 +9,7 @@ Write-Host "Installing WDK version $wdkVersion" Write-Host "Major version number: $majorVersionNum" # Update the packages.config file with the version passed as parameter -$packagesConfigPath = ".\packages.config" +$packagesConfigPath = "C:\WDK.config" if (Test-Path $packagesConfigPath) { [xml]$packagesConfig = Get-Content $packagesConfigPath @@ -28,19 +28,19 @@ if (Test-Path $packagesConfigPath) { # Install NuGet try { - nuget restore .\packages.config -PackagesDirectory .\packages - Write-Host "WDK installed at .\packages" + nuget restore .\packages.config -PackagesDirectory C:\WDK + Write-Host "WDK installed at C:\WDK" } catch { Write-Error "Failed to restore packages using NuGet. Error: $_" exit 1 } $folders = @( - ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion", - ".\packages\Microsoft.Windows.SDK.CPP.x64.$wdkVersion", - ".\packages\Microsoft.Windows.SDK.CPP.arm64.$wdkVersion", - ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion", - ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion" + "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion", + "C:\WDK\Microsoft.Windows.SDK.CPP.x64.$wdkVersion", + "C:\WDK\Microsoft.Windows.SDK.CPP.arm64.$wdkVersion", + "C:\WDK\Microsoft.Windows.WDK.ARM64.$wdkVersion", + "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion" ) foreach ($folder in $folders) { if (-Not (Test-Path $folder)) { @@ -64,33 +64,33 @@ function Copy-File { } # Copying signtool to WDK bin folder -$signtoolx64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\signtool.exe" -$signtoolX86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\signtool.exe" -$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" -$destinationX86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" +$signtoolx64 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\signtool.exe" +$signtoolX86 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\signtool.exe" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationX86 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" Copy-File -sourcePath $signtoolX64 -destinationPath $destinationX64 -fileName "signtool.exe" Copy-File -sourcePath $signtoolX86 -destinationPath $destinationX86 -fileName "signtool.exe" # Copying certmgr to WDK bin folder -$certmgrx86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\certmgr.exe" -$certmgrX64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\certmgr.exe" -$certmgrARM64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\certmgr.exe" -$destinationx86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" -$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" -$destinationARM64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" +$certmgrx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\certmgr.exe" +$certmgrX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\certmgr.exe" +$certmgrARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\certmgr.exe" +$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" Copy-File -sourcePath $certmgrx86 -destinationPath $destinationx86 -fileName "certmgr.exe" Copy-File -sourcePath $certmgrX64 -destinationPath $destinationx64 -fileName "certmgr.exe" Copy-File -sourcePath $certmgrARM64 -destinationPath $destinationARM64 -fileName "certmgr.exe" # Copying makecert to WDK bin folder -$makecertx86 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\MakeCert.exe" -$makecertX64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\MakeCert.exe" -$makecertARM64 = ".\packages\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\MakeCert.exe" -$destinationx86 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" -$destinationx64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" -$destinationARM64 = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" +$makecertx86 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x86\MakeCert.exe" +$makecertX64 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\x64\MakeCert.exe" +$makecertARM64 = "C:\WDK\Microsoft.Windows.SDK.CPP.$wdkVersion\c\bin\$majorVersionNum.0\arm64\MakeCert.exe" +$destinationx86 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x86" +$destinationx64 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\x64" +$destinationARM64 = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\bin\$majorVersionNum.0\ARM64" Copy-File -sourcePath $makecertx86 -destinationPath $destinationx86 -fileName "MakeCert.exe" Copy-File -sourcePath $makecertX64 -destinationPath $destinationx64 -fileName "MakeCert.exe" @@ -111,11 +111,11 @@ function Copy-Folder { } # Copying km, um, kmdf, umdf ARM64 headers to x64 folders -Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\km\arm64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\km" -Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\um\arm64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\um" -Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\kmdf\ARM64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\kmdf" -Copy-Folder -sourceFolder ".\packages\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\umdf\ARM64" -destinationFolder ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\umdf" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\km\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\km" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\$majorVersionNum.0\um\arm64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\$majorVersionNum.0\um" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\kmdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\kmdf" +Copy-Folder -sourceFolder "C:\WDK\Microsoft.Windows.WDK.ARM64.$wdkVersion\c\Lib\wdf\umdf\ARM64" -destinationFolder "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c\Lib\wdf\umdf" # Set WDKContentRoot environment variable -$NugetWdkContentRoot = ".\packages\Microsoft.Windows.WDK.x64.$wdkVersion\c" +$NugetWdkContentRoot = "C:\WDK\Microsoft.Windows.WDK.x64.$wdkVersion\c" Write-Output "WDKContentRoot=$NugetWdkContentRoot" >> $env:GITHUB_ENV \ No newline at end of file From 58686732cbc267a96f594427bdd5b069fd16abb2 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Wed, 16 Oct 2024 11:18:15 -0700 Subject: [PATCH 50/52] fix packagesConfigPath in nuget-install-wdk.ps1 --- .github/scripts/nuget-install-wdk.ps1 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/scripts/nuget-install-wdk.ps1 b/.github/scripts/nuget-install-wdk.ps1 index 3d25ec5a..0b32da60 100644 --- a/.github/scripts/nuget-install-wdk.ps1 +++ b/.github/scripts/nuget-install-wdk.ps1 @@ -9,7 +9,7 @@ Write-Host "Installing WDK version $wdkVersion" Write-Host "Major version number: $majorVersionNum" # Update the packages.config file with the version passed as parameter -$packagesConfigPath = "C:\WDK.config" +$packagesConfigPath = ".\packages.config" if (Test-Path $packagesConfigPath) { [xml]$packagesConfig = Get-Content $packagesConfigPath @@ -26,7 +26,7 @@ if (Test-Path $packagesConfigPath) { Write-Error "packages.config file not found" } -# Install NuGet +# Install WDK using NuGet try { nuget restore .\packages.config -PackagesDirectory C:\WDK Write-Host "WDK installed at C:\WDK" From a422a4cf0fbb971656ca7faede585b0777ce83ee Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Tue, 22 Oct 2024 09:46:29 -0700 Subject: [PATCH 51/52] use is_none_or() for clippy::nominal_bool --- crates/wdk-build/src/utils.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/crates/wdk-build/src/utils.rs b/crates/wdk-build/src/utils.rs index c8b6a3ee..4f4f6351 100644 --- a/crates/wdk-build/src/utils.rs +++ b/crates/wdk-build/src/utils.rs @@ -234,9 +234,7 @@ pub fn validate_wdk_version_format>(version_string: S) -> bool { let version_parts: Vec<&str> = version.split('.').collect(); // First, check if we have "10" as our first value - if !version_parts.first().is_some_and(|first| *first == "10") { - // FIXME: Once is_some_or is stabilized, replace the above with: - // if version_parts.first().is_none_or(|first| *first != "10") { + if version_parts.first().is_none_or(|first| *first != "10") { return false; } From 02562756fe4b0240e1caa1bd7bc79920917d8648 Mon Sep 17 00:00:00 2001 From: Shravan Vasista Date: Tue, 22 Oct 2024 09:52:23 -0700 Subject: [PATCH 52/52] remove unnecessary hashes around raw string literal --- crates/wdk-sys/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/wdk-sys/build.rs b/crates/wdk-sys/build.rs index f0b37dd7..37f350f3 100644 --- a/crates/wdk-sys/build.rs +++ b/crates/wdk-sys/build.rs @@ -127,13 +127,13 @@ macro_rules! call_unsafe_wdf_function_binding {{ }}"# ); static ref TEST_STUBS_TEMPLATE: String = format!( - r#" + r" use crate::WDFFUNC; /// Stubbed version of the symbol that [`WdfFunctions`] links to so that test targets will compile #[no_mangle] pub static mut {WDFFUNCTIONS_SYMBOL_NAME_PLACEHOLDER}: *const WDFFUNC = core::ptr::null(); -"#, +", ); }