On Tue, May 02, 2017 at 06:11:22PM +0800, Wei Xie wrote:
diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c index 441a874..51a67e2 100644 --- a/dlls/ole32/datacache.c +++ b/dlls/ole32/datacache.c @@ -2052,8 +2052,45 @@ static HRESULT WINAPI DataCache_InitCache( IOleCache2* iface, IDataObject* pDataObject) {
- FIXME("stub\n");
- return E_NOTIMPL;
- HRESULT hr;
- FORMATETC fmt;
- STGMEDIUM med;
- FIXME("semi-stub\n");
- hr = IDataObject_GetData(pDataObject, &fmt, &med);
- if (FAILED(hr))
- {
return CACHE_E_NOCACHE_UPDATED;
- }
- if (!fmt.cfFormat || !fmt.tymed ||
(check_valid_clipformat_and_tymed(fmt.cfFormat, fmt.tymed, FALSE)
&& TYMED_NULL != med.tymed))
- {
switch(med.tymed)
{
case TYMED_GDI:
{
fmt.cfFormat = CF_BITMAP;
fmt.ptd = NULL;
fmt.dwAspect = DVASPECT_CONTENT;
fmt.lindex = -1;
fmt.tymed = TYMED_GDI;
}
break;
default:
FIXME("Fill formatetc\n");
}
- }
- hr = IOleCache2_SetData(iface, &fmt, &med, FALSE);
- if (FAILED(hr))
- {
return CACHE_E_NOCACHE_UPDATED;
- }
- return hr;
}
This isn't correct. What I think the tests will show you is that it looks something like the pseudo-code:
for_each_cached_format( &fmt ) /* some function that returns the fmt of each cache entry */ { IDataObject_GetData(pDataObject, &fmt, &med); IOleCache2_SetData(iface, &fmt, &med); }
Of course there needs to be error handling, tests if the cache has already been initialized, etc.
However for now I suggest you just concerntrate on getting the tests in, and come back to this and the subsequent patches later on.
Huw.