Nikolay Sivov : ole32: Missing MiscStatus key is not a failure for OleRegGetMiscStatus().

Alexandre Julliard julliard at winehq.org
Tue Aug 27 14:47:55 CDT 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Aug 27 10:13:15 2013 +0400

ole32: Missing MiscStatus key is not a failure for OleRegGetMiscStatus().

---

 dlls/ole32/ole2.c          |   11 +++++------
 dlls/ole32/tests/compobj.c |   25 ++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 7 deletions(-)

diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index a1a4b9a..0994a5f 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -882,11 +882,6 @@ HRESULT WINAPI OleRegGetMiscStatus(
   LONG    result;
 
   /*
-   * Initialize the out parameter.
-   */
-  *pdwStatus = 0;
-
-  /*
    * Build the key name we're looking for
    */
   sprintfW( keyName, clsidfmtW,
@@ -896,6 +891,10 @@ HRESULT WINAPI OleRegGetMiscStatus(
 
   TRACE("(%s, %d, %p)\n", debugstr_w(keyName), dwAspect, pdwStatus);
 
+  if (!pdwStatus) return E_INVALIDARG;
+
+  *pdwStatus = 0;
+
   /*
    * Open the class id Key
    */
@@ -910,7 +909,7 @@ HRESULT WINAPI OleRegGetMiscStatus(
   if (result != ERROR_SUCCESS)
   {
     RegCloseKey(clsidKey);
-    return REGDB_E_READREGDB;
+    return S_OK;
   }
 
   /*
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index c81a017..519cb74 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -1732,18 +1732,41 @@ static void test_OleRegGetMiscStatus(void)
     DWORD status;
     HRESULT hr;
 
+    hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, NULL);
+    ok(hr == E_INVALIDARG, "got 0x%08x\n", hr);
+
+    status = 0xdeadbeef;
     hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
     ok(hr == REGDB_E_CLASSNOTREG, "got 0x%08x\n", hr);
+    ok(status == 0, "got 0x%08x\n", status);
+
+    status = -1;
+    hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
+    ok(hr == S_OK, "got 0x%08x\n", hr);
+    ok(status == 0, "got 0x%08x\n", status);
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
-
         status = 0;
         hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_ICON, &status);
 todo_wine {
         ok(hr == S_OK, "got 0x%08x\n", hr);
         ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
 }
+        /* context data takes precedence over registration info */
+        status = 0;
+        hr = OleRegGetMiscStatus(&CLSID_StdFont, DVASPECT_ICON, &status);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+todo_wine
+        ok(status == OLEMISC_RECOMPOSEONRESIZE, "got 0x%08x\n", status);
+
+        /* there's no such attribute in context */
+        status = -1;
+        hr = OleRegGetMiscStatus(&CLSID_Testclass, DVASPECT_DOCPRINT, &status);
+todo_wine
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(status == 0, "got 0x%08x\n", status);
+
         pDeactivateActCtx(0, cookie);
         pReleaseActCtx(handle);
     }




More information about the wine-cvs mailing list