diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index bb34f3ab7b..9d1a1b797a 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -56,9 +56,9 @@ static inline IDirectDrawImpl *impl_from_IDirectDraw2(IDirectDraw2 *iface) return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw2_iface); } -static inline IDirectDrawImpl *ddraw_from_ddraw3(IDirectDraw3 *iface) +static inline IDirectDrawImpl *impl_from_IDirectDraw3(IDirectDraw3 *iface) { - return (IDirectDrawImpl *)((char*)iface - FIELD_OFFSET(IDirectDrawImpl, IDirectDraw3_vtbl)); + return CONTAINING_RECORD(iface, IDirectDrawImpl, IDirectDraw3_iface); } static inline IDirectDrawImpl *ddraw_from_ddraw4(IDirectDraw4 *iface) @@ -243,9 +243,11 @@ static HRESULT WINAPI ddraw4_QueryInterface(IDirectDraw4 *iface, REFIID riid, vo static HRESULT WINAPI ddraw3_QueryInterface(IDirectDraw3 *iface, REFIID riid, void **object) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object); - return ddraw7_QueryInterface((IDirectDraw7 *)ddraw_from_ddraw3(iface), riid, object); + return ddraw7_QueryInterface((IDirectDraw7 *)This, riid, object); } static HRESULT WINAPI ddraw2_QueryInterface(IDirectDraw2 *iface, REFIID riid, void **object) @@ -346,12 +348,12 @@ static ULONG WINAPI ddraw4_AddRef(IDirectDraw4 *iface) static ULONG WINAPI ddraw3_AddRef(IDirectDraw3 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); - ULONG ref = InterlockedIncrement(&ddraw->ref3); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + ULONG ref = InterlockedIncrement(&This->ref3); - TRACE("%p increasing refcount to %u.\n", ddraw, ref); + TRACE("%p increasing refcount to %u.\n", This, ref); - if (ref == 1) InterlockedIncrement(&ddraw->numIfaces); + if (ref == 1) InterlockedIncrement(&This->numIfaces); return ref; } @@ -486,13 +488,13 @@ static ULONG WINAPI ddraw4_Release(IDirectDraw4 *iface) static ULONG WINAPI ddraw3_Release(IDirectDraw3 *iface) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); - ULONG ref = InterlockedDecrement(&ddraw->ref3); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + ULONG ref = InterlockedDecrement(&This->ref3); - TRACE("%p decreasing refcount to %u.\n", ddraw, ref); + TRACE("%p decreasing refcount to %u.\n", This, ref); - if (!ref && !InterlockedDecrement(&ddraw->numIfaces)) - ddraw_destroy(ddraw); + if (!ref && !InterlockedDecrement(&This->numIfaces)) + ddraw_destroy(This); return ref; } @@ -779,9 +781,11 @@ static HRESULT WINAPI ddraw4_SetCooperativeLevel(IDirectDraw4 *iface, HWND windo static HRESULT WINAPI ddraw3_SetCooperativeLevel(IDirectDraw3 *iface, HWND window, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, window %p, flags %#x.\n", iface, window, flags); - return ddraw7_SetCooperativeLevel((IDirectDraw7 *)ddraw_from_ddraw3(iface), window, flags); + return ddraw7_SetCooperativeLevel((IDirectDraw7 *)This, window, flags); } static HRESULT WINAPI ddraw2_SetCooperativeLevel(IDirectDraw2 *iface, HWND window, DWORD flags) @@ -920,14 +924,15 @@ static HRESULT WINAPI ddraw4_SetDisplayMode(IDirectDraw4 *iface, width, height, bpp, refresh_rate, flags); } -static HRESULT WINAPI ddraw3_SetDisplayMode(IDirectDraw3 *iface, - DWORD width, DWORD height, DWORD bpp, DWORD refresh_rate, DWORD flags) +static HRESULT WINAPI ddraw3_SetDisplayMode(IDirectDraw3 *iface, DWORD width, DWORD height, + DWORD bpp, DWORD refresh_rate, DWORD flags) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, width %u, height %u, bpp %u, refresh_rate %u, flags %#x.\n", iface, width, height, bpp, refresh_rate, flags); - return ddraw7_SetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface), - width, height, bpp, refresh_rate, flags); + return ddraw7_SetDisplayMode((IDirectDraw7 *)This, width, height, bpp, refresh_rate, flags); } static HRESULT WINAPI ddraw2_SetDisplayMode(IDirectDraw2 *iface, @@ -989,9 +994,11 @@ static HRESULT WINAPI ddraw4_RestoreDisplayMode(IDirectDraw4 *iface) static HRESULT WINAPI ddraw3_RestoreDisplayMode(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_RestoreDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_RestoreDisplayMode((IDirectDraw7 *)This); } static HRESULT WINAPI ddraw2_RestoreDisplayMode(IDirectDraw2 *iface) @@ -1122,9 +1129,11 @@ static HRESULT WINAPI ddraw4_GetCaps(IDirectDraw4 *iface, DDCAPS *driver_caps, D static HRESULT WINAPI ddraw3_GetCaps(IDirectDraw3 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, driver_caps %p, hel_caps %p.\n", iface, driver_caps, hel_caps); - return ddraw7_GetCaps((IDirectDraw7 *)ddraw_from_ddraw3(iface), driver_caps, hel_caps); + return ddraw7_GetCaps((IDirectDraw7 *)This, driver_caps, hel_caps); } static HRESULT WINAPI ddraw2_GetCaps(IDirectDraw2 *iface, DDCAPS *driver_caps, DDCAPS *hel_caps) @@ -1170,9 +1179,11 @@ static HRESULT WINAPI ddraw4_Compact(IDirectDraw4 *iface) static HRESULT WINAPI ddraw3_Compact(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_Compact((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_Compact((IDirectDraw7 *)This); } static HRESULT WINAPI ddraw2_Compact(IDirectDraw2 *iface) @@ -1269,9 +1280,11 @@ static HRESULT WINAPI ddraw4_GetDisplayMode(IDirectDraw4 *iface, DDSURFACEDESC2 static HRESULT WINAPI ddraw3_GetDisplayMode(IDirectDraw3 *iface, DDSURFACEDESC *surface_desc) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, surface_desc %p.\n", iface, surface_desc); - return ddraw7_GetDisplayMode((IDirectDraw7 *)ddraw_from_ddraw3(iface), (DDSURFACEDESC2 *)surface_desc); + return ddraw7_GetDisplayMode((IDirectDraw7 *)This, (DDSURFACEDESC2 *)surface_desc); } static HRESULT WINAPI ddraw2_GetDisplayMode(IDirectDraw2 *iface, DDSURFACEDESC *surface_desc) @@ -1366,9 +1379,11 @@ static HRESULT WINAPI ddraw4_GetFourCCCodes(IDirectDraw4 *iface, DWORD *codes_co static HRESULT WINAPI ddraw3_GetFourCCCodes(IDirectDraw3 *iface, DWORD *codes_count, DWORD *codes) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, codes_count %p, codes %p.\n", iface, codes_count, codes); - return ddraw7_GetFourCCCodes((IDirectDraw7 *)ddraw_from_ddraw3(iface), codes_count, codes); + return ddraw7_GetFourCCCodes((IDirectDraw7 *)This, codes_count, codes); } static HRESULT WINAPI ddraw2_GetFourCCCodes(IDirectDraw2 *iface, DWORD *codes_count, DWORD *codes) @@ -1423,9 +1438,11 @@ static HRESULT WINAPI ddraw4_GetMonitorFrequency(IDirectDraw4 *iface, DWORD *fre static HRESULT WINAPI ddraw3_GetMonitorFrequency(IDirectDraw3 *iface, DWORD *frequency) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, frequency %p.\n", iface, frequency); - return ddraw7_GetMonitorFrequency((IDirectDraw7 *)ddraw_from_ddraw3(iface), frequency); + return ddraw7_GetMonitorFrequency((IDirectDraw7 *)This, frequency); } static HRESULT WINAPI ddraw2_GetMonitorFrequency(IDirectDraw2 *iface, DWORD *frequency) @@ -1489,9 +1506,11 @@ static HRESULT WINAPI ddraw4_GetVerticalBlankStatus(IDirectDraw4 *iface, BOOL *s static HRESULT WINAPI ddraw3_GetVerticalBlankStatus(IDirectDraw3 *iface, BOOL *status) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, status %p.\n", iface, status); - return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)ddraw_from_ddraw3(iface), status); + return ddraw7_GetVerticalBlankStatus((IDirectDraw7 *)This, status); } static HRESULT WINAPI ddraw2_GetVerticalBlankStatus(IDirectDraw2 *iface, BOOL *status) @@ -1566,15 +1585,16 @@ static HRESULT WINAPI ddraw4_GetAvailableVidMem(IDirectDraw4 *iface, return ddraw7_GetAvailableVidMem((IDirectDraw7 *)ddraw_from_ddraw4(iface), caps, total, free); } -static HRESULT WINAPI ddraw3_GetAvailableVidMem(IDirectDraw3 *iface, - DDSCAPS *caps, DWORD *total, DWORD *free) +static HRESULT WINAPI ddraw3_GetAvailableVidMem(IDirectDraw3 *iface, DDSCAPS *caps, DWORD *total, + DWORD *free) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); DDSCAPS2 caps2; TRACE("iface %p, caps %p, total %p, free %p.\n", iface, caps, total, free); DDRAW_Convert_DDSCAPS_1_To_2(caps, &caps2); - return ddraw7_GetAvailableVidMem((IDirectDraw7 *)ddraw_from_ddraw3(iface), &caps2, total, free); + return ddraw7_GetAvailableVidMem((IDirectDraw7 *)This, &caps2, total, free); } static HRESULT WINAPI ddraw2_GetAvailableVidMem(IDirectDraw2 *iface, @@ -1628,9 +1648,11 @@ static HRESULT WINAPI ddraw4_Initialize(IDirectDraw4 *iface, GUID *guid) static HRESULT WINAPI ddraw3_Initialize(IDirectDraw3 *iface, GUID *guid) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, guid %s.\n", iface, debugstr_guid(guid)); - return ddraw7_Initialize((IDirectDraw7 *)ddraw_from_ddraw3(iface), guid); + return ddraw7_Initialize((IDirectDraw7 *)This, guid); } static HRESULT WINAPI ddraw2_Initialize(IDirectDraw2 *iface, GUID *guid) @@ -1687,9 +1709,11 @@ static HRESULT WINAPI ddraw4_FlipToGDISurface(IDirectDraw4 *iface) static HRESULT WINAPI ddraw3_FlipToGDISurface(IDirectDraw3 *iface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p.\n", iface); - return ddraw7_FlipToGDISurface((IDirectDraw7 *)ddraw_from_ddraw3(iface)); + return ddraw7_FlipToGDISurface((IDirectDraw7 *)This); } static HRESULT WINAPI ddraw2_FlipToGDISurface(IDirectDraw2 *iface) @@ -1756,9 +1780,11 @@ static HRESULT WINAPI ddraw4_WaitForVerticalBlank(IDirectDraw4 *iface, DWORD fla static HRESULT WINAPI ddraw3_WaitForVerticalBlank(IDirectDraw3 *iface, DWORD flags, HANDLE event) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, flags %#x, event %p.\n", iface, flags, event); - return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, event); + return ddraw7_WaitForVerticalBlank((IDirectDraw7 *)This, flags, event); } static HRESULT WINAPI ddraw2_WaitForVerticalBlank(IDirectDraw2 *iface, DWORD flags, HANDLE event) @@ -1831,9 +1857,11 @@ static HRESULT WINAPI ddraw4_GetScanLine(IDirectDraw4 *iface, DWORD *line) static HRESULT WINAPI ddraw3_GetScanLine(IDirectDraw3 *iface, DWORD *line) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, line %p.\n", iface, line); - return ddraw7_GetScanLine((IDirectDraw7 *)ddraw_from_ddraw3(iface), line); + return ddraw7_GetScanLine((IDirectDraw7 *)This, line); } static HRESULT WINAPI ddraw2_GetScanLine(IDirectDraw2 *iface, DWORD *line) @@ -1949,12 +1977,13 @@ static HRESULT WINAPI ddraw4_GetGDISurface(IDirectDraw4 *iface, IDirectDrawSurfa static HRESULT WINAPI ddraw3_GetGDISurface(IDirectDraw3 *iface, IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *surface7; HRESULT hr; TRACE("iface %p, surface %p.\n", iface, surface); - hr = ddraw7_GetGDISurface((IDirectDraw7 *)ddraw_from_ddraw3(iface), &surface7); + hr = ddraw7_GetGDISurface((IDirectDraw7 *)This, &surface7); *surface = surface7 ? (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)surface7)->IDirectDrawSurface3_vtbl : NULL; return hr; @@ -2186,6 +2215,7 @@ static HRESULT WINAPI ddraw4_EnumDisplayModes(IDirectDraw4 *iface, DWORD flags, static HRESULT WINAPI ddraw3_EnumDisplayModes(IDirectDraw3 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMMODESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); struct displaymodescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -2194,7 +2224,7 @@ static HRESULT WINAPI ddraw3_EnumDisplayModes(IDirectDraw3 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumDisplayModes((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, + return ddraw7_EnumDisplayModes((IDirectDraw7 *)This, flags, (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumDisplayModesCallbackThunk); } @@ -2356,12 +2386,14 @@ static HRESULT WINAPI ddraw4_GetSurfaceFromDC(IDirectDraw4 *iface, HDC dc, IDire return hr; } -static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, IDirectDrawSurface **surface) +static HRESULT WINAPI ddraw3_GetSurfaceFromDC(IDirectDraw3 *iface, HDC dc, + IDirectDrawSurface **surface) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, dc %p, surface %p.\n", iface, dc, surface); - return ddraw7_GetSurfaceFromDC((IDirectDraw7 *)ddraw_from_ddraw3(iface), - dc, (IDirectDrawSurface7 **)surface); + return ddraw7_GetSurfaceFromDC((IDirectDraw7 *)This, dc, (IDirectDrawSurface7 **)surface); } /***************************************************************************** @@ -3469,10 +3501,10 @@ static HRESULT WINAPI ddraw4_CreateSurface(IDirectDraw4 *iface, return hr; } -static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, - DDSURFACEDESC *surface_desc, IDirectDrawSurface **surface, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, DDSURFACEDESC *surface_desc, + IDirectDrawSurface **surface, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *surface7; IDirectDrawSurfaceImpl *impl; HRESULT hr; @@ -3498,7 +3530,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, return DDERR_INVALIDCAPS; } - hr = CreateSurface(ddraw, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); + hr = CreateSurface(This, (DDSURFACEDESC2 *)surface_desc, &surface7, outer_unknown); if (FAILED(hr)) { *surface = NULL; @@ -3508,7 +3540,7 @@ static HRESULT WINAPI ddraw3_CreateSurface(IDirectDraw3 *iface, impl = (IDirectDrawSurfaceImpl *)surface7; *surface = (IDirectDrawSurface *)&impl->IDirectDrawSurface3_vtbl; ddraw_set_surface_version(impl, 3); - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release((IDirectDraw7 *)This); IDirectDraw3_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; @@ -3803,6 +3835,7 @@ static HRESULT WINAPI ddraw4_EnumSurfaces(IDirectDraw4 *iface, DWORD flags, static HRESULT WINAPI ddraw3_EnumSurfaces(IDirectDraw3 *iface, DWORD flags, DDSURFACEDESC *surface_desc, void *context, LPDDENUMSURFACESCALLBACK callback) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); struct surfacescallback_context cbcontext; TRACE("iface %p, flags %#x, surface_desc %p, context %p, callback %p.\n", @@ -3811,7 +3844,7 @@ static HRESULT WINAPI ddraw3_EnumSurfaces(IDirectDraw3 *iface, DWORD flags, cbcontext.func = callback; cbcontext.context = context; - return ddraw7_EnumSurfaces((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, + return ddraw7_EnumSurfaces((IDirectDraw7 *)This, flags, (DDSURFACEDESC2 *)surface_desc, &cbcontext, EnumSurfacesCallbackThunk); } @@ -3933,13 +3966,15 @@ static HRESULT WINAPI ddraw4_CreateClipper(IDirectDraw4 *iface, return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw4(iface), flags, clipper, outer_unknown); } -static HRESULT WINAPI ddraw3_CreateClipper(IDirectDraw3 *iface, - DWORD flags, IDirectDrawClipper **clipper, IUnknown *outer_unknown) +static HRESULT WINAPI ddraw3_CreateClipper(IDirectDraw3 *iface, DWORD flags, + IDirectDrawClipper **clipper, IUnknown *outer_unknown) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); + TRACE("iface %p, flags %#x, clipper %p, outer_unknown %p.\n", iface, flags, clipper, outer_unknown); - return ddraw7_CreateClipper((IDirectDraw7 *)ddraw_from_ddraw3(iface), flags, clipper, outer_unknown); + return ddraw7_CreateClipper((IDirectDraw7 *)This, flags, clipper, outer_unknown); } static HRESULT WINAPI ddraw2_CreateClipper(IDirectDraw2 *iface, @@ -4053,17 +4088,17 @@ static HRESULT WINAPI ddraw4_CreatePalette(IDirectDraw4 *iface, DWORD flags, static HRESULT WINAPI ddraw3_CreatePalette(IDirectDraw3 *iface, DWORD flags, PALETTEENTRY *entries, IDirectDrawPalette **palette, IUnknown *outer_unknown) { - IDirectDrawImpl *ddraw = ddraw_from_ddraw3(iface); + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); HRESULT hr; TRACE("iface %p, flags %#x, entries %p, palette %p, outer_unknown %p.\n", iface, flags, entries, palette, outer_unknown); - hr = ddraw7_CreatePalette((IDirectDraw7 *)ddraw, flags, entries, palette, outer_unknown); + hr = ddraw7_CreatePalette((IDirectDraw7 *)This, flags, entries, palette, outer_unknown); if (SUCCEEDED(hr) && *palette) { IDirectDrawPaletteImpl *impl = (IDirectDrawPaletteImpl *)*palette; - IDirectDraw7_Release((IDirectDraw7 *)ddraw); + IDirectDraw7_Release((IDirectDraw7 *)This); IDirectDraw4_AddRef(iface); impl->ifaceToRelease = (IUnknown *)iface; } @@ -4151,15 +4186,16 @@ static HRESULT WINAPI ddraw4_DuplicateSurface(IDirectDraw4 *iface, (IDirectDrawSurface7 *)src, (IDirectDrawSurface7 **)dst); } -static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, - IDirectDrawSurface *src, IDirectDrawSurface **dst) +static HRESULT WINAPI ddraw3_DuplicateSurface(IDirectDraw3 *iface, IDirectDrawSurface *src, + IDirectDrawSurface **dst) { + IDirectDrawImpl *This = impl_from_IDirectDraw3(iface); IDirectDrawSurface7 *src7, *dst7; HRESULT hr; TRACE("iface %p, src %p, dst %p.\n", iface, src, dst); src7 = (IDirectDrawSurface7 *)surface_from_surface3((IDirectDrawSurface3 *)src); - hr = ddraw7_DuplicateSurface((IDirectDraw7 *)ddraw_from_ddraw3(iface), src7, &dst7); + hr = ddraw7_DuplicateSurface((IDirectDraw7 *)This, src7, &dst7); if (FAILED(hr)) return hr; *dst = (IDirectDrawSurface *)&((IDirectDrawSurfaceImpl *)dst7)->IDirectDrawSurface3_vtbl; @@ -5903,7 +5939,7 @@ HRESULT ddraw_init(IDirectDrawImpl *ddraw, WINED3DDEVTYPE device_type) ddraw->lpVtbl = &ddraw7_vtbl; ddraw->IDirectDraw_iface.lpVtbl = &ddraw1_vtbl; ddraw->IDirectDraw2_iface.lpVtbl = &ddraw2_vtbl; - ddraw->IDirectDraw3_vtbl = &ddraw3_vtbl; + ddraw->IDirectDraw3_iface.lpVtbl = &ddraw3_vtbl; ddraw->IDirectDraw4_vtbl = &ddraw4_vtbl; ddraw->IDirect3D_iface.lpVtbl = &d3d1_vtbl; ddraw->IDirect3D2_iface.lpVtbl = &d3d2_vtbl; diff --git a/dlls/ddraw/ddraw_private.h b/dlls/ddraw/ddraw_private.h index ef94448626..01b95bf4e7 100644 --- a/dlls/ddraw/ddraw_private.h +++ b/dlls/ddraw/ddraw_private.h @@ -98,7 +98,7 @@ struct IDirectDrawImpl /* IUnknown fields */ const IDirectDraw7Vtbl *lpVtbl; const IDirectDraw4Vtbl *IDirectDraw4_vtbl; - const IDirectDraw3Vtbl *IDirectDraw3_vtbl; + IDirectDraw3 IDirectDraw3_iface; IDirectDraw2 IDirectDraw2_iface; IDirectDraw IDirectDraw_iface; IDirect3D7 IDirect3D7_iface; diff --git a/dlls/ddraw/main.c b/dlls/ddraw/main.c index d095d8da0b..a2fffa4b57 100644 --- a/dlls/ddraw/main.c +++ b/dlls/ddraw/main.c @@ -939,7 +939,7 @@ DllMain(HINSTANCE hInstDLL, /* Add references to each interface to avoid freeing them unexpectedly */ IDirectDraw_AddRef(&ddraw->IDirectDraw_iface); IDirectDraw2_AddRef(&ddraw->IDirectDraw2_iface); - IDirectDraw3_AddRef((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl); + IDirectDraw3_AddRef(&ddraw->IDirectDraw3_iface); IDirectDraw4_AddRef((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl); IDirectDraw7_AddRef((IDirectDraw7 *)ddraw); @@ -975,7 +975,7 @@ DllMain(HINSTANCE hInstDLL, */ while(IDirectDraw_Release(&ddraw->IDirectDraw_iface)); while(IDirectDraw2_Release(&ddraw->IDirectDraw2_iface)); - while(IDirectDraw3_Release((IDirectDraw3 *)&ddraw->IDirectDraw3_vtbl)); + while(IDirectDraw3_Release(&ddraw->IDirectDraw3_iface)); while(IDirectDraw4_Release((IDirectDraw4 *)&ddraw->IDirectDraw4_vtbl)); while(IDirectDraw7_Release((IDirectDraw7 *)ddraw)); }