comdlg32: File dialog: Append multi-part extensions like .abc.def

Joachim Priesner joachim.priesner at web.de
Tue Jun 2 17:14:08 CDT 2015


---
 dlls/comdlg32/filedlg.c       | 5 +++--
 dlls/comdlg32/tests/filedlg.c | 5 +++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 2890108..1453396 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -2596,10 +2596,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
                     filterSearchIndex[0] = '\0';
                 }
 
+                /* find the file extension by searching for the first dot in filterExt */
                 /* strip the * or anything else from the extension, "*.abc" becomes "abc" */
                 /* if the extension is invalid or contains a glob, ignore it */
-                filterSearchIndex = PathFindExtensionW(filterExt);
-                if (*filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
+                filterSearchIndex = strchrW(filterExt, '.');
+                if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
                 {
                     strcpyW(filterExt, filterSearchIndex);
                 }
diff --git a/dlls/comdlg32/tests/filedlg.c b/dlls/comdlg32/tests/filedlg.c
index e3d9bc7..49a430c 100644
--- a/dlls/comdlg32/tests/filedlg.c
+++ b/dlls/comdlg32/tests/filedlg.c
@@ -1130,6 +1130,11 @@ static void test_extension(void)
     for (i = 0; i < ARRAY_SIZE(defext_wildcard_filters); i++) {
         test_extension_helper(&ofn, defext_wildcard_filters[i], "deadbeef.xyz");
     }
+
+    /* Append valid extensions consisting of multiple parts */
+    test_extension_helper(&ofn, "TestFilter (*.abc.def)\0*.abc.def\0", "deadbeef.abc.def");
+    test_extension_helper(&ofn, "TestFilter (.abc.def)\0.abc.def\0", "deadbeef.abc.def");
+    test_extension_helper(&ofn, "TestFilter (*.*.def)\0*.*.def\0", "deadbeef.xyz");
 }
 
 #undef ARRAY_SIZE
-- 
1.8.4.5




More information about the wine-patches mailing list