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)
WCHAR szSearch[MAX_PATH];
DWORD dwLen;
HANDLE hfind;
BOOL retVal = FALSE;
BOOL retVal = TRUE;
WIN32_FIND_DATAW find_data;
TRACE("(%s)\n",debugstr_w(lpszPath));
if (!lpszPath || !PathIsDirectoryW(lpszPath))
return FALSE;
return FALSE;
lstrcpynW(szSearch, lpszPath, MAX_PATH);
PathAddBackslashW(szSearch);
......@@ -3888,14 +3888,23 @@ BOOL WINAPI PathIsDirectoryEmptyW(LPCWSTR lpszPath)
strcpyW(szSearch + dwLen, szAllFiles);
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] == '.')
/* The only directory entry should be the parent */
retVal = !FindNextFileW(hfind, &find_data);
FindClose(hfind);
if (find_data.cFileName[0] == '.')
{
if (find_data.cFileName[1] == '\0') continue;
if (find_data.cFileName[1] == '.' && find_data.cFileName[2] == '\0') continue;
}
retVal = FALSE;
break;
}
while (FindNextFileW(hfind, &find_data));
FindClose(hfind);
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