[PATCH 4/5] d3d10/effect: Validate flags vs pool instance when creating child effects.

Nikolay Sivov nsivov at codeweavers.com
Thu Sep 16 01:48:11 CDT 2021


Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
 dlls/d3d10/effect.c       | 3 +++
 dlls/d3d10/tests/effect.c | 6 ------
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c
index a2595aac136..c757b82a529 100644
--- a/dlls/d3d10/effect.c
+++ b/dlls/d3d10/effect.c
@@ -8443,6 +8443,9 @@ HRESULT WINAPI D3D10CreateEffectFromMemory(void *data, SIZE_T data_size, UINT fl
     FIXME("data %p, data_size %lu, flags %#x, device %p, effect_pool %p, effect %p stub!\n",
             data, data_size, flags, device, effect_pool, effect);
 
+    if (!(flags & D3D10_EFFECT_COMPILE_CHILD_EFFECT) != !effect_pool)
+        return E_INVALIDARG;
+
     if (FAILED(hr = d3d10_create_effect(data, data_size, device, &d3d10_effect_vtbl, &object)))
     {
         WARN("Failed to create an effect, hr %#x.\n", hr);
diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c
index 97331c2135e..2ca78194d6a 100644
--- a/dlls/d3d10/tests/effect.c
+++ b/dlls/d3d10/tests/effect.c
@@ -6486,9 +6486,7 @@ todo_wine
 
     /* Create standalone effect from the same blob used for pool,  */
     hr = create_effect(fx_test_pool, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
-todo_wine
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
-    if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
 
     hr = create_effect(fx_test_pool, 0, device, NULL, &effect2);
     ok(hr == S_OK, "Unexpected hr %#x.\n", hr);
@@ -6564,14 +6562,10 @@ todo_wine
 
     /* When pool is specified, corresponding flag has to be set. */
     hr = create_effect(fx_test_pool_child, 0, device, pool, &child_effect);
-todo_wine
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
-    if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
 
     hr = create_effect(fx_test_pool_child, D3D10_EFFECT_COMPILE_CHILD_EFFECT, device, NULL, &child_effect);
-todo_wine
     ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
-    if (SUCCEEDED(hr)) child_effect->lpVtbl->Release(child_effect);
 
     refcount = get_refcount(pool);
     ok(refcount == 1, "Unexpected refcount %u.\n", refcount);
-- 
2.33.0




More information about the wine-devel mailing list