mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
enter a critical region before looking up a CID handle
svn path=/trunk/; revision=17198
This commit is contained in:
parent
da23cad0de
commit
1a2a435f9c
3 changed files with 20 additions and 6 deletions
|
@ -477,6 +477,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
|||
PEPROCESS FoundProcess;
|
||||
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
||||
PAGED_CODE();
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
|
||||
/* Get the CID Handle Entry */
|
||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||
|
@ -497,6 +499,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
|||
/* Unlock the Entry */
|
||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||
}
|
||||
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
/* Return to caller */
|
||||
return Status;
|
||||
|
@ -515,6 +519,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
|||
PETHREAD FoundThread;
|
||||
NTSTATUS Status = STATUS_INVALID_CID;
|
||||
PAGED_CODE();
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
|
||||
/* Get the CID Handle Entry */
|
||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||
|
@ -544,6 +550,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
|||
/* Unlock the Entry */
|
||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||
}
|
||||
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
/* Return to caller */
|
||||
return Status;
|
||||
|
|
|
@ -374,6 +374,8 @@ PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
|||
PETHREAD FoundThread;
|
||||
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
||||
PAGED_CODE();
|
||||
|
||||
KeEnterCriticalRegion();
|
||||
|
||||
/* Get the CID Handle Entry */
|
||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||
|
@ -394,6 +396,8 @@ PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
|||
/* Unlock the Entry */
|
||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||
}
|
||||
|
||||
KeLeaveCriticalRegion();
|
||||
|
||||
/* Return to caller */
|
||||
return Status;
|
||||
|
|
|
@ -261,11 +261,11 @@ RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
|
|||
|
||||
Handle = ExCreateHandle(AtomTable->ExHandleTable,
|
||||
&ExEntry);
|
||||
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
||||
if (Handle != NULL)
|
||||
{
|
||||
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
||||
/* FIXME - Handle Indexes >= 0xC000 ?! */
|
||||
if (HandleIndex < 0xC000)
|
||||
if ((ULONG_PTR)HandleIndex >> 2 < 0xC000)
|
||||
{
|
||||
Entry->HandleIndex = HandleIndex;
|
||||
Entry->Atom = 0xC000 + HandleIndex;
|
||||
|
@ -284,21 +284,23 @@ PRTL_ATOM_TABLE_ENTRY
|
|||
RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
|
||||
{
|
||||
PHANDLE_TABLE_ENTRY ExEntry;
|
||||
PRTL_ATOM_TABLE_ENTRY Entry = NULL;
|
||||
|
||||
/* NOTE: There's no need to explicitly enter a critical region because it's
|
||||
guaranteed that we're in a critical region right now (as we hold
|
||||
the atom table lock) */
|
||||
|
||||
ExEntry = ExMapHandleToPointer(AtomTable->ExHandleTable,
|
||||
(HANDLE)((ULONG_PTR)Index << 2));
|
||||
if (ExEntry != NULL)
|
||||
{
|
||||
PRTL_ATOM_TABLE_ENTRY Entry;
|
||||
|
||||
Entry = ExEntry->u1.Object;
|
||||
|
||||
ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
|
||||
ExEntry);
|
||||
return Entry;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return Entry;
|
||||
}
|
||||
|
||||
/* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
|
||||
|
|
Loading…
Reference in a new issue