VOID
IoSetShareAccess(
IN ACCESS_MASK DesiredAccess,
IN ULONG DesiredShareAccess,
IN OUT PFILE_OBJECT FileObject,
OUT PSHARE_ACCESS ShareAccess
);
IoSetShareAccess sets up the access rights for sharing the given file object.
Parameters
DesiredAccess
Specifies the access level for the given FileObject.
DesiredShareAccess
Specifies a requested share access to be set for the file object.
FileObject
Points to the file object whose share access is being set or reset.
ShareAccess
Specifies the share access that was set for the given FileObject on return from IoSetShareAccess.
Comments
If a kernel-mode driver calls this routine, it must be a highest-level driver. That is, the call must occur in the context of the first thread that attempts to open the FileObject.
This routine sets the access and share access information when the given file object is first opened.
Generally, FSDs are most likely to call this routine. However, other highest-level drivers can call IoSetShareAccess to control what kind of access is allowed to a driver-created device object associated with the given FileObject.
Callers of IoSetShareAccess must be running at IRQL PASSIVE_LEVEL.
See Also
IoCheckShareAccess, IoGetFileObjectGenericMapping, IoGetRelatedDeviceObject, IoRemoveShareAccess, IoUpdateShareAccess