STATUS_FILE_CLOSED Error

when i try to write data to file from the buffer i’m getting STATUS_FILE_CLOSED Error

ioStackLocation->Parameters.Write.Length = Length;
ioStackLocation->Parameters.Write.ByteOffset = Offset;
ioStackLocation->Parameters.Write.Key = TapeSign;
ioStackLocation->MajorFunction = IRP_MJ_WRITE;
ioStackLocation->MinorFunction = 0;

DDbgPrint((“TapeDataTxfer: LENGTH %d\n”, Length));
//FileObject->Flags |= FO_NO_INTERMEDIATE_BUFFERING;
//irp->Flags &= (~IRP_NOCACHE);
}
else{
DDbgPrint((“TapeDataTxfer: UNKNOWN OPERATION READ/WRITE WAS EXPECTED \n”));
IoFreeIrp(irp);
IoStatusBlock->Status = STATUS_UNSUCCESSFUL;
return;
}

ioStackLocation->FileObject = FileObject;
//ioStackLocation->MinorFunction = 0;

//
// We use a completion routine to keep the I/O Manager from doing
// “cleanup” on our IRP - like freeing our MDL.
//

IoSetCompletionRoutine( irp,
TapeReadWriteCompletion,//SmGeneralIoCompletion ,
FileObject,
TRUE,
TRUE,
TRUE);

//
// Send it on. Ignore the return code.

//

DDbgPrint((“TapeDataTxfer:File Object %x\n”, FileObject));

DDbgPrint((“TapeDataTxfer: Calling NTFSD\n”));

status = IoCallDriver(fsdDevice, irp);

> when i try to write data to file from the buffer i’m getting STATUS_FILE_CLOSED Error

Maybe because the file is closed
and no one can perform an I/O on closed file ?

L.

This occurs if you send IO to the file object for which CLEANUP was already
executed.
Only paging IO can occur on such file objects.


Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

wrote in message news:xxxxx@ntfsd…
> when i try to write data to file from the buffer i’m getting
STATUS_FILE_CLOSED Error
>
> ioStackLocation->Parameters.Write.Length = Length;
> ioStackLocation->Parameters.Write.ByteOffset = Offset;
> ioStackLocation->Parameters.Write.Key = TapeSign;
> ioStackLocation->MajorFunction = IRP_MJ_WRITE;
> ioStackLocation->MinorFunction = 0;
>
> DDbgPrint((“TapeDataTxfer: LENGTH %d\n”, Length));
> //FileObject->Flags |= FO_NO_INTERMEDIATE_BUFFERING;
> //irp->Flags &= (~IRP_NOCACHE);
> }
> else{
> DDbgPrint((“TapeDataTxfer: UNKNOWN OPERATION READ/WRITE WAS EXPECTED \n”));
> IoFreeIrp(irp);
> IoStatusBlock->Status = STATUS_UNSUCCESSFUL;
> return;
> }
>
> ioStackLocation->FileObject = FileObject;
> //ioStackLocation->MinorFunction = 0;
>
> //
> // We use a completion routine to keep the I/O Manager from doing
> // “cleanup” on our IRP - like freeing our MDL.
> //
>
>
>
> IoSetCompletionRoutine( irp,
> TapeReadWriteCompletion,//SmGeneralIoCompletion ,
> FileObject,
> TRUE,
> TRUE,
> TRUE);
>
> //
> // Send it on. Ignore the return code.
>
>
> //
>
> DDbgPrint((“TapeDataTxfer:File Object %x\n”, FileObject));
>
> DDbgPrint((“TapeDataTxfer: Calling NTFSD\n”));
>
>
> status = IoCallDriver(fsdDevice, irp);
>