Eryk Wieliczko : comdlg32: GetSaveFileName: Don't append .* extension.

Alexandre Julliard julliard at winehq.org
Tue Nov 2 11:11:01 CDT 2010


Module: wine
Branch: master
Commit: bd0fe7d26bafebc2e51ec54d354bf1e41bc3892e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=bd0fe7d26bafebc2e51ec54d354bf1e41bc3892e

Author: Eryk Wieliczko <ewdevel at gmail.com>
Date:   Mon Nov  1 12:35:43 2010 +0100

comdlg32: GetSaveFileName: Don't append .* extension.

---

 dlls/comdlg32/filedlg.c |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c
index 2687029..f36d3a5 100644
--- a/dlls/comdlg32/filedlg.c
+++ b/dlls/comdlg32/filedlg.c
@@ -2474,14 +2474,11 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
             /* if no extension is specified with file name, then */
             /* attach the extension from file filter or default one */
             
-            WCHAR *filterExt = NULL;
+            const WCHAR *filterExt = NULL;
             LPWSTR lpstrFilter = NULL;
             static const WCHAR szwDot[] = {'.',0};
             int PathLength = lstrlenW(lpstrPathAndFile);
 
-            /* Attach the dot*/
-            lstrcatW(lpstrPathAndFile, szwDot);
-    
             /*Get the file extension from file type filter*/
             lpstrFilter = (LPWSTR) CBGetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB,
                                              fodInfos->ofnInfos->nFilterIndex-1);
@@ -2490,9 +2487,18 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
                 filterExt = PathFindExtensionW(lpstrFilter);
 
             if ( filterExt && *filterExt ) /* attach the file extension from file type filter*/
-                lstrcatW(lpstrPathAndFile, filterExt + 1);
+                filterExt = filterExt + 1;
             else if ( fodInfos->defext ) /* attach the default file extension*/
-                lstrcatW(lpstrPathAndFile, fodInfos->defext);
+                filterExt = fodInfos->defext;
+
+            /* If extension is .*, ignore it */
+            if (filterExt[0] != '*')
+            {
+                /* Attach the dot*/
+                lstrcatW(lpstrPathAndFile, szwDot);
+                /* Attach the extension */
+                lstrcatW(lpstrPathAndFile, filterExt );
+            }
 
             /* In Open dialog: if file does not exist try without extension */
             if (!(fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) && !PathFileExistsW(lpstrPathAndFile))




More information about the wine-cvs mailing list