Dmitry Timoshkov dmitry@codeweavers.com writes:
sf = LocalAlloc( LMEM_ZEROINIT, sizeof (IGenericSFImpl) );
if (!sf)
return E_OUTOFMEMORY;
if (InterlockedCompareExchangePointer((void *)&cached_sf, sf, NULL) != NULL)
LocalFree( sf ); /* some other thread already been here */
else
{
sf->ref = 0;
sf->lpVtbl = &vt_MCFldr_ShellFolder2;
sf->pidlRoot = _ILCreateDesktop(); /* my qualified pidl */
sf->sPathTarget = SHAlloc( (lstrlenW(szMyPath) + 1)*sizeof(WCHAR) );
lstrcpyW( sf->sPathTarget, szMyPath );
}
- }
You need to initialize the object completely before storing it as cached entry.