Complete the dummy of HAL.
CreateDirectDraw and CreateDirectDrawEx
will return a pointer of ddraw object.
only hardware acclration support are being add.
noting real working yet.
Modified: trunk/reactos/lib/ddraw/ddraw.c
Modified: trunk/reactos/lib/ddraw/ddraw_hal.c
Modified: trunk/reactos/lib/ddraw/ddraw_private.h

Modified: trunk/reactos/lib/ddraw/ddraw.c
--- trunk/reactos/lib/ddraw/ddraw.c	2005-03-20 09:46:13 UTC (rev 14210)
+++ trunk/reactos/lib/ddraw/ddraw.c	2005-03-20 09:58:10 UTC (rev 14211)
@@ -76,27 +76,30 @@
 	LPGUID lpGUID, LPVOID *lplpDD, LPUNKNOWN pUnkOuter, REFIID iid, BOOL ex) 
 {  		      
 	
-	
+	 HRESULT hr;
 
-
-	//HDC desktop;
-	
-    /* BOOL ex == TRUE it is DirectDrawCreateEx call here. */
-	
-	/* TODO: 
+     
+    /* TODO 1: 
 	   check the GUID are right 
 	   add scanner that DirectDrawCreate / DirectDrawCreateEx select right driver.
 	   now we will assume it is the current display driver 
 	*/
 
+	 /* TODO 2: 
+	   do not only use hardware mode.
+	*/
+
+	hr = HAL_DirectDraw_Create(lpGUID, lplpDD, pUnkOuter, iid,  ex);
+
+	/* old code 
+	 //HDC desktop;		
 	
-	/*
 	desktop = GetWindowDC(GetDesktopWindow());
 	lplpDD = OsThunkDdCreateDirectDrawObject(desktop);   
 	if (lplpDD == NULL) return DDERR_NODIRECTDRAWHW;
 	*/
 	 	
-	return DDERR_NODIRECTDRAWHW;
+	return hr;
 }
 
 BOOL WINAPI DllMain(HINSTANCE hInstance,DWORD fwdReason, LPVOID lpvReserved)

Modified: trunk/reactos/lib/ddraw/ddraw_hal.c
--- trunk/reactos/lib/ddraw/ddraw_hal.c	2005-03-20 09:46:13 UTC (rev 14210)
+++ trunk/reactos/lib/ddraw/ddraw_hal.c	2005-03-20 09:58:10 UTC (rev 14211)
@@ -1,330 +1,353 @@
-/*	DirectDraw HAL driver
- *
- * Copyright 2001 TransGaming Technologies Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-
-
-
+/*	DirectDraw HAL driver
+ *
+ * Copyright 2001 TransGaming Technologies Inc.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ */
+
+
+
 #include <windows.h>
 #include "ddraw.h"
-#include "rosddraw.h"
-#include "ddraw_private.h"
-
-static IDirectDraw7Vtbl HAL_DirectDraw_VTable;
-
-
-HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
-{    
-    //This->local.lpGbl = &dd_gbl;
-
-    This->final_release = HAL_DirectDraw_final_release;
-    This->set_exclusive_mode = HAL_DirectDrawSet_exclusive_mode;
-   // This->create_palette = HAL_DirectDrawPalette_Create;
-
-    This->create_primary    = HAL_DirectDraw_create_primary;
-    This->create_backbuffer = HAL_DirectDraw_create_backbuffer;
-    This->create_texture    = HAL_DirectDraw_create_texture;
-
-    ICOM_INIT_INTERFACE(This, IDirectDraw7, HAL_DirectDraw_VTable);
-    return S_OK;
-}
-
-void HAL_DirectDraw_final_release(IDirectDrawImpl *This)
-{
- 
-}
-
-HRESULT HAL_DirectDrawSet_exclusive_mode(IDirectDrawImpl *This, DWORD dwEnterExcl)
-{
- return DDERR_UNSUPPORTED;
-}
-
-
-HRESULT HAL_DirectDraw_create_primary(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD, LPDIRECTDRAWSURFACE7* ppSurf,
-				      IUnknown* pUnkOuter)
-
-{
-	return DDERR_UNSUPPORTED;
-  }
-
-HRESULT HAL_DirectDraw_create_backbuffer(IDirectDrawImpl* This,
-					 const DDSURFACEDESC2* pDDSD,
-					 LPDIRECTDRAWSURFACE7* ppSurf,
-					 IUnknown* pUnkOuter,
-					 IDirectDrawSurfaceImpl* primary)
-{
-	return DDERR_UNSUPPORTED;
-  }
-
-HRESULT HAL_DirectDraw_create_texture(IDirectDrawImpl* This,
-				      const DDSURFACEDESC2* pDDSD,
-				      LPDIRECTDRAWSURFACE7* ppSurf,
-				      LPUNKNOWN pOuter,
-				      DWORD dwMipMapLevel)
-{
-	return DDERR_UNSUPPORTED;
-  }
-
-
-
-
-
-
-/* basic funtion for the com object */
-HRESULT WINAPI HAL_DirectDraw_QueryInterface(LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj) 
-{
-	return DDERR_UNSUPPORTED;
-  }
-
-ULONG WINAPI HAL_DirectDraw_AddRef(LPDIRECTDRAW7 iface) 
-{
-    IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
-    ULONG ref = InterlockedIncrement(&This->ref);
-
-    //TRACE("(%p)->() incrementing from %lu.\n", This, ref -1);
-
-    return ref;
-}
-
-ULONG WINAPI HAL_DirectDraw_Release(LPDIRECTDRAW7 iface) 
-{
-    IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
-    ULONG ref = InterlockedDecrement(&This->ref);
-    
-    if (ref == 0)
-    {
-	if (This->final_release != NULL)
-	    This->final_release(This);
-
-	/* We free the private. This is an artifact of the fact that I don't
-	 * have the destructors set up correctly. */
-	if (This->private != (This+1))
-	    HeapFree(GetProcessHeap(), 0, This->private);
-
-	HeapFree(GetProcessHeap(), 0, This);
-    }
-
-    return ref;
-}
-
-HRESULT WINAPI HAL_DirectDraw_Compact(LPDIRECTDRAW7 iface) 
-{
- 
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface, DWORD dwFlags, 
-											 LPDIRECTDRAWCLIPPER *ppClipper, IUnknown *pUnkOuter)
-{
-    return DDERR_UNSUPPORTED;
-}
-HRESULT WINAPI HAL_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
-			      LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE* ppPalette,LPUNKNOWN pUnknown)
-{
-	return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
-			      LPDIRECTDRAWSURFACE7 *ppSurf,IUnknown *pUnkOuter) 
-{
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src,
-				 LPDIRECTDRAWSURFACE7* dst) 
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
-				 LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback) 
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
-			     LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
-			     LPDDENUMSURFACESCALLBACK7 callback) 
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface) 
-{
-return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
-			LPDDCAPS pHELCaps) 
-{
-return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD) 
-{
-    return DDERR_UNSUPPORTED;
-}
-
-
-HRESULT WINAPI HAL_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD pCodes)
-{
-  
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface, 
-											 LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
-{
-  
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
-{  
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL status)
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID lpGuid)
-{
- return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
-{
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd,
-												   DWORD cooplevel)
-{
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
-			      DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
-{
-  
-    return DDERR_UNSUPPORTED;
-}
-
-
-HRESULT WINAPI HAL_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
-												   HANDLE h)
-{
-  
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
-				   LPDWORD total, LPDWORD free)											   
-
-{
-  
-    return DDERR_UNSUPPORTED;
-}
-												   
-HRESULT WINAPI HAL_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
-												LPDIRECTDRAWSURFACE7 *lpDDS)
-{  
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
-{
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface) 
-{
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
-				   LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
-{    
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes,
-			      DWORD dwNumModes, DWORD dwFlags)
-{    
-    return DDERR_UNSUPPORTED;
-}
-
-HRESULT WINAPI HAL_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b)
-{    
-    return DDERR_UNSUPPORTED;
-}
-
-/* End com interface */
-
-
-
-
-HRESULT WINAPI HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
-			      IUnknown* pUnkOuter, BOOL ex)
-{
-   
-    IDirectDrawImpl* This;    
-	*pIface = ICOM_INTERFACE(This, IDirectDraw7);
-
-    return DD_OK;
-}
-
-static IDirectDraw7Vtbl HAL_DirectDraw_VTable =
-{
-    HAL_DirectDraw_QueryInterface,
-    HAL_DirectDraw_AddRef,
-    HAL_DirectDraw_Release,
-    HAL_DirectDraw_Compact,
-    HAL_DirectDraw_CreateClipper,
-    HAL_DirectDraw_CreatePalette,
-    HAL_DirectDraw_CreateSurface,
-    HAL_DirectDraw_DuplicateSurface,
-    HAL_DirectDraw_EnumDisplayModes,
-    HAL_DirectDraw_EnumSurfaces,
-    HAL_DirectDraw_FlipToGDISurface,
-    HAL_DirectDraw_GetCaps,
-    HAL_DirectDraw_GetDisplayMode,
-    HAL_DirectDraw_GetFourCCCodes,
-    HAL_DirectDraw_GetGDISurface,
-    HAL_DirectDraw_GetMonitorFrequency,
-    HAL_DirectDraw_GetScanLine,
-    HAL_DirectDraw_GetVerticalBlankStatus,
-    HAL_DirectDraw_Initialize,
-    HAL_DirectDraw_RestoreDisplayMode,
-    HAL_DirectDraw_SetCooperativeLevel,
-    HAL_DirectDraw_SetDisplayMode,
-    HAL_DirectDraw_WaitForVerticalBlank,
-    HAL_DirectDraw_GetAvailableVidMem,
-    HAL_DirectDraw_GetSurfaceFromDC,
-    HAL_DirectDraw_RestoreAllSurfaces,
-    HAL_DirectDraw_TestCooperativeLevel,
-    HAL_DirectDraw_GetDeviceIdentifier,
-    HAL_DirectDraw_StartModeTest,
-    HAL_DirectDraw_EvaluateMode
-};
+#include "rosddraw.h"
+#include "ddraw_private.h"
+
+static IDirectDraw7Vtbl HAL_DirectDraw_VTable;
+
+
+HRESULT HAL_DirectDraw_Construct(IDirectDrawImpl *This, BOOL ex)
+{    
+    //This->local.lpGbl = &dd_gbl;
+
+    This->final_release = HAL_DirectDraw_final_release;
+    This->set_exclusive_mode = HAL_DirectDrawSet_exclusive_mode;
+   // This->create_palette = HAL_DirectDrawPalette_Create;
+
+    This->create_primary    = HAL_DirectDraw_create_primary;
+    This->create_backbuffer = HAL_DirectDraw_create_backbuffer;
+    This->create_texture    = HAL_DirectDraw_create_texture;
+
+    ICOM_INIT_INTERFACE(This, IDirectDraw7, HAL_DirectDraw_VTable);
+    return S_OK;
+}
+
+void HAL_DirectDraw_final_release(IDirectDrawImpl *This)
+{
+ 
+}
+
+HRESULT HAL_DirectDrawSet_exclusive_mode(IDirectDrawImpl *This, DWORD dwEnterExcl)
+{
+ return DDERR_UNSUPPORTED;
+}
+
+
+HRESULT HAL_DirectDraw_create_primary(IDirectDrawImpl* This, const DDSURFACEDESC2* pDDSD, LPDIRECTDRAWSURFACE7* ppSurf,
+				      IUnknown* pUnkOuter)
+
+{
+	return DDERR_UNSUPPORTED;
+  }
+
+HRESULT HAL_DirectDraw_create_backbuffer(IDirectDrawImpl* This,
+					 const DDSURFACEDESC2* pDDSD,
+					 LPDIRECTDRAWSURFACE7* ppSurf,
+					 IUnknown* pUnkOuter,
+					 IDirectDrawSurfaceImpl* primary)
+{
+	return DDERR_UNSUPPORTED;
+  }
+
+HRESULT HAL_DirectDraw_create_texture(IDirectDrawImpl* This,
+				      const DDSURFACEDESC2* pDDSD,
+				      LPDIRECTDRAWSURFACE7* ppSurf,
+				      LPUNKNOWN pOuter,
+				      DWORD dwMipMapLevel)
+{
+	return DDERR_UNSUPPORTED;
+  }
+
+
+
+
+
+
+/* basic funtion for the com object */
+HRESULT WINAPI HAL_DirectDraw_QueryInterface(LPDIRECTDRAW7 iface,REFIID refiid,LPVOID *obj) 
+{
+	return DDERR_UNSUPPORTED;
+  }
+
+ULONG WINAPI HAL_DirectDraw_AddRef(LPDIRECTDRAW7 iface) 
+{
+    IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+    ULONG ref = InterlockedIncrement(&This->ref);
+
+    //TRACE("(%p)->() incrementing from %lu.\n", This, ref -1);
+
+    return ref;
+}
+
+ULONG WINAPI HAL_DirectDraw_Release(LPDIRECTDRAW7 iface) 
+{
+    IDirectDrawImpl *This = (IDirectDrawImpl *)iface;
+    ULONG ref = InterlockedDecrement(&This->ref);
+    
+    if (ref == 0)
+    {
+	if (This->final_release != NULL)
+	    This->final_release(This);
+
+	/* We free the private. This is an artifact of the fact that I don't
+	 * have the destructors set up correctly. */
+	if (This->private != (This+1))
+	    HeapFree(GetProcessHeap(), 0, This->private);
+
+	HeapFree(GetProcessHeap(), 0, This);
+    }
+
+    return ref;
+}
+
+HRESULT WINAPI HAL_DirectDraw_Compact(LPDIRECTDRAW7 iface) 
+{
+ 
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_CreateClipper(LPDIRECTDRAW7 iface, DWORD dwFlags, 
+											 LPDIRECTDRAWCLIPPER *ppClipper, IUnknown *pUnkOuter)
+{
+    return DDERR_UNSUPPORTED;
+}
+HRESULT WINAPI HAL_DirectDraw_CreatePalette(LPDIRECTDRAW7 iface, DWORD dwFlags,
+			      LPPALETTEENTRY palent,LPDIRECTDRAWPALETTE* ppPalette,LPUNKNOWN pUnknown)
+{
+	return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_CreateSurface(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD,
+			      LPDIRECTDRAWSURFACE7 *ppSurf,IUnknown *pUnkOuter) 
+{
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_DuplicateSurface(LPDIRECTDRAW7 iface, LPDIRECTDRAWSURFACE7 src,
+				 LPDIRECTDRAWSURFACE7* dst) 
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_EnumDisplayModes(LPDIRECTDRAW7 iface, DWORD dwFlags,
+				 LPDDSURFACEDESC2 pDDSD, LPVOID context, LPDDENUMMODESCALLBACK2 callback) 
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_EnumSurfaces(LPDIRECTDRAW7 iface, DWORD dwFlags,
+			     LPDDSURFACEDESC2 lpDDSD2, LPVOID context,
+			     LPDDENUMSURFACESCALLBACK7 callback) 
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_FlipToGDISurface(LPDIRECTDRAW7 iface) 
+{
+return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetCaps(LPDIRECTDRAW7 iface, LPDDCAPS pDriverCaps,
+			LPDDCAPS pHELCaps) 
+{
+return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetDisplayMode(LPDIRECTDRAW7 iface, LPDDSURFACEDESC2 pDDSD) 
+{
+    return DDERR_UNSUPPORTED;
+}
+
+
+HRESULT WINAPI HAL_DirectDraw_GetFourCCCodes(LPDIRECTDRAW7 iface, LPDWORD pNumCodes, LPDWORD pCodes)
+{
+  
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetGDISurface(LPDIRECTDRAW7 iface, 
+											 LPDIRECTDRAWSURFACE7 *lplpGDIDDSSurface)
+{
+  
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetMonitorFrequency(LPDIRECTDRAW7 iface,LPDWORD freq)
+{  
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine)
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetVerticalBlankStatus(LPDIRECTDRAW7 iface, LPBOOL status)
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_Initialize(LPDIRECTDRAW7 iface, LPGUID lpGuid)
+{
+ return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_RestoreDisplayMode(LPDIRECTDRAW7 iface)
+{
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_SetCooperativeLevel(LPDIRECTDRAW7 iface, HWND hwnd,
+												   DWORD cooplevel)
+{
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_SetDisplayMode(LPDIRECTDRAW7 iface, DWORD dwWidth,
+			      DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
+{
+  
+    return DDERR_UNSUPPORTED;
+}
+
+
+HRESULT WINAPI HAL_DirectDraw_WaitForVerticalBlank(LPDIRECTDRAW7 iface, DWORD dwFlags,
+												   HANDLE h)
+{
+  
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetAvailableVidMem(LPDIRECTDRAW7 iface, LPDDSCAPS2 ddscaps,
+				   LPDWORD total, LPDWORD free)											   
+
+{
+  
+    return DDERR_UNSUPPORTED;
+}
+												   
+HRESULT WINAPI HAL_DirectDraw_GetSurfaceFromDC(LPDIRECTDRAW7 iface, HDC hdc,
+												LPDIRECTDRAWSURFACE7 *lpDDS)
+{  
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_RestoreAllSurfaces(LPDIRECTDRAW7 iface)
+{
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_TestCooperativeLevel(LPDIRECTDRAW7 iface) 
+{
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_GetDeviceIdentifier(LPDIRECTDRAW7 iface,
+				   LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
+{    
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_StartModeTest(LPDIRECTDRAW7 iface, LPSIZE pModes,
+			      DWORD dwNumModes, DWORD dwFlags)
+{    
+    return DDERR_UNSUPPORTED;
+}
+
+HRESULT WINAPI HAL_DirectDraw_EvaluateMode(LPDIRECTDRAW7 iface,DWORD a,DWORD* b)
+{    
+    return DDERR_UNSUPPORTED;
+}
+
+/* End com interface */
+
+
+
+
+HRESULT WINAPI HAL_DirectDraw_Create(const GUID* pGUID, LPDIRECTDRAW7* pIface,
+			      IUnknown* pUnkOuter, BOOL ex)
+{
+   
+      HRESULT hr;
+    IDirectDrawImpl* This;    
+
+	/*
+    This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+		     sizeof(IDirectDrawImpl)
+		     + sizeof(HAL_DirectDrawImpl));
+	 */
+	This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+		     sizeof(IDirectDrawImpl));
+
+    if (This == NULL) return E_OUTOFMEMORY;
+
+    /* Note that this relation does *not* hold true if the DD object was
+     * CoCreateInstanced then Initialized. */
+    //This->private = (HAL_DirectDrawImpl *)(This+1);
+
+    /* Initialize the DDCAPS structure */
+    This->caps.dwSize = sizeof(This->caps);
+
+    hr = HAL_DirectDraw_Construct(This, ex);
+    if (FAILED(hr))
+	HeapFree(GetProcessHeap(), 0, This);
+    else
+	*pIface = ICOM_INTERFACE(This, IDirectDraw7);
+
+    return hr;
+}
+
+static IDirectDraw7Vtbl HAL_DirectDraw_VTable =
+{
+    HAL_DirectDraw_QueryInterface,
+    HAL_DirectDraw_AddRef,
+    HAL_DirectDraw_Release,
+    HAL_DirectDraw_Compact,
+    HAL_DirectDraw_CreateClipper,
+    HAL_DirectDraw_CreatePalette,
+    HAL_DirectDraw_CreateSurface,
+    HAL_DirectDraw_DuplicateSurface,
+    HAL_DirectDraw_EnumDisplayModes,
+    HAL_DirectDraw_EnumSurfaces,
+    HAL_DirectDraw_FlipToGDISurface,
+    HAL_DirectDraw_GetCaps,
+    HAL_DirectDraw_GetDisplayMode,
+    HAL_DirectDraw_GetFourCCCodes,
+    HAL_DirectDraw_GetGDISurface,
+    HAL_DirectDraw_GetMonitorFrequency,
+    HAL_DirectDraw_GetScanLine,
+    HAL_DirectDraw_GetVerticalBlankStatus,
+    HAL_DirectDraw_Initialize,
+    HAL_DirectDraw_RestoreDisplayMode,
+    HAL_DirectDraw_SetCooperativeLevel,
+    HAL_DirectDraw_SetDisplayMode,
+    HAL_DirectDraw_WaitForVerticalBlank,
+    HAL_DirectDraw_GetAvailableVidMem,
+    HAL_DirectDraw_GetSurfaceFromDC,
+    HAL_DirectDraw_RestoreAllSurfaces,
+    HAL_DirectDraw_TestCooperativeLevel,
+    HAL_DirectDraw_GetDeviceIdentifier,
+    HAL_DirectDraw_StartModeTest,
+    HAL_DirectDraw_EvaluateMode
+};

Modified: trunk/reactos/lib/ddraw/ddraw_private.h
--- trunk/reactos/lib/ddraw/ddraw_private.h	2005-03-20 09:46:13 UTC (rev 14210)
+++ trunk/reactos/lib/ddraw/ddraw_private.h	2005-03-20 09:58:10 UTC (rev 14211)
@@ -1,481 +1,482 @@
-/*
- * Copyright 2000-2001 TransGaming Technologies Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-#ifndef _DDCOMIMPL_H_
-#define _DDCOMIMPL_H_
-
-#include <stddef.h>
-
-/* Generates the name for a vtable pointer for a given interface. */
-/* The canonical name for a single interface is "lpVtbl". */
-#define ICOM_VFIELD_MULTI_NAME2(iface) ITF_##iface
-#define ICOM_VFIELD_MULTI_NAME(iface) ICOM_VFIELD_MULTI_NAME2(iface)
-
-/* Declares a vtable pointer field in an implementation. */
-#define ICOM_VFIELD_MULTI(iface) \
-	iface ICOM_VFIELD_MULTI_NAME(iface)
-
-/* Returns the offset of a vtable pointer within an implementation object. */
-#define ICOM_VFIELD_OFFSET(impltype, iface) \
-	offsetof(impltype, ICOM_VFIELD_MULTI_NAME(iface))
-
-/* Given an interface pointer, returns the implementation pointer. */
-#define ICOM_OBJECT(impltype, ifacename, ifaceptr)		\
-	(impltype*)((ifaceptr) == NULL ? NULL			\
-		  : (char*)(ifaceptr) - ICOM_VFIELD_OFFSET(impltype,ifacename))
-
-#define ICOM_THIS_FROM(impltype, ifacename, ifaceptr) \
-	impltype* This = ICOM_OBJECT(impltype, ifacename, ifaceptr)
-
-/* Given an object and interface name, returns a pointer to that interface. */
-#define ICOM_INTERFACE(implobj, iface) \
-	(&((implobj)->ICOM_VFIELD_MULTI_NAME(iface)))
-
-#define ICOM_INIT_INTERFACE(implobj, ifacename, vtblname) \
-	do { \
-	  (implobj)->ICOM_VFIELD_MULTI_NAME(ifacename).lpVtbl = &(vtblname); \
-	} while (0)
-
-#define COM_INTERFACE_CAST(impltype, ifnamefrom, ifnameto, ifaceptr)	\
-	ICOM_INTERFACE(ICOM_OBJECT(impltype, ifnamefrom, ifaceptr), ifnameto)
-
-#endif /* _DDCOMIMPL_H_ */
-
-#ifndef __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
-#define __WINE_DLLS_DDRAW_DDRAW_PRIVATE_H
-
-/* MAY NOT CONTAIN X11 or DGA specific includes/defines/structs! */
-
-#include <stdarg.h>
-#include <stdio.h>
-
-#include "windef.h"
-#include "winbase.h"
-#include "wtypes.h"
-#include "wingdi.h"
-#include "winuser.h"
-#include "ddraw.h"
-#include "d3d.h"
-#include "ddrawi.h"
-
-/* XXX Put this somewhere proper. */
-#define DD_STRUCT_INIT(x)			\
-	do {					\
-		memset((x), 0, sizeof(*(x)));	\
-		(x)->dwSize = sizeof(*x);	\
-	} while (0)
-
-#define DD_STRUCT_COPY_BYSIZE(to,from)			\
-	do {						\
-	    	DWORD __size = (to)->dwSize;		\
-	    	DWORD __copysize = __size;		\
-	    	DWORD __resetsize = __size;		\
-	        if (__resetsize > sizeof(*to))		\
-		    __resetsize = sizeof(*to);		\
-	    	memset(to,0,__resetsize);               \
-	        if ((from)->dwSize < __size) 		\
-		    __copysize = (from)->dwSize;	\
-		memcpy(to,from,__copysize);		\
-		(to)->dwSize = __size;/*restore size*/	\
-	} while (0)
-
-#define MAKE_FOURCC(a,b,c,d) ((a << 0) | (b << 8) | (c << 16) | (d << 24))
-
-/*****************************************************************************
- * IDirectDraw implementation structure
- */
-
-typedef struct IDirectDrawImpl IDirectDrawImpl;
-typedef struct IDirectDrawPaletteImpl IDirectDrawPaletteImpl;
-typedef struct IDirectDrawClipperImpl IDirectDrawClipperImpl;
-typedef struct IDirectDrawSurfaceImpl IDirectDrawSurfaceImpl;
-typedef struct IDirect3DDeviceImpl IDirect3DDeviceImpl;
-
-typedef void (*pixel_convert_func)(void *src, void *dst, DWORD width,
-				   DWORD height, LONG pitch,
-				   IDirectDrawPaletteImpl *palette);
-
-typedef void (*palette_convert_func)(LPPALETTEENTRY palent,
-				     void *screen_palette, DWORD start,
-				     DWORD count);
-
-struct IDirectDrawImpl
-{
-    ICOM_VFIELD_MULTI(IDirectDraw7);
-    ICOM_VFIELD_MULTI(IDirectDraw4);
-    ICOM_VFIELD_MULTI(IDirectDraw2);
-    ICOM_VFIELD_MULTI(IDirectDraw);
-    // ICOM_VFIELD_MULTI(IDirect3D7);
-    // ICOM_VFIELD_MULTI(IDirect3D3);
-    // ICOM_VFIELD_MULTI(IDirect3D2);
-    // ICOM_VFIELD_MULTI(IDirect3D);
-
-    DWORD ref;
-
-    /* TRUE if created via DirectDrawCreateEx or CoCreateInstance,
-     * FALSE if created via DirectDrawCreate. */
-    BOOL ex;
-
-    /* Linked list of surfaces, joined by next_ddraw in IDirectSurfaceImpl. */
-    IDirectDrawSurfaceImpl* surfaces;
-    /* Linked list of palettes, joined by next_ddraw. */
-    IDirectDrawPaletteImpl* palettes;
-    /* Linked list of clippers, joined by next_ddraw. */
-    IDirectDrawClipperImpl* clippers;
-
-    IDirectDrawSurfaceImpl* primary_surface;
-
-    DDRAWI_DIRECTDRAW_LCL local;
-    DDCAPS caps;
-
-    HWND window;
-    DWORD cooperative_level;
-    WNDPROC original_wndproc;
-
-    DWORD width, height;
-    LONG pitch;
-    DDPIXELFORMAT pixelformat;
-    DWORD cur_scanline;
-
-    /* Should each of these go into some structure? */
-    DWORD orig_width, orig_height;
-    LONG orig_pitch;
-    DDPIXELFORMAT orig_pixelformat;
-
-    /* Called when the refcount goes to 0. */
-    void (*final_release)(IDirectDrawImpl *This);
-
-    HRESULT (*set_exclusive_mode)(IDirectDrawImpl *This, DWORD dwExcl);
-
-    HRESULT (*create_palette)(IDirectDrawImpl* This, DWORD dwFlags,
-			      LPDIRECTDRAWPALETTE* ppPalette,
-			      LPUNKNOWN pUnkOuter);
-
-    /* Surface creation functions. For all of these, pOuter == NULL. */
-
-    /* Do not create any backbuffers or the flipping chain. */
-    HRESULT (*create_primary)(IDirectDrawImpl* This,
-			      const DDSURFACEDESC2* pDDSD,
-			      LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter);
-
-    /* Primary may be NULL if we are creating an unattached backbuffer. */
-    HRESULT (*create_backbuffer)(IDirectDrawImpl* This,
-				 const DDSURFACEDESC2* pDDSD,
-				 LPDIRECTDRAWSURFACE7* ppSurf,
-				 LPUNKNOWN pOuter,
-				 IDirectDrawSurfaceImpl* primary);
-
-    /* shiny happy offscreenplain surfaces */
-    HRESULT (*create_offscreen)(IDirectDrawImpl* This,
-				const DDSURFACEDESC2* pDDSD,
-				LPDIRECTDRAWSURFACE7* ppSurf,
-				LPUNKNOWN pOuter);
-
-    /* dwMipMapLevel is specified as per OpenGL. (i.e. 0 is base) */
-    HRESULT (*create_texture)(IDirectDrawImpl* This,
-   			      const DDSURFACEDESC2* pDDSD,
-   			      LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter,
-    		      DWORD dwMipMapLevel);
-
-     HRESULT (*create_zbuffer)(IDirectDrawImpl* This,
-			      const DDSURFACEDESC2* pDDSD,
-			      LPDIRECTDRAWSURFACE7* ppSurf, LPUNKNOWN pOuter);
-
-    LPVOID	private;
-
-    /* Everything below here is still questionable. */
-
-    DDPIXELFORMAT screen_pixelformat;
-
-    int           pixmap_depth;
-    // pixel_convert_func pixel_convert;
-    // palette_convert_func palette_convert;
-
-    /* Use to fool some too strict games */
-    INT32 (*allocate_memory)(IDirectDrawImpl *This, DWORD mem);
-    void (*free_memory)(IDirectDrawImpl *This, DWORD mem);
-    DWORD total_vidmem, available_vidmem;
-    
-    /* IDirect3D fields */
-    LPVOID d3d_private;
-
-    /* Used as a callback function to create a texture */
-    HRESULT (*d3d_create_texture)(IDirectDrawImpl *d3d, IDirectDrawSurfaceImpl *tex, BOOLEAN at_creation, IDirectDrawSurfaceImpl *main);
-
-    /* Used as a callback for Devices to tell to the D3D object it's been created */
-     HRESULT (*d3d_added_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device);
-     HRESULT (*d3d_removed_device)(IDirectDrawImpl *d3d, IDirect3DDeviceImpl *device);
-
-    /* This is needed for delayed texture creation and Z buffer blits */
-    IDirect3DDeviceImpl *current_device;
-
-    /* This is for the fake mainWindow */
-    ATOM	winclass;
-    PAINTSTRUCT	ps;
-    BOOL	paintable;
-};
-
-/*****************************************************************************
- * IDirectDrawPalette implementation structure
- */
-struct IDirectDrawPaletteImpl
-{
-    /* IUnknown fields */
-    ICOM_VFIELD_MULTI(IDirectDrawPalette);
-    DWORD ref;
-
-    DDRAWI_DDRAWPALETTE_LCL local;
-    DDRAWI_DDRAWPALETTE_GBL global;
-
-    /* IDirectDrawPalette fields */
-    HPALETTE		hpal;
-    WORD		palVersion, palNumEntries; /* LOGPALETTE */
-    PALETTEENTRY	palents[256];
-    /* This is to store the palette in 'screen format' */
-    int			screen_palents[256];
-
-    VOID (*final_release)(IDirectDrawPaletteImpl* This);
-
-    IDirectDrawImpl* ddraw_owner;
-    IDirectDrawPaletteImpl* prev_ddraw;
-    IDirectDrawPaletteImpl* next_ddraw;
-
-    LPVOID		private;
-};
-
-/*****************************************************************************
- * IDirectDrawClipper implementation structure
- */
-struct IDirectDrawClipperImpl
-{
-    /* IUnknown fields */
[truncated at 1000 lines; 698 more skipped]