win-capture: Change inject-hook intervals

This makes a minor adjustment to the interval at which the inject helper
tries to post the inject message to the target process.  Only 2 seconds
before, now up to 4 seconds, with the PostThreadMessage called every
half second for the duration.

The reason I did this is because I noticed that on rare occasions that
it wouldn't hook due to the low interval; usually just because the
target process is busy and isn't able to process its message queue, and
therefor the hook wouldn't go through due to the fact that
SetWindowsHookEx won't inject until the set event has occurred.  The
inject helper program would just close before the thread message had
finally been processed, which would cancel the SetWindowsHookEx hooking.
master
jp9000 2015-01-05 00:16:00 -08:00
parent e9f8374bf4
commit 14bcb3ad18
1 changed files with 3 additions and 5 deletions

View File

@ -61,12 +61,10 @@ static int inject_library_safe(DWORD thread_id, const char *dll)
return -5;
}
for (i = 0; i < 20; i++)
for (i = 0; i < 8; i++) {
Sleep(500);
PostThreadMessage(thread_id, WM_USER + 432, 0, (LPARAM)hook);
Sleep(1000);
for (i = 0; i < 20; i++)
PostThreadMessage(thread_id, WM_USER + 432, 0, (LPARAM)hook);
Sleep(1000);
}
return 0;
}