[PATCH v2] ole32: Partially implement OleCreateStaticFromData() for OLERENDER_FORMAT.
Jactry Zeng
jactry92 at gmail.com
Wed Aug 29 03:10:03 CDT 2018
Thanks Huw!
I sent another try.
Huw Davies <huw at codeweavers.com> 于2018年8月29日周三 下午3:29写道:
>
> On Tue, Aug 28, 2018 at 09:25:02PM +0800, Jactry Zeng wrote:
> > Superseded patch 150331.
> > Thanks Zhiyi's advice.
> >
> > For bug 42710: https://bugs.winehq.org/show_bug.cgi?id=42710 .
> >
> > Signed-off-by: Jactry Zeng <jzeng at codeweavers.com>
> > ---
> > dlls/ole32/ole2impl.c | 51 ++++++++++++++++++++++++++++++++++--
> > dlls/ole32/tests/ole2.c | 57 +++++++++++++++++++++++++++++++++++++++++
> > 2 files changed, 106 insertions(+), 2 deletions(-)
> >
> > diff --git a/dlls/ole32/ole2impl.c b/dlls/ole32/ole2impl.c
> > index fa5777beb0..8927267e90 100644
> > --- a/dlls/ole32/ole2impl.c
> > +++ b/dlls/ole32/ole2impl.c
> > @@ -232,9 +232,56 @@ HRESULT WINAPI OleCreateStaticFromData(IDataObject *data, REFIID iid,
> > IOleClientSite *client_site, IStorage *stg,
> > void **obj)
> > {
> > - FIXME("%p,%s,%08x,%p,%p,%p,%p: semi-stub\n",
> > + HRESULT hr;
> > + IOleCache2 *ole_cache = NULL;
> > + IPersistStorage *persist = NULL;
> > + DWORD connection;
> > + STGMEDIUM stgmedium;
> > +
> > + TRACE("(%p, %s, 0x%08x, %p, %p, %p, %p)\n",
> > data, debugstr_guid(iid), renderopt, fmt, client_site, stg, obj);
> > - return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
> > +
> > + if (!obj || !stg)
> > + return E_INVALIDARG;
> > +
> > + if (renderopt != OLERENDER_FORMAT)
> > + {
> > + FIXME("semi-stub\n");
> > + return OleCreateFromData(data, iid, renderopt, fmt, client_site, stg, obj);
> > + }
> > +
> > + if (!fmt)
> > + return E_INVALIDARG;
> > +
> > + hr = CreateDataCache(NULL, &CLSID_NULL, &IID_IOleCache2, (LPVOID *)&ole_cache);
> > + if (FAILED(hr)) goto end;
>
> This should most likely call OleCreateDefaultHandler() instead so that
> you don't need the OleLoad later on.
>
> > +
> > + hr = IOleCache2_Cache(ole_cache, fmt, ADVF_PRIMEFIRST, &connection);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = IDataObject_GetData(data, fmt, &stgmedium);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = IOleCache2_SetData(ole_cache, fmt, &stgmedium, TRUE);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = IOleCache2_QueryInterface(ole_cache, &IID_IPersistStorage, (LPVOID *)&persist);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = IPersistStorage_Save(persist, stg, TRUE);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = IPersistStorage_SaveCompleted(persist, NULL);
> > + if (FAILED(hr)) goto end;
> > +
> > + hr = OleLoad(stg, iid, client_site, obj);
>
>
>
--
Regards,
Jactry Zeng
More information about the wine-devel
mailing list