From c29b7c352438669ee22961466360e926a831d313 Mon Sep 17 00:00:00 2001 From: Aric Stewart Date: Fri, 3 Mar 2006 10:08:32 -0600 Subject: [PATCH] shell32: Skip dot directories in SHFileOperation. In ShFileOperation when generating a file list with * wildcards, for example for deletion, do not include the dot directories (. and ..) in the list, because that cause the operation to spiral out of control. --- dlls/shell32/shlfileop.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index e12df61a48..18d11335d2 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -779,7 +779,7 @@ static DWORD count_wildcard_files(LPCWSTR szWildFile) while (res) { - dwCount++; + if (!IsDotDir(wfd.cFileName)) dwCount++; res = FindNextFileW(hFile, &wfd); } @@ -879,18 +879,16 @@ static void parse_wildcard_files(FILE_LIST *flList, LPWSTR szFile, LPDWORD pdwLi WIN32_FIND_DATAW wfd; HANDLE hFile = FindFirstFileW(szFile, &wfd); LPWSTR szFullPath; - BOOL res = TRUE, bDir; - - while (res) - { - szFullPath = wildcard_to_file(szFile, wfd.cFileName); - bDir = add_file_to_entry(&flList->feFiles[(*pdwListIndex)++], - szFullPath, TRUE); - HeapFree(GetProcessHeap(), 0, szFullPath); - res = FindNextFileW(hFile, &wfd); + BOOL res; - if (bDir) + for (res = TRUE; res; res = FindNextFileW(hFile, &wfd)) + { + if (IsDotDir(wfd.cFileName)) continue; + szFullPath = wildcard_to_file(szFile, wfd.cFileName); + if (add_file_to_entry(&flList->feFiles[(*pdwListIndex)++], + szFullPath, TRUE)) flList->bAnyDirectories = TRUE; + HeapFree(GetProcessHeap(), 0, szFullPath); } FindClose(hFile);