From 1f3051e81ab2ed7418079ea671fc09248bb5e1c6 Mon Sep 17 00:00:00 2001 From: Quantum Date: Tue, 16 Jun 2026 22:31:34 -0400 Subject: [PATCH] [host] d12: handle IDXGIAdapter::EnumOutputs errors Before, the code treated any errors other than DXGI_ERROR_NOT_FOUND as if they were successes, which is incorrect. --- host/platform/Windows/capture/D12/d12.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/host/platform/Windows/capture/D12/d12.c b/host/platform/Windows/capture/D12/d12.c index dce1e108..f8bf3353 100644 --- a/host/platform/Windows/capture/D12/d12.c +++ b/host/platform/Windows/capture/D12/d12.c @@ -987,11 +987,17 @@ static bool d12_enumerateDevices( DEBUG_INFO("Adapter matched, trying: %ls", adapterDesc.Description); } - for( - int n = 0; - IDXGIAdapter1_EnumOutputs(*adapter, n, output) != DXGI_ERROR_NOT_FOUND; - ++n, comRef_release(output)) + for (int n = 0; ; ++n, comRef_release(output)) { + HRESULT hr = IDXGIAdapter1_EnumOutputs(*adapter, n, output); + + if (FAILED(hr)) + { + if (hr != DXGI_ERROR_NOT_FOUND) + DEBUG_WINERROR("Failed to IDXGIAdapter::EnumOutputs", hr); + break; + } + IDXGIOutput_GetDesc(*output, &outputDesc); if (optOutput)