mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-15 19:57:18 +00:00
ntdll/tests: Fix SYSTEM_CACHE_INFORMATION failures.
This commit is contained in:
parent
2fb6dcb3f2
commit
3e162934d1
|
@ -505,18 +505,51 @@ static void test_query_cache(void)
|
||||||
{
|
{
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
ULONG ReturnLength;
|
ULONG ReturnLength;
|
||||||
SYSTEM_CACHE_INFORMATION sci;
|
BYTE buffer[128];
|
||||||
|
SYSTEM_CACHE_INFORMATION *sci = (SYSTEM_CACHE_INFORMATION *) buffer;
|
||||||
|
ULONG expected;
|
||||||
|
INT i;
|
||||||
|
|
||||||
status = pNtQuerySystemInformation(SystemCacheInformation, &sci, 0, &ReturnLength);
|
/* the large SYSTEM_CACHE_INFORMATION on WIN64 is not documented */
|
||||||
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
expected = sizeof(SYSTEM_CACHE_INFORMATION);
|
||||||
|
for (i = sizeof(buffer); i>= expected; i--)
|
||||||
|
{
|
||||||
|
ReturnLength = 0xdeadbeef;
|
||||||
|
status = pNtQuerySystemInformation(SystemCacheInformation, sci, i, &ReturnLength);
|
||||||
|
ok(!status && (ReturnLength == expected),
|
||||||
|
"%d: got 0x%x and %u (expected STATUS_SUCCESS and %u)\n", i, status, ReturnLength, expected);
|
||||||
|
}
|
||||||
|
|
||||||
status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci), &ReturnLength);
|
/* buffer too small for the full result.
|
||||||
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
Up to win7, the function succeeds with a partial result. */
|
||||||
ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
status = pNtQuerySystemInformation(SystemCacheInformation, sci, i, &ReturnLength);
|
||||||
|
if (!status)
|
||||||
|
{
|
||||||
|
expected = offsetof(SYSTEM_CACHE_INFORMATION, MinimumWorkingSet);
|
||||||
|
for (; i>= expected; i--)
|
||||||
|
{
|
||||||
|
ReturnLength = 0xdeadbeef;
|
||||||
|
status = pNtQuerySystemInformation(SystemCacheInformation, sci, i, &ReturnLength);
|
||||||
|
ok(!status && (ReturnLength == expected),
|
||||||
|
"%d: got 0x%x and %u (expected STATUS_SUCCESS and %u)\n", i, status, ReturnLength, expected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
status = pNtQuerySystemInformation(SystemCacheInformation, &sci, sizeof(sci) + 2, &ReturnLength);
|
/* buffer too small for the result, this call will always fail */
|
||||||
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
ReturnLength = 0xdeadbeef;
|
||||||
ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
status = pNtQuerySystemInformation(SystemCacheInformation, sci, i, &ReturnLength);
|
||||||
|
ok( status == STATUS_INFO_LENGTH_MISMATCH &&
|
||||||
|
((ReturnLength == expected) || broken(!ReturnLength) || broken(ReturnLength == 0xfffffff0)),
|
||||||
|
"%d: got 0x%x and %u (expected STATUS_INFO_LENGTH_MISMATCH and %u)\n", i, status, ReturnLength, expected);
|
||||||
|
|
||||||
|
if (0) {
|
||||||
|
/* this crashes on some vista / win7 machines */
|
||||||
|
ReturnLength = 0xdeadbeef;
|
||||||
|
status = pNtQuerySystemInformation(SystemCacheInformation, sci, 0, &ReturnLength);
|
||||||
|
ok( status == STATUS_INFO_LENGTH_MISMATCH &&
|
||||||
|
((ReturnLength == expected) || broken(!ReturnLength) || broken(ReturnLength == 0xfffffff0)),
|
||||||
|
"0: got 0x%x and %u (expected STATUS_INFO_LENGTH_MISMATCH and %u)\n", status, ReturnLength, expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void test_query_interrupt(void)
|
static void test_query_interrupt(void)
|
||||||
|
|
|
@ -1287,10 +1287,11 @@ typedef struct _SYSTEM_CACHE_INFORMATION {
|
||||||
ULONG CurrentSize;
|
ULONG CurrentSize;
|
||||||
ULONG PeakSize;
|
ULONG PeakSize;
|
||||||
ULONG PageFaultCount;
|
ULONG PageFaultCount;
|
||||||
#ifndef _WIN64
|
|
||||||
ULONG MinimumWorkingSet;
|
ULONG MinimumWorkingSet;
|
||||||
ULONG MaximumWorkingSet;
|
ULONG MaximumWorkingSet;
|
||||||
ULONG unused[4];
|
ULONG unused[4];
|
||||||
|
#ifdef _WIN64
|
||||||
|
ULONG unknown64[7];
|
||||||
#endif
|
#endif
|
||||||
} SYSTEM_CACHE_INFORMATION, *PSYSTEM_CACHE_INFORMATION;
|
} SYSTEM_CACHE_INFORMATION, *PSYSTEM_CACHE_INFORMATION;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue