From c795487ab00b763ba7aac73a7ba943d4446b27d5 Mon Sep 17 00:00:00 2001 From: Stefan Riesenberger Date: Tue, 26 Feb 2019 22:39:01 +0330 Subject: [PATCH] d3d10_1: Avoid calling D3D10CreateDevice1() from D3D10CreateDeviceAndSwapChain1(). Signed-off-by: Stefan Riesenberger Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d10_1/d3d10_1_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/dlls/d3d10_1/d3d10_1_main.c b/dlls/d3d10_1/d3d10_1_main.c index e9fad3ed093..8ee5aa71f79 100644 --- a/dlls/d3d10_1/d3d10_1_main.c +++ b/dlls/d3d10_1/d3d10_1_main.c @@ -63,7 +63,7 @@ static const char *debug_d3d10_feature_level(D3D10_FEATURE_LEVEL1 feature_level) #undef WINE_D3D10_TO_STR -HRESULT WINAPI D3D10CreateDevice1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, +static HRESULT d3d10_create_device1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, D3D10_FEATURE_LEVEL1 hw_level, UINT sdk_version, ID3D10Device1 **device) { IDXGIFactory *factory; @@ -175,6 +175,12 @@ HRESULT WINAPI D3D10CreateDevice1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE drive return hr; } +HRESULT WINAPI D3D10CreateDevice1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, + UINT flags, D3D10_FEATURE_LEVEL1 hw_level, UINT sdk_version, ID3D10Device1 **device) +{ + return d3d10_create_device1(adapter, driver_type, swrast, flags, hw_level, sdk_version, device); +} + HRESULT WINAPI D3D10CreateDeviceAndSwapChain1(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, D3D10_FEATURE_LEVEL1 feature_level, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, IDXGISwapChain **swapchain, ID3D10Device1 **device) @@ -194,7 +200,9 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain1(IDXGIAdapter *adapter, D3D10_DRIVE if (!device) return E_INVALIDARG; - if (FAILED(hr = D3D10CreateDevice1(adapter, driver_type, swrast, flags, feature_level, sdk_version, device))) + /* Avoid forwarding to D3D10CreateDevice1(), since it breaks applications + * hooking these entry-points. */ + if (FAILED(hr = d3d10_create_device1(adapter, driver_type, swrast, flags, feature_level, sdk_version, device))) { WARN("Failed to create a device, returning %#x.\n", hr); *device = NULL;