diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 99710ad00a..919b7b0a2a 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -135,6 +135,42 @@ LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl) return newpidl; } +/************************************************************************* + * ILLoadFromStream + * + * NOTES + * the first two bytes are the len, the pidl is following then + */ +HRESULT WINAPI ILLoadFromStream (IStream * pStream, LPITEMIDLIST * ppPidl) +{ WORD wLen = 0; + DWORD dwBytesRead; + HRESULT ret = E_FAIL; + + + TRACE(shell,"%p %p\n", pStream , ppPidl); + + if (*ppPidl) + { SHFree(*ppPidl); + *ppPidl = NULL; + } + + IStream_AddRef (pStream); + + if (SUCCEEDED(IStream_Read(pStream, (LPVOID)&wLen, 2, &dwBytesRead))) + { *ppPidl = SHAlloc (wLen); + if (SUCCEEDED(IStream_Read(pStream, *ppPidl , wLen, &dwBytesRead))) + { ret = S_OK; + } + else + { SHFree(*ppPidl); + *ppPidl = NULL; + } + } + + IStream_Release (pStream); + + return ret; +} /************************************************************************* * SHILCreateFromPath [SHELL32.28] *