mirror of
https://github.com/ApfelTeeSaft/reactos.git
synced 2026-09-02 04:13:34 +00:00
Reworked quite a bit of IO manager code to fix several bugs:
1) fixed create.c to use a null file name when opening the raw device, instead of a file name with a single null terminator char 2) fixed cleanup.c create.c dir.c file.c fs.c page.c rw.c to use the KEVENT object in the FILE_OBJECT when it needs one to wait on, or if there is no FILE_OBJECT, the KEVENT MUST be allocated from non paged pool, NOT the stack. svn path=/trunk/; revision=2832
This commit is contained in:
@@ -50,6 +50,7 @@ IopCompleteRequest1(struct _KAPC* Apc,
|
||||
if (Irp->UserEvent!=NULL)
|
||||
{
|
||||
KeSetEvent(Irp->UserEvent,PriorityBoost,FALSE);
|
||||
ObDereferenceObject( Irp->UserEvent );
|
||||
}
|
||||
|
||||
FileObject = IoStack->FileObject;
|
||||
@@ -175,7 +176,8 @@ VOID IoSecondStageCompletion(PIRP Irp, CCHAR PriorityBoost)
|
||||
Irp, PriorityBoost);
|
||||
|
||||
IoStack = &Irp->Stack[(ULONG)Irp->CurrentLocation];
|
||||
|
||||
FileObject = IoStack->FileObject;
|
||||
|
||||
DeviceObject = IoStack->DeviceObject;
|
||||
|
||||
switch (IoStack->MajorFunction)
|
||||
@@ -241,10 +243,11 @@ VOID IoSecondStageCompletion(PIRP Irp, CCHAR PriorityBoost)
|
||||
if (Irp->UserEvent!=NULL)
|
||||
{
|
||||
KeSetEvent(Irp->UserEvent,PriorityBoost,FALSE);
|
||||
// if the event is not the one in the file object, it needs dereferenced
|
||||
if( FileObject && Irp->UserEvent != &FileObject->Event )
|
||||
ObDereferenceObject( Irp->UserEvent );
|
||||
}
|
||||
|
||||
FileObject = IoStack->FileObject;
|
||||
|
||||
if (FileObject != NULL && IoStack->MajorFunction != IRP_MJ_CLOSE)
|
||||
{
|
||||
//ObDereferenceObject(FileObject);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: create.c,v 1.54 2002/04/01 22:18:01 hbirr Exp $
|
||||
/* $Id: create.c,v 1.55 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -106,15 +106,8 @@ IopCreateFile(PVOID ObjectBody,
|
||||
if (NULL == RemainingPath)
|
||||
{
|
||||
FileObject->Flags = FileObject->Flags | FO_DIRECT_DEVICE_OPEN;
|
||||
FileObject->FileName.Buffer =
|
||||
ExAllocatePoolWithTag(NonPagedPool,
|
||||
(ObjectAttributes->ObjectName->Length+1)*sizeof(WCHAR),
|
||||
TAG_FILE_NAME);
|
||||
FileObject->FileName.Length = ObjectAttributes->ObjectName->Length;
|
||||
FileObject->FileName.MaximumLength =
|
||||
ObjectAttributes->ObjectName->MaximumLength;
|
||||
RtlCopyUnicodeString(&(FileObject->FileName),
|
||||
ObjectAttributes->ObjectName);
|
||||
FileObject->FileName.Buffer = 0;
|
||||
FileObject->FileName.Length = FileObject->FileName.MaximumLength = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -218,6 +211,9 @@ IoCreateStreamFileObject(PFILE_OBJECT FileObject,
|
||||
CreatedFileObject->Vpb = DeviceObject->Vpb;
|
||||
CreatedFileObject->Type = InternalFileType;
|
||||
CreatedFileObject->Flags |= FO_DIRECT_DEVICE_OPEN;
|
||||
|
||||
// shouldn't we initialize the lock event, and several other things here too?
|
||||
KeInitializeEvent( &CreatedFileObject->Event, NotificationEvent, FALSE );
|
||||
|
||||
ZwClose (FileHandle);
|
||||
|
||||
@@ -312,7 +308,6 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
PIO_STACK_LOCATION StackLoc;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
IO_SECURITY_CONTEXT SecurityContext;
|
||||
@@ -354,7 +349,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||
SecurityContext.FullCreateOptions = 0; /* ?? */
|
||||
|
||||
KeInitializeEvent(&FileObject->Lock, NotificationEvent, TRUE);
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
KeInitializeEvent(&FileObject->Event, NotificationEvent, FALSE);
|
||||
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
DPRINT("FileObject->DeviceObject %x\n", FileObject->DeviceObject);
|
||||
@@ -374,7 +369,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||
Irp->AssociatedIrp.SystemBuffer = EaBuffer;
|
||||
Irp->Tail.Overlay.AuxiliaryBuffer = (PCHAR)ExtraCreateParameters;
|
||||
Irp->Tail.Overlay.Thread = PsGetCurrentThread();
|
||||
Irp->UserEvent = &Event;
|
||||
Irp->UserEvent = &FileObject->Event;
|
||||
|
||||
/*
|
||||
* Get the stack location for the new
|
||||
@@ -418,7 +413,7 @@ IoCreateFile(OUT PHANDLE FileHandle,
|
||||
|
||||
if (Status == STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&Event,
|
||||
KeWaitForSingleObject(&FileObject->Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: dir.c,v 1.11 2001/11/02 22:22:33 hbirr Exp $
|
||||
/* $Id: dir.c,v 1.12 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -85,7 +85,6 @@ NtQueryDirectoryFile(
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PFILE_OBJECT FileObject;
|
||||
NTSTATUS Status;
|
||||
KEVENT Event;
|
||||
PIO_STACK_LOCATION IoStack;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
|
||||
@@ -103,7 +102,6 @@ NtQueryDirectoryFile(
|
||||
ObDereferenceObject(FileObject);
|
||||
return(Status);
|
||||
}
|
||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||
DeviceObject = FileObject->DeviceObject;
|
||||
|
||||
Irp = IoAllocateIrp(DeviceObject->StackSize, TRUE);
|
||||
@@ -115,7 +113,8 @@ NtQueryDirectoryFile(
|
||||
|
||||
|
||||
Irp->UserIosb = &IoSB;
|
||||
Irp->UserEvent = &Event;
|
||||
Irp->UserEvent = &FileObject->Event;
|
||||
KeResetEvent( &FileObject->Event );
|
||||
Irp->UserBuffer=FileInformation;
|
||||
|
||||
IoStack = IoGetNextIrpStackLocation(Irp);
|
||||
@@ -150,11 +149,11 @@ NtQueryDirectoryFile(
|
||||
{
|
||||
if (FileObject->Flags & FO_ALERTABLE_IO)
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,TRUE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,TRUE,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
|
||||
}
|
||||
Status = IoSB.Status;
|
||||
}
|
||||
|
||||
+10
-24
@@ -1,4 +1,4 @@
|
||||
/* $Id: file.c,v 1.15 2001/11/02 22:22:33 hbirr Exp $
|
||||
/* $Id: file.c,v 1.16 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -38,7 +38,6 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||
PIRP Irp;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
PVOID SystemBuffer;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
|
||||
@@ -64,9 +63,6 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||
}
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
DeviceObject = FileObject->DeviceObject;
|
||||
|
||||
Irp = IoAllocateIrp(DeviceObject->StackSize,
|
||||
@@ -89,7 +85,8 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||
|
||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||
Irp->UserIosb = &IoSB;
|
||||
Irp->UserEvent = &Event;
|
||||
Irp->UserEvent = &FileObject->Event;
|
||||
KeResetEvent( &FileObject->Event );
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION;
|
||||
@@ -107,7 +104,7 @@ NtQueryInformationFile(HANDLE FileHandle,
|
||||
Irp);
|
||||
if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,
|
||||
KeWaitForSingleObject(&FileObject->Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
@@ -145,7 +142,6 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
|
||||
PIRP Irp;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
|
||||
assert(FileInformation != NULL)
|
||||
@@ -161,9 +157,6 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
|
||||
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
DeviceObject = FileObject->DeviceObject;
|
||||
|
||||
Irp = IoAllocateIrp(DeviceObject->StackSize,
|
||||
@@ -176,7 +169,8 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
|
||||
|
||||
Irp->AssociatedIrp.SystemBuffer = FileInformation;
|
||||
Irp->UserIosb = &IoStatusBlock;
|
||||
Irp->UserEvent = &Event;
|
||||
Irp->UserEvent = &FileObject->Event;
|
||||
KeResetEvent( &FileObject->Event );
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->MajorFunction = IRP_MJ_QUERY_INFORMATION;
|
||||
@@ -194,7 +188,7 @@ IoQueryFileInformation(IN PFILE_OBJECT FileObject,
|
||||
Irp);
|
||||
if (Status==STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,
|
||||
KeWaitForSingleObject(&FileObject->Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
@@ -224,7 +218,6 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||
PFILE_OBJECT FileObject;
|
||||
PDEVICE_OBJECT DeviceObject;
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
NTSTATUS Status;
|
||||
PVOID SystemBuffer;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
@@ -253,14 +246,6 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||
|
||||
DPRINT("FileObject %x\n", FileObject);
|
||||
|
||||
/*
|
||||
* Initialize an event object to wait
|
||||
* on for the request.
|
||||
*/
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
|
||||
DeviceObject = FileObject->DeviceObject;
|
||||
|
||||
Irp = IoAllocateIrp(DeviceObject->StackSize,
|
||||
@@ -287,7 +272,8 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||
|
||||
Irp->AssociatedIrp.SystemBuffer = SystemBuffer;
|
||||
Irp->UserIosb = &IoSB;
|
||||
Irp->UserEvent = &Event;
|
||||
Irp->UserEvent = &FileObject->Event;
|
||||
KeResetEvent( &FileObject->Event );
|
||||
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
StackPtr->MajorFunction = IRP_MJ_SET_INFORMATION;
|
||||
@@ -310,7 +296,7 @@ NtSetInformationFile(HANDLE FileHandle,
|
||||
Irp);
|
||||
if (Status == STATUS_PENDING && !(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,
|
||||
KeWaitForSingleObject(&FileObject->Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: fs.c,v 1.20 2001/12/05 12:14:13 ekohl Exp $
|
||||
/* $Id: fs.c,v 1.21 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -184,27 +184,30 @@ NTSTATUS IoAskFileSystemToMountDevice(PDEVICE_OBJECT DeviceObject,
|
||||
PDEVICE_OBJECT DeviceToMount)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
IO_STATUS_BLOCK IoStatusBlock;
|
||||
NTSTATUS Status;
|
||||
PKEVENT Event; // KEVENT must be allocated from non paged pool, not stack
|
||||
|
||||
DPRINT("IoAskFileSystemToMountDevice(DeviceObject %x, DeviceToMount %x)\n",
|
||||
DeviceObject,DeviceToMount);
|
||||
|
||||
assert_irql(PASSIVE_LEVEL);
|
||||
|
||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||
Event = ExAllocatePool( NonPagedPool, sizeof( KEVENT ) );
|
||||
if( Event == 0 )
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
KeInitializeEvent(Event,NotificationEvent,FALSE);
|
||||
Irp = IoBuildFilesystemControlRequest(IRP_MN_MOUNT_VOLUME,
|
||||
DeviceObject,
|
||||
&Event,
|
||||
Event,
|
||||
&IoStatusBlock,
|
||||
DeviceToMount);
|
||||
Status = IoCallDriver(DeviceObject,Irp);
|
||||
if (Status==STATUS_PENDING)
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
KeWaitForSingleObject(Event,Executive,KernelMode,FALSE,NULL);
|
||||
Status = IoStatusBlock.Status;
|
||||
}
|
||||
ExFreePool( Event );
|
||||
return(Status);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
/* $Id: page.c,v 1.14 2002/01/08 00:49:00 dwelch Exp $
|
||||
/* $Id: page.c,v 1.15 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -26,7 +26,6 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
|
||||
BOOLEAN PagingIo)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
NTSTATUS Status;
|
||||
|
||||
@@ -37,13 +36,12 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
IoFileObjectType,
|
||||
UserMode);
|
||||
|
||||
KeInitializeEvent(&Event,NotificationEvent,FALSE);
|
||||
KeResetEvent( &FileObject->Event );
|
||||
Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_WRITE,
|
||||
FileObject->DeviceObject,
|
||||
Mdl,
|
||||
Offset,
|
||||
&Event,
|
||||
&FileObject->Event,
|
||||
StatusBlock,
|
||||
PagingIo);
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
@@ -56,12 +54,12 @@ NTSTATUS STDCALL IoPageWrite(PFILE_OBJECT FileObject,
|
||||
DPRINT("Waiting for io operation\n");
|
||||
if (FileObject->Flags & FO_ALERTABLE_IO)
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,TRUE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,TRUE,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Non-alertable wait\n");
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
|
||||
}
|
||||
Status = StatusBlock->Status;
|
||||
}
|
||||
@@ -77,7 +75,6 @@ IoPageRead(PFILE_OBJECT FileObject,
|
||||
BOOLEAN PagingIo)
|
||||
{
|
||||
PIRP Irp;
|
||||
KEVENT Event;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
NTSTATUS Status;
|
||||
|
||||
@@ -88,13 +85,12 @@ IoPageRead(PFILE_OBJECT FileObject,
|
||||
STANDARD_RIGHTS_REQUIRED,
|
||||
IoFileObjectType,
|
||||
UserMode);
|
||||
|
||||
KeInitializeEvent(&Event, NotificationEvent, FALSE);
|
||||
KeResetEvent( &FileObject->Event );
|
||||
Irp = IoBuildSynchronousFsdRequestWithMdl(IRP_MJ_READ,
|
||||
FileObject->DeviceObject,
|
||||
Mdl,
|
||||
Offset,
|
||||
&Event,
|
||||
&FileObject->Event,
|
||||
StatusBlock,
|
||||
PagingIo);
|
||||
StackPtr = IoGetNextIrpStackLocation(Irp);
|
||||
@@ -107,12 +103,12 @@ IoPageRead(PFILE_OBJECT FileObject,
|
||||
DPRINT("Waiting for io operation\n");
|
||||
if (FileObject->Flags & FO_ALERTABLE_IO)
|
||||
{
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,TRUE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,TRUE,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
DPRINT("Non-alertable wait\n");
|
||||
KeWaitForSingleObject(&Event,Executive,KernelMode,FALSE,NULL);
|
||||
KeWaitForSingleObject(&FileObject->Event,Executive,KernelMode,FALSE,NULL);
|
||||
}
|
||||
Status = StatusBlock->Status;
|
||||
}
|
||||
|
||||
+18
-34
@@ -1,4 +1,4 @@
|
||||
/* $Id: rw.c,v 1.34 2001/11/02 22:22:33 hbirr Exp $
|
||||
/* $Id: rw.c,v 1.35 2002/04/07 18:36:13 phreak Exp $
|
||||
*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
@@ -53,7 +53,6 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
PKEVENT ptrEvent = NULL;
|
||||
KEVENT Event;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
|
||||
DPRINT("NtReadFile(FileHandle %x Buffer %x Length %x ByteOffset %x, "
|
||||
@@ -66,12 +65,6 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||
UserMode,
|
||||
(PVOID*)&FileObject,
|
||||
NULL);
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT("NtReadFile() = %x\n",Status);
|
||||
return Status;
|
||||
}
|
||||
|
||||
if (ByteOffset == NULL)
|
||||
{
|
||||
ByteOffset = &FileObject->CurrentByteOffset;
|
||||
@@ -91,16 +84,10 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||
return Status;
|
||||
}
|
||||
}
|
||||
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
ptrEvent = NULL;
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
ptrEvent = &Event;
|
||||
ptrEvent = &FileObject->Event;
|
||||
KeResetEvent( ptrEvent );
|
||||
}
|
||||
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_READ,
|
||||
@@ -128,7 +115,7 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||
Status = IoCallDriver(FileObject->DeviceObject,
|
||||
Irp);
|
||||
if (EventHandle == NULL && Status == STATUS_PENDING &&
|
||||
!(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
BOOLEAN Alertable;
|
||||
|
||||
@@ -141,12 +128,16 @@ NTSTATUS STDCALL NtReadFile(HANDLE FileHandle,
|
||||
Alertable = FALSE;
|
||||
}
|
||||
|
||||
KeWaitForSingleObject(&Event,
|
||||
Executive,
|
||||
KernelMode,
|
||||
Alertable,
|
||||
NULL);
|
||||
Status = IoSB.Status;
|
||||
Status = KeWaitForSingleObject(ptrEvent,
|
||||
Executive,
|
||||
KernelMode,
|
||||
Alertable,
|
||||
NULL);
|
||||
if( !NT_SUCCESS( Status ) )
|
||||
{
|
||||
DPRINT1( "WaitForSingleObject failed: %x\n", Status );
|
||||
}
|
||||
else Status = IoSB.Status;
|
||||
}
|
||||
if (IoStatusBlock && EventHandle == NULL)
|
||||
{
|
||||
@@ -183,7 +174,6 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||
PFILE_OBJECT FileObject;
|
||||
PIRP Irp;
|
||||
PIO_STACK_LOCATION StackPtr;
|
||||
KEVENT Event;
|
||||
PKEVENT ptrEvent;
|
||||
IO_STATUS_BLOCK IoSB;
|
||||
|
||||
@@ -220,16 +210,10 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||
return(Status);
|
||||
}
|
||||
}
|
||||
else if (FileObject->Flags & FO_SYNCHRONOUS_IO)
|
||||
{
|
||||
ptrEvent = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
KeInitializeEvent(&Event,
|
||||
NotificationEvent,
|
||||
FALSE);
|
||||
ptrEvent = &Event;
|
||||
ptrEvent = &FileObject->Event;
|
||||
KeResetEvent( ptrEvent );
|
||||
}
|
||||
|
||||
Irp = IoBuildSynchronousFsdRequest(IRP_MJ_WRITE,
|
||||
@@ -259,7 +243,7 @@ NTSTATUS STDCALL NtWriteFile(HANDLE FileHandle,
|
||||
if (EventHandle == NULL && Status == STATUS_PENDING &&
|
||||
!(FileObject->Flags & FO_SYNCHRONOUS_IO))
|
||||
{
|
||||
KeWaitForSingleObject(&Event,
|
||||
KeWaitForSingleObject(ptrEvent,
|
||||
Executive,
|
||||
KernelMode,
|
||||
FALSE,
|
||||
|
||||
Reference in New Issue
Block a user