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);