d3d9: Finish the COM cleanup of the IDirect3DDevice9Ex iface.
diff --git a/dlls/d3d9/buffer.c b/dlls/d3d9/buffer.c index 827a191..f10e531 100644 --- a/dlls/d3d9/buffer.c +++ b/dlls/d3d9/buffer.c
@@ -281,7 +281,7 @@ return hr; } - buffer->parentDevice = (IDirect3DDevice9Ex *)device; + buffer->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(buffer->parentDevice); return D3D_OK; @@ -544,7 +544,7 @@ return hr; } - buffer->parentDevice = (IDirect3DDevice9Ex *)device; + buffer->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(buffer->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c index 95f133a..0a3c569 100644 --- a/dlls/d3d9/cubetexture.c +++ b/dlls/d3d9/cubetexture.c
@@ -480,7 +480,7 @@ return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index c3392d7..fe68b53 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h
@@ -162,14 +162,10 @@ */ typedef struct IDirect3DDevice9Impl { - /* IUnknown fields */ - const IDirect3DDevice9ExVtbl *lpVtbl; + IDirect3DDevice9Ex IDirect3DDevice9Ex_iface; const IWineD3DDeviceParentVtbl *device_parent_vtbl; - LONG ref; - - /* IDirect3DDevice9 fields */ - IWineD3DDevice *WineD3DDevice; - + LONG ref; + IWineD3DDevice *WineD3DDevice; /* Avoids recursion with nested ReleaseRef to 0 */ BOOL inDestruction;
diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index c316e8c..5e70b45 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c
@@ -183,7 +183,7 @@ static inline IDirect3DDevice9Impl *impl_from_IDirect3DDevice9Ex(IDirect3DDevice9Ex *iface) { - return CONTAINING_RECORD(iface, IDirect3DDevice9Impl, lpVtbl); + return CONTAINING_RECORD(iface, IDirect3DDevice9Impl, IDirect3DDevice9Ex_iface); } static HRESULT WINAPI IDirect3DDevice9Impl_QueryInterface(IDirect3DDevice9Ex *iface, REFIID riid, @@ -2213,7 +2213,8 @@ hr = vdecl_convert_fvf(fvf, &elements); if (hr != S_OK) return NULL; - hr = IDirect3DDevice9Impl_CreateVertexDeclaration((IDirect3DDevice9Ex *) This, elements, &pDecl); + hr = IDirect3DDevice9Impl_CreateVertexDeclaration(&This->IDirect3DDevice9Ex_iface, elements, + &pDecl); HeapFree(GetProcessHeap(), 0, elements); /* CreateVertexDeclaration makes a copy */ if (hr != S_OK) return NULL; @@ -3142,22 +3143,23 @@ - FIELD_OFFSET(struct IDirect3DDevice9Impl, device_parent_vtbl)); } -static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, REFIID riid, void **object) +static HRESULT STDMETHODCALLTYPE device_parent_QueryInterface(IWineD3DDeviceParent *iface, + REFIID riid, void **object) { struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_QueryInterface((IDirect3DDevice9Ex *)This, riid, object); + return IDirect3DDevice9Impl_QueryInterface(&This->IDirect3DDevice9Ex_iface, riid, object); } static ULONG STDMETHODCALLTYPE device_parent_AddRef(IWineD3DDeviceParent *iface) { struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_AddRef((IDirect3DDevice9Ex *)This); + return IDirect3DDevice9Impl_AddRef(&This->IDirect3DDevice9Ex_iface); } static ULONG STDMETHODCALLTYPE device_parent_Release(IWineD3DDeviceParent *iface) { struct IDirect3DDevice9Impl *This = device_from_device_parent(iface); - return IDirect3DDevice9Impl_Release((IDirect3DDevice9Ex *)This); + return IDirect3DDevice9Impl_Release(&This->IDirect3DDevice9Ex_iface); } /* IWineD3DDeviceParent methods */ @@ -3218,7 +3220,7 @@ "\tmultisample_quality %u, lockable %u, surface %p\n", iface, container_parent, width, height, format, multisample_type, multisample_quality, lockable, surface); - hr = IDirect3DDevice9Impl_CreateRenderTarget((IDirect3DDevice9Ex *)This, width, height, + hr = IDirect3DDevice9Impl_CreateRenderTarget(&This->IDirect3DDevice9Ex_iface, width, height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, lockable, (IDirect3DSurface9 **)&d3d_surface, NULL); if (FAILED(hr)) @@ -3249,9 +3251,9 @@ "\tmultisample_quality %u, discard %u, surface %p\n", iface, width, height, format, multisample_type, multisample_quality, discard, surface); - hr = IDirect3DDevice9Impl_CreateDepthStencilSurface((IDirect3DDevice9Ex *)This, width, height, - d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, discard, - (IDirect3DSurface9 **)&d3d_surface, NULL); + hr = IDirect3DDevice9Impl_CreateDepthStencilSurface(&This->IDirect3DDevice9Ex_iface, width, + height, d3dformat_from_wined3dformat(format), multisample_type, multisample_quality, + discard, (IDirect3DSurface9 **)&d3d_surface, NULL); if (FAILED(hr)) { ERR("(%p) CreateDepthStencilSurface failed, returning %#x\n", iface, hr); @@ -3260,7 +3262,7 @@ *surface = d3d_surface->wineD3DSurface; IWineD3DSurface_AddRef(*surface); - d3d_surface->container = (IUnknown *)This; + d3d_surface->container = (IUnknown *)&This->IDirect3DDevice9Ex_iface; /* Implicit surfaces are created with an refcount of 0 */ IDirect3DSurface9_Release((IDirect3DSurface9 *)d3d_surface); @@ -3333,7 +3335,7 @@ local_parameters.FullScreen_RefreshRateInHz = present_parameters->FullScreen_RefreshRateInHz; local_parameters.PresentationInterval = present_parameters->PresentationInterval; - hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain((IDirect3DDevice9Ex *)This, + hr = IDirect3DDevice9Impl_CreateAdditionalSwapChain(&This->IDirect3DDevice9Ex_iface, &local_parameters, &d3d_swapchain); if (FAILED(hr)) { @@ -3402,7 +3404,7 @@ if (mode) FIXME("Ignoring display mode.\n"); - device->lpVtbl = &Direct3DDevice9_Vtbl; + device->IDirect3DDevice9Ex_iface.lpVtbl = &Direct3DDevice9_Vtbl; device->device_parent_vtbl = &d3d9_wined3d_device_parent_vtbl; device->ref = 1;
diff --git a/dlls/d3d9/directx.c b/dlls/d3d9/directx.c index 71ae870..7a22c30 100644 --- a/dlls/d3d9/directx.c +++ b/dlls/d3d9/directx.c
@@ -516,7 +516,7 @@ } TRACE("Created device %p.\n", object); - *device = (IDirect3DDevice9Ex *)object; + *device = &object->IDirect3DDevice9Ex_iface; return D3D_OK; }
diff --git a/dlls/d3d9/query.c b/dlls/d3d9/query.c index 918c21f..5e1bf12 100644 --- a/dlls/d3d9/query.c +++ b/dlls/d3d9/query.c
@@ -179,7 +179,7 @@ return hr; } - query->parentDevice = (IDirect3DDevice9Ex *)device; + query->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(query->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/shader.c b/dlls/d3d9/shader.c index 0c11562..d4bc4c0 100644 --- a/dlls/d3d9/shader.c +++ b/dlls/d3d9/shader.c
@@ -144,7 +144,7 @@ return hr; } - shader->parentDevice = (IDirect3DDevice9Ex *)device; + shader->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(shader->parentDevice); return D3D_OK; @@ -271,7 +271,7 @@ return hr; } - shader->parentDevice = (IDirect3DDevice9Ex *)device; + shader->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(shader->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index 46a4de5..58994c0 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c
@@ -159,7 +159,7 @@ } } - stateblock->parentDevice = (IDirect3DDevice9Ex *)device; + stateblock->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(stateblock->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index 7cca2d6..8e81092 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c
@@ -402,7 +402,7 @@ return hr; } - surface->parentDevice = (IDirect3DDevice9Ex *)device; + surface->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(surface->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index 8f5ed9c..8730d16 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c
@@ -285,7 +285,7 @@ return hr; } - swapchain->parentDevice = (IDirect3DDevice9Ex *)device; + swapchain->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(swapchain->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index a2bbb37..21fb910 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c
@@ -467,7 +467,7 @@ return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index a478813..ec260e4 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c
@@ -406,7 +406,7 @@ return hr; } - declaration->parentDevice = (IDirect3DDevice9Ex *)device; + declaration->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(declaration->parentDevice); return D3D_OK;
diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c index 7f4f217..914be0a 100644 --- a/dlls/d3d9/volumetexture.c +++ b/dlls/d3d9/volumetexture.c
@@ -453,7 +453,7 @@ return hr; } - texture->parentDevice = (IDirect3DDevice9Ex *)device; + texture->parentDevice = &device->IDirect3DDevice9Ex_iface; IDirect3DDevice9Ex_AddRef(texture->parentDevice); return D3D_OK;