[PATCH 1/5] ddraw: Don't return a pointer to the implementation in ddraw7_QueryInterface().

Henri Verbeet hverbeet at codeweavers.com
Tue Mar 13 14:31:33 CDT 2012


Returning "This" is only safe because IDirectDraw7_iface happens to be the
first field in the structure.
---
 dlls/ddraw/ddraw.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 3ce18db..2231e05 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -161,7 +161,7 @@ static HRESULT WINAPI ddraw7_QueryInterface(IDirectDraw7 *iface, REFIID refiid,
     if ( IsEqualGUID( &IID_IUnknown, refiid ) ||
          IsEqualGUID( &IID_IDirectDraw7, refiid ) )
     {
-        *obj = This;
+        *obj = &This->IDirectDraw7_iface;
         TRACE("(%p) Returning IDirectDraw7 interface at %p\n", This, *obj);
     }
     else if ( IsEqualGUID( &IID_IDirectDraw4, refiid ) )
-- 
1.7.3.4




More information about the wine-patches mailing list