Fixed the calculation of the hash for the process data.
Modified: trunk/reactos/subsys/csrss/api/process.c

Modified: trunk/reactos/subsys/csrss/api/process.c
--- trunk/reactos/subsys/csrss/api/process.c	2005-10-24 18:00:46 UTC (rev 18755)
+++ trunk/reactos/subsys/csrss/api/process.c	2005-10-24 18:03:57 UTC (rev 18756)
@@ -37,7 +37,7 @@
    ULONG hash;
    PCSRSS_PROCESS_DATA pProcessData;
 
-   hash = ((ULONG_PTR)ProcessId & ~0x3) % (sizeof(ProcessData) / sizeof(*ProcessData));
+   hash = ((ULONG_PTR)ProcessId >> 2) % (sizeof(ProcessData) / sizeof(*ProcessData));
 
    LOCK;
 
@@ -59,7 +59,7 @@
    CLIENT_ID ClientId;
    NTSTATUS Status;
 
-   hash = ((ULONG_PTR)ProcessId & ~0x3) % (sizeof(ProcessData) / sizeof(*ProcessData));
+   hash = ((ULONG_PTR)ProcessId >> 2) % (sizeof(ProcessData) / sizeof(*ProcessData));
 
    LOCK;
 
@@ -100,7 +100,10 @@
 	    RtlFreeHeap(CsrssApiHeap, 0, pProcessData);
 	    pProcessData = NULL;
          }
-         RtlInitializeCriticalSection(&pProcessData->HandleTableLock);
+         else
+         {
+            RtlInitializeCriticalSection(&pProcessData->HandleTableLock);
+         }
       }
    }
    else
@@ -110,7 +113,7 @@
    UNLOCK;
    if (pProcessData == NULL)
    {
-      DbgPrint("CSR: CsrGetProcessData() failed\n");
+      DPRINT1("CsrCreateProcessData() failed\n");
    }
    return pProcessData;
 }
@@ -121,7 +124,7 @@
   UINT c;
   PCSRSS_PROCESS_DATA pProcessData, pPrevProcessData = NULL;
 
-  hash = ((ULONG_PTR)Pid & ~0x3) % (sizeof(ProcessData) / sizeof(*ProcessData));
+  hash = ((ULONG_PTR)Pid >> 2) % (sizeof(ProcessData) / sizeof(*ProcessData));
 
   LOCK;
 
@@ -142,9 +145,7 @@
       }
       if (pProcessData->Console)
         {
-          RtlEnterCriticalSection(&ProcessDataLock);
           RemoveEntryList(&pProcessData->ProcessEntry);
-          RtlLeaveCriticalSection(&ProcessDataLock);
         }
       if (pProcessData->HandleTable)
         {