[PATCH 1/2] comdlg32: GetSaveFileName don't append .* extension anymore.
Eryk Wieliczko
ewdevel at gmail.com
Mon Nov 1 06:35:43 CDT 2010
Simple change to make GetSaveFileNameA/W ignore the extension if it's "All files (*.*)"
Fixes bug 18853. Probably fixes bugs 9548 and 15640.
---
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))
--
1.7.0.4
More information about the wine-patches
mailing list