[NTOS:IO] Do not set Shared property of the file if we are failing in IoCheckShareAccess

This commit is contained in:
Jérôme Gardou 2020-12-14 15:51:15 +01:00
parent 115b8290cd
commit 1d1dba51db

View file

@ -3429,11 +3429,6 @@ IoCheckShareAccess(IN ACCESS_MASK DesiredAccess,
SharedWrite = (DesiredShareAccess & FILE_SHARE_WRITE) != 0;
SharedDelete = (DesiredShareAccess & FILE_SHARE_DELETE) != 0;
/* Set them */
FileObject->SharedRead = SharedRead;
FileObject->SharedWrite = SharedWrite;
FileObject->SharedDelete = SharedDelete;
/* Check if the shared access is violated */
if ((ReadAccess &&
(ShareAccess->SharedRead < ShareAccess->OpenCount)) ||
@ -3449,6 +3444,11 @@ IoCheckShareAccess(IN ACCESS_MASK DesiredAccess,
return STATUS_SHARING_VIOLATION;
}
/* Set them */
FileObject->SharedRead = SharedRead;
FileObject->SharedWrite = SharedWrite;
FileObject->SharedDelete = SharedDelete;
/* It's not, check if caller wants us to update it */
if (Update)
{