From a661e95cdf19d062d4c39b4b1bd74a5beb3b8184 Mon Sep 17 00:00:00 2001 From: Thomas Bluemel Date: Thu, 28 Jul 2005 23:29:44 +0000 Subject: [PATCH] clear out the lower 2 bits of a pid before using it to calculate the hash as they may vary svn path=/trunk/; revision=16849 --- reactos/subsys/csrss/api/process.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/reactos/subsys/csrss/api/process.c b/reactos/subsys/csrss/api/process.c index b089abbb88b..7bffb18308c 100644 --- a/reactos/subsys/csrss/api/process.c +++ b/reactos/subsys/csrss/api/process.c @@ -37,7 +37,7 @@ PCSRSS_PROCESS_DATA STDCALL CsrGetProcessData(HANDLE ProcessId) ULONG hash; PCSRSS_PROCESS_DATA pProcessData; - hash = (ULONG_PTR)ProcessId % (sizeof(ProcessData) / sizeof(*ProcessData)); + hash = ((ULONG_PTR)ProcessId & ~0x3) % (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 % (sizeof(ProcessData) / sizeof(*ProcessData)); + hash = ((ULONG_PTR)ProcessId & ~0x3) % (sizeof(ProcessData) / sizeof(*ProcessData)); LOCK; @@ -121,7 +121,7 @@ NTSTATUS STDCALL CsrFreeProcessData(HANDLE Pid) UINT c; PCSRSS_PROCESS_DATA pProcessData, pPrevProcessData = NULL; - hash = (ULONG_PTR)Pid % (sizeof(ProcessData) / sizeof(*ProcessData)); + hash = ((ULONG_PTR)Pid & ~0x3) % (sizeof(ProcessData) / sizeof(*ProcessData)); LOCK;