ddraw/device.c: Fixed Thunk_IDirect3DDeviceImpl_1_AddViewport

Christoph Bumiller e0425955 at stud3.tuwien.ac.at
Mon Nov 27 04:23:54 CST 2006

This is my first "patch" - I was trying an old game with wine 
(Starfleet Academy), which crashed when using D3D, and I got the 
following trace messages:

(0x1b440c)->(0x1f44f0) thunking to IDirect3DDevice3 interface.
(0x1b4408)->(0x1f44f0) thunking to IDirect3DDevice3 interface.
fixme:d3d7:IDirect3DDeviceImpl_3_GetStats (0x1b4408)->(0x1f44f0): Stub!

This looks like Thunk_IDirect3DDeviceImpl_1_AddViewport called the 
GetStats thunk
which called GetStats with the viewport as argument, where it set some 
fields to
0, which resulted in a segfault in IDirect3DViewportImpl_SetBackground 
because IDirect3DViewportImpl->ddraw was NULL.

My change fixes this ... but I'm not sure if this is the correct 
solution, someone please verify.

-------------- next part --------------
>From 152e3d59c9e0aa402e00dd754c7ad8206c28774f Mon Sep 17 00:00:00 2001
From: Christoph Bumiller <chr at ECHELON.(none)>
Date: Mon, 27 Nov 2006 10:57:16 +0100
Subject: Fixed mistake in Thunk_IDirect3DDeviceImpl_1_AddViewport, should use
ICOM_THIS_FROM(..., IDirect3DDevice, ...), not IDirect3DDevice2.
 dlls/ddraw/device.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/device.c b/dlls/ddraw/device.c
index 11435cf..f3f4830 100644
--- a/dlls/ddraw/device.c
+++ b/dlls/ddraw/device.c
@@ -808,7 +808,7 @@ static HRESULT WINAPI
 Thunk_IDirect3DDeviceImpl_1_AddViewport(IDirect3DDevice *iface,
                                         IDirect3DViewport *Direct3DViewport)
-    ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice2, iface);
+    ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice, iface);
     IDirect3DViewportImpl *vp = ICOM_OBJECT(IDirect3DViewportImpl, IDirect3DViewport3, Direct3DViewport);
     TRACE_(ddraw_thunk)("(%p)->(%p) thunking to IDirect3DDevice3 interface.\n", This, vp);
     return IDirect3DDevice3_AddViewport(ICOM_INTERFACE(This, IDirect3DDevice3),

More information about the wine-patches mailing list