Skip to content

Commit a152f49

Browse files
authored
Merge branch 'main' into derives-library
Signed-off-by: Leon Durrenberger <leon.durrenberger@gmail.com>
2 parents f119754 + 21ec8f8 commit a152f49

37 files changed

Lines changed: 2438 additions & 1474 deletions

File tree

.github/actions/install-winget/action.yaml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,15 +80,16 @@ runs:
8080
# Install all dependency packages for the detected architecture
8181
$depsInstalled = 0
8282
$depsFailed = 0
83-
Get-ChildItem -Path $depsDir -Recurse -Include '*.appx', '*.msix' | Where-Object {
83+
$depPackages = Get-ChildItem -Path $depsDir -Recurse -Include '*.appx', '*.msix' | Where-Object {
8484
$_.FullName -match "[\\/]$arch[\\/]"
85-
} | ForEach-Object {
85+
}
86+
foreach ($pkg in $depPackages) {
8687
try {
87-
Add-AppxPackage -Path $_.FullName -ForceApplicationShutdown -ForceUpdateFromAnyVersion -ErrorAction Stop
88-
Write-Host "Installed dependency: $($_.Name)"
88+
Add-AppxPackage -Path $pkg.FullName -ForceApplicationShutdown -ForceUpdateFromAnyVersion -ErrorAction Stop
89+
Write-Host "Installed dependency: $($pkg.Name)"
8990
$depsInstalled++
9091
} catch {
91-
Write-Host "Dependency $($_.Name): $($_.Exception.Message)"
92+
Write-Host "Dependency $($pkg.Name): $($_.Exception.Message)"
9293
$depsFailed++
9394
}
9495
}

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,9 @@ jobs:
113113
run: cargo +${{ matrix.rust_toolchain }} install --path=crates/cargo-wdk --profile ${{ matrix.cargo_profile }} --locked --force
114114

115115
- name: Build & Package Examples (via cargo-wdk)
116-
run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample
116+
run: cargo +${{ matrix.rust_toolchain }} wdk build --locked --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }} --sample
117117
working-directory: ./examples
118118

119119
- name: Run build on tests folder (via cargo-wdk)
120-
run: cargo +${{ matrix.rust_toolchain }} wdk build --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }}
120+
run: cargo +${{ matrix.rust_toolchain }} wdk build --locked --profile ${{ matrix.cargo_profile }} --target-arch ${{ matrix.target_triple.arch }}
121121
working-directory: ./tests

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108

109109
- name: Upload Coverage to Codecov
110110
if: matrix.runner.arch != 'arm64' && github.repository == 'microsoft/windows-drivers-rs' # Skip for forks because they may not have CODECOV_TOKEN
111-
uses: codecov/codecov-action@v5
111+
uses: codecov/codecov-action@v7
112112
with:
113113
files: target/codecov.info
114114
token: ${{ secrets.CODECOV_TOKEN }}

Cargo.lock

Lines changed: 9 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ anyhow = "1.0.97"
3939
assert_cmd = "2.0.17"
4040
assert_fs = "1.1.3"
4141
bindgen = "0.72.1"
42-
bitflags = "2.6.0"
4342
camino = "1.1.9"
4443
cargo_metadata = "0.19.2"
4544
cc = "1.2.39"

crates/cargo-wdk/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ version = "0.1.1"
1414
anyhow.workspace = true
1515
cargo_metadata.workspace = true
1616
clap = { features = ["derive"], workspace = true }
17-
clap-cargo.workspace = true
17+
clap-cargo = { features = ["cargo_metadata"], workspace = true }
1818
clap-verbosity-flag.workspace = true
1919
include_dir.workspace = true
2020
mockall.workspace = true

crates/cargo-wdk/README.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,16 +65,23 @@ Usage: cargo wdk build [OPTIONS]
6565
Options:
6666
--profile <PROFILE> Build artifacts with the specified profile
6767
--target-arch <TARGET_ARCH> Build for the target architecture
68+
--sign-mode <SIGN_MODE> Driver signing mode [default: test] [possible values: off, test]
6869
--verify-signature Verify the signature
6970
--sample Build sample class driver project
71+
--locked Assert that `Cargo.lock` will remain unchanged
7072
-h, --help Print help
7173
74+
Feature Selection:
75+
--all-features Activate all available features
76+
--no-default-features Do not activate the `default` feature
77+
-F, --features <FEATURES> Space-separated list of features to activate
78+
7279
Verbosity:
7380
-v, --verbose... Increase logging verbosity
7481
-q, --quiet... Decrease logging verbosity
7582
```
7683

77-
`build` takes a number of inputs specifying build profile (`dev` or `release`), target architecture (`amd64` or `arm64`), a flag enabling signature verification and a flag indicating a sample driver along with verbosity flags.
84+
`build` takes a number of inputs specifying build profile (`dev` or `release`), target architecture (`amd64` or `arm64`), the driver signing mode, a flag enabling signature verification and a flag indicating a sample driver along with verbosity flags.
7885

7986
When the command completes the packaged driver artifacts are emitted at the path `target\<profile>\<project-name>-package`.
8087

@@ -90,9 +97,14 @@ If you have a workspace with a mix of sample and non-sample driver projects, the
9097

9198
#### Signing and Verification
9299

93-
To sign driver artifacts `build` looks for a certificate called `WDRLocalTestCert` in a store called `WDRTestCertStore`. Make sure you place your signing certificate there with that name. If no certificate is found, `build` will automatically generate a new self-signed one and add it for you.
100+
The `build` command has a `--sign-mode` flag that controls how driver artifacts are signed. It accepts the following values:
101+
102+
- `test` (default): Sign with a test certificate. The command looks for a certificate called `WDRLocalTestCert` in a store called `WDRTestCertStore`. If you wish to use your own certificate, add it to the same store with the same name. Otherwise a self-signed certificate will be automatically generated, added, and used for signing.
103+
- `off`: Skip signing entirely. This is useful when you intend to sign the artifacts later with your own toolchain.
94104

95-
If the `--verify-signature` flag is provided, the signatures are verified after signing. For verification to work, make sure you add a copy of the signing certificate in the `Trusted Root Certification Authorities` store. For security reasons `build` does not automatically do this even when it automatically generates the cert. You will have to always perform this step manually.
105+
If the `--verify-signature` flag is provided, the signatures are verified after signing. For verification to work, make sure you add a copy of the signing certificate in the `Trusted Root Certification Authorities` store. For security reasons `build` does not automatically do this even when it automatically generates the cert. You will have to always perform this step manually.
106+
107+
`--verify-signature` cannot be combined with `--sign-mode=off` because if signing is off there is nothing to verify. Passing both will cause `build` to fail with an error.
96108

97109
#### Examples
98110

@@ -113,3 +125,9 @@ If the `--verify-signature` flag is provided, the signatures are verified after
113125
```pwsh
114126
cargo wdk build --target-arch amd64
115127
```
128+
129+
- To build a driver project with signing off, navigate to the root of the project and run:
130+
131+
```pwsh
132+
cargo wdk build --sign-mode off
133+
```

0 commit comments

Comments
 (0)