The RelatedFileObject pointer is not null if the file name is relative. So
RelatedFileObject->FileName points to the directory where the file is
located. You need check these things before call IoCallDriver.
After the call, RelatedFileObject becomes NULL in most cases.
Shangwu
“Vodicka, Michal” <michal.vodicka> wrote in message
news:xxxxx@ntfsd…
>
> > ----------
> > From:
> > xxxxx@windows.microsoft.com[SMTP:xxxxx@windows.microsoft.com]
> > Reply To: xxxxx@lists.osr.com
> > Sent: Tuesday, February 04, 2003 1:58 AM
> > To: xxxxx@lists.osr.com
> > Subject: [ntfsd] RE: How can I get the current dirctory in a file
> > system filter driver?
> >
> > It is only valid to look at the FileName and RelatedFileObject fields of
> > a FILE_OBJECT structure during pre-create. These fields are not
> > necessarily valid at any other time.
> >
> Is RelatedFileObject->FileName always valid in pre-create path?
>
> I’m just investigating IFS (XP SP1) examples to find how to get canonical
> name in pre-create path and have to say I’m a bit confused. SFilter
accesses
> RelatedFileObject->FileName directly (post-create when open fails) whereas
> FileSpy queries for FileNameInfo. There is a comment (fspylib.c / 1272)
> which explains it is because RelatedFileObject may be also relative. Well,
> so why don’t use relative name directly if it isn’t?
>
> The comment is also misleading because tells about using
ObQueryNameString()
> and is followed by call of SpyQueryFileSystemForFileName() which contains
> following comment “ObQueryNameString CANNOT be used here…”
>
> Can somebody explain when is RelatedFileObject created and give an example
> of real situation when it can be relative to the other one?
>
> Thanks.
>
> Best regards,
>
> Michal Vodicka
> STMicroelectronics Design and Application s.r.o.
> [michal.vodicka@st.com, http:://www.st.com]
>
>
>
>
>
>
></michal.vodicka>