Module: wine Branch: master Commit: e4ec89f2b052fa8052ba394d013e46d1660587ac URL: http://source.winehq.org/git/wine.git/?a=commit;h=e4ec89f2b052fa8052ba394d01...
Author: Huw Davies huw@codeweavers.com Date: Wed Oct 14 10:33:49 2015 +0100
ole32: Return OLE_E_NOTRUNNING on a cache-miss when the object isn't running.
Signed-off-by: Huw Davies huw@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ole32/defaulthandler.c | 22 ++++++++++++++++++++-- dlls/ole32/tests/ole2.c | 2 -- 2 files changed, 20 insertions(+), 4 deletions(-)
diff --git a/dlls/ole32/defaulthandler.c b/dlls/ole32/defaulthandler.c index ad79e99..9f6fa2b 100644 --- a/dlls/ole32/defaulthandler.c +++ b/dlls/ole32/defaulthandler.c @@ -1021,8 +1021,17 @@ static HRESULT WINAPI DefaultHandler_GetData(
IDataObject_Release(cacheDataObject);
- if (FAILED(hres) && object_is_running( This )) + if (hres == S_OK) return hres; + + if (object_is_running( This )) + { hres = IDataObject_GetData(This->pDataDelegate, pformatetcIn, pmedium); + if (hres == S_OK) return hres; + } + + /* Query running state again, as the object may have closed during _GetData call */ + if (!object_is_running( This )) + hres = OLE_E_NOTRUNNING;
return hres; } @@ -1067,8 +1076,17 @@ static HRESULT WINAPI DefaultHandler_QueryGetData(
IDataObject_Release(cacheDataObject);
- if (FAILED(hres) && object_is_running( This )) + if (hres == S_OK) return hres; + + if (object_is_running( This )) + { hres = IDataObject_QueryGetData(This->pDataDelegate, pformatetc); + if (hres == S_OK) return hres; + } + + /* Query running state again, as the object may have closed during _QueryGetData call */ + if (!object_is_running( This )) + hres = OLE_E_NOTRUNNING;
return hres; } diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index b297f03..39680af 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -1933,7 +1933,6 @@ static void test_default_handler(void) fmtetc.lindex = -1; fmtetc.tymed = TYMED_ENHMF; hr = IDataObject_QueryGetData(pDataObject, &fmtetc); - todo_wine ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
fmtetc.cfFormat = CF_TEXT; @@ -1942,7 +1941,6 @@ static void test_default_handler(void) fmtetc.lindex = -1; fmtetc.tymed = TYMED_NULL; hr = IDataObject_QueryGetData(pDataObject, &fmtetc); - todo_wine ok(hr == OLE_E_NOTRUNNING, "IDataObject_QueryGetData should have returned OLE_E_NOTRUNNING instead of 0x%08x\n", hr);
hr = IOleObject_QueryInterface(pObject, &IID_IRunnableObject, (void **)&pRunnableObject);