From a9f96ad60a548600eb3524e82d1c96d55257c9d8 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 11 May 2009 13:49:24 +0100 Subject: [PATCH] ole32: Beginnings of OleCreateFromDataEx. --- dlls/ole32/ole2impl.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 52 insertions(+), 3 deletions(-) diff --git a/dlls/ole32/ole2impl.c b/dlls/ole32/ole2impl.c index f7da399e69a..dd65e885a2e 100644 --- a/dlls/ole32/ole2impl.c +++ b/dlls/ole32/ole2impl.c @@ -84,6 +84,44 @@ HRESULT WINAPI OleQueryCreateFromData(IDataObject *data) return found_static ? OLE_S_STATIC : S_FALSE; } +static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed) +{ + fmt->cfFormat = cf; + fmt->ptd = NULL; + fmt->dwAspect = DVASPECT_CONTENT; + fmt->lindex = -1; + fmt->tymed = tymed; +} + +/*************************************************************************** + * get_storage + * + * Retrieve an object's storage from a variety of sources. + * + * FIXME: CF_EMBEDDEDOBJECT, CF_FILENAME, IPersistStorage. + */ +static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf) +{ + HRESULT hr; + FORMATETC fmt; + STGMEDIUM med; + + *src_cf = 0; + + /* CF_EMBEDSOURCE */ + init_fmtetc(&fmt, embed_source_clipboard_format, TYMED_ISTORAGE); + med.tymed = TYMED_ISTORAGE; + med.u.pstg = stg; + hr = IDataObject_GetDataHere(data, &fmt, &med); + if(SUCCEEDED(hr)) + { + *src_cf = embed_source_clipboard_format; + return hr; + } + + return hr; +} + /****************************************************************************** * OleCreateFromDataEx [OLE32.@] * @@ -91,15 +129,26 @@ HRESULT WINAPI OleQueryCreateFromData(IDataObject *data) * the clipboard or OLE drag and drop. */ HRESULT WINAPI OleCreateFromDataEx(IDataObject *data, REFIID iid, DWORD flags, - DWORD renderopt, ULONG num_fmts, DWORD *adv_flags, FORMATETC *fmts, + DWORD renderopt, ULONG num_cache_fmts, DWORD *adv_flags, FORMATETC *cache_fmts, IAdviseSink *sink, DWORD *conns, IOleClientSite *client_site, IStorage *stg, void **obj) { + HRESULT hr; + UINT src_cf; + FIXME("(%p, %s, %08x, %08x, %d, %p, %p, %p, %p, %p, %p, %p): stub\n", - data, debugstr_guid(iid), flags, renderopt, num_fmts, adv_flags, fmts, + data, debugstr_guid(iid), flags, renderopt, num_cache_fmts, adv_flags, cache_fmts, sink, conns, client_site, stg, obj); - return E_NOTIMPL; + hr = get_storage(data, stg, &src_cf); + if(FAILED(hr)) return hr; + + hr = OleLoad(stg, iid, client_site, obj); + if(FAILED(hr)) return hr; + + /* FIXME: Init cache */ + + return hr; } /****************************************************************************** -- 2.11.4.GIT