FSFD & IRP_MJ_CREATE Problem

Hi,I am writing a FSFD, I filter file creation notifications through the IRP_MJ_CREATE message, some times the ‘irpStack->FileObject->FileName’ being received doesn’t include the directory name where the file is being created, why does this happen [???] shouldn’t the file being created always include it’s full path [???]May this be the result of creating a file in the current directory without specifying it’s full path [???] if indeed this is the case how can I resolve the directory in which the file is about to be created [???], is there a way to get the current directory of a specific process [???] ( the one creating the file )Any help comment or remark would be appreciated…P.S.I would rather avoid doing any file name resolution in the completion request of IRP_MJ_CREATE as there are cases where the driver should prevent the file from bein created…-- Naddav http://www.sophin.com


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

After CREATE was completed, the FileObject->FileName is not guaranteed to be valid and can contain any junk.

Also - it is a relative name, relative to ->RelatedFileObject which is usually a current directory or SMB share.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Nadav
To: Windows File Systems Devs Interest List
Sent: Monday, August 29, 2005 11:16 PM
Subject: [ntfsd] FSFD & IRP_MJ_CREATE Problem

Hi,

I am writing a FSFD, I filter file creation notifications through the
IRP_MJ_CREATE message, some times the ‘irpStack->FileObject->FileName’ being
received doesn’t include the directory name where the file is being created,
why does this happen [???] shouldn’t the file being created always include
it’s full path [???]
May this be the result of creating a file in the current directory without
specifying it’s full path [???] if indeed this is the case how can I resolve
the directory in which the file is about to be created [???], is there a way
to get the current directory of a specific process [???] ( the one creating
the file )

Any help comment or remark would be appreciated.

P.S.
I would rather avoid doing any file name resolution in the completion
request of IRP_MJ_CREATE as there are cases where the driver should prevent
the file from bein created…

Naddav
http://www.sophin.com__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17 You are currently subscribed to ntfsd as: xxxxx@storagecraft.com To unsubscribe send a blank email to xxxxx@lists.osr.com

The short answer is that you need to look at
RelatedFileObject. The long answer is to search the
archives of this list. You would think that this
would be a fairly simple thing to do, but it is more
complicated that it seems and has to be done exactly
right.

BTW, if you can do a mini-filter this is all taken
care of and will save you tons of time.

— Nadav wrote:

>
> Hi,I am writing a FSFD, I filter file creation
> notifications through the IRP_MJ_CREATE message,
> some times the ‘irpStack->FileObject->FileName’
> being received doesn’t include the directory name
> where the file is being created, why does this
> happen [???] shouldn’t the file being created always
> include it’s full path [???]May this be the result
> of creating a file in the current directory without
> specifying it’s full path [???] if indeed this is
> the case how can I resolve the directory in which
> the file is about to be created [???], is there a
> way to get the current directory of a specific
> process [???] ( the one creating the file )Any help
> comment or remark would be appreciated…P.S.I would
> rather avoid doing any file name resolution in the
> completion request of IRP_MJ_CREATE as there are
> cases where the driver should prevent the file from
> bein created…-- Naddav http://www.sophin.com
>
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam
> protection around
> http://mail.yahoo.com
> —
> Questions? First check the IFS FAQ at
> https://www.osronline.com/article.cfm?id=17
>
> You are currently subscribed to ntfsd as:
> xxxxx@yahoo.com
> To unsubscribe send a blank email to
xxxxx@lists.osr.com

Check the RelatedFileObject pointer in the file object. It will point to the
parent directory file object. You can then call the FSD and get the filename
to this file object, concatenate the name in your current file object to the
name returned from the file system and you will have the canonical filename.

Jamey


From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Nadav
Sent: Monday, August 29, 2005 12:16 PM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] FSFD & IRP_MJ_CREATE Problem

Hi,

I am writing a FSFD, I filter file creation notifications through the
IRP_MJ_CREATE message, some times the ‘irpStack->FileObject->FileName’ being

received doesn’t include the directory name where the file is being created,

why does this happen [???] shouldn’t the file being created always include
it’s full path [???]
May this be the result of creating a file in the current directory without
specifying it’s full path [???] if indeed this is the case how can I resolve

the directory in which the file is about to be created [???], is there a way

to get the current directory of a specific process [???] ( the one creating
the file )

Any help comment or remark would be appreciated.

P.S.
I would rather avoid doing any file name resolution in the completion
request of IRP_MJ_CREATE as there are cases where the driver should prevent
the file from bein created…

Naddav
http://www.sophin.com http:</http:>


Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17 You are currently subscribed to
ntfsd as: xxxxx@rocketdivision.com To unsubscribe send a blank email to
xxxxx@lists.osr.com

Thanks, usage of ->RelatedFileObject resolved my problem…

“Maxim S. Shatskih” wrote: After CREATE was completed, the FileObject->FileName is not guaranteed to be valid and can contain any junk.

Also - it is a relative name, relative to ->RelatedFileObject which is usually a current directory or SMB share.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
----- Original Message -----
From: Nadav
To: Windows File Systems Devs Interest List
Sent: Monday, August 29, 2005 11:16 PM
Subject: [ntfsd] FSFD & IRP_MJ_CREATE Problem

Hi,I am writing a FSFD, I filter file creation notifications through the IRP_MJ_CREATE message, some times the ‘irpStack->FileObject->FileName’ being received doesn’t include the directory name where the file is being created, why does this happen [???] shouldn’t the file being created always include it’s full path [???]May this be the result of creating a file in the current directory without specifying it’s full path [???] if indeed this is the case how can I resolve the directory in which the file is about to be created [???], is there a way to get the current directory of a specific process [???] ( the one creating the file )Any help comment or remark would be appreciated…P.S.I would rather avoid doing any file name resolution in the completion request of IRP_MJ_CREATE as there are cases where the driver should prevent the file from bein created…-- Naddav http://www.sophin.com

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com — Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17 You are currently subscribed to ntfsd as: xxxxx@storagecraft.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

---------------------------------
Start your day with Yahoo! - make it your home page