Clean up.
Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c

Modified: trunk/reactos/ntoskrnl/ex/sysinfo.c
--- trunk/reactos/ntoskrnl/ex/sysinfo.c	2005-03-02 03:09:37 UTC (rev 13794)
+++ trunk/reactos/ntoskrnl/ex/sysinfo.c	2005-03-02 07:11:26 UTC (rev 13795)
@@ -820,7 +820,6 @@
 /* Class 16 - Handle Information */
 QSI_DEF(SystemHandleInformation)
 {
-
         PSYSTEM_HANDLE_INFORMATION Shi = 
         	(PSYSTEM_HANDLE_INFORMATION) Buffer;
 
@@ -845,35 +844,31 @@
         do
 	  {
             hCount = hCount + ObpGetHandleCountByHandleTable(&pr->HandleTable);
+            pr = PsGetNextProcess(pr);
 
-            curSize = sizeof(SYSTEM_HANDLE_INFORMATION)+
-                        (  (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) - 
-                           (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) ));
-
-            Shi->NumberOfHandles = hCount;
-
-           if (curSize > Size)
-             {
-               DPRINT1("SystemHandleInformation 2\n");
-               *ReqSize = curSize;
-               if (pr != NULL)
-	         {
-	            ObDereferenceObject(pr);
-	         }
-               return (STATUS_INFO_LENGTH_MISMATCH);
-             }
-
-	    pr = PsGetNextProcess(pr);
-
 	    if ((pr == syspr) || (pr == NULL))
 		break;
         } while ((pr != syspr) && (pr != NULL));
 
+	DPRINT("SystemHandleInformation 2\n");
+
 	if (pr != NULL)
 	  {
 	    ObDereferenceObject(pr);
 	  }
 
+        curSize = sizeof(SYSTEM_HANDLE_INFORMATION)+
+                  (  (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) * hCount) - 
+                     (sizeof(SYSTEM_HANDLE_TABLE_ENTRY_INFO) ));
+
+        Shi->NumberOfHandles = hCount;
+
+        if (curSize > Size)
+          {
+            *ReqSize = curSize;
+             return (STATUS_INFO_LENGTH_MISMATCH);
+          }
+
 	DPRINT("SystemHandleInformation 3\n");
 
         /* Now get Handles from all processs. */