https://git.reactos.org/?p=reactos.git;a=commitdiff;h=19d88628515506f939238…
commit 19d88628515506f9392384ae45bc7d38d1e9708a
Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com>
AuthorDate: Mon Jun 19 14:15:18 2023 +0900
Commit: GitHub <noreply(a)github.com>
CommitDate: Mon Jun 19 14:15:18 2023 +0900
[MSPAINT] Fix CMainWindow::GetSaveFileName (#5356)
Fix filename extension cases and "File Type" field. If no filename extension
on save, then append ".png" to the filename.
CORE-18867
---
base/applications/mspaint/main.cpp | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp
index b3b6728fd94..cbe3574698d 100644
--- a/base/applications/mspaint/main.cpp
+++ b/base/applications/mspaint/main.cpp
@@ -123,13 +123,18 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT
cchMaxFile)
sfn.lpfnHook = OFNHookProc;
sfn.lpstrDefExt = L"png";
- // Choose PNG
- for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
+ LPWSTR pchDotExt = PathFindExtensionW(pszFile);
+ if (*pchDotExt == UNICODE_NULL)
{
- if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
+ // Choose PNG
+ wcscat(pszFile, L".png");
+ for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i)
{
- sfn.nFilterIndex = i + 1;
- break;
+ if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG)
+ {
+ sfn.nFilterIndex = i + 1;
+ break;
+ }
}
}
}