Author: ion
Date: Fri Jun 9 01:36:44 2006
New Revision: 22288
URL:
http://svn.reactos.ru/svn/reactos?rev=22288&view=rev
Log:
- Remove the heart (but not the brain) of the IopCreateFile hack. A much 'nicer'
hack now detects if a filename can't be found, and instead of inserting it into the
object directory (wrong!), calling IopCreateFile (wrong!), then having it fail, only to
then remove the newly inserted object entry (wrong wrong wrong!), IopCreateFile is now
*only* called for real files, otherwise Ob detects the invalid name and fails nicely and
quickly.
Modified:
trunk/reactos/ntoskrnl/ob/obname.c
Modified: trunk/reactos/ntoskrnl/ob/obname.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/ob/obname.c?rev=22…
==============================================================================
--- trunk/reactos/ntoskrnl/ob/obname.c (original)
+++ trunk/reactos/ntoskrnl/ob/obname.c Fri Jun 9 01:36:44 2006
@@ -310,7 +310,6 @@
PVOID FoundObject = NULL;
POBJECT_HEADER Header = OBJECT_TO_OBJECT_HEADER(Insert);
POBJECT_HEADER FoundHeader = NULL;
- BOOLEAN ObjectAttached = FALSE;
FoundObject = *ReturnedObject;
if (FoundObject)
{
@@ -322,6 +321,29 @@
DPRINT("Object exists\n");
ObDereferenceObject(FoundObject);
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 &&
@@ -347,34 +369,8 @@
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;
}