mirror of
https://github.com/reactos/reactos.git
synced 2025-04-21 20:50:29 +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
|
@ -478,6 +478,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
||||||
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
/* Get the CID Handle Entry */
|
/* Get the CID Handle Entry */
|
||||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||||
ProcessId)))
|
ProcessId)))
|
||||||
|
@ -498,6 +500,8 @@ PsLookupProcessByProcessId(IN HANDLE ProcessId,
|
||||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
|
||||||
/* Return to caller */
|
/* Return to caller */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
@ -516,6 +520,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||||
NTSTATUS Status = STATUS_INVALID_CID;
|
NTSTATUS Status = STATUS_INVALID_CID;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
/* Get the CID Handle Entry */
|
/* Get the CID Handle Entry */
|
||||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||||
Cid->UniqueThread)))
|
Cid->UniqueThread)))
|
||||||
|
@ -545,6 +551,8 @@ PsLookupProcessThreadByCid(IN PCLIENT_ID Cid,
|
||||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
|
||||||
/* Return to caller */
|
/* Return to caller */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -375,6 +375,8 @@ PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
||||||
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
NTSTATUS Status = STATUS_INVALID_PARAMETER;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
|
|
||||||
|
KeEnterCriticalRegion();
|
||||||
|
|
||||||
/* Get the CID Handle Entry */
|
/* Get the CID Handle Entry */
|
||||||
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
if ((CidEntry = ExMapHandleToPointer(PspCidTable,
|
||||||
ThreadId)))
|
ThreadId)))
|
||||||
|
@ -395,6 +397,8 @@ PsLookupThreadByThreadId(IN HANDLE ThreadId,
|
||||||
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
ExUnlockHandleTableEntry(PspCidTable, CidEntry);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
KeLeaveCriticalRegion();
|
||||||
|
|
||||||
/* Return to caller */
|
/* Return to caller */
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
|
@ -261,11 +261,11 @@ RtlpCreateAtomHandle(PRTL_ATOM_TABLE AtomTable, PRTL_ATOM_TABLE_ENTRY Entry)
|
||||||
|
|
||||||
Handle = ExCreateHandle(AtomTable->ExHandleTable,
|
Handle = ExCreateHandle(AtomTable->ExHandleTable,
|
||||||
&ExEntry);
|
&ExEntry);
|
||||||
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
|
||||||
if (Handle != NULL)
|
if (Handle != NULL)
|
||||||
{
|
{
|
||||||
|
HandleIndex = (USHORT)((ULONG_PTR)Handle >> 2);
|
||||||
/* FIXME - Handle Indexes >= 0xC000 ?! */
|
/* FIXME - Handle Indexes >= 0xC000 ?! */
|
||||||
if (HandleIndex < 0xC000)
|
if ((ULONG_PTR)HandleIndex >> 2 < 0xC000)
|
||||||
{
|
{
|
||||||
Entry->HandleIndex = HandleIndex;
|
Entry->HandleIndex = HandleIndex;
|
||||||
Entry->Atom = 0xC000 + HandleIndex;
|
Entry->Atom = 0xC000 + HandleIndex;
|
||||||
|
@ -284,21 +284,23 @@ PRTL_ATOM_TABLE_ENTRY
|
||||||
RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
|
RtlpGetAtomEntry(PRTL_ATOM_TABLE AtomTable, ULONG Index)
|
||||||
{
|
{
|
||||||
PHANDLE_TABLE_ENTRY ExEntry;
|
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,
|
ExEntry = ExMapHandleToPointer(AtomTable->ExHandleTable,
|
||||||
(HANDLE)((ULONG_PTR)Index << 2));
|
(HANDLE)((ULONG_PTR)Index << 2));
|
||||||
if (ExEntry != NULL)
|
if (ExEntry != NULL)
|
||||||
{
|
{
|
||||||
PRTL_ATOM_TABLE_ENTRY Entry;
|
|
||||||
|
|
||||||
Entry = ExEntry->u1.Object;
|
Entry = ExEntry->u1.Object;
|
||||||
|
|
||||||
ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
|
ExUnlockHandleTableEntry(AtomTable->ExHandleTable,
|
||||||
ExEntry);
|
ExEntry);
|
||||||
return Entry;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return Entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
|
/* FIXME - RtlpCreateUnicodeString is obsolete and should be removed ASAP! */
|
||||||
|
|
Loading…
Reference in a new issue