mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 10:22:59 +00:00
- 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. svn path=/trunk/; revision=22290
This commit is contained in:
parent
c07a24b350
commit
dc1e926987
3 changed files with 72 additions and 100 deletions
|
@ -65,6 +65,44 @@ typedef struct _IO_COMPLETION_PACKET
|
||||||
IO_STATUS_BLOCK IoStatus;
|
IO_STATUS_BLOCK IoStatus;
|
||||||
} IO_COMPLETION_PACKET, *PIO_COMPLETION_PACKET;
|
} 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 */
|
/* List of Bus Type GUIDs */
|
||||||
typedef struct _IO_BUS_TYPE_GUID_LIST
|
typedef struct _IO_BUS_TYPE_GUID_LIST
|
||||||
{
|
{
|
||||||
|
|
|
@ -125,120 +125,52 @@ IopCreateFile(PVOID ObjectBody,
|
||||||
PWSTR RemainingPath,
|
PWSTR RemainingPath,
|
||||||
POBJECT_CREATE_INFORMATION ObjectCreateInfo)
|
POBJECT_CREATE_INFORMATION ObjectCreateInfo)
|
||||||
{
|
{
|
||||||
PDEVICE_OBJECT DeviceObject;
|
PDEVICE_OBJECT DeviceObject;
|
||||||
PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
|
PFILE_OBJECT FileObject = (PFILE_OBJECT) ObjectBody;
|
||||||
POBJECT_TYPE ParentObjectType;
|
POBJECT_TYPE ParentObjectType;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("IopCreateFile(ObjectBody 0x%p, Parent 0x%p, RemainingPath %S)\n",
|
DPRINT("IopCreateFile(ObjectBody 0x%p, Parent 0x%p, RemainingPath %S)\n",
|
||||||
ObjectBody,
|
ObjectBody,
|
||||||
Parent,
|
Parent,
|
||||||
RemainingPath);
|
RemainingPath);
|
||||||
|
|
||||||
if (NULL == Parent)
|
ParentObjectType = OBJECT_TO_OBJECT_HEADER(Parent)->Type;
|
||||||
|
|
||||||
|
if (ParentObjectType == IoDeviceObjectType)
|
||||||
{
|
{
|
||||||
/* This is probably an attempt to create a meta fileobject (eg. for FAT)
|
/* Parent is a devce object */
|
||||||
for the cache manager, so return STATUS_SUCCESS */
|
DeviceObject = IoGetAttachedDevice((PDEVICE_OBJECT)Parent);
|
||||||
DPRINT("Parent object was NULL\n");
|
DPRINT1("DeviceObject 0x%p\n", DeviceObject);
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
ParentObjectType = OBJECT_TO_OBJECT_HEADER(Parent)->Type;
|
if (DeviceObject->Vpb)
|
||||||
|
|
||||||
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;
|
if (!(DeviceObject->Vpb->Flags & VPB_MOUNTED))
|
||||||
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))
|
|
||||||
{
|
{
|
||||||
CPRINT("Device was wrong type\n");
|
DPRINT1("Mount the logical volume\n");
|
||||||
return(STATUS_UNSUCCESSFUL);
|
Status = IoMountVolume(DeviceObject, FALSE);
|
||||||
|
DPRINT1("Status %x\n", Status);
|
||||||
}
|
}
|
||||||
|
DeviceObject = DeviceObject->Vpb->DeviceObject;
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
DPRINT("FsDeviceObject %lx\n", DeviceObject);
|
||||||
|
RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Parent is a file object */
|
DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject;
|
||||||
if (RemainingPath == NULL)
|
DPRINT("DeviceObject 0x%p\n", DeviceObject);
|
||||||
{
|
|
||||||
CPRINT("Device is unnamed\n");
|
|
||||||
return STATUS_UNSUCCESSFUL;
|
|
||||||
}
|
|
||||||
|
|
||||||
DeviceObject = ((PFILE_OBJECT)Parent)->DeviceObject;
|
FileObject->RelatedFileObject = (PFILE_OBJECT)Parent;
|
||||||
DPRINT("DeviceObject 0x%p\n", DeviceObject);
|
|
||||||
|
|
||||||
FileObject->RelatedFileObject = (PFILE_OBJECT)Parent;
|
RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
|
||||||
|
|
||||||
RtlCreateUnicodeString(&FileObject->FileName, RemainingPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINT("FileObject->FileName %wZ\n",
|
FileObject->DeviceObject = DeviceObject;
|
||||||
&FileObject->FileName);
|
FileObject->Vpb = DeviceObject->Vpb;
|
||||||
FileObject->DeviceObject = DeviceObject;
|
FileObject->Type = IO_TYPE_FILE;
|
||||||
DPRINT("FileObject 0x%p DeviceObject 0x%p\n",
|
return STATUS_SUCCESS;
|
||||||
FileObject,
|
|
||||||
DeviceObject);
|
|
||||||
FileObject->Vpb = DeviceObject->Vpb;
|
|
||||||
FileObject->Type = IO_TYPE_FILE;
|
|
||||||
|
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
|
@ -1023,6 +955,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||||
OBJECT_ATTRIBUTES tmpObjectAttributes;
|
OBJECT_ATTRIBUTES tmpObjectAttributes;
|
||||||
UNICODE_STRING ObjectName;
|
UNICODE_STRING ObjectName;
|
||||||
|
|
||||||
|
DPRINT1("FileExisted: %wZ %lx\n", ObjectAttributes->ObjectName, LocalHandle);
|
||||||
Status = ObReferenceObjectByHandle(LocalHandle,
|
Status = ObReferenceObjectByHandle(LocalHandle,
|
||||||
DesiredAccess,
|
DesiredAccess,
|
||||||
NULL,
|
NULL,
|
||||||
|
|
|
@ -288,6 +288,7 @@ Next:
|
||||||
}
|
}
|
||||||
ObDereferenceObject(CurrentObject);
|
ObDereferenceObject(CurrentObject);
|
||||||
CurrentObject = NextObject;
|
CurrentObject = NextObject;
|
||||||
|
if (!current) break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current)
|
if (current)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue