SHFileOperation and wildcards
Aric Stewart
aric at codeweavers.com
Fri Mar 3 10:08:32 CST 2006
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.
-------------- next part --------------
dlls/shell32/shlfileop.c | 28 ++++++++++++++++++++--------
1 files changed, 20 insertions(+), 8 deletions(-)
applies-to: 0ccf3db4103194ee47ee4f1bd781dc0a0d4ac569
34b882fc9af2f4e35420ba24a958f73c867c2601
diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c
index e12df61..7a7b293 100644
--- a/dlls/shell32/shlfileop.c
+++ b/dlls/shell32/shlfileop.c
@@ -779,7 +779,12 @@ static DWORD count_wildcard_files(LPCWST
while (res)
{
- dwCount++;
+ LPWSTR lp = wfd.cAlternateFileName;
+ if (!lp[0])
+ lp = wfd.cFileName;
+
+ if (!IsDotDir(lp))
+ dwCount++;
res = FindNextFileW(hFile, &wfd);
}
@@ -883,14 +888,21 @@ static void parse_wildcard_files(FILE_LI
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);
+ LPWSTR lp = wfd.cAlternateFileName;
+ if (!lp[0])
+ lp = wfd.cFileName;
- if (bDir)
- flList->bAnyDirectories = TRUE;
+ if (!IsDotDir(lp))
+ {
+ szFullPath = wildcard_to_file(szFile, wfd.cFileName);
+ bDir = add_file_to_entry(&flList->feFiles[(*pdwListIndex)++],
+ szFullPath, TRUE);
+ HeapFree(GetProcessHeap(), 0, szFullPath);
+
+ if (bDir)
+ flList->bAnyDirectories = TRUE;
+ }
+ res = FindNextFileW(hFile, &wfd);
}
FindClose(hFile);
---
0.99.9i
More information about the wine-patches
mailing list