If ExistingOpen.SharingMode.FILE_SHARE_DELETE is FALSE, then return STATUS_SHARING_VIOLATION. EndFor Return STATUS_SUCCESS. Algorithm to Check Sharing Access to an Existing Stream or Directory The inputs to the algorithm are: Open: The Open for an in-progress Open operation to an existing stream or directory. On completion, the algorithm returns: Status: An NTSTATUS code that specifies the result of the sharing check. The object store MUST perform sharing checks when opening an existing stream or directory. Pseudocode for checks is as follows: If AccessCheck(SecurityContext, Open.Link.ParentFile.SecurityDescriptor, FILE_WRITE_DATA) returns FALSE, the object store MUST set Open.SharingMode.FILE_SHARE_READ to TRUE. If DesiredAccess contains any of (FILE_READ_DATA | FILE_EXECUTE | FILE_WRITE_DATA | FILE_APPEND_DATA | DELETE): For each ExistingOpen in Open.File.OpenList: If ExistingOpen.Stream equals Open.Stream and ExistingOpen.GrantedAccess contains any of (FILE_READ_DATA | FILE_EXECUTE | FILE_WRITE_DATA | FILE_APPEND_DATA | DELETE), then return STATUS_SHARING_VIOLATION under any of the following conditions: If ExistingOpen.SharingMode.FILE_SHARE_READ is and DesiredAccess contains either FILE_READ_DATA or FILE_EXECUTE If is and ExistingOpen.SharingMode.FILE_SHARE_WRITE DesiredAccess contains either FILE_WRITE_DATA or FILE_APPEND_DATA If is FALSE and ExistingOpen.SharingMode.FILE_SHARE_DELETE ExistingOpen contains DELETE If is FALSE and Open.SharingMode.FILE_SHARE_READ ExistingOpen.GrantedAccess contains either FILE_READ_DATA or FILE_EXECUTE If Open.SharingMode.FILE_SHARE_WRITE is FALSE and ExistingOpen.GrantedAccess contains either FILE_WRITE_DATA or FILE_APPEND_DATA If Open.SharingMode.FILE_SHARE_DELETE is FALSE and ExistingOpen.GrantedAccess contains DELETE EndFor EndIf
If ExistingOpen.SharingMode.FILE_SHARE_DELETE is FALSE, then return STATUS_SHARING_VIOLATION. EndFor Return STATUS_SUCCESS. Algorithm to Check Sharing Access to an Existing Stream or Directory The inputs to the algorithm are: Open: The Open for an in-progress Open operation to an existing stream or directory. On completion, the algorithm returns: Status: An NTSTATUS code that specifies the result of the sharing check. The object store MUST perform sharing checks when opening an existing stream or directory. Pseudocode for checks is as follows: If AccessCheck(SecurityContext, Open.Link.ParentFile.SecurityDescriptor, FILE_WRITE_DATA) returns FALSE, the object store MUST set Open.SharingMode.FILE_SHARE_READ to TRUE. If DesiredAccess contains any of (FILE_READ_DATA | FILE_EXECUTE | FILE_WRITE_DATA | FILE_APPEND_DATA | DELETE): For each ExistingOpen in Open.File.OpenList: If ExistingOpen.Stream equals Open.Stream and ExistingOpen.GrantedAccess contains any of (FILE_READ_DATA | FILE_EXECUTE | FILE_WRITE_DATA | FILE_APPEND_DATA | DELETE), then return STATUS_SHARING_VIOLATION under any of the following conditions: If ExistingOpen.SharingMode.FILE_SHARE_READ is and DesiredAccess contains either FILE_READ_DATA or FILE_EXECUTE If ExistingOpen.SharingMode.FILE_SHARE_WRITE is and DesiredAccess contains either FILE_WRITE_DATA or FILE_APPEND_DATA If ExistingOpen.SharingMode.FILE_SHARE_DELETE is FALSE and ExistingOpen contains DELETE If Open.SharingMode.FILE_SHARE_READ is FALSE and ExistingOpen.GrantedAccess contains either FILE_READ_DATA or FILE_EXECUTE If Open.SharingMode.FILE_SHARE_WRITE is FALSE and ExistingOpen.GrantedAccess contains either FILE_WRITE_DATA or FILE_APPEND_DATA If Open.SharingMode.FILE_SHARE_DELETE is FALSE and ExistingOpen.GrantedAccess contains DELETE EndFor EndIf