From: Jaakko Hannikainen <jgke@jgke.fi> This prevents the 'edit instrument' screen in Dorico from crashing the entire software, now merely rendering a completely white screen. --- dlls/dcomp/device.c | 3 ++- dlls/dcomp/target.c | 3 ++- dlls/dcomp/tests/dcomp.c | 48 ++++++++++++++++++++++++++++++++++++++++ dlls/dcomp/visual2.c | 3 ++- 4 files changed, 54 insertions(+), 3 deletions(-) diff --git a/dlls/dcomp/device.c b/dlls/dcomp/device.c index 7cd7462fb8e..e33e52e450f 100644 --- a/dlls/dcomp/device.c +++ b/dlls/dcomp/device.c @@ -88,7 +88,8 @@ static ULONG STDMETHODCALLTYPE composition_device_Release_impl(struct compositio static HRESULT STDMETHODCALLTYPE composition_device_Commit_impl(struct composition_device *device) { FIXME("device %p stub!\n", device); - return E_NOTIMPL; + /* FIXME: this should be E_NOTIMPL but it causes crashes */ + return S_OK; } static HRESULT STDMETHODCALLTYPE composition_device_WaitForCommitCompletion_impl(struct composition_device *device) diff --git a/dlls/dcomp/target.c b/dlls/dcomp/target.c index 52baa85fd26..06caf825751 100644 --- a/dlls/dcomp/target.c +++ b/dlls/dcomp/target.c @@ -80,7 +80,8 @@ static HRESULT STDMETHODCALLTYPE STDMETHODCALLTYPE composition_target_SetRoot( IDCompositionTarget *iface, IDCompositionVisual *visual) { FIXME("iface %p, visual %p stub!\n", iface, visual); - return E_NOTIMPL; + /* FIXME: should be E_NOTIMPL but it causes crashes */ + return S_OK; } static const struct IDCompositionTargetVtbl composition_target_vtbl = diff --git a/dlls/dcomp/tests/dcomp.c b/dlls/dcomp/tests/dcomp.c index 963636f88eb..28de6ee67e3 100644 --- a/dlls/dcomp/tests/dcomp.c +++ b/dlls/dcomp/tests/dcomp.c @@ -163,6 +163,53 @@ static void test_create_surface_and_target(void) IDXGIDevice_Release(dxgi_device); } +static void test_hacks(void) +{ + HRESULT hr; + ID3D11Device *d3d11_device; + HWND hwnd; + IDXGIDevice *dxgi_device = NULL; + IDCompositionDesktopDevice *dcomp_device; + IDCompositionTarget *target; + IDCompositionVisual2 *visual; + + hr = create_window_and_device(&hwnd, &d3d11_device, &dxgi_device); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = DCompositionCreateDevice2((IUnknown *)dxgi_device, + &IID_IDCompositionDesktopDevice, + (void **)&dcomp_device); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IDCompositionDesktopDevice_CreateTargetForHwnd(dcomp_device, hwnd, FALSE, &target); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IDCompositionDesktopDevice_CreateVisual(dcomp_device, &visual); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + /* These 3 functions should currently return E_NOTIMPL, but it crashes Dorico. */ + hr = IDCompositionVisual2_SetContent(visual, NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IDCompositionTarget_SetRoot(target, (IDCompositionVisual *)visual); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IDCompositionDesktopDevice_Commit(dcomp_device); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + IDCompositionTarget_Release(target); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IDCompositionVisual2_Release(visual); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + IDCompositionDesktopDevice_Release(dcomp_device); + + IDXGIDevice_Release(dxgi_device); +} + START_TEST(dcomp) { CoInitialize(NULL); @@ -183,6 +230,7 @@ START_TEST(dcomp) test_CreateInstance(&DCompositionCreateDevice3, &IID_IDCompositionDevice3, E_NOINTERFACE); test_create_surface_and_target(); + test_hacks(); CoUninitialize(); } diff --git a/dlls/dcomp/visual2.c b/dlls/dcomp/visual2.c index ee2141cb61f..889d4436490 100644 --- a/dlls/dcomp/visual2.c +++ b/dlls/dcomp/visual2.c @@ -163,7 +163,8 @@ static HRESULT STDMETHODCALLTYPE composition_visual_SetContent( IDCompositionVisual2 *iface, IUnknown *content) { FIXME("iface %p content %p stub!\n", iface, content); - return E_NOTIMPL; + /* FIXME: should be E_NOTIMPL but it causes crashes */ + return S_OK; } static HRESULT STDMETHODCALLTYPE composition_visual_AddVisual( -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9839