Skip to content

Commit 19e5c3a

Browse files
committed
Merge branch 'develop'
2 parents d65f6bb + 5c4ceae commit 19e5c3a

File tree

8 files changed

+71
-113
lines changed

8 files changed

+71
-113
lines changed

.github/scripts/Install-Vsix.ps1

Lines changed: 0 additions & 38 deletions
This file was deleted.

.github/workflows/Code-Scanning.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ on:
88
branches:
99
- main
1010
- develop
11+
paths-ignore:
12+
- '**.md'
13+
- 'LICENSE'
1114
pull_request:
1215
# The branches below must be a subset of the branches above
1316
branches:
1417
- main
1518
- develop
19+
paths-ignore:
20+
- '**.md'
21+
- 'LICENSE'
1622

1723
# Allow manual scheduling
1824
workflow_dispatch:
@@ -37,9 +43,6 @@ jobs:
3743
with:
3844
submodules: 'recursive'
3945

40-
- name: Install WDK VSIX
41-
run: .\.github\scripts\Install-Vsix.ps1
42-
4346
- name: Install Nuget Packages
4447
run: nuget restore .\packages.config -PackagesDirectory .\packages\
4548

.github/workflows/ci-pr.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ jobs:
2222
with:
2323
submodules: 'recursive'
2424

25-
- name: Install WDK VSIX
26-
run: .\.github\scripts\Install-Vsix.ps1
27-
2825
- name: Install Nuget Packages
2926
run: nuget restore .\packages.config -PackagesDirectory .\packages\
3027

.github/workflows/ci.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,6 @@ jobs:
2222
with:
2323
submodules: 'recursive'
2424

25-
- name: Install WDK VSIX
26-
run: .\.github\scripts\Install-Vsix.ps1
27-
2825
- name: Install Nuget Packages
2926
run: nuget restore .\packages.config -PackagesDirectory .\packages\
3027

Build-SampleSet.ps1

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -56,20 +56,17 @@ finally {
5656
# Determine build environment: 'GitHub', 'NuGet', 'EWDK', or 'WDK'.
5757
# Determine build number (used for exclusions based on build number). Five digits. Say, '22621'.
5858
# Determine NuGet package version (if applicable).
59-
# Determine WDK vsix version.
6059
#
6160
$build_environment=""
6261
$build_number=0
6362
$nuget_package_version=0
64-
$vsix_version=""
6563
#
66-
# In Github we build using NuGet and get the version from packages and vsix version from env var set from the install vsix step.
64+
# In Github we build using NuGet.
6765
#
6866
if ($env:GITHUB_REPOSITORY) {
6967
$build_environment="GitHub"
7068
$nuget_package_version=([regex]'(?<=x64\.)(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches((Get-Childitem .\packages\*WDK.x64* -Name)).Value
7169
$build_number=$nuget_package_version.split('.')[2]
72-
$vsix_version = $env:SAMPLES_VSIX_VERSION
7370
}
7471
#
7572
# WDK NuGet will require presence of a folder 'packages'. The version is sourced from repo .\Env-Vars.ps1.
@@ -107,16 +104,12 @@ else {
107104
exit 1
108105
}
109106
#
110-
# Get the vsix version from packages if not set
111-
if (-not $vsix_version) {
112-
$vsix_version = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name
113-
if ($vsix_version) {
114-
$vsix_version = $vsix_version.split('=')[1]
115-
}
116-
else {
117-
Write-Error "No version of the WDK VSIX could be found. The WDK VSIX is not installed."
118-
exit 1
119-
}
107+
# Get the WDK extension version from installed packages
108+
$wdk_extension_ver = ls "${env:ProgramData}\Microsoft\VisualStudio\Packages\Microsoft.Windows.DriverKit,version=*" | Select -ExpandProperty Name
109+
$wdk_extension_ver = ([regex]'(\d+\.)(\d+\.)(\d+\.)(\d+)').Matches($wdk_extension_ver).Value
110+
if (-not $wdk_extension_ver) {
111+
Write-Error "No version of the WDK Visual Studio Extension could be found. The WDK Extension is not installed."
112+
exit 1
120113
}
121114
#
122115
#
@@ -180,20 +173,22 @@ $jresult = @{
180173

181174
$SolutionsTotal = $sampleSet.Count * $Configurations.Count * $Platforms.Count
182175

183-
Write-Output ("Build Environment: " + $build_environment)
184-
Write-Output ("Build Number: " + $build_number)
185-
if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) { Write-Output ("Nuget Package Version: " + $nuget_package_version) }
186-
Write-Output ("WDK VSIX Version: " + $vsix_version)
187-
Write-Output ("Samples: " + $sampleSet.Count)
188-
Write-Output ("Configurations: " + $Configurations.Count + " (" + $Configurations + ")")
189-
Write-Output ("Platforms: " + $Platforms.Count + " (" + $Platforms + ")")
176+
Write-Output "WDK Build Environment: $build_environment"
177+
Write-Output "WDK Build Number: $build_number"
178+
if (($build_environment -eq "GitHub") -or ($build_environment -eq "NuGet")) {
179+
Write-Output "WDK Nuget Version: $nuget_package_version"
180+
}
181+
Write-Output "WDK Extension Version: $wdk_extension_ver"
182+
Write-Output "Samples: $($sampleSet.Count)"
183+
Write-Output "Configurations: $($Configurations.Count) ($Configurations)"
184+
Write-Output "Platforms: $($Platforms.Count) ($Platforms)"
190185
Write-Output "InfVerif_AdditionalOptions: $InfVerif_AdditionalOptions"
191186
Write-Output "Combinations: $SolutionsTotal"
192187
Write-Output "LogicalProcessors: $LogicalProcessors"
193188
Write-Output "ThrottleFactor: $ThrottleFactor"
194189
Write-Output "ThrottleLimit: $ThrottleLimit"
195190
Write-Output "WDS_WipeOutputs: $env:WDS_WipeOutputs"
196-
Write-Output ("Disk Remaining (GB): " + (((Get-Volume ($DriveLetter = (Get-Item ".").PSDrive.Name)).SizeRemaining / 1GB)))
191+
Write-Output "Disk Remaining (GB): $(((Get-Volume ((Get-Item ".").PSDrive.Name)).SizeRemaining) / 1GB)"
197192
Write-Output ""
198193
Write-Output "T: Combinations"
199194
Write-Output "B: Built"

Building-Locally.md

Lines changed: 44 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,19 @@
22

33
## Step 1: Install Tools
44

5-
```
5+
```powershell
66
winget install --id Microsoft.Powershell --source winget
77
winget install --id Git.Git --source winget
88
```
99

1010
For using WDK NuGet feed based build additionally:
11-
```
11+
12+
```powershell
1213
winget install --id Microsoft.NuGet --source winget
1314
```
1415

16+
---
17+
1518
## Step 2: Optional: Disable Strong Name Validation
1619

1720
When: This step is only required if you will be using pre-release versions of the WDK.
@@ -26,16 +29,20 @@ reg add HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\StrongName\Verification\*,31bf3856
2629
reg add HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\StrongName\Verification\*,31bf3856ad364e35 /v TestPublicKey /t REG_SZ /d 00240000048000009400000006020000002400005253413100040000010001003f8c902c8fe7ac83af7401b14c1bd103973b26dfafb2b77eda478a2539b979b56ce47f36336741b4ec52bbc51fecd51ba23810cec47070f3e29a2261a2d1d08e4b2b4b457beaa91460055f78cc89f21cd028377af0cc5e6c04699b6856a1e49d5fad3ef16d3c3d6010f40df0a7d6cc2ee11744b5cfb42e0f19a52b8a29dc31b0 /f
2730
```
2831

32+
---
33+
2934
## Step 3: Optional: Install Microsoft .NET Framework 4.7.2 Targeting Pack and Microsoft .NET Framework 4.8.1 SDK
3035

3136
When: This step is only required to build sample usb\usbview .
3237

3338
### Option A: Install VS Components
39+
3440
Easy: If you will install Visual Studio (see later) you may at that point select to add both of following individual components:
3541
* .NET Framework 4.7.2 targeting pack
3642
* .NET Framework 4.8.1 SDK
3743

3844
### Option B: Use EWDK
45+
3946
Easy: If you use EWDK, then all necessary prequisites are included.
4047

4148
### Option C: Install Developer Pack
@@ -52,24 +59,30 @@ This will install following Apps:
5259
* Microsoft .NET Framework 4.8.1 Targeting Pack
5360
* Microsoft .NET Framework 4.8.1 Targeting Pack (ENU)
5461

62+
---
63+
5564
## Step 4: Clone Windows Driver Samples and checkout relevant branch
5665

57-
```
58-
cd path\to\your\repos
59-
git clone --recurse-submodules https://github.com/microsoft/Windows-driver-samples.git
60-
cd Windows-driver-samples
66+
```powershell
67+
cd "path\to\your\repos"
68+
git clone --recurse-submodules "https://github.com/microsoft/Windows-driver-samples.git"
69+
cd ".\Windows-driver-samples"
6170
```
6271

6372
If you are planning to use in-market WDK, then you would typically want to use the 'main' branch:
73+
6474
```
6575
git checkout main
6676
```
6777

6878
If you are planning to use a WDK Preview or WDK EEAP release, then you would typically want to use the 'develop' branch:
79+
6980
```
7081
git checkout develop
7182
```
7283

84+
---
85+
7386
## Step 5: Create a "driver build environment"
7487

7588
To build the Windows Driver Samples you need a "driver build environment". In essence an environment that consist of following prerequisites:
@@ -78,53 +91,55 @@ To build the Windows Driver Samples you need a "driver build environment". In e
7891
* The Windows Driver Kit.
7992

8093
### Option A: Use WDK NuGet Packages
81-
* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete "Step 1". You do not need to install the SDK or the WDK.
82-
* Install the Visual Studio Windows Driver Kit Extension (WDK.vsix).
83-
* Open Visual Studio -> Extensions -> Manage Extensions... -> Browse.
84-
* In the search bar type: `Windows Driver Kit`.
85-
* Find the `Microsoft` signed extension.
86-
* Click the Install button.
94+
95+
* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, but only complete `Step 1`. You do not need to install the SDK or the WDK.
8796
* Launch a "Developer Command Prompt for VS 2022".
8897
* Restore WDK packages from feed :
8998

90-
```
91-
>cd path\to\your\repos\Windows-driver-samples
92-
>nuget restore -PackagesDirectory .\packages
99+
```powershell
100+
cd "path\to\your\repos\Windows-driver-samples"
101+
nuget restore -PackagesDirectory ".\packages"
93102
```
94103

95-
* When this is done you should have a .\packages folder that looks exactly as follows:
96-
```
97-
>cd path\to\your\repos\Windows-driver-samples
98-
>dir /b packages
104+
* When this is done you should have a .\packages folder that looks like example below:
105+
106+
```powershell
107+
cd "path\to\your\repos\Windows-driver-samples"
108+
dir /b packages
99109
Microsoft.Windows.SDK.CPP.10.0.26000.1
100110
Microsoft.Windows.SDK.CPP.x64.10.0.26000.1
101111
Microsoft.Windows.SDK.CPP.arm64.10.0.26000.1
102112
Microsoft.Windows.WDK.x64.10.0.26000.1
103113
Microsoft.Windows.WDK.arm64.10.0.26000.1
104114
```
115+
105116
### Option B: Use the Windows Driver Kit
117+
106118
* Here you will install each of above prerequisites one at a time.
107119
* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to install Visual Studio, SDK, and WDK.
108120
* Launch a "Developer Command Prompt for VS 2022".
109121

110122
### Option C: Use an Enterprise WDK
123+
111124
* You can also simply use the Enterprise WDK (EWDK), a standalone, self-contained command-line environment for building drivers that contains all prerequisites in one combined ISO.
112125
* See [Download the Windows Driver Kit (WDK)](https://learn.microsoft.com/en-us/windows-hardware/drivers/download-the-wdk) for instructions on how to download the EWDK.
113126
* Mount ISO image
114127
* Open a terminal
115128
* `.\LaunchBuildEnv`
116129

130+
---
117131

118132
## Step 6: Check all samples builds with expected results for all flavors
119133

120-
```
134+
```powershell
121135
pwsh
122136
.\Build-AllSamples
123137
```
124138
Above builds all samples for all configurations and platforms.
125139

126140
You can refine what exact samples to build, what configurations, and platforms to build. build Here are a few examples:
127-
```
141+
142+
```powershell
128143
# Get Help:
129144
Get-Help .\Build-AllSamples
130145
@@ -144,9 +159,9 @@ Get-Help .\Build-AllSamples
144159
.\Build-AllSamples -Samples '^tools.' -Configurations 'Debug' -Platforms 'x64'
145160
```
146161

147-
Expected output:
162+
Example of expected output:
163+
148164
```
149-
PS > .\build-AllSamples.ps1
150165
Build Environment: NuGet
151166
Build Number: 26100
152167
Samples: 132
@@ -190,6 +205,8 @@ Log files directory: .\_logs
190205
Overview report: .\_overview.htm
191206
```
192207

208+
---
209+
193210
## 7: NuGet - Additional Notes
194211

195212
To restore a specific version of our WDK NuGet packages:
@@ -201,12 +218,13 @@ Follow these steps before running "nuget restore" command:
201218
* Now you can run "nuget restore"
202219

203220
A few examples of how to interact with nuget:
204-
```
221+
222+
```powershell
205223
# To add an alternative online NuGet source:
206-
nuget sources add -Name "MyNuGetFeed" -Source https://nugetserver.com/_packaging/feedname/nuget/v3/index.json
224+
nuget sources add -Name "MyNuGetFeed" -Source "https://nugetserver.com/_packaging/feedname/nuget/v3/index.json"
207225
208226
# To add an alternative local NuGet source:
209-
nuget sources add -Name "MyNuGetFeed" -Source \\path\to\mylocalrepo
227+
nuget sources add -Name "MyNuGetFeed" -Source "\\path\to\mylocalrepo"
210228
211229
# To remove an alternative NuGet source:
212230
nuget sources remove -Name "MyNuGetFeed"

configuration.dsc.yaml

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ properties:
4242
- Microsoft.VisualStudio.Component.VC.MFC.ARM64
4343
- Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre
4444
- Microsoft.VisualStudio.Workload.NativeDesktop
45+
- Component.Microsoft.Windows.DriverKit
4546
- resource: Microsoft.WinGet.DSC/WinGetPackage
4647
id: sdkPackage
4748
directives:
@@ -62,20 +63,4 @@ properties:
6263
id: Microsoft.WindowsWDK.10.0.26100
6364
source: winget
6465
useLatest: true
65-
- resource: PSDscResources/Script
66-
id: wdkVsix
67-
dependsOn:
68-
- wdkPackage
69-
- vsComponents
70-
directives:
71-
description: Install Windows Driver Kit VSIX
72-
settings:
73-
GetScript: |
74-
return & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -version '[17.0,18.0)' -requires Microsoft.Windows.DriverKit -property installationVersion
75-
SetScript: |
76-
$installerPath = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -latest -products * -property enginePath | Join-Path -ChildPath 'VSIXInstaller.exe'
77-
if (Test-Path $installerPath) { & $installerPath /q "${env:ProgramFiles(x86)}\Windows Kits\10\Vsix\VS2022\10.0.26100.0\${env:PROCESSOR_ARCHITECTURE}\WDK.vsix" }
78-
TestScript: |
79-
$versionString = & "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -nologo -version '[17.0,18.0)' -requires Microsoft.Windows.DriverKit -property installationVersion
80-
return $versionString -match "^17\."
81-
configurationVersion: 0.2.0
66+
configurationVersion: 0.2.1

configuration_vsonly.dsc.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,5 @@ properties:
4242
- Microsoft.VisualStudio.Component.VC.MFC.ARM64
4343
- Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre
4444
- Microsoft.VisualStudio.Workload.NativeDesktop
45-
configurationVersion: 0.2.0
45+
- Component.Microsoft.Windows.DriverKit
46+
configurationVersion: 0.2.1

0 commit comments

Comments
 (0)