mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-05 18:01:34 +00:00
kernel32/tests: Avoid failures when processes start during the process test.
On Windows processes sometimes start during test_services_exe() so that the size returned by the first NtQuerySystemInformation() is no longer sufficient for the second call. Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54094
This commit is contained in:
parent
926433faa3
commit
508b793ec9
1 changed files with 14 additions and 5 deletions
|
@ -4949,16 +4949,25 @@ static void test_job_list_attribute(HANDLE parent_job)
|
|||
static void test_services_exe(void)
|
||||
{
|
||||
NTSTATUS status;
|
||||
ULONG size, offset;
|
||||
ULONG size, offset, try;
|
||||
char *buf;
|
||||
SYSTEM_PROCESS_INFORMATION *spi;
|
||||
ULONG services_pid = 0, services_session_id = ~0;
|
||||
|
||||
status = NtQuerySystemInformation(SystemProcessInformation, NULL, 0, &size);
|
||||
ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status);
|
||||
/* Check that passing a zero size returns a size suitable for the next call,
|
||||
* taking into account that in rare cases processes may start between the
|
||||
* two NtQuerySystemInformation() calls. So this may require a few tries.
|
||||
*/
|
||||
for (try = 0; try < 3; try++)
|
||||
{
|
||||
status = NtQuerySystemInformation(SystemProcessInformation, NULL, 0, &size);
|
||||
ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status);
|
||||
|
||||
buf = malloc(size);
|
||||
status = NtQuerySystemInformation(SystemProcessInformation, buf, size, &size);
|
||||
buf = malloc(size);
|
||||
status = NtQuerySystemInformation(SystemProcessInformation, buf, size, &size);
|
||||
if (status != STATUS_INFO_LENGTH_MISMATCH) break;
|
||||
free(buf);
|
||||
}
|
||||
ok(status == STATUS_SUCCESS, "got %#lx\n", status);
|
||||
|
||||
spi = (SYSTEM_PROCESS_INFORMATION *)buf;
|
||||
|
|
Loading…
Reference in a new issue