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.
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.
IoCheckShareAccess, IoGetFileObjectGenericMapping, IoGetRelatedDeviceObject, IoRemoveShareAccess, IoUpdateShareAccess