adding more stuff for create surface right
Modified: trunk/reactos/lib/ddraw/hal/ddraw_hal.c
Modified: trunk/reactos/lib/ddraw/main/ddraw_main.c
Modified: trunk/reactos/lib/ddraw/rosdraw.h

Modified: trunk/reactos/lib/ddraw/hal/ddraw_hal.c
--- trunk/reactos/lib/ddraw/hal/ddraw_hal.c	2005-10-30 15:39:00 UTC (rev 18885)
+++ trunk/reactos/lib/ddraw/hal/ddraw_hal.c	2005-10-30 15:45:40 UTC (rev 18886)
@@ -319,8 +319,35 @@
 		
 
 
+     /* */
+	 /*  DWORD   dwIntRefCnt;
 
+	 
+        LPVOID  lpVtbl;
+        LPDDRAWI_DDRAWSURFACE_LCL  lpLcl;
+        LPDDRAWI_DDRAWSURFACE_INT  lpLink;
+       
+        } DDRAWI_DDRAWSURFACE_INT;
+     */
 
+	 /* Setting up some part for surface not ever thing are being fill in yet */
+	 This->DirectDrawGlobal.dsList = (LPDDRAWI_DDRAWSURFACE_INT)HeapAlloc(GetProcessHeap(), 0,
+		                              sizeof(DDRAWI_DDRAWSURFACE_INT));
+
+	 This->DirectDrawGlobal.dsList->lpLink = (LPDDRAWI_DDRAWSURFACE_INT) &This->DirectDrawGlobal.dsList;
+
+	 This->DirectDrawGlobal.dsList->lpLcl = (LPDDRAWI_DDRAWSURFACE_LCL)HeapAlloc(GetProcessHeap(), 0,
+		                              sizeof(DDRAWI_DDRAWSURFACE_LCL));
+
+	 This->DirectDrawGlobal.dsList->lpLcl->lpGbl = 
+		           (LPDDRAWI_DDRAWSURFACE_GBL)HeapAlloc(GetProcessHeap(), 0, sizeof(DDRAWI_DDRAWSURFACE_GBL));
+
+	 This->DirectDrawGlobal.dsList->lpLcl->lpGbl->lpDD  = &This->DirectDrawGlobal;
+
+	 
+
+
+
 	/* Now all setup for HAL is done and we hopply do not have forget anything */
 
 	return DD_OK;
@@ -328,7 +355,25 @@
 
 HRESULT Hal_DirectDraw_SetCooperativeLevel (LPDIRECTDRAW7 iface)
 {
-   	return DD_OK;
+   	IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
+
+	DDHAL_SETEXCLUSIVEMODEDATA SetExclusiveMode;
+
+	if (!(This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE)) 
+	{
+		return DDERR_NODRIVERSUPPORT;
+	}
+
+	SetExclusiveMode.lpDD = &This->DirectDrawGlobal;
+    SetExclusiveMode.ddRVal = DDERR_NOTPALETTIZED;
+	SetExclusiveMode.dwEnterExcl = This->cooperative_level;
+
+	if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.SetExclusiveMode(&SetExclusiveMode) != DDHAL_DRIVER_HANDLED)
+	{
+	   return DDERR_NODRIVERSUPPORT;
+	}
+
+	return SetExclusiveMode.ddRVal;
 }
 
 

Modified: trunk/reactos/lib/ddraw/main/ddraw_main.c
--- trunk/reactos/lib/ddraw/main/ddraw_main.c	2005-10-30 15:39:00 UTC (rev 18885)
+++ trunk/reactos/lib/ddraw/main/ddraw_main.c	2005-10-30 15:45:40 UTC (rev 18886)
@@ -16,6 +16,8 @@
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
 	HRESULT ret;
 
+	
+
 	// this if it is not called by DirectDrawCreate
 	if(FALSE)
 		return DDERR_ALREADYINITIALIZED;
@@ -48,7 +50,6 @@
 	// - allow more Flags
 
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
-	HRESULT ret;
 
 	// check the parameters
 	if (This->cooperative_level == cooplevel && This->window == hwnd)
@@ -72,20 +73,21 @@
 	This->cooperative_level = cooplevel;
 
 	
+    if (This->DirectDrawGlobal.lpDDCBtmp->HALDD.dwFlags & DDHAL_CB32_SETEXCLUSIVEMODE) 
+	{
+	    return Hal_DirectDraw_SetCooperativeLevel (iface);		
+	}
 
-	if((ret = Hal_DirectDraw_SetCooperativeLevel (iface)) != DD_OK)
-		return ret;
+	return Hel_DirectDraw_SetCooperativeLevel(iface);
 
-	if((ret = Hel_DirectDraw_SetCooperativeLevel (iface)) != DD_OK)
-		return ret;
-
-   	return DD_OK;
 }
 
 HRESULT WINAPI Main_DirectDraw_SetDisplayMode (LPDIRECTDRAW7 iface, DWORD dwWidth, DWORD dwHeight, 
 																DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
 {
 	DWORD ret;
+
+    /* FIXME implement hal setMode */
 	if((ret = Hal_DirectDraw_SetDisplayMode(iface,  dwWidth,  dwHeight, 
                                             dwBPP,  dwRefreshRate,  dwFlags)) == DD_OK)
 	{
@@ -174,8 +176,12 @@
 
 	That->lpVtbl = &DirectDrawSurface7_Vtable;
 	That->lpVtbl_v3 = &DDRAW_IDDS3_Thunk_VTable;
-	That->ref = 1;
+	
+	That->owner->DirectDrawGlobal.dsList->dwIntRefCnt =1;
 
+	/* we alwasy set to use the DirectDrawSurface7_Vtable as internel */
+	That->owner->DirectDrawGlobal.dsList->lpVtbl = (PVOID) &DirectDrawSurface7_Vtable;
+
 	*ppSurf = (LPDIRECTDRAWSURFACE7)That;
 
 	// the real surface object creation

Modified: trunk/reactos/lib/ddraw/rosdraw.h
--- trunk/reactos/lib/ddraw/rosdraw.h	2005-10-30 15:39:00 UTC (rev 18885)
+++ trunk/reactos/lib/ddraw/rosdraw.h	2005-10-30 15:45:40 UTC (rev 18886)
@@ -38,13 +38,7 @@
 {
 	IDirectDrawSurface7Vtbl* lpVtbl;
 	IDirectDrawSurface3Vtbl* lpVtbl_v3;
-
-    LONG ref;
-
-	DDRAWI_DDRAWSURFACE_GBL Global;
-	DDRAWI_DDRAWSURFACE_MORE More;
-	DDRAWI_DDRAWSURFACE_LCL Local;
-
+   
     IDirectDrawImpl* owner;
 
 } IDirectDrawSurfaceImpl;