fix handle table calculations

now we can create 4186000 handles instead of 4100
and VLC doesn't BSOD anymore

svn path=/trunk/; revision=34466
This commit is contained in:
Christoph von Wittich 2008-07-13 18:22:18 +00:00
parent ba77ba4484
commit 538c89cbf6

View file

@ -209,11 +209,18 @@ ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable)
{
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,10 +504,17 @@ ExpAllocateHandleTableEntrySlow(IN PHANDLE_TABLE HandleTable,
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);
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)
{