In my filter driver, when I process IRP_MJ_CLEANUP, I call
IRP_MJ_QUERY_INFORMATION/FileStandardInformation.
If the fileobject is local (c:\test.txt), IRP_MJ_QUERY_INFORMATION works
fine, IoCallDriver() returns STATUS_SUCCESS.
If the fileobject is remote (\server\test.txt),
IRP_MJ_QUERY_INFORMATION fails on IoCallDriver()/KeWaitForSingleObject()
In this case, IoCallDriver() returns STATUS_PENDING, the Completion
routine is not called and KeWaitForSingleObject() never returns !
I have tried to remplace FileStandardInformation by FileNameInformation
In this case, all works fine. Even if the fileobject is remote, I can
get information correctly
Just for testing, I call my routine from IRP_MJ_CREATE/FILE_OPEN. In
this case all works fine.
In this thread, http://www.osronline.com/showThread.cfm?link=7511, there
are several suggestions:
* adding irp->Flags = IRP_NOCACHE;
there is no amelioration
* forcing FO_SYNCHRONOUS_IO on pFileObject->Flags
A very bad idea in this case. Now, IoCallDriver() returns
STATUS_OBJECT_NAME_NOT_FOUND !
Why IRP_MJ_QUERY_INFORMATION/FileNameInformation works fine and
IRP_MJ_QUERY_INFORMATION/FileStandardInformation
failed on remote file ?
IRP_MJ_CLEANUP can’t handle
IRP_MJ_QUERY_INFORMATION/FileStandardInformation for remote file?
Regards,
my code is as follows:
NTSTATUS MyCompletionRoutine(PDEVICE_OBJECT DeviceObject, PIRP Irp,
PVOID Context)
{
KdPrint((“MyCompletionRoutine()\n”));
*Irp->UserIosb = Irp->IoStatus;
KeSetEvent(Irp->UserEvent, 0, FALSE);
IoFreeIrp(Irp);
return STATUS_MORE_PROCESSING_REQUIRED;
}
NTSTATUS MyFileStandardInformation(PDEVICE_OBJECT DeviceObject,
PFILE_OBJECT FileObject)
{
PIRP irp;
KEVENT event;
IO_STATUS_BLOCK IoStatusBlock;
PIO_STACK_LOCATION ioStackLocation;
FILE_STANDARD_INFORMATION Buffer;
NTSTATUS status;
KeInitializeEvent(&event, SynchronizationEvent, FALSE);
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
irp->AssociatedIrp.SystemBuffer = &Buffer;
irp->UserEvent = &event;
IoStatusBlock.Status = STATUS_SUCCESS;
irp->UserIosb = &IoStatusBlock;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->RequestorMode = KernelMode;
irp->Flags = 0;
ioStackLocation = IoGetNextIrpStackLocation(irp);
ioStackLocation->MajorFunction = IRP_MJ_QUERY_INFORMATION;
ioStackLocation->DeviceObject = DeviceObject;
ioStackLocation->FileObject = FileObject;
ioStackLocation->Parameters.QueryFile.Length =
sizeof(FILE_STANDARD_INFORMATION);
ioStackLocation->Parameters.QueryFile.FileInformationClass =
FileStandardInformation;
IoSetCompletionRoutine(irp, MyCompletionRoutine, 0, TRUE, TRUE, TRUE);
status = IoCallDriver(DeviceObject, irp);
KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0);
return IoStatusBlock.Status;
}