Browse Source

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

pull/51/head
Valentin Radu 4 years ago
parent
commit
4cf492c8d3
  1. 4
      ExplorerPatcher/StartMenu.c

4
ExplorerPatcher/StartMenu.c

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

Loading…
Cancel
Save