Huw Davies : ole: ProgIDFromCLSID sets progid to NULL on failure.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 20 13:20:27 CST 2006


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

Author: Huw Davies <huw at codeweavers.com>
Date:   Fri Jan 20 19:41:56 2006 +0100

ole: ProgIDFromCLSID sets progid to NULL on failure.

---

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

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index ed0e4f9..dcef9c6 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -1049,6 +1049,7 @@ HRESULT WINAPI ProgIDFromCLSID(REFCLSID 
     HRESULT  ret;
     LONG progidlen = 0;
 
+    *lplpszProgID = NULL;
     ret = COM_OpenKeyForCLSID(clsid, wszProgID, KEY_READ, &hkey);
     if (FAILED(ret))
         return ret;
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index b4a5cb4..ef043b1 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -30,6 +30,7 @@
 
 #define ok_ole_success(hr, func) ok(hr == S_OK, func " failed with error 0x%08lx\n", hr)
 
+static const CLSID CLSID_non_existent =   { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } };
 static const CLSID CLSID_CDeviceMoniker = { 0x4315d437, 0x5b8c, 0x11d0, { 0xbd, 0x3b, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86 } };
 static const WCHAR devicedotone[] = {'d','e','v','i','c','e','.','1',0};
 static const WCHAR wszCLSID_CDeviceMoniker[] =
@@ -53,6 +54,11 @@ static void test_ProgIDFromCLSID(void)
         ok(!lstrcmpiW(progid, devicedotone), "Didn't get expected prog ID\n");
         CoTaskMemFree(progid);
     }
+
+    progid = (LPWSTR)0xdeadbeef;
+    hr = ProgIDFromCLSID(&CLSID_non_existent, &progid);
+    ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08lx\n", hr);
+    ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid);
 }
 
 static void test_CLSIDFromProgID(void)




More information about the wine-cvs mailing list