Esme Povirk (@madewokherd) commented about dlls/uiautomationcore/tests/uiautomation.c:
+/* + * Some versions of Windows 10 query multiple unrelated HWNDs when + * winevents are fired, this function waits for these to stop before + * continuing to the next test. + */ +#define TIME_SINCE_LAST_CALLBACK_TIMEOUT 200 +static BOOL wait_for_clientside_callbacks(DWORD total_timeout) +{ + DWORD prev_last_callback_time, cur_time = 0; + DWORD start_time = GetTickCount(); + BOOL ret; + + if (last_clientside_callback_time < start_time) + prev_last_callback_time = start_time; + else + prev_last_callback_time = last_clientside_callback_time; We usually avoid comparisons like this for `GetTickCount()` values, because it can wrap around at 49.7 days uptime. Comparisons like `(cur_time - start_time) >= total_timeout` work correctly even in case of wraparound.
Is there any reason to have `prev_last_callback_time` at all? What if we just set last_clientside_callback_time to start_time here and used that? -- https://gitlab.winehq.org/wine/wine/-/merge_requests/4024#note_47886