Nikolay Sivov : ole32: Support activation context redirection in CoGetPSClsid().

Alexandre Julliard julliard at winehq.org
Tue Oct 22 13:30:41 CDT 2013


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

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Fri Sep 27 22:59:03 2013 +0400

ole32: Support activation context redirection in CoGetPSClsid().

---

 dlls/ole32/compobj.c       |   22 ++++++++++++++++++++++
 dlls/ole32/tests/compobj.c |   11 +++++++++--
 2 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index ddfc74b..d70bfc1 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -123,6 +123,18 @@ struct comclassredirect_data
     DWORD miscstatusdocprint;
 };
 
+struct ifacepsredirect_data
+{
+    ULONG size;
+    DWORD mask;
+    GUID  iid;
+    ULONG nummethods;
+    GUID  tlbid;
+    GUID  base;
+    ULONG name_len;
+    ULONG name_offset;
+};
+
 struct class_reg_data
 {
     union
@@ -2359,6 +2371,7 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
     HKEY hkey;
     APARTMENT *apt = COM_CurrentApt();
     struct registered_psclsid *registered_psclsid;
+    ACTCTX_SECTION_KEYED_DATA data;
 
     TRACE("() riid=%s, pclsid=%p\n", debugstr_guid(riid), pclsid);
 
@@ -2386,6 +2399,15 @@ HRESULT WINAPI CoGetPSClsid(REFIID riid, CLSID *pclsid)
 
     LeaveCriticalSection(&apt->cs);
 
+    data.cbSize = sizeof(data);
+    if (FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION,
+                              riid, &data))
+    {
+        struct ifacepsredirect_data *ifaceps = (struct ifacepsredirect_data*)data.lpData;
+        *pclsid = ifaceps->iid;
+        return S_OK;
+    }
+
     /* Interface\\{string form of riid}\\ProxyStubClsid32 */
     strcpyW(path, wszInterface);
     StringFromGUID2(riid, path + ARRAYSIZE(wszInterface) - 1, CHARS_IN_GUID);
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 9f94f3d..8998251 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -1031,7 +1031,6 @@ static void test_CoGetPSClsid(void)
 
     if ((handle = activate_context(actctx_manifest, &cookie)))
     {
-todo_wine {
         memset(&clsid, 0, sizeof(clsid));
         hr = CoGetPSClsid(&IID_Testiface, &clsid);
         ok(hr == S_OK, "got 0x%08x\n", hr);
@@ -1051,7 +1050,15 @@ todo_wine {
         hr = CoGetPSClsid(&IID_Testiface4, &clsid);
         ok(hr == S_OK, "got 0x%08x\n", hr);
         ok(IsEqualGUID(&clsid, &GUID_NULL), "got clsid %s\n", debugstr_guid(&clsid));
-}
+
+        /* register same interface and try to get CLSID back */
+        hr = CoRegisterPSClsid(&IID_Testiface, &IID_Testiface4);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        memset(&clsid, 0, sizeof(clsid));
+        hr = CoGetPSClsid(&IID_Testiface, &clsid);
+        ok(hr == S_OK, "got 0x%08x\n", hr);
+        ok(IsEqualGUID(&clsid, &IID_Testiface4), "got clsid %s\n", debugstr_guid(&clsid));
+
         pDeactivateActCtx(0, cookie);
         pReleaseActCtx(handle);
     }




More information about the wine-cvs mailing list