From 63eb8104288f0b3731902d41d4687ed7d2fd0ef7 Mon Sep 17 00:00:00 2001 From: Huw Davies Date: Mon, 11 May 2009 13:51:49 +0100 Subject: [PATCH] ole32: Add support for retrieving data from IPersistStorage. --- dlls/ole32/ole2impl.c | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/ole32/ole2impl.c b/dlls/ole32/ole2impl.c index dd65e885a2..b37ced6444 100644 --- a/dlls/ole32/ole2impl.c +++ b/dlls/ole32/ole2impl.c @@ -98,13 +98,15 @@ static inline void init_fmtetc(FORMATETC *fmt, CLIPFORMAT cf, TYMED tymed) * * Retrieve an object's storage from a variety of sources. * - * FIXME: CF_EMBEDDEDOBJECT, CF_FILENAME, IPersistStorage. + * FIXME: CF_EMBEDDEDOBJECT, CF_FILENAME. */ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf) { HRESULT hr; FORMATETC fmt; STGMEDIUM med; + IPersistStorage *persist; + CLSID clsid; *src_cf = 0; @@ -119,6 +121,24 @@ static HRESULT get_storage(IDataObject *data, IStorage *stg, UINT *src_cf) return hr; } + /* IPersistStorage */ + hr = IDataObject_QueryInterface(data, &IID_IPersistStorage, (void**)&persist); + if(FAILED(hr)) return hr; + + hr = IPersistStorage_GetClassID(persist, &clsid); + if(FAILED(hr)) goto end; + + hr = IStorage_SetClass(stg, &clsid); + if(FAILED(hr)) goto end; + + hr = IPersistStorage_Save(persist, stg, FALSE); + if(FAILED(hr)) goto end; + + hr = IPersistStorage_SaveCompleted(persist, NULL); + +end: + IPersistStorage_Release(persist); + return hr; }