This prevents a stack overflow when using Reshade, which hooks these functions.
Signed-off-by: Stefan Riesenberger stefan.riesenberger@gmail.com --- dlls/opengl32/wgl.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 92410053d5..1d1a944bae 100644 --- a/dlls/opengl32/wgl.c +++ b/dlls/opengl32/wgl.c @@ -398,9 +398,9 @@ HDC WINAPI wglGetCurrentDC(void) }
/*********************************************************************** - * wglCreateContext (OPENGL32.@) + * wgl_create_context wrapper for hooking */ -HGLRC WINAPI wglCreateContext(HDC hdc) +HGLRC wgl_create_context(HDC hdc) { HGLRC ret = 0; struct wgl_context *drv_ctx; @@ -419,6 +419,14 @@ HGLRC WINAPI wglCreateContext(HDC hdc) return ret; }
+/*********************************************************************** + * wglCreateContext (OPENGL32.@) + */ +HGLRC WINAPI wglCreateContext(HDC hdc) +{ + return wgl_create_context(hdc); +} + /*********************************************************************** * wglGetCurrentContext (OPENGL32.@) */ @@ -667,7 +675,7 @@ HGLRC WINAPI wglCreateLayerContext(HDC hdc, TRACE("(%p,%d)\n", hdc, iLayerPlane);
if (iLayerPlane == 0) { - return wglCreateContext(hdc); + return wgl_create_context(hdc); } FIXME("no handler for layer %d\n", iLayerPlane);
Signed-off-by: Stefan Riesenberger stefan.riesenberger@gmail.com --- dlls/d3d11/d3d11_main.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/dlls/d3d11/d3d11_main.c b/dlls/d3d11/d3d11_main.c index 9c89820f6f..f8a16572cb 100644 --- a/dlls/d3d11/d3d11_main.c +++ b/dlls/d3d11/d3d11_main.c @@ -136,7 +136,7 @@ HRESULT WINAPI D3D11CoreCreateDevice(IDXGIFactory *factory, IDXGIAdapter *adapte return S_OK; }
-HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, +HRESULT d3d11_create_device(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context) { @@ -278,6 +278,14 @@ HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_t return (device_out || immediate_context) ? S_OK : S_FALSE; }
+HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, + const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, + D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context) +{ + return d3d11_create_device(adapter, driver_type, swrast, flags, feature_levels, levels, sdk_version, + device_out, obtained_feature_level, immediate_context); +} + HRESULT WINAPI D3D11CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, const DXGI_SWAP_CHAIN_DESC *swapchain_desc, IDXGISwapChain **swapchain, @@ -299,7 +307,7 @@ HRESULT WINAPI D3D11CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D_DRIVER_T if (device_out) *device_out = NULL;
- if (FAILED(hr = D3D11CreateDevice(adapter, driver_type, swrast, flags, feature_levels, levels, sdk_version, + if (FAILED(hr = d3d11_create_device(adapter, driver_type, swrast, flags, feature_levels, levels, sdk_version, &device, obtained_feature_level, immediate_context))) { WARN("Failed to create a device, returning %#x.\n", hr);
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48144
Your paranoid android.
=== debian9 (32 bit Chinese:China report) ===
d3d11: Unhandled exception: page fault on read access to 0x3f800000 in 32-bit code (0x7eb44f0d).
=== debian9 (32 bit WoW report) ===
d3d11: d3d11.c:5341: Test failed: Got unexpected hr 0x8876086a for query type 4. d3d11.c:5346: Test failed: Got unexpected hr 0x8876086a for query type 4.
=== debian9 (64 bit WoW report) ===
d3d11: d3d11.c:16707: Test failed: Got {-1.00787401e+00, 0.00000000e+00, 1.00000000e+00, 5.03937006e-01}, expected {-1.00000000e+00, 0.00000000e+00, 1.00000000e+00, 5.03937006e-01} at (0, 0), sub-resource 0.
On Fri, 22 Feb 2019 at 22:48, Stefan Riesenberger stefan.riesenberger@gmail.com wrote:
-HRESULT WINAPI D3D11CreateDevice(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, +HRESULT d3d11_create_device(IDXGIAdapter *adapter, D3D_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, const D3D_FEATURE_LEVEL *feature_levels, UINT levels, UINT sdk_version, ID3D11Device **device_out, D3D_FEATURE_LEVEL *obtained_feature_level, ID3D11DeviceContext **immediate_context)
I think we'd want this to be either static or DECLSPEC_HIDDEN, we'd don't want to export it.
Signed-off-by: Stefan Riesenberger stefan.riesenberger@gmail.com --- dlls/d3d10/d3d10_main.c | 10 ++++++++-- dlls/d3d10_1/d3d10_1_main.c | 10 ++++++++-- 2 files changed, 16 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d10/d3d10_main.c b/dlls/d3d10/d3d10_main.c index 4d3ed1244e..985d9cc8c0 100644 --- a/dlls/d3d10/d3d10_main.c +++ b/dlls/d3d10/d3d10_main.c @@ -27,7 +27,7 @@
WINE_DEFAULT_DEBUG_CHANNEL(d3d10);
-HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, +HRESULT d3d10_create_device(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device) { IDXGIFactory *factory; @@ -139,6 +139,12 @@ HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver return hr; }
+HRESULT WINAPI D3D10CreateDevice(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, + HMODULE swrast, UINT flags, UINT sdk_version, ID3D10Device **device) +{ + return d3d10_create_device(adapter, driver_type, swrast, flags, sdk_version, device); +} + HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER_TYPE driver_type, HMODULE swrast, UINT flags, UINT sdk_version, DXGI_SWAP_CHAIN_DESC *swapchain_desc, IDXGISwapChain **swapchain, ID3D10Device **device) @@ -152,7 +158,7 @@ HRESULT WINAPI D3D10CreateDeviceAndSwapChain(IDXGIAdapter *adapter, D3D10_DRIVER adapter, debug_d3d10_driver_type(driver_type), swrast, flags, sdk_version, swapchain_desc, swapchain, device);
- hr = D3D10CreateDevice(adapter, driver_type, swrast, flags, sdk_version, device); + hr = d3d10_create_device(adapter, driver_type, swrast, flags, sdk_version, device); if (FAILED(hr)) { WARN("Failed to create a device, returning %#x\n", hr); diff --git a/dlls/d3d10_1/d3d10_1_main.c b/dlls/d3d10_1/d3d10_1_main.c index e9fad3ed09..d1b9c792da 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, +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,7 @@ 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))) + 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;
Hi,
While running your changed tests on Windows, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=48145
Your paranoid android.
=== debian9 (32 bit Chinese:China report) ===
d3d11: Unhandled exception: page fault on read access to 0x3f800000 in 32-bit code (0x7eb5cf0d).
=== debian9 (32 bit WoW report) ===
d3d11: d3d11.c:5341: Test failed: Got unexpected hr 0x8876086a for query type 4. d3d11.c:5346: Test failed: Got unexpected hr 0x8876086a for query type 4. Unhandled exception: page fault on read access to 0x3f800000 in 32-bit code (0x7ed11f0d).
=== debian9 (64 bit WoW report) ===
d3d11: d3d11.c:17791: Test failed: Got {0x00000000, 0x00000000, 0x00000000, 0x00000000}, expected {0x00000000, 0xffffffff, 0x00000000, 0x00000000} at (0, 0), sub-resource 0.