[ros-diffs] [fireball] 49872: [DDRAW] - Jerome Gardou: Almost all of the ddraw->refcount winetests pass. One remains, due to the fact that IdirectDrawSurface::SetPalette is unimplemented. IDirectDraw::Createpa...

fireball at svn.reactos.org fireball at svn.reactos.org
Tue Nov 30 16:29:51 UTC 2010


Author: fireball
Date: Tue Nov 30 16:29:49 2010
New Revision: 49872

URL: http://svn.reactos.org/svn/reactos?rev=49872&view=rev
Log:
[DDRAW]
- Jerome Gardou: Almost all of the ddraw->refcount winetests pass. One remains, due to the fact that IdirectDrawSurface::SetPalette is unimplemented. IDirectDraw::Createpalette is implemented too, but needs testing. There are no parameter checks.
- Comments from me: The patch is not build-tested, however I did my best to merge it to existing ddraw and I prefer the actual code to be in the repository rather than hanging in bugzilla for years (last comment to the patch is dated 29.10.2009).

See issue #4909 for more details.

Added:
    trunk/reactos/dll/directx/ddraw/Palette/createpalette.c   (with props)
    trunk/reactos/dll/directx/ddraw/Palette/palette.c   (with props)
Modified:
    trunk/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c
    trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
    trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
    trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
    trunk/reactos/dll/directx/ddraw/Surface/surface_main.c
    trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c
    trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c
    trunk/reactos/dll/directx/ddraw/ddraw.rbuild
    trunk/reactos/dll/directx/ddraw/rosdraw.h
    trunk/reactos/dll/directx/ddraw/startup.c

Modified: trunk/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/callbacks_dd_hel.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -75,9 +75,46 @@
     DX_STUB;
 }
 
-DWORD CALLBACK  HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette)
+DWORD CALLBACK HelDdCreatePalette(LPDDHAL_CREATEPALETTEDATA lpCreatePalette)
 {
-    DX_STUB;
+    DDRAWI_DDRAWPALETTE_GBL* ddPalGbl = lpCreatePalette->lpDDPalette;
+    LOGPALETTE* logPal ;
+    WORD size=1;
+
+    if(ddPalGbl->dwFlags & DDRAWIPAL_2)
+        size = 2;
+    else if(ddPalGbl->dwFlags & DDRAWIPAL_4)
+        size = 4;
+    else if(ddPalGbl->dwFlags & DDRAWIPAL_16)
+        size = 16;
+    else if(ddPalGbl->dwFlags & DDRAWIPAL_256)
+        size = 256;
+
+    DxHeapMemAlloc(logPal, sizeof(LOGPALETTE) + size*sizeof(PALETTEENTRY));
+    if(logPal == NULL)
+    {
+        lpCreatePalette->ddRVal = DDERR_OUTOFMEMORY;
+        return DDHAL_DRIVER_HANDLED;
+    }
+
+    logPal->palVersion = 0x300;
+    logPal->palNumEntries = size;
+    CopyMemory(&logPal->palPalEntry[0], lpCreatePalette->lpColorTable, size*sizeof(PALETTEENTRY));
+
+    ddPalGbl->hHELGDIPalette = CreatePalette(logPal);
+
+    if (ddPalGbl->hHELGDIPalette == NULL)
+    {
+        DxHeapMemFree(logPal);
+        lpCreatePalette->ddRVal = DDERR_INVALIDOBJECT;
+        return DDHAL_DRIVER_HANDLED;
+    }
+
+    DxHeapMemFree(logPal);
+    ddPalGbl->lpColorTable = lpCreatePalette->lpColorTable;
+    ddPalGbl->dwFlags |= DDRAWIPAL_INHEL | DDRAWIPAL_GDI ;
+    lpCreatePalette->ddRVal = DD_OK;
+    return DDHAL_DRIVER_HANDLED;
 }
 
 DWORD CALLBACK  HelDdGetScanLine(LPDDHAL_GETSCANLINEDATA lpGetScanLine)

Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -533,6 +533,9 @@
     }
     _SEH2_END;
 
+    if(*ppSurf != NULL)
+        Main_DirectDraw_AddRef(This);
+
     LeaveCriticalSection(&ddcs);
     return ret;
 }
@@ -540,11 +543,36 @@
 /* 5 of 31 DirectDraw7_Vtable api are working simluare to windows */
 /* 8 of 31 DirectDraw7_Vtable api are under devloping / testing */
 
-
-
-
-
-
-
-
-
+HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
+                  LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter)
+{
+	HRESULT ret = DD_OK;
+    DX_WINDBG_trace();
+
+    EnterCriticalSection(&ddcs);
+    *ppPalette = NULL;
+
+    _SEH2_TRY
+    {
+        ret = Internal_CreatePalette(This, dwFlags, palent, ppPalette, pUnkOuter);
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        ret = DDERR_INVALIDPARAMS;
+    }
+    _SEH2_END;
+
+    //Versions 7 and 4 are addref'ed
+    if((This->lpVtbl == &DirectDraw7_Vtable || This->lpVtbl == &DirectDraw4_Vtable) && *ppPalette != NULL)
+        Main_DirectDraw_AddRef(This) ;
+
+    LeaveCriticalSection(&ddcs);
+    return ret;
+}
+
+
+
+
+
+
+

Modified: trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_stubs.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -19,13 +19,6 @@
                               DWORD dwFlags,
                               LPDIRECTDRAWCLIPPER *ppClipper,
                               IUnknown *pUnkOuter)
-{
-	DX_WINDBG_trace();
-	DX_STUB;
-}
-
-HRESULT WINAPI Main_DirectDraw_CreatePalette(LPDDRAWI_DIRECTDRAW_INT This, DWORD dwFlags,
-                  LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter)
 {
 	DX_WINDBG_trace();
 	DX_STUB;

Added: trunk/reactos/dll/directx/ddraw/Palette/createpalette.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Palette/createpalette.c?rev=49872&view=auto
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Palette/createpalette.c (added)
+++ trunk/reactos/dll/directx/ddraw/Palette/createpalette.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -1,0 +1,135 @@
+/* $Id$
+ *
+ * COPYRIGHT:            See COPYING in the top level directory
+ * PROJECT:              ReactOS DirectX
+ * FILE:                 ddraw/surface/createsurface.c
+ * PURPOSE:              IDirectDrawPalette Creation
+ * PROGRAMMER:           Jérôme Gardou
+ *
+ */
+#include "rosdraw.h"
+
+DWORD ConvertPCapsFlags(DWORD dwFlags)
+{
+    DWORD ret = 0;
+    if(dwFlags & DDPCAPS_4BIT)
+        ret|=DDRAWIPAL_16;
+    if(dwFlags & DDPCAPS_8BIT)
+        ret|=DDRAWIPAL_256;
+    if(dwFlags & DDPCAPS_8BITENTRIES)
+        ret|=DDRAWIPAL_STORED_8INDEX;
+    if(dwFlags & DDPCAPS_ALLOW256)
+        ret|=DDRAWIPAL_ALLOW256;
+    if(dwFlags & DDPCAPS_ALPHA)
+        ret|=DDRAWIPAL_ALPHA;
+    if(dwFlags & DDPCAPS_1BIT)
+        ret|=DDRAWIPAL_2;
+    if(dwFlags & DDPCAPS_2BIT)
+        ret|=DDRAWIPAL_4;
+
+    return ret;
+}
+
+HRESULT
+Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags,
+                  LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter)
+{
+    DDHAL_CREATEPALETTEDATA mDdCreatePalette = { 0 };
+
+    LPDDRAWI_DDRAWPALETTE_INT ThisPalInt = NULL;
+    LPDDRAWI_DDRAWPALETTE_LCL ThisPalLcl = NULL;
+    LPDDRAWI_DDRAWPALETTE_GBL ThisPalGbl = NULL;
+
+    HRESULT ret;
+
+    if(pUnkOuter)
+    {
+        return CLASS_E_NOAGGREGATION;
+    }
+
+    if(!(pDDraw->lpLcl->dwLocalFlags & DDRAWILCL_SETCOOPCALLED))
+    {
+        return DDERR_NOCOOPERATIVELEVELSET;
+    }
+
+
+    if (pDDraw->lpLcl->dwProcessId != GetCurrentProcessId() )
+    {
+        return DDERR_INVALIDOBJECT;
+    }
+
+    /* Allocate the palette interface and needed members */
+    DxHeapMemAlloc(ThisPalInt,  sizeof( DDRAWI_DDRAWPALETTE_INT ) );
+    if( ThisPalInt == NULL )
+    {
+        ret = DDERR_OUTOFMEMORY;
+        goto cleanup;
+    }
+
+    DxHeapMemAlloc(ThisPalLcl,  sizeof( DDRAWI_DDRAWPALETTE_LCL ) );
+    if( ThisPalLcl == NULL )
+    {
+        ret = DDERR_OUTOFMEMORY;
+        goto cleanup;
+    }
+
+    DxHeapMemAlloc(ThisPalGbl,  sizeof( DDRAWI_DDRAWPALETTE_GBL ) );
+    if( ThisPalGbl == NULL )
+    {
+        ret = DDERR_OUTOFMEMORY;
+        goto cleanup;
+    }
+
+    /*Some initial setup*/
+
+    ThisPalInt->lpLcl = ThisPalLcl;
+    ThisPalLcl->lpGbl = ThisPalGbl;
+
+    ThisPalLcl->lpDD_lcl = ThisPalGbl->lpDD_lcl = pDDraw->lpLcl;
+    ThisPalGbl->dwFlags = ConvertPCapsFlags(dwFlags);
+
+    ThisPalInt->lpVtbl = (PVOID)&DirectDrawPalette_Vtable;
+    ThisPalGbl->dwProcessId = GetCurrentProcessId();
+
+    mDdCreatePalette.lpDD = pDDraw->lpLcl->lpGbl;
+    mDdCreatePalette.lpDDPalette = ThisPalGbl;
+    if(pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_CREATEPALETTE) {
+        mDdCreatePalette.CreatePalette = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HALDD.CreatePalette;
+        DX_STUB_str("Using HAL CreatePalette\n");
+    }
+    else {
+        mDdCreatePalette.CreatePalette = pDDraw->lpLcl->lpGbl->lpDDCBtmp->HELDD.CreatePalette;
+        DX_STUB_str("Using HEL CreatePalette\n");
+    }
+    mDdCreatePalette.ddRVal = DDERR_GENERIC;
+    mDdCreatePalette.lpColorTable = palent;
+
+    if (mDdCreatePalette.CreatePalette(&mDdCreatePalette) == DDHAL_DRIVER_NOTHANDLED)
+    {
+        DX_STUB_str("mDdCreateSurface failed with DDHAL_DRIVER_NOTHANDLED.");
+        ret = DDERR_NOTINITIALIZED;
+        goto cleanup;
+    }
+
+    if (mDdCreatePalette.ddRVal != DD_OK)
+    {
+        DX_STUB_str("mDdCreateSurface failed.");
+        ret = mDdCreatePalette.ddRVal;
+        goto cleanup;
+    }
+
+    *ppPalette = (LPDIRECTDRAWPALETTE)ThisPalInt;
+    ThisPalInt->lpLink = pDDraw->lpLcl->lpGbl->palList;
+    pDDraw->lpLcl->lpGbl->palList = ThisPalInt;
+    ThisPalInt->lpLcl->dwReserved1 = (ULONG_PTR)pDDraw;
+    IDirectDrawPalette_AddRef(*ppPalette);
+
+    return DD_OK;
+
+cleanup:
+    if(ThisPalInt) DxHeapMemFree(ThisPalInt);
+    if(ThisPalLcl) DxHeapMemFree(ThisPalLcl);
+    if(ThisPalGbl) DxHeapMemFree(ThisPalGbl);
+
+    return ret;
+}

Propchange: trunk/reactos/dll/directx/ddraw/Palette/createpalette.c
------------------------------------------------------------------------------
    svn:eol-style = native

Added: trunk/reactos/dll/directx/ddraw/Palette/palette.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Palette/palette.c?rev=49872&view=auto
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Palette/palette.c (added)
+++ trunk/reactos/dll/directx/ddraw/Palette/palette.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -1,0 +1,157 @@
+/* $Id: palette.c $
+ *
+ * COPYRIGHT:            See COPYING in the top level directory
+ * PROJECT:              ReactOS DirectX
+ * FILE:                 ddraw/Palette/palette.c
+ * PURPOSE:              IDirectDrawPalette Implementation
+ * PROGRAMMER:           Jérôme Gardou
+ *
+ */
+
+#include "rosdraw.h"
+
+/*****************************************************************************
+ * IDirectDrawPalette::QueryInterface
+ *
+ * A usual QueryInterface implementation. Can only Query IUnknown and
+ * IDirectDrawPalette
+ *
+ * Params:
+ *  refiid: The interface id queried for
+ *  obj: Address to return the interface pointer at
+ *
+ * Returns:
+ *  S_OK on success
+ *  E_NOINTERFACE if the requested interface wasn't found
+ *****************************************************************************/
+static HRESULT WINAPI
+DirectDrawPalette_QueryInterface(IDirectDrawPalette *iface,
+                                      REFIID refiid,
+                                      void **obj)
+{
+    if (IsEqualGUID(refiid, &IID_IUnknown)
+        || IsEqualGUID(refiid, &IID_IDirectDrawPalette))
+    {
+        *obj = iface;
+        IDirectDrawPalette_AddRef(iface);
+        return S_OK;
+    }
+    else
+    {
+        *obj = NULL;
+        return E_NOINTERFACE;
+    }
+}
+
+/*****************************************************************************
+ * IDirectDrawPaletteImpl::AddRef
+ *
+ * Increases the refcount.
+ *
+ * Returns:
+ *  The new refcount
+ *
+ *****************************************************************************/
+static ULONG WINAPI
+DirectDrawPalette_AddRef(IDirectDrawPalette *iface)
+{
+    LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface;
+    ULONG ref = 0;
+
+    _SEH2_TRY
+    {
+        ref = ++This->dwIntRefCnt;
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+    }
+    _SEH2_END
+
+    return ref;
+}
+
+/*****************************************************************************
+ * IDirectDrawPaletteImpl::Release
+ *
+ * Reduces the refcount. If the refcount falls to 0, the object is destroyed
+ *
+ * Returns:
+ *  The new refcount
+ *
+ *****************************************************************************/
+static ULONG WINAPI
+DirectDrawPalette_Release(IDirectDrawPalette *iface)
+{
+    LPDDRAWI_DDRAWPALETTE_INT This = (LPDDRAWI_DDRAWPALETTE_INT)iface;
+    ULONG ref = 0;
+
+    _SEH2_TRY
+    {
+        ref = --This->dwIntRefCnt;
+        if(ref == 0)
+        {
+            AcquireDDThreadLock();
+            if(((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw7_Vtable
+                    || ((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1)->lpVtbl == &DirectDraw4_Vtable)
+                Main_DirectDraw_Release((LPDDRAWI_DIRECTDRAW_INT)This->lpLcl->dwReserved1) ;
+            DxHeapMemFree(This); //HUGE FIXME!!!
+            ReleaseDDThreadLock();
+        }
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+    }
+    _SEH2_END
+
+    return ref;
+}
+
+static HRESULT WINAPI
+DirectDrawPalette_Initialize( LPDIRECTDRAWPALETTE iface,
+				              LPDIRECTDRAW ddraw,
+                              DWORD dwFlags,
+				              LPPALETTEENTRY palent)
+{
+   DX_WINDBG_trace();
+   DX_STUB;
+}
+
+static HRESULT WINAPI
+DirectDrawPalette_GetEntries( LPDIRECTDRAWPALETTE iface,
+                              DWORD dwFlags,
+				              DWORD dwStart, DWORD dwCount,
+				              LPPALETTEENTRY palent)
+{
+   DX_WINDBG_trace();
+   DX_STUB;
+}
+
+static HRESULT WINAPI
+DirectDrawPalette_SetEntries( LPDIRECTDRAWPALETTE iface,
+                              DWORD dwFlags,
+				              DWORD dwStart,
+                              DWORD dwCount,
+				              LPPALETTEENTRY palent)
+{
+   DX_WINDBG_trace();
+   DX_STUB;
+}
+
+static HRESULT WINAPI
+DirectDrawPalette_GetCaps( LPDIRECTDRAWPALETTE iface,
+                           LPDWORD lpdwCaps)
+{
+   DX_WINDBG_trace();
+   DX_STUB;
+}
+
+const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable =
+{
+    DirectDrawPalette_QueryInterface,
+    DirectDrawPalette_AddRef,
+    DirectDrawPalette_Release,
+    DirectDrawPalette_GetCaps,
+    DirectDrawPalette_GetEntries,
+    DirectDrawPalette_Initialize,
+    DirectDrawPalette_SetEntries
+};

Propchange: trunk/reactos/dll/directx/ddraw/Palette/palette.c
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: trunk/reactos/dll/directx/ddraw/Surface/createsurface.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/createsurface.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/createsurface.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/createsurface.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -182,7 +182,6 @@
             /* FIXME  ThisSurfaceMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop */
             ThisSurfMore->dmiDDrawReserved7.wMonitorsAttachedToDesktop = 1;
             pDDraw->lpLcl->lpPrimary = ThisSurfInt;
-            Main_DirectDraw_AddRef(pDDraw);
         }
         else
         {

Modified: trunk/reactos/dll/directx/ddraw/Surface/surface_main.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Surface/surface_main.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Surface/surface_main.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Surface/surface_main.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -264,14 +264,28 @@
 
 ULONG WINAPI Main_DDrawSurface_Release(LPDDRAWI_DDRAWSURFACE_INT This)
 {
-
     /* FIXME
        This is not right exiame how it should be done
      */
-    DX_STUB_str("FIXME This is not right exiame how it should be done\n");
-    return This->dwIntRefCnt;
-}
-
+    ULONG ret = --This->dwIntRefCnt;
+    if(!ret)
+    {
+        DX_STUB_str("Release is a bit simplistic right now\n");
+        AcquireDDThreadLock();
+        DxHeapMemFree(This);
+        ReleaseDDThreadLock();
+    }
+    return ret;
+}
+
+ULONG WINAPI Main_DDrawSurface_Release4(LPDDRAWI_DDRAWSURFACE_INT This)
+{
+    ULONG ref = Main_DDrawSurface_Release(This) ;
+
+    if(ref == 0) Main_DirectDraw_Release(This->lpLcl->lpSurfMore->lpDD_int);
+
+    return ref;
+}
 
 HRESULT WINAPI Main_DDrawSurface_Blt(LPDDRAWI_DDRAWSURFACE_INT ThisDest, LPRECT rdst,
                                      LPDDRAWI_DDRAWSURFACE_INT ThisSrc, LPRECT rsrc, DWORD dwFlags, LPDDBLTFX lpbltfx)

Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface4_Vtable.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -16,7 +16,7 @@
 #endif
 
 ULONG   WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE4);
-ULONG   WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE4);
+ULONG   WINAPI Main_DDrawSurface_Release4(LPDIRECTDRAWSURFACE4);
 HRESULT WINAPI Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE4, REFIID, LPVOID*);
 HRESULT WINAPI Main_DDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE4, HDC);
 HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE4, LPRECT, LPDIRECTDRAWSURFACE4, LPRECT, DWORD, LPDDBLTFX);
@@ -68,7 +68,7 @@
 {
     Main_DDrawSurface_QueryInterface,
     Main_DDrawSurface_AddRef,                        /* (Compact done) */
-    Main_DDrawSurface_Release,
+    Main_DDrawSurface_Release4,
     Main_DDrawSurface_AddAttachedSurface,
     Main_DDrawSurface_AddOverlayDirtyRect,
     Main_DDrawSurface_Blt,

Modified: trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/Vtable/DirectDrawSurface7_Vtable.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -16,7 +16,7 @@
 #endif
 
 ULONG   WINAPI Main_DDrawSurface_AddRef(LPDIRECTDRAWSURFACE7);
-ULONG   WINAPI Main_DDrawSurface_Release(LPDIRECTDRAWSURFACE7);
+ULONG   WINAPI Main_DDrawSurface_Release4(LPDIRECTDRAWSURFACE7);
 HRESULT WINAPI Main_DDrawSurface_QueryInterface(LPDIRECTDRAWSURFACE7, REFIID, LPVOID*);
 HRESULT WINAPI Main_DDrawSurface_ReleaseDC(LPDIRECTDRAWSURFACE7, HDC);
 HRESULT WINAPI Main_DDrawSurface_Blt(LPDIRECTDRAWSURFACE7, LPRECT, LPDIRECTDRAWSURFACE7, LPRECT, DWORD, LPDDBLTFX);
@@ -72,7 +72,7 @@
 {
     Main_DDrawSurface_QueryInterface,
     Main_DDrawSurface_AddRef,                        /* (Compact done) */
-    Main_DDrawSurface_Release,
+    Main_DDrawSurface_Release4,
     Main_DDrawSurface_AddAttachedSurface,
     Main_DDrawSurface_AddOverlayDirtyRect,
     Main_DDrawSurface_Blt,

Modified: trunk/reactos/dll/directx/ddraw/ddraw.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/ddraw.rbuild?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/ddraw.rbuild [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/ddraw.rbuild [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -8,7 +8,7 @@
 	<library>d3d8thk</library>
 	<library>dxguid</library>
 	<library>ole32</library>
-	<library>user32</library>
+	<library>uuid</library>
 	<library>advapi32</library>
 	<library>pseh</library>
 
@@ -49,7 +49,8 @@
 		<file>kernel_stubs.c</file>
 	</directory>
 	<directory name="Palette">
-		<file>palette_stubs.c</file>
+		<file>palette.c</file>
+		<file>createpalette.c</file>
 	</directory>
 	<directory name="Videoport">
 		<file>videoport_stubs.c</file>

Modified: trunk/reactos/dll/directx/ddraw/rosdraw.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/rosdraw.h?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/rosdraw.h [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/rosdraw.h [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -34,7 +34,7 @@
 extern IDirectDrawSurface3Vtbl DirectDrawSurface3_Vtable;
 extern IDirectDrawSurface2Vtbl DirectDrawSurface2_Vtable;
 extern IDirectDrawSurfaceVtbl DirectDrawSurface_Vtable;
-extern IDirectDrawPaletteVtbl DirectDrawPalette_Vtable;
+extern const IDirectDrawPaletteVtbl DirectDrawPalette_Vtable;
 extern IDirectDrawClipperVtbl DirectDrawClipper_Vtable;
 extern IDirectDrawColorControlVtbl DirectDrawColorControl_Vtable;
 extern IDirectDrawGammaControlVtbl DirectDrawGammaControl_Vtable;
@@ -92,6 +92,10 @@
                        LPDDSURFACEDESC2 pDDSD,
                        LPDDRAWI_DDRAWSURFACE_INT *ppSurf,
                        IUnknown *pUnkOuter);
+
+HRESULT
+Internal_CreatePalette( LPDDRAWI_DIRECTDRAW_INT pDDraw, DWORD dwFlags,
+                  LPPALETTEENTRY palent, LPDIRECTDRAWPALETTE* ppPalette, LPUNKNOWN pUnkOuter);
 
 /* convert DDSURFACEDESC to DDSURFACEDESC2 */
 void CopyDDSurfDescToDDSurfDesc2(LPDDSURFACEDESC2 dst_pDesc, LPDDSURFACEDESC src_pDesc);

Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.c?rev=49872&r1=49871&r2=49872&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c [iso-8859-1] (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c [iso-8859-1] Tue Nov 30 16:29:49 2010
@@ -24,17 +24,29 @@
     LPDDRAWI_DIRECTDRAW_INT This;
 
     DX_WINDBG_trace();
-
-    if ((IsBadReadPtr(pIface,sizeof(LPDIRECTDRAW))) ||
-       (IsBadWritePtr(pIface,sizeof(LPDIRECTDRAW))))
+    BOOL linking = FALSE;
+
+    if (pIface == NULL)
     {
         return DDERR_INVALIDPARAMS;
     }
 
     This = (LPDDRAWI_DIRECTDRAW_INT)*pIface;
 
-    if ( (IsBadWritePtr(This,sizeof(LPDDRAWI_DIRECTDRAW_INT)) != 0) || 
-         (IsBadWritePtr(This->lpLcl,sizeof(LPDDRAWI_DIRECTDRAW_LCL)) != 0) )
+    DX_STUB_str("Linking?\n")
+
+    _SEH2_TRY
+    {
+        linking = This->lpLcl ? TRUE:FALSE;
+    }
+    _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
+    {
+        linking = FALSE;
+    }
+    _SEH2_END;
+
+    /* fixme linking too second link when we shall not doing it */
+    if (!linking)
     {
         /* We do not have a DirectDraw interface, we need alloc it*/
         LPDDRAWI_DIRECTDRAW_INT memThis;
@@ -310,6 +322,7 @@
             return DDERR_NODIRECTDRAWSUPPORT;
         }
         dwFlags |= DDRAWI_NOHARDWARE;
+        DX_STUB_str("No hardware support\n");
     }
 
     if (hel_ret!=DD_OK)




More information about the Ros-diffs mailing list