[ros-diffs] [greatlrd] 27075: Fixing allot bugs in Main_DirectDraw_GetAvailableVidMem, it is still buggi

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Fri Jun 8 19:12:06 CEST 2007


Author: greatlrd
Date: Fri Jun  8 21:12:05 2007
New Revision: 27075

URL: http://svn.reactos.org/svn/reactos?rev=27075&view=rev
Log:
Fixing allot bugs in Main_DirectDraw_GetAvailableVidMem, it is still buggi 

Modified:
    trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c

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=27075&r1=27074&r2=27075&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c (original)
+++ trunk/reactos/dll/directx/ddraw/Ddraw/ddraw_main.c Fri Jun  8 21:12:05 2007
@@ -184,7 +184,8 @@
     _SEH_TRY
     {
         // There is no HEL implentation of this api
-        if (!(This->lpLcl->lpDDCB->cbDDMiscellaneousCallbacks.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY))
+        if (!(This->lpLcl->lpDDCB->HALDDMiscellaneous.dwFlags & DDHAL_MISCCB32_GETAVAILDRIVERMEMORY) ||
+            (This->lpLcl->lpGbl->dwFlags & DDRAWI_NOHARDWARE) )
         {
             retVal = DDERR_NODIRECTDRAWHW;
         }
@@ -193,31 +194,63 @@
             if ((!dwTotal && !dwFree) || !ddscaps)
             {
                 retVal = DDERR_INVALIDPARAMS;
+                _SEH_LEAVE;
+            }
+
+            if ( ddscaps->dwCaps & (DDSCAPS_BACKBUFFER  | DDSCAPS_COMPLEX   | DDSCAPS_FLIP | 
+                                    DDSCAPS_FRONTBUFFER | DDSCAPS_PALETTE   | DDSCAPS_SYSTEMMEMORY |
+                                    DDSCAPS_VISIBLE     | DDSCAPS_WRITEONLY | DDSCAPS_OWNDC))
+            {
+                retVal = DDERR_INVALIDPARAMS;
+                _SEH_LEAVE;
+            }
+
+            /* fixme 
+            if ( ddscaps->dwCaps2 & (DDSCAPS_BACKBUFFER  | DDSCAPS_COMPLEX   | DDSCAPS_FLIP | 
+                                    DDSCAPS_FRONTBUFFER | DDSCAPS_PALETTE   | DDSCAPS_SYSTEMMEMORY |
+                                    DDSCAPS_VISIBLE     | DDSCAPS_WRITEONLY | DDSCAPS_OWNDC))
+            {
+                retVal = DDERR_INVALIDPARAMS;
+                _SEH_LEAVE;
+            }
+
+            if ( ddscaps->dwCaps3 & (DDSCAPS_BACKBUFFER  | DDSCAPS_COMPLEX   | DDSCAPS_FLIP | 
+                                    DDSCAPS_FRONTBUFFER | DDSCAPS_PALETTE   | DDSCAPS_SYSTEMMEMORY |
+                                    DDSCAPS_VISIBLE     | DDSCAPS_WRITEONLY | DDSCAPS_OWNDC))
+            {
+                retVal = DDERR_INVALIDPARAMS;
+                _SEH_LEAVE;
+            }
+            */
+
+            if ( ddscaps->dwCaps4)
+            {
+                retVal = DDERR_INVALIDCAPS;
+                _SEH_LEAVE;
+            }
+
+            ZeroMemory(&memdata, sizeof(DDHAL_GETAVAILDRIVERMEMORYDATA));
+            memdata.lpDD = This->lpLcl->lpGbl;
+            memdata.ddRVal = DDERR_INVALIDPARAMS;
+
+            memdata.ddsCapsEx.dwCaps2 = ddscaps->dwCaps2;
+            memdata.ddsCapsEx.dwCaps3 = ddscaps->dwCaps3;
+
+            This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
+
+            if (This->lpLcl->lpDDCB->HALDDMiscellaneous.GetAvailDriverMemory(&memdata) == DDHAL_DRIVER_NOTHANDLED)
+            {
+                retVal = DDERR_NODIRECTDRAWHW;
             }
             else
             {
-                
-                ZeroMemory(&memdata, sizeof(DDHAL_GETAVAILDRIVERMEMORYDATA));
-                memdata.lpDD = This->lpLcl->lpGbl;
-                memdata.ddRVal = DDERR_INVALIDPARAMS;
-                memcpy(&memdata.DDSCaps, ddscaps, sizeof(DDSCAPS2));
-
-                This->lpLcl->lpGbl->hDD = This->lpLcl->hDD;
-
-                if (This->lpLcl->lpDDCB->HALDDMiscellaneous.GetAvailDriverMemory(&memdata) == DDHAL_DRIVER_NOTHANDLED)
-                {
-                    retVal = DDERR_NODIRECTDRAWHW;
-                }
-                else
-                {
-                    if (dwTotal)
-                        *dwTotal = memdata.dwTotal;
-
-                    if (dwFree)
-                        *dwFree = memdata.dwFree;
+                if (dwTotal)
+                    *dwTotal = memdata.dwTotal;
+
+                if (dwFree)
+                    *dwFree = memdata.dwFree;
          
-                    retVal = memdata.ddRVal;
-                }
+                retVal = memdata.ddRVal;
             }
         }
     }




More information about the Ros-diffs mailing list