Only exact buffer size gives STATUS_SUCCESS.

This commit is contained in:
Paul Vriens 2005-06-15 10:19:34 +00:00 committed by Alexandre Julliard
parent a4bb17c314
commit 7691aca10c
2 changed files with 6 additions and 1 deletions

View File

@ -605,7 +605,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
sbi.bKeNumberProcessors = 1; /* FIXME */
len = sizeof(sbi);
if ( Length >= len)
if ( Length == len)
{
if (!SystemInformation) ret = STATUS_ACCESS_VIOLATION;
else memcpy( SystemInformation, &sbi, len);

View File

@ -78,6 +78,11 @@ static void test_query_basic()
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
/* Check a too large buffer size */
trace("Check a too large buffer size\n");
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi) * 2, &ReturnLength);
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
/* Finally some correct calls */
trace("Check with correct parameters\n");
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);