From 626c7fccd7bbb5042e724742d75fc8c79baa48ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 28 Sep 2014 21:48:52 +0200 Subject: [PATCH] Add patch to correctly treat '.' when checking for empty directories. --- README.md | 3 +- patches/Makefile | 19 ++++++ ...y-treat-.-when-enumerating-files-in-.patch | 62 +++++++++++++++++++ .../shlwapi-PathIsDirectoryEmptyW/definition | 4 ++ 4 files changed, 87 insertions(+), 1 deletion(-) create mode 100644 patches/shlwapi-PathIsDirectoryEmptyW/0001-shlwapi-Correctly-treat-.-when-enumerating-files-in-.patch create mode 100644 patches/shlwapi-PathIsDirectoryEmptyW/definition diff --git a/README.md b/README.md index e18fcfc8..894daa76 100644 --- a/README.md +++ b/README.md @@ -35,8 +35,9 @@ Wine. All those differences are also documented on the Included bugfixes and improvements ================================== -**Bugfixes and features included in the next upcoming release [5]:** +**Bugfixes and features included in the next upcoming release [6]:** +* Correctly treat '.' when checking for empty directories ([Wine Bug #26272](http://bugs.winehq.org/show_bug.cgi?id=26272)) * Fix issues when driver dispatch routine returns different status codes ([Wine Bug #30155](http://bugs.winehq.org/show_bug.cgi?id=30155)) * Send WM_PAINT event during dialog creation ([Wine Bug #35652](http://bugs.winehq.org/show_bug.cgi?id=35652)) * Support for FIND_FIRST_EX_CASE_SENSITIVE flag in FindFirstFileExW diff --git a/patches/Makefile b/patches/Makefile index 1f8f806f..2490008b 100644 --- a/patches/Makefile +++ b/patches/Makefile @@ -63,6 +63,7 @@ PATCHLIST := \ shell32-Icons.ok \ shell32-RunDLL_CallEntry16.ok \ shell32-SHCreateSessionKey.ok \ + shlwapi-PathIsDirectoryEmptyW.ok \ shlwapi-UrlCombine.ok \ user32-Dialog_Paint_Event.ok \ user32-GetSystemMetrics.ok \ @@ -1001,6 +1002,24 @@ shell32-SHCreateSessionKey.ok: echo '+ { "shell32-SHCreateSessionKey", "Dmitry Timoshkov", "shell32: Implement SHCreateSessionKey." },'; \ ) > shell32-SHCreateSessionKey.ok +# Patchset shlwapi-PathIsDirectoryEmptyW +# | +# | Included patches: +# | * Correctly treat '.' when enumerating files in PathIsDirectoryEmptyW. [by Michael Müller] +# | +# | This patchset fixes the following Wine bugs: +# | * [#26272] Correctly treat '.' when checking for empty directories +# | +# | Modified files: +# | * dlls/shlwapi/path.c +# | +.INTERMEDIATE: shlwapi-PathIsDirectoryEmptyW.ok +shlwapi-PathIsDirectoryEmptyW.ok: + $(call APPLY_FILE,shlwapi-PathIsDirectoryEmptyW/0001-shlwapi-Correctly-treat-.-when-enumerating-files-in-.patch) + @( \ + echo '+ { "shlwapi-PathIsDirectoryEmptyW", "Michael Müller", "Correctly treat '\''.'\'' when enumerating files in PathIsDirectoryEmptyW." },'; \ + ) > shlwapi-PathIsDirectoryEmptyW.ok + # Patchset shlwapi-UrlCombine # | # | Included patches: diff --git a/patches/shlwapi-PathIsDirectoryEmptyW/0001-shlwapi-Correctly-treat-.-when-enumerating-files-in-.patch b/patches/shlwapi-PathIsDirectoryEmptyW/0001-shlwapi-Correctly-treat-.-when-enumerating-files-in-.patch new file mode 100644 index 00000000..28a30a50 --- /dev/null +++ b/patches/shlwapi-PathIsDirectoryEmptyW/0001-shlwapi-Correctly-treat-.-when-enumerating-files-in-.patch @@ -0,0 +1,62 @@ +From b145c61782e6bfc45d44f4b8877ec53823796751 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sun, 28 Sep 2014 17:30:45 +0200 +Subject: shlwapi: Correctly treat '.' when enumerating files in + PathIsDirectoryEmptyW. + +--- + dlls/shlwapi/path.c | 23 ++++++++++++++++------- + 1 file changed, 16 insertions(+), 7 deletions(-) + +diff --git a/dlls/shlwapi/path.c b/dlls/shlwapi/path.c +index 5c7a88a..051ce0f 100644 +--- a/dlls/shlwapi/path.c ++++ b/dlls/shlwapi/path.c +@@ -3870,13 +3870,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); +@@ -3886,14 +3886,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; + } + +-- +1.9.1 + diff --git a/patches/shlwapi-PathIsDirectoryEmptyW/definition b/patches/shlwapi-PathIsDirectoryEmptyW/definition new file mode 100644 index 00000000..4508af50 --- /dev/null +++ b/patches/shlwapi-PathIsDirectoryEmptyW/definition @@ -0,0 +1,4 @@ +Author: Michael Müller +Subject: Correctly treat '.' when enumerating files in PathIsDirectoryEmptyW. +Revision: 1 +Fixes: [26272] Correctly treat '.' when checking for empty directories