Qian Hong : ole32: Fix OleDraw() with NULL pUnk.
Alexandre Julliard
julliard at winehq.org
Thu Dec 6 16:25:10 CST 2012
Module: wine
Branch: master
Commit: 9b90ea557b12b7a0a25ce945ac4374f1aa702ae5
URL: http://source.winehq.org/git/wine.git/?a=commit;h=9b90ea557b12b7a0a25ce945ac4374f1aa702ae5
Author: Qian Hong <fracting at gmail.com>
Date: Fri Dec 7 01:45:33 2012 +0800
ole32: Fix OleDraw() with NULL pUnk.
---
dlls/ole32/ole2.c | 2 ++
dlls/ole32/tests/ole2.c | 7 +++++++
2 files changed, 9 insertions(+), 0 deletions(-)
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 4a36aec..1bd4c1a 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -2546,6 +2546,8 @@ HRESULT WINAPI OleDraw(
HRESULT hres;
IViewObject *viewobject;
+ if (!pUnk) return E_INVALIDARG;
+
hres = IUnknown_QueryInterface(pUnk,
&IID_IViewObject,
(void**)&viewobject);
diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c
index eb8e6d3..27653c1 100644
--- a/dlls/ole32/tests/ole2.c
+++ b/dlls/ole32/tests/ole2.c
@@ -1934,9 +1934,16 @@ static void test_OleLockRunning(void)
static void test_OleDraw(void)
{
HRESULT hr;
+ RECT rect;
hr = OleDraw((IUnknown*)&viewobject, 0, (HDC)0x1, NULL);
ok(hr == S_OK, "got 0x%08x\n", hr);
+
+ hr = OleDraw(NULL, 0, (HDC)0x1, NULL);
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+ hr = OleDraw(NULL, 0, (HDC)0x1, &rect);
+ ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
}
START_TEST(ole2)
More information about the wine-cvs
mailing list