Aric Stewart : shell32: Skip dot directories in SHFileOperation.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 6 12:54:53 CST 2006


Module: wine
Branch: refs/heads/master
Commit: c29b7c352438669ee22961466360e926a831d313
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=c29b7c352438669ee22961466360e926a831d313

Author: Aric Stewart <aric at codeweavers.com>
Date:   Fri Mar  3 10:08:32 2006 -0600

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 |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index e12df61..18d1133 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -779,7 +779,7 @@ static DWORD count_wildcard_files(LPCWST
     
     while (res)
     {
-        dwCount++;
+        if (!IsDotDir(wfd.cFileName)) dwCount++;
         res = FindNextFileW(hFile, &wfd);
     }
 
@@ -879,18 +879,16 @@ static void parse_wildcard_files(FILE_LI
     WIN32_FIND_DATAW wfd;
     HANDLE hFile = FindFirstFileW(szFile, &wfd);
     LPWSTR szFullPath;
-    BOOL res = TRUE, bDir;
-    
-    while (res)
+    BOOL res;
+
+    for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
     {
+        if (IsDotDir(wfd.cFileName)) continue;
         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);
-
-        if (bDir)
+        if (add_file_to_entry(&flList->feFiles[(*pdwListIndex)++],
+                              szFullPath, TRUE))
             flList->bAnyDirectories = TRUE;
+        HeapFree(GetProcessHeap(), 0, szFullPath);
     }
 
     FindClose(hFile);




More information about the wine-cvs mailing list