[ros-dev] [ros-diffs] [sginsberg] 35042: - ExpLookupHandleTableEntry: Apply same changes as was done for ExpFreeHandleTable and ExpAllocateHandleTableEntrySlow in 34467 - ExpAllocateHandleTableEntry: Fail if we don't find a handle table entry

Alex Ionescu ionucu at videotron.ca
Sun Aug 3 02:50:21 CEST 2008


This is broken.

Best regards,
Alex Ionescu



On Sat, Aug 2, 2008 at 11:25 AM,  <sginsberg at svn.reactos.org> wrote:
> Author: sginsberg
> Date: Sat Aug  2 13:25:53 2008
> New Revision: 35042
>
> URL: http://svn.reactos.org/svn/reactos?rev=35042&view=rev
> Log:
> - ExpLookupHandleTableEntry: Apply same changes as was done for ExpFreeHandleTable and ExpAllocateHandleTableEntrySlow in 34467
> - ExpAllocateHandleTableEntry: Fail if we don't find a handle table entry
>
> 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=35042&r1=35041&r2=35042&view=diff
> ==============================================================================
> --- trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] (original)
> +++ trunk/reactos/ntoskrnl/ex/handle.c [iso-8859-1] Sat Aug  2 13:25:53 2008
> @@ -35,8 +35,10 @@
>  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;
> @@ -45,13 +47,6 @@
>     Handle.TagBits = 0;
>     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 @@
>     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();
>
> @@ -733,6 +728,13 @@
>
>         /* 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;
>
>


More information about the Ros-dev mailing list