Commit 18d31c27 authored by David Hedberg's avatar David Hedberg Committed by Alexandre Julliard

shell32: Don't crash on NULL cmdgroup in DefView OleCommandTarget.

parent 208aeedc
...@@ -2258,7 +2258,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryStatus( ...@@ -2258,7 +2258,7 @@ static HRESULT WINAPI ISVOleCmdTarget_QueryStatus(
This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText); This, debugstr_guid(pguidCmdGroup), cCmds, prgCmds, pCmdText);
if (!prgCmds) if (!prgCmds)
return E_POINTER; return E_INVALIDARG;
for (i = 0; i < cCmds; i++) for (i = 0; i < cCmds; i++)
{ {
FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID); FIXME("\tprgCmds[%d].cmdID = %d\n", i, prgCmds[i].cmdID);
...@@ -2285,6 +2285,8 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec( ...@@ -2285,6 +2285,8 @@ static HRESULT WINAPI ISVOleCmdTarget_Exec(
FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n", FIXME("(%p)->(\n\tTarget GUID:%s Command:0x%08x Opt:0x%08x %p %p)\n",
This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut); This, debugstr_guid(pguidCmdGroup), nCmdID, nCmdexecopt, pvaIn, pvaOut);
if (!pguidCmdGroup)
return OLECMDERR_E_UNKNOWNGROUP;
if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) && if (IsEqualIID(pguidCmdGroup, &CGID_Explorer) &&
(nCmdID == 0x29) && (nCmdID == 0x29) &&
(nCmdexecopt == 4) && pvaOut) (nCmdexecopt == 4) && pvaOut)
......
...@@ -1100,6 +1100,49 @@ static void test_GetSetCurrentViewMode(void) ...@@ -1100,6 +1100,49 @@ static void test_GetSetCurrentViewMode(void)
IShellFolder_Release(desktop); 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) START_TEST(shlview)
{ {
OleInitialize(NULL); OleInitialize(NULL);
...@@ -1112,6 +1155,7 @@ START_TEST(shlview) ...@@ -1112,6 +1155,7 @@ START_TEST(shlview)
test_IShellFolderView(); test_IShellFolderView();
test_IOleWindow(); test_IOleWindow();
test_GetSetCurrentViewMode(); test_GetSetCurrentViewMode();
test_IOleCommandTarget();
OleUninitialize(); OleUninitialize();
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment