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.
This commit is contained in:
Aric Stewart 2006-03-03 10:08:32 -06:00 committed by Alexandre Julliard
parent 71b94726d9
commit c29b7c3524

View File

@ -779,7 +779,7 @@ static DWORD count_wildcard_files(LPCWSTR szWildFile)
while (res) while (res)
{ {
dwCount++; if (!IsDotDir(wfd.cFileName)) dwCount++;
res = FindNextFileW(hFile, &wfd); res = FindNextFileW(hFile, &wfd);
} }
@ -879,18 +879,16 @@ static void parse_wildcard_files(FILE_LIST *flList, LPWSTR szFile, LPDWORD pdwLi
WIN32_FIND_DATAW wfd; WIN32_FIND_DATAW wfd;
HANDLE hFile = FindFirstFileW(szFile, &wfd); HANDLE hFile = FindFirstFileW(szFile, &wfd);
LPWSTR szFullPath; LPWSTR szFullPath;
BOOL res = TRUE, bDir; BOOL res;
while (res) for (res = TRUE; res; res = FindNextFileW(hFile, &wfd))
{ {
if (IsDotDir(wfd.cFileName)) continue;
szFullPath = wildcard_to_file(szFile, wfd.cFileName); szFullPath = wildcard_to_file(szFile, wfd.cFileName);
bDir = add_file_to_entry(&flList->feFiles[(*pdwListIndex)++], if (add_file_to_entry(&flList->feFiles[(*pdwListIndex)++],
szFullPath, TRUE); szFullPath, TRUE))
HeapFree(GetProcessHeap(), 0, szFullPath);
res = FindNextFileW(hFile, &wfd);
if (bDir)
flList->bAnyDirectories = TRUE; flList->bAnyDirectories = TRUE;
HeapFree(GetProcessHeap(), 0, szFullPath);
} }
FindClose(hFile); FindClose(hFile);