IoCheckShareAccessEx function (wdm.h)

The IoCheckShareAccessEx routine is called by file system drivers (FSDs) or other highest-level drivers to check whether shared access to a file object is permitted.

Syntax

NTSTATUS IoCheckShareAccessEx(
  [in]      ACCESS_MASK   DesiredAccess,
  [in]      ULONG         DesiredShareAccess,
  [in, out] PFILE_OBJECT  FileObject,
  [in, out] PSHARE_ACCESS ShareAccess,
  [in]      BOOLEAN       Update,
  [in]      PBOOLEAN      WritePermission
);

Parameters

[in] DesiredAccess

Specifies an ACCESS_MASK value that indicates the desired type of access to the given file object.

[in] DesiredShareAccess

Specifies the desired type of shared access to the file object for the current open request. The value of this parameter is usually the same as the ShareAccess parameter that is passed to the file system or highest-level driver by the I/O manager when the open request was made. This value can be zero, or any combination of the following:

FILE_SHARE_READ

FILE_SHARE_WRITE

FILE_SHARE_DELETE

[in, out] FileObject

A pointer to the file object for which to check access for the current open request.

[in, out] ShareAccess

A pointer to the common share-access data structure that is associated with FileObject. Drivers should treat this structure as opaque.

[in] Update

Specifies whether to update the share-access status for FileObject. A Boolean value of TRUE means this routine will update the share access information for the file object if the open request is permitted.

[in] WritePermission

Specifies whether the share access has write permission. This value is TRUE if the share has write permission; otherwise, FALSE. If the value is FALSE and the share access has write permission and the caller attempts to take exclusive read access, the write permission is downgraded to FILE_SHARE_READ. This value is NULL if a write permission check is not done on the share access.

Return value

The IoCheckShareAccessEx routine returns STATUS_SUCCESS if the requester'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.

Requirements

Requirement Value
Minimum supported client Available in Windows 7 and later versions of Windows.
Target Platform Universal
Header wdm.h
Library Ntoskrnl.lib

See also

I/O Manager Routines