diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 73671c1d962..a6cea0f6db9 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -2258,7 +2258,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); if (!prgCmds) - return E_POINTER; + return E_INVALIDARG; for (i = 0; i < cCmds; i++) { FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID); @@ -2285,6 +2285,8 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec( FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n", This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut); + if (!pguidCmdGroup) + return OLECMDERR_E_UNKNOWNGROUP; if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) && (nCmdID == 0x29) && (nCmdexecopt == 4) && pvaOut) diff --git a/dlls/shell32/tests/shlview.c b/dlls/shell32/tests/shlview.c index bfb6870a432..271f9bc2e18 100644 --- a/dlls/shell32/tests/shlview.c +++ b/dlls/shell32/tests/shlview.c @@ -1100,6 +1100,49 @@ static void test_GetSetCurrentViewMode(void) IShellFolder_Release(desktop); } +static void test_IOleCommandTarget(void) +{ + IShellFolder *psf_desktop; + IShellView *psv; + IOleCommandTarget *poct; + HRESULT hr; + + hr = SHGetDesktopFolder(&psf_desktop); + ok(hr == S_OK, "got (0x%08x)\n", hr); + + hr = IShellFolder_CreateViewObject(psf_desktop, NULL, &IID_IShellView, (void**)&psv); + ok(hr == S_OK, "got (0x%08x)\n", hr); + if(SUCCEEDED(hr)) + { + hr = IShellView_QueryInterface(psv, &IID_IOleCommandTarget, (void**)&poct); + ok(hr == S_OK || broken(hr == E_NOINTERFACE) /* Win95/NT4 */, "Got 0x%08x\n", hr); + if(SUCCEEDED(hr)) + { + OLECMD oc; + + hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, NULL, NULL); + ok(hr == E_INVALIDARG, "Got 0x%08x\n", hr); + + oc.cmdID = 1; + hr = IOleCommandTarget_QueryStatus(poct, NULL, 0, &oc, NULL); + ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr); + + oc.cmdID = 1; + hr = IOleCommandTarget_QueryStatus(poct, NULL, 1, &oc, NULL); + ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr); + + hr = IOleCommandTarget_Exec(poct, NULL, 0, 0, NULL, NULL); + ok(hr == OLECMDERR_E_UNKNOWNGROUP, "Got 0x%08x\n", hr); + + IOleCommandTarget_Release(poct); + } + + IShellView_Release(psv); + } + + IShellFolder_Release(psf_desktop); +} + START_TEST(shlview) { OleInitialize(NULL); @@ -1112,6 +1155,7 @@ START_TEST(shlview) test_IShellFolderView(); test_IOleWindow(); test_GetSetCurrentViewMode(); + test_IOleCommandTarget(); OleUninitialize(); }