IoSetShareAccessEx function (wdm.h)

The IoSetShareAccessEx routine sets the access rights for sharing the specified file object.

Syntax

void IoSetShareAccessEx(
  [in]           ACCESS_MASK   DesiredAccess,
  [in]           ULONG         DesiredShareAccess,
  [in, out]      PFILE_OBJECT  FileObject,
  [out]          PSHARE_ACCESS ShareAccess,
  [in, optional] PBOOLEAN      WritePermission
);

Parameters

[in] DesiredAccess

Specifies an ACCESS_MASK value that represents the type of access requested for the file object. See IoCreateFile for a complete list of system-defined DesiredAccess flags.

[in] DesiredShareAccess

Specifies the type of share access to be set for the file object. This value can be zero, or any combination of the following flags:

FILE_SHARE_READ

FILE_SHARE_WRITE

FILE_SHARE_DELETE

[in, out] FileObject

A pointer to the file object whose share access is being set or reset.

[out] ShareAccess

A pointer to the SHARE_ACCESS structure that is associated with FileObject. Drivers should treat this structure as opaque.

[in, optional] WritePermission

A pointer to the value that specifies whether the file object has write permission. This value is TRUE if the share has write permission; otherwise, it is FALSE. If the value is FALSE and the caller attempts to take exclusive read access, the write permission is downgraded to FILE_SHARE_READ.

Return value

None

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

ACCESS_MASK

IoCreateFile