ole32: Use interface redirection section too when looking for modules in CoGetClassObject().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2019-10-29 16:36:06 +03:00 committed by Alexandre Julliard
parent ce15bc1f02
commit 32088c0c09
2 changed files with 39 additions and 3 deletions

View File

@ -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;
}
}

View File

@ -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);