Thanks Ryan & Jamey, I’m trying other way not to use the IoCheckShareAccess,
and it seems fine.
For me, it is very strange for the call of IoCheckShareAccess. I thought if
the Update parameter of
IoCheckShareAccess is set to FALSE, the sharing status of file object should
not be changed. But the
senerio I found is: if the IoCheckShareAccess is called with the incorrect
shareaccess parameter, files
located on FAT volumes can’t be opened because of sharing violation. Will
the call of IoCheckShareAccess
changes the sharing status of FileObject? And this problem can’t be
reproduced on NTFS volumes.
Regards,
Xinwei
“Nick Ryan” wrote into:xxxxx@ntfsd…
>
> True, I didn’t want to encourage him to take over functionality from the
> filesystem, but if he needs to this is probably one of the simplest
> pieces you can take. The OP needs to explain exactly what he’s trying to
> do and where he’s getting his parameters from.
>
> Jamey Kirby wrote:
>
> > If you maintain your own lock structure you surly can; we have done it
> > before to over-ride the FSD share with our own share structures.
> >
> > Jamey
> >
> > -----Original Message-----
> > From: xxxxx@lists.osr.com
> > [mailto:xxxxx@lists.osr.com] On Behalf Of Nick Ryan
> > Sent: Monday, August 11, 2003 1:20 AM
> > To: File Systems Developers
> > Subject: [ntfsd] Re: STATUS_SHARING_VIOLATION reported after
> > IoCheckShareAccess is called. (Only on FAT volume)
> >
> > You can’t call this API in a filter. The ‘ShareAccess’ parameter must be
> > a pointer to a SHARE_ACCESS structure internal to the filesystem (stored
> > in the FCB so as to be shared across all open instances of the file).
> >
> > SXW wrote:
> >
> >
> >>BlankHi,
> >>
> >>I’m trying IoCheckShareAccess on a file object is created successfully,
> >>
> >>the codes just like:
> >>
> >>status = SendIrpCreate();
> >>if( NT_SUCCESS(status) ){
> >> // just check the share, doesn’t change the status returned
> >> IoCheckShareAccess( accessmask , desireshare, FileObject,
> >>&shareaccess,FALSE);
> >>}
> >>return status;
> >>
> >>
> >>the accessmask is always FILE_READ_DATA
> >>the desireshare is set as
> >> ULONG desireshare = 0;
> >> if( FileObject->SharedRead ) desireshare |=FILE_SHARE_READ;
> >> if( FileObject->SharedWrite) desireshare |=FILE_SHARE_WRITE;
> >> if( FileObject->SharedDelete ) desireshare |=FILE_SHARE_DELETE;
> >>
> >>the call to IoCheckShareAccess will fail file/dir open on FAT volume
with
> >>STATUS_SHARING_VIOLATION, but files/directories located on NTFS volume
can
> >>be openned succefully.
> >>
> >>if the desireshare is changed to FILE_SHARE_READ, open file seems OK.
> >>
> >>What’s wrong with the IoCheckAccessShare? And why does this problem
> >
> > relative
> >
> >>to disk format?
> >>
> >>Thanks for any hints,
> >>
> >>sxw
> >>
> >>
> >>
> >>
> >>
> >>
> >
> >
>
> –
> - Nick Ryan (MVP for DDK)
>
>
>