https://git.reactos.org/?p=reactos.git;a=commitdiff;h=6911fab69ad1a4a147c9dc...
commit 6911fab69ad1a4a147c9dceaf52ecfee61055c77 Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Tue Sep 19 22:17:48 2023 +0900 Commit: GitHub noreply@github.com CommitDate: Tue Sep 19 22:17:48 2023 +0900
[COMDLG32] Implement CDM_SETDEFEXT (#5704)
- CDM_SETDEFEXT message handling was a missing feature of COMDLG32. - Make info->defext dynamic allocation. - On CDM_SETDEFEXT handling, replace info->defext data. CORE-15020 --- dll/win32/comdlg32/filedlg.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)
diff --git a/dll/win32/comdlg32/filedlg.c b/dll/win32/comdlg32/filedlg.c index 8aa8eae3987..0adb3357b3a 100644 --- a/dll/win32/comdlg32/filedlg.c +++ b/dll/win32/comdlg32/filedlg.c @@ -552,7 +552,17 @@ static void init_filedlg_infoW(OPENFILENAMEW *ofn, FileOpenDlgInfos *info) info->ofnInfos = ofn;
info->title = ofn->lpstrTitle; +#ifdef __REACTOS__ + if (ofn->lpstrDefExt) + { + INT cchExt = lstrlenW(ofn->lpstrDefExt); + LPWSTR pszExt = heap_alloc((cchExt + 1) * sizeof(WCHAR)); + lstrcpyW(pszExt, ofn->lpstrDefExt); + info->defext = pszExt; + } +#else info->defext = ofn->lpstrDefExt; +#endif info->filter = ofn->lpstrFilter; info->customfilter = ofn->lpstrCustomFilter;
@@ -697,6 +707,12 @@ static BOOL GetFileDialog95(FileOpenDlgInfos *info, UINT dlg_type) heap_free((void *)info->filter); heap_free((void *)info->customfilter); } +#ifdef __REACTOS__ + else + { + heap_free((void *)info->defext); + } +#endif
heap_free(info->filename); heap_free(info->initdir); @@ -1207,6 +1223,34 @@ static INT_PTR FILEDLG95_HandleCustomDialogMessages(HWND hwnd, UINT uMsg, WPARAM else retval = FALSE; break;
+#ifdef __REACTOS__ + case CDM_SETDEFEXT: + { + LPWSTR olddefext = (LPWSTR)fodInfos->defext; + fodInfos->defext = NULL; + + if (fodInfos->unicode) + { + LPCWSTR pszExt = (LPCWSTR)lParam; + if (pszExt) + { + INT cchExt = lstrlenW(pszExt); + fodInfos->defext = heap_alloc((cchExt + 1) * sizeof(WCHAR)); + lstrcpyW((LPWSTR)fodInfos->defext, pszExt); + } + } + else + { + LPCSTR pszExt = (LPCSTR)lParam; + if (pszExt) + fodInfos->defext = heap_strdupAtoW(pszExt); + } + + heap_free(olddefext); + break; + } +#endif + default: if (uMsg >= CDM_FIRST && uMsg <= CDM_LAST) FIXME("message CDM_FIRST+%04x not implemented\n", uMsg - CDM_FIRST);