Paul Gofman : ole32: Zero output interface pointer in OleGetClipboard() on error.
Alexandre Julliard
julliard at wine.codeweavers.com
Fri Jan 15 10:48:55 CST 2016
Module: wine
Branch: master
Commit: 5d4b23e6e7eb939ffb2605685099f88d3ebca751
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5d4b23e6e7eb939ffb2605685099f88d3ebca751
Author: Paul Gofman <gofmanp at gmail.com>
Date: Fri Jan 15 15:09:54 2016 +0300
ole32: Zero output interface pointer in OleGetClipboard() on error.
Signed-off-by: Paul Gofman <gofmanp at gmail.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/clipboard.c | 1 +
dlls/ole32/tests/clipboard.c | 20 ++++++++++++++++++++
2 files changed, 21 insertions(+)
diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c
index ca9520f..b871bbc 100644
--- a/dlls/ole32/clipboard.c
+++ b/dlls/ole32/clipboard.c
@@ -2201,6 +2201,7 @@ HRESULT WINAPI OleGetClipboard(IDataObject **obj)
TRACE("(%p)\n", obj);
if(!obj) return E_INVALIDARG;
+ *obj = NULL;
if(FAILED(hr = get_ole_clipbrd(&clipbrd))) return hr;
diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c
index 02097ea..1087de3 100644
--- a/dlls/ole32/tests/clipboard.c
+++ b/dlls/ole32/tests/clipboard.c
@@ -1571,6 +1571,25 @@ static void test_multithreaded_clipboard(void)
OleUninitialize();
}
+static void test_get_clipboard_locked(void)
+{
+ HRESULT hr;
+ IDataObject *pDObj;
+
+ OleInitialize(NULL);
+
+ pDObj = (IDataObject *)0xdeadbeef;
+ /* lock clipboard */
+ OpenClipboard(NULL);
+ hr = OleGetClipboard(&pDObj);
+ todo_wine ok(hr == CLIPBRD_E_CANT_OPEN, "OleGetClipboard() got 0x%08x instead of 0x%08x\n", hr, CLIPBRD_E_CANT_OPEN);
+ todo_wine ok(pDObj == NULL, "OleGetClipboard() got 0x%p instead of NULL\n",pDObj);
+ if (pDObj) IDataObject_Release(pDObj);
+ CloseClipboard();
+
+ OleUninitialize();
+}
+
START_TEST(clipboard)
{
test_set_clipboard();
@@ -1579,4 +1598,5 @@ START_TEST(clipboard)
test_nonole_clipboard();
test_getdatahere();
test_multithreaded_clipboard();
+ test_get_clipboard_locked();
}
More information about the wine-cvs
mailing list