IoSetShareAccess function (wdm.h)
The IoSetShareAccess routine sets the access rights for sharing the given file object.
void IoSetShareAccess( [in] ACCESS_MASK DesiredAccess, [in] ULONG DesiredShareAccess, [in, out] PFILE_OBJECT FileObject, [out] PSHARE_ACCESS ShareAccess );
Specifies the type of share access to be set for the file object. This value can be zero, or any combination of the following:
[in, out] FileObject
Pointer to the file object whose share access is being set or reset.
Pointer to the SHARE_ACCESS structure associated with FileObject. Drivers should treat this structure as opaque.
Only highest-level kernel-mode drivers should call this routine. 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 FileObject is first opened. It returns a pointer to the common share-access data structure associated with FileObject. Callers should save this pointer for later use when updating the access or closing the file.
Generally, file system drivers (FSDs) are most likely to call this routine. However, other highest-level drivers can call IoSetShareAccess to control the kind of access allowed to a driver-created device object associated with the given FileObject.
IoSetShareAccess is not an atomic operation. Therefore, drivers calling this routine must protect the shared file object passed to IoSetShareAccess by means of some kind of lock, such as a mutex or a resource lock, in order to prevent corruption of the shared access counts.
|Minimum supported client||Available starting with Windows 2000.|
|Header||wdm.h (include Wdm.h, Ntddk.h, Ntifs.h)|
|DDI compliance rules||HwStorPortProhibitedDDIs(storport), IrqlIoPassive5(wdm)|
Submit and view feedback for