Commit a528ddd7 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shell32/shellview: Handle NULL folder pointer in SHCreateShellFolderViewEx().

parent 7a49da50
...@@ -3806,6 +3806,9 @@ HRESULT WINAPI SHCreateShellFolderViewEx(CSFV *desc, IShellView **shellview) ...@@ -3806,6 +3806,9 @@ HRESULT WINAPI SHCreateShellFolderViewEx(CSFV *desc, IShellView **shellview)
TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", desc->pshf, desc->pidl, desc->pfnCallback, TRACE("sf=%p pidl=%p cb=%p mode=0x%08x parm=%p\n", desc->pshf, desc->pidl, desc->pfnCallback,
desc->fvm, desc->psvOuter); desc->fvm, desc->psvOuter);
if (!desc->pshf)
return E_UNEXPECTED;
*shellview = IShellView_Constructor(desc->pshf); *shellview = IShellView_Constructor(desc->pshf);
if (!*shellview) if (!*shellview)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
......
...@@ -1433,6 +1433,16 @@ static void test_SHCreateShellFolderViewEx(void) ...@@ -1433,6 +1433,16 @@ static void test_SHCreateShellFolderViewEx(void)
ok(refCount == 0, "refCount = %u\n", refCount); ok(refCount == 0, "refCount = %u\n", refCount);
} }
if (0)
{
/* Crashes on null shellfolder, on XP/2k3 */
memset(&csfv, 0, sizeof(csfv));
csfv.pshf = NULL;
psv = (void *)0xdeadbeef;
hr = SHCreateShellFolderViewEx(&csfv, &psv);
ok(hr == E_UNEXPECTED, "Got 0x%08x\n", hr);
ok(psv == NULL, "psv = %p\n", psv);
}
memset(&csfv, 0, sizeof(csfv)); memset(&csfv, 0, sizeof(csfv));
csfv.cbSize = sizeof(csfv); csfv.cbSize = sizeof(csfv);
csfv.pshf = desktop; csfv.pshf = desktop;
......
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