mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 01:55:19 +00:00
If the file object is for a device, we must gather some information
from the object attribute (at least the OBJ_INHERIT flag). We cannot use IoCreateStreamFileObject because a handle from such a file object is never inheritable. svn path=/trunk/; revision=17248
This commit is contained in:
parent
2afd140d2a
commit
19f47fc57c
1 changed files with 42 additions and 2 deletions
|
@ -857,6 +857,10 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
OBJECT_CREATE_INFORMATION ObjectCreateInfo;
|
||||
OBJECT_ATTRIBUTES tmpObjectAttributes;
|
||||
UNICODE_STRING ObjectName;
|
||||
|
||||
Status = ObReferenceObjectByHandle(LocalHandle,
|
||||
DesiredAccess,
|
||||
NULL,
|
||||
|
@ -873,11 +877,47 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
ObDereferenceObject (DeviceObject);
|
||||
return STATUS_OBJECT_NAME_COLLISION;
|
||||
}
|
||||
|
||||
Status = ObpCaptureObjectAttributes(ObjectAttributes,
|
||||
AccessMode,
|
||||
NULL,
|
||||
&ObjectCreateInfo,
|
||||
&ObjectName);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
ObDereferenceObject (DeviceObject);
|
||||
return Status;
|
||||
}
|
||||
|
||||
InitializeObjectAttributes(&tmpObjectAttributes,
|
||||
NULL,
|
||||
ObjectCreateInfo.Attributes & OBJ_INHERIT,
|
||||
0,
|
||||
NULL);
|
||||
ObpReleaseCapturedAttributes(&ObjectCreateInfo);
|
||||
if (ObjectName.Buffer) ExFreePool(ObjectName.Buffer);
|
||||
|
||||
|
||||
/* FIXME: wt... */
|
||||
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||
Status = ObCreateObject(KernelMode,
|
||||
IoFileObjectType,
|
||||
&tmpObjectAttributes,
|
||||
KernelMode,
|
||||
NULL,
|
||||
sizeof(FILE_OBJECT),
|
||||
0,
|
||||
0,
|
||||
(PVOID*)&FileObject);
|
||||
|
||||
|
||||
/* Set File Object Data */
|
||||
FileObject->DeviceObject = IoGetAttachedDevice(DeviceObject);
|
||||
FileObject->Vpb = FileObject->DeviceObject->Vpb;
|
||||
|
||||
/* HACK */
|
||||
FileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||
DPRINT("%wZ\n", ObjectAttributes->ObjectName);
|
||||
|
||||
DPRINT1("%wZ\n", ObjectAttributes->ObjectName);
|
||||
|
||||
ObDereferenceObject (DeviceObject);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue