Hi,
I perform a Post Create in IRP_MJ_CREATE Dispatch routine using IoCreateFileSpecifyDeviceObjectHint function. After that i use ZwReadFile or MyOwnReadIrp to read some data from the file to analyze few things. It works fine on local drives but on network drives i get the error as STATUS_INVALID_HANDLE. Here is the create that i use.
IoCreateFileSpecifyDeviceObjectHint ( FileHandle, SYNCHRONIZE, &ObjAttributes, &IoStatusBlock, 0,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_VALID_FLAGS, FILE_OPEN,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_NO_INTEMEDIATE_BUFFERING, NULL, 0, CreateFileTypeNone, NULL, IO_IGNORE_SHARE_ACCESS_CHECK, ExtensionDeviceObject);
If i use this i cant read anything from the network (mapped) drives because i guess access mask is not correct. But i see all the other things working fine meaning i see all the IRPS posted (IRP_NOCACHE Writes and all).
To make it read data from network drive i tried to use the following variation of the function
IoCreateFileSpecifyDeviceObjectHint ( FileHandle, SYNCHRONIZE | FILE_READ_DATA, &ObjAttributes, &IoStatusBlock, 0,
FILE_ATTRIBUTE_NORMAL, FILE_SHARE_VALID_FLAGS, FILE_OPEN,
FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT | FILE_NO_INTEMEDIATE_BUFFERING, NULL, 0, CreateFileTypeNone, NULL, IO_IGNORE_SHARE_ACCESS_CHECK, ExtensionDeviceObject);
With addition of this flag i can read the data but i dont see any IRP_NOCACHE Writes. I dont know what is the real reason behind this issue (not seeing IRP_NOCACHE writes). Another thing is there a way to read data by not specifying FILE_READ_DATA as access mask.
Please if anyone can highlight what the problem is that will be of real help as this is a pressing issue. I cannot go ahead until CREATE gets solved u know.
Thanks
Suhail