https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cfdb7d564c25190c0f9b377bdfb19fa47c35175d

commit cfdb7d564c25190c0f9b377bdfb19fa47c35175d
Author:     Mark Jansen <[email protected]>
AuthorDate: Mon Mar 11 22:47:22 2019 +0100
Commit:     Mark Jansen <[email protected]>
CommitDate: Thu Mar 14 20:02:01 2019 +0100

    [SHIMENG] Don't crash on a shim not found
    CORE-15846
---
 dll/appcompat/apphelp/shimeng.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/dll/appcompat/apphelp/shimeng.c b/dll/appcompat/apphelp/shimeng.c
index 3520266133..d1ba71d7bd 100644
--- a/dll/appcompat/apphelp/shimeng.c
+++ b/dll/appcompat/apphelp/shimeng.c
@@ -1142,10 +1142,13 @@ VOID SeiInit(PUNICODE_STRING ProcessImage, HSDB hsdb, 
SDBQUERYRESULT* pQuery)
             SHIMENG_INFO("Using SHIM \"%S!%S\"\n", DllName, ShimName);
 
             /* Ask this shim what hooks it needs (and pass along the 
commandline) */
+            dwHookCount = 0;
             pHookApi = pShimModuleInfo->pGetHookAPIs(AnsiCommandLine.Buffer, 
ShimName, &dwHookCount);
             SHIMENG_INFO("GetHookAPIs returns %d hooks for DLL \"%wZ\" SHIM 
\"%S\"\n", dwHookCount, &UnicodeDllName, ShimName);
-            if (dwHookCount)
+            if (dwHookCount && pHookApi)
                 pShimInfo = SeiAppendHookInfo(pShimModuleInfo, pHookApi, 
dwHookCount, ShimName);
+            else
+                dwHookCount = 0;
 
             /* If this shim has hooks, create the include / exclude lists */
             if (pShimInfo)

Reply via email to