Author: ion
Date: Thu Jun 29 22:07:53 2006
New Revision: 22692
URL:
http://svn.reactos.org/svn/reactos?rev=22692&view=rev
Log:
- 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!
Modified:
trunk/reactos/include/ndk/rtlfuncs.h
trunk/reactos/ntoskrnl/ob/obdir.c
trunk/reactos/ntoskrnl/ob/obhandle.c
trunk/reactos/ntoskrnl/ob/obname.c
trunk/reactos/ntoskrnl/ob/obref.c
Modified: trunk/reactos/include/ndk/rtlfuncs.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/include/ndk/rtlfuncs.h?rev…
==============================================================================
--- trunk/reactos/include/ndk/rtlfuncs.h (original)
+++ trunk/reactos/include/ndk/rtlfuncs.h Thu Jun 29 22:07:53 2006
@@ -2329,12 +2329,28 @@
);
NTSYSAPI
+ULONG
+NTAPI
+RtlFindNextForwardRunClear(
+ IN PRTL_BITMAP BitMapHeader,
+ IN ULONG FromIndex,
+ IN PULONG StartingRunIndex
+);
+
+NTSYSAPI
VOID
NTAPI
RtlInitializeBitMap(
IN PRTL_BITMAP BitMapHeader,
IN PULONG BitMapBuffer,
IN ULONG SizeOfBitMap
+);
+
+NTSYSAPI
+ULONG
+NTAPI
+RtlNumberOfSetBits(
+ IN PRTL_BITMAP BitMapHeader
);
NTSYSAPI
Modified: trunk/reactos/ntoskrnl/ob/obdir.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obdir.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obdir.c (original)
+++ trunk/reactos/ntoskrnl/ob/obdir.c Thu Jun 29 22:07:53 2006
@@ -220,9 +220,6 @@
/* Save the found object */
FoundObject = CurrentEntry->Object;
if (!FoundObject) goto Quickie;
-
- /* Add a reference to the object */
- ObReferenceObject(FoundObject);
}
/* Check if the directory was unlocked (which means we locked it) */
Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c Thu Jun 29 22:07:53 2006
@@ -1382,7 +1382,6 @@
}
/* Now create the handle */
- ObDereferenceObject(SourceObject);
NewHandle = ExCreateHandle(HandleTable, &NewHandleEntry);
if (!NewHandle)
{
Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=2…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c Thu Jun 29 22:07:53 2006
@@ -102,6 +102,7 @@
/* Check if we were inserted in a directory */
if (Directory)
{
+ /* We were, so dereference the directory and the object as well */
ObDereferenceObject(Directory);
ObDereferenceObject(Object);
}
Modified: trunk/reactos/ntoskrnl/ob/obref.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obref.c (original)
+++ trunk/reactos/ntoskrnl/ob/obref.c Thu Jun 29 22:07:53 2006
@@ -88,7 +88,7 @@
/* Extract the object header */
Header = OBJECT_TO_OBJECT_HEADER(Object);
- if (Header->PointerCount <= Header->HandleCount)
+ if (Header->PointerCount < Header->HandleCount)
{
DPRINT1("Misbehaving object: %wZ\n", &Header->Type->Name);
return;
@@ -98,7 +98,7 @@
if (!(InterlockedDecrement(&Header->PointerCount)))
{
/* Sanity check */
- if(Header->HandleCount)
+ if (Header->HandleCount)
{
DPRINT1("Misbehaving object: %wZ\n",
&Header->Type->Name);
return;