clamscan.exe fails to delete a file from C:\somefolder though it can
successfully delete a file from a user-owned directory (eg
C:\Users\user\somefolder). From what I can tell, this is because a new
directory in C:\somefolder does not have the full-access ACL by
default.
This patch changes the NtCreateFile() call to open with generic read
& delete rights, instead of requesting full-access.
... | ... |
@@ -338,7 +338,7 @@ static int traverse_to(const char *directory, bool want_directory_handle, HANDLE |
338 | 338 |
if (true != want_directory_handle) { |
339 | 339 |
if (i == tokens_count - 1) { |
340 | 340 |
/* Change createfile options for our target file instead of an intermediate directory. */ |
341 |
- desiredAccess = FILE_ALL_ACCESS | DELETE; |
|
341 |
+ desiredAccess = FILE_GENERIC_READ | DELETE; |
|
342 | 342 |
fileAttributes = FILE_ATTRIBUTE_NORMAL; |
343 | 343 |
createOptions = FILE_NON_DIRECTORY_FILE; |
344 | 344 |
shareAccess = FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE; |