Huw Davies : ole32: Call the draw_continue function.

Alexandre Julliard julliard at winehq.org
Tue Sep 28 11:13:37 CDT 2010


Module: wine
Branch: master
Commit: 250b55c41d70aab736453cfb36e714b3e5a28194
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=250b55c41d70aab736453cfb36e714b3e5a28194

Author: Huw Davies <huw at codeweavers.com>
Date:   Tue Sep 28 10:48:23 2010 +0100

ole32: Call the draw_continue function.

---

 dlls/ole32/datacache.c  |    2 ++
 dlls/ole32/tests/ole2.c |   17 +++++++++++++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/datacache.c b/dlls/ole32/datacache.c
index 2f26363..db4cc0c 100644
--- a/dlls/ole32/datacache.c
+++ b/dlls/ole32/datacache.c
@@ -1633,6 +1633,8 @@ static HRESULT WINAPI DataCache_Draw(
     if (cache_entry->stgmedium.tymed == TYMED_NULL)
       continue;
 
+    if (pfnContinue && !pfnContinue(dwContinue)) return E_ABORT;
+
     switch (cache_entry->data_cf)
     {
       case CF_METAFILEPICT:
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index 080c2f2..48584a1 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -897,6 +897,12 @@ static BOOL STDMETHODCALLTYPE draw_continue(ULONG_PTR param)
     return TRUE;
 }
 
+static BOOL STDMETHODCALLTYPE draw_continue_false(ULONG_PTR param)
+{
+    CHECK_EXPECTED_METHOD("draw_continue_false");
+    return FALSE;
+}
+
 static HRESULT WINAPI AdviseSink_QueryInterface(IAdviseSink *iface, REFIID riid, void **ppv)
 {
     if (IsEqualIID(riid, &IID_IAdviseSink) || IsEqualIID(riid, &IID_IUnknown))
@@ -1117,6 +1123,7 @@ static void test_data_cache(void)
         { "AdviseSink_OnViewChange", 0 },
         { "AdviseSink_OnViewChange", 0 },
         { "draw_continue", 1 },
+        { "draw_continue_false", 1 },
         { "DataObject_DAdvise", 0 },
         { "DataObject_DAdvise", 0 },
         { "DataObject_DUnadvise", 0 },
@@ -1268,6 +1275,16 @@ static void test_data_cache(void)
     hr = IViewObject_Draw(pViewObject, DVASPECT_CONTENT, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue, 0xdeadbeef);
     ok(hr == OLE_E_BLANK, "IViewObject_Draw with uncached aspect should have returned OLE_E_BLANK instead of 0x%08x\n", hr);
 
+    /* a NULL draw_continue fn ptr */
+    hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, NULL, 0xdeadbeef);
+    ok_ole_success(hr, "IViewObject_Draw");
+
+    /* draw_continue that returns FALSE to abort drawing */
+    hr = IViewObject_Draw(pViewObject, DVASPECT_ICON, -1, NULL, NULL, NULL, hdcMem, &rcBounds, NULL, draw_continue_false, 0xdeadbeef);
+    ok(hr == E_ABORT ||
+       broken(hr == S_OK), /* win9x may skip the callbacks */
+       "IViewObject_Draw with draw_continue_false returns 0x%08x\n", hr);
+
     DeleteDC(hdcMem);
 
     hr = IOleCacheControl_OnRun(pOleCacheControl, &DataObject);




More information about the wine-cvs mailing list