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.
Modified: trunk/reactos/ntoskrnl/io/file.c
_____
Modified: trunk/reactos/ntoskrnl/io/file.c
--- trunk/reactos/ntoskrnl/io/file.c 2005-08-09 19:11:57 UTC (rev
17247)
+++ trunk/reactos/ntoskrnl/io/file.c 2005-08-09 19:12:46 UTC (rev
17248)
@@ -857,6 +857,10 @@
if (NT_SUCCESS(Status))
{
+ OBJECT_CREATE_INFORMATION ObjectCreateInfo;
+ OBJECT_ATTRIBUTES tmpObjectAttributes;
+ UNICODE_STRING ObjectName;
+
Status = ObReferenceObjectByHandle(LocalHandle,
DesiredAccess,
NULL,
@@ -873,12 +877,48 @@
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);
}
Show replies by date