mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 02:15:43 +00:00
- Fix the last two Ob reference counting bugs:
- Don't de-reference the object when duplicating it (not sure why this was left there). This fixes all the "misbehaving object: Event" messages in the console and fixes those regressions. - Don't reference the object when doing a lookup (not sure why this was there either). This made it impossible to kill named objects, since ObpDeleteNameCheck did a lookup before killing them, and the lookup ended up adding a reference. - Cm still needs fixing! svn path=/trunk/; revision=22692
This commit is contained in:
parent
0e79c3011a
commit
ec719832c0
5 changed files with 19 additions and 6 deletions
|
@ -2328,6 +2328,15 @@ RtlFindClearBitsAndSet(
|
||||||
IN ULONG HintIndex
|
IN ULONG HintIndex
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSYSAPI
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
RtlFindNextForwardRunClear(
|
||||||
|
IN PRTL_BITMAP BitMapHeader,
|
||||||
|
IN ULONG FromIndex,
|
||||||
|
IN PULONG StartingRunIndex
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
@ -2337,6 +2346,13 @@ RtlInitializeBitMap(
|
||||||
IN ULONG SizeOfBitMap
|
IN ULONG SizeOfBitMap
|
||||||
);
|
);
|
||||||
|
|
||||||
|
NTSYSAPI
|
||||||
|
ULONG
|
||||||
|
NTAPI
|
||||||
|
RtlNumberOfSetBits(
|
||||||
|
IN PRTL_BITMAP BitMapHeader
|
||||||
|
);
|
||||||
|
|
||||||
NTSYSAPI
|
NTSYSAPI
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
|
|
|
@ -220,9 +220,6 @@ ObpLookupEntryDirectory(IN POBJECT_DIRECTORY Directory,
|
||||||
/* Save the found object */
|
/* Save the found object */
|
||||||
FoundObject = CurrentEntry->Object;
|
FoundObject = CurrentEntry->Object;
|
||||||
if (!FoundObject) goto Quickie;
|
if (!FoundObject) goto Quickie;
|
||||||
|
|
||||||
/* Add a reference to the object */
|
|
||||||
ObReferenceObject(FoundObject);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if the directory was unlocked (which means we locked it) */
|
/* Check if the directory was unlocked (which means we locked it) */
|
||||||
|
|
|
@ -1382,7 +1382,6 @@ ObDuplicateObject(IN PEPROCESS SourceProcess,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now create the handle */
|
/* Now create the handle */
|
||||||
ObDereferenceObject(SourceObject);
|
|
||||||
NewHandle = ExCreateHandle(HandleTable, &NewHandleEntry);
|
NewHandle = ExCreateHandle(HandleTable, &NewHandleEntry);
|
||||||
if (!NewHandle)
|
if (!NewHandle)
|
||||||
{
|
{
|
||||||
|
|
|
@ -102,6 +102,7 @@ ObpDeleteNameCheck(IN PVOID Object)
|
||||||
/* Check if we were inserted in a directory */
|
/* Check if we were inserted in a directory */
|
||||||
if (Directory)
|
if (Directory)
|
||||||
{
|
{
|
||||||
|
/* We were, so dereference the directory and the object as well */
|
||||||
ObDereferenceObject(Directory);
|
ObDereferenceObject(Directory);
|
||||||
ObDereferenceObject(Object);
|
ObDereferenceObject(Object);
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ ObfDereferenceObject(IN PVOID Object)
|
||||||
/* Extract the object header */
|
/* Extract the object header */
|
||||||
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
Header = OBJECT_TO_OBJECT_HEADER(Object);
|
||||||
|
|
||||||
if (Header->PointerCount <= Header->HandleCount)
|
if (Header->PointerCount < Header->HandleCount)
|
||||||
{
|
{
|
||||||
DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name);
|
DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name);
|
||||||
return;
|
return;
|
||||||
|
@ -98,7 +98,7 @@ ObfDereferenceObject(IN PVOID Object)
|
||||||
if (!(InterlockedDecrement(&Header->PointerCount)))
|
if (!(InterlockedDecrement(&Header->PointerCount)))
|
||||||
{
|
{
|
||||||
/* Sanity check */
|
/* Sanity check */
|
||||||
if(Header->HandleCount)
|
if (Header->HandleCount)
|
||||||
{
|
{
|
||||||
DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name);
|
DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name);
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue