Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ntdll/actctx.c | 40 ++++++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 1fb337ea333..1fa97ac0379 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -1778,12 +1778,40 @@ static BOOL parse_nummethods(const xmlstr_t *str, struct entity *entity) return TRUE; }
+static void parse_add_interface_class( xmlbuf_t *xmlbuf, struct entity_array *entities, + struct actctx_loader *acl, WCHAR *clsid ) +{ + struct entity *entity; + WCHAR *str; + + if (!clsid) return; + + if (!(str = strdupW(clsid))) + { + set_error( xmlbuf ); + return; + } + + if (!(entity = add_entity(entities, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION))) + { + RtlFreeHeap(GetProcessHeap(), 0, str); + set_error( xmlbuf ); + return; + } + + entity->u.comclass.clsid = str; + entity->u.comclass.model = ThreadingModel_Both; + + acl->actctx->sections |= SERVERREDIRECT_SECTION; +} + static void parse_cominterface_proxy_stub_elem( xmlbuf_t *xmlbuf, struct dll_redirect *dll, struct actctx_loader *acl, const struct xml_elem *parent ) { + WCHAR *psclsid = NULL; + struct entity *entity; struct xml_attr attr; BOOL end = FALSE; - struct entity* entity;
if (!(entity = add_entity(&dll->entities, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION))) { @@ -1815,8 +1843,12 @@ static void parse_cominterface_proxy_stub_elem( xmlbuf_t *xmlbuf, struct dll_red { if (!(entity->u.ifaceps.tlib = xmlstrdupW(&attr.value))) set_error( xmlbuf ); } + else if (xml_attr_cmp(&attr, proxyStubClsid32W)) + { + if (!(psclsid = xmlstrdupW(&attr.value))) set_error( xmlbuf ); + } /* not used */ - else if (xml_attr_cmp(&attr, proxyStubClsid32W) || xml_attr_cmp(&attr, threadingmodelW)) + else if (xml_attr_cmp(&attr, threadingmodelW)) { } else if (!is_xmlns_attr( &attr )) @@ -1827,6 +1859,10 @@ static void parse_cominterface_proxy_stub_elem( xmlbuf_t *xmlbuf, struct dll_red
acl->actctx->sections |= IFACEREDIRECT_SECTION; if (!end) parse_expect_end_elem(xmlbuf, parent); + + parse_add_interface_class(xmlbuf, &dll->entities, acl, psclsid ? psclsid : entity->u.ifaceps.iid); + + RtlFreeHeap(GetProcessHeap(), 0, psclsid); }
static BOOL parse_typelib_flags(const xmlstr_t *value, struct entity *entity)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/ole32/compobj.c | 41 +--------------- dlls/ole32/tests/compobj.c | 95 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 97 insertions(+), 39 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index df234498e65..6d9904a1650 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -3138,9 +3138,7 @@ 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 */ @@ -3153,46 +3151,11 @@ 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, clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); - ReleaseActCtx(clsreg.u.actctx.hactctx); + hres = get_inproc_class_object(apt, &clsreg, &comclass->clsid, iid, !(dwClsContext & WINE_CLSCTX_DONT_HOST), ppv); + ReleaseActCtx(data.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 d6ccbc58823..eb172aac28d 100644 --- a/dlls/ole32/tests/compobj.c +++ b/dlls/ole32/tests/compobj.c @@ -347,6 +347,32 @@ static const char actctx_manifest[] = " </clrClass>" "</assembly>";
+static const char actctx_manifest2[] = +"<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">" +"<assemblyIdentity version="1.2.3.4" name="Wine.Test" type="win32"" +" publicKeyToken="6595b6414666f1df" />" +"<file name="testlib.dll">" +" <comInterfaceProxyStub " +" name="Testiface7"" +" iid="{52222222-1234-1234-1234-56789abcdef0}"" +" proxyStubClsid32="{82222222-1234-1234-1234-56789abcdef0}"" +" threadingModel="Apartment"" +" />" +"</file>" +"<file name="testlib4.dll">" +" <comInterfaceProxyStub " +" name="Testiface8"" +" iid="{92222222-1234-1234-1234-56789abcdef0}"" +" threadingModel="Apartment"" +" />" +"</file>" +" <comInterfaceExternalProxyStub " +" name="Iifaceps3"" +" iid="{42222222-1234-1234-1234-56789abcdef0}"" +" proxyStubClsid32="{66666666-8888-7777-6666-555555555555}"" +" />" +"</assembly>"; + DEFINE_GUID(CLSID_Testclass, 0x12345678, 0x1234, 0x1234, 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0);
static void test_ProgIDFromCLSID(void) @@ -692,6 +718,28 @@ static void test_CoCreateInstance(void) test_apt_type(APTTYPE_CURRENT, APTTYPEQUALIFIER_NONE); }
+struct comclassredirect_data +{ + ULONG size; + ULONG flags; + DWORD model; + GUID clsid; + GUID alias; + GUID clsid2; + GUID tlid; + ULONG name_len; + ULONG name_offset; + ULONG progid_len; + ULONG progid_offset; + ULONG clrdata_len; + ULONG clrdata_offset; + DWORD miscstatus; + DWORD miscstatuscontent; + DWORD miscstatusthumbnail; + DWORD miscstatusicon; + DWORD miscstatusdocprint; +}; + static void test_CoGetClassObject(void) { HRESULT hr; @@ -763,6 +811,53 @@ static void test_CoGetClassObject(void) deactivate_context(handle, cookie); }
+ if ((handle = activate_context(actctx_manifest2, &cookie))) + { + struct comclassredirect_data *comclass; + ACTCTX_SECTION_KEYED_DATA data; + BOOL ret; + + /* This one will load test dll and get back specific error code. */ + hr = CoGetClassObject(&IID_Testiface7, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk); + ok(hr == 0x80001235 || broken(hr == HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)) /* winxp */, "Unexpected hr %#x.\n", hr); + + hr = CoGetClassObject(&IID_Testiface8, CLSCTX_INPROC_SERVER, NULL, &IID_IUnknown, (void **)&pUnk); + ok(FAILED(hr), "Unexpected hr %#x.\n", hr); + + memset(&data, 0, sizeof(data)); + data.cbSize = sizeof(data); + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_INTERFACE_REDIRECTION, &IID_Testiface8, &data); + ok(ret, "Section not found.\n"); + + memset(&data, 0, sizeof(data)); + data.cbSize = sizeof(data); + + /* External proxy-stubs are not accessible. */ + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface3, &data); + ok(!ret, "Unexpected return value.\n"); + + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_TestPS, &data); + ok(!ret, "Unexpected return value.\n"); + + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface7, &data); + ok(ret, "Unexpected return value.\n"); + + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface4, &data); + ok(!ret, "Unexpected return value.\n"); + + ret = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, &IID_Testiface8, &data); + ok(ret, "Unexpected return value.\n"); + + comclass = data.lpData; + if (comclass) + { + WCHAR *name = (WCHAR *)((char *)data.lpSectionBase + comclass->name_offset); + ok(!lstrcmpW(name, L"testlib4.dll"), "Unexpected module name %s.\n", wine_dbgstr_w(name)); + } + + deactivate_context(handle, cookie); + } + CoUninitialize(); }
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=73310
Your paranoid android.
=== w8 (32 bit report) ===
ole32: compobj.c:2986: Test failed: expected message 1024, received none compobj.c:2988: Test failed: PeekMessageA failed: 1400 compobj.c:2765: Test failed: WaitForSingleObject failed
=== debiant (32 bit WoW report) ===
ntdll: om.c:2133: Test failed: got 88
On 6/12/20 1:06 PM, Marvin wrote:
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=73310
Your paranoid android.
=== w8 (32 bit report) ===
ole32: compobj.c:2986: Test failed: expected message 1024, received none compobj.c:2988: Test failed: PeekMessageA failed: 1400 compobj.c:2765: Test failed: WaitForSingleObject failed
=== debiant (32 bit WoW report) ===
ntdll: om.c:2133: Test failed: got 88
Message test failure comes up occasionally, it's not new, see for example [1].
[1] http://test.winehq.org/data/3c72034b72014a087eae8d181252c67cb0782e28/win10_n...