mirror of
https://github.com/reactos/reactos.git
synced 2025-01-13 01:22:03 +00:00
- ExpLookupHandleTableEntry: Apply same changes as was done for ExpFreeHandleTable and ExpAllocateHandleTableEntrySlow in 34467
- ExpAllocateHandleTableEntry: Fail if we don't find a handle table entry svn path=/trunk/; revision=35042
This commit is contained in:
parent
9b188f4ebc
commit
a124618434
1 changed files with 12 additions and 10 deletions
|
@ -35,8 +35,10 @@ NTAPI
|
|||
ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
|
||||
IN EXHANDLE LookupHandle)
|
||||
{
|
||||
ULONG i, j, k, TableLevel, NextHandle;
|
||||
ULONG_PTR TableBase;
|
||||
ULONG i, j, k, NextHandle;
|
||||
ULONG_PTR TableCode = HandleTable->TableCode;
|
||||
ULONG_PTR TableBase = TableCode & ~3;
|
||||
ULONG TableLevel = (ULONG)(TableCode & 3);
|
||||
PHANDLE_TABLE_ENTRY Entry = NULL;
|
||||
EXHANDLE Handle = LookupHandle;
|
||||
PUCHAR Level1, Level2, Level3;
|
||||
|
@ -46,13 +48,6 @@ ExpLookupHandleTableEntry(IN PHANDLE_TABLE HandleTable,
|
|||
NextHandle = *(volatile ULONG*)&HandleTable->NextHandleNeedingPool;
|
||||
if (Handle.Value >= NextHandle) return NULL;
|
||||
|
||||
/* 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 what level we're running at */
|
||||
switch (TableLevel)
|
||||
{
|
||||
|
@ -210,8 +205,8 @@ ExpFreeHandleTable(IN PHANDLE_TABLE HandleTable)
|
|||
PEPROCESS Process = HandleTable->QuotaProcess;
|
||||
ULONG i, j;
|
||||
ULONG_PTR TableCode = HandleTable->TableCode;
|
||||
ULONG TableLevel = TableCode & 3;
|
||||
ULONG_PTR TableBase = TableCode & ~3;
|
||||
ULONG TableLevel = (ULONG)(TableCode & 3);
|
||||
PHANDLE_TABLE_ENTRY Level1, *Level2, **Level3;
|
||||
PAGED_CODE();
|
||||
|
||||
|
@ -734,6 +729,13 @@ ExpAllocateHandleTableEntry(IN PHANDLE_TABLE HandleTable,
|
|||
/* Lookup the entry for this handle */
|
||||
Entry = ExpLookupHandleTableEntry(HandleTable, Handle);
|
||||
|
||||
/* Make sure that we found an entry */
|
||||
if (!Entry)
|
||||
{
|
||||
/* We didn't, fail */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Get an available lock and acquire it */
|
||||
i = ((OldValue & FREE_HANDLE_MASK) >> 2) % 4;
|
||||
KeEnterCriticalRegion();
|
||||
|
|
Loading…
Reference in a new issue