Author: cwittich Date: Sun Jul 13 13:22:18 2008 New Revision: 34466
URL: http://svn.reactos.org/svn/reactos?rev=34466&view=rev Log: fix handle table calculations now we can create 4186000 handles instead of 4100 and VLC doesn't BSOD anymore
Modified: trunk/reactos/ntoskrnl/ex/handle.c
Modified: trunk/reactos/ntoskrnl/ex/handle.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ex/handle.c?rev=34... ============================================================================== --- trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] (original) +++ trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] Sun Jul 13 13:22:18 2008 @@ -209,10 +209,17 @@ { PEPROCESS Process = HandleTable->QuotaProcess; ULONG i, j; - ULONG TableLevel = (ULONG)(HandleTable->TableCode & 3); - ULONG_PTR TableBase = HandleTable->TableCode & ~3; + ULONG TableLevel; + ULONG_PTR TableBase; PHANDLE_TABLE_ENTRY Level1, *Level2, **Level3; PAGED_CODE(); + + /* Get the table code */ + TableBase = *(volatile ULONG_PTR*)&HandleTable->TableCode; + + /* Extract the table level and actual table base */ + TableLevel = (ULONG)(TableBase & 3); + TableBase = TableBase - TableLevel;
/* Check which level we're at */ if (!TableLevel) @@ -497,9 +504,16 @@ PHANDLE_TABLE_ENTRY Low = NULL, *Mid, **High, *SecondLevel, **ThirdLevel; ULONG NewFree, FirstFree; PVOID Value; - ULONG_PTR TableBase = HandleTable->TableCode & ~3; - ULONG TableLevel = (ULONG)(TableBase & 3); - PAGED_CODE(); + ULONG_PTR TableBase; + ULONG TableLevel; + PAGED_CODE(); + + /* Get the table code */ + TableBase = *(volatile ULONG_PTR*)&HandleTable->TableCode; + + /* Extract the table level and actual table base */ + TableLevel = (ULONG)(TableBase & 3); + TableBase = TableBase - TableLevel;
/* Check how many levels we already have */ if (!TableLevel)