NTSTATUS
IoCheckShareAccess(
IN ACCESS_MASK DesiredAccess,
IN ULONG DesiredShareAccess,
IN OUT PFILE_OBJECT FileObject,
IN OUT PSHARE_ACCESS ShareAccess,
IN BOOLEAN Update
);
IoCheckShareAccess is called by FSDs or other highest-level drivers to check whether shared access to a file object is permitted.
IoCheckShareAccess returns STATUS_SUCCESS if the requestor’s access to the file object is compatible with the way in which it is currently open. If the request is denied because of a sharing violation, then STATUS_SHARING_VIOLATION is returned.
IoCheckShareAccess checks a file object open request to determine whether the types of desired and shared accesses specified are compatible with the way in which the file object is currently being accessed by other opens.
File systems maintain state about files through structures called file control blocks (FCBs). The SHARE_ACCESS is a structure describing how the file is currently accessed by all opens. This state is contained in the FCB as part of the open state for each file object. Other highest-level drivers might call this routine to check the access requested when a file object representing such a driver’s device object is opened.
Callers of IoCheckShareAccess must be running at IRQL PASSIVE_LEVEL.
IoGetRelatedDeviceObject, IoRemoveShareAccess, IoSetShareAccess, IoUpdateShareAccess