ntdll: Calculate SystemProcessInformation's ReturnLength and return it.

This commit is contained in:
Akihiro Sagawa 2012-10-23 23:52:35 +09:00 committed by Alexandre Julliard
parent 3fc4e88473
commit bb4a31a8ed
2 changed files with 5 additions and 4 deletions

View File

@ -1739,9 +1739,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
/* spi->ti will be set later on */ /* spi->ti will be set later on */
len += procstructlen;
} }
else ret = STATUS_INFO_LENGTH_MISMATCH; len += procstructlen;
} }
} }
SERVER_END_REQ; SERVER_END_REQ;
@ -1751,7 +1750,8 @@ NTSTATUS WINAPI NtQuerySystemInformation(
if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS; if (ret == STATUS_NO_MORE_FILES) ret = STATUS_SUCCESS;
break; break;
} }
else /* Length is already checked for */
if (Length >= len)
{ {
int i, j; int i, j;
@ -1799,6 +1799,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
} }
} }
if (ret == STATUS_SUCCESS && last) last->NextEntryOffset = 0; if (ret == STATUS_SUCCESS && last) last->NextEntryOffset = 0;
if (len > Length) ret = STATUS_INFO_LENGTH_MISMATCH;
if (hSnap) NtClose(hSnap); if (hSnap) NtClose(hSnap);
} }
break; break;

View File

@ -289,7 +289,7 @@ static void test_query_process(void)
ReturnLength = 0; ReturnLength = 0;
status = pNtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ReturnLength); status = pNtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_LENGTH_MISMATCH got %08x\n", status); ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_LENGTH_MISMATCH got %08x\n", status);
todo_wine ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */, ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */,
"Expected a ReturnLength to show the needed length\n"); "Expected a ReturnLength to show the needed length\n");
/* W2K3 and later returns the needed length, the rest returns 0, so we have to loop */ /* W2K3 and later returns the needed length, the rest returns 0, so we have to loop */