[ros-diffs] [ion] 25395: - Add missing code to ObpLookupDirectoryEntry. - Add calls to ObpInitailizeDirectoryLookup. - Add calls to ObpCleanupDirectoryLookup but disable them for now. - Add calls to ObpAcquireDirectoryLock but disable them for now.

ion at svn.reactos.org ion at svn.reactos.org
Tue Jan 9 10:07:36 CET 2007


Author: ion
Date: Tue Jan  9 12:07:36 2007
New Revision: 25395

URL: http://svn.reactos.org/svn/reactos?rev=25395&view=rev
Log:
- Add missing code to ObpLookupDirectoryEntry.
- Add calls to ObpInitailizeDirectoryLookup.
- Add calls to ObpCleanupDirectoryLookup but disable them for now.
- Add calls to ObpAcquireDirectoryLock but disable them for now.

Modified:
    trunk/reactos/ntoskrnl/ob/obdir.c
    trunk/reactos/ntoskrnl/ob/obhandle.c
    trunk/reactos/ntoskrnl/ob/obinit.c
    trunk/reactos/ntoskrnl/ob/obref.c

Modified: trunk/reactos/ntoskrnl/ob/obdir.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obdir.c?rev=25395&r1=25394&r2=25395&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obdir.c (original)
+++ trunk/reactos/ntoskrnl/ob/obdir.c Tue Jan  9 12:07:36 2007
@@ -185,7 +185,8 @@
     /* Check if the directory is already locked */
     if (!Context->DirectoryLocked)
     {
-
+        /* Lock it */
+        ObpAcquireDirectoryLockShared(Directory, Context);
     }
 
     /* Start looping */
@@ -222,6 +223,8 @@
             /* Check if the directory was locked */
             if (!Context->DirectoryLocked)
             {
+                /* Convert the lock from shared to exclusive */
+                ExConvertPushLockSharedToExclusive(&Directory->Lock);
             }
 
             /* Set the Current Entry */
@@ -241,6 +244,11 @@
         /* Get the object name information */
         ObjectHeader = OBJECT_TO_OBJECT_HEADER(FoundObject);
         HeaderNameInfo = OBJECT_HEADER_TO_NAME_INFO(ObjectHeader);
+        if (HeaderNameInfo)
+        {
+            /* Add a query reference */
+            //ObpIncrementQueryReference(ObjectHeader, HeaderNameInfo);
+        }
 
         /* Reference the object being looked up */
         //ObReferenceObject(FoundObject);
@@ -248,6 +256,8 @@
         /* Check if the directory was locked */
         if (!Context->DirectoryLocked)
         {
+            /* Release the lock */
+            ObpReleaseDirectoryLock(Directory, Context);
         }
     }
     else
@@ -255,6 +265,8 @@
         /* Check if the directory was locked */
         if (!Context->DirectoryLocked)
         {
+            /* Release the lock */
+            ObpReleaseDirectoryLock(Directory, Context);
         }
 
         /* Check if we should scan the shadow directory */

Modified: trunk/reactos/ntoskrnl/ob/obhandle.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obhandle.c?rev=25395&r1=25394&r2=25395&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obhandle.c (original)
+++ trunk/reactos/ntoskrnl/ob/obhandle.c Tue Jan  9 12:07:36 2007
@@ -2030,6 +2030,7 @@
     if (!NT_SUCCESS(Status))
     {
         /* Cleanup after lookup */
+        //ObpCleanupDirectoryLookup(&TempBuffer->LookupContext, TRUE);
         TempBuffer->LookupContext.Object = NULL;
         goto Cleanup;
     }
@@ -2062,7 +2063,9 @@
     {
         /* Set failure code */
         Status = STATUS_INVALID_PARAMETER;
-        TempBuffer->LookupContext.Object = NULL;
+
+        /* Cleanup after lookup */
+        //ObpCleanupDirectoryLookup(&TempBuffer->LookupContext, TRUE);
     }
     else
     {
@@ -2440,12 +2443,13 @@
     if (!NT_SUCCESS(Status))
     {
         /* Fail */
+        if (ObjectNameInfo) ObpDecrementQueryReference(ObjectNameInfo);
         ObDereferenceObject(Object);
         return Status;
     }
 
     /* Setup a lookup context */
-    Context.Object = NULL;
+    ObpInitializeDirectoryLookup(&Context);
     InsertObject = Object;
     OpenReason = ObCreateHandle;
 

Modified: trunk/reactos/ntoskrnl/ob/obinit.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obinit.c?rev=25395&r1=25394&r2=25395&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obinit.c (original)
+++ trunk/reactos/ntoskrnl/ob/obinit.c Tue Jan  9 12:07:36 2007
@@ -278,9 +278,17 @@
     Status = NtClose(Handle);
     if (!NT_SUCCESS(Status)) return FALSE;
 
-    Context.Object = NULL;
+    /* Initialize lookup context */
+    ObpInitializeDirectoryLookup(&Context);
+
+    /* Lock it */
+    //ObpAcquireDirectoryLockExclusive(ObpTypeDirectoryObject, &Context);
+
+    /* Setup directory */
+    // FIXME: ObpSetLookupDirectory(Dir);?
     Context.Directory = ObpTypeDirectoryObject;
     Context.DirectoryLocked = TRUE;
+    Context.LockStateSignature = 0xCCCC1234;
 
     /* Loop the object types */
     ListHead = &ObTypeObjectType->TypeList;
@@ -317,6 +325,8 @@
         NextEntry = NextEntry->Flink;
     }
 
+    /* Cleanup after lookup */
+    //ObpCleanupDirectoryLookup(&Context, TRUE);
     Context.Object = NULL;
 
     /* Initialize DOS Devices Directory and related Symbolic Links */

Modified: trunk/reactos/ntoskrnl/ob/obref.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/ntoskrnl/ob/obref.c?rev=25395&r1=25394&r2=25395&view=diff
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obref.c (original)
+++ trunk/reactos/ntoskrnl/ob/obref.c Tue Jan  9 12:07:36 2007
@@ -428,6 +428,9 @@
                                  PassedAccessState,
                                  &Context,
                                  &Object);
+
+    /* Cleanup after lookup */
+    //ObpCleanupDirectoryLookup(&Context, TRUE);
     Context.Object = NULL;
 
     /* Check if the lookup succeeded */




More information about the Ros-diffs mailing list