to get source file name in the completion routine of IRP_MJ_SET_INFORMATION

Hi all,

I am writing a filter driver over NTFS for win NT 4.0.
I will be registering a completion routine in case of a rename request
(IRP_MJ_SET_INFORMATION ). If I do a pFileObject->FileName before calling
the lower driver, it gives me the source file name as expected. But if do
it in the completion routine, the file name is that of the destination
file. Am I correct ? Is that expected ? Is there any way to get source
file name in the completion routine ?

Pl. help me…

Thanks in advance,
vishnu.

You are correct, there is no guarantee at all that this information is
available on completion. Generally you should track and cache required
information on the dispatch side and use a lookup mechanism to retrieve the
information you require on completion.

Mark Roddy
Consultant
Hollis Technology Solutions
xxxxx@hollistech.com
www.hollistech.com
603-321-1032
“vishnu” wrote in message news:xxxxx@ntfsd…
>
> Hi all,
>
>
> I am writing a filter driver over NTFS for win NT 4.0.
> I will be registering a completion routine in case of a rename request
> (IRP_MJ_SET_INFORMATION ). If I do a pFileObject->FileName before calling
> the lower driver, it gives me the source file name as expected. But if do
> it in the completion routine, the file name is that of the destination
> file. Am I correct ? Is that expected ? Is there any way to get source
> file name in the completion routine ?
>
> Pl. help me…
>
> Thanks in advance,
> vishnu.
>
>

It has been stated many times before in this list but I will state it
again:

It is only valid to look at the FileObject->FileName field during
pre-create. It is not guaranteed to be valid at any other time!

If you need to get the name at some other time you can do one of the
following:

  • Use ObQueryNameString. Note that this may cause a recursive call back
    into your filter that you need to handle properly.

  • Create your own IRP_MJ_QUERY_INFORMATION IRP using the
    FileNameInformation class and sending the IRP down the stack to the
    drivers below you. If you don’t know how to do this look at the FileSpy
    sample in the XP version of the IFSKit.

  • Save the name in pre-create and keep track of it yourself. The
    FileSpy sample in the Windows 2000 and XP versions of the IFSKit do
    this.

Also be aware that there are times when it is NOT safe to query for the
name of a file. These times are:

  • At DPC level (I hope this one is obvious)

  • If TopLevelIrp is non-zero. This value being non-zero implies that
    someone is already holding a lock on this file and querying for the name
    may cause a deadlock.

  • If you are doing an IRP_MJ_READ from the pagingFile.

Neal Christiansen

This posting is provided “AS IS” with no warranties, and confers no
rights.

-----Original Message-----
From: vishnu [mailto:xxxxx@lycos.com]
Sent: Wednesday, March 06, 2002 06:00 AM
To: File Systems Developers
Subject: [ntfsd] to get source file name in the completion routine of
IRP_MJ_SET_INFORMATION

Hi all,

I am writing a filter driver over NTFS for win NT 4.0.
I will be registering a completion routine in case of a rename request
(IRP_MJ_SET_INFORMATION ). If I do a pFileObject->FileName before
calling
the lower driver, it gives me the source file name as expected. But if
do
it in the completion routine, the file name is that of the destination
file. Am I correct ? Is that expected ? Is there any way to get source
file name in the completion routine ?

Pl. help me…

Thanks in advance,
vishnu.


You are currently subscribed to ntfsd as: xxxxx@Windows.Microsoft.com
To unsubscribe send a blank email to %%email.unsub%%