Fixed the calculation of the hash for the process data.

svn path=/trunk/; revision=18756
This commit is contained in:
Hartmut Birr 2005-10-24 18:03:57 +00:00
parent fea86552f0
commit aaa2a0d33a

View file

@ -37,7 +37,7 @@ PCSRSS_PROCESS_DATA STDCALL CsrGetProcessData(HANDLE ProcessId)
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 @@ PCSRSS_PROCESS_DATA STDCALL CsrCreateProcessData(HANDLE ProcessId)
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 @@ PCSRSS_PROCESS_DATA STDCALL CsrCreateProcessData(HANDLE ProcessId)
RtlFreeHeap(CsrssApiHeap, 0, pProcessData);
pProcessData = NULL;
}
RtlInitializeCriticalSection(&pProcessData->HandleTableLock);
else
{
RtlInitializeCriticalSection(&pProcessData->HandleTableLock);
}
}
}
else
@ -110,7 +113,7 @@ PCSRSS_PROCESS_DATA STDCALL CsrCreateProcessData(HANDLE ProcessId)
UNLOCK;
if (pProcessData == NULL)
{
DbgPrint("CSR: CsrGetProcessData() failed\n");
DPRINT1("CsrCreateProcessData() failed\n");
}
return pProcessData;
}
@ -121,7 +124,7 @@ NTSTATUS STDCALL CsrFreeProcessData(HANDLE Pid)
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 @@ NTSTATUS STDCALL CsrFreeProcessData(HANDLE Pid)
}
if (pProcessData->Console)
{
RtlEnterCriticalSection(&ProcessDataLock);
RemoveEntryList(&pProcessData->ProcessEntry);
RtlLeaveCriticalSection(&ProcessDataLock);
}
if (pProcessData->HandleTable)
{