Network Write (Help please)

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

What is ExtensionDeviceObject?
“Suhail Ansari” wrote in message
news:xxxxx@ntfsd…
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

ExtensionDeviceObject = /Device/LanmanRedirector DeviceObject

Suhail

From: “Lyndon J Clarke”
>Reply-To: “Windows File Systems Devs Interest List”
>To: “Windows File Systems Devs Interest List”
>Subject: Re:[ntfsd] Network Write (Help please)
>Date: Wed, 16 Mar 2005 23:27:03 -0000
>
>What is ExtensionDeviceObject?
>“Suhail Ansari” wrote in message
>news:xxxxx@ntfsd…
>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
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@hotmail.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com