From a31e5531eb8f3be5fddf9f81f48f191b1a10c2aa Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 16 Mar 2015 08:18:33 +0100
Subject: [PATCH] d3dx9_36: Improve stub for ID3DXEffectImpl_CloneEffect.

---
 dlls/d3dx9_36/effect.c       |  4 +++-
 dlls/d3dx9_36/tests/effect.c | 16 +++++-----------
 2 files changed, 8 insertions(+), 12 deletions(-)

diff --git a/dlls/d3dx9_36/effect.c b/dlls/d3dx9_36/effect.c
index 7d686a435d..f8d8ab9cd2 100644
--- a/dlls/d3dx9_36/effect.c
+++ b/dlls/d3dx9_36/effect.c
@@ -4100,7 +4100,9 @@ static HRESULT WINAPI d3dx_effect_CloneEffect(ID3DXEffect *iface, IDirect3DDevic
     if (!device)
         return D3DERR_INVALIDCALL;
 
-    return E_NOTIMPL;
+    iface->lpVtbl->AddRef(iface);
+    *new_effect = iface;
+    return S_OK;
 }
 
 #if D3DX_SDK_VERSION >= 27
diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 5c4a3c5e77..ff15426938 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -7419,29 +7419,23 @@ static void test_effect_clone(void)
     ok(hr == D3DERR_INVALIDCALL, "Got result %#x.\n", hr);
 
     hr = effect->lpVtbl->CloneEffect(effect, device, &cloned);
-todo_wine
     ok(hr == D3D_OK, "Got result %#x.\n", hr);
-if (hr == D3D_OK)
-{
-    ok(cloned != effect, "Expected new effect instance.\n");
+
+    todo_wine ok(cloned != effect, "Expected new effect instance.\n");
     cloned->lpVtbl->Release(cloned);
-}
     /* Try with different device. */
     device2 = create_device(&window2);
     hr = effect->lpVtbl->CloneEffect(effect, device2, &cloned);
-todo_wine
     ok(hr == D3D_OK, "Got result %#x.\n", hr);
-if (hr == D3D_OK)
-{
-    ok(cloned != effect, "Expected new effect instance.\n");
+    todo_wine ok(cloned != effect, "Expected new effect instance.\n");
 
     hr = cloned->lpVtbl->GetDevice(cloned, &device3);
     ok(hr == S_OK, "Failed to get effect device.\n");
-    ok(device3 == device2, "Unexpected device instance.\n");
+    todo_wine ok(device3 == device2, "Unexpected device instance, device3 %p, device2 %p.\n", device3, device2);
     IDirect3DDevice9_Release(device3);
 
     cloned->lpVtbl->Release(cloned);
-}
+
     IDirect3DDevice9_Release(device2);
     DestroyWindow(window2);
     effect->lpVtbl->Release(effect);
-- 
2.21.0

