Re[2]: how to know "Open for write"?

Hello Ted,

A very good help, but I can’t find where to get “createDisposition”
value?
Other fields are found in stack location, but I can’t find this
field


Best regards,
Ðîìàí mailto:xxxxx@rbcmail.ru

Friday, July 16, 2004, 11:09:24 PM, you wrote:

TH> Hope the follow snippet helps shed some light on what you asked. You may not
TH> care about attribute modification vs. data modification in your application.
TH> The tricky ones are the truncation, supersede modes.

TH> /ted

TH> In preCREATE for any type of data/attribute modification:

TH> writeOperation = ((desiredAccess & (FILE_WRITE_DATA | //
TH> 0x0002
TH> FILE_WRITE_ATTRIBUTES |
TH> // 0x0100
TH> FILE_WRITE_EA |
TH> // 0x0010
TH> FILE_APPEND_DATA |
TH> // 0x0004
TH> DELETE |
TH> // 0x00010000
TH> WRITE_DAC |
TH> // 0x00040000
TH> WRITE_OWNER)) ||
TH> // 0x00080000
TH> (createDisposition != FILE_OPEN) || //
TH> Modes 0 & 2-5
TH> (createOptions & FILE_DELETE_ON_CLOSE)); //
TH> 0x00001000

TH> In postCreate check for the special case of FILE_OPEN_IF with no write
TH> access which creates a new file:

TH> if ((createDisposition == FILE_OPEN_IF) &&
TH> ((desiredAccess & (FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES |
TH> FILE_WRITE_EA |
TH> FILE_APPEND_DATA | DELETE | WRITE_DAC |
TH> WRITE_OWNER)) == 0) &&
TH> (Irp->IoStatus.Information != FILE_CREATED))
TH> {
TH> // Just a plain open of an existing file with no write access
TH> requested
TH> // Reset status set in PreCreate
TH> }

TH> And… Then there is SFM (Services For Macintosh) which diddles file
TH> attributes on RO FileObjects (sigh!)

TH> -----Original Message-----
TH> From: AFei [mailto:xxxxx@hotmail.com]
TH> Sent: Friday, July 16, 2004 2:37 PM
TH> To: Windows File Systems Devs Interest List
TH> Subject: [ntfsd] how to know “Open for write”?

TH> Hi,

TH> In a filesystem filter driver, is there a way to know the file was opened
TH> for write in IRP_MJ_CREATE? (mapping from GENERIC_WRITE flag).

TH> thx.

TH> AFei

TH> —
TH> Questions? First check the IFS FAQ at
TH> https://www.osronline.com/article.cfm?id=17

TH> You are currently subscribed to ntfsd as: xxxxx@livevault.com To unsubscribe
TH> send a blank email to xxxxx@lists.osr.com

TH> —
TH> Questions? First check the IFS FAQ at
TH> https://www.osronline.com/article.cfm?id=17

TH> You are currently subscribed to ntfsd as: xxxxx@rbcmail.ru
TH> To unsubscribe send a blank email to
TH> xxxxx@lists.osr.com

( Parameters.Create.Options >> 24 )

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

----- Original Message -----
From: “Ðîìàí”
To: “Windows File Systems Devs Interest List”
Sent: Saturday, August 28, 2004 6:37 PM
Subject: Re[2]: [ntfsd] how to know “Open for write”?

> Hello Ted,
>
> A very good help, but I can’t find where to get “createDisposition”
> value?
> Other fields are found in stack location, but I can’t find this
> field
>
>
> –
> Best regards,
> Ðîìàí mailto:xxxxx@rbcmail.ru
>
> Friday, July 16, 2004, 11:09:24 PM, you wrote:
>
> TH> Hope the follow snippet helps shed some light on what you asked. You may
not
> TH> care about attribute modification vs. data modification in your
application.
> TH> The tricky ones are the truncation, supersede modes.
>
> TH> /ted
>
>
> TH> In preCREATE for any type of data/attribute modification:
>
> TH> writeOperation = ((desiredAccess & (FILE_WRITE_DATA | //
> TH> 0x0002
> TH> FILE_WRITE_ATTRIBUTES |
> TH> // 0x0100
> TH> FILE_WRITE_EA |
> TH> // 0x0010
> TH> FILE_APPEND_DATA |
> TH> // 0x0004
> TH> DELETE |
> TH> // 0x00010000
> TH> WRITE_DAC |
> TH> // 0x00040000
> TH> WRITE_OWNER)) ||
> TH> // 0x00080000
> TH> (createDisposition != FILE_OPEN) || //
> TH> Modes 0 & 2-5
> TH> (createOptions & FILE_DELETE_ON_CLOSE)); //
> TH> 0x00001000
>
> TH> In postCreate check for the special case of FILE_OPEN_IF with no write
> TH> access which creates a new file:
>
> TH> if ((createDisposition == FILE_OPEN_IF) &&
> TH> ((desiredAccess & (FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES |
> TH> FILE_WRITE_EA |
> TH> FILE_APPEND_DATA | DELETE | WRITE_DAC |
> TH> WRITE_OWNER)) == 0) &&
> TH> (Irp->IoStatus.Information != FILE_CREATED))
> TH> {
> TH> // Just a plain open of an existing file with no write access
> TH> requested
> TH> // Reset status set in PreCreate
> TH> }
>
> TH> And… Then there is SFM (Services For Macintosh) which diddles file
> TH> attributes on RO FileObjects (sigh!)
>
> TH> -----Original Message-----
> TH> From: AFei [mailto:xxxxx@hotmail.com]
> TH> Sent: Friday, July 16, 2004 2:37 PM
> TH> To: Windows File Systems Devs Interest List
> TH> Subject: [ntfsd] how to know “Open for write”?
>
>
> TH> Hi,
>
> TH> In a filesystem filter driver, is there a way to know the file was opened
> TH> for write in IRP_MJ_CREATE? (mapping from GENERIC_WRITE flag).
>
> TH> thx.
>
> TH> AFei
>
>
>
> TH> —
> TH> Questions? First check the IFS FAQ at
> TH> https://www.osronline.com/article.cfm?id=17
>
> TH> You are currently subscribed to ntfsd as: xxxxx@livevault.com To
unsubscribe
> TH> send a blank email to xxxxx@lists.osr.com
>
> TH> —
> TH> Questions? First check the IFS FAQ at
> TH> https://www.osronline.com/article.cfm?id=17
>
> TH> You are currently subscribed to ntfsd as: xxxxx@rbcmail.ru
> TH> To unsubscribe send a blank email to
> TH> 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: xxxxx@storagecraft.com
> To unsubscribe send a blank email to xxxxx@lists.osr.com

ACCESS_MASK desiredAccess =
irpSp->Parameters.Create.SecurityContext->DesiredAccess;
ULONG createDisposition = (irpSp->Parameters.Create.Options >> 24) & 0xFF;

-----Original Message-----
From: xxxxx@rbcmail.ru [mailto:xxxxx@rbcmail.ru]
Sent: Saturday, August 28, 2004 10:37 AM
To: Windows File Systems Devs Interest List
Subject: Re[2]: [ntfsd] how to know “Open for write”?

Hello Ted,

A very good help, but I can’t find where to get “createDisposition” value?
Other fields are found in stack location, but I can’t find this field


Best regards,
??? mailto:xxxxx@rbcmail.ru

Friday, July 16, 2004, 11:09:24 PM, you wrote:

TH> Hope the follow snippet helps shed some light on what you asked. You
TH> may not care about attribute modification vs. data modification in
TH> your application. The tricky ones are the truncation, supersede
TH> modes.

TH> /ted

TH> In preCREATE for any type of data/attribute modification:

TH> writeOperation = ((desiredAccess & (FILE_WRITE_DATA |
//
TH> 0x0002
TH> FILE_WRITE_ATTRIBUTES |
TH> // 0x0100
TH> FILE_WRITE_EA |
TH> // 0x0010
TH> FILE_APPEND_DATA |
TH> // 0x0004
TH> DELETE |
TH> // 0x00010000
TH> WRITE_DAC |
TH> // 0x00040000
TH> WRITE_OWNER)) ||
TH> // 0x00080000
TH> (createDisposition != FILE_OPEN) || //
TH> Modes 0 & 2-5
TH> (createOptions & FILE_DELETE_ON_CLOSE)); //
TH> 0x00001000

TH> In postCreate check for the special case of FILE_OPEN_IF with no
TH> write access which creates a new file:

TH> if ((createDisposition == FILE_OPEN_IF) &&
TH> ((desiredAccess & (FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES |
TH> FILE_WRITE_EA |
TH> FILE_APPEND_DATA | DELETE | WRITE_DAC |
TH> WRITE_OWNER)) == 0) &&
TH> (Irp->IoStatus.Information != FILE_CREATED))
TH> {
TH> // Just a plain open of an existing file with no write access
TH> requested
TH> // Reset status set in PreCreate
TH> }

TH> And… Then there is SFM (Services For Macintosh) which diddles file
TH> attributes on RO FileObjects (sigh!)

TH> -----Original Message-----
TH> From: AFei [mailto:xxxxx@hotmail.com]
TH> Sent: Friday, July 16, 2004 2:37 PM
TH> To: Windows File Systems Devs Interest List
TH> Subject: [ntfsd] how to know “Open for write”?

TH> Hi,

TH> In a filesystem filter driver, is there a way to know the file was
opened
TH> for write in IRP_MJ_CREATE? (mapping from GENERIC_WRITE flag).

TH> thx.

TH> AFei

TH> —
TH> Questions? First check the IFS FAQ at
TH> https://www.osronline.com/article.cfm?id=17

TH> You are currently subscribed to ntfsd as: xxxxx@livevault.com To
unsubscribe
TH> send a blank email to xxxxx@lists.osr.com

TH> —
TH> Questions? First check the IFS FAQ at
TH> https://www.osronline.com/article.cfm?id=17

TH> You are currently subscribed to ntfsd as: xxxxx@rbcmail.ru
TH> To unsubscribe send a blank email to
TH> 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: xxxxx@livevault.com
To unsubscribe send a blank email to xxxxx@lists.osr.com

Thanks Ted


Roman Kudinov

mailto:xxxxx@rbcmail.ru

Monday, August 30, 2004, 2:57:22 AM, you wrote:

TH> ACCESS_MASK desiredAccess =
irpSp->>Parameters.Create.SecurityContext->DesiredAccess;
TH> ULONG createDisposition = (irpSp->Parameters.Create.Options >> 24) & 0xFF;

TH> -----Original Message-----
TH> From: xxxxx@rbcmail.ru [mailto:xxxxx@rbcmail.ru]
TH> Sent: Saturday, August 28, 2004 10:37 AM
TH> To: Windows File Systems Devs Interest List
TH> Subject: Re[2]: [ntfsd] how to know “Open for write”?

TH> Hello Ted,

TH> A very good help, but I can’t find where to get “createDisposition” value?
TH> Other fields are found in stack location, but I can’t find this field