From 8f70f4395ed29a1f6336b8fd55034bc618a26afb Mon Sep 17 00:00:00 2001 From: Giannis Adamopoulos Date: Sat, 20 Aug 2016 09:43:09 +0000 Subject: [PATCH] [SHELL32] - Fail to delete any file if one is invalid. - Patch by andy-123 CORE-9959 svn path=/trunk/; revision=72398 --- reactos/dll/win32/shell32/shlfileop.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/reactos/dll/win32/shell32/shlfileop.cpp b/reactos/dll/win32/shell32/shlfileop.cpp index 2502bb0798a..39ac5b32b96 100644 --- a/reactos/dll/win32/shell32/shlfileop.cpp +++ b/reactos/dll/win32/shell32/shlfileop.cpp @@ -1480,6 +1480,19 @@ static HRESULT delete_files(FILE_OPERATION *op, const FILE_LIST *flFrom) return 0; } + /* Check files. Do not delete one if one file does not exists */ + for (i = 0; i < flFrom->dwNumFiles; i++) + { + fileEntry = &flFrom->feFiles[i]; + + if ((HANDLE)fileEntry->attributes == INVALID_HANDLE_VALUE) + { + // This is a windows 2003 server specific value which has been removed. + // Later versions of windows return ERROR_FILE_NOT_FOUND. + return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND; + } + } + for (i = 0; i < flFrom->dwNumFiles; i++) { bPathExists = TRUE; @@ -1527,7 +1540,7 @@ static HRESULT delete_files(FILE_OPERATION *op, const FILE_LIST *flFrom) { // This is a windows 2003 server specific value which ahs been removed. // Later versions of windows return ERROR_FILE_NOT_FOUND. - return 1026; + return ERROR_SHELL_INTERNAL_FILE_NOT_FOUND; } else {