- Remove the heart (but not the brain) of the IopCreateFile hack. A much 'nicer'...
authorAlex Ionescu <aionescu@gmail.com>
Thu, 8 Jun 2006 21:36:44 +0000 (21:36 +0000)
committerAlex Ionescu <aionescu@gmail.com>
Thu, 8 Jun 2006 21:36:44 +0000 (21:36 +0000)
svn path=/trunk/; revision=22288

reactos/ntoskrnl/ob/obname.c

index 0ef4abe..b9e7549 100644 (file)
@@ -310,7 +310,6 @@ Next:
         PVOID FoundObject = NULL;
         POBJECT_HEADER Header = OBJECT_TO_OBJECT_HEADER(Insert);
         POBJECT_HEADER FoundHeader = NULL;
-        BOOLEAN ObjectAttached = FALSE;
         FoundObject = *ReturnedObject;
         if (FoundObject)
         {
@@ -324,6 +323,29 @@ Next:
             return STATUS_OBJECT_NAME_COLLISION;
         }
 
+        /*
+         * MiniHack
+         * If we still have a remaining path on a directory object, but we are
+         * a file object, then fail, because this means the file doesn't exist
+         */
+        if ((RemainingPath->Buffer) &&
+            (FoundHeader && FoundHeader->Type == ObDirectoryType) &&
+            (Header->Type == IoFileObjectType))
+        {
+            /* Hack */
+            RtlFreeUnicodeString(RemainingPath);
+            *ReturnedObject = NULL;
+            return STATUS_OBJECT_PATH_NOT_FOUND;
+        }
+        else if (Header->Type == IoFileObjectType)
+        {
+            /* Otherwise, call the hacked parse routine which will go away soon */
+            Status = IopCreateFile(&Header->Body,
+                                   FoundObject,
+                                   RemainingPath->Buffer,
+                                   NULL);
+        }
+
         if (FoundHeader && FoundHeader->Type == ObDirectoryType &&
             RemainingPath->Buffer)
         {
@@ -347,34 +369,8 @@ Next:
             ObjectNameInfo->Name.Length = RemainingPath->Length - Delta;
             ObjectNameInfo->Name.MaximumLength = RemainingPath->MaximumLength - Delta;
             ObpInsertEntryDirectory(FoundObject, Context, Header);
-            ObjectAttached = TRUE;
-        }
-
-        if (Header->Type == IoFileObjectType)
-        {
-            /* TEMPORARY HACK. DO NOT TOUCH -- Alex */
-            DPRINT("Calling IopCreateFile: %p %p %wZ\n", &Header->Body, FoundObject, RemainingPath);
-            Status = IopCreateFile(&Header->Body,
-                FoundObject,
-                RemainingPath->Buffer,            
-                NULL);
-            DPRINT("Called IopCreateFile: %x\n", Status);
         }
 
-        if (!NT_SUCCESS(Status))
-        {
-            DPRINT("Create Failed\n");
-            if (ObjectAttached == TRUE)
-            {
-                ObpDeleteEntryDirectory(Context);
-            }
-            if (FoundObject)
-            {
-                ObDereferenceObject(FoundObject);
-            }
-            RtlFreeUnicodeString(RemainingPath);
-            return Status;
-        }
         RtlFreeUnicodeString(RemainingPath);
         *ReturnedObject = Insert;
     }