ZwReadFile was using Write member of Irp union.

ZwReadFile now returns correct status

svn path=/trunk/; revision=35
This commit is contained in:
Rex Jolliff 1998-09-13 01:17:05 +00:00
parent ca01965c67
commit 153b0ad928

View file

@ -16,7 +16,7 @@
#include <internal/string.h> #include <internal/string.h>
#include <internal/objmgr.h> #include <internal/objmgr.h>
//#define NDEBUG #define NDEBUG
#include <internal/debug.h> #include <internal/debug.h>
#ifndef NDEBUG #ifndef NDEBUG
@ -87,24 +87,24 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
StackPtr->Control = 0; StackPtr->Control = 0;
StackPtr->DeviceObject = FileObject->DeviceObject; StackPtr->DeviceObject = FileObject->DeviceObject;
StackPtr->FileObject = FileObject; StackPtr->FileObject = FileObject;
StackPtr->Parameters.Write.Length = Length; StackPtr->Parameters.Read.Length = Length;
if (ByteOffset!=NULL) if (ByteOffset!=NULL)
{ {
StackPtr->Parameters.Write.ByteOffset.LowPart = ByteOffset->LowPart; StackPtr->Parameters.Read.ByteOffset.LowPart = ByteOffset->LowPart;
StackPtr->Parameters.Write.ByteOffset.HighPart = ByteOffset->HighPart; StackPtr->Parameters.Read.ByteOffset.HighPart = ByteOffset->HighPart;
} }
else else
{ {
StackPtr->Parameters.Write.ByteOffset.LowPart = 0; StackPtr->Parameters.Read.ByteOffset.LowPart = 0;
StackPtr->Parameters.Write.ByteOffset.HighPart = 0; StackPtr->Parameters.Read.ByteOffset.HighPart = 0;
} }
if (Key!=NULL) if (Key!=NULL)
{ {
StackPtr->Parameters.Write.Key = *Key; StackPtr->Parameters.Read.Key = *Key;
} }
else else
{ {
StackPtr->Parameters.Write.Key = 0; StackPtr->Parameters.Read.Key = 0;
} }
DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject); DPRINT("FileObject->DeviceObject %x\n",FileObject->DeviceObject);
@ -112,9 +112,13 @@ NTSTATUS ZwReadFile(HANDLE FileHandle,
if (NT_SUCCESS(Status)) if (NT_SUCCESS(Status))
{ {
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL); KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
if (FileObject->DeviceObject->Flags&DO_BUFFERED_IO) Status = Irp->IoStatus.Status;
if (NT_SUCCESS(Status))
{ {
memcpy(Buffer,Irp->AssociatedIrp.SystemBuffer,Length); if (FileObject->DeviceObject->Flags&DO_BUFFERED_IO)
{
memcpy(Buffer,Irp->AssociatedIrp.SystemBuffer,Length);
}
} }
} }
return(Status); return(Status);