Deal with the case of loading an empty PIDL from a stream better in
ILLoadFromStream.
This commit is contained in:
parent
0ab73312c8
commit
72d8aa5ec2
|
@ -279,25 +279,35 @@ HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl)
|
||||||
IStream_AddRef (pStream);
|
IStream_AddRef (pStream);
|
||||||
|
|
||||||
if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead)))
|
if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead)))
|
||||||
{ *ppPidl = SHAlloc (wLen);
|
{
|
||||||
if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead)))
|
TRACE("PIDL length is %d\n", wLen);
|
||||||
{ ret = S_OK;
|
if (wLen != 0) {
|
||||||
}
|
*ppPidl = SHAlloc (wLen);
|
||||||
else
|
if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead))) {
|
||||||
{ SHFree(*ppPidl);
|
TRACE("Stream read OK\n");
|
||||||
|
ret = S_OK;
|
||||||
|
} else {
|
||||||
|
WARN("reading pidl failed\n");
|
||||||
|
SHFree(*ppPidl);
|
||||||
|
*ppPidl = NULL;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
*ppPidl = NULL;
|
*ppPidl = NULL;
|
||||||
|
ret = S_OK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we are not yet fully compatible */
|
/* we are not yet fully compatible */
|
||||||
if (!pcheck(*ppPidl))
|
if (*ppPidl && !pcheck(*ppPidl))
|
||||||
{ SHFree(*ppPidl);
|
{
|
||||||
|
WARN("Check failed\n");
|
||||||
|
SHFree(*ppPidl);
|
||||||
*ppPidl = NULL;
|
*ppPidl = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
IStream_Release (pStream);
|
IStream_Release (pStream);
|
||||||
|
TRACE("done\n");
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue