Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=51640 Signed-off-by: Bernhard Übelacker bernhardu@mailbox.org --- dlls/comdlg32/itemdlg.c | 3 +++ dlls/comdlg32/tests/itemdlg.c | 37 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+)
diff --git a/dlls/comdlg32/itemdlg.c b/dlls/comdlg32/itemdlg.c index d6957d51a66..da1a289bc5a 100644 --- a/dlls/comdlg32/itemdlg.c +++ b/dlls/comdlg32/itemdlg.c @@ -4156,6 +4156,9 @@ static HRESULT WINAPI IFileDialogCustomize_fnRemoveControlItem(IFileDialogCustom
item = get_item(ctrl, dwIDItem, CDCS_VISIBLE|CDCS_ENABLED, &position);
+ if (!item) + return E_INVALIDARG; + if ((item->cdcstate & (CDCS_VISIBLE|CDCS_ENABLED)) == (CDCS_VISIBLE|CDCS_ENABLED)) { if(SendMessageW(ctrl->hwnd, CB_DELETESTRING, position, 0) == CB_ERR) diff --git a/dlls/comdlg32/tests/itemdlg.c b/dlls/comdlg32/tests/itemdlg.c index c38457a0a13..e6060acdf5d 100644 --- a/dlls/comdlg32/tests/itemdlg.c +++ b/dlls/comdlg32/tests/itemdlg.c @@ -2460,6 +2460,42 @@ static void test_overwrite(void) IShellItem_Release(psi_current); }
+static void test_customize_remove_from_empty_combobox(void) +{ + IFileDialog *pfod; + IFileDialogCustomize *pfdc; + UINT i; + HRESULT hr; + hr = CoCreateInstance(&CLSID_FileOpenDialog, NULL, CLSCTX_INPROC_SERVER, + &IID_IFileDialog, (void**)&pfod); + ok(hr == S_OK, "got 0x%08x.\n", hr); + + hr = IFileDialog_QueryInterface(pfod, &IID_IFileDialogCustomize, (void**)&pfdc); + ok(hr == S_OK, "got 0x%08x.\n", hr); + if(FAILED(hr)) + { + skip("Skipping IFileDialogCustomize tests.\n"); + IFileDialog_Release(pfod); + return; + } + + i = 107; + hr = IFileDialogCustomize_AddComboBox(pfdc, i); + ok(hr == S_OK, "got 0x%08x.\n", hr); + + hr = IFileDialogCustomize_RemoveAllControlItems(pfdc, i); + ok(hr == E_NOTIMPL, "got 0x%08x.\n", hr); + + hr = IFileDialogCustomize_SetSelectedControlItem(pfdc, i, 1000); + ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr); + + hr = IFileDialogCustomize_RemoveControlItem(pfdc, i, 0); + ok(hr == E_INVALIDARG, "got 0x%08x.\n", hr); + + IFileDialogCustomize_Release(pfdc); + IFileDialog_Release(pfod); +} + START_TEST(itemdlg) { OleInitialize(NULL); @@ -2474,6 +2510,7 @@ START_TEST(itemdlg) test_customize(); test_persistent_state(); test_overwrite(); + test_customize_remove_from_empty_combobox(); } else skip("Skipping all Item Dialog tests.\n");