2007-03-06 11:59:18 +00:00
|
|
|
/* Unit test suite for *Information* Registry API functions
|
|
|
|
*
|
|
|
|
* Copyright 2005 Paul Vriens
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "ntdll_test.h"
|
2008-05-12 08:33:26 +00:00
|
|
|
#include <winnls.h>
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
#include <stdio.h>
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
|
2012-12-09 20:47:13 +00:00
|
|
|
static NTSTATUS (WINAPI * pNtPowerInformation)(POWER_INFORMATION_LEVEL, PVOID, ULONG, PVOID, ULONG);
|
2007-03-06 11:59:18 +00:00
|
|
|
static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG);
|
2010-03-15 17:59:46 +00:00
|
|
|
static NTSTATUS (WINAPI * pNtQueryInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG);
|
|
|
|
static NTSTATUS (WINAPI * pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG);
|
|
|
|
static NTSTATUS (WINAPI * pNtSetInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG);
|
2008-05-12 08:33:26 +00:00
|
|
|
static NTSTATUS (WINAPI * pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*);
|
2011-10-03 19:29:29 +00:00
|
|
|
static NTSTATUS (WINAPI * pNtQueryVirtualMemory)(HANDLE, LPCVOID, MEMORY_INFORMATION_CLASS , PVOID , SIZE_T , SIZE_T *);
|
|
|
|
static NTSTATUS (WINAPI * pNtCreateSection)(HANDLE*,ACCESS_MASK,const OBJECT_ATTRIBUTES*,const LARGE_INTEGER*,ULONG,ULONG,HANDLE);
|
|
|
|
static NTSTATUS (WINAPI * pNtMapViewOfSection)(HANDLE,HANDLE,PVOID*,ULONG,SIZE_T,const LARGE_INTEGER*,SIZE_T*,SECTION_INHERIT,ULONG,ULONG);
|
|
|
|
static NTSTATUS (WINAPI * pNtUnmapViewOfSection)(HANDLE,PVOID);
|
|
|
|
static NTSTATUS (WINAPI * pNtClose)(HANDLE);
|
2012-12-09 20:47:13 +00:00
|
|
|
static ULONG (WINAPI * pNtGetCurrentProcessorNumber)(void);
|
|
|
|
static BOOL (WINAPI * pIsWow64Process)(HANDLE, PBOOL);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
|
|
|
|
static BOOL is_wow64;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* one_before_last_pid is used to be able to compare values of a still running process
|
|
|
|
with the output of the test_query_process_times and test_query_process_handlecount tests.
|
|
|
|
*/
|
|
|
|
static DWORD one_before_last_pid = 0;
|
|
|
|
|
2008-05-12 08:33:26 +00:00
|
|
|
#define NTDLL_GET_PROC(func) do { \
|
2007-03-06 11:59:18 +00:00
|
|
|
p ## func = (void*)GetProcAddress(hntdll, #func); \
|
|
|
|
if(!p ## func) { \
|
|
|
|
trace("GetProcAddress(%s) failed\n", #func); \
|
|
|
|
return FALSE; \
|
2008-05-12 08:33:26 +00:00
|
|
|
} \
|
|
|
|
} while(0)
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
static BOOL InitFunctionPtrs(void)
|
|
|
|
{
|
2008-05-12 08:33:26 +00:00
|
|
|
/* All needed functions are NT based, so using GetModuleHandle is a good check */
|
2014-04-20 13:44:55 +00:00
|
|
|
HMODULE hntdll = GetModuleHandleA("ntdll");
|
2008-05-12 08:33:26 +00:00
|
|
|
if (!hntdll)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2010-03-15 17:59:46 +00:00
|
|
|
win_skip("Not running on NT\n");
|
2008-05-12 08:33:26 +00:00
|
|
|
return FALSE;
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
2008-05-12 08:33:26 +00:00
|
|
|
|
|
|
|
NTDLL_GET_PROC(NtQuerySystemInformation);
|
2012-12-09 20:47:13 +00:00
|
|
|
NTDLL_GET_PROC(NtPowerInformation);
|
2008-05-12 08:33:26 +00:00
|
|
|
NTDLL_GET_PROC(NtQueryInformationProcess);
|
2010-03-15 17:59:46 +00:00
|
|
|
NTDLL_GET_PROC(NtQueryInformationThread);
|
|
|
|
NTDLL_GET_PROC(NtSetInformationProcess);
|
|
|
|
NTDLL_GET_PROC(NtSetInformationThread);
|
2008-05-12 08:33:26 +00:00
|
|
|
NTDLL_GET_PROC(NtReadVirtualMemory);
|
2011-10-03 19:29:29 +00:00
|
|
|
NTDLL_GET_PROC(NtQueryVirtualMemory);
|
|
|
|
NTDLL_GET_PROC(NtClose);
|
|
|
|
NTDLL_GET_PROC(NtCreateSection);
|
|
|
|
NTDLL_GET_PROC(NtMapViewOfSection);
|
|
|
|
NTDLL_GET_PROC(NtUnmapViewOfSection);
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
/* not present before XP */
|
|
|
|
pNtGetCurrentProcessorNumber = (void *) GetProcAddress(hntdll, "NtGetCurrentProcessorNumber");
|
|
|
|
|
2014-04-20 13:44:55 +00:00
|
|
|
pIsWow64Process = (void *)GetProcAddress(GetModuleHandleA("kernel32.dll"), "IsWow64Process");
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
if (!pIsWow64Process || !pIsWow64Process( GetCurrentProcess(), &is_wow64 )) is_wow64 = FALSE;
|
2007-03-06 11:59:18 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_basic(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
|
2008-05-12 08:33:26 +00:00
|
|
|
/* This test also covers some basic parameter testing that should be the same for
|
2007-03-06 11:59:18 +00:00
|
|
|
* every information class
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Use a nonexistent info class */
|
|
|
|
trace("Check nonexistent info class\n");
|
|
|
|
status = pNtQuerySystemInformation(-1, NULL, 0, NULL);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_NOT_IMPLEMENTED /* vista */,
|
|
|
|
"Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use an existing class but with a zero-length buffer */
|
|
|
|
trace("Check zero-length buffer\n");
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, NULL, 0, NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use an existing class, correct length but no SystemInformation buffer */
|
|
|
|
trace("Check no SystemInformation buffer\n");
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, NULL, sizeof(sbi), NULL);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_PARAMETER /* vista */,
|
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2014-04-20 13:44:55 +00:00
|
|
|
/* Use an existing class, correct length, a pointer to a buffer but no ReturnLength pointer */
|
2007-03-06 11:59:18 +00:00
|
|
|
trace("Check no ReturnLength pointer\n");
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check a too large buffer size */
|
|
|
|
trace("Check a too large buffer size\n");
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi) * 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Finally some correct calls */
|
|
|
|
trace("Check with correct parameters\n");
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(sbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values */
|
|
|
|
trace("Number of Processors : %d\n", sbi.NumberOfProcessors);
|
|
|
|
ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n", sbi.NumberOfProcessors);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_cpu(void)
|
|
|
|
{
|
|
|
|
DWORD status;
|
|
|
|
ULONG ReturnLength;
|
|
|
|
SYSTEM_CPU_INFORMATION sci;
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(sci) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("Processor FeatureSet : %08x\n", sci.FeatureSet);
|
|
|
|
ok( sci.FeatureSet != 0, "Expected some features for this processor, got %08x\n", sci.FeatureSet);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_performance(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
ULONGLONG buffer[sizeof(SYSTEM_PERFORMANCE_INFORMATION)/sizeof(ULONGLONG) + 5];
|
|
|
|
DWORD size = sizeof(SYSTEM_PERFORMANCE_INFORMATION);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size, &ReturnLength);
|
|
|
|
if (status == STATUS_INFO_LENGTH_MISMATCH && is_wow64)
|
|
|
|
{
|
|
|
|
/* size is larger on wow64 under w2k8/win7 */
|
|
|
|
size += 16;
|
|
|
|
status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size, &ReturnLength);
|
|
|
|
}
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
ok( ReturnLength == size, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size + 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
ok( ReturnLength == size || ReturnLength == size + 2,
|
2010-03-15 17:59:46 +00:00
|
|
|
"Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Not return values yet, as struct members are unknown */
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_timeofday(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
|
|
|
|
/* Copy of our winternl.h structure turned into a private one */
|
|
|
|
typedef struct _SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE {
|
|
|
|
LARGE_INTEGER liKeBootTime;
|
|
|
|
LARGE_INTEGER liKeSystemTime;
|
|
|
|
LARGE_INTEGER liExpTimeZoneBias;
|
|
|
|
ULONG uCurrentTimeZoneId;
|
|
|
|
DWORD dwUnknown1[5];
|
2012-12-09 20:47:13 +00:00
|
|
|
} SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE sti;
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* The struct size for NT (32 bytes) and Win2K/XP (48 bytes) differ.
|
|
|
|
*
|
|
|
|
* Windows 2000 and XP return STATUS_INFO_LENGTH_MISMATCH if the given buffer size is greater
|
|
|
|
* then 48 and 0 otherwise
|
|
|
|
* Windows NT returns STATUS_INFO_LENGTH_MISMATCH when the given buffer size is not correct
|
|
|
|
* and 0 otherwise
|
|
|
|
*
|
|
|
|
* Windows 2000 and XP copy the given buffer size into the provided buffer, if the return code is STATUS_SUCCESS
|
|
|
|
* NT only fills the buffer if the return code is STATUS_SUCCESS
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength);
|
|
|
|
|
|
|
|
if (status == STATUS_INFO_LENGTH_MISMATCH)
|
|
|
|
{
|
|
|
|
trace("Windows version is NT, we have to cater for differences with W2K/WinXP\n");
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
ok( 0 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
sti.uCurrentTimeZoneId = 0xdeadbeef;
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 28, &ReturnLength);
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(status == STATUS_SUCCESS || broken(status == STATUS_INFO_LENGTH_MISMATCH /* NT4 */), "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( 0xdeadbeef == sti.uCurrentTimeZoneId, "This part of the buffer should not have been filled\n");
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 32, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( 32 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( 0 == ReturnLength, "ReturnLength should be 0, it is (%d)\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
sti.uCurrentTimeZoneId = 0xdeadbeef;
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 24, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( 24 == ReturnLength, "ReturnLength should be 24, it is (%d)\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( 0xdeadbeef == sti.uCurrentTimeZoneId, "This part of the buffer should not have been filled\n");
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
sti.uCurrentTimeZoneId = 0xdeadbeef;
|
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 32, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( 32 == ReturnLength, "ReturnLength should be 32, it is (%d)\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( 0xdeadbeef != sti.uCurrentTimeZoneId, "Buffer should have been partially filled\n");
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, 49, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( ReturnLength == 0 || ReturnLength == sizeof(sti) /* vista */,
|
|
|
|
"ReturnLength should be 0, it is (%d)\n", ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(sti) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Check if we have some return values */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("uCurrentTimeZoneId : (%d)\n", sti.uCurrentTimeZoneId);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_process(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
DWORD last_pid;
|
|
|
|
ULONG ReturnLength;
|
|
|
|
int i = 0, k = 0;
|
2014-04-20 13:44:55 +00:00
|
|
|
BOOL is_nt = FALSE;
|
2007-03-06 11:59:18 +00:00
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
|
|
|
|
/* Copy of our winternl.h structure turned into a private one */
|
|
|
|
typedef struct _SYSTEM_PROCESS_INFORMATION_PRIVATE {
|
2010-03-15 17:59:46 +00:00
|
|
|
ULONG NextEntryOffset;
|
2007-03-06 11:59:18 +00:00
|
|
|
DWORD dwThreadCount;
|
|
|
|
DWORD dwUnknown1[6];
|
|
|
|
FILETIME ftCreationTime;
|
|
|
|
FILETIME ftUserTime;
|
|
|
|
FILETIME ftKernelTime;
|
|
|
|
UNICODE_STRING ProcessName;
|
|
|
|
DWORD dwBasePriority;
|
2010-03-15 17:59:46 +00:00
|
|
|
HANDLE UniqueProcessId;
|
|
|
|
HANDLE ParentProcessId;
|
|
|
|
ULONG HandleCount;
|
2007-03-06 11:59:18 +00:00
|
|
|
DWORD dwUnknown3;
|
|
|
|
DWORD dwUnknown4;
|
|
|
|
VM_COUNTERS vmCounters;
|
|
|
|
IO_COUNTERS ioCounters;
|
|
|
|
SYSTEM_THREAD_INFORMATION ti[1];
|
2012-12-09 20:47:13 +00:00
|
|
|
} SYSTEM_PROCESS_INFORMATION_PRIVATE;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
ULONG SystemInformationLength = sizeof(SYSTEM_PROCESS_INFORMATION_PRIVATE);
|
2008-12-12 23:42:40 +00:00
|
|
|
SYSTEM_PROCESS_INFORMATION_PRIVATE *spi, *spi_buf = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
/* test ReturnLength */
|
|
|
|
ReturnLength = 0;
|
|
|
|
status = pNtQuerySystemInformation(SystemProcessInformation, NULL, 0, &ReturnLength);
|
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_LENGTH_MISMATCH got %08x\n", status);
|
|
|
|
ok( ReturnLength > 0 || broken(ReturnLength == 0) /* NT4, Win2K */,
|
|
|
|
"Expected a ReturnLength to show the needed length\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
/* W2K3 and later returns the needed length, the rest returns 0, so we have to loop */
|
2007-03-06 11:59:18 +00:00
|
|
|
for (;;)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemProcessInformation, spi_buf, SystemInformationLength, &ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
if (status != STATUS_INFO_LENGTH_MISMATCH) break;
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2008-12-12 23:42:40 +00:00
|
|
|
spi_buf = HeapReAlloc(GetProcessHeap(), 0, spi_buf , SystemInformationLength *= 2);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2008-12-12 23:42:40 +00:00
|
|
|
spi = spi_buf;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
/* Get the first NextEntryOffset, from this we can deduce the OS version we're running
|
2007-03-06 11:59:18 +00:00
|
|
|
*
|
|
|
|
* W2K/WinXP/W2K3:
|
2010-03-15 17:59:46 +00:00
|
|
|
* NextEntryOffset for a process is 184 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION)
|
2007-03-06 11:59:18 +00:00
|
|
|
* NT:
|
2010-03-15 17:59:46 +00:00
|
|
|
* NextEntryOffset for a process is 136 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION)
|
2007-03-06 11:59:18 +00:00
|
|
|
* Wine (with every windows version):
|
2010-03-15 17:59:46 +00:00
|
|
|
* NextEntryOffset for a process is 0 if just this test is running
|
|
|
|
* NextEntryOffset for a process is 184 + (no. of threads) * sizeof(SYSTEM_THREAD_INFORMATION) +
|
2007-03-06 11:59:18 +00:00
|
|
|
* ProcessName.MaximumLength
|
|
|
|
* if more wine processes are running
|
|
|
|
*
|
|
|
|
* Note : On windows the first process is in fact the Idle 'process' with a thread for every processor
|
|
|
|
*/
|
|
|
|
|
|
|
|
pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
is_nt = ( spi->NextEntryOffset - (sbi.NumberOfProcessors * sizeof(SYSTEM_THREAD_INFORMATION)) == 136);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
if (is_nt) win_skip("Windows version is NT, we will skip thread tests\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values
|
2008-05-12 08:33:26 +00:00
|
|
|
*
|
2007-03-06 11:59:18 +00:00
|
|
|
* On windows there will be several processes running (Including the always present Idle and System)
|
|
|
|
* On wine we only have one (if this test is the only wine process running)
|
|
|
|
*/
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* Loop through the processes */
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
last_pid = (DWORD_PTR)spi->UniqueProcessId;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
ok( spi->dwThreadCount > 0, "Expected some threads for this process, got 0\n");
|
|
|
|
|
|
|
|
/* Loop through the threads, skip NT4 for now */
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
if (!is_nt)
|
|
|
|
{
|
|
|
|
DWORD j;
|
2008-05-12 08:33:26 +00:00
|
|
|
for ( j = 0; j < spi->dwThreadCount; j++)
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
|
|
|
k++;
|
2010-03-15 17:59:46 +00:00
|
|
|
ok ( spi->ti[j].ClientId.UniqueProcess == spi->UniqueProcessId,
|
|
|
|
"The owning pid of the thread (%p) doesn't equal the pid (%p) of the process\n",
|
|
|
|
spi->ti[j].ClientId.UniqueProcess, spi->UniqueProcessId);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
if (!spi->NextEntryOffset) break;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
one_before_last_pid = last_pid;
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
spi = (SYSTEM_PROCESS_INFORMATION_PRIVATE*)((char*)spi + spi->NextEntryOffset);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
trace("Total number of running processes : %d\n", i);
|
|
|
|
if (!is_nt) trace("Total number of running threads : %d\n", k);
|
|
|
|
|
|
|
|
if (one_before_last_pid == 0) one_before_last_pid = last_pid;
|
|
|
|
|
2008-12-12 23:42:40 +00:00
|
|
|
HeapFree( GetProcessHeap(), 0, spi_buf);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_procperf(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
ULONG NeededLength;
|
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION* sppi;
|
|
|
|
|
|
|
|
/* Find out the number of processors */
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
NeededLength = sbi.NumberOfProcessors * sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION);
|
|
|
|
|
|
|
|
sppi = HeapAlloc(GetProcessHeap(), 0, NeededLength);
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Try it for 1 processor */
|
2008-12-12 23:42:40 +00:00
|
|
|
sppi->KernelTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->UserTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->IdleTime.QuadPart = 0xdeaddead;
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi,
|
|
|
|
sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( sizeof(SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION) == ReturnLength,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Inconsistent length %d\n", ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
|
|
|
|
ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
|
|
|
|
ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* Try it for all processors */
|
2008-12-12 23:42:40 +00:00
|
|
|
sppi->KernelTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->UserTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->IdleTime.QuadPart = 0xdeaddead;
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( NeededLength == ReturnLength, "Inconsistent length (%d) <-> (%d)\n", NeededLength, ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
|
|
|
|
ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
|
|
|
|
ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* A too large given buffer size */
|
|
|
|
sppi = HeapReAlloc(GetProcessHeap(), 0, sppi , NeededLength + 2);
|
2008-12-12 23:42:40 +00:00
|
|
|
sppi->KernelTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->UserTime.QuadPart = 0xdeaddead;
|
|
|
|
sppi->IdleTime.QuadPart = 0xdeaddead;
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength + 2, &ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_SUCCESS || status == STATUS_INFO_LENGTH_MISMATCH /* vista */,
|
|
|
|
"Expected STATUS_SUCCESS or STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( NeededLength == ReturnLength, "Inconsistent length (%d) <-> (%d)\n", NeededLength, ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
|
|
|
|
ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
|
|
|
|
ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
|
|
|
|
}
|
|
|
|
else /* vista and 2008 */
|
|
|
|
{
|
|
|
|
ok (sppi->KernelTime.QuadPart == 0xdeaddead, "KernelTime changed\n");
|
|
|
|
ok (sppi->UserTime.QuadPart == 0xdeaddead, "UserTime changed\n");
|
|
|
|
ok (sppi->IdleTime.QuadPart == 0xdeaddead, "IdleTime changed\n");
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, sppi);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_module(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
ULONG ModuleCount, i;
|
|
|
|
|
|
|
|
ULONG SystemInformationLength = sizeof(SYSTEM_MODULE_INFORMATION);
|
2008-05-12 08:33:26 +00:00
|
|
|
SYSTEM_MODULE_INFORMATION* smi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
SYSTEM_MODULE* sm;
|
|
|
|
|
|
|
|
/* Request the needed length */
|
|
|
|
status = pNtQuerySystemInformation(SystemModuleInformation, smi, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( ReturnLength > 0, "Expected a ReturnLength to show the needed length\n");
|
|
|
|
|
|
|
|
SystemInformationLength = ReturnLength;
|
|
|
|
smi = HeapReAlloc(GetProcessHeap(), 0, smi , SystemInformationLength);
|
|
|
|
status = pNtQuerySystemInformation(SystemModuleInformation, smi, SystemInformationLength, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
ModuleCount = smi->ModulesCount;
|
|
|
|
sm = &smi->Modules[0];
|
2008-05-12 08:33:26 +00:00
|
|
|
/* our implementation is a stub for now */
|
|
|
|
ok( ModuleCount > 0, "Expected some modules to be loaded\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Loop through all the modules/drivers, Wine doesn't get here (yet) */
|
|
|
|
for (i = 0; i < ModuleCount ; i++)
|
|
|
|
{
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( i == sm->Id, "Id (%d) should have matched %u\n", sm->Id, i);
|
2007-03-06 11:59:18 +00:00
|
|
|
sm++;
|
|
|
|
}
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, smi);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_handle(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
ULONG SystemInformationLength = sizeof(SYSTEM_HANDLE_INFORMATION);
|
|
|
|
SYSTEM_HANDLE_INFORMATION* shi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
|
|
|
|
|
|
|
|
/* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
|
|
|
|
status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
todo_wine ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
SystemInformationLength = ReturnLength;
|
|
|
|
shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength);
|
|
|
|
status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
|
2008-12-12 23:42:40 +00:00
|
|
|
if (status != STATUS_INFO_LENGTH_MISMATCH) /* vista */
|
2007-03-06 11:59:18 +00:00
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_SUCCESS,
|
|
|
|
"Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2008-12-12 23:42:40 +00:00
|
|
|
/* Check if we have some return values */
|
|
|
|
trace("Number of Handles : %d\n", shi->Count);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
/* our implementation is a stub for now */
|
|
|
|
ok( shi->Count > 1, "Expected more than 1 handles, got (%d)\n", shi->Count);
|
|
|
|
}
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
HeapFree( GetProcessHeap(), 0, shi);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_cache(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
2013-09-10 16:49:44 +00:00
|
|
|
BYTE buffer[128];
|
|
|
|
SYSTEM_CACHE_INFORMATION *sci = (SYSTEM_CACHE_INFORMATION *) buffer;
|
|
|
|
ULONG expected;
|
|
|
|
INT i;
|
|
|
|
|
|
|
|
/* the large SYSTEM_CACHE_INFORMATION on WIN64 is not documented */
|
|
|
|
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);
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2013-09-10 16:49:44 +00:00
|
|
|
/* buffer too small for the full result.
|
|
|
|
Up to win7, the function succeeds with a partial result. */
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2013-09-10 16:49:44 +00:00
|
|
|
/* buffer too small for the result, this call will always fail */
|
|
|
|
ReturnLength = 0xdeadbeef;
|
|
|
|
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);
|
|
|
|
}
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_interrupt(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
ULONG NeededLength;
|
|
|
|
SYSTEM_BASIC_INFORMATION sbi;
|
|
|
|
SYSTEM_INTERRUPT_INFORMATION* sii;
|
|
|
|
|
|
|
|
/* Find out the number of processors */
|
|
|
|
status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
NeededLength = sbi.NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION);
|
|
|
|
|
|
|
|
sii = HeapAlloc(GetProcessHeap(), 0, NeededLength);
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Try it for all processors */
|
|
|
|
status = pNtQuerySystemInformation(SystemInterruptInformation, sii, NeededLength, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Windows XP and W2K3 (and others?) always return 0 for the ReturnLength
|
|
|
|
* No test added for this as it's highly unlikely that an app depends on this
|
|
|
|
*/
|
|
|
|
|
|
|
|
HeapFree( GetProcessHeap(), 0, sii);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_kerndebug(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
SYSTEM_KERNEL_DEBUGGER_INFORMATION skdi;
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(skdi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi) + 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(skdi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_regquota(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
SYSTEM_REGISTRY_QUOTA_INFORMATION srqi;
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, 0, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(srqi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi) + 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(srqi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
static void test_query_logicalproc(void)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
ULONG len, i, proc_no;
|
|
|
|
SYSTEM_LOGICAL_PROCESSOR_INFORMATION *slpi;
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
|
|
|
|
GetSystemInfo(&si);
|
|
|
|
|
|
|
|
status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, NULL, 0, &len);
|
|
|
|
if(status == STATUS_INVALID_INFO_CLASS)
|
|
|
|
{
|
|
|
|
win_skip("SystemLogicalProcessorInformation is not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
if(status == STATUS_NOT_IMPLEMENTED)
|
|
|
|
{
|
|
|
|
todo_wine ok(0, "SystemLogicalProcessorInformation is not implemented\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
ok(len%sizeof(*slpi) == 0, "Incorrect length %d\n", len);
|
|
|
|
|
|
|
|
slpi = HeapAlloc(GetProcessHeap(), 0, len);
|
|
|
|
status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, slpi, len, &len);
|
|
|
|
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
proc_no = 0;
|
|
|
|
for(i=0; i<len/sizeof(*slpi); i++) {
|
|
|
|
switch(slpi[i].Relationship) {
|
|
|
|
case RelationProcessorCore:
|
|
|
|
/* Get number of logical processors */
|
|
|
|
for(; slpi[i].ProcessorMask; slpi[i].ProcessorMask /= 2)
|
|
|
|
proc_no += slpi[i].ProcessorMask%2;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ok(proc_no > 0, "No processors were found\n");
|
|
|
|
if(si.dwNumberOfProcessors <= 32)
|
|
|
|
ok(proc_no == si.dwNumberOfProcessors, "Incorrect number of logical processors: %d, expected %d\n",
|
|
|
|
proc_no, si.dwNumberOfProcessors);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, slpi);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_processor_power_info(void)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
PROCESSOR_POWER_INFORMATION* ppi;
|
|
|
|
ULONG size;
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
GetSystemInfo(&si);
|
|
|
|
size = si.dwNumberOfProcessors * sizeof(PROCESSOR_POWER_INFORMATION);
|
|
|
|
ppi = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
|
|
|
|
/* If size < (sizeof(PROCESSOR_POWER_INFORMATION) * NumberOfProcessors), Win7 returns
|
|
|
|
* STATUS_BUFFER_TOO_SMALL. WinXP returns STATUS_SUCCESS for any value of size. It copies as
|
|
|
|
* many whole PROCESSOR_POWER_INFORMATION structures that there is room for. Even if there is
|
|
|
|
* not enough room for one structure, WinXP still returns STATUS_SUCCESS having done nothing.
|
|
|
|
*
|
|
|
|
* If ppi == NULL, Win7 returns STATUS_INVALID_PARAMETER while WinXP returns STATUS_SUCCESS
|
|
|
|
* and does nothing.
|
|
|
|
*
|
|
|
|
* The same behavior is seen with CallNtPowerInformation (in powrprof.dll).
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (si.dwNumberOfProcessors > 1)
|
|
|
|
{
|
|
|
|
for(i = 0; i < si.dwNumberOfProcessors; i++)
|
|
|
|
ppi[i].Number = 0xDEADBEEF;
|
|
|
|
|
|
|
|
/* Call with a buffer size that is large enough to hold at least one but not large
|
|
|
|
* enough to hold them all. This will be STATUS_SUCCESS on WinXP but not on Win7 */
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, size - sizeof(PROCESSOR_POWER_INFORMATION));
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
/* lax version found on older Windows like WinXP */
|
|
|
|
ok( (ppi[si.dwNumberOfProcessors - 2].Number != 0xDEADBEEF) &&
|
|
|
|
(ppi[si.dwNumberOfProcessors - 1].Number == 0xDEADBEEF),
|
|
|
|
"Expected all but the last record to be overwritten.\n");
|
|
|
|
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, 0, size);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
for(i = 0; i < si.dwNumberOfProcessors; i++)
|
|
|
|
ppi[i].Number = 0xDEADBEEF;
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) - 1);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
for(i = 0; i < si.dwNumberOfProcessors; i++)
|
|
|
|
if (ppi[i].Number != 0xDEADBEEF) break;
|
|
|
|
ok( i == si.dwNumberOfProcessors, "Expected untouched buffer\n");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
/* picky version found on newer Windows like Win7 */
|
|
|
|
ok( ppi[1].Number == 0xDEADBEEF, "Expected untouched buffer.\n");
|
|
|
|
ok( status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08x\n", status);
|
|
|
|
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, 0, size);
|
|
|
|
ok( status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "Got %08x\n", status);
|
|
|
|
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, 0);
|
|
|
|
ok( status == STATUS_BUFFER_TOO_SMALL || status == STATUS_INVALID_PARAMETER, "Got %08x\n", status);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
skip("Test needs more than one processor.\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, size);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
HeapFree(GetProcessHeap(), 0, ppi);
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static void test_query_process_basic(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
|
|
|
|
typedef struct _PROCESS_BASIC_INFORMATION_PRIVATE {
|
2010-03-15 17:59:46 +00:00
|
|
|
DWORD_PTR ExitStatus;
|
|
|
|
PPEB PebBaseAddress;
|
|
|
|
DWORD_PTR AffinityMask;
|
|
|
|
DWORD_PTR BasePriority;
|
|
|
|
ULONG_PTR UniqueProcessId;
|
|
|
|
ULONG_PTR InheritedFromUniqueProcessId;
|
2012-12-09 20:47:13 +00:00
|
|
|
} PROCESS_BASIC_INFORMATION_PRIVATE;
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
PROCESS_BASIC_INFORMATION_PRIVATE pbi;
|
|
|
|
|
|
|
|
/* This test also covers some basic parameter testing that should be the same for
|
|
|
|
* every information class
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* Use a nonexistent info class */
|
|
|
|
trace("Check nonexistent info class\n");
|
|
|
|
status = pNtQueryInformationProcess(NULL, -1, NULL, 0, NULL);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_INVALID_INFO_CLASS || status == STATUS_NOT_IMPLEMENTED /* vista */,
|
|
|
|
"Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Do not give a handle and buffer */
|
|
|
|
trace("Check NULL handle and buffer and zero-length buffersize\n");
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, NULL, 0, NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use a correct info class and buffer size, but still no handle and buffer */
|
|
|
|
trace("Check NULL handle and buffer\n");
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, NULL, sizeof(pbi), NULL);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use a correct info class and buffer size, but still no handle */
|
|
|
|
trace("Check NULL handle\n");
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use a greater buffer size */
|
|
|
|
trace("Check NULL handle and too large buffersize\n");
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessBasicInformation, &pbi, sizeof(pbi) * 2, NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Use no ReturnLength */
|
|
|
|
trace("Check NULL ReturnLength\n");
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Finally some correct calls */
|
|
|
|
trace("Check with correct parameters\n");
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(pbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Everything is correct except a too large buffersize */
|
|
|
|
trace("Too large buffersize\n");
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi) * 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
ok( sizeof(pbi) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* Check if we have some return values */
|
2010-03-15 17:59:46 +00:00
|
|
|
trace("ProcessID : %lx\n", pbi.UniqueProcessId);
|
2007-03-06 11:59:18 +00:00
|
|
|
ok( pbi.UniqueProcessId > 0, "Expected a ProcessID > 0, got 0\n");
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_process_vm(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
VM_COUNTERS pvi;
|
2010-03-15 17:59:46 +00:00
|
|
|
ULONG old_size = FIELD_OFFSET(VM_COUNTERS,PrivatePageCount);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessVmCounters, NULL, sizeof(pvi), NULL);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessVmCounters, &pvi, old_size, NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Windows XP and W2K3 will report success for a size of 44 AND 48 !
|
|
|
|
Windows W2K will only report success for 44.
|
2010-03-15 17:59:46 +00:00
|
|
|
For now we only care for 44, which is FIELD_OFFSET(VM_COUNTERS,PrivatePageCount))
|
2007-03-06 11:59:18 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, 24, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, old_size, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( old_size == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessVmCounters, &pvi, 46, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( ReturnLength == old_size || ReturnLength == sizeof(pvi), "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values */
|
|
|
|
trace("WorkingSetSize : %ld\n", pvi.WorkingSetSize);
|
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_process_io(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
IO_COUNTERS pii;
|
|
|
|
|
|
|
|
/* NT4 doesn't support this information class, so check for it */
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii), &ReturnLength);
|
|
|
|
if (status == STATUS_NOT_SUPPORTED)
|
|
|
|
{
|
2010-03-15 17:59:46 +00:00
|
|
|
win_skip("ProcessIoCounters information class is not supported\n");
|
2007-03-06 11:59:18 +00:00
|
|
|
return;
|
|
|
|
}
|
2008-05-12 08:33:26 +00:00
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessIoCounters, NULL, sizeof(pii), NULL);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessIoCounters, &pii, sizeof(pii), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, 24, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(pii) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessIoCounters, &pii, sizeof(pii) * 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
ok( sizeof(pii) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("OtherOperationCount : 0x%x%08x\n", (DWORD)(pii.OtherOperationCount >> 32), (DWORD)pii.OtherOperationCount);
|
2007-03-06 11:59:18 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok( pii.OtherOperationCount > 0, "Expected an OtherOperationCount > 0\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_process_times(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
HANDLE process;
|
|
|
|
SYSTEMTIME UTC, Local;
|
|
|
|
KERNEL_USER_TIMES spti;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessTimes, NULL, sizeof(spti), NULL);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessTimes, &spti, sizeof(spti), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessTimes, &spti, 24, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, one_before_last_pid);
|
|
|
|
if (!process)
|
|
|
|
{
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("Could not open process with ID : %d, error : %u. Going to use current one.\n", one_before_last_pid, GetLastError());
|
2007-03-06 11:59:18 +00:00
|
|
|
process = GetCurrentProcess();
|
|
|
|
trace("ProcessTimes for current process\n");
|
|
|
|
}
|
|
|
|
else
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("ProcessTimes for process with ID : %d\n", one_before_last_pid);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( process, ProcessTimes, &spti, sizeof(spti), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(spti) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
CloseHandle(process);
|
|
|
|
|
|
|
|
FileTimeToSystemTime((const FILETIME *)&spti.CreateTime, &UTC);
|
|
|
|
SystemTimeToTzSpecificLocalTime(NULL, &UTC, &Local);
|
|
|
|
trace("CreateTime : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
|
|
|
|
Local.wHour, Local.wMinute, Local.wSecond);
|
|
|
|
|
|
|
|
FileTimeToSystemTime((const FILETIME *)&spti.ExitTime, &UTC);
|
|
|
|
SystemTimeToTzSpecificLocalTime(NULL, &UTC, &Local);
|
|
|
|
trace("ExitTime : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
|
|
|
|
Local.wHour, Local.wMinute, Local.wSecond);
|
|
|
|
|
|
|
|
FileTimeToSystemTime((const FILETIME *)&spti.KernelTime, &Local);
|
|
|
|
trace("KernelTime : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
|
|
|
|
|
|
|
|
FileTimeToSystemTime((const FILETIME *)&spti.UserTime, &Local);
|
|
|
|
trace("UserTime : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessTimes, &spti, sizeof(spti) * 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
ok( sizeof(spti) == ReturnLength ||
|
|
|
|
ReturnLength == 0 /* vista */ ||
|
|
|
|
broken(is_wow64), /* returns garbage on wow64 */
|
2008-12-12 23:42:40 +00:00
|
|
|
"Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
static void test_query_process_debug_port(int argc, char **argv)
|
|
|
|
{
|
|
|
|
DWORD_PTR debug_port = 0xdeadbeef;
|
|
|
|
char cmdline[MAX_PATH];
|
|
|
|
PROCESS_INFORMATION pi;
|
2014-04-20 13:44:55 +00:00
|
|
|
STARTUPINFOA si = { 0 };
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
NTSTATUS status;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
|
|
|
|
|
|
|
|
si.cb = sizeof(si);
|
2014-04-20 13:44:55 +00:00
|
|
|
ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS, NULL, NULL, &si, &pi);
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) return;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugPort,
|
|
|
|
NULL, 0, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugPort,
|
|
|
|
NULL, sizeof(debug_port), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE || status == STATUS_ACCESS_VIOLATION,
|
|
|
|
"Expected STATUS_INVALID_HANDLE, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
|
|
|
|
NULL, sizeof(debug_port), NULL);
|
|
|
|
ok(status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugPort,
|
|
|
|
&debug_port, sizeof(debug_port), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE, "Expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
|
|
|
|
&debug_port, sizeof(debug_port) - 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
|
|
|
|
&debug_port, sizeof(debug_port) + 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugPort,
|
|
|
|
&debug_port, sizeof(debug_port), NULL);
|
|
|
|
ok(!status, "NtQueryInformationProcess failed, status %#x.\n", status);
|
|
|
|
ok(debug_port == 0, "Expected port 0, got %#lx.\n", debug_port);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugPort,
|
|
|
|
&debug_port, sizeof(debug_port), NULL);
|
|
|
|
ok(!status, "NtQueryInformationProcess failed, status %#x.\n", status);
|
|
|
|
ok(debug_port == ~(DWORD_PTR)0, "Expected port %#lx, got %#lx.\n", ~(DWORD_PTR)0, debug_port);
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
DEBUG_EVENT ev;
|
|
|
|
|
|
|
|
ret = WaitForDebugEvent(&ev, INFINITE);
|
|
|
|
ok(ret, "WaitForDebugEvent failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
|
|
|
|
if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break;
|
|
|
|
|
|
|
|
ret = ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
|
|
|
|
ok(ret, "ContinueDebugEvent failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = CloseHandle(pi.hThread);
|
|
|
|
ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
|
|
|
|
ret = CloseHandle(pi.hProcess);
|
|
|
|
ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
static void test_query_process_handlecount(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2007-03-06 11:59:18 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
DWORD handlecount;
|
2010-03-15 17:59:46 +00:00
|
|
|
BYTE buffer[2 * sizeof(DWORD)];
|
2007-03-06 11:59:18 +00:00
|
|
|
HANDLE process;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessHandleCount, NULL, sizeof(handlecount), NULL);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION || status == STATUS_INVALID_HANDLE,
|
2008-05-12 08:33:26 +00:00
|
|
|
"Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessHandleCount, &handlecount, sizeof(handlecount), NULL);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessHandleCount, &handlecount, 2, &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
process = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, one_before_last_pid);
|
|
|
|
if (!process)
|
|
|
|
{
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("Could not open process with ID : %d, error : %u. Going to use current one.\n", one_before_last_pid, GetLastError());
|
2007-03-06 11:59:18 +00:00
|
|
|
process = GetCurrentProcess();
|
|
|
|
trace("ProcessHandleCount for current process\n");
|
|
|
|
}
|
|
|
|
else
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("ProcessHandleCount for process with ID : %d\n", one_before_last_pid);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( process, ProcessHandleCount, &handlecount, sizeof(handlecount), &ReturnLength);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
CloseHandle(process);
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessHandleCount, buffer, sizeof(buffer), &ReturnLength);
|
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH || status == STATUS_SUCCESS,
|
|
|
|
"Expected STATUS_INFO_LENGTH_MISMATCH or STATUS_SUCCESS, got %08x\n", status);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %d\n", ReturnLength);
|
2007-03-06 11:59:18 +00:00
|
|
|
|
|
|
|
/* Check if we have some return values */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("HandleCount : %d\n", handlecount);
|
2007-03-06 11:59:18 +00:00
|
|
|
todo_wine
|
|
|
|
{
|
|
|
|
ok( handlecount > 0, "Expected some handles, got 0\n");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2008-05-12 08:33:26 +00:00
|
|
|
static void test_query_process_image_file_name(void)
|
|
|
|
{
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2008-05-12 08:33:26 +00:00
|
|
|
ULONG ReturnLength;
|
|
|
|
UNICODE_STRING image_file_name;
|
|
|
|
void *buffer;
|
|
|
|
char *file_nameA;
|
|
|
|
INT len;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessImageFileName, &image_file_name, sizeof(image_file_name), NULL);
|
|
|
|
if (status == STATUS_INVALID_INFO_CLASS)
|
|
|
|
{
|
2010-03-15 17:59:46 +00:00
|
|
|
win_skip("ProcessImageFileName is not supported\n");
|
2008-05-12 08:33:26 +00:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, &image_file_name, 2, &ReturnLength);
|
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, &image_file_name, sizeof(image_file_name), &ReturnLength);
|
|
|
|
ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status);
|
|
|
|
|
|
|
|
buffer = HeapAlloc(GetProcessHeap(), 0, ReturnLength);
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, buffer, ReturnLength, &ReturnLength);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
memcpy(&image_file_name, buffer, sizeof(image_file_name));
|
|
|
|
len = WideCharToMultiByte(CP_ACP, 0, image_file_name.Buffer, image_file_name.Length/sizeof(WCHAR), NULL, 0, NULL, NULL);
|
|
|
|
file_nameA = HeapAlloc(GetProcessHeap(), 0, len + 1);
|
|
|
|
WideCharToMultiByte(CP_ACP, 0, image_file_name.Buffer, image_file_name.Length/sizeof(WCHAR), file_nameA, len, NULL, NULL);
|
|
|
|
file_nameA[len] = '\0';
|
|
|
|
HeapFree(GetProcessHeap(), 0, buffer);
|
|
|
|
trace("process image file name: %s\n", file_nameA);
|
2010-03-15 17:59:46 +00:00
|
|
|
todo_wine ok(strncmp(file_nameA, "\\Device\\", 8) == 0, "Process image name should be an NT path beginning with \\Device\\ (is %s)\n", file_nameA);
|
2008-05-12 08:33:26 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, file_nameA);
|
|
|
|
}
|
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
static void test_query_process_debug_object_handle(int argc, char **argv)
|
|
|
|
{
|
|
|
|
char cmdline[MAX_PATH];
|
2014-04-20 13:44:55 +00:00
|
|
|
STARTUPINFOA si = {0};
|
2011-10-03 19:29:29 +00:00
|
|
|
PROCESS_INFORMATION pi;
|
|
|
|
BOOL ret;
|
|
|
|
HANDLE debug_object;
|
|
|
|
NTSTATUS status;
|
|
|
|
|
|
|
|
sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
|
|
|
|
|
|
|
|
si.cb = sizeof(si);
|
2014-04-20 13:44:55 +00:00
|
|
|
ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS, NULL,
|
2011-10-03 19:29:29 +00:00
|
|
|
NULL, &si, &pi);
|
|
|
|
ok(ret, "CreateProcess failed with last error %u\n", GetLastError());
|
|
|
|
if (!ret) return;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugObjectHandle, NULL,
|
|
|
|
0, NULL);
|
|
|
|
if (status == STATUS_INVALID_INFO_CLASS || status == STATUS_NOT_IMPLEMENTED)
|
|
|
|
{
|
|
|
|
win_skip("ProcessDebugObjectHandle is not supported\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x\n",
|
|
|
|
status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugObjectHandle, NULL,
|
|
|
|
sizeof(debug_object), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE ||
|
|
|
|
status == STATUS_ACCESS_VIOLATION, /* XP */
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_INVALID_HANDLE, got 0x%08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(),
|
|
|
|
ProcessDebugObjectHandle, NULL, sizeof(debug_object), NULL);
|
|
|
|
ok(status == STATUS_ACCESS_VIOLATION,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugObjectHandle,
|
|
|
|
&debug_object, sizeof(debug_object), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(),
|
|
|
|
ProcessDebugObjectHandle, &debug_object,
|
|
|
|
sizeof(debug_object) - 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(),
|
|
|
|
ProcessDebugObjectHandle, &debug_object,
|
|
|
|
sizeof(debug_object) + 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x\n", status);
|
|
|
|
|
|
|
|
debug_object = (HANDLE)0xdeadbeef;
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(),
|
|
|
|
ProcessDebugObjectHandle, &debug_object,
|
|
|
|
sizeof(debug_object), NULL);
|
|
|
|
ok(status == STATUS_PORT_NOT_SET,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_PORT_NOT_SET, got 0x%08x\n", status);
|
|
|
|
ok(debug_object == NULL ||
|
|
|
|
broken(debug_object == (HANDLE)0xdeadbeef), /* Wow64 */
|
|
|
|
"Expected debug object handle to be NULL, got %p\n", debug_object);
|
|
|
|
|
|
|
|
debug_object = (HANDLE)0xdeadbeef;
|
|
|
|
status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugObjectHandle,
|
|
|
|
&debug_object, sizeof(debug_object), NULL);
|
|
|
|
todo_wine
|
|
|
|
ok(status == STATUS_SUCCESS,
|
|
|
|
"Expected NtQueryInformationProcess to return STATUS_SUCCESS, got 0x%08x\n", status);
|
|
|
|
todo_wine
|
|
|
|
ok(debug_object != NULL,
|
|
|
|
"Expected debug object handle to be non-NULL, got %p\n", debug_object);
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
DEBUG_EVENT ev;
|
|
|
|
|
|
|
|
ret = WaitForDebugEvent(&ev, INFINITE);
|
|
|
|
ok(ret, "WaitForDebugEvent failed with last error %u\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
|
|
|
|
if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break;
|
|
|
|
|
|
|
|
ret = ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
|
|
|
|
ok(ret, "ContinueDebugEvent failed with last error %u\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = CloseHandle(pi.hThread);
|
|
|
|
ok(ret, "CloseHandle failed with last error %u\n", GetLastError());
|
|
|
|
ret = CloseHandle(pi.hProcess);
|
|
|
|
ok(ret, "CloseHandle failed with last error %u\n", GetLastError());
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_query_process_debug_flags(int argc, char **argv)
|
|
|
|
{
|
|
|
|
DWORD debug_flags = 0xdeadbeef;
|
|
|
|
char cmdline[MAX_PATH];
|
|
|
|
PROCESS_INFORMATION pi;
|
2014-04-20 13:44:55 +00:00
|
|
|
STARTUPINFOA si = { 0 };
|
2011-10-03 19:29:29 +00:00
|
|
|
NTSTATUS status;
|
|
|
|
BOOL ret;
|
|
|
|
|
|
|
|
sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
|
|
|
|
|
|
|
|
si.cb = sizeof(si);
|
2014-04-20 13:44:55 +00:00
|
|
|
ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS, NULL, NULL, &si, &pi);
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(ret, "CreateProcess failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) return;
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugFlags,
|
|
|
|
NULL, 0, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugFlags,
|
|
|
|
NULL, sizeof(debug_flags), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE || status == STATUS_ACCESS_VIOLATION || broken(status == STATUS_INVALID_INFO_CLASS) /* W7PROX64 (32-bit) */,
|
|
|
|
"Expected STATUS_INVALID_HANDLE, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugFlags,
|
|
|
|
NULL, sizeof(debug_flags), NULL);
|
|
|
|
ok(status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(NULL, ProcessDebugFlags,
|
|
|
|
&debug_flags, sizeof(debug_flags), NULL);
|
|
|
|
ok(status == STATUS_INVALID_HANDLE || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected STATUS_ACCESS_VIOLATION, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugFlags,
|
|
|
|
&debug_flags, sizeof(debug_flags) - 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugFlags,
|
|
|
|
&debug_flags, sizeof(debug_flags) + 1, NULL);
|
|
|
|
ok(status == STATUS_INFO_LENGTH_MISMATCH || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessDebugFlags,
|
|
|
|
&debug_flags, sizeof(debug_flags), NULL);
|
|
|
|
ok(!status || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "NtQueryInformationProcess failed, status %#x.\n", status);
|
|
|
|
ok(debug_flags == TRUE|| broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected flag TRUE, got %x.\n", debug_flags);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(pi.hProcess, ProcessDebugFlags,
|
|
|
|
&debug_flags, sizeof(debug_flags), NULL);
|
|
|
|
ok(!status || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "NtQueryInformationProcess failed, status %#x.\n", status);
|
|
|
|
ok(debug_flags == FALSE || broken(status == STATUS_INVALID_INFO_CLASS) /* NT4 */, "Expected flag FALSE, got %x.\n", debug_flags);
|
|
|
|
|
|
|
|
for (;;)
|
|
|
|
{
|
|
|
|
DEBUG_EVENT ev;
|
|
|
|
|
|
|
|
ret = WaitForDebugEvent(&ev, INFINITE);
|
|
|
|
ok(ret, "WaitForDebugEvent failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
|
|
|
|
if (ev.dwDebugEventCode == EXIT_PROCESS_DEBUG_EVENT) break;
|
|
|
|
|
|
|
|
ret = ContinueDebugEvent(ev.dwProcessId, ev.dwThreadId, DBG_CONTINUE);
|
|
|
|
ok(ret, "ContinueDebugEvent failed, last error %#x.\n", GetLastError());
|
|
|
|
if (!ret) break;
|
|
|
|
}
|
|
|
|
|
|
|
|
ret = CloseHandle(pi.hThread);
|
|
|
|
ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
|
|
|
|
ret = CloseHandle(pi.hProcess);
|
|
|
|
ok(ret, "CloseHandle failed, last error %#x.\n", GetLastError());
|
|
|
|
}
|
2008-05-12 08:33:26 +00:00
|
|
|
|
|
|
|
static void test_readvirtualmemory(void)
|
|
|
|
{
|
|
|
|
HANDLE process;
|
2008-12-12 23:42:40 +00:00
|
|
|
NTSTATUS status;
|
2008-05-12 08:33:26 +00:00
|
|
|
SIZE_T readcount;
|
|
|
|
static const char teststring[] = "test string";
|
|
|
|
char buffer[12];
|
|
|
|
|
|
|
|
process = OpenProcess(PROCESS_VM_READ, FALSE, GetCurrentProcessId());
|
|
|
|
ok(process != 0, "Expected to be able to open own process for reading memory\n");
|
|
|
|
|
|
|
|
/* normal operation */
|
|
|
|
status = pNtReadVirtualMemory(process, teststring, buffer, 12, &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == 12, "Expected to read 12 bytes, got %ld\n",readcount);
|
|
|
|
ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
|
|
|
|
|
|
|
|
/* no number of bytes */
|
|
|
|
memset(buffer, 0, 12);
|
|
|
|
status = pNtReadVirtualMemory(process, teststring, buffer, 12, NULL);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
|
|
|
|
|
|
|
|
/* illegal remote address */
|
|
|
|
todo_wine{
|
|
|
|
status = pNtReadVirtualMemory(process, (void *) 0x1234, buffer, 12, &readcount);
|
2008-12-12 23:42:40 +00:00
|
|
|
ok( status == STATUS_PARTIAL_COPY || broken(status == STATUS_ACCESS_VIOLATION), "Expected STATUS_PARTIAL_COPY, got %08x\n", status);
|
|
|
|
if (status == STATUS_PARTIAL_COPY)
|
|
|
|
ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
|
2008-05-12 08:33:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* 0 handle */
|
|
|
|
status = pNtReadVirtualMemory(0, teststring, buffer, 12, &readcount);
|
|
|
|
ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08x\n", status);
|
|
|
|
ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
|
|
|
|
|
|
|
|
/* pseudo handle for current process*/
|
|
|
|
memset(buffer, 0, 12);
|
|
|
|
status = pNtReadVirtualMemory((HANDLE)-1, teststring, buffer, 12, &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == 12, "Expected to read 12 bytes, got %ld\n",readcount);
|
|
|
|
ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
|
|
|
|
|
|
|
|
/* illegal local address */
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtReadVirtualMemory(process, teststring, (void *)0x1234, 12, &readcount);
|
|
|
|
ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08x\n", status);
|
2008-05-12 08:33:26 +00:00
|
|
|
ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
|
|
|
|
|
|
|
|
CloseHandle(process);
|
|
|
|
}
|
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
static void test_mapprotection(void)
|
|
|
|
{
|
|
|
|
HANDLE h;
|
|
|
|
void* addr;
|
|
|
|
MEMORY_BASIC_INFORMATION info;
|
|
|
|
ULONG oldflags, flagsize, flags = MEM_EXECUTE_OPTION_ENABLE;
|
|
|
|
LARGE_INTEGER size, offset;
|
|
|
|
NTSTATUS status;
|
|
|
|
SIZE_T retlen, count;
|
|
|
|
void (*f)(void);
|
|
|
|
|
|
|
|
if (!pNtClose) {
|
|
|
|
skip("No NtClose ... Win98\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/* Switch to being a noexec unaware process */
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &oldflags, sizeof (oldflags), &flagsize);
|
|
|
|
if (status == STATUS_INVALID_PARAMETER) {
|
|
|
|
skip("Invalid Parameter on ProcessExecuteFlags query?\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
ok( (status == STATUS_SUCCESS) || (status == STATUS_INVALID_INFO_CLASS), "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) );
|
|
|
|
ok( (status == STATUS_SUCCESS) || (status == STATUS_INVALID_INFO_CLASS), "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
size.u.LowPart = 0x1000;
|
|
|
|
size.u.HighPart = 0;
|
|
|
|
status = pNtCreateSection ( &h,
|
|
|
|
STANDARD_RIGHTS_REQUIRED | SECTION_QUERY | SECTION_MAP_READ | SECTION_MAP_WRITE | SECTION_MAP_EXECUTE,
|
|
|
|
NULL,
|
|
|
|
&size,
|
|
|
|
PAGE_READWRITE,
|
|
|
|
SEC_COMMIT | SEC_NOCACHE,
|
|
|
|
0
|
|
|
|
);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
offset.u.LowPart = 0;
|
|
|
|
offset.u.HighPart = 0;
|
|
|
|
count = 0x1000;
|
|
|
|
addr = NULL;
|
|
|
|
status = pNtMapViewOfSection ( h, GetCurrentProcess(), &addr, 0, 0, &offset, &count, ViewShare, 0, PAGE_READWRITE);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2014-04-20 13:44:55 +00:00
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
#if defined(__x86_64__) || defined(__i386__)
|
2014-04-20 13:44:55 +00:00
|
|
|
*(unsigned char*)addr = 0xc3; /* lret ... in both i386 and x86_64 */
|
|
|
|
#elif defined(__arm__)
|
|
|
|
*(unsigned long*)addr = 0xe12fff1e; /* bx lr */
|
|
|
|
#else
|
|
|
|
ok(0, "Add a return opcode for your architecture or expect a crash in this test\n");
|
|
|
|
#endif
|
2011-10-03 19:29:29 +00:00
|
|
|
trace("trying to execute code in the readwrite only mapped anon file...\n");
|
|
|
|
f = addr;f();
|
|
|
|
trace("...done.\n");
|
|
|
|
|
|
|
|
status = pNtQueryVirtualMemory( GetCurrentProcess(), addr, MemoryBasicInformation, &info, sizeof(info), &retlen );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( retlen == sizeof(info), "Expected STATUS_SUCCESS, got %08x\n", status);
|
2012-12-09 20:47:13 +00:00
|
|
|
ok((info.Protect & ~PAGE_NOCACHE) == PAGE_READWRITE, "addr.Protect is not PAGE_READWRITE, but 0x%x\n", info.Protect);
|
2011-10-03 19:29:29 +00:00
|
|
|
|
|
|
|
status = pNtUnmapViewOfSection (GetCurrentProcess(), addr);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
pNtClose (h);
|
|
|
|
|
|
|
|
/* Switch back */
|
|
|
|
pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &oldflags, sizeof(oldflags) );
|
|
|
|
}
|
|
|
|
|
|
|
|
static void test_queryvirtualmemory(void)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
SIZE_T readcount;
|
|
|
|
static const char teststring[] = "test string";
|
|
|
|
static char datatestbuf[42] = "abc";
|
|
|
|
static char rwtestbuf[42];
|
|
|
|
MEMORY_BASIC_INFORMATION mbi;
|
|
|
|
char stackbuf[42];
|
|
|
|
HMODULE module;
|
|
|
|
|
2014-04-20 13:44:55 +00:00
|
|
|
module = GetModuleHandleA( "ntdll.dll" );
|
2011-10-03 19:29:29 +00:00
|
|
|
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
|
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%x\n", mbi.State, MEM_COMMIT);
|
|
|
|
ok (mbi.Protect == PAGE_READONLY, "mbi.Protect is 0x%x, expected 0x%x\n", mbi.Protect, PAGE_READONLY);
|
|
|
|
ok (mbi.Type == MEM_IMAGE, "mbi.Type is 0x%x, expected 0x%x\n", mbi.Type, MEM_IMAGE);
|
|
|
|
|
|
|
|
trace("Check flags of a function entry in NTDLL.DLL at %p\n", pNtQueryVirtualMemory);
|
2014-04-20 13:44:55 +00:00
|
|
|
module = GetModuleHandleA( "ntdll.dll" );
|
2011-10-03 19:29:29 +00:00
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), pNtQueryVirtualMemory, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%x\n", mbi.State, MEM_COMMIT);
|
|
|
|
ok (mbi.Protect == PAGE_EXECUTE_READ, "mbi.Protect is 0x%x, expected 0x%x\n", mbi.Protect, PAGE_EXECUTE_READ);
|
|
|
|
|
|
|
|
trace("Check flags of heap at %p\n", GetProcessHeap());
|
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_READWRITE || mbi.AllocationProtect == PAGE_EXECUTE_READWRITE,
|
|
|
|
"mbi.AllocationProtect is 0x%x\n", mbi.AllocationProtect);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%x\n", mbi.State, MEM_COMMIT);
|
|
|
|
ok (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_EXECUTE_READWRITE,
|
|
|
|
"mbi.Protect is 0x%x\n", mbi.Protect);
|
|
|
|
|
|
|
|
trace("Check flags of stack at %p\n", stackbuf);
|
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), stackbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_READWRITE, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_READWRITE);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%x\n", mbi.State, MEM_COMMIT);
|
|
|
|
ok (mbi.Protect == PAGE_READWRITE, "mbi.Protect is 0x%x, expected 0x%x\n", mbi.Protect, PAGE_READWRITE);
|
|
|
|
|
|
|
|
trace("Check flags of read-only data at %p\n", teststring);
|
2014-04-20 13:44:55 +00:00
|
|
|
module = GetModuleHandleA( NULL );
|
2011-10-03 19:29:29 +00:00
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), teststring, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%X\n", mbi.State, MEM_COMMIT);
|
|
|
|
if (mbi.Protect != PAGE_READONLY)
|
|
|
|
todo_wine ok( mbi.Protect == PAGE_READONLY, "mbi.Protect is 0x%x, expected 0x%X\n", mbi.Protect, PAGE_READONLY);
|
|
|
|
|
|
|
|
trace("Check flags of read-write data at %p\n", datatestbuf);
|
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), datatestbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
|
|
|
|
ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%X\n", mbi.State, MEM_COMMIT);
|
|
|
|
ok (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_WRITECOPY,
|
|
|
|
"mbi.Protect is 0x%x\n", mbi.Protect);
|
|
|
|
|
|
|
|
trace("Check flags of read-write uninitialized data (.bss) at %p\n", rwtestbuf);
|
|
|
|
status = pNtQueryVirtualMemory(NtCurrentProcess(), rwtestbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %ld\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
|
|
|
|
if (mbi.AllocationBase == module)
|
|
|
|
{
|
|
|
|
ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%x, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
|
|
|
|
ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%x, expected 0x%X\n", mbi.State, MEM_COMMIT);
|
2012-07-11 07:04:50 +00:00
|
|
|
ok (mbi.Protect == PAGE_READWRITE || mbi.Protect == PAGE_WRITECOPY,
|
|
|
|
"mbi.Protect is 0x%x\n", mbi.Protect);
|
2011-10-03 19:29:29 +00:00
|
|
|
}
|
|
|
|
else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */
|
|
|
|
}
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
static void test_affinity(void)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
PROCESS_BASIC_INFORMATION pbi;
|
|
|
|
DWORD_PTR proc_affinity, thread_affinity;
|
|
|
|
THREAD_BASIC_INFORMATION tbi;
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
|
|
|
|
GetSystemInfo(&si);
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2014-04-20 13:44:55 +00:00
|
|
|
proc_affinity = pbi.AffinityMask;
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( proc_affinity == (1 << si.dwNumberOfProcessors) - 1, "Unexpected process affinity\n" );
|
|
|
|
proc_affinity = 1 << si.dwNumberOfProcessors;
|
|
|
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
|
|
|
|
ok( status == STATUS_INVALID_PARAMETER,
|
|
|
|
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
|
|
|
|
|
|
|
proc_affinity = 0;
|
|
|
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
|
|
|
|
ok( status == STATUS_INVALID_PARAMETER,
|
|
|
|
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( tbi.AffinityMask == (1 << si.dwNumberOfProcessors) - 1, "Unexpected thread affinity\n" );
|
|
|
|
thread_affinity = 1 << si.dwNumberOfProcessors;
|
|
|
|
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
|
|
|
ok( status == STATUS_INVALID_PARAMETER,
|
|
|
|
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
|
|
|
thread_affinity = 0;
|
|
|
|
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
|
|
|
ok( status == STATUS_INVALID_PARAMETER,
|
|
|
|
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
|
|
|
|
|
|
|
thread_affinity = 1;
|
|
|
|
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( tbi.AffinityMask == 1, "Unexpected thread affinity\n" );
|
|
|
|
|
|
|
|
/* NOTE: Pre-Vista does not recognize the "all processors" flag (all bits set) */
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
thread_affinity = ~(DWORD_PTR)0;
|
2010-03-15 17:59:46 +00:00
|
|
|
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
|
|
|
ok( broken(status == STATUS_INVALID_PARAMETER) || status == STATUS_SUCCESS,
|
|
|
|
"Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
|
|
|
|
if (si.dwNumberOfProcessors <= 1)
|
|
|
|
{
|
|
|
|
skip("only one processor, skipping affinity testing\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Test thread affinity mask resulting from "all processors" flag */
|
|
|
|
if (status == STATUS_SUCCESS)
|
|
|
|
{
|
|
|
|
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
2011-10-03 19:29:29 +00:00
|
|
|
ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( broken(tbi.AffinityMask == 1) || tbi.AffinityMask == (1 << si.dwNumberOfProcessors) - 1,
|
|
|
|
"Unexpected thread affinity\n" );
|
|
|
|
}
|
|
|
|
else
|
|
|
|
skip("Cannot test thread affinity mask for 'all processors' flag\n");
|
|
|
|
|
|
|
|
proc_affinity = 2;
|
|
|
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
2014-04-20 13:44:55 +00:00
|
|
|
proc_affinity = pbi.AffinityMask;
|
2010-03-15 17:59:46 +00:00
|
|
|
ok( proc_affinity == 2, "Unexpected process affinity\n" );
|
|
|
|
/* Setting the process affinity changes the thread affinity to match */
|
|
|
|
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( tbi.AffinityMask == 2, "Unexpected thread affinity\n" );
|
|
|
|
/* The thread affinity is restricted to the process affinity */
|
|
|
|
thread_affinity = 1;
|
|
|
|
status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
|
|
|
|
ok( status == STATUS_INVALID_PARAMETER,
|
|
|
|
"Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
|
|
|
|
|
|
|
proc_affinity = (1 << si.dwNumberOfProcessors) - 1;
|
|
|
|
status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
/* Resetting the process affinity also resets the thread affinity */
|
|
|
|
status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
|
|
|
|
ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status);
|
|
|
|
ok( tbi.AffinityMask == (1 << si.dwNumberOfProcessors) - 1,
|
|
|
|
"Unexpected thread affinity\n" );
|
|
|
|
}
|
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
static void test_NtGetCurrentProcessorNumber(void)
|
|
|
|
{
|
|
|
|
NTSTATUS status;
|
|
|
|
SYSTEM_INFO si;
|
|
|
|
PROCESS_BASIC_INFORMATION pbi;
|
|
|
|
THREAD_BASIC_INFORMATION tbi;
|
|
|
|
DWORD_PTR old_process_mask;
|
|
|
|
DWORD_PTR old_thread_mask;
|
|
|
|
DWORD_PTR new_mask;
|
|
|
|
ULONG current_cpu;
|
|
|
|
ULONG i;
|
|
|
|
|
|
|
|
if (!pNtGetCurrentProcessorNumber) {
|
|
|
|
win_skip("NtGetCurrentProcessorNumber not available\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
GetSystemInfo(&si);
|
|
|
|
current_cpu = pNtGetCurrentProcessorNumber();
|
|
|
|
trace("dwNumberOfProcessors: %d, current processor: %d\n", si.dwNumberOfProcessors, current_cpu);
|
|
|
|
|
|
|
|
status = pNtQueryInformationProcess(GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL);
|
2014-04-20 13:44:55 +00:00
|
|
|
old_process_mask = pbi.AffinityMask;
|
2012-12-09 20:47:13 +00:00
|
|
|
ok(status == STATUS_SUCCESS, "got 0x%x (expected STATUS_SUCCESS)\n", status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationThread(GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL);
|
|
|
|
old_thread_mask = tbi.AffinityMask;
|
|
|
|
ok(status == STATUS_SUCCESS, "got 0x%x (expected STATUS_SUCCESS)\n", status);
|
|
|
|
|
|
|
|
/* allow the test to run on all processors */
|
|
|
|
new_mask = (1 << si.dwNumberOfProcessors) - 1;
|
|
|
|
status = pNtSetInformationProcess(GetCurrentProcess(), ProcessAffinityMask, &new_mask, sizeof(new_mask));
|
|
|
|
ok(status == STATUS_SUCCESS, "got 0x%x (expected STATUS_SUCCESS)\n", status);
|
|
|
|
|
|
|
|
for (i = 0; i < si.dwNumberOfProcessors; i++)
|
|
|
|
{
|
|
|
|
new_mask = 1 << i;
|
|
|
|
status = pNtSetInformationThread(GetCurrentThread(), ThreadAffinityMask, &new_mask, sizeof(new_mask));
|
|
|
|
ok(status == STATUS_SUCCESS, "%d: got 0x%x (expected STATUS_SUCCESS)\n", i, status);
|
|
|
|
|
|
|
|
status = pNtQueryInformationThread(GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL);
|
|
|
|
ok(status == STATUS_SUCCESS, "%d: got 0x%x (expected STATUS_SUCCESS)\n", i, status);
|
|
|
|
|
|
|
|
current_cpu = pNtGetCurrentProcessorNumber();
|
|
|
|
ok((current_cpu == i), "%d (new_mask 0x%lx): running on processor %d (AffinityMask: 0x%lx)\n",
|
|
|
|
i, new_mask, current_cpu, tbi.AffinityMask);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* restore old values */
|
|
|
|
status = pNtSetInformationProcess(GetCurrentProcess(), ProcessAffinityMask, &old_process_mask, sizeof(old_process_mask));
|
|
|
|
ok(status == STATUS_SUCCESS, "got 0x%x (expected STATUS_SUCCESS)\n", status);
|
|
|
|
|
|
|
|
status = pNtSetInformationThread(GetCurrentThread(), ThreadAffinityMask, &old_thread_mask, sizeof(old_thread_mask));
|
|
|
|
ok(status == STATUS_SUCCESS, "got 0x%x (expected STATUS_SUCCESS)\n", status);
|
|
|
|
}
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
START_TEST(info)
|
|
|
|
{
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
char **argv;
|
|
|
|
int argc;
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
if(!InitFunctionPtrs())
|
|
|
|
return;
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
argc = winetest_get_mainargs(&argv);
|
|
|
|
if (argc >= 3) return; /* Child */
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* NtQuerySystemInformation */
|
|
|
|
|
|
|
|
/* 0x0 SystemBasicInformation */
|
|
|
|
trace("Starting test_query_basic()\n");
|
|
|
|
test_query_basic();
|
|
|
|
|
|
|
|
/* 0x1 SystemCpuInformation */
|
|
|
|
trace("Starting test_query_cpu()\n");
|
|
|
|
test_query_cpu();
|
|
|
|
|
|
|
|
/* 0x2 SystemPerformanceInformation */
|
|
|
|
trace("Starting test_query_performance()\n");
|
|
|
|
test_query_performance();
|
|
|
|
|
|
|
|
/* 0x3 SystemTimeOfDayInformation */
|
|
|
|
trace("Starting test_query_timeofday()\n");
|
|
|
|
test_query_timeofday();
|
|
|
|
|
|
|
|
/* 0x5 SystemProcessInformation */
|
|
|
|
trace("Starting test_query_process()\n");
|
|
|
|
test_query_process();
|
|
|
|
|
|
|
|
/* 0x8 SystemProcessorPerformanceInformation */
|
|
|
|
trace("Starting test_query_procperf()\n");
|
|
|
|
test_query_procperf();
|
|
|
|
|
|
|
|
/* 0xb SystemModuleInformation */
|
|
|
|
trace("Starting test_query_module()\n");
|
|
|
|
test_query_module();
|
|
|
|
|
|
|
|
/* 0x10 SystemHandleInformation */
|
|
|
|
trace("Starting test_query_handle()\n");
|
|
|
|
test_query_handle();
|
|
|
|
|
|
|
|
/* 0x15 SystemCacheInformation */
|
|
|
|
trace("Starting test_query_cache()\n");
|
|
|
|
test_query_cache();
|
|
|
|
|
|
|
|
/* 0x17 SystemInterruptInformation */
|
|
|
|
trace("Starting test_query_interrupt()\n");
|
|
|
|
test_query_interrupt();
|
|
|
|
|
|
|
|
/* 0x23 SystemKernelDebuggerInformation */
|
|
|
|
trace("Starting test_query_kerndebug()\n");
|
|
|
|
test_query_kerndebug();
|
|
|
|
|
|
|
|
/* 0x25 SystemRegistryQuotaInformation */
|
|
|
|
trace("Starting test_query_regquota()\n");
|
|
|
|
test_query_regquota();
|
|
|
|
|
2012-12-09 20:47:13 +00:00
|
|
|
/* 0x49 SystemLogicalProcessorInformation */
|
|
|
|
trace("Starting test_query_logicalproc()\n");
|
|
|
|
test_query_logicalproc();
|
|
|
|
|
|
|
|
/* NtPowerInformation */
|
|
|
|
|
|
|
|
/* 0xb ProcessorInformation */
|
|
|
|
trace("Starting test_query_processor_power_info()\n");
|
|
|
|
test_query_processor_power_info();
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* NtQueryInformationProcess */
|
|
|
|
|
|
|
|
/* 0x0 ProcessBasicInformation */
|
|
|
|
trace("Starting test_query_process_basic()\n");
|
|
|
|
test_query_process_basic();
|
|
|
|
|
|
|
|
/* 0x2 ProcessIoCounters */
|
|
|
|
trace("Starting test_query_process_io()\n");
|
|
|
|
test_query_process_io();
|
|
|
|
|
|
|
|
/* 0x3 ProcessVmCounters */
|
|
|
|
trace("Starting test_query_process_vm()\n");
|
|
|
|
test_query_process_vm();
|
|
|
|
|
|
|
|
/* 0x4 ProcessTimes */
|
|
|
|
trace("Starting test_query_process_times()\n");
|
|
|
|
test_query_process_times();
|
|
|
|
|
Sync advapi32, comctl32, crypt32, cryptui, cryptnet, fusion, gdi32, gdiplus, hlink, imm32, jscript, kernel32, localspl, msacm32, mscms, msi, mstask, msvcrtd, msxml3, ntdll, ole32, pdh, psapi, quartz, rasapi32, riched20 AND rsaenh Winetests.
TBD mshtml, shell32, oleaut32 which still fail to build here
svn path=/trunk/; revision=47931
2010-07-03 12:45:23 +00:00
|
|
|
/* 0x7 ProcessDebugPort */
|
|
|
|
trace("Starting test_process_debug_port()\n");
|
|
|
|
test_query_process_debug_port(argc, argv);
|
|
|
|
|
2007-03-06 11:59:18 +00:00
|
|
|
/* 0x14 ProcessHandleCount */
|
|
|
|
trace("Starting test_query_process_handlecount()\n");
|
|
|
|
test_query_process_handlecount();
|
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
/* 0x1B ProcessImageFileName */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("Starting test_query_process_image_file_name()\n");
|
|
|
|
test_query_process_image_file_name();
|
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
/* 0x1E ProcessDebugObjectHandle */
|
|
|
|
trace("Starting test_query_process_debug_object_handle()\n");
|
|
|
|
test_query_process_debug_object_handle(argc, argv);
|
|
|
|
|
|
|
|
/* 0x1F ProcessDebugFlags */
|
|
|
|
trace("Starting test_process_debug_flags()\n");
|
|
|
|
test_query_process_debug_flags(argc, argv);
|
|
|
|
|
2014-04-20 13:44:55 +00:00
|
|
|
/* belongs to its own file */
|
2008-05-12 08:33:26 +00:00
|
|
|
trace("Starting test_readvirtualmemory()\n");
|
|
|
|
test_readvirtualmemory();
|
2010-03-15 17:59:46 +00:00
|
|
|
|
2011-10-03 19:29:29 +00:00
|
|
|
trace("Starting test_queryvirtualmemory()\n");
|
|
|
|
test_queryvirtualmemory();
|
|
|
|
|
|
|
|
trace("Starting test_mapprotection()\n");
|
|
|
|
test_mapprotection();
|
|
|
|
|
2010-03-15 17:59:46 +00:00
|
|
|
trace("Starting test_affinity()\n");
|
|
|
|
test_affinity();
|
2012-12-09 20:47:13 +00:00
|
|
|
test_NtGetCurrentProcessorNumber();
|
2007-03-06 11:59:18 +00:00
|
|
|
}
|