info.c (a76e7d13) | info.c (4ba4c415) |
---|---|
1/* Unit test suite for *Information* Registry API functions 2 * 3 * Copyright 2005 Paul Vriens 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. --- 5 unchanged lines hidden (view full) --- 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 * 19 */ 20 21#include "ntdll_test.h" | 1/* Unit test suite for *Information* Registry API functions 2 * 3 * Copyright 2005 Paul Vriens 4 * 5 * This library is free software; you can redistribute it and/or 6 * modify it under the terms of the GNU Lesser General Public 7 * License as published by the Free Software Foundation; either 8 * version 2.1 of the License, or (at your option) any later version. --- 5 unchanged lines hidden (view full) --- 14 * 15 * You should have received a copy of the GNU Lesser General Public 16 * License along with this library; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 18 * 19 */ 20 21#include "ntdll_test.h" |
22#include <winnls.h> 23#include <stdio.h> |
|
22 23static NTSTATUS (WINAPI * pRtlDowncaseUnicodeString)(UNICODE_STRING *, const UNICODE_STRING *, BOOLEAN); 24static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); 25static NTSTATUS (WINAPI * pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS, void*, ULONG, void*, ULONG, ULONG*); 26static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG); 27static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG); 28static NTSTATUS (WINAPI * pNtQueryInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG); 29static NTSTATUS (WINAPI * pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG); --- 1931 unchanged lines hidden (view full) --- 1961 { 1962 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY); 1963 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%X\n", mbi.State, MEM_COMMIT); 1964 ok (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_WRITECOPY, 1965 "mbi.Protect is 0x%x\n", mbi.Protect); 1966 } 1967 else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */ 1968 | 24 25static NTSTATUS (WINAPI * pRtlDowncaseUnicodeString)(UNICODE_STRING *, const UNICODE_STRING *, BOOLEAN); 26static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); 27static NTSTATUS (WINAPI * pNtQuerySystemInformationEx)(SYSTEM_INFORMATION_CLASS, void*, ULONG, void*, ULONG, ULONG*); 28static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG); 29static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG); 30static NTSTATUS (WINAPI * pNtQueryInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG); 31static NTSTATUS (WINAPI * pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG); --- 1931 unchanged lines hidden (view full) --- 1963 { 1964 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY); 1965 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%X\n", mbi.State, MEM_COMMIT); 1966 ok (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_WRITECOPY, 1967 "mbi.Protect is 0x%x\n", mbi.Protect); 1968 } 1969 else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */ 1970 |
1971 /* check error code when addr is higher than working set limit */ 1972 status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)~0, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount); 1973 ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); 1974 |
|
1969 trace("Check section name of NTDLL.DLL with invalid size\n"); 1970 module = GetModuleHandleA( "ntdll.dll" ); 1971 memset(msn, 0, sizeof(*msn)); 1972 readcount = 0; 1973 status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(*msn), &readcount); 1974 ok( status == STATUS_BUFFER_OVERFLOW, "Expected STATUS_BUFFER_OVERFLOW, got %08x\n", status); 1975 ok( readcount > 0, "Expected readcount to be > 0\n"); 1976 --- 246 unchanged lines hidden (view full) --- 2223 2224 value = 0xdeadbeef; 2225 status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &ReturnLength); 2226 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); 2227 ok(sizeof(value) == ReturnLength, "Inconsistent length %u\n", ReturnLength); 2228 ok(value == 64, "Expected 64, got %u\n", value); 2229} 2230 | 1975 trace("Check section name of NTDLL.DLL with invalid size\n"); 1976 module = GetModuleHandleA( "ntdll.dll" ); 1977 memset(msn, 0, sizeof(*msn)); 1978 readcount = 0; 1979 status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemorySectionName, msn, sizeof(*msn), &readcount); 1980 ok( status == STATUS_BUFFER_OVERFLOW, "Expected STATUS_BUFFER_OVERFLOW, got %08x\n", status); 1981 ok( readcount > 0, "Expected readcount to be > 0\n"); 1982 --- 246 unchanged lines hidden (view full) --- 2229 2230 value = 0xdeadbeef; 2231 status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &ReturnLength); 2232 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); 2233 ok(sizeof(value) == ReturnLength, "Inconsistent length %u\n", ReturnLength); 2234 ok(value == 64, "Expected 64, got %u\n", value); 2235} 2236 |
2231static void test_working_set_limit(void) 2232{ 2233 DWORD_PTR lower = 0, upper = ~(DWORD_PTR)0; 2234 MEMORY_BASIC_INFORMATION mbi; 2235 SIZE_T readcount; 2236 NTSTATUS status; 2237 2238 while (lower != upper) 2239 { 2240 DWORD_PTR check = (lower >> 1) + (upper >> 1) + (lower & upper & 1); 2241 status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)check, MemoryBasicInformation, 2242 &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount); 2243 if (status == STATUS_INVALID_PARAMETER) upper = check; 2244 else lower = check + 1; 2245 } 2246 2247 trace("working set limit is %p\n", (void *)upper); 2248 ok(upper != ~(DWORD_PTR)0, "expected != ~(DWORD_PTR)0\n"); 2249} 2250 | |
2251START_TEST(info) 2252{ 2253 char **argv; 2254 int argc; 2255 2256 if(!InitFunctionPtrs()) 2257 return; 2258 --- 127 unchanged lines hidden (view full) --- 2386 trace("Starting test_NtGetCurrentProcessorNumber()\n"); 2387 test_NtGetCurrentProcessorNumber(); 2388 2389 trace("Starting test_thread_start_address()\n"); 2390 test_thread_start_address(); 2391 2392 trace("Starting test_query_data_alignment()\n"); 2393 test_query_data_alignment(); | 2237START_TEST(info) 2238{ 2239 char **argv; 2240 int argc; 2241 2242 if(!InitFunctionPtrs()) 2243 return; 2244 --- 127 unchanged lines hidden (view full) --- 2372 trace("Starting test_NtGetCurrentProcessorNumber()\n"); 2373 test_NtGetCurrentProcessorNumber(); 2374 2375 trace("Starting test_thread_start_address()\n"); 2376 test_thread_start_address(); 2377 2378 trace("Starting test_query_data_alignment()\n"); 2379 test_query_data_alignment(); |
2394 2395 trace("Starting test_working_set_limit()\n"); 2396 test_working_set_limit(); | |
2397} | 2380} |