diff --git a/dlls/ddraw/ddraw/dga.c b/dlls/ddraw/ddraw/dga.c index d81254b5a8f..3d983ee24d5 100644 --- a/dlls/ddraw/ddraw/dga.c +++ b/dlls/ddraw/ddraw/dga.c @@ -60,9 +60,9 @@ static XF86VidModeModeInfo *orig_mode = NULL; /* This function is used both by DGA and DGA2 drivers, thus the virtual function table is not set here, but in the calling function */ -HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT( +HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT( LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd,LPDIRECTDRAWSURFACE *lpdsf, - IUnknown *lpunk + IUnknown *lpunk, void *vtable ) { ICOM_THIS(IDirectDraw2Impl,iface); IDirectDrawSurfaceImpl* dsurf; @@ -84,6 +84,8 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT( HEAP_ZERO_MEMORY, sizeof(dga_ds_private) ); + ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)vtable; + dspriv = (dga_ds_private*)dsurf->private; IDirectDraw2_AddRef(iface); @@ -148,7 +150,7 @@ HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT( ); IDirectDraw2_AddRef(iface); back->ref = 1; - ICOM_VTBL(back) = (ICOM_VTABLE(IDirectDrawSurface4)*)&dga_dds4vt; + ICOM_VTBL(back) = (ICOM_VTABLE(IDirectDrawSurface4)*)vtable; back->private = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, @@ -196,12 +198,8 @@ static HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface( IUnknown *lpunk ) { HRESULT ret; - IDirectDrawSurfaceImpl* dsurf; - ret = DGA_IDirectDraw2Impl_CreateSurface_no_VT(iface, lpddsd, lpdsf, lpunk); - - dsurf = *(IDirectDrawSurfaceImpl**)lpdsf; - ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)&dga_dds4vt; + ret = DGA_IDirectDraw2Impl_CreateSurface_with_VT(iface, lpddsd, lpdsf, lpunk, &dga_dds4vt); return ret; } diff --git a/dlls/ddraw/ddraw/dga2.c b/dlls/ddraw/ddraw/dga2.c index a661c595895..bb5cc9cf20e 100644 --- a/dlls/ddraw/ddraw/dga2.c +++ b/dlls/ddraw/ddraw/dga2.c @@ -40,12 +40,8 @@ static HRESULT WINAPI DGA2_IDirectDraw2Impl_CreateSurface( IUnknown *lpunk ) { HRESULT ret; - IDirectDrawSurfaceImpl* dsurf; - ret = DGA_IDirectDraw2Impl_CreateSurface_no_VT(iface, lpddsd, lpdsf, lpunk); - - dsurf = *(IDirectDrawSurfaceImpl**)lpdsf; - ICOM_VTBL(dsurf) = (ICOM_VTABLE(IDirectDrawSurface)*)&dga2_dds4vt; + ret = DGA_IDirectDraw2Impl_CreateSurface_with_VT(iface, lpddsd, lpdsf, lpunk, &dga2_dds4vt); return ret; } diff --git a/dlls/ddraw/dga_private.h b/dlls/ddraw/dga_private.h index 2becdd522b3..f292b1629c7 100644 --- a/dlls/ddraw/dga_private.h +++ b/dlls/ddraw/dga_private.h @@ -37,8 +37,8 @@ extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_SetPalette(LPDIRECTDRAWSURFACE extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_Unlock(LPDIRECTDRAWSURFACE4 iface,LPVOID surface) ; extern HRESULT WINAPI DGA_IDirectDrawSurface4Impl_GetDC(LPDIRECTDRAWSURFACE4 iface,HDC* lphdc); -extern HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_no_VT(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd, - LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk) ; +extern HRESULT WINAPI DGA_IDirectDraw2Impl_CreateSurface_with_VT(LPDIRECTDRAW2 iface,LPDDSURFACEDESC lpddsd, + LPDIRECTDRAWSURFACE *lpdsf,IUnknown *lpunk, void *vtable) ; extern HRESULT WINAPI DGA_IDirectDraw2Impl_QueryInterface(LPDIRECTDRAW2 iface,REFIID refiid,LPVOID *obj) ; extern HRESULT WINAPI DGA_IDirectDraw2Impl_GetCaps(LPDIRECTDRAW2 iface,LPDDCAPS caps1,LPDDCAPS caps2) ;