Hi,Tonny
Thanks for your quick reply.
Let me explain more what i am doing.
i have a folder for example : c:\test
in this folder i have some files like:
test1.txt.ppt
test2.txt.ppt
test3.txt.ppt
when the application try to open the file “c:\test\test1.txt” , i will get
some info from “c:\test\test1.txt.ppt” and create the file "
c:\test\test1.txt".
if my application open this file from the local computer, it works fine,but
when my application open this file from network, it returns " Can not find
the file".
I monitored it with filespy. I found that it trys to query the file with
IRP_MN_QUERY_DIRECTORY.
so i intercept the filename “\test\test1.txt” to “\test\test1.txt.ppt” in
IrpSp->Parameters.QueryDirectory.FileName .
the first time it return the result STATUS_SUCCESS.
and i change the filename in the structure FILE_BOTH_DIR_INFORMATION to
“test1.txt” as following:
DirInfo = (PFILE_BOTH_DIR_INFORMATION) Irp->UserBuffer;
PreDirInfo = DirInfo;
if (Length == 0)
break;
if ((!DirInfo) || (DirInfo->NextEntryOffset > Length))
break;
do
{
Offset = DirInfo->NextEntryOffset;
if (DirInfo->FileNameLength > 0)
{ if (stringCompare( &(DirInfo->FileName,“test.txt.ppt”))
{
DirInfo->FileName[DirInfo->FileNameLength/sizeof(WCHAR)-4] = ‘\0’;
DirInfo->FileNameLength -= 8;
}
CurPos += Offset;
PreDirInfo = DirInfo;
DirInfo = (PFILE_BOTH_DIR_INFORMATION) ((PUCHAR) DirInfo + Offset);
} while (0 != Offset);
Thanks
Bin
From: “Tony Mason”
>Reply-To: “Windows File Systems Devs Interest List”
>To: “Windows File Systems Devs Interest List”
>Subject: RE: [ntfsd] Help ! IRP_MN_QUERY_DIRECTORY
>Date: Wed, 11 Jan 2006 14:11:40 -0500
>
>Can you describe what you expected to see? STATUS_NO_SUCH_FILE is a
>legitimate return from a directory enumeration (although on the SECOND
>call it would be irregular unless returned also to the first call.)
>What was returned on the first enumeration call? What else is in the
>directory?
>
>I have often found with directory enumeration that it is useful to build
>your own test program that sends NtQueryDirectoryFile calls (it allows
>me to know what the application requested AND what the application sees
>in return.)
>
>Regards,
>
>Tony
>
>Tony Mason
>Consulting Partner
>OSR Open Systems Resources, Inc.
>http://www.osr.com
>
>
>Looking forward to seeing you at the next OSR File Systems class in
>Boston, MA April 24-27, 2006.
>
>
>-----Original Message-----
>From: xxxxx@lists.osr.com
>[mailto:xxxxx@lists.osr.com] On Behalf Of Bin Zeng
>Sent: Wednesday, January 11, 2006 2:03 PM
>To: ntfsd redirect
>Subject: [ntfsd] Help ! IRP_MN_QUERY_DIRECTORY
>
>Hi,All
>
>I am trying to create a virtual file in a specify folder. I handle
>IRP_MJ_CREATE ,it will create a temporary file, it works fine for most
>applications. But when i open the file from network it will query
>the file with request IRP_MN_QUERY_DIRECTORY .
>
>I try to intercept IRP_MN_QUERY_DIRECTORY, the first time i change
>IrpSp->Parameters.QueryDirectory.FileName to my temporary file. The
>second
>request comes in, IrpSp->Parameters.QueryDirectory.FileName is NULL,so
>i
>pass down to lower file system.
>
>my application get return " No SUCH FILE"…
>
>Anyone can help I will be appreciated.
>
>Thanks
>
>Bin
>
>
>
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: xxxxx@osr.com
>To unsubscribe send a blank email to xxxxx@lists.osr.com
>
>—
>Questions? First check the IFS FAQ at
>https://www.osronline.com/article.cfm?id=17
>
>You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
>To unsubscribe send a blank email to xxxxx@lists.osr.com