ole32: Lock item container on BindToStorage().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2020-01-28 10:32:21 +03:00 committed by Alexandre Julliard
parent 25ad349d30
commit 0187babcc6
2 changed files with 20 additions and 19 deletions

View File

@ -462,33 +462,31 @@ static HRESULT WINAPI ItemMonikerImpl_BindToObject(IMoniker* iface,
/******************************************************************************
* ItemMoniker_BindToStorage
******************************************************************************/
static HRESULT WINAPI ItemMonikerImpl_BindToStorage(IMoniker* iface,
IBindCtx* pbc,
IMoniker* pmkToLeft,
REFIID riid,
VOID** ppvResult)
static HRESULT WINAPI ItemMonikerImpl_BindToStorage(IMoniker *iface, IBindCtx *pbc, IMoniker *pmkToLeft, REFIID riid,
void **ppvResult)
{
ItemMonikerImpl *This = impl_from_IMoniker(iface);
HRESULT res;
IOleItemContainer *poic=0;
ItemMonikerImpl *moniker = impl_from_IMoniker(iface);
IOleItemContainer *container;
HRESULT hr;
TRACE("(%p,%p,%p,%s,%p)\n",iface,pbc,pmkToLeft,debugstr_guid(riid),ppvResult);
TRACE("%p, %p, %p, %s, %p.\n", iface, pbc, pmkToLeft, debugstr_guid(riid), ppvResult);
*ppvResult=0;
*ppvResult = 0;
if(pmkToLeft==NULL)
if (!pmkToLeft)
return E_INVALIDARG;
res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic);
hr = IMoniker_BindToObject(pmkToLeft, pbc, NULL, &IID_IOleItemContainer, (void **)&container);
if (SUCCEEDED(hr))
{
if (FAILED(hr = set_container_lock(container, pbc)))
WARN("Failed to lock container, hr %#x.\n", hr);
if (SUCCEEDED(res)){
res=IOleItemContainer_GetObjectStorage(poic,This->itemName,pbc,riid,ppvResult);
IOleItemContainer_Release(poic);
hr = IOleItemContainer_GetObjectStorage(container, moniker->itemName, pbc, riid, ppvResult);
IOleItemContainer_Release(container);
}
return res;
return hr;
}
/******************************************************************************

View File

@ -380,7 +380,7 @@ static HRESULT WINAPI test_item_container_GetObject(IOleItemContainer *iface, LP
static HRESULT WINAPI test_item_container_GetObjectStorage(IOleItemContainer *iface, LPOLESTR item,
IBindCtx *pbc, REFIID riid, void **obj)
{
return E_NOTIMPL;
return 0x8bee0001;
}
static HRESULT WINAPI test_item_container_IsRunning(IOleItemContainer *iface, LPOLESTR item)
@ -2235,6 +2235,9 @@ todo_wine
hr = IMoniker_BindToStorage(moniker, bindctx, NULL, &IID_IUnknown, (void **)&unknown);
ok(hr == E_INVALIDARG, "Unexpected hr %#x.\n", hr);
hr = IMoniker_BindToStorage(moniker, bindctx, &container_moniker->IMoniker_iface, &IID_IUnknown, (void **)&unknown);
ok(hr == 0x8bee0001, "Unexpected hr %#x.\n", hr);
/* ParseDisplayName() */
hr = IMoniker_ParseDisplayName(moniker, bindctx, NULL, displayname, &eaten, &moniker2);
ok(hr == MK_E_SYNTAX, "Unexpected hr %#x.\n", hr);