From a942a455208b374f7c68de8364fc2455e9c64a1a Mon Sep 17 00:00:00 2001 From: Jevan Saks Date: Wed, 22 Apr 2026 16:36:58 -0700 Subject: [PATCH 1/3] Add SDK header patch system for shift-left metadata annotations Introduces a patch system that modifies SDK headers during ingestion (UpdateSDK.ps1 / RecompileIdlFilesForScraping.ps1) to add metadata annotations until the official SDK ships these changes. Patches are unified diffs in generation/WinSDK/patches/, organized by phase: - pre-midl/ : Applied before MIDL recompilation (IDL files, etc.) - post-midl/ : Applied after MIDL and header restores (.h files) Includes two proof-of-concept patches: - Uxtheme.h (post-midl): Adds conditional SET_THEME_APP_PROPERTIES_FLAGS enum under #ifdef _WIN32METADATA_ with typed function signatures - amstream.idl (pre-midl): Adds cpp_quote metadata marker that flows through MIDL into the generated amstream.h Both patches validated via full SDK update (10.0.26100.7705). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/sdk_patches.md | 58 +++++++++++++++ .../WinSDK/RecompiledIdlHeaders/um/Uxtheme.h | 15 +++- .../WinSDK/RecompiledIdlHeaders/um/amstream.h | 6 ++ .../RecompiledIdlHeaders/um/amstream.idl | 7 ++ .../WinSDK/patches/post-midl/Uxtheme.h.patch | 37 ++++++++++ .../patches/pre-midl/amstream.idl.patch | 18 +++++ scripts/ApplySDKPatches.ps1 | 71 +++++++++++++++++++ scripts/RecompileIdlFilesForScraping.ps1 | 8 +++ 8 files changed, 218 insertions(+), 2 deletions(-) create mode 100644 docs/sdk_patches.md create mode 100644 generation/WinSDK/patches/post-midl/Uxtheme.h.patch create mode 100644 generation/WinSDK/patches/pre-midl/amstream.idl.patch create mode 100644 scripts/ApplySDKPatches.ps1 diff --git a/docs/sdk_patches.md b/docs/sdk_patches.md new file mode 100644 index 000000000..d780f3b7a --- /dev/null +++ b/docs/sdk_patches.md @@ -0,0 +1,58 @@ +# SDK Header Patches + +Patches modify SDK headers during ingestion to add metadata annotations (conditional enums, SAL attributes, etc.) until those changes ship in the official SDK. + +## How It Works + +Patches are unified diffs in `generation/WinSDK/patches/`, organized by phase: + +``` +patches/ + pre-midl/ ← Applied after SDK copy, before MIDL recompilation + post-midl/ ← Applied after MIDL recompilation and header restores +``` + +**Pre-MIDL** patches target `.idl` files (or headers included during MIDL compilation). Changes flow through `ConvertMidlAttributesToSalAnnotations.ps1` → MIDL → generated `.h`. + +**Post-MIDL** patches target `.h` files directly. Use this for headers not generated by MIDL (e.g., `Uxtheme.h`). + +Both phases run automatically during `UpdateSDK.ps1` / `RecompileIdlFilesForScraping.ps1`. If a patch fails to apply, the script errors out — this signals the SDK changed and the patch needs regeneration. + +## Creating a Patch + +1. Run `UpdateSDK.ps1` (or `RecompileIdlFilesForScraping.ps1`) to get a pristine SDK copy with patches applied. +2. Edit the target file in `generation/WinSDK/RecompiledIdlHeaders/`. +3. Generate the patch: + ```powershell + git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/MyHeader.h" ` + > "generation/WinSDK/patches/post-midl/MyHeader.h.patch" + ``` +4. Commit both the patch file and the modified header. + +For IDL files, use `pre-midl/`: +```powershell +git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/myfile.idl" ` + > "generation/WinSDK/patches/pre-midl/myfile.idl.patch" +``` + +## Updating a Patch After an SDK Update + +When `UpdateSDK.ps1` is run with a new SDK version: +1. Fresh SDK headers are copied (overwriting all previous content). +2. Patches are re-applied automatically. +3. **If a patch fails**: the SDK incorporated the fix (or changed the surrounding code). Regenerate or remove the patch. + +To regenerate a failing patch against the new SDK: +1. Comment out the failing patch temporarily (or move it aside). +2. Re-run `RecompileIdlFilesForScraping.ps1` to get the new pristine baseline. +3. Make the edit, generate the new patch, commit. + +## Removing a Patch + +When the official SDK ships a fix, delete the `.patch` file and re-run `UpdateSDK.ps1`. The header will now contain the fix natively. + +## Examples + +**Header patch** (`post-midl/Uxtheme.h.patch`): Adds a conditional `SET_THEME_APP_PROPERTIES_FLAGS` enum under `#ifdef _WIN32METADATA_` and updates function signatures. + +**IDL patch** (`pre-midl/amstream.idl.patch`): Adds a `cpp_quote` block to `amstream.idl`. MIDL compiles it and the change appears in the generated `amstream.h`. diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h index 2ce29c891..eb7d1f959 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h +++ b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h @@ -1413,11 +1413,22 @@ IsThemeDialogTextureEnabled( STAP_ALLOW_CONTROLS | \ STAP_ALLOW_WEBCONTENT) +#ifdef _WIN32METADATA_ +enum __attribute__((flag_enum)) SET_THEME_APP_PROPERTIES_FLAGS : unsigned int { + ALLOW_NONCLIENT = STAP_ALLOW_NONCLIENT, + ALLOW_CONTROLS = STAP_ALLOW_CONTROLS, + ALLOW_WEBCONTENT = STAP_ALLOW_WEBCONTENT, + VALIDBITS = (STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT), +}; +#else +#define SET_THEME_APP_PROPERTIES_FLAGS DWORD +#endif + //--------------------------------------------------------------------------- // GetThemeAppProperties() // - returns the app property flags that control theming //--------------------------------------------------------------------------- -THEMEAPI_(DWORD) +THEMEAPI_(SET_THEME_APP_PROPERTIES_FLAGS) GetThemeAppProperties( VOID ); @@ -1430,7 +1441,7 @@ GetThemeAppProperties( //--------------------------------------------------------------------------- THEMEAPI_(void) SetThemeAppProperties( - _In_ DWORD dwFlags + _In_ SET_THEME_APP_PROPERTIES_FLAGS dwFlags ); //--------------------------------------------------------------------------- diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h index c8aae8834..b0973c07a 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h +++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h @@ -156,6 +156,12 @@ enum __MIDL___MIDL_itf_amstream_0000_0000_0004 } OUTPUT_STATE; +// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum +#ifdef _WIN32METADATA_ +#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1 +#endif + + extern RPC_IF_HANDLE __MIDL_itf_amstream_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_amstream_0000_0000_v0_0_s_ifspec; diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl index 69cde55ce..05cfbaa19 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl +++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl @@ -71,6 +71,13 @@ typedef [v1_enum] enum { RenderData = 2 } OUTPUT_STATE; +cpp_quote("") +cpp_quote("// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum") +cpp_quote("#ifdef _WIN32METADATA_") +cpp_quote("#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1") +cpp_quote("#endif") +cpp_quote("") + // IAMMultiMediaStream interface [ diff --git a/generation/WinSDK/patches/post-midl/Uxtheme.h.patch b/generation/WinSDK/patches/post-midl/Uxtheme.h.patch new file mode 100644 index 000000000..a3a784d70 --- /dev/null +++ b/generation/WinSDK/patches/post-midl/Uxtheme.h.patch @@ -0,0 +1,37 @@ +diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h +index 2ce29c89..eb7d1f95 100644 +--- a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h ++++ b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h +@@ -1413,11 +1413,22 @@ IsThemeDialogTextureEnabled( + STAP_ALLOW_CONTROLS | \ + STAP_ALLOW_WEBCONTENT) + ++#ifdef _WIN32METADATA_ ++enum __attribute__((flag_enum)) SET_THEME_APP_PROPERTIES_FLAGS : unsigned int { ++ ALLOW_NONCLIENT = STAP_ALLOW_NONCLIENT, ++ ALLOW_CONTROLS = STAP_ALLOW_CONTROLS, ++ ALLOW_WEBCONTENT = STAP_ALLOW_WEBCONTENT, ++ VALIDBITS = (STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT), ++}; ++#else ++#define SET_THEME_APP_PROPERTIES_FLAGS DWORD ++#endif ++ + //--------------------------------------------------------------------------- + // GetThemeAppProperties() + // - returns the app property flags that control theming + //--------------------------------------------------------------------------- +-THEMEAPI_(DWORD) ++THEMEAPI_(SET_THEME_APP_PROPERTIES_FLAGS) + GetThemeAppProperties( + VOID + ); +@@ -1430,7 +1441,7 @@ GetThemeAppProperties( + //--------------------------------------------------------------------------- + THEMEAPI_(void) + SetThemeAppProperties( +- _In_ DWORD dwFlags ++ _In_ SET_THEME_APP_PROPERTIES_FLAGS dwFlags + ); + + //--------------------------------------------------------------------------- diff --git a/generation/WinSDK/patches/pre-midl/amstream.idl.patch b/generation/WinSDK/patches/pre-midl/amstream.idl.patch new file mode 100644 index 000000000..7abd2ad5a --- /dev/null +++ b/generation/WinSDK/patches/pre-midl/amstream.idl.patch @@ -0,0 +1,18 @@ +diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl +index 69cde55c..05cfbaa1 100644 +--- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl ++++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl +@@ -71,6 +71,13 @@ typedef [v1_enum] enum { + RenderData = 2 + } OUTPUT_STATE; + ++cpp_quote("") ++cpp_quote("// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum") ++cpp_quote("#ifdef _WIN32METADATA_") ++cpp_quote("#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1") ++cpp_quote("#endif") ++cpp_quote("") ++ + + // IAMMultiMediaStream interface + [ diff --git a/scripts/ApplySDKPatches.ps1 b/scripts/ApplySDKPatches.ps1 new file mode 100644 index 000000000..0f352ab3b --- /dev/null +++ b/scripts/ApplySDKPatches.ps1 @@ -0,0 +1,71 @@ +# ApplySDKPatches.ps1 +# Applies SDK header patches from generation/WinSDK/patches/{phase}/ directories. +# +# Patches are unified diffs (generated by `git diff`) with paths relative to the repo root. +# They are organized by phase: +# patches/pre-midl/ — Applied after SDK copy, before MIDL recompilation. +# Use for .idl files and headers included during MIDL compilation. +# patches/post-midl/ — Applied after MIDL recompilation and header restores. +# Use for .h files not generated by MIDL, or direct header patches. +# +# Creating a new patch: +# 1. Run UpdateSDK.ps1 (or RecompileIdlFilesForScraping.ps1) to get a pristine SDK copy +# 2. Edit the target file in RecompiledIdlHeaders/ +# 3. From the repo root, run: +# git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/" > "generation/WinSDK/patches//.patch" +# 4. The patched file in RecompiledIdlHeaders/ stays as-is (it's the committed result) +# +# IMPORTANT: When updating an existing patch after an SDK update, the fresh SDK copy is already +# the correct baseline. Edit the file, re-run `git diff`, and overwrite the patch file. +# +# Usage: +# . .\ApplySDKPatches.ps1 -Phase pre-midl # Apply pre-MIDL patches (IDL files, etc.) +# . .\ApplySDKPatches.ps1 -Phase post-midl # Apply post-MIDL patches (header files) + +[CmdletBinding()] +Param( + [Parameter(Mandatory=$true)] + [ValidateSet("pre-midl", "post-midl")] + [string]$Phase +) + +. "$PSScriptRoot\CommonUtils.ps1" + +$patchDir = Join-Path $windowsWin32ProjectRoot "patches\$Phase" + +if (!(Test-Path $patchDir)) { + Write-Host "No $Phase patches directory found. Skipping." + return +} + +$patchFiles = Get-ChildItem -Path $patchDir -Filter "*.patch" -Recurse | Sort-Object FullName +if ($patchFiles.Count -eq 0) { + Write-Host "No $Phase patch files found. Skipping." + return +} + +$appliedCount = 0 +$failedCount = 0 + +foreach ($patchFile in $patchFiles) { + $relativeName = $patchFile.FullName.Substring($patchDir.Length + 1) + Write-Host "Applying $Phase patch: $relativeName..." + + # Anchor git to repo root so patch paths (generation/WinSDK/...) resolve correctly + git -C $rootDir apply $patchFile.FullName 2>&1 | ForEach-Object { Write-Host " $_" } + if ($LASTEXITCODE -eq 0) { + Write-Host " Applied successfully" -ForegroundColor Green + $appliedCount++ + } else { + Write-Warning " FAILED to apply patch: $relativeName" + Write-Warning " The SDK headers may have changed. Regenerate this patch against the new SDK." + $failedCount++ + } +} + +Write-Host "SDK $Phase patches: $appliedCount applied, $failedCount failed (of $($patchFiles.Count))." + +if ($failedCount -gt 0) { + Write-Error "$Phase patches failed. Regenerate failing patches against the new SDK headers." + exit 1 +} diff --git a/scripts/RecompileIdlFilesForScraping.ps1 b/scripts/RecompileIdlFilesForScraping.ps1 index 5e54df3c1..c0e66e887 100644 --- a/scripts/RecompileIdlFilesForScraping.ps1 +++ b/scripts/RecompileIdlFilesForScraping.ps1 @@ -44,6 +44,10 @@ Copy-Item "$d3dIncludeDir\dxgiformat.*" "$recompiledIdlHeadersDir\shared" -Recur Write-Host "Copying additional headers from $windowsWin32ProjectRoot\AdditionalHeaders to $recompiledIdlHeadersDir\um..." Copy-Item "$windowsWin32ProjectRoot\AdditionalHeaders\*" "$recompiledIdlHeadersDir\um" -Recurse +Write-Host "Applying SDK patches to IDL files (pre-MIDL)..." +& $PSScriptRoot\ApplySDKPatches.ps1 -Phase pre-midl +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + Write-Host "Converting MIDL attributes to SAL annotations..." $idlFilesToRecompile = [System.Collections.ArrayList]@() $idlFilesToExclude = "cellularapi_oem", "certbcli", "dxgicommon", "dxgitype", "microsoft.diagnostics.appanalysis", "PortableDeviceConnectImports", "wincrypt" | ForEach-Object { "$_.idl" } @@ -183,4 +187,8 @@ foreach ($winHvHeader in $winHvHeadersToRestore) { git checkout origin/main $fullPath } +Write-Host "Applying SDK patches to header files (post-MIDL)..." +& $PSScriptRoot\ApplySDKPatches.ps1 -Phase post-midl +if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE } + $ErrorActionPreference = "Stop" From da5b95f4a92ffaba030bb19b757af5f6627c19e5 Mon Sep 17 00:00:00 2001 From: Jevan Saks Date: Tue, 28 Apr 2026 10:21:49 -0700 Subject: [PATCH 2/3] Use per-reason patch naming: ..patch Supports multiple independent patches per header file, each for a single logical change. Patches are applied in sorted filename order. Example: Uxtheme.h.set-theme-app-properties-enum.patch Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/sdk_patches.md | 26 +++++++++++++++---- ...eme.h.set-theme-app-properties-enum.patch} | 0 ...am.idl.output-state-metadata-marker.patch} | 0 scripts/ApplySDKPatches.ps1 | 11 ++++++-- 4 files changed, 30 insertions(+), 7 deletions(-) rename generation/WinSDK/patches/post-midl/{Uxtheme.h.patch => Uxtheme.h.set-theme-app-properties-enum.patch} (100%) rename generation/WinSDK/patches/pre-midl/{amstream.idl.patch => amstream.idl.output-state-metadata-marker.patch} (100%) diff --git a/docs/sdk_patches.md b/docs/sdk_patches.md index d780f3b7a..ed068ffa1 100644 --- a/docs/sdk_patches.md +++ b/docs/sdk_patches.md @@ -18,21 +18,37 @@ patches/ Both phases run automatically during `UpdateSDK.ps1` / `RecompileIdlFilesForScraping.ps1`. If a patch fails to apply, the script errors out — this signals the SDK changed and the patch needs regeneration. +## Naming Convention + +``` +..patch +``` + +Each patch is a single logical change. Multiple patches per file are supported: + +``` +patches/post-midl/ + Uxtheme.h.set-theme-app-properties-enum.patch + Uxtheme.h.some-other-fix.patch +``` + +Patches are applied in sorted filename order within each phase. + ## Creating a Patch -1. Run `UpdateSDK.ps1` (or `RecompileIdlFilesForScraping.ps1`) to get a pristine SDK copy with patches applied. +1. Run `UpdateSDK.ps1` (or `RecompileIdlFilesForScraping.ps1`) to get a pristine SDK copy with existing patches applied. 2. Edit the target file in `generation/WinSDK/RecompiledIdlHeaders/`. 3. Generate the patch: ```powershell git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/MyHeader.h" ` - > "generation/WinSDK/patches/post-midl/MyHeader.h.patch" + > "generation/WinSDK/patches/post-midl/MyHeader.h.my-reason.patch" ``` 4. Commit both the patch file and the modified header. For IDL files, use `pre-midl/`: ```powershell git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/myfile.idl" ` - > "generation/WinSDK/patches/pre-midl/myfile.idl.patch" + > "generation/WinSDK/patches/pre-midl/myfile.idl.my-reason.patch" ``` ## Updating a Patch After an SDK Update @@ -53,6 +69,6 @@ When the official SDK ships a fix, delete the `.patch` file and re-run `UpdateSD ## Examples -**Header patch** (`post-midl/Uxtheme.h.patch`): Adds a conditional `SET_THEME_APP_PROPERTIES_FLAGS` enum under `#ifdef _WIN32METADATA_` and updates function signatures. +**Header patch** (`post-midl/Uxtheme.h.set-theme-app-properties-enum.patch`): Adds a conditional `SET_THEME_APP_PROPERTIES_FLAGS` enum under `#ifdef _WIN32METADATA_` and updates function signatures. -**IDL patch** (`pre-midl/amstream.idl.patch`): Adds a `cpp_quote` block to `amstream.idl`. MIDL compiles it and the change appears in the generated `amstream.h`. +**IDL patch** (`pre-midl/amstream.idl.output-state-metadata-marker.patch`): Adds a `cpp_quote` block to `amstream.idl`. MIDL compiles it and the change appears in the generated `amstream.h`. diff --git a/generation/WinSDK/patches/post-midl/Uxtheme.h.patch b/generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch similarity index 100% rename from generation/WinSDK/patches/post-midl/Uxtheme.h.patch rename to generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch diff --git a/generation/WinSDK/patches/pre-midl/amstream.idl.patch b/generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch similarity index 100% rename from generation/WinSDK/patches/pre-midl/amstream.idl.patch rename to generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch diff --git a/scripts/ApplySDKPatches.ps1 b/scripts/ApplySDKPatches.ps1 index 0f352ab3b..bd38550c0 100644 --- a/scripts/ApplySDKPatches.ps1 +++ b/scripts/ApplySDKPatches.ps1 @@ -8,11 +8,18 @@ # patches/post-midl/ — Applied after MIDL recompilation and header restores. # Use for .h files not generated by MIDL, or direct header patches. # +# Naming convention: ..patch +# e.g. Uxtheme.h.set-theme-app-properties-enum.patch +# amstream.idl.output-state-metadata-marker.patch +# Multiple patches per file are supported. Each should be a single logical change. +# Patches are applied in sorted filename order within each phase. +# # Creating a new patch: # 1. Run UpdateSDK.ps1 (or RecompileIdlFilesForScraping.ps1) to get a pristine SDK copy # 2. Edit the target file in RecompiledIdlHeaders/ -# 3. From the repo root, run: -# git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/" > "generation/WinSDK/patches//.patch" +# 3. From the repo root: +# git diff -- "generation/WinSDK/RecompiledIdlHeaders/um/" ` +# > "generation/WinSDK/patches//..patch" # 4. The patched file in RecompiledIdlHeaders/ stays as-is (it's the committed result) # # IMPORTANT: When updating an existing patch after an SDK update, the fresh SDK copy is already From 9f1600d3cf9d02c7e0cee8fd16d1b441cf00698a Mon Sep 17 00:00:00 2001 From: Jevan Saks Date: Tue, 28 Apr 2026 10:56:16 -0700 Subject: [PATCH 3/3] Remove proof-of-concept patches, keep infrastructure only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The patch system (ApplySDKPatches.ps1, hooks in RecompileIdlFilesForScraping.ps1, docs/sdk_patches.md) is ready for use. POC patches removed to avoid winmd baseline changes — real patches will be added as shift-left work proceeds. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> --- docs/sdk_patches.md | 4 +- .../WinSDK/RecompiledIdlHeaders/um/Uxtheme.h | 15 +------- .../WinSDK/RecompiledIdlHeaders/um/amstream.h | 6 --- .../RecompiledIdlHeaders/um/amstream.idl | 7 ---- generation/WinSDK/patches/post-midl/.gitkeep | 0 ...heme.h.set-theme-app-properties-enum.patch | 37 ------------------- generation/WinSDK/patches/pre-midl/.gitkeep | 0 ...eam.idl.output-state-metadata-marker.patch | 18 --------- 8 files changed, 4 insertions(+), 83 deletions(-) create mode 100644 generation/WinSDK/patches/post-midl/.gitkeep delete mode 100644 generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch create mode 100644 generation/WinSDK/patches/pre-midl/.gitkeep delete mode 100644 generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch diff --git a/docs/sdk_patches.md b/docs/sdk_patches.md index ed068ffa1..30ffad0a7 100644 --- a/docs/sdk_patches.md +++ b/docs/sdk_patches.md @@ -69,6 +69,6 @@ When the official SDK ships a fix, delete the `.patch` file and re-run `UpdateSD ## Examples -**Header patch** (`post-midl/Uxtheme.h.set-theme-app-properties-enum.patch`): Adds a conditional `SET_THEME_APP_PROPERTIES_FLAGS` enum under `#ifdef _WIN32METADATA_` and updates function signatures. +**Header patch** (`post-midl/Uxtheme.h.set-theme-app-properties-enum.patch`): Would add a conditional `SET_THEME_APP_PROPERTIES_FLAGS` enum under `#ifdef _WIN32METADATA_` and update function signatures. -**IDL patch** (`pre-midl/amstream.idl.output-state-metadata-marker.patch`): Adds a `cpp_quote` block to `amstream.idl`. MIDL compiles it and the change appears in the generated `amstream.h`. +**IDL patch** (`pre-midl/myfile.idl.my-reason.patch`): Would add a `cpp_quote` block to an IDL file. MIDL compiles it and the change appears in the generated `.h`. diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h index eb7d1f959..2ce29c891 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h +++ b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h @@ -1413,22 +1413,11 @@ IsThemeDialogTextureEnabled( STAP_ALLOW_CONTROLS | \ STAP_ALLOW_WEBCONTENT) -#ifdef _WIN32METADATA_ -enum __attribute__((flag_enum)) SET_THEME_APP_PROPERTIES_FLAGS : unsigned int { - ALLOW_NONCLIENT = STAP_ALLOW_NONCLIENT, - ALLOW_CONTROLS = STAP_ALLOW_CONTROLS, - ALLOW_WEBCONTENT = STAP_ALLOW_WEBCONTENT, - VALIDBITS = (STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT), -}; -#else -#define SET_THEME_APP_PROPERTIES_FLAGS DWORD -#endif - //--------------------------------------------------------------------------- // GetThemeAppProperties() // - returns the app property flags that control theming //--------------------------------------------------------------------------- -THEMEAPI_(SET_THEME_APP_PROPERTIES_FLAGS) +THEMEAPI_(DWORD) GetThemeAppProperties( VOID ); @@ -1441,7 +1430,7 @@ GetThemeAppProperties( //--------------------------------------------------------------------------- THEMEAPI_(void) SetThemeAppProperties( - _In_ SET_THEME_APP_PROPERTIES_FLAGS dwFlags + _In_ DWORD dwFlags ); //--------------------------------------------------------------------------- diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h index b0973c07a..c8aae8834 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h +++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.h @@ -156,12 +156,6 @@ enum __MIDL___MIDL_itf_amstream_0000_0000_0004 } OUTPUT_STATE; -// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum -#ifdef _WIN32METADATA_ -#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1 -#endif - - extern RPC_IF_HANDLE __MIDL_itf_amstream_0000_0000_v0_0_c_ifspec; extern RPC_IF_HANDLE __MIDL_itf_amstream_0000_0000_v0_0_s_ifspec; diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl index 05cfbaa19..69cde55ce 100644 --- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl +++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl @@ -71,13 +71,6 @@ typedef [v1_enum] enum { RenderData = 2 } OUTPUT_STATE; -cpp_quote("") -cpp_quote("// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum") -cpp_quote("#ifdef _WIN32METADATA_") -cpp_quote("#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1") -cpp_quote("#endif") -cpp_quote("") - // IAMMultiMediaStream interface [ diff --git a/generation/WinSDK/patches/post-midl/.gitkeep b/generation/WinSDK/patches/post-midl/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch b/generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch deleted file mode 100644 index a3a784d70..000000000 --- a/generation/WinSDK/patches/post-midl/Uxtheme.h.set-theme-app-properties-enum.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h -index 2ce29c89..eb7d1f95 100644 ---- a/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h -+++ b/generation/WinSDK/RecompiledIdlHeaders/um/Uxtheme.h -@@ -1413,11 +1413,22 @@ IsThemeDialogTextureEnabled( - STAP_ALLOW_CONTROLS | \ - STAP_ALLOW_WEBCONTENT) - -+#ifdef _WIN32METADATA_ -+enum __attribute__((flag_enum)) SET_THEME_APP_PROPERTIES_FLAGS : unsigned int { -+ ALLOW_NONCLIENT = STAP_ALLOW_NONCLIENT, -+ ALLOW_CONTROLS = STAP_ALLOW_CONTROLS, -+ ALLOW_WEBCONTENT = STAP_ALLOW_WEBCONTENT, -+ VALIDBITS = (STAP_ALLOW_NONCLIENT | STAP_ALLOW_CONTROLS | STAP_ALLOW_WEBCONTENT), -+}; -+#else -+#define SET_THEME_APP_PROPERTIES_FLAGS DWORD -+#endif -+ - //--------------------------------------------------------------------------- - // GetThemeAppProperties() - // - returns the app property flags that control theming - //--------------------------------------------------------------------------- --THEMEAPI_(DWORD) -+THEMEAPI_(SET_THEME_APP_PROPERTIES_FLAGS) - GetThemeAppProperties( - VOID - ); -@@ -1430,7 +1441,7 @@ GetThemeAppProperties( - //--------------------------------------------------------------------------- - THEMEAPI_(void) - SetThemeAppProperties( -- _In_ DWORD dwFlags -+ _In_ SET_THEME_APP_PROPERTIES_FLAGS dwFlags - ); - - //--------------------------------------------------------------------------- diff --git a/generation/WinSDK/patches/pre-midl/.gitkeep b/generation/WinSDK/patches/pre-midl/.gitkeep new file mode 100644 index 000000000..e69de29bb diff --git a/generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch b/generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch deleted file mode 100644 index 7abd2ad5a..000000000 --- a/generation/WinSDK/patches/pre-midl/amstream.idl.output-state-metadata-marker.patch +++ /dev/null @@ -1,18 +0,0 @@ -diff --git a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl -index 69cde55c..05cfbaa1 100644 ---- a/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl -+++ b/generation/WinSDK/RecompiledIdlHeaders/um/amstream.idl -@@ -71,6 +71,13 @@ typedef [v1_enum] enum { - RenderData = 2 - } OUTPUT_STATE; - -+cpp_quote("") -+cpp_quote("// [win32metadata sdk patch] Metadata marker for OUTPUT_STATE enum") -+cpp_quote("#ifdef _WIN32METADATA_") -+cpp_quote("#define _AMSTREAM_OUTPUT_STATE_PATCHED_ 1") -+cpp_quote("#endif") -+cpp_quote("") -+ - - // IAMMultiMediaStream interface - [