[ros-diffs] [fireball] 33290: - Revert 33274, except the change in GetDisplayNumberFromDeviceName(), where a zero-length string should be actually accepted. - As for other changes in 33274: removed accidentally committed DPRINT1s by Magnus, removed unneeded DisplayNumber zero-init, because it's always initialized by a call to GetDisplayNumberFromDeviceName().

fireball at svn.reactos.org fireball at svn.reactos.org
Mon May 5 10:28:42 CEST 2008


Author: fireball
Date: Mon May  5 03:28:41 2008
New Revision: 33290

URL: http://svn.reactos.org/svn/reactos?rev=33290&view=rev
Log:
- Revert 33274, except the change in GetDisplayNumberFromDeviceName(), where a zero-length string should be actually accepted.
- As for other changes in 33274: removed accidentally committed DPRINT1s by Magnus, removed unneeded DisplayNumber zero-init, because it's always initialized by a call to GetDisplayNumberFromDeviceName().

Modified:
    trunk/reactos/subsystems/win32/win32k/objects/dc.c

Modified: trunk/reactos/subsystems/win32/win32k/objects/dc.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/objects/dc.c?rev=33290&r1=33289&r2=33290&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/objects/dc.c [iso-8859-1] Mon May  5 03:28:41 2008
@@ -2741,17 +2741,10 @@
   if (DisplayNumber == NULL)
     return STATUS_INVALID_PARAMETER_2;
 
- DPRINT1("GetDisplayNumberFromDeviceName Pass 1 seh  \n");
-
-  if ((pDeviceName != NULL) && (pDeviceName->Length != 0))
-  {
-    if (pDeviceName->Length <= DisplayString.Length)
-    {
-      DPRINT1("GetDisplayNumberFromDeviceName FAIL pDeviceName : %wZ  \n",pDeviceName);
-      DPRINT1("GetDisplayNumberFromDeviceName FAIL pDeviceName->Length : %d  \n",pDeviceName->Length);
-      return STATUS_OBJECT_NAME_INVALID;
-    }
-  }
+  /* Check if DeviceName is valid */
+  if (pDeviceName &&
+      pDeviceName->Length > 0 && pDeviceName->Length <= DisplayString.Length)
+    return STATUS_OBJECT_NAME_INVALID;
 
   if (pDeviceName == NULL || pDeviceName->Length == 0)
   {
@@ -2790,7 +2783,7 @@
         Number = Number * 10 + Char - L'0';
       else if (Char != L'\0')
         return STATUS_OBJECT_NAME_INVALID;
-      }
+    }
 
     *DisplayNumber = Number - 1;
   }
@@ -2816,15 +2809,13 @@
   static UNICODE_STRING CachedDeviceName;
   PDEVMODEW CachedMode = NULL;
   DEVMODEW DevMode;
-  ULONG DisplayNumber = 0;
+  ULONG DisplayNumber;
 
   if (!NT_SUCCESS(GetDisplayNumberFromDeviceName(pDeviceName, &DisplayNumber)))
   {
     SetLastWin32Error(STATUS_NO_SUCH_DEVICE);
     return FALSE;
   }
-
-  DPRINT1("IntEnumDisplaySettings Pass 1 seh  \n");
 
   DPRINT("DevMode->dmSize = %d\n", pDevMode->dmSize);
   DPRINT("DevMode->dmExtraSize = %d\n", pDevMode->dmDriverExtra);
@@ -2836,17 +2827,13 @@
     return FALSE;
   }
 
-  DPRINT1("IntEnumDisplaySettings Pass 2 seh  \n");
-
   if (iModeNum == ENUM_CURRENT_SETTINGS)
   {
-    DPRINT1("IntEnumDisplaySettings  ENUM_CURRENT_SETTINGS  \n");
     CachedMode = &PrimarySurface.DMW;
     ASSERT(CachedMode->dmSize > 0);
   }
   else if (iModeNum == ENUM_REGISTRY_SETTINGS)
   {
-    DPRINT1("IntEnumDisplaySettings  ENUM_REGISTRY_SETTINGS  \n");
     RtlZeroMemory(&DevMode, sizeof (DevMode));
     DevMode.dmSize = sizeof (DevMode);
     DevMode.dmDriverExtra = 0;
@@ -2860,13 +2847,9 @@
     /* FIXME: Maybe look for the matching devmode supplied by the
      *        driver so we can provide driver private/extra data?
      */
-
-    DPRINT1("IntEnumDisplaySettings Pass 3 seh  \n");
   }
   else
   {
-    DPRINT1("IntEnumDisplaySettings  NO FLAGs  \n");
-
     BOOL IsCachedDevice = (CachedDevModes != NULL);
 
     if (CachedDevModes &&
@@ -2883,8 +2866,6 @@
       LPWSTR CurrentName;
       DRVENABLEDATA DrvEnableData;
 
-      DPRINT1("IntEnumDisplaySettings iModeNum  \n");
-
       /* Free resources from last driver cache */
       if (IsCachedDevice == FALSE && CachedDeviceName.Buffer != NULL)
       {
@@ -2899,15 +2880,11 @@
         return FALSE;
       }
 
-      DPRINT1("IntEnumDisplaySettings Pass 4 seh  \n");
-
       if (!IntPrepareDriverIfNeeded())
       {
         DPRINT1("IntPrepareDriverIfNeeded failed\n");
         return FALSE;
       }
-
-      DPRINT1("IntEnumDisplaySettings Pass 5 seh  \n");
 
       /*
        * DriverFileNames may be a list of drivers in REG_SZ_MULTI format,
@@ -2989,9 +2966,6 @@
             SetLastWin32Error(STATUS_NO_MEMORY);
             return FALSE;
           }
-
-          DPRINT1("IntEnumDisplaySettings Pass 6 seh  \n");
-
           if (CachedDevModes != NULL)
           {
             RtlCopyMemory(NewBuffer, CachedDevModes, SizeUsed);
@@ -3030,19 +3004,12 @@
     }
 
     /* return cached info */
-
-
-     DPRINT1("IntEnumDisplaySettings return cached info  \n");
-
     CachedMode = CachedDevModes;
     if (CachedMode >= CachedDevModesEnd)
     {
       SetLastWin32Error(STATUS_NO_MORE_ENTRIES);
       return FALSE;
     }
-
-    DPRINT1("IntEnumDisplaySettings Pass 7 seh  \n");
-
     while (iModeNum-- > 0 && CachedMode < CachedDevModesEnd)
     {
       assert(CachedMode->dmSize > 0);
@@ -3053,13 +3020,9 @@
       SetLastWin32Error(STATUS_NO_MORE_ENTRIES);
       return FALSE;
     }
-
-    DPRINT1("IntEnumDisplaySettings Pass 8 seh  \n");
   }
 
   ASSERT(CachedMode != NULL);
-
-  DPRINT1("IntEnumDisplaySettings Pass 9 seh  \n");
 
   RtlCopyMemory(pDevMode, CachedMode, min(pDevMode->dmSize, CachedMode->dmSize));
   RtlZeroMemory(pDevMode + pDevMode->dmSize, pDevMode->dmDriverExtra);



More information about the Ros-diffs mailing list