From c7ba8b7aa49f9938b24f55a7c3cd049c27d73aad Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 7 Dec 2020 10:27:56 +0300 Subject: [PATCH] sxs: Query context that contains the GUID in SxsLookupClrGuid(). This restores pre-2cfc85dc55d403a7fcb885a62bb28f8d73498c2d logic; activation/deactivation still happens, and user context in this case is returned from FindActCtxSectionGuid(). Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50139 Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/sxs/sxs.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/dlls/sxs/sxs.c b/dlls/sxs/sxs.c index 7150f55c33e..cd1d0f7bb56 100644 --- a/dlls/sxs/sxs.c +++ b/dlls/sxs/sxs.c @@ -135,14 +135,20 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff if (flags & SXS_LOOKUP_CLR_GUID_FIND_SURROGATE) { - if ((retval = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES, clsid, &guid_info))) + if ((retval = FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, + ACTIVATION_CONTEXT_SECTION_CLR_SURROGATES, clsid, &guid_info))) + { flags &= ~SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS; + } } if (!retval && (flags & SXS_LOOKUP_CLR_GUID_FIND_CLR_CLASS)) { - if ((retval = FindActCtxSectionGuid(0, NULL, ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, clsid, &guid_info))) + if ((retval = FindActCtxSectionGuid(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, + ACTIVATION_CONTEXT_SECTION_COM_SERVER_REDIRECTION, clsid, &guid_info))) + { flags &= ~SXS_LOOKUP_CLR_GUID_FIND_SURROGATE; + } } if (!retval) @@ -151,7 +157,7 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff goto out; } - retval = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, NULL, &guid_info.ulAssemblyRosterIndex, + retval = QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex, AssemblyDetailedInformationInActivationContext, NULL, 0, &bytes_assembly_info); if (!retval && GetLastError() != ERROR_INSUFFICIENT_BUFFER) { @@ -159,7 +165,7 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff } assembly_info = heap_alloc(bytes_assembly_info); - if (!(retval = QueryActCtxW(QUERY_ACTCTX_FLAG_USE_ACTIVE_ACTCTX, NULL, &guid_info.ulAssemblyRosterIndex, + if (!(retval = QueryActCtxW(0, guid_info.hActCtx, &guid_info.ulAssemblyRosterIndex, AssemblyDetailedInformationInActivationContext, assembly_info, bytes_assembly_info, &bytes_assembly_info))) { @@ -225,6 +231,7 @@ BOOL WINAPI SxsLookupClrGuid(DWORD flags, GUID *clsid, HANDLE actctx, void *buff SetLastError(0); out: + ReleaseActCtx(guid_info.hActCtx); if (flags & SXS_LOOKUP_CLR_GUID_USE_ACTCTX) DeactivateActCtx(0, cookie);