mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Make the remaning code match the current formatting instead of being really ugly, and make some changes to IoCreateFileStreamObject (which is wrong anyways, since it's doing what *Lite should do)
svn path=/trunk/; revision=15178
This commit is contained in:
parent
834acf81da
commit
37707ad1a6
1 changed files with 166 additions and 155 deletions
|
@ -4,7 +4,8 @@
|
|||
* FILE: ntoskrnl/io/file.c
|
||||
* PURPOSE: I/O File Object & NT File Handle Access/Managment of Files.
|
||||
*
|
||||
* PROGRAMMERS: David Welch (welch@mcmail.com)
|
||||
* PROGRAMMERS: Alex Ionescu (alex@relsoft.net)
|
||||
* David Welch (welch@mcmail.com)
|
||||
*/
|
||||
|
||||
/* INCLUDES *****************************************************************/
|
||||
|
@ -767,6 +768,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
|||
ObDereferenceObject (DeviceObject);
|
||||
return STATUS_OBJECT_NAME_COLLISION;
|
||||
}
|
||||
/* FIXME: wt... */
|
||||
FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
|
||||
ObDereferenceObject (DeviceObject);
|
||||
}
|
||||
|
@ -1000,11 +1002,16 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
|||
PFILE_OBJECT CreatedFileObject;
|
||||
NTSTATUS Status;
|
||||
|
||||
/* FIXME: This function should call ObInsertObject. The "Lite" version
|
||||
doesnt. This function is also called from IoCreateFile for some
|
||||
reason. These hacks need to be removed.
|
||||
*/
|
||||
|
||||
DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",
|
||||
FileObject, DeviceObject);
|
||||
PAGED_CODE();
|
||||
|
||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||
|
||||
/* Create the File Object */
|
||||
Status = ObCreateObject(KernelMode,
|
||||
IoFileObjectType,
|
||||
NULL,
|
||||
|
@ -1016,35 +1023,25 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
|||
(PVOID*)&CreatedFileObject);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("Could not create FileObject\n");
|
||||
DPRINT1("Could not create FileObject\n");
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
if (FileObject != NULL)
|
||||
{
|
||||
DeviceObject = FileObject->DeviceObject;
|
||||
}
|
||||
DeviceObject = IoGetAttachedDevice(DeviceObject);
|
||||
|
||||
/* Choose Device Object */
|
||||
if (FileObject) DeviceObject = FileObject->DeviceObject;
|
||||
DPRINT("DeviceObject %x\n", DeviceObject);
|
||||
|
||||
if (DeviceObject->Vpb &&
|
||||
DeviceObject->Vpb->DeviceObject)
|
||||
{
|
||||
CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Set File Object Data */
|
||||
CreatedFileObject->DeviceObject = DeviceObject;
|
||||
}
|
||||
CreatedFileObject->Vpb = DeviceObject->Vpb;
|
||||
CreatedFileObject->Type = IO_TYPE_FILE;
|
||||
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||
CreatedFileObject->Flags = FO_STREAM_FILE;
|
||||
|
||||
// shouldn't we initialize the lock event, and several other things here too?
|
||||
/* Initialize Lock and Event */
|
||||
KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
|
||||
KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE);
|
||||
|
||||
/* Return file */
|
||||
return CreatedFileObject;
|
||||
}
|
||||
|
||||
|
@ -1396,21 +1393,28 @@ NtCreateMailslotFile(OUT PHANDLE FileHandle,
|
|||
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
|
||||
FileHandle,DesiredAccess,ObjectAttributes,
|
||||
ObjectAttributes->ObjectName->Buffer);
|
||||
PAGED_CODE();
|
||||
|
||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||
|
||||
if (TimeOut != NULL)
|
||||
/* Check for Timeout */
|
||||
if (TimeOut)
|
||||
{
|
||||
Buffer.ReadTimeout.QuadPart = TimeOut->QuadPart;
|
||||
/* Enable it */
|
||||
Buffer.TimeoutSpecified = TRUE;
|
||||
|
||||
/* FIXME: Add SEH */
|
||||
Buffer.ReadTimeout = *TimeOut;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No timeout */
|
||||
Buffer.TimeoutSpecified = FALSE;
|
||||
}
|
||||
|
||||
/* Set Settings */
|
||||
Buffer.MailslotQuota = MailslotQuota;
|
||||
Buffer.MaximumMessageSize = MaxMessageSize;
|
||||
|
||||
/* Call I/O */
|
||||
return IoCreateFile(FileHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
|
@ -1450,18 +1454,24 @@ NtCreateNamedPipeFile(PHANDLE FileHandle,
|
|||
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
|
||||
FileHandle,DesiredAccess,ObjectAttributes,
|
||||
ObjectAttributes->ObjectName->Buffer);
|
||||
PAGED_CODE();
|
||||
|
||||
ASSERT_IRQL(PASSIVE_LEVEL);
|
||||
|
||||
if (DefaultTimeout != NULL)
|
||||
/* Check for Timeout */
|
||||
if (DefaultTimeout)
|
||||
{
|
||||
Buffer.DefaultTimeout.QuadPart = DefaultTimeout->QuadPart;
|
||||
/* Enable it */
|
||||
Buffer.TimeoutSpecified = TRUE;
|
||||
|
||||
/* FIXME: Add SEH */
|
||||
Buffer.DefaultTimeout = *DefaultTimeout;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* No timeout */
|
||||
Buffer.TimeoutSpecified = FALSE;
|
||||
}
|
||||
|
||||
/* Set Settings */
|
||||
Buffer.NamedPipeType = NamedPipeType;
|
||||
Buffer.ReadMode = ReadMode;
|
||||
Buffer.CompletionMode = CompletionMode;
|
||||
|
@ -1469,6 +1479,7 @@ NtCreateNamedPipeFile(PHANDLE FileHandle,
|
|||
Buffer.InboundQuota = InboundQuota;
|
||||
Buffer.OutboundQuota = OutboundQuota;
|
||||
|
||||
/* Call I/O */
|
||||
return IoCreateFile(FileHandle,
|
||||
DesiredAccess,
|
||||
ObjectAttributes,
|
||||
|
@ -1983,12 +1994,12 @@ NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
FileInformation,
|
||||
sizeof(FILE_BASIC_INFORMATION),
|
||||
FileBasicInformation);
|
||||
ZwClose (FileHandle);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
|
||||
}
|
||||
|
||||
ZwClose(FileHandle);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -2207,12 +2218,12 @@ NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|||
FileInformation,
|
||||
sizeof(FILE_NETWORK_OPEN_INFORMATION),
|
||||
FileNetworkOpenInformation);
|
||||
ZwClose (FileHandle);
|
||||
if (!NT_SUCCESS (Status))
|
||||
{
|
||||
DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
|
||||
}
|
||||
|
||||
ZwClose (FileHandle);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue