commdlg: Malformed filters are still added to the filter combo box.

This commit is contained in:
Mike McCormack 2006-03-26 11:35:52 +09:00 committed by Alexandre Julliard
parent 316e5835a0
commit 05eaadc1f7
1 changed files with 7 additions and 4 deletions

View File

@ -2367,16 +2367,19 @@ static HRESULT FILEDLG95_FILETYPE_Init(HWND hwnd)
lpstrDisplay = lpstrPos;
lpstrPos += strlenW(lpstrPos) + 1;
CBAddStringW(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
nFilters++;
/* malformed filters are added anyway... */
if (!*lpstrPos) break;
/* Copy the extensions */
if (! *lpstrPos) return E_FAIL; /* malformed filter */
if (!(lpstrExt = MemAlloc((strlenW(lpstrPos)+1)*sizeof(WCHAR)))) return E_FAIL;
strcpyW(lpstrExt,lpstrPos);
lpstrPos += strlenW(lpstrPos) + 1;
/* Add the item at the end of the combo */
CBAddStringW(fodInfos->DlgInfos.hwndFileTypeCB, lpstrDisplay);
CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters, lpstrExt);
nFilters++;
CBSetItemDataPtr(fodInfos->DlgInfos.hwndFileTypeCB, nFilters-1, lpstrExt);
}
}