From bd0fe7d26bafebc2e51ec54d354bf1e41bc3892e Mon Sep 17 00:00:00 2001 From: Eryk Wieliczko Date: Mon, 1 Nov 2010 12:35:43 +0100 Subject: [PATCH] comdlg32: GetSaveFileName: Don't append .* extension. --- dlls/comdlg32/filedlg.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dlls/comdlg32/filedlg.c b/dlls/comdlg32/filedlg.c index 2687029d89b..f36d3a51cb5 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))