Commit 97451080 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ddraw: COM cleanup for the IDirectDraw7 iface.

parent cd8c18e8
...@@ -95,8 +95,8 @@ struct FvfToDecl ...@@ -95,8 +95,8 @@ struct FvfToDecl
struct IDirectDrawImpl struct IDirectDrawImpl
{ {
/* IUnknown fields */ /* Interfaces */
const IDirectDraw7Vtbl *lpVtbl; IDirectDraw7 IDirectDraw7_iface;
IDirectDraw4 IDirectDraw4_iface; IDirectDraw4 IDirectDraw4_iface;
IDirectDraw3 IDirectDraw3_iface; IDirectDraw3 IDirectDraw3_iface;
IDirectDraw2 IDirectDraw2_iface; IDirectDraw2 IDirectDraw2_iface;
......
...@@ -119,7 +119,7 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface, ...@@ -119,7 +119,7 @@ IDirect3DDeviceImpl_7_QueryInterface(IDirect3DDevice7 *iface,
/* Check DirectDraw Interfacs */ /* Check DirectDraw Interfacs */
else if( IsEqualGUID( &IID_IDirectDraw7, refiid ) ) else if( IsEqualGUID( &IID_IDirectDraw7, refiid ) )
{ {
*obj = This->ddraw; *obj = &This->ddraw->IDirectDraw7_iface;
TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj); TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj);
} }
else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) ) else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
......
...@@ -273,8 +273,8 @@ DDRAW_Create(const GUID *guid, ...@@ -273,8 +273,8 @@ DDRAW_Create(const GUID *guid,
return hr; return hr;
} }
hr = IDirectDraw7_QueryInterface((IDirectDraw7 *)This, iid, DD); hr = IDirectDraw7_QueryInterface(&This->IDirectDraw7_iface, iid, DD);
IDirectDraw7_Release((IDirectDraw7 *)This); IDirectDraw7_Release(&This->IDirectDraw7_iface);
if (SUCCEEDED(hr)) list_add_head(&global_ddraw_list, &This->ddraw_list_entry); if (SUCCEEDED(hr)) list_add_head(&global_ddraw_list, &This->ddraw_list_entry);
else WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), This); else WARN("Failed to query interface %s from ddraw object %p.\n", debugstr_guid(iid), This);
...@@ -941,7 +941,7 @@ DllMain(HINSTANCE hInstDLL, ...@@ -941,7 +941,7 @@ DllMain(HINSTANCE hInstDLL,
IDirectDraw2_AddRef(&ddraw->IDirectDraw2_iface); IDirectDraw2_AddRef(&ddraw->IDirectDraw2_iface);
IDirectDraw3_AddRef(&ddraw->IDirectDraw3_iface); IDirectDraw3_AddRef(&ddraw->IDirectDraw3_iface);
IDirectDraw4_AddRef(&ddraw->IDirectDraw4_iface); IDirectDraw4_AddRef(&ddraw->IDirectDraw4_iface);
IDirectDraw7_AddRef((IDirectDraw7 *)ddraw); IDirectDraw7_AddRef(&ddraw->IDirectDraw7_iface);
/* Does a D3D device exist? Destroy it /* Does a D3D device exist? Destroy it
* TODO: Destroy all Vertex buffers, Lights, Materials * TODO: Destroy all Vertex buffers, Lights, Materials
...@@ -960,8 +960,8 @@ DllMain(HINSTANCE hInstDLL, ...@@ -960,8 +960,8 @@ DllMain(HINSTANCE hInstDLL,
desc.dwSize = sizeof(desc); desc.dwSize = sizeof(desc);
for(i = 0; i <= 1; i++) for(i = 0; i <= 1; i++)
{ {
hr = IDirectDraw7_EnumSurfaces((IDirectDraw7 *)ddraw, hr = IDirectDraw7_EnumSurfaces(&ddraw->IDirectDraw7_iface, DDENUMSURFACES_ALL,
DDENUMSURFACES_ALL, &desc, ddraw, DestroyCallback); &desc, ddraw, DestroyCallback);
if(hr != D3D_OK) if(hr != D3D_OK)
ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw); ERR("(%p) EnumSurfaces failed, prepare for trouble\n", ddraw);
} }
...@@ -977,7 +977,7 @@ DllMain(HINSTANCE hInstDLL, ...@@ -977,7 +977,7 @@ DllMain(HINSTANCE hInstDLL,
while(IDirectDraw2_Release(&ddraw->IDirectDraw2_iface)); while(IDirectDraw2_Release(&ddraw->IDirectDraw2_iface));
while(IDirectDraw3_Release(&ddraw->IDirectDraw3_iface)); while(IDirectDraw3_Release(&ddraw->IDirectDraw3_iface));
while(IDirectDraw4_Release(&ddraw->IDirectDraw4_iface)); while(IDirectDraw4_Release(&ddraw->IDirectDraw4_iface));
while(IDirectDraw7_Release((IDirectDraw7 *)ddraw)); while(IDirectDraw7_Release(&ddraw->IDirectDraw7_iface));
} }
} }
......
...@@ -274,7 +274,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette, ...@@ -274,7 +274,7 @@ HRESULT ddraw_palette_init(IDirectDrawPaletteImpl *palette,
return hr; return hr;
} }
palette->ifaceToRelease = (IUnknown *)ddraw; palette->ifaceToRelease = (IUnknown *)&ddraw->IDirectDraw7_iface;
IUnknown_AddRef(palette->ifaceToRelease); IUnknown_AddRef(palette->ifaceToRelease);
return DD_OK; return DD_OK;
......
...@@ -2254,7 +2254,7 @@ static HRESULT WINAPI ddraw_surface7_GetDDInterface(IDirectDrawSurface7 *iface, ...@@ -2254,7 +2254,7 @@ static HRESULT WINAPI ddraw_surface7_GetDDInterface(IDirectDrawSurface7 *iface,
switch(This->version) switch(This->version)
{ {
case 7: case 7:
*DD = This->ddraw; *DD = &This->ddraw->IDirectDraw7_iface;
break; break;
case 4: case 4:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment