Re: shell32: Make SHGetDesktopFolder use a cached instance of IShellFolder
Dmitry Timoshkov <dmitry(a)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(a)winehq.org
participants (1)
-
Alexandre Julliard