v2: make functions static
v1: 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 92410053d5..c6018b0c7b 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) +static 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);
@@ -1212,8 +1220,8 @@ BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase
static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3]) { - vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size; - vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size; + vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size; + vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size; vertex[2] = 0.0; }
@@ -1393,7 +1401,7 @@ static BOOL wglUseFontOutlines_common(HDC hdc, lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY, - lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY); + lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY); lpgmf++; }
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..ce1d639236 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, +static 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=48233
Your paranoid android.
=== debian9 (32 bit report) ===
d3d11: d3d11.c:5593: Test failed: Got unexpected hr 0x8876086a. Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debian9 (32 bit WoW report) ===
d3d11: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== debian9 (64 bit WoW report) ===
d3d11: Unhandled exception: page fault on execute access to 0x00000065 in 64-bit code (0x0000000000000065).
Report errors: d3d11:d3d11 crashed (c0000005)
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..a13f026ecc 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, +static 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..332b67063d 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,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=48234
Your paranoid android.
=== debian9 (32 bit report) ===
d3d11: d3d11.c:5593: Test failed: Got unexpected hr 0x8876086a. Unhandled exception: page fault on read access to 0x00000001 in 32-bit code (0x7ed11f0d).
=== debian9 (32 bit WoW report) ===
d3d11: Unhandled exception: page fault on execute access to 0x00000000 in 32-bit code (0x00000000).
=== 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 02/25/2019 11:34 AM, Stefan Riesenberger wrote:
v2: make functions static
v1: 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 92410053d5..c6018b0c7b 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) +static 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);
+}
Does using DECLSPEC_HOTPATCH work instead? That might be better.
On 02/25/2019 12:35 PM, Zebediah Figura wrote:
On 02/25/2019 11:34 AM, Stefan Riesenberger wrote:
v2: make functions static
v1: 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 | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-)
diff --git a/dlls/opengl32/wgl.c b/dlls/opengl32/wgl.c index 92410053d5..c6018b0c7b 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) +static 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);
+}
Does using DECLSPEC_HOTPATCH work instead? That might be better.
Sorry, I misunderstood the purpose of the patch. Ignore this comment.