From afe616b5885ee89e71f2244d676aafabf27a1e9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andr=C3=A9=20Hentschel?= Date: Thu, 14 Jun 2012 20:31:22 +0200 Subject: [PATCH] d3drm: Implement IDirect3DRMMeshBuilderX_GetClassName. --- dlls/d3drm/meshbuilder.c | 18 ++++++++++++------ dlls/d3drm/tests/d3drm.c | 22 ++++++++++++++++------ 2 files changed, 28 insertions(+), 12 deletions(-) diff --git a/dlls/d3drm/meshbuilder.c b/dlls/d3drm/meshbuilder.c index 21cfc2f649a..a05c59725de 100644 --- a/dlls/d3drm/meshbuilder.c +++ b/dlls/d3drm/meshbuilder.c @@ -454,13 +454,13 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetName(IDirect3DRMMeshBuilder } static HRESULT WINAPI IDirect3DRMMeshBuilder2Impl_GetClassName(IDirect3DRMMeshBuilder2* iface, - LPDWORD lpdwSize, LPSTR lpName) + LPDWORD size, LPSTR name) { IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder2(iface); - FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName); + TRACE("(%p)->(%p, %p)\n", This, size, name); - return E_NOTIMPL; + return IDirect3DRMMeshBuilder3_GetClassName(&This->IDirect3DRMMeshBuilder3_iface, size, name); } /*** IDirect3DRMMeshBuilder2 methods ***/ @@ -1080,13 +1080,19 @@ static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetName(IDirect3DRMMeshBuilder } static HRESULT WINAPI IDirect3DRMMeshBuilder3Impl_GetClassName(IDirect3DRMMeshBuilder3* iface, - LPDWORD lpdwSize, LPSTR lpName) + LPDWORD size, LPSTR name) { IDirect3DRMMeshBuilderImpl *This = impl_from_IDirect3DRMMeshBuilder3(iface); - FIXME("(%p)->(%p,%p): stub\n", This, lpdwSize, lpName); + TRACE("(%p)->(%p, %p)\n", This, size, name); - return E_NOTIMPL; + if (!size || *size < strlen("Builder") || !name) + return E_INVALIDARG; + + strcpy(name, "Builder"); + *size = sizeof("Builder"); + + return D3DRM_OK; } HRESULT load_mesh_data(IDirect3DRMMeshBuilder3* iface, LPDIRECTXFILEDATA pData) diff --git a/dlls/d3drm/tests/d3drm.c b/dlls/d3drm/tests/d3drm.c index bbe2da38a3c..2766098f28a 100644 --- a/dlls/d3drm/tests/d3drm.c +++ b/dlls/d3drm/tests/d3drm.c @@ -198,13 +198,18 @@ static void test_MeshBuilder(void) hr = IDirect3DRM_CreateMeshBuilder(pD3DRM, &pMeshBuilder); ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder interface (hr = %x)\n", hr); + hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, NULL, NULL); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = 1; + hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, &size, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); size = sizeof(cname); hr = IDirect3DRMMeshBuilder_GetClassName(pMeshBuilder, &size, cname); - todo_wine { ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr); - ok(size != sizeof(cname), "size didn't change: %u\n", size); + ok(size == sizeof("Builder"), "wrong strlen: %u\n", size); ok(!strcmp(cname, "Builder"), "Expected cname to be \"Builder\", but got \"%s\"\n", cname); - } info.lpMemory = data_bad_version; info.dSize = strlen(data_bad_version); @@ -463,13 +468,18 @@ static void test_MeshBuilder3(void) hr = IDirect3DRM3_CreateMeshBuilder(pD3DRM3, &pMeshBuilder3); ok(hr == D3DRM_OK, "Cannot get IDirect3DRMMeshBuilder3 interface (hr = %x)\n", hr); + hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, NULL, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, NULL, NULL); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); + size = 1; + hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, &size, cname); + ok(hr == E_INVALIDARG, "GetClassName failed with %x\n", hr); size = sizeof(cname); hr = IDirect3DRMMeshBuilder3_GetClassName(pMeshBuilder3, &size, cname); - todo_wine { ok(hr == D3DRM_OK, "Cannot get classname (hr = %x)\n", hr); - ok(size != sizeof(cname), "size didn't change: %u\n", size); + ok(size == sizeof("Builder"), "wrong strlen: %u\n", size); ok(!strcmp(cname, "Builder"), "Expected cname to be \"Builder\", but got \"%s\"\n", cname); - } info.lpMemory = data_bad_version; info.dSize = strlen(data_bad_version);