https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d284c8149417e55a026c2…
commit d284c8149417e55a026c2876eddcb0b435c7b38e
Author: Mark Jansen <mark.jansen(a)reactos.org>
AuthorDate: Thu Oct 20 19:17:33 2022 +0200
Commit: Mark Jansen <mark.jansen(a)reactos.org>
CommitDate: Wed Oct 26 20:19:31 2022 +0200
[APPHELP] Stop shimeng being initialized multiple times
This is a hack, but is required when MSI is loaded in a process that is already
shimmed.
It should be removed when the MSI shim integration is fixed.
CORE-18532
CORE-13283
---
dll/appcompat/apphelp/shimeng.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/dll/appcompat/apphelp/shimeng.c b/dll/appcompat/apphelp/shimeng.c
index c470ff3d8d6..1e351e8a37d 100644
--- a/dll/appcompat/apphelp/shimeng.c
+++ b/dll/appcompat/apphelp/shimeng.c
@@ -32,6 +32,7 @@ static UNICODE_STRING g_LoadingShimDll;
ULONG g_ShimEngDebugLevel = 0xffffffff;
BOOL g_bComPlusImage = FALSE;
BOOL g_bShimDuringInit = FALSE;
+BOOL g_bShimEngInitialized = FALSE;
BOOL g_bInternalHooksUsed = FALSE;
static ARRAY g_pShimInfo; /* PSHIMMODULE */
static ARRAY g_pHookArray; /* HOOKMODULEINFO */
@@ -1358,6 +1359,7 @@ VOID SeiInit(LPCWSTR ProcessImage, HSDB hsdb, SDBQUERYRESULT*
pQuery, BOOLEAN Pr
/* Remove the 'LDRP_ENTRY_PROCESSED' flag from entries we modified, so
that the loader can continue to process them */
SeiResetEntryProcessed(Peb);
}
+ g_bShimEngInitialized = TRUE;
}
@@ -1484,6 +1486,12 @@ LdrInitShimEngineDynamic(IN PVOID BaseAddress);
BOOL WINAPI SE_DynamicShim(LPCWSTR ProcessImage, HSDB hsdb, PVOID pQueryResult, LPCSTR
Module, LPDWORD lpdwDynamicToken)
{
+ if (g_bShimEngInitialized)
+ {
+ SHIMENG_MSG("ReactOS HACK(CORE-13283): ShimEng already
initialized!\n");
+ return TRUE;
+ }
+
g_bShimDuringInit = TRUE;
SeiInit(ProcessImage, hsdb, pQueryResult, FALSE);
g_bShimDuringInit = FALSE;