Rob Shearman : ole32: Fix clipboard test failures on some versions of Windows.

Alexandre Julliard julliard at winehq.org
Tue Sep 30 11:16:13 CDT 2008


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

Author: Rob Shearman <robertshearman at gmail.com>
Date:   Sun Sep 28 17:41:47 2008 +0100

ole32: Fix clipboard test failures on some versions of Windows.

Some versions of ole32 don't test that the lindex field of the
FORMATETC structure passed into functions is valid.

---

 dlls/ole32/tests/clipboard.c |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c
index ee912ce..e714064 100644
--- a/dlls/ole32/tests/clipboard.c
+++ b/dlls/ole32/tests/clipboard.c
@@ -359,7 +359,10 @@ static void test_get_clipboard(void)
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.lindex = 256;
     hr = IDataObject_QueryGetData(data_obj, &fmtetc);
-    ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC || broken(hr == S_OK),
+        "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    if (hr == S_OK)
+        ReleaseStgMedium(&stgmedium);
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.cfFormat = CF_RIFF;
@@ -398,7 +401,13 @@ static void test_get_clipboard(void)
     fmtetc.lindex = 256;
     hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium);
     todo_wine
-    ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    ok(hr == DV_E_FORMATETC || broken(hr == S_OK), "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr);
+    if (hr == S_OK)
+    {
+        /* undo the unexpected success */
+        DataObjectImpl_GetData_calls--;
+        ReleaseStgMedium(&stgmedium);
+    }
 
     InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL);
     fmtetc.cfFormat = CF_RIFF;




More information about the wine-cvs mailing list