From:	SMTP%"dave@silcom.com" 11-OCT-1997 10:56:36.57
To:	ntfsd@atria.com
CC:	
Subj:	Re: Determining read/write mode of an Irp

Return-Path: owner-ntfsd@atria.com
Received: by arisia.gce.com (UCX V4.1-12C, OpenVMS V7.1 VAX);
	Sat, 11 Oct 1997 10:38:41 -0400
Received: from gw.atria.com (gw.atria.com [192.88.237.2]) by bort.mv.net (8.8.5/mem-951016) with SMTP id SAA26409 for <everhart@arisia.gce.com>; Thu, 9 Oct 1997 18:06:15 -0400 (EDT)
Received: by gw.atria.com id <NAA05303@gw.atria.com> Thu, 9 Oct 1997 13:39:04 -0400    
Received: from acme.sb.west.net by gw.atria.com id <NAA05280@gw.atria.com> Thu, 9 Oct 1997 13:39:00 -0400    
Received: from division_bell (host3.miramarsys.com [205.180.87.4]) by acme.sb.west.net (8.8.3/8.6.12) with ESMTP id KAA16777 for <ntfsd@atria.com>; Thu, 9 Oct 1997 10:38:57 -0700 (PDT)
Message-ID: <343D1624.6EE8D221@silcom.com>
Date: Thu, 09 Oct 1997 10:36:36 -0700
From: Dave Cox <dave@silcom.com>
Reply-To: dave@silcom.com
X-Mailer: Mozilla 4.01 [en] (WinNT; I)
MIME-Version: 1.0
To: ntfsd@atria.com
Subject: Re: Determining read/write mode of an Irp
X-Priority: 3 (Normal)
References: <343C2361.3D811753@leprechaun.com.au>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Sender: owner-ntfsd@atria.com
Precedence: bulk

Those fields are set by the FSD in the CREATE dispatch, so they aren't
useful to a filter before the CREATE completes.

Also, FSDs set these by using system functions called something like
IoCheckShareAccess and IoSetShareAccess.  However, an FSD isn't required
to use those functions to manage access and sharing, nor to use the
boolean fields in the file object to store the granted access. FSDs
usually need to keep more information about a file, on a per-open basis,
than the FILE_OBJECT has room for, so the developer defines a
proprietary structure and points the FsContext2 member of the
FILE_OBJECT at it.  The access and sharing could be stored there, or (in
the case of a network redirector) could be implicit in the network
protocol's file handle.

To check the access requested before the CREATE dispatch, look in the
IO_STACK_LOCATION.Parameters.Create.SecurityContext->DesiredAccess.  If
the CREATE dispatch succeeds, then all the requested access was granted.

Dave Cox
Miramar Systems

Colin Ward wrote:
> 
> Hi all!
> 
>   I need to check an IRP_MJ_CREATE Irp to see if the file is being
> opened in read, read/write or write mode in a file system filter
> driver.  Supposedly I just need to check the FILE_OBJECT structure
> pointed to by the current IO_STACK_LOCATION.  The BOOLEAN fields
> ReadAccess, WriteAccess, SharedRead and SharedWrite in the FILE_OBJECT
> structure should tell me what I need to know, but for some reason they
> are always FALSE...
> 
>   Bizarre...  Usually things make sense in NT Kernel Mode Drivers
> (unlike in VxDs!), but this most certainly doesn't!  Can anyone
> enlighten me?
> 
> /----------------------------------------------------------------------\
> [Hitman/Code HQ - 6502/68000/604e coder - Long live the Amiga!         ]
> [VZ-200/Vic-20/c64*6/c128/Amiga CD32/500/2000/1200*2/4000 - 6581 Rulez!]
> [A4000/CV64-3D/060-50/604e-200/66 Meg.  Does not own a PC!             ]
> [After three days without coding, life becomes meaningless.            ]
> \----------------------------------------------------------------------/
>  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
> [ To unsubscribe, send email to ntfsd-request@atria.com with body
> UNSUBSCRIBE (the subject is ignored). ]
 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
[ To unsubscribe, send email to ntfsd-request@atria.com with body
UNSUBSCRIBE (the subject is ignored). ]
