From 99e0442acc123a32139cb0a2a3c365a87b33b577 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 5 Jun 2017 02:07:32 +0300 Subject: [PATCH] d3drm: Fix IDirect3DRMMeshBuilder::QueryInterface to support IDirect3DRMObject and IDirect3DRMVisual. Signed-off-by: Nikolay Sivov Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3drm/meshbuilder.c | 2 ++ dlls/d3drm/tests/d3drm.c | 27 +++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c index 82f809e83f2..e53457dc361 100644 --- a/dlls/d3drm/meshbuilder.c +++ b/dlls/d3drm/meshbuilder.c @@ -361,6 +361,8 @@ static HRESULT WINAPI d3drm_mesh_builder2_QueryInterface(IDirect3DRMMeshBuilder2 if (IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder2) || IsEqualGUID(riid, &IID_IDirect3DRMMeshBuilder) + || IsEqualGUID(riid, &IID_IDirect3DRMVisual) + || IsEqualGUID(riid, &IID_IDirect3DRMObject) || IsEqualGUID(riid, &IID_IUnknown)) { *out = &mesh_builder->IDirect3DRMMeshBuilder2_iface; diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index 9985d035401..e1091be423e 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -203,6 +203,7 @@ static void test_MeshBuilder(void) HRESULT hr; IDirect3DRM *d3drm; IDirect3DRMMeshBuilder *pMeshBuilder; + IDirect3DRMMeshBuilder3 *meshbuilder3; IDirect3DRMMesh *mesh; D3DRMLOADMEMORY info; int val; @@ -215,6 +216,7 @@ static void test_MeshBuilder(void) DWORD size; D3DCOLOR color; CHAR cname[64] = {0}; + IUnknown *unk; hr = Direct3DRMCreate(&d3drm); ok(hr == D3DRM_OK, "Cannot get IDirect3DRM interface (hr = %x)\n", hr); @@ -222,6 +224,31 @@ static void test_MeshBuilder(void) hr = IDirect3DRM_CreateMeshBuilder(d3drm, &pMeshBuilder); ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder interface (hr = %x)\n", hr); + hr = IDirect3DRMMeshBuilder_QueryInterface(pMeshBuilder, &IID_IDirect3DRMObject, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, %#x.\n", hr); + ok(unk == (IUnknown *)pMeshBuilder, "Unexpected interface pointer.\n"); + IUnknown_Release(unk); + + hr = IDirect3DRMMeshBuilder_QueryInterface(pMeshBuilder, &IID_IDirect3DRMVisual, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IDirect3DRMVisual, %#x.\n", hr); + ok(unk == (IUnknown *)pMeshBuilder, "Unexpected interface pointer.\n"); + IUnknown_Release(unk); + + hr = IDirect3DRMMeshBuilder_QueryInterface(pMeshBuilder, &IID_IDirect3DRMMeshBuilder3, (void **)&meshbuilder3); + ok(SUCCEEDED(hr), "Failed to get IDirect3DRMMeshBuilder3, %#x.\n", hr); + + hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder3, &IID_IDirect3DRMObject, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IDirect3DRMObject, %#x.\n", hr); + ok(unk == (IUnknown *)pMeshBuilder, "Unexpected interface pointer.\n"); + IUnknown_Release(unk); + + hr = IDirect3DRMMeshBuilder3_QueryInterface(meshbuilder3, &IID_IDirect3DRMVisual, (void **)&unk); + ok(SUCCEEDED(hr), "Failed to get IDirect3DRMVisual, %#x.\n", hr); + ok(unk == (IUnknown *)pMeshBuilder, "Unexpected interface pointer.\n"); + IUnknown_Release(unk); + + IDirect3DRMMeshBuilder3_Release(meshbuilder3); + hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, cname); ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, NULL);