ALL,
I am writing a file system filter driver. During Pre create to get last write time of the file, I open the parent folder and get file information, instead of opening the file because it is more efficent when you have encryption software. For local file system like ntfs i am able to open foder and read file information, but on network share file, i can open the folder but when i try to query information about file i get STATUS_OBJECT_NAME_INVALID any suggestion???
// Allocate an irp for read request.
irp = IoAllocateIrp( pTargetDevice->StackSize + 2, FALSE );
if ( NULL == irp )
{
break;
}
// Build the IRP’s main body
irp->UserBuffer = DataBuffer;
irp->UserEvent = &event;
irp->UserIosb = &iosb;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->Tail.Overlay.OriginalFileObject = fileObject;
irp->RequestorMode = KernelMode;
irp->Flags = IRP_SYNCHRONOUS_API;
// Set up the I/O stack location.
ioStack = IoGetNextIrpStackLocation( irp );
ioStack->MajorFunction = IRP_MJ_DIRECTORY_CONTROL;
ioStack->MinorFunction = IRP_MN_QUERY_DIRECTORY;
ioStack->Parameters.QueryDirectory.Length = Length;
ioStack->Parameters.QueryDirectory.FileName = (PSTRING) FileName;
ioStack->Parameters.QueryDirectory.FileInformationClass = FileDirectoryInformation;
ioStack->Parameters.QueryDirectory.FileIndex = 0;
ioStack->FileObject = fileObject;
ioStack->DeviceObject = pTargetDevice;
ioStack->Flags = SL_RESTART_SCAN | SL_RETURN_SINGLE_ENTRY;
// Set the clenup completion routine.
IoSetCompletionRoutine( irp, _SetEventFreeIrp_CompletionRoutine, 0, TRUE, TRUE, TRUE);
// Send the read IRP to target
ntStatus = IoCallDriver(pTargetDevice, irp);
Thanks for help
ashish