upleb.uk

Public git repos — served from a NIP-34 GRASP relay at git.upleb.uk

summaryrefslogtreecommitdiff
path: root/runtime/shims/dxgi_com.cpp
diff options
context:
space:
mode:
authorbobcatchris <83428450+bobcatchris@users.noreply.github.com>2026-11-22 12:23:49 -0600
committerbobcatchris <83428450+bobcatchris@users.noreply.github.com>2026-11-22 13:40:33 -0600
commit32fc04a14ef7b67af919ef3e17c00efa873b47d4 (patch)
tree8fa308ce97f4378f35f63f834300e0d0199c59c5 /runtime/shims/dxgi_com.cpp
parent162821017ea3c286c8bec860f3ff94f037912061 (diff)
dxgi: MakeWindowAssociation refuses unknown flag bits
The factory answered S_OK for every flags value, while the host rejects anything outside DXGI_MWA_NO_WINDOW_CHANGES, DXGI_MWA_NO_ALT_ENTER and DXGI_MWA_NO_PRINT_SCREEN with DXGI_ERROR_INVALID_CALL (measured on Windows 11 with the system DXGI), so an invalid call looked accepted. Reject unknown bits before recording the window, and cover the accepted combinations and two unknown bits in the swapchain test.
Diffstat (limited to 'runtime/shims/dxgi_com.cpp')
-rw-r--r--runtime/shims/dxgi_com.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/runtime/shims/dxgi_com.cpp b/runtime/shims/dxgi_com.cpp
index 47a53f7a2..ac12943ba 100644
--- a/runtime/shims/dxgi_com.cpp
+++ b/runtime/shims/dxgi_com.cpp
@@ -750,7 +750,13 @@ public:
750 *out = static_cast<IDXGIAdapter*>(adapter); 750 *out = static_cast<IDXGIAdapter*>(adapter);
751 return S_OK; 751 return S_OK;
752 } 752 }
753 HRESULT STDMETHODCALLTYPE MakeWindowAssociation(HWND hwnd, UINT) override { assoc_hwnd_ = hwnd; return S_OK; } 753 HRESULT STDMETHODCALLTYPE MakeWindowAssociation(HWND hwnd, UINT flags) override {
754 // Host-measured: only the three documented bits are accepted; any other bit is DXGI_ERROR_INVALID_CALL.
755 constexpr UINT known = DXGI_MWA_NO_WINDOW_CHANGES | DXGI_MWA_NO_ALT_ENTER | DXGI_MWA_NO_PRINT_SCREEN;
756 if (flags & ~known) return DXGI_ERROR_INVALID_CALL;
757 assoc_hwnd_ = hwnd;
758 return S_OK;
759 }
754 HRESULT STDMETHODCALLTYPE GetWindowAssociation(HWND* hwnd) override { 760 HRESULT STDMETHODCALLTYPE GetWindowAssociation(HWND* hwnd) override {
755 if (!hwnd) return E_INVALIDARG; 761 if (!hwnd) return E_INVALIDARG;
756 *hwnd = assoc_hwnd_; 762 *hwnd = assoc_hwnd_;