Robert Shearman : ole32: Re-order the function calls in OleLoad to match native.
Module: wine Branch: master Commit: 4ad8da53f5946965a1461f38be956ec58a9b0c25 URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=4ad8da53f5946965a1461f38... Author: Robert Shearman <rob(a)codeweavers.com> Date: Thu Aug 31 17:17:55 2006 +0100 ole32: Re-order the function calls in OleLoad to match native. Call IOleObject_GetMiscStatus like OleCreate and native do. --- dlls/ole32/ole2.c | 50 ++++++++++++++++++++++++++++++++++---------------- 1 files changed, 34 insertions(+), 16 deletions(-) diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index e2d9d9d..8f0629c 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -952,12 +952,15 @@ HRESULT WINAPI OleLoad( LPVOID* ppvObj) { IPersistStorage* persistStorage = NULL; - IOleObject* oleObject = NULL; + IUnknown* pUnk; + IOleObject* pOleObject = NULL; STATSTG storageInfo; HRESULT hres; TRACE("(%p,%p,%p,%p)\n", pStg, riid, pClientSite, ppvObj); + *ppvObj = NULL; + /* * TODO, Conversion ... OleDoAutoConvert */ @@ -973,8 +976,8 @@ HRESULT WINAPI OleLoad( hres = CoCreateInstance(&storageInfo.clsid, NULL, CLSCTX_INPROC_HANDLER, - &IID_IOleObject, - (void**)&oleObject); + riid, + (void**)&pUnk); /* * If that fails, as it will most times, load the default @@ -984,8 +987,8 @@ HRESULT WINAPI OleLoad( { hres = OleCreateDefaultHandler(&storageInfo.clsid, NULL, - &IID_IOleObject, - (void**)&oleObject); + riid, + (void**)&pUnk); } /* @@ -994,35 +997,50 @@ HRESULT WINAPI OleLoad( if (FAILED(hres)) return hres; - /* - * Inform the new object of it's client site. - */ - hres = IOleObject_SetClientSite(oleObject, pClientSite); + if (pClientSite) + { + hres = IUnknown_QueryInterface(pUnk, &IID_IOleObject, (void **)&pOleObject); + if (SUCCEEDED(hres)) + { + DWORD dwStatus; + hres = IOleObject_GetMiscStatus(pOleObject, DVASPECT_CONTENT, &dwStatus); + } + } /* * Initialize the object with it's IPersistStorage interface. */ - hres = IOleObject_QueryInterface(oleObject, + hres = IOleObject_QueryInterface(pUnk, &IID_IPersistStorage, (void**)&persistStorage); if (SUCCEEDED(hres)) { - IPersistStorage_Load(persistStorage, pStg); + hres = IPersistStorage_Load(persistStorage, pStg); IPersistStorage_Release(persistStorage); persistStorage = NULL; } - /* - * Return the requested interface to the caller. - */ - hres = IOleObject_QueryInterface(oleObject, riid, ppvObj); + if (SUCCEEDED(hres) && pClientSite) + /* + * Inform the new object of it's client site. + */ + hres = IOleObject_SetClientSite(pOleObject, pClientSite); /* * Cleanup interfaces used internally */ - IOleObject_Release(oleObject); + if (pOleObject) + IOleObject_Release(pOleObject); + + if (FAILED(hres)) + { + IUnknown_Release(pUnk); + pUnk = NULL; + } + + *ppvObj = pUnk; return hres; }
participants (1)
-
Alexandre Julliard