Nikolay Sivov : ole32: Use interface redirection section too when looking for modules in CoGetClassObject().
Alexandre Julliard
julliard at winehq.org
Wed Oct 30 18:40:11 CDT 2019
Module: wine
Branch: master
Commit: 32088c0c09046faf8ad52e276d9e7b37ec17326e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=32088c0c09046faf8ad52e276d9e7b37ec17326e
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Oct 29 16:36:06 2019 +0300
ole32: Use interface redirection section too when looking for modules in CoGetClassObject().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ole32/compobj.c | 41 +++++++++++++++++++++++++++++++++++++++--
dlls/ole32/tests/compobj.c | 1 -
2 files changed, 39 insertions(+), 3 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 4e48f6add6..0dc0d39c22 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -3138,7 +3138,9 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(
if (CLSCTX_INPROC & dwClsContext)
{
+ ASSEMBLY_FILE_DETAILED_INFORMATION *file_info = NULL;
ACTCTX_SECTION_KEYED_DATA data;
+ const CLSID *clsid = NULL;
data.cbSize = sizeof(data);
/* search activation context first */
@@ -3151,11 +3153,46 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CoGetClassObject(
clsreg.u.actctx.module_name = (WCHAR *)((BYTE *)data.lpSectionBase + comclass->name_offset);
clsreg.u.actctx.hactctx = data.hActCtx;
clsreg.u.actctx.threading_model = comclass->model;
+ clsid = &comclass->clsid;
+ }
+ else if (FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL,
+ ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, rclsid, &data))
+ {
+ ACTIVATION_CONTEXT_QUERY_INDEX query_index;
+ SIZE_T required_len = 0;
+
+ query_index.ulAssemblyIndex = data.ulAssemblyRosterIndex - 1;
+ query_index.ulFileIndexInAssembly = 0;
+
+ QueryActCtxW(0, data.hActCtx, &query_index, FileInformationInAssemblyOfAssemblyInActivationContext,
+ NULL, 0, &required_len);
+ if (required_len)
+ {
+ file_info = heap_alloc(required_len);
+ if (file_info)
+ {
+ if (QueryActCtxW(0, data.hActCtx, &query_index, FileInformationInAssemblyOfAssemblyInActivationContext,
+ file_info, required_len, &required_len))
+ {
+ clsreg.u.actctx.module_name = file_info->lpFileName;
+ clsreg.u.actctx.hactctx = data.hActCtx;
+ clsreg.u.actctx.threading_model = ThreadingModel_Both;
+ clsid = rclsid;
+ }
+ else
+ heap_free(file_info);
+ }
+ }
+ }
+
+ if (clsreg.u.actctx.hactctx)
+ {
clsreg.origin = CLASS_REG_ACTCTX;
- hres = get_inproc_class_object(apt, &clsreg, &comclass->clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
- ReleaseActCtx(data.hActCtx);
+ hres = get_inproc_class_object(apt, &clsreg, clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv);
+ ReleaseActCtx(clsreg.u.actctx.hactctx);
apartment_release(apt);
+ heap_free(file_info);
return hres;
}
}
diff --git a/dlls/ole32/tests/compobj.c b/dlls/ole32/tests/compobj.c
index 4252f88369..6361f5f0da 100644
--- a/dlls/ole32/tests/compobj.c
+++ b/dlls/ole32/tests/compobj.c
@@ -757,7 +757,6 @@ static void test_CoGetClassObject(void)
IUnknown_Release(pUnk);
hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
- todo_wine
ok(hr == 0x80001235, "Unexpected hr %#x.\n", hr);
hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk);
More information about the wine-cvs
mailing list