1
0
mirror of https://github.com/valinet/ExplorerPatcher.git synced 2024-11-27 17:00:59 +01:00

Added guard to stop trying to hook Start menu after some time if not found

This commit is contained in:
Valentin Radu 2021-10-10 06:03:22 +03:00
parent 04b204f2b6
commit 4cf492c8d3

View File

@ -201,6 +201,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
while (TRUE)
{
unsigned int retry = 0;
HANDLE hProcess, hSnapshot;
PROCESSENTRY32 pe32;
while (TRUE)
@ -233,6 +234,7 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
{
printf("Unable to open handle to StartMenuExperienceHost.exe.\n");
Sleep(params->dwTimeout);
continue;
}
TCHAR wszProcessPath[MAX_PATH];
DWORD dwLength = MAX_PATH;
@ -261,6 +263,8 @@ DWORD WINAPI HookStartMenu(HookStartMenuParams* params)
}
else
{
retry++;
if (retry > 5) return 0;
Sleep(params->dwTimeout);
}
}