Add patch to correctly treat '.' when checking for empty directories.

This commit is contained in:
Michael Müller 2014-09-28 21:48:52 +02:00
parent 9882020ee6
commit 626c7fccd7
4 changed files with 87 additions and 1 deletions

View File

@ -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

View File

@ -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:

View File

@ -0,0 +1,62 @@
From b145c61782e6bfc45d44f4b8877ec53823796751 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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

View File

@ -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