Nikolay Sivov : ole32: Added activation context support for OleRegGetMiscStatus().

Alexandre Julliard julliard at winehq.org
Mon Nov 11 14:08:16 CST 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Nov 11 22:02:58 2013 +0400

ole32: Added activation context support for OleRegGetMiscStatus().

---

 dlls/ole32/compobj.c         |   74 ++++++++++++++++++++++++++++++++++++++++++
 dlls/ole32/compobj_private.h |    2 +
 dlls/ole32/ole2.c            |    2 +
 dlls/ole32/tests/compobj.c   |    5 +--
 4 files changed, 79 insertions(+), 4 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index fd7cc48..d3f4804 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -99,6 +99,15 @@ enum comclass_threadingmodel
     ThreadingModel_Neutral   = 5
 };
 
+enum comclass_miscfields
+{
+    MiscStatus          = 1,
+    MiscStatusIcon      = 2,
+    MiscStatusContent   = 4,
+    MiscStatusThumbnail = 8,
+    MiscStatusDocPrint  = 16
+};
+
 struct comclassredirect_data
 {
     ULONG size;
@@ -218,6 +227,71 @@ static CRITICAL_SECTION_DEBUG class_cs_debug =
 };
 static CRITICAL_SECTION csRegisteredClassList = { &class_cs_debug, -1, 0, 0, 0, 0 };
 
+static inline enum comclass_miscfields dvaspect_to_miscfields(DWORD aspect)
+{
+    switch (aspect)
+    {
+    case DVASPECT_CONTENT:
+        return MiscStatusContent;
+    case DVASPECT_THUMBNAIL:
+        return MiscStatusThumbnail;
+    case DVASPECT_ICON:
+        return MiscStatusIcon;
+    case DVASPECT_DOCPRINT:
+        return MiscStatusDocPrint;
+    default:
+        return MiscStatus;
+    };
+}
+
+BOOL actctx_get_miscstatus(const CLSID *clsid, DWORD aspect, DWORD *status)
+{
+    ACTCTX_SECTION_KEYED_DATA data;
+
+    data.cbSize = sizeof(data);
+    if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION,
+                              clsid, &data))
+    {
+        struct comclassredirect_data *comclass = (struct comclassredirect_data*)data.lpData;
+        enum comclass_miscfields misc = dvaspect_to_miscfields(aspect);
+
+        if (!(comclass->miscmask & misc))
+        {
+            if (!(comclass->miscmask & MiscStatus))
+            {
+                *status = 0;
+                return TRUE;
+            }
+            misc = MiscStatus;
+        }
+
+        switch (misc)
+        {
+        case MiscStatus:
+            *status = comclass->miscstatus;
+            break;
+        case MiscStatusIcon:
+            *status = comclass->miscstatusicon;
+            break;
+        case MiscStatusContent:
+            *status = comclass->miscstatuscontent;
+            break;
+        case MiscStatusThumbnail:
+            *status = comclass->miscstatusthumbnail;
+            break;
+        case MiscStatusDocPrint:
+            *status = comclass->miscstatusdocprint;
+            break;
+        default:
+           ;
+        };
+
+        return TRUE;
+    }
+    else
+        return FALSE;
+}
+
 /* wrapper for NtCreateKey that creates the key recursively if necessary */
 static NTSTATUS create_key( HKEY *retkey, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr )
 {
diff --git a/dlls/ole32/compobj_private.h b/dlls/ole32/compobj_private.h
index 0f4519b..933b71c 100644
--- a/dlls/ole32/compobj_private.h
+++ b/dlls/ole32/compobj_private.h
@@ -315,6 +315,8 @@ extern UINT ole_private_data_clipboard_format DECLSPEC_HIDDEN;
 extern LSTATUS create_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
 extern LSTATUS open_classes_key(HKEY, const WCHAR *, REGSAM, HKEY *) DECLSPEC_HIDDEN;
 
+extern BOOL actctx_get_miscstatus(const CLSID*, DWORD, DWORD*) DECLSPEC_HIDDEN;
+
 static inline void *heap_alloc(size_t len)
 {
     return HeapAlloc(GetProcessHeap(), 0, len);
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 0994a5f..5e789f2 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -895,6 +895,8 @@ HRESULT WINAPI OleRegGetMiscStatus(
 
   *pdwStatus = 0;
 
+  if (actctx_get_miscstatus(clsid, dwAspect, pdwStatus)) return S_OK;
+
   /*
    * Open the class id Key
    */
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 3deedf3..8c4d6a8 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -1889,21 +1889,18 @@ static void test_OleRegGetMiscStatus(void)
     {
         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);
 




More information about the wine-cvs mailing list