advapi32/tests: Fix a service stop race condition.

If some Windows services stop while testing EnumServicesStatusW()'s
resume handle support, one possibility is that the still running
services all fit in the specified buffer, invalidating the test so
there is a retry in place.
But in some cases the second call just returns fewer tests than
expected. So retry in that case too.

Wine-Bug: https://bugs.winehq.org//show_bug.cgi?id=53460
This commit is contained in:
Francois Gouget 2023-11-16 18:50:30 +01:00 committed by Alexandre Julliard
parent 58155d3eb9
commit 96da5a8a35

View file

@ -1370,6 +1370,8 @@ static BOOL test_enum_svc(int attempt)
goto retry; /* service start race condition */
ok(ret, "Expected success, got error %lu\n", GetLastError());
ok(needed == 0, "Expected 0 needed bytes as we are done, got %lu\n", needed);
if (returned < missing && strcmp(winetest_platform, "wine") && attempt)
goto retry; /* service stop race condition */
todo_wine ok(returned == missing, "Expected %lu remaining services, got %lu\n", missing, returned);
ok(resume == 0, "Expected the resume handle to be 0\n");