[ros-diffs] [greatlrd] 26851: Fixing minors bugs 1. The linking interface was use when we req no linking interface. 2. The no linking was use when we req linking interface 3. cleanup the linking interface code so it getting simplire, like reuse same dx handler and other stuff. (have not check if ms ddraw resue it or not)

greatlrd at svn.reactos.org greatlrd at svn.reactos.org
Mon May 21 17:44:28 CEST 2007


Author: greatlrd
Date: Mon May 21 19:44:27 2007
New Revision: 26851

URL: http://svn.reactos.org/svn/reactos?rev=26851&view=rev
Log:
Fixing minors bugs
1. The linking interface was use when we req no linking interface.
2. The no linking was use when we req linking interface
3. cleanup the linking interface code so it getting simplire, like reuse same dx  handler and other stuff. (have not check if ms ddraw resue it or not)

Modified:
    trunk/reactos/dll/directx/ddraw/startup.c

Modified: trunk/reactos/dll/directx/ddraw/startup.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/ddraw/startup.c?rev=26851&r1=26850&r2=26851&view=diff
==============================================================================
--- trunk/reactos/dll/directx/ddraw/startup.c (original)
+++ trunk/reactos/dll/directx/ddraw/startup.c Mon May 21 19:44:27 2007
@@ -52,16 +52,26 @@
             DX_STUB_str("DDERR_OUTOFMEMORY");
             return DDERR_OUTOFMEMORY;
         }
+
+        /* Fixme release memory alloc if we fail */
+        This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+        if (This->lpLcl == NULL)
+        {
+            DX_STUB_str("DDERR_OUTOFMEMORY");
+            return DDERR_OUTOFMEMORY;
+        }
+        This->lpLcl->lpGbl = &ddgbl;
     }
     else
     {
         DX_STUB_str("2.linking\n");
         /* We got the DirectDraw interface alloc and we need create the link */
         LPDDRAWI_DIRECTDRAW_INT  newThis;
+
         newThis = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
         if (newThis == NULL)
         {
-            DX_STUB_str("DDERR_OUTOFMEMORY");
+            DX_STUB_str("DDERR_OUTOFMEMORY\n");
             return DDERR_OUTOFMEMORY;
         }
 
@@ -71,22 +81,26 @@
             if (pGUID !=NULL)
             {
                 This = newThis;
-                DX_STUB_str("DDERR_INVALIDDIRECTDRAWGUID");
+                DX_STUB_str("DDERR_INVALIDDIRECTDRAWGUID\n");
                 return DDERR_INVALIDDIRECTDRAWGUID;
             }
         }
         newThis->lpLink = This;
+
+        newThis->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
+        if (newThis->lpLcl == NULL)
+        {
+            This = newThis;
+            DX_STUB_str("DDERR_OUTOFMEMORY");
+            return DDERR_OUTOFMEMORY;
+        }
+        RtlCopyMemory(newThis->lpLcl, This->lpLcl, sizeof(DDRAWI_DIRECTDRAW_LCL));
+
         This = newThis;
-    }
-
-    /* Fixme release memory alloc if we fail */
-    This->lpLcl = DxHeapMemAlloc(sizeof(DDRAWI_DIRECTDRAW_INT));
-    if (This->lpLcl == NULL)
-    {
-        DX_STUB_str("DDERR_OUTOFMEMORY");
-        return DDERR_OUTOFMEMORY;
-    }
-    This->lpLcl->lpGbl = &ddgbl;
+
+        DX_STUB_str("here\n");
+
+    }
 
     *pIface = (LPDIRECTDRAW)This;
 
@@ -451,12 +465,13 @@
             DxHeapMemFree(mpFourCC);
             DxHeapMemFree(ddgbl.lpDDCBtmp);
             // FIXME Close DX fristcall and second call
-			return DD_FALSE;
-        }
-    }
+        }
+    }
+    
 
     /* Get all basic data from the driver */
-    if (!DdQueryDirectDrawObject(This->lpLcl->lpGbl,
+    if (!DdQueryDirectDrawObject(
+                                 This->lpLcl->lpGbl,
                                  &mHALInfo,
                                  &ddgbl.lpDDCBtmp->HALDD,
                                  &ddgbl.lpDDCBtmp->HALDDSurface,
@@ -476,7 +491,9 @@
     }
 
     memcpy(&ddgbl.vmiData, &mHALInfo.vmiData,sizeof(VIDMEMINFO));
-    memcpy(&ddgbl.ddCaps, &mHALInfo.ddCaps,sizeof(DDCORECAPS));
+    
+
+    memcpy(&ddgbl.ddCaps,  &mHALInfo.ddCaps,sizeof(DDCORECAPS));
 
     This->lpLcl->lpGbl->dwNumFourCC = mHALInfo.ddCaps.dwNumFourCCCodes;
     This->lpLcl->lpGbl->lpdwFourCC = mpFourCC;
@@ -485,11 +502,9 @@
     This->lpLcl->lpGbl->dwModeIndex        = mHALInfo.dwModeIndex;
     This->lpLcl->lpGbl->dwNumModes         = mHALInfo.dwNumModes;
     This->lpLcl->lpGbl->lpModeInfo         = mHALInfo.lpModeInfo;
-    This->lpLcl->lpGbl->hInstance          = mHALInfo.hInstance;
-    This->lpLcl->lpGbl->lp16DD = This->lpLcl->lpGbl;
 
     /* FIXME convert mpTextures to DDHALMODEINFO */
-    DxHeapMemFree(mpTextures);
+    // DxHeapMemFree( mpTextures);
 
     /* FIXME D3D setup mD3dCallbacks and mD3dDriverData */
 	DDHAL_GETDRIVERINFODATA DdGetDriverInfo = { 0 };




More information about the Ros-diffs mailing list