Add second call to DdQueryDirectDrawObject.
Modified: trunk/reactos/lib/ddraw/hal/ddraw.c
Modified: trunk/reactos/lib/ddraw/rosdraw.h

Modified: trunk/reactos/lib/ddraw/hal/ddraw.c
--- trunk/reactos/lib/ddraw/hal/ddraw.c	2005-08-09 11:18:48 UTC (rev 17237)
+++ trunk/reactos/lib/ddraw/hal/ddraw.c	2005-08-09 13:57:03 UTC (rev 17238)
@@ -19,11 +19,11 @@
 		return DDERR_INVALIDPARAMS;
  
 	This->HalInfo.dwSize = sizeof(DDHALINFO);
+	This->D3dDriverData.dwSize = sizeof(D3DHAL_GLOBALDRIVERDATA);
     This->DriverCallbacks.DdMain.dwSize = sizeof(DDHAL_DDCALLBACKS);
 	This->DriverCallbacks.DdSurface.dwSize = sizeof(DDHAL_DDSURFACECALLBACKS);
 	This->DriverCallbacks.DdPalette.dwSize = sizeof(DDHAL_DDPALETTECALLBACKS);
 	This->DriverCallbacks.D3dMain.dwSize = sizeof(D3DHAL_CALLBACKS);
-	This->DriverCallbacks.D3dDriverData.dwSize = sizeof(D3DHAL_GLOBALDRIVERDATA);
 	This->DriverCallbacks.D3dBufferCallbacks.dwSize = sizeof(DDHAL_DDEXEBUFCALLBACKS);
  
 	if(!DdQueryDirectDrawObject (
@@ -33,15 +33,31 @@
 		&This->DriverCallbacks.DdSurface,
 		&This->DriverCallbacks.DdPalette,
 		&This->DriverCallbacks.D3dMain,
-		&This->DriverCallbacks.D3dDriverData,
+		&This->D3dDriverData,
 		&This->DriverCallbacks.D3dBufferCallbacks, 
 		NULL, 
 		NULL, 
 		NULL ))
 		return DDERR_INVALIDPARAMS;
 
-	// ToDo: Second DdQueryDirectDrawObject without the three NULLs	
+	This->pD3dTextureFormats = HeapAlloc(GetProcessHeap(), 0, sizeof(DDSURFACEDESC) * This->D3dDriverData.dwNumTextureFormats);
+	This->pdwFourCC = HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD) * This->HalInfo.ddCaps.dwNumFourCCCodes);
+	This->pvmList = HeapAlloc(GetProcessHeap(), 0, sizeof(VIDMEM) * This->HalInfo.vmiData.dwNumHeaps);
 
+	if(!DdQueryDirectDrawObject (
+		&This->DirectDrawGlobal, 
+		&This->HalInfo, 
+		&This->DriverCallbacks.DdMain,
+		&This->DriverCallbacks.DdSurface,
+		&This->DriverCallbacks.DdPalette,
+		&This->DriverCallbacks.D3dMain,
+		&This->D3dDriverData,
+		&This->DriverCallbacks.D3dBufferCallbacks, 
+		This->pD3dTextureFormats, 
+		This->pdwFourCC, 
+		This->pvmList ))
+		return DDERR_INVALIDPARAMS;
+
 	return DD_OK;
 }
 
@@ -55,8 +71,11 @@
     IDirectDrawImpl* This = (IDirectDrawImpl*)iface;
 
 	DdDeleteDirectDrawObject (&This->DirectDrawGlobal);
+			
+	if(This->pD3dTextureFormats)
+		HeapFree(GetProcessHeap(), 0, This->pD3dTextureFormats);
+	if(This->pdwFourCC)
+		HeapFree(GetProcessHeap(), 0, This->pdwFourCC);
+	if(This->pvmList)
+		HeapFree(GetProcessHeap(), 0, This->pvmList);
 }
-
-
-
-

Modified: trunk/reactos/lib/ddraw/rosdraw.h
--- trunk/reactos/lib/ddraw/rosdraw.h	2005-08-09 11:18:48 UTC (rev 17237)
+++ trunk/reactos/lib/ddraw/rosdraw.h	2005-08-09 13:57:03 UTC (rev 17238)
@@ -22,7 +22,6 @@
     DDHAL_DDSURFACECALLBACKS DdSurface;
     DDHAL_DDPALETTECALLBACKS DdPalette;
     D3DHAL_CALLBACKS D3dMain;
-    D3DHAL_GLOBALDRIVERDATA	D3dDriverData;
     DDHAL_DDEXEBUFCALLBACKS	D3dBufferCallbacks;
 
 } DRIVERCALLBACKS;
@@ -33,8 +32,13 @@
 	DRIVERCALLBACKS DriverCallbacks;
     DWORD ref;
 
-	DDHALINFO HalInfo;
+	DDHALINFO HalInfo;	
+    D3DHAL_GLOBALDRIVERDATA	D3dDriverData;
 
+	LPDDSURFACEDESC pD3dTextureFormats;
+	LPDWORD pdwFourCC;
+	LPVIDMEM pvmList;
+
     HWND window;
     DWORD cooperative_level;
 	HDC hdc;