Author: ion
Date: Fri Jun 9 11:28:26 2006
New Revision: 22290
URL:
http://svn.reactos.ru/svn/reactos?rev=22290&view=rev
Log:
- Add the OPEN_PACKET structure to internal headers. Used for the I/O Parse Routine.
- Gut down IopCreateFile to the strict minimum so that only the critical parts remain.
- NT Compatiblity fix in ObFindObject: stop parsing if remaining path is null, this means
that the parse routine is done parsing and that -this- is the final object.
Modified:
trunk/reactos/ntoskrnl/include/internal/io.h
trunk/reactos/ntoskrnl/io/file.c
trunk/reactos/ntoskrnl/ob/obname.c
Modified: trunk/reactos/ntoskrnl/include/internal/io.h
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/include/internal/i…
==============================================================================
--- trunk/reactos/ntoskrnl/include/internal/io.h (original)
+++ trunk/reactos/ntoskrnl/include/internal/io.h Fri Jun 9 11:28:26 2006
@@ -65,6 +65,44 @@
IO_STATUS_BLOCK IoStatus;
} IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET;
+typedef struct _DUMMY_FILE_OBJECT
+{
+ OBJECT_HEADER ObjectHeader;
+ CHAR FileObjectBody[sizeof(FILE_OBJECT)];
+} DUMMY_FILE_OBJECT, *PDUMMY_FILE_OBJECT;
+
+typedef struct _OPEN_PACKET
+{
+ CSHORT Type;
+ CSHORT Size;
+ PFILE_OBJECT FileObject;
+ NTSTATUS FinalStatus;
+ ULONG_PTR Information;
+ ULONG ParseCheck;
+ PFILE_OBJECT RelatedFileObject;
+ OBJECT_ATTRIBUTES OriginalAttributes;
+ LARGE_INTEGER AllocationSize;
+ ULONG CreateOptions;
+ USHORT FileAttributes;
+ USHORT ShareAccess;
+ PVOID EaBuffer;
+ ULONG EaLength;
+ ULONG Options;
+ ULONG Disposition;
+ PFILE_BASIC_INFORMATION BasicInformation;
+ PFILE_NETWORK_OPEN_INFORMATION NetworkInformation;
+ CREATE_FILE_TYPE CreateFileType;
+ PVOID MailslotOrPipeParameters;
+ BOOLEAN Override;
+ BOOLEAN QueryOnly;
+ BOOLEAN DeleteOnly;
+ BOOLEAN FullAttributes;
+ PDUMMY_FILE_OBJECT DummyFileObject;
+ ULONG InternalFlags;
+ //PIO_DRIVER_CREATE_CONTEXT DriverCreateContext; Vista only, needs ROS DDK Update
+} OPEN_PACKET, *POPEN_PACKET;
+
+
/* List of Bus Type GUIDs */
typedef struct _IO_BUS_TYPE_GUID_LIST
{
Modified: trunk/reactos/ntoskrnl/io/file.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/ntoskrnl/io/file.c?rev=2229…
==============================================================================
--- trunk/reactos/ntoskrnl/io/file.c (original)
+++ trunk/reactos/ntoskrnl/io/file.c Fri Jun 9 11:28:26 2006
@@ -125,120 +125,52 @@
PWSTR RemainingPath,
POBJECT_CREATE_INFORMATION ObjectCreateInfo)
{
- PDEVICE_OBJECT DeviceObject;
- PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
- POBJECT_TYPE ParentObjectType;
- NTSTATUS Status;
-
- DPRINT("IopCreateFile(ObjectBody 0x%p, Parent 0x%p, RemainingPath %S)\n",
- ObjectBody,
- Parent,
- RemainingPath);
-
- if (NULL == Parent)
- {
- /* This is probably an attempt to create a meta fileobject (eg. for FAT)
- for the cache manager, so return STATUS_SUCCESS */
- DPRINT("Parent object was NULL\n");
- return(STATUS_SUCCESS);
- }
-
- ParentObjectType = OBJECT_TO_OBJECT_HEADER(Parent)->Type;
-
- if (ParentObjectType != IoDeviceObjectType &&
- ParentObjectType != IoFileObjectType)
- {
- DPRINT("Parent [%wZ] is a %S which is neither a file type nor a device type ;
remaining path = %S\n",
- &OBJECT_HEADER_TO_NAME_INFO(OBJECT_TO_OBJECT_HEADER(Parent))->Name,
- OBJECT_TO_OBJECT_HEADER(Parent)->Type->Name.Buffer,
- RemainingPath);
- return(STATUS_UNSUCCESSFUL);
- }
-
- Status = ObReferenceObjectByPointer(Parent,
- STANDARD_RIGHTS_REQUIRED,
- ParentObjectType,
- UserMode);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("Failed to reference parent object 0x%p\n", Parent);
- return(Status);
- }
-
- if (ParentObjectType == IoDeviceObjectType)
- {
- /* Parent is a devce object */
- DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)Parent);
- DPRINT("DeviceObject 0x%p\n", DeviceObject);
-
- if (RemainingPath == NULL)
- {
- FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
- FileObject->FileName.Buffer = 0;
- FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
- }
- else
- {
- if ((DeviceObject->DeviceType != FILE_DEVICE_FILE_SYSTEM)
- && (DeviceObject->DeviceType != FILE_DEVICE_DISK)
- && (DeviceObject->DeviceType != FILE_DEVICE_CD_ROM)
- && (DeviceObject->DeviceType != FILE_DEVICE_TAPE)
- && (DeviceObject->DeviceType != FILE_DEVICE_NETWORK)
- && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
- && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
+ PDEVICE_OBJECT DeviceObject;
+ PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
+ POBJECT_TYPE ParentObjectType;
+ NTSTATUS Status;
+
+ DPRINT("IopCreateFile(ObjectBody 0x%p, Parent 0x%p, RemainingPath %S)\n",
+ ObjectBody,
+ Parent,
+ RemainingPath);
+
+ ParentObjectType = OBJECT_TO_OBJECT_HEADER(Parent)->Type;
+
+ if (ParentObjectType == IoDeviceObjectType)
+ {
+ /* Parent is a devce object */
+ DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)Parent);
+ DPRINT1("DeviceObject 0x%p\n", DeviceObject);
+
+ if (DeviceObject->Vpb)
+ {
+ if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
{
- CPRINT("Device was wrong type\n");
- return(STATUS_UNSUCCESSFUL);
+ DPRINT1("Mount the logical volume\n");
+ Status = IoMountVolume(DeviceObject, FALSE);
+ DPRINT1("Status %x\n", Status);
}
-
- if (DeviceObject->DeviceType != FILE_DEVICE_NETWORK
- && (DeviceObject->DeviceType != FILE_DEVICE_NAMED_PIPE)
- && (DeviceObject->DeviceType != FILE_DEVICE_MAILSLOT))
- {
- if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
- {
- DPRINT("Mount the logical volume\n");
- Status = IoMountVolume(DeviceObject, FALSE);
- DPRINT("Status %x\n", Status);
- if (!NT_SUCCESS(Status))
- {
- CPRINT("Failed to mount logical volume (Status %x)\n",
Status);
- return(Status);
- }
- }
- DeviceObject = DeviceObject->Vpb->DeviceObject;
- DPRINT("FsDeviceObject %lx\n", DeviceObject);
- }
- RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
- }
- }
- else
- {
- /* Parent is a file object */
- if (RemainingPath == NULL)
- {
- CPRINT("Device is unnamed\n");
- return STATUS_UNSUCCESSFUL;
- }
-
- DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject;
- DPRINT("DeviceObject 0x%p\n", DeviceObject);
-
- FileObject->RelatedFileObject = (PFILE_OBJECT)Parent;
-
- RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
- }
-
- DPRINT("FileObject->FileName %wZ\n",
- &FileObject->FileName);
- FileObject->DeviceObject = DeviceObject;
- DPRINT("FileObject 0x%p DeviceObject 0x%p\n",
- FileObject,
- DeviceObject);
- FileObject->Vpb = DeviceObject->Vpb;
- FileObject->Type = IO_TYPE_FILE;
-
- return(STATUS_SUCCESS);
+ DeviceObject = DeviceObject->Vpb->DeviceObject;
+ }
+
+ DPRINT("FsDeviceObject %lx\n", DeviceObject);
+ RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
+ }
+ else
+ {
+ DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject;
+ DPRINT("DeviceObject 0x%p\n", DeviceObject);
+
+ FileObject->RelatedFileObject = (PFILE_OBJECT)Parent;
+
+ RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
+ }
+
+ FileObject->DeviceObject = DeviceObject;
+ FileObject->Vpb = DeviceObject->Vpb;
+ FileObject->Type = IO_TYPE_FILE;
+ return STATUS_SUCCESS;
}
VOID
@@ -1023,6 +955,7 @@
OBJECT_ATTRIBUTES tmpObjectAttributes;
UNICODE_STRING ObjectName;
+ DPRINT1("FileExisted: %wZ %lx\n", ObjectAttributes->ObjectName,
LocalHandle);
Status = ObReferenceObjectByHandle(LocalHandle,
DesiredAccess,
NULL,
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 11:28:26 2006
@@ -288,6 +288,7 @@
}
ObDereferenceObject(CurrentObject);
CurrentObject = NextObject;
+ if (!current) break;
}
if (current)