When elapsed time exceeded the timeout, the remaining milliseconds expression went negative and was implicitly converted to DWORD, wrapping to ~0xFFFFFFFF (5 days) — effectively INFINITE. Now clamps to 0 and returns false when time has elapsed.