From e7068b507afd2cb791e9eb57a3353989885992dd Mon Sep 17 00:00:00 2001 From: narzoul Date: Mon, 22 Apr 2024 23:38:46 +0200 Subject: [PATCH] Fixed interface version in pfnCreateDevice Fixes a crash on old Intel drivers (issue #299). --- DDrawCompat/D3dDdi/Adapter.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/DDrawCompat/D3dDdi/Adapter.cpp b/DDrawCompat/D3dDdi/Adapter.cpp index 52aa38a..ab87240 100644 --- a/DDrawCompat/D3dDdi/Adapter.cpp +++ b/DDrawCompat/D3dDdi/Adapter.cpp @@ -434,7 +434,10 @@ namespace D3dDdi HRESULT Adapter::pfnCreateDevice(D3DDDIARG_CREATEDEVICE* pCreateData) { DeviceCallbacks::hookVtable(*pCreateData->pCallbacks, m_runtimeVersion); + auto origInterface = pCreateData->Interface; + pCreateData->Interface = 9; HRESULT result = m_origVtable.pfnCreateDevice(m_adapter, pCreateData); + pCreateData->Interface = origInterface; if (SUCCEEDED(result)) { DeviceFuncs::hookVtable(*pCreateData->pDeviceFuncs, m_driverVersion);