<html>
<head>
<style>
<!--
body { background-color:#ffffff }
.file { border:1px solid #eeeeee; margin-top:1em; margin-bottom:1em }
.pathname { font-family:monospace; float:right }
.fileheader { margin-bottom:.5em }
.diff { margin:0 }
.tasklist { padding:4px; border:1px dashed #000000; margin-top:1em }
.tasklist ul { margin-top:0; margin-bottom:0 }
tr.alt { background-color:#eeeeee }
#added { background-color:#ddffdd }
#addedchars { background-color:#99ff99; font-weight:bolder }
tr.alt #added { background-color:#ccf7cc }
#removed { background-color:#ffdddd }
#removedchars { background-color:#ff9999; font-weight:bolder }
tr.alt #removed { background-color:#f7cccc }
#info { color:#888888 }
#context { background-color:#eeeeee }
td {padding-left:.3em; padding-right:.3em }
tr.head { border-bottom-width:1px; border-bottom-style:solid }
tr.head td { padding:0; padding-top:.2em }
.task { background-color:#ffff00 }
.comment { padding:4px; border:1px dashed #000000; background-color:#ffffdd }
.error { color:red }
hr { border-width:0px; height:2px; background:black }
-->
</style>
</head>
<body>
<pre class="comment">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)</pre><pre class="diff" id="context">Modified: trunk/reactos/ntoskrnl/io/file.c
</pre><hr /><div class="file">
<div class="fileheader"><big><b>Modified: trunk/reactos/ntoskrnl/io/file.c</b></big></div>
<pre class="diff"><small id="info">--- trunk/reactos/ntoskrnl/io/file.c        2005-05-09 03:58:35 UTC (rev 15177)
+++ trunk/reactos/ntoskrnl/io/file.c        2005-05-09 04:31:04 UTC (rev 15178)
@@ -4,7 +4,8 @@
</small></pre><pre class="diff" id="context"> * FILE: ntoskrnl/io/file.c
* PURPOSE: I/O File Object & NT File Handle Access/Managment of Files.
*
</pre><pre class="diff" id="removed">- * PROGRAMMERS: <span id="removedchars">David Welch (welch@mcmail.com</span>)
</pre><pre class="diff" id="added">+ * PROGRAMMERS: <span id="addedchars">Alex Ionescu (alex@relsoft.net</span>)
+ * David Welch (welch@mcmail.com)
</pre><pre class="diff" id="context"> */
/* INCLUDES *****************************************************************/
@@ -767,6 +768,7 @@
</pre><pre class="diff" id="context"> ObDereferenceObject (DeviceObject);
return STATUS_OBJECT_NAME_COLLISION;
}
</pre><pre class="diff" id="added">+ /* FIXME: wt... */
</pre><pre class="diff" id="context"> FileObject = IoCreateStreamFileObject(NULL, DeviceObject);
ObDereferenceObject (DeviceObject);
}
@@ -997,55 +999,50 @@
</pre><pre class="diff" id="context"> IoCreateStreamFileObject(PFILE_OBJECT FileObject,
PDEVICE_OBJECT DeviceObject)
{
</pre><pre class="diff" id="removed">- PFILE_OBJECT CreatedFileObject;
- <span id="removedchars">NTSTATUS Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> PFILE_OBJECT CreatedFileObject</span>;
+ 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.
+ */
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",
- <span id="removedchars">FileObject, DeviceObject);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT("IoCreateStreamFileObject(FileObject %x, DeviceObject %x)\n",</span>
+ FileObject, DeviceObject);
+ PAGED_CODE();
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- ASSERT_IRQL(PASSIVE_LEVEL);
-
- Status = ObCreateObject(KernelMode,
- IoFileObjectType,
- NULL,
- KernelMode,
- NULL,
- sizeof(FILE_OBJECT),
- 0,
- 0,
- (PVOID*)&CreatedFileObject);
- <span id="removedchars">if (!NT_SUCCESS(Status))</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Create the File Object */</span>
+ Status = ObCreateObject(KernelMode,
+ IoFileObjectType,
+ NULL,
+ KernelMode,
+ NULL,
+ sizeof(FILE_OBJECT),
+ 0,
+ 0,
+ (PVOID*)&CreatedFileObject);
+ if (!NT_SUCCESS(Status))
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- DPRINT("Could not create FileObject\n");
- <span id="removedchars">return (NULL</span>);
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT1("Could not create FileObject\n"</span>);
+ return (NULL);
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- if (FileObject != NULL)
- {
- DeviceObject = FileObject->DeviceObject;
- }
- <span id="removedchars">DeviceObject = IoGetAttachedDevice(DeviceObject);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Choose Device Object */</span>
+ if (FileObject) DeviceObject = FileObject->DeviceObject;
+ DPRINT("DeviceObject %x\n", DeviceObject);
+
+ /* Set File Object Data */
+ CreatedFileObject->DeviceObject = DeviceObject;
+ CreatedFileObject->Vpb = DeviceObject->Vpb;
+ CreatedFileObject->Type = IO_TYPE_FILE;
+ CreatedFileObject->Flags = FO_STREAM_FILE;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- <span id="removedchars">DPRINT("DeviceObject %x\n", DeviceObject);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Initialize Lock and Event */</span>
+ KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
+ KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE);
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- if (DeviceObject->Vpb &&
- DeviceObject->Vpb->DeviceObject)
- {
- CreatedFileObject->DeviceObject = DeviceObject->Vpb->DeviceObject;
- }
- else
- {
- CreatedFileObject->DeviceObject = DeviceObject;
- }
- CreatedFileObject->Vpb = DeviceObject->Vpb;
- CreatedFileObject->Type = IO_TYPE_FILE;
- CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
-
- // shouldn't we initialize the lock event, and several other things here too?
- KeInitializeEvent(&CreatedFileObject->Event, NotificationEvent, FALSE);
- KeInitializeEvent(&CreatedFileObject->Lock, SynchronizationEvent, TRUE);
-
- <span id="removedchars">return CreatedFileObject;</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Return file */</span>
+ return CreatedFileObject;
</pre><pre class="diff" id="context"> }
/*
@@ -1390,41 +1387,48 @@
</pre><pre class="diff" id="context"> IN ULONG MaxMessageSize,
IN PLARGE_INTEGER TimeOut)
{
</pre><pre class="diff" id="removed">- MAILSLOT_CREATE_PARAMETERS Buffer;
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>MAILSLOT_CREATE_PARAMETERS Buffer;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- DPRINT("NtCreateMailslotFile(FileHandle %x, DesiredAccess %x, "
- "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
- FileHandle,DesiredAccess,ObjectAttributes,
- <span id="removedchars">ObjectAttributes->ObjectName->Buffer);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT("NtCreateMailslotFile(FileHandle %x, DesiredAccess %x, "</span>
+ "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
+ FileHandle,DesiredAccess,ObjectAttributes,
+ ObjectAttributes->ObjectName->Buffer);
+ PAGED_CODE();
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- ASSERT_IRQL(PASSIVE_LEVEL);
-
- if (TimeOut != NULL)
- {
- Buffer.ReadTimeout.QuadPart = TimeOut->QuadPart;
- Buffer.TimeoutSpecified = TRUE;
- }
- else
- {
- Buffer.TimeoutSpecified = FALSE;
- }
- Buffer.MailslotQuota = MailslotQuota;
- <span id="removedchars">Buffer.MaximumMessageSize = MaxMessageSize;</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Check for Timeout */</span>
+ if (TimeOut)
+ {
+ /* 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;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- return IoCreateFile(FileHandle,
- DesiredAccess,
- ObjectAttributes,
- IoStatusBlock,
- NULL,
- FILE_ATTRIBUTE_NORMAL,
- FILE_SHARE_READ | FILE_SHARE_WRITE,
- FILE_CREATE,
- CreateOptions,
- NULL,
- 0,
- CreateFileTypeMailslot,
- (PVOID)&Buffer,
- <span id="removedchars"> 0);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars">/* Call I/O */</span>
+ return IoCreateFile(FileHandle,
+ DesiredAccess,
+ ObjectAttributes,
+ IoStatusBlock,
+ NULL,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ FILE_CREATE,
+ CreateOptions,
+ NULL,
+ 0,
+ CreateFileTypeMailslot,
+ (PVOID)&Buffer,
+ 0);
</pre><pre class="diff" id="context"> }
NTSTATUS
@@ -1444,45 +1448,52 @@
</pre><pre class="diff" id="context"> ULONG OutboundQuota,
PLARGE_INTEGER DefaultTimeout)
{
</pre><pre class="diff" id="removed">- NAMED_PIPE_CREATE_PARAMETERS Buffer;
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>NAMED_PIPE_CREATE_PARAMETERS Buffer;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- DPRINT("NtCreateNamedPipeFile(FileHandle %x, DesiredAccess %x, "
- "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
- FileHandle,DesiredAccess,ObjectAttributes,
- <span id="removedchars">ObjectAttributes->ObjectName->Buffer);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT("NtCreateNamedPipeFile(FileHandle %x, DesiredAccess %x, "</span>
+ "ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
+ FileHandle,DesiredAccess,ObjectAttributes,
+ ObjectAttributes->ObjectName->Buffer);
+ PAGED_CODE();
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- ASSERT_IRQL(PASSIVE_LEVEL);
-
- <span id="removedchars">if (DefaultTimeout != NULL)</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Check for Timeout */</span>
+ if (DefaultTimeout)
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- Buffer.DefaultTimeout.QuadPart = DefaultTimeout->QuadPart;
- <span id="removedchars">Buffer.TimeoutSpecified = TRUE;</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Enable it */</span>
+ Buffer.TimeoutSpecified = TRUE;
+
+ /* FIXME: Add SEH */
+ Buffer.DefaultTimeout = *DefaultTimeout;
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- else
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>else
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- <span id="removedchars">Buffer.TimeoutSpecified = FALSE;</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* No timeout */</span>
+ Buffer.TimeoutSpecified = FALSE;
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- Buffer.NamedPipeType = NamedPipeType;
- Buffer.ReadMode = ReadMode;
- Buffer.CompletionMode = CompletionMode;
- Buffer.MaximumInstances = MaximumInstances;
- Buffer.InboundQuota = InboundQuota;
- <span id="removedchars">Buffer.OutboundQuota = OutboundQuota;</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>
+ /* Set Settings */
+ Buffer.NamedPipeType = NamedPipeType;
+ Buffer.ReadMode = ReadMode;
+ Buffer.CompletionMode = CompletionMode;
+ Buffer.MaximumInstances = MaximumInstances;
+ Buffer.InboundQuota = InboundQuota;
+ Buffer.OutboundQuota = OutboundQuota;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- return IoCreateFile(FileHandle,
- DesiredAccess,
- ObjectAttributes,
- IoStatusBlock,
- NULL,
- FILE_ATTRIBUTE_NORMAL,
- ShareAccess,
- CreateDisposition,
- CreateOptions,
- NULL,
- 0,
- CreateFileTypeNamedPipe,
- (PVOID)&Buffer,
- <span id="removedchars"> 0);</span>
</pre><pre class="diff" id="added">+ <span id="addedchars">/* Call I/O */</span>
+ return IoCreateFile(FileHandle,
+ DesiredAccess,
+ ObjectAttributes,
+ IoStatusBlock,
+ NULL,
+ FILE_ATTRIBUTE_NORMAL,
+ ShareAccess,
+ CreateDisposition,
+ CreateOptions,
+ NULL,
+ 0,
+ CreateFileTypeNamedPipe,
+ (PVOID)&Buffer,
+ 0);
</pre><pre class="diff" id="context"> }
/*
@@ -1513,8 +1524,8 @@
</pre><pre class="diff" id="context"> STDCALL
NtFlushWriteBuffer(VOID)
{
</pre><pre class="diff" id="removed">- KeFlushWriteBuffer();
- <span id="removedchars">return STATUS_SUCCESS</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> KeFlushWriteBuffer()</span>;
+ return STATUS_SUCCESS;
</pre><pre class="diff" id="context"> }
/*
@@ -1960,36 +1971,36 @@
</pre><pre class="diff" id="context"> NtQueryAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PFILE_BASIC_INFORMATION FileInformation)
{
</pre><pre class="diff" id="removed">- IO_STATUS_BLOCK IoStatusBlock;
- HANDLE FileHandle;
- <span id="removedchars">NTSTATUS Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> IO_STATUS_BLOCK IoStatusBlock</span>;
+ HANDLE FileHandle;
+ NTSTATUS Status;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- /* Open the file */
- Status = ZwOpenFile (&FileHandle,
- SYNCHRONIZE | FILE_READ_ATTRIBUTES,
- ObjectAttributes,
- &IoStatusBlock,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- FILE_SYNCHRONOUS_IO_NONALERT);
- <span id="removedchars">if (!NT_SUCCESS (Status))</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Open the file */</span>
+ Status = ZwOpenFile(&FileHandle,
+ SYNCHRONIZE | FILE_READ_ATTRIBUTES,
+ ObjectAttributes,
+ &IoStatusBlock,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS (Status))
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status);
- <span id="removedchars">return Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status)</span>;
+ return Status;
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- /* Get file attributes */
- Status = ZwQueryInformationFile (FileHandle,
- &IoStatusBlock,
- FileInformation,
- sizeof(FILE_BASIC_INFORMATION),
- FileBasicInformation);
- ZwClose (FileHandle);
- <span id="removedchars">if (!NT_SUCCESS (Status))</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Get file attributes */</span>
+ Status = ZwQueryInformationFile(FileHandle,
+ &IoStatusBlock,
+ FileInformation,
+ sizeof(FILE_BASIC_INFORMATION),
+ FileBasicInformation);
+ if (!NT_SUCCESS (Status))
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- <span id="removedchars">return Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> ZwClose(FileHandle)</span>;
+ return Status;
</pre><pre class="diff" id="context"> }
/*
@@ -2184,36 +2195,36 @@
</pre><pre class="diff" id="context"> NtQueryFullAttributesFile(IN POBJECT_ATTRIBUTES ObjectAttributes,
OUT PFILE_NETWORK_OPEN_INFORMATION FileInformation)
{
</pre><pre class="diff" id="removed">- IO_STATUS_BLOCK IoStatusBlock;
- HANDLE FileHandle;
- <span id="removedchars">NTSTATUS Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> IO_STATUS_BLOCK IoStatusBlock</span>;
+ HANDLE FileHandle;
+ NTSTATUS Status;
</pre><pre class="diff" id="context">
</pre><pre class="diff" id="removed">- /* Open the file */
- Status = ZwOpenFile (&FileHandle,
- SYNCHRONIZE | FILE_READ_ATTRIBUTES,
- ObjectAttributes,
- &IoStatusBlock,
- FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
- FILE_SYNCHRONOUS_IO_NONALERT);
- <span id="removedchars">if (!NT_SUCCESS (Status))</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Open the file */</span>
+ Status = ZwOpenFile(&FileHandle,
+ SYNCHRONIZE | FILE_READ_ATTRIBUTES,
+ ObjectAttributes,
+ &IoStatusBlock,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
+ FILE_SYNCHRONOUS_IO_NONALERT);
+ if (!NT_SUCCESS (Status))
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status);
- <span id="removedchars">return Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> DPRINT ("ZwOpenFile() failed (Status %lx)\n", Status)</span>;
+ return Status;
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- /* Get file attributes */
- Status = ZwQueryInformationFile (FileHandle,
- &IoStatusBlock,
- FileInformation,
- sizeof(FILE_NETWORK_OPEN_INFORMATION),
- FileNetworkOpenInformation);
- ZwClose (FileHandle);
- <span id="removedchars">if (!NT_SUCCESS (Status))</span>
</pre><pre class="diff" id="added">+ <span id="addedchars"> /* Get file attributes */</span>
+ Status = ZwQueryInformationFile(FileHandle,
+ &IoStatusBlock,
+ FileInformation,
+ sizeof(FILE_NETWORK_OPEN_INFORMATION),
+ FileNetworkOpenInformation);
+ if (!NT_SUCCESS (Status))
</pre><pre class="diff" id="context"> {
</pre><pre class="diff" id="removed">- DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
</pre><pre class="diff" id="added">+ <span id="addedchars"> </span>DPRINT ("ZwQueryInformationFile() failed (Status %lx)\n", Status);
</pre><pre class="diff" id="context"> }
</pre><pre class="diff" id="removed">- <span id="removedchars">return Status</span>;
</pre><pre class="diff" id="added">+ <span id="addedchars"> ZwClose (FileHandle)</span>;
+ return Status;
</pre><pre class="diff" id="context"> }
/*
</pre>
</div>
</body>
</html>