mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Try always to open a file as named object first.
This is necessary for the redirection to NUL which is used by the new build system. svn path=/trunk/; revision=15699
This commit is contained in:
parent
17b55d1d60
commit
9029590177
1 changed files with 30 additions and 35 deletions
|
@ -844,44 +844,39 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
DPRINT1("FIXME: IO_CHECK_CREATE_PARAMETERS not yet supported!\n");
|
||||
}
|
||||
|
||||
if (CreateDisposition == FILE_OPEN ||
|
||||
CreateDisposition == FILE_OPEN_IF)
|
||||
Status = ObOpenObjectByName(ObjectAttributes,
|
||||
NULL,
|
||||
NULL,
|
||||
AccessMode,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
&LocalHandle);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
|
||||
Status = ObOpenObjectByName(ObjectAttributes,
|
||||
NULL,
|
||||
NULL,
|
||||
AccessMode,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
&LocalHandle);
|
||||
|
||||
if (NT_SUCCESS(Status))
|
||||
Status = ObReferenceObjectByHandle(LocalHandle,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
AccessMode,
|
||||
(PVOID*)&DeviceObject,
|
||||
NULL);
|
||||
ZwClose(LocalHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
Status = ObReferenceObjectByHandle(LocalHandle,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
AccessMode,
|
||||
(PVOID*)&DeviceObject,
|
||||
NULL);
|
||||
ZwClose(LocalHandle);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
return Status;
|
||||
}
|
||||
if (BODY_TO_HEADER(DeviceObject)->Type != IoDeviceObjectType)
|
||||
{
|
||||
ObDereferenceObject (DeviceObject);
|
||||
return STATUS_OBJECT_NAME_COLLISION;
|
||||
}
|
||||
/* FIXME: wt... */
|
||||
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||
/* HACK */
|
||||
FileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||
DPRINT("%wZ\n", ObjectAttributes->ObjectName);
|
||||
|
||||
ObDereferenceObject (DeviceObject);
|
||||
return Status;
|
||||
}
|
||||
if (BODY_TO_HEADER(DeviceObject)->Type != IoDeviceObjectType)
|
||||
{
|
||||
ObDereferenceObject (DeviceObject);
|
||||
return STATUS_OBJECT_NAME_COLLISION;
|
||||
}
|
||||
/* FIXME: wt... */
|
||||
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||
/* HACK */
|
||||
FileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||
DPRINT("%wZ\n", ObjectAttributes->ObjectName);
|
||||
|
||||
ObDereferenceObject (DeviceObject);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue