mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Added some modifications for asyncronous i/o requests (for vfatfs).
svn path=/trunk/; revision=2343
This commit is contained in:
parent
ab19671382
commit
2723d14c06
8 changed files with 137 additions and 57 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: create.c,v 1.49 2001/11/02 09:17:52 ekohl Exp $
|
/* $Id: create.c,v 1.50 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -315,6 +315,7 @@ IoCreateFile(
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PIO_STACK_LOCATION StackLoc;
|
PIO_STACK_LOCATION StackLoc;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, "
|
DPRINT("IoCreateFile(FileHandle %x, DesiredAccess %x, "
|
||||||
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
|
"ObjectAttributes %x ObjectAttributes->ObjectName->Buffer %S)\n",
|
||||||
|
@ -360,9 +361,11 @@ IoCreateFile(
|
||||||
return (STATUS_UNSUCCESSFUL);
|
return (STATUS_UNSUCCESSFUL);
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->UserIosb = IoStatusBlock; //return iostatus
|
Irp->UserIosb = &IoSB; //return iostatus
|
||||||
Irp->AssociatedIrp.SystemBuffer = EaBuffer;
|
Irp->AssociatedIrp.SystemBuffer = EaBuffer;
|
||||||
Irp->Tail.Overlay.AuxiliaryBuffer = (PCHAR)ExtraCreateParameters;
|
Irp->Tail.Overlay.AuxiliaryBuffer = (PCHAR)ExtraCreateParameters;
|
||||||
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
Irp->UserEvent = &Event;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Get the stack location for the new
|
* Get the stack location for the new
|
||||||
|
@ -407,14 +410,17 @@ IoCreateFile(
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = IoStatusBlock->Status;
|
Status = IoSB.Status;
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT("Failing create request with status %x\n", Status);
|
DPRINT("Failing create request with status %x\n", Status);
|
||||||
ZwClose(*FileHandle);
|
ZwClose(*FileHandle);
|
||||||
}
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
|
}
|
||||||
assert_irql(PASSIVE_LEVEL);
|
assert_irql(PASSIVE_LEVEL);
|
||||||
|
|
||||||
DPRINT("Finished IoCreateFile() (*FileHandle) %x\n", (*FileHandle));
|
DPRINT("Finished IoCreateFile() (*FileHandle) %x\n", (*FileHandle));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: dir.c,v 1.10 2000/03/26 19:38:22 ea Exp $
|
/* $Id: dir.c,v 1.11 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -87,6 +87,7 @@ NtQueryDirectoryFile(
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PIO_STACK_LOCATION IoStack;
|
PIO_STACK_LOCATION IoStack;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("NtQueryDirectoryFile()\n");
|
DPRINT("NtQueryDirectoryFile()\n");
|
||||||
|
|
||||||
|
@ -113,7 +114,7 @@ NtQueryDirectoryFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = &IoSB;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
Irp->UserBuffer=FileInformation;
|
Irp->UserBuffer=FileInformation;
|
||||||
|
|
||||||
|
@ -155,7 +156,11 @@ NtQueryDirectoryFile(
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||||
}
|
}
|
||||||
Status = IoStatusBlock->Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: file.c,v 1.14 2001/06/12 12:30:36 ekohl Exp $
|
/* $Id: file.c,v 1.15 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -40,6 +40,7 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PVOID SystemBuffer;
|
PVOID SystemBuffer;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
assert(IoStatusBlock != NULL);
|
assert(IoStatusBlock != NULL);
|
||||||
assert(FileInformation != NULL);
|
assert(FileInformation != NULL);
|
||||||
|
@ -87,7 +88,7 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||||
}
|
}
|
||||||
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = &IoSB;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
|
@ -104,14 +105,18 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||||
|
|
||||||
Status = IoCallDriver(FileObject->DeviceObject,
|
Status = IoCallDriver(FileObject->DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status==STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,
|
KeWaitForSingleObject(&Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -187,14 +192,14 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
|
||||||
|
|
||||||
Status = IoCallDriver(FileObject->DeviceObject,
|
Status = IoCallDriver(FileObject->DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status==STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,
|
KeWaitForSingleObject(&Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = IoStatusBlock.Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ReturnedLength != NULL)
|
if (ReturnedLength != NULL)
|
||||||
|
@ -222,6 +227,7 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PVOID SystemBuffer;
|
PVOID SystemBuffer;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
assert(IoStatusBlock != NULL)
|
assert(IoStatusBlock != NULL)
|
||||||
assert(FileInformation != NULL)
|
assert(FileInformation != NULL)
|
||||||
|
@ -280,7 +286,7 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||||
Length);
|
Length);
|
||||||
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = &IoSB;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
|
@ -302,16 +308,19 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||||
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
||||||
Status = IoCallDriver(FileObject->DeviceObject,
|
Status = IoCallDriver(FileObject->DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
if (Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,
|
KeWaitForSingleObject(&Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(SystemBuffer);
|
ExFreePool(SystemBuffer);
|
||||||
ObDereferenceObject(FileObject);
|
ObDereferenceObject(FileObject);
|
||||||
|
|
||||||
|
|
|
@ -49,6 +49,7 @@ NtFlushBuffersFile (
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(FileHandle,
|
Status = ObReferenceObjectByHandle(FileHandle,
|
||||||
FILE_WRITE_DATA,
|
FILE_WRITE_DATA,
|
||||||
|
@ -68,7 +69,7 @@ NtFlushBuffersFile (
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
&Event,
|
&Event,
|
||||||
IoStatusBlock);
|
&IoSB);
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->FileObject = FileObject;
|
StackPtr->FileObject = FileObject;
|
||||||
|
@ -77,7 +78,11 @@ NtFlushBuffersFile (
|
||||||
if (Status==STATUS_PENDING)
|
if (Status==STATUS_PENDING)
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: fs.c,v 1.18 2001/07/15 15:36:31 ekohl Exp $
|
/* $Id: fs.c,v 1.19 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -56,6 +56,7 @@ NtFsControlFile (
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT KEvent;
|
KEVENT KEvent;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("NtFsControlFile(DeviceHandle %x EventHandle %x ApcRoutine %x "
|
DPRINT("NtFsControlFile(DeviceHandle %x EventHandle %x ApcRoutine %x "
|
||||||
"ApcContext %x IoStatusBlock %x IoControlCode %x "
|
"ApcContext %x IoStatusBlock %x IoControlCode %x "
|
||||||
|
@ -89,7 +90,7 @@ NtFsControlFile (
|
||||||
OutputBufferSize,
|
OutputBufferSize,
|
||||||
FALSE,
|
FALSE,
|
||||||
&KEvent,
|
&KEvent,
|
||||||
IoStatusBlock);
|
&IoSB);
|
||||||
|
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||||
|
@ -103,10 +104,14 @@ NtFsControlFile (
|
||||||
StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
|
StackPtr->MajorFunction = IRP_MJ_FILE_SYSTEM_CONTROL;
|
||||||
|
|
||||||
Status = IoCallDriver(DeviceObject,Irp);
|
Status = IoCallDriver(DeviceObject,Irp);
|
||||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
if (Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
|
||||||
return(IoStatusBlock->Status);
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ioctrl.c,v 1.12 2001/03/21 23:27:18 chorns Exp $
|
/* $Id: ioctrl.c,v 1.13 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -39,6 +39,8 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
|
||||||
PIRP Irp;
|
PIRP Irp;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT KEvent;
|
KEVENT KEvent;
|
||||||
|
PKEVENT ptrEvent;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("NtDeviceIoControlFile(DeviceHandle %x Event %x UserApcRoutine %x "
|
DPRINT("NtDeviceIoControlFile(DeviceHandle %x Event %x UserApcRoutine %x "
|
||||||
"UserApcContext %x IoStatusBlock %x IoControlCode %x "
|
"UserApcContext %x IoStatusBlock %x IoControlCode %x "
|
||||||
|
@ -59,6 +61,31 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
|
||||||
{
|
{
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
if (Event != NULL)
|
||||||
|
{
|
||||||
|
Status = ObReferenceObjectByHandle (Event,
|
||||||
|
SYNCHRONIZE,
|
||||||
|
ExEventObjectType,
|
||||||
|
UserMode,
|
||||||
|
(PVOID*)&ptrEvent,
|
||||||
|
NULL);
|
||||||
|
if (!NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
ObDereferenceObject(FileObject);
|
||||||
|
return Status;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||||
|
{
|
||||||
|
ptrEvent = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
KeInitializeEvent (&KEvent,
|
||||||
|
NotificationEvent,
|
||||||
|
FALSE);
|
||||||
|
ptrEvent = &KEvent;
|
||||||
|
}
|
||||||
|
|
||||||
DeviceObject = FileObject->DeviceObject;
|
DeviceObject = FileObject->DeviceObject;
|
||||||
|
|
||||||
|
@ -71,8 +98,8 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
|
||||||
OutputBuffer,
|
OutputBuffer,
|
||||||
OutputBufferSize,
|
OutputBufferSize,
|
||||||
FALSE,
|
FALSE,
|
||||||
&KEvent,
|
ptrEvent,
|
||||||
IoStatusBlock);
|
Event ? IoStatusBlock : &IoSB);
|
||||||
|
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = UserApcRoutine;
|
Irp->Overlay.AsynchronousParameters.UserApcRoutine = UserApcRoutine;
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcContext = UserApcContext;
|
Irp->Overlay.AsynchronousParameters.UserApcContext = UserApcContext;
|
||||||
|
@ -84,10 +111,14 @@ NTSTATUS STDCALL NtDeviceIoControlFile (IN HANDLE DeviceHandle,
|
||||||
StackPtr->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferSize;
|
StackPtr->Parameters.DeviceIoControl.OutputBufferLength = OutputBufferSize;
|
||||||
|
|
||||||
Status = IoCallDriver(DeviceObject,Irp);
|
Status = IoCallDriver(DeviceObject,Irp);
|
||||||
if (Status == STATUS_PENDING && (FileObject->Flags & FO_SYNCHRONOUS_IO))
|
if (Event == NULL && Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
|
KeWaitForSingleObject(&KEvent,Executive,KernelMode,FALSE,NULL);
|
||||||
return(IoStatusBlock->Status);
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: rw.c,v 1.33 2000/10/22 16:36:50 ekohl Exp $
|
/* $Id: rw.c,v 1.34 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -54,6 +54,7 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
PKEVENT ptrEvent = NULL;
|
PKEVENT ptrEvent = NULL;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
||||||
"IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset,
|
"IoStatusBlock %x)\n", FileHandle, Buffer, Length, ByteOffset,
|
||||||
|
@ -91,16 +92,16 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||||
|
{
|
||||||
|
ptrEvent = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
KeInitializeEvent(&Event,
|
KeInitializeEvent(&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
ptrEvent = &Event;
|
ptrEvent = &Event;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ptrEvent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||||
FileObject->DeviceObject,
|
FileObject->DeviceObject,
|
||||||
|
@ -108,7 +109,7 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||||
Length,
|
Length,
|
||||||
ByteOffset,
|
ByteOffset,
|
||||||
ptrEvent,
|
ptrEvent,
|
||||||
IoStatusBlock);
|
EventHandle ? IoStatusBlock : &IoSB);
|
||||||
|
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||||
|
@ -126,8 +127,8 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||||
|
|
||||||
Status = IoCallDriver(FileObject->DeviceObject,
|
Status = IoCallDriver(FileObject->DeviceObject,
|
||||||
Irp);
|
Irp);
|
||||||
if ((Status == STATUS_PENDING) &&
|
if (EventHandle == NULL && Status == STATUS_PENDING &&
|
||||||
(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
!(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
BOOLEAN Alertable;
|
BOOLEAN Alertable;
|
||||||
|
|
||||||
|
@ -145,9 +146,12 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
Alertable,
|
Alertable,
|
||||||
NULL);
|
NULL);
|
||||||
Status = IoStatusBlock->Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock && EventHandle == NULL)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (Status);
|
return (Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,6 +185,7 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
KEVENT Event;
|
KEVENT Event;
|
||||||
PKEVENT ptrEvent;
|
PKEVENT ptrEvent;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
DPRINT("NtWriteFile(FileHandle %x, Buffer %x, Length %d)\n",
|
DPRINT("NtWriteFile(FileHandle %x, Buffer %x, Length %d)\n",
|
||||||
FileHandle, Buffer, Length);
|
FileHandle, Buffer, Length);
|
||||||
|
@ -216,27 +221,24 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||||
|
{
|
||||||
|
ptrEvent = NULL;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
KeInitializeEvent(&Event,
|
KeInitializeEvent(&Event,
|
||||||
NotificationEvent,
|
NotificationEvent,
|
||||||
FALSE);
|
FALSE);
|
||||||
ptrEvent = &Event;
|
ptrEvent = &Event;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
ptrEvent = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
KeInitializeEvent(&Event,
|
|
||||||
NotificationEvent,
|
|
||||||
FALSE);
|
|
||||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
||||||
FileObject->DeviceObject,
|
FileObject->DeviceObject,
|
||||||
Buffer,
|
Buffer,
|
||||||
Length,
|
Length,
|
||||||
ByteOffset,
|
ByteOffset,
|
||||||
ptrEvent,
|
ptrEvent,
|
||||||
IoStatusBlock);
|
EventHandle ? IoStatusBlock : &IoSB);
|
||||||
|
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
Irp->Overlay.AsynchronousParameters.UserApcRoutine = ApcRoutine;
|
||||||
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
Irp->Overlay.AsynchronousParameters.UserApcContext = ApcContext;
|
||||||
|
@ -254,15 +256,19 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||||
StackPtr->Parameters.Write.Key = 0;
|
StackPtr->Parameters.Write.Key = 0;
|
||||||
}
|
}
|
||||||
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
Status = IoCallDriver(FileObject->DeviceObject, Irp);
|
||||||
if ((Status == STATUS_PENDING) &&
|
if (EventHandle == NULL && Status == STATUS_PENDING &&
|
||||||
(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
!(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||||
{
|
{
|
||||||
KeWaitForSingleObject(&Event,
|
KeWaitForSingleObject(&Event,
|
||||||
Executive,
|
Executive,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = Irp->IoStatus.Status;
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock && EventHandle == NULL)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
return(Status);
|
return(Status);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: vpb.c,v 1.13 2001/06/12 12:30:36 ekohl Exp $
|
/* $Id: vpb.c,v 1.14 2001/11/02 22:22:33 hbirr Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -102,6 +102,7 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
PVOID SystemBuffer;
|
PVOID SystemBuffer;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
assert(IoStatusBlock != NULL);
|
assert(IoStatusBlock != NULL);
|
||||||
assert(FsInformation != NULL);
|
assert(FsInformation != NULL);
|
||||||
|
@ -145,7 +146,8 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = &IoSB;
|
||||||
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
|
StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
|
||||||
|
@ -167,7 +169,7 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
Status = IoStatusBlock->Status;
|
Status = IoSB.Status;
|
||||||
}
|
}
|
||||||
DPRINT("Status %x\n", Status);
|
DPRINT("Status %x\n", Status);
|
||||||
|
|
||||||
|
@ -176,7 +178,11 @@ NtQueryVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
DPRINT("Information %lu\n", IoStatusBlock->Information);
|
DPRINT("Information %lu\n", IoStatusBlock->Information);
|
||||||
MmSafeCopyToUser(FsInformation,
|
MmSafeCopyToUser(FsInformation,
|
||||||
SystemBuffer,
|
SystemBuffer,
|
||||||
IoStatusBlock->Information);
|
IoSB.Information);
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
ExFreePool(SystemBuffer);
|
ExFreePool(SystemBuffer);
|
||||||
ObDereferenceObject(FileObject);
|
ObDereferenceObject(FileObject);
|
||||||
|
@ -229,6 +235,7 @@ IoQueryVolumeInformation(IN PFILE_OBJECT FileObject,
|
||||||
Irp->AssociatedIrp.SystemBuffer = FsInformation;
|
Irp->AssociatedIrp.SystemBuffer = FsInformation;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
Irp->UserIosb = &IoStatusBlock;
|
Irp->UserIosb = &IoStatusBlock;
|
||||||
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
|
StackPtr->MajorFunction = IRP_MJ_QUERY_VOLUME_INFORMATION;
|
||||||
|
@ -278,6 +285,7 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PIO_STACK_LOCATION StackPtr;
|
PIO_STACK_LOCATION StackPtr;
|
||||||
PVOID SystemBuffer;
|
PVOID SystemBuffer;
|
||||||
|
IO_STATUS_BLOCK IoSB;
|
||||||
|
|
||||||
Status = ObReferenceObjectByHandle(FileHandle,
|
Status = ObReferenceObjectByHandle(FileHandle,
|
||||||
FILE_WRITE_ATTRIBUTES,
|
FILE_WRITE_ATTRIBUTES,
|
||||||
|
@ -319,7 +327,8 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
|
|
||||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||||
Irp->UserEvent = &Event;
|
Irp->UserEvent = &Event;
|
||||||
Irp->UserIosb = IoStatusBlock;
|
Irp->UserIosb = &IoSB;
|
||||||
|
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||||
|
|
||||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||||
StackPtr->MajorFunction = IRP_MJ_SET_VOLUME_INFORMATION;
|
StackPtr->MajorFunction = IRP_MJ_SET_VOLUME_INFORMATION;
|
||||||
|
@ -340,8 +349,12 @@ NtSetVolumeInformationFile(IN HANDLE FileHandle,
|
||||||
KernelMode,
|
KernelMode,
|
||||||
FALSE,
|
FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
Status = IoSB.Status;
|
||||||
|
}
|
||||||
|
if (IoStatusBlock)
|
||||||
|
{
|
||||||
|
*IoStatusBlock = IoSB;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExFreePool(SystemBuffer);
|
ExFreePool(SystemBuffer);
|
||||||
|
|
||||||
return(Status);
|
return(Status);
|
||||||
|
|
Loading…
Reference in a new issue