Guillaume Charifi : ole32: CoCreateGuid returns E_INVALIDARG on null-GUID.

Alexandre Julliard julliard at winehq.org
Thu Jun 12 15:51:44 CDT 2014


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

Author: Guillaume Charifi <guillaume.charifi at sfr.fr>
Date:   Sat Jun  7 19:24:28 2014 +0200

ole32: CoCreateGuid returns E_INVALIDARG on null-GUID.

---

 dlls/ole32/compobj.c       |    6 +++++-
 dlls/ole32/tests/compobj.c |    9 +++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 250c0f9..d117c02 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2051,7 +2051,11 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
  */
 HRESULT WINAPI CoCreateGuid(GUID *pguid)
 {
-    DWORD status = UuidCreate(pguid);
+    DWORD status;
+
+    if(!pguid) return E_INVALIDARG;
+
+    status = UuidCreate(pguid);
     if (status == RPC_S_OK || status == RPC_S_UUID_LOCAL_ONLY) return S_OK;
     return HRESULT_FROM_WIN32( status );
 }
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index b85842b..16ae501 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -1977,6 +1977,14 @@ static void test_OleRegGetMiscStatus(void)
     }
 }
 
+static void test_CoCreateGuid(void)
+{
+    HRESULT hr;
+
+    hr = CoCreateGuid(NULL);
+    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+}
+
 static void init_funcs(void)
 {
     HMODULE hOle32 = GetModuleHandleA("ole32");
@@ -2033,4 +2041,5 @@ START_TEST(compobj)
     test_CoGetTreatAsClass();
     test_CoInitializeEx();
     test_OleRegGetMiscStatus();
+    test_CoCreateGuid();
 }




More information about the wine-cvs mailing list