Commit 7ee7953c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

kernel32/tests: Call NtQuerySystemInformation(SystemProcessInformation) until it…

kernel32/tests: Call NtQuerySystemInformation(SystemProcessInformation) until it returns STATUS_SUCCESS. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent ec3cdaba
...@@ -230,18 +230,19 @@ static DWORD WINAPI get_id_thread(void* curr_pid) ...@@ -230,18 +230,19 @@ static DWORD WINAPI get_id_thread(void* curr_pid)
ok(found == FALSE, "The thread order is not strictly consistent\n"); ok(found == FALSE, "The thread order is not strictly consistent\n");
/* Determine the order by NtQuerySystemInformation function */ /* Determine the order by NtQuerySystemInformation function */
pcs_buffer = NULL;
status = pNtQuerySystemInformation(SystemProcessInformation, pcs_buffer, buf_size, &buf_size); while ((status = NtQuerySystemInformation(SystemProcessInformation,
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Failed with %x\n", status); pcs_buffer, buf_size, &buf_size)) == STATUS_INFO_LENGTH_MISMATCH)
if (status == STATUS_INFO_LENGTH_MISMATCH)
{ {
pcs_buffer = HeapAlloc(GetProcessHeap(), 0, buf_size); free(pcs_buffer);
ok(pcs_buffer != NULL, "Unable to allocate space\n"); pcs_buffer = malloc(buf_size);
}
ok(status == STATUS_SUCCESS, "got %#x\n", status);
found = FALSE; found = FALSE;
matched_idx = -1; matched_idx = -1;
status = NtQuerySystemInformation(SystemProcessInformation, pcs_buffer, buf_size, &buf_size); do
do { {
spi = (SYSTEM_PROCESS_INFORMATION*)&pcs_buffer[pcs_offset]; spi = (SYSTEM_PROCESS_INFORMATION*)&pcs_buffer[pcs_offset];
if (spi->UniqueProcessId == curr_pid) if (spi->UniqueProcessId == curr_pid)
{ {
...@@ -266,9 +267,7 @@ static DWORD WINAPI get_id_thread(void* curr_pid) ...@@ -266,9 +267,7 @@ static DWORD WINAPI get_id_thread(void* curr_pid)
thread_traversed[matched_idx++] = tid; thread_traversed[matched_idx++] = tid;
} }
} }
} free(pcs_buffer);
if (pcs_buffer)
HeapFree(GetProcessHeap(), 0, pcs_buffer);
ok(matched_idx > 0, "No thread id match found\n"); ok(matched_idx > 0, "No thread id match found\n");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment