Commit 8758a8a6 authored by Michael Müller's avatar Michael Müller Committed by Alexandre Julliard

shlwapi: Correctly treat '.' when enumerating files in PathIsDirectoryEmptyW.

parent cffe06af
...@@ -3872,13 +3872,13 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath) ...@@ -3872,13 +3872,13 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
WCHAR szSearch[MAX_PATH]; WCHAR szSearch[MAX_PATH];
DWORD dwLen; DWORD dwLen;
HANDLE hfind; HANDLE hfind;
BOOL retVal = FALSE; BOOL retVal = TRUE;
WIN32_FIND_DATAW find_data; WIN32_FIND_DATAW find_data;
TRACE("(%s)\n",debugstr_w(lpszPath)); TRACE("(%s)\n",debugstr_w(lpszPath));
if (!lpszPath || !PathIsDirectoryW(lpszPath)) if (!lpszPath || !PathIsDirectoryW(lpszPath))
return FALSE; return FALSE;
lstrcpynW(szSearch, lpszPath, MAX_PATH); lstrcpynW(szSearch, lpszPath, MAX_PATH);
PathAddBackslashW(szSearch); PathAddBackslashW(szSearch);
...@@ -3888,14 +3888,23 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath) ...@@ -3888,14 +3888,23 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
strcpyW(szSearch + dwLen, szAllFiles); strcpyW(szSearch + dwLen, szAllFiles);
hfind = FindFirstFileW(szSearch, &find_data); hfind = FindFirstFileW(szSearch, &find_data);
if (hfind != INVALID_HANDLE_VALUE) if (hfind == INVALID_HANDLE_VALUE)
return FALSE;
do
{ {
if (find_data.cFileName[0] == '.' && find_data.cFileName[1] == '.') if (find_data.cFileName[0] == '.')
/* The only directory entry should be the parent */ {
retVal = !FindNextFileW(hfind, &find_data); if (find_data.cFileName[1] == '\0') continue;
FindClose(hfind); if (find_data.cFileName[1] == '.' && find_data.cFileName[2] == '\0') continue;
}
retVal = FALSE;
break;
} }
while (FindNextFileW(hfind, &find_data));
FindClose(hfind);
return retVal; return retVal;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment