Skip to content

Commit c622700

Browse files
Add UMDF 2.15 WDF headers and improve Windows SDK detection
Added Windows Driver Frameworks (WDF) UMDF 2.15 public headers to ThirdParty/Windows-Driver-Frameworks. Updated GitHub Actions workflows to robustly detect and set Windows SDK paths and versions, and to pass these as MSBuild parameters for driver builds. This improves build reliability and ensures correct SDK usage in CI environments.
1 parent 12ceed1 commit c622700

37 files changed

+17619
-2
lines changed

.github/workflows/build-and-sign-sequential.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,44 @@ jobs:
3939
# Setup build environment
4040
- name: Setup MSBuild
4141
uses: microsoft/setup-msbuild@v2
42+
43+
- name: Detect Windows SDK (windows.h)
44+
shell: pwsh
45+
run: |
46+
$ErrorActionPreference = "Stop"
47+
48+
$kitsRoot = $null
49+
try {
50+
$kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
51+
} catch {
52+
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
53+
}
54+
55+
if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
56+
throw "Windows Kits root not found: $kitsRoot"
57+
}
58+
59+
$includeRoot = Join-Path $kitsRoot "Include"
60+
if (-not (Test-Path $includeRoot)) {
61+
throw "Windows Kits Include directory not found: $includeRoot"
62+
}
63+
64+
$best =
65+
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
66+
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
67+
Where-Object { Test-Path (Join-Path $_.FullName "um\Windows.h") } |
68+
Sort-Object -Property Name -Descending |
69+
Select-Object -First 1
70+
71+
if (-not $best) {
72+
throw "Could not find an SDK version directory containing um\\Windows.h under: $includeRoot"
73+
}
74+
75+
$sdkVersion = $best.Name
76+
Write-Output "Using WindowsSdkDir: $kitsRoot"
77+
Write-Output "Using WindowsTargetPlatformVersion: $sdkVersion"
78+
"WINDOWS_SDK_DIR=$kitsRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
79+
"WINDOWS_TARGET_PLATFORM_VERSION=$sdkVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
4280
4381
- name: Setup .NET
4482
uses: actions/setup-dotnet@v4

.github/workflows/ci-validation.yml

Lines changed: 40 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,44 @@ jobs:
2727
- name: Setup MSBuild
2828
uses: microsoft/setup-msbuild@v2
2929

30+
- name: Detect Windows SDK (windows.h)
31+
shell: pwsh
32+
run: |
33+
$ErrorActionPreference = "Stop"
34+
35+
$kitsRoot = $null
36+
try {
37+
$kitsRoot = (Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows Kits\Installed Roots" -Name "KitsRoot10" -ErrorAction Stop).KitsRoot10
38+
} catch {
39+
$kitsRoot = Join-Path ${env:ProgramFiles(x86)} "Windows Kits\10\"
40+
}
41+
42+
if (-not $kitsRoot -or -not (Test-Path $kitsRoot)) {
43+
throw "Windows Kits root not found: $kitsRoot"
44+
}
45+
46+
$includeRoot = Join-Path $kitsRoot "Include"
47+
if (-not (Test-Path $includeRoot)) {
48+
throw "Windows Kits Include directory not found: $includeRoot"
49+
}
50+
51+
$best =
52+
Get-ChildItem -Path $includeRoot -Directory -ErrorAction SilentlyContinue |
53+
Where-Object { $_.Name -match '^\d+\.\d+\.\d+\.\d+$' } |
54+
Where-Object { Test-Path (Join-Path $_.FullName "um\Windows.h") } |
55+
Sort-Object -Property Name -Descending |
56+
Select-Object -First 1
57+
58+
if (-not $best) {
59+
throw "Could not find an SDK version directory containing um\\Windows.h under: $includeRoot"
60+
}
61+
62+
$sdkVersion = $best.Name
63+
Write-Output "Using WindowsSdkDir: $kitsRoot"
64+
Write-Output "Using WindowsTargetPlatformVersion: $sdkVersion"
65+
"WINDOWS_SDK_DIR=$kitsRoot" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
66+
"WINDOWS_TARGET_PLATFORM_VERSION=$sdkVersion" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
67+
3068
- name: Setup Node.js
3169
uses: actions/setup-node@v4
3270
with:
@@ -44,7 +82,7 @@ jobs:
4482
Write-Output "Performing quick VDD compilation check..."
4583
$vddSln = "Virtual Display Driver (HDR)/MTTVDD.sln"
4684
if (-not (Test-Path $vddSln)) { throw "VDD solution file not found at: $vddSln" }
47-
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build
85+
msbuild $vddSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal /target:Build
4886
4987
- name: Quick VAD Compilation Check
5088
shell: pwsh
@@ -53,5 +91,5 @@ jobs:
5391
Write-Output "Performing quick VAD compilation check..."
5492
$vadSln = "Virtual-Audio-Driver (Latest Stable)/VirtualAudioDriver.sln"
5593
if (-not (Test-Path $vadSln)) { throw "VAD solution file not found at: $vadSln" }
56-
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /verbosity:minimal /target:Build
94+
msbuild $vadSln /p:Configuration=$env:BUILD_CONFIGURATION /p:Platform=x64 /p:WindowsSdkDir=$env:WINDOWS_SDK_DIR /p:WindowsTargetPlatformVersion=$env:WINDOWS_TARGET_PLATFORM_VERSION /verbosity:minimal /target:Build
5795
Lines changed: 134 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,134 @@
1+
/*++
2+
3+
Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
Module Name:
6+
7+
Wdf.h
8+
9+
Environment:
10+
11+
user mode
12+
13+
NOTE: This header is generated by stubwork.
14+
15+
To modify contents, add or remove <shared> or <umdf>
16+
tags in the corresponding .x and .y template files.
17+
18+
--*/
19+
20+
#pragma once
21+
22+
#ifndef WDF_EXTERN_C
23+
#ifdef __cplusplus
24+
#define WDF_EXTERN_C extern "C"
25+
#define WDF_EXTERN_C_START extern "C" {
26+
#define WDF_EXTERN_C_END }
27+
#else
28+
#define WDF_EXTERN_C
29+
#define WDF_EXTERN_C_START
30+
#define WDF_EXTERN_C_END
31+
#endif
32+
#endif
33+
34+
WDF_EXTERN_C_START
35+
36+
#ifndef _Dispatch_type_
37+
#include <driverspecs.h>
38+
#endif
39+
40+
__user_code
41+
42+
//
43+
// Fix for value-less UMDF_DRIVER identifier in UMDF 1.x.
44+
//
45+
#if defined(UMDF_DRIVER)
46+
#undef UMDF_DRIVER
47+
#endif
48+
#define UMDF_DRIVER (2)
49+
50+
#include <winioctl.h>
51+
#include <ntstatus.h>
52+
53+
#pragma warning( disable: 4201 ) // nonstandard extension used : nameless struct/union
54+
#pragma warning( disable: 4214 ) // nonstandard extension used : bit field types other than int
55+
56+
#include "WudfWdm.h"
57+
58+
#ifdef WDF_UMDF2_DRIVER_INTERNAL
59+
#include <WdfUtilityUm.h>
60+
#endif
61+
62+
//
63+
// Rename WdfFunctions to match version number. Build issues relating to
64+
// unresolved externals of WdfFunctions or WdfFunctions_XXXXX indicate
65+
// multiple WDF versions are being included. Ensure WDF version of all input
66+
// binaries match to resolve.
67+
//
68+
69+
#define WdfFunctions WdfFunctions_02015
70+
71+
typedef VOID (*WDFFUNC) (VOID);
72+
extern const WDFFUNC *WdfFunctions;
73+
74+
// Basic definitions
75+
#include "wdftypes.h"
76+
#include "wdfglobals.h"
77+
#include "wdffuncenum.h"
78+
#include "wdfstatus.h"
79+
#include "wdfassert.h"
80+
#include "wdfverifier.h"
81+
82+
// generic object
83+
#include "wdfobject.h"
84+
85+
// Synchronization
86+
#include "wdfsync.h"
87+
88+
#include "wdfcore.h"
89+
90+
#include "wdfdriver.h"
91+
92+
// Objects
93+
#include "WdfQueryInterface.h"
94+
#include "wdfmemory.h"
95+
#include "wdfchildlist.h"
96+
#include "wdffileobject.h"
97+
#include "wdfdevice.h"
98+
#include "wdfcollection.h"
99+
100+
#include "wdftimer.h"
101+
#include "wdfworkitem.h"
102+
#include "wdfinterrupt.h"
103+
#include "wdfresource.h"
104+
105+
// I/O
106+
#include "wdfrequest.h"
107+
#include "wdfiotarget.h"
108+
#include "wdfio.h"
109+
110+
// particular device types
111+
#include "wdffdo.h"
112+
#include "wdfpdo.h"
113+
#include "wdfcontrol.h"
114+
115+
#include "WdfWMI.h"
116+
117+
#include "wdfstring.h"
118+
#include "wdfregistry.h"
119+
120+
#include "wdfbugcodes.h"
121+
#include "wdfroletypes.h"
122+
#include "wdfhwaccess.h"
123+
124+
__declspec(dllexport)
125+
__control_entrypoint(DllExport)
126+
NTSTATUS
127+
FxDriverEntryUm(
128+
_In_ PVOID LoaderInterface,
129+
_In_ PVOID Context,
130+
_In_ PVOID DriverObject,
131+
_In_ PUNICODE_STRING RegistryPath
132+
);
133+
WDF_EXTERN_C_END
134+
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
/*++
2+
3+
Copyright (c) Microsoft Corporation. All rights reserved.
4+
5+
Module Name:
6+
7+
Wdfassert.h
8+
9+
Environment:
10+
11+
user mode
12+
13+
NOTE: This header is generated by stubwork.
14+
15+
To modify contents, add or remove <shared> or <umdf>
16+
tags in the corresponding .x and .y template files.
17+
18+
--*/
19+
20+
#pragma once
21+
22+
#ifndef WDF_EXTERN_C
23+
#ifdef __cplusplus
24+
#define WDF_EXTERN_C extern "C"
25+
#define WDF_EXTERN_C_START extern "C" {
26+
#define WDF_EXTERN_C_END }
27+
#else
28+
#define WDF_EXTERN_C
29+
#define WDF_EXTERN_C_START
30+
#define WDF_EXTERN_C_END
31+
#endif
32+
#endif
33+
34+
WDF_EXTERN_C_START
35+
36+
37+
#if (NTDDI_VERSION >= NTDDI_WIN2K)
38+
39+
//
40+
// Including here because RtlAssert is not declared in XP and Win2K headers for
41+
// free builds
42+
//
43+
NTSYSAPI
44+
VOID
45+
NTAPI
46+
RtlAssert(
47+
_In_ PVOID FailedAssertion,
48+
_In_ PVOID FileName,
49+
_In_ ULONG LineNumber,
50+
_In_opt_ PSTR Message
51+
);
52+
53+
//
54+
// WDFVERIFY is active both on checked and free build only if
55+
// the wdf verifier is tuned on
56+
//
57+
#define WDFVERIFY(exp) { \
58+
if ((WdfDriverGlobals->DriverFlags & WdfVerifyOn) && !(exp)) { \
59+
RtlAssert( #exp, __FILE__, __LINE__, NULL ); \
60+
} \
61+
}
62+
63+
#define VERIFY_IS_IRQL_PASSIVE_LEVEL() WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL)
64+
65+
//
66+
// Following macro is obsolete and it will be phased out in due course
67+
//
68+
#define IS_AT_PASSIVE() WDFVERIFY(KeGetCurrentIrql() == PASSIVE_LEVEL)
69+
70+
//
71+
// Compile time active "assert". File will not compile if this assert is FALSE.
72+
//
73+
// This compile time assert is designed to catch mismatch in the values of the
74+
// declared constants. So suppress the OACR warning #6326 generated about the
75+
// potential comparison of constants.
76+
//
77+
#define WDFCASSERT(c) { \
78+
__pragma(warning(suppress: 6326)) \
79+
switch(0) case (c): case 0: ; \
80+
}
81+
82+
#define DbgPrint(_fmt_, ...) DbgPrintEx(DPFLTR_DEFAULT_ID, DPFLTR_INFO_LEVEL, _fmt_, __VA_ARGS__)
83+
#ifndef KdPrint
84+
#if DBG
85+
#define KdPrint(_x_) DbgPrint _x_
86+
#else
87+
#define KdPrint(_x_)
88+
#endif
89+
#endif
90+
91+
#endif // (NTDDI_VERSION >= NTDDI_WIN2K)
92+
WDF_EXTERN_C_END
93+

0 commit comments

Comments
 (0)