shell32: Make SHGetDesktopFolder use a cached instance of
IShellFolder
Alexandre Julliard
julliard at winehq.org
Thu Jun 21 06:33:28 CDT 2007
Dmitry Timoshkov <dmitry at 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.
--
Alexandre Julliard
julliard at winehq.org
More information about the wine-devel
mailing list