mirror of
https://github.com/reactos/reactos.git
synced 2025-04-20 20:36:35 +00:00
- Rewrite RtlpCreateAtomHandle to readable code and fix a problem spotted in bug 4788.
svn path=/trunk/; revision=42635
This commit is contained in:
parent
f529b441b2
commit
9e804e5230
1 changed files with 23 additions and 16 deletions
|
@ -516,29 +516,36 @@ RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
USHORT HandleIndex;
|
USHORT HandleIndex;
|
||||||
|
|
||||||
|
/* Initialize ex handle table entry */
|
||||||
ExEntry.Object = Entry;
|
ExEntry.Object = Entry;
|
||||||
ExEntry.GrantedAccess = 0x1; /* FIXME - valid handle */
|
ExEntry.GrantedAccess = 0x1; /* FIXME - valid handle */
|
||||||
|
|
||||||
|
/* Create ex handle */
|
||||||
Handle = ExCreateHandle(AtomTable->ExHandleTable,
|
Handle = ExCreateHandle(AtomTable->ExHandleTable,
|
||||||
&ExEntry);
|
&ExEntry);
|
||||||
if (Handle != NULL)
|
if (!Handle) return FALSE;
|
||||||
{
|
|
||||||
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
|
||||||
/* FIXME - Handle Indexes >= 0xC000 ?! */
|
|
||||||
if ((ULONG_PTR)HandleIndex >> 2 < 0xC000)
|
|
||||||
{
|
|
||||||
Entry->HandleIndex = HandleIndex;
|
|
||||||
Entry->Atom = 0xC000 + HandleIndex;
|
|
||||||
|
|
||||||
return TRUE;
|
/* Calculate HandleIndex (by getting rid of the first two bits) */
|
||||||
}
|
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
||||||
else
|
|
||||||
|
/* Index must be less than 0xC000 */
|
||||||
|
if (HandleIndex >= 0xC000)
|
||||||
|
{
|
||||||
|
/* Destroy ex handle */
|
||||||
ExDestroyHandle(AtomTable->ExHandleTable,
|
ExDestroyHandle(AtomTable->ExHandleTable,
|
||||||
Handle,
|
Handle,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
|
/* Return failure */
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
/* Initialize atom table entry */
|
||||||
|
Entry->HandleIndex = HandleIndex;
|
||||||
|
Entry->Atom = 0xC000 + HandleIndex;
|
||||||
|
|
||||||
|
/* Return success */
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
PRTL_ATOM_TABLE_ENTRY
|
PRTL_ATOM_TABLE_ENTRY
|
||||||
|
|
Loading…
Reference in a new issue