From 7014ee90502467cf646d5c9c2ef076acb1f5c97b Mon Sep 17 00:00:00 2001 From: ge0rdi Date: Thu, 24 Aug 2023 09:05:29 +0200 Subject: [PATCH] Avoid recursive Start menu initialization (#1675) It may happen that during `InitStartMenuDLL` execution some component posts a message that is then intercepted by (still active) `HookInject` that will call `InitStartMenuDLL` again (and everything will repeat). To prevent such endless recursion during initialization, we will make sure that `InitStartMenuDLL` will be executed just once. --- Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp b/Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp index 278f3bc9f..d8da25b26 100644 --- a/Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp +++ b/Src/StartMenu/StartMenuDLL/StartMenuDLL.cpp @@ -2891,6 +2891,12 @@ static void OpenCortana( void ) static void InitStartMenuDLL( void ) { + static bool initCalled = false; + if (initCalled) + return; + + initCalled = true; + LogToFile(STARTUP_LOG, L"StartMenu DLL: InitStartMenuDLL"); WaitDllInitThread();