Rob Shearman : ole32: Add tests for passing invalid arguments to CoUnmarshalInterface.

Alexandre Julliard julliard at wine.codeweavers.com
Wed Jan 10 05:36:03 CST 2007


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

Author: Rob Shearman <rob at codeweavers.com>
Date:   Tue Jan  9 17:17:34 2007 +0000

ole32: Add tests for passing invalid arguments to CoUnmarshalInterface.

---

 dlls/ole32/tests/compobj.c |   24 ++++++++++++++++++++++++
 1 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index cc83f83..eb9f281 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -528,6 +528,28 @@ static void test_CoGetPSClsid(void)
     CoUninitialize();
 }
 
+/* basic test, mainly for invalid arguments. see marshal.c for more */
+static void test_CoUnmarshalInterface(void)
+{
+    IUnknown *pProxy;
+    IStream *pStream;
+    HRESULT hr;
+
+    hr = CoUnmarshalInterface(NULL, &IID_IUnknown, (void **)&pProxy);
+    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+
+    hr = CreateStreamOnHGlobal(NULL, TRUE, &pStream);
+    ok_ole_success(hr, "CreateStreamOnHGlobal");
+
+    hr = CoUnmarshalInterface(pStream, &IID_IUnknown, (void **)&pProxy);
+    ok(hr == STG_E_READFAULT, "CoUnmarshalInterface should have returned STG_E_READFAULT instead of 0x%08x\n", hr);
+
+    hr = CoUnmarshalInterface(pStream, &IID_IUnknown, NULL);
+    ok(hr == E_INVALIDARG, "CoUnmarshalInterface should have returned E_INVALIDARG instead of 0x%08x\n", hr);
+
+    IStream_Release(pStream);
+}
+
 static void test_CoGetInterfaceAndReleaseStream(void)
 {
     HRESULT hr;
@@ -541,6 +563,7 @@ static void test_CoGetInterfaceAndReleas
     CoUninitialize();
 }
 
+/* basic test, mainly for invalid arguments. see marshal.c for more */
 static void test_CoMarshalInterface(void)
 {
     IStream *pStream;
@@ -627,6 +650,7 @@ START_TEST(compobj)
     test_CoRegisterMessageFilter();
     test_CoRegisterPSClsid();
     test_CoGetPSClsid();
+    test_CoUnmarshalInterface();
     test_CoGetInterfaceAndReleaseStream();
     test_CoMarshalInterface();
     test_CoMarshalInterThreadInterfaceInStream();




More information about the wine-cvs mailing list