ReactOS 0.4.17-dev-116-ga4b6fe9
info.c File Reference
#include <stdarg.h>
#include <stdio.h>
#include "ntstatus.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "winnls.h"
#include "ddk/ntddk.h"
#include "psapi.h"
#include "wine/test.h"
Include dependency graph for info.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 
#define NTDLL_GET_PROC(func)
 
#define ACPI   0x41435049
 
#define FIRM   0x4649524D
 
#define RSMB   0x52534D42
 

Functions

static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS
 
static ULONG (WINAPI *pNtGetCurrentProcessorNumber)(void)
 
static BOOL (WINAPI *pGetLogicalProcessorInformationEx)(LOGICAL_PROCESSOR_RELATIONSHIP
 
static SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX DWORD *static DEP_SYSTEM_POLICY_TYPE (WINAPI *pGetSystemDEPPolicy)(void)
 
static ULONG *static DEBUG_EVENT *static HANDLE (WINAPI *pDbgUiGetThreadDebugObject)(void)
 
static void (WINAPI *pDbgUiSetThreadDebugObject)(HANDLE)
 
static DWORD_PTR get_affinity_mask (DWORD num_cpus)
 
static void InitFunctionPtrs (void)
 
static void test_query_basic (void)
 
static void test_query_cpu (void)
 
static void test_query_performance (void)
 
static void test_query_timeofday (void)
 
static void test_query_process (BOOL extended)
 
static void test_query_procperf (void)
 
static void test_query_module (void)
 
static void test_query_handle (void)
 
static void test_query_handle_ex (void)
 
static void test_query_cache (void)
 
static void test_query_interrupt (void)
 
static void test_time_adjustment (void)
 
static void test_query_kerndebug (void)
 
static void test_query_regquota (void)
 
static void test_query_logicalproc (void)
 
static void test_query_logicalprocex (void)
 
static void test_query_cpusetinfo (void)
 
static void test_query_firmware (void)
 
static void test_query_battery (void)
 
static void test_query_processor_power_info (void)
 
static void test_query_process_wow64 (void)
 
static void test_query_process_basic (void)
 
static void dump_vm_counters (const char *header, const VM_COUNTERS_EX *pvi)
 
static void test_query_process_vm (void)
 
static void test_query_process_io (void)
 
static void test_query_process_times (void)
 
static void test_query_process_debug_port (int argc, char **argv)
 
static void subtest_query_process_debug_port_custom_dacl (int argc, char **argv, ACCESS_MASK access, PSID sid)
 
static TOKEN_OWNERget_current_owner (void)
 
static void test_query_process_debug_port_custom_dacl (int argc, char **argv)
 
static void test_query_process_priority (void)
 
static void test_query_process_handlecount (void)
 
static void test_query_process_image_file_name (void)
 
static void test_query_process_image_info (void)
 
static void test_query_process_debug_object_handle (int argc, char **argv)
 
static void test_query_process_debug_flags (int argc, char **argv)
 
static void test_query_process_quota_limits (void)
 
static void test_readvirtualmemory (void)
 
static void test_mapprotection (void)
 
static void test_threadstack (void)
 
static void test_queryvirtualmemory (void)
 
static void test_affinity (void)
 
static DWORD WINAPI hide_from_debugger_thread (void *arg)
 
static void test_HideFromDebugger (void)
 
static void test_NtGetCurrentProcessorNumber (void)
 
static void test_ThreadEnableAlignmentFaultFixup (void)
 
static DWORD WINAPI start_address_thread (void *arg)
 
static void test_thread_start_address (void)
 
static void test_query_data_alignment (void)
 
static void test_thread_lookup (void)
 
static void test_thread_ideal_processor (void)
 
static void test_thread_info (void)
 
static void test_debug_object (void)
 
static void test_process_instrumentation_callback (void)
 
static void test_debuggee_dbgport (int argc, char **argv)
 
static DWORD WINAPI test_ThreadIsTerminated_thread (void *stop_event)
 
static void test_ThreadIsTerminated (void)
 
static void test_system_debug_control (void)
 
static void test_process_token (int argc, char **argv)
 
static void test_process_id (void)
 
static void test_processor_idle_cycle_time (void)
 
 START_TEST (info)
 

Variables

static PVOID
 
static ULONG
 
static PULONG
 
static THREADINFOCLASS
 
static PROCESSINFOCLASS
 
static const void void SIZE_T
 
static const void void SIZE_T *static LPCVOID
 
static const void void SIZE_T *static MEMORY_INFORMATION_CLASS
 
static const void void SIZE_T *static SIZE_T *static ACCESS_MASK
 
static const void void SIZE_T *static SIZE_T *static const OBJECT_ATTRIBUTES const LARGE_INTEGER HANDLE
 
static PVOID ULONG_PTR
 
static PVOID const LARGE_INTEGER SIZE_T SECTION_INHERIT
 
static const OBJECT_ATTRIBUTES const CLIENT_ID *static OBJECT_INFORMATION_CLASS
 
static DEBUGOBJECTINFOCLASS
 
static BOOL is_wow64
 
static BOOL old_wow64
 
static DWORD one_before_last_pid = 0
 

Macro Definition Documentation

◆ ACPI

#define ACPI   0x41435049

Definition at line 87 of file info.c.

◆ FIRM

#define FIRM   0x4649524D

Definition at line 88 of file info.c.

◆ NTDLL_GET_PROC

#define NTDLL_GET_PROC (   func)
Value:
do { \
p ## func = (void*)GetProcAddress(hntdll, #func); \
if(!p ## func) { \
trace("GetProcAddress(%s) failed\n", #func); \
} \
} while(0)
#define GetProcAddress(x, y)
Definition: compat.h:753
GLenum func
Definition: glext.h:6028
GLfloat GLfloat p
Definition: glext.h:8902
static HINSTANCE hntdll
Definition: process.c:68

Definition at line 79 of file info.c.

◆ RSMB

#define RSMB   0x52534D42

Definition at line 89 of file info.c.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 25 of file info.c.

Function Documentation

◆ BOOL()

static BOOL ( WINAPI pGetLogicalProcessorInformationEx)
static

◆ DEP_SYSTEM_POLICY_TYPE()

static SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX DWORD *static DEP_SYSTEM_POLICY_TYPE ( WINAPI pGetSystemDEPPolicy)
static

◆ dump_vm_counters()

static void dump_vm_counters ( const char header,
const VM_COUNTERS_EX pvi 
)
static

Definition at line 1888 of file info.c.

1889{
1890 trace("%s:\n", header);
1891 trace("PeakVirtualSize : %Iu\n", pvi->PeakVirtualSize);
1892 trace("VirtualSize : %Iu\n", pvi->VirtualSize);
1893 trace("PageFaultCount : %lu\n", pvi->PageFaultCount);
1894 trace("PeakWorkingSetSize : %Iu\n", pvi->PeakWorkingSetSize);
1895 trace("WorkingSetSize : %Iu\n", pvi->WorkingSetSize);
1896 trace("QuotaPeakPagedPoolUsage : %Iu\n", pvi->QuotaPeakPagedPoolUsage);
1897 trace("QuotaPagedPoolUsage : %Iu\n", pvi->QuotaPagedPoolUsage);
1898 trace("QuotaPeakNonPagePoolUsage : %Iu\n", pvi->QuotaPeakNonPagedPoolUsage);
1899 trace("QuotaNonPagePoolUsage : %Iu\n", pvi->QuotaNonPagedPoolUsage);
1900 trace("PagefileUsage : %Iu\n", pvi->PagefileUsage);
1901 trace("PeakPagefileUsage : %Iu\n", pvi->PeakPagefileUsage);
1902}
#define trace
Definition: atltest.h:70
SIZE_T PeakVirtualSize
Definition: winternl.h:3146
SIZE_T QuotaNonPagedPoolUsage
Definition: winternl.h:3154
SIZE_T WorkingSetSize
Definition: winternl.h:3150
SIZE_T VirtualSize
Definition: winternl.h:3147
SIZE_T PeakWorkingSetSize
Definition: winternl.h:3149
SIZE_T QuotaPeakNonPagedPoolUsage
Definition: winternl.h:3153
SIZE_T QuotaPeakPagedPoolUsage
Definition: winternl.h:3151
SIZE_T PagefileUsage
Definition: winternl.h:3155
SIZE_T QuotaPagedPoolUsage
Definition: winternl.h:3152
ULONG PageFaultCount
Definition: winternl.h:3148
SIZE_T PeakPagefileUsage
Definition: winternl.h:3156

Referenced by test_query_process_vm().

◆ get_affinity_mask()

static DWORD_PTR get_affinity_mask ( DWORD  num_cpus)
inlinestatic

Definition at line 73 of file info.c.

74{
75 if (num_cpus >= sizeof(DWORD_PTR) * 8) return ~(DWORD_PTR)0;
76 return ((DWORD_PTR)1 << num_cpus) - 1;
77}
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65

Referenced by test_affinity(), and test_NtGetCurrentProcessorNumber().

◆ get_current_owner()

static TOKEN_OWNER * get_current_owner ( void  )
static

Definition at line 2244 of file info.c.

2245{
2246 TOKEN_OWNER *owner;
2247 ULONG length = 0;
2248 HANDLE token;
2249 BOOL ret;
2250
2252 ok(ret, "Failed to get process token: %lu\n", GetLastError());
2253
2256 "GetTokenInformation failed: %lu\n", GetLastError());
2257 ok(length != 0, "Failed to get token owner information length: %lu\n", GetLastError());
2258
2259 owner = HeapAlloc(GetProcessHeap(), 0, length);
2261 ok(ret, "Failed to get token owner information: %lu)\n", GetLastError());
2262
2264 return owner;
2265}
#define ok(value,...)
Definition: atltest.h:57
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
#define NULL
Definition: types.h:112
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:411
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:294
#define CloseHandle
Definition: compat.h:739
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define GetCurrentProcess()
Definition: compat.h:759
return ret
Definition: mutex.c:146
unsigned int BOOL
Definition: ntddk_ex.h:94
GLuint GLsizei GLsizei * length
Definition: glext.h:6040
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat token
Definition: glfuncs.h:210
uint32_t ULONG
Definition: typedefs.h:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
@ TokenOwner
Definition: setypes.h:981
#define TOKEN_ALL_ACCESS
Definition: setypes.h:958

Referenced by test_query_process_debug_port_custom_dacl().

◆ HANDLE()

static ULONG *static DEBUG_EVENT *static HANDLE ( WINAPI pDbgUiGetThreadDebugObject)
static

◆ hide_from_debugger_thread()

static DWORD WINAPI hide_from_debugger_thread ( void arg)
static

Definition at line 3287 of file info.c.

3288{
3291 return 0;
3292}
#define INFINITE
Definition: serial.h:102
HANDLE stop_event
Definition: nfs41_daemon.c:55
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
void * arg
Definition: msvc.h:10

Referenced by test_HideFromDebugger().

◆ InitFunctionPtrs()

static void InitFunctionPtrs ( void  )
static

Definition at line 91 of file info.c.

92{
93 /* All needed functions are NT based, so using GetModuleHandle is a good check */
96
120
122
123 if (is_wow64)
124 {
125 TEB64 *teb64 = ULongToPtr( NtCurrentTeb()->GdiBatchCount );
126
127 if (teb64)
128 {
129 PEB64 *peb64 = ULongToPtr(teb64->Peb);
130 old_wow64 = !peb64->LdrData;
131 }
132 }
133
134 pGetSystemDEPPolicy = (void *)GetProcAddress(hkernel32, "GetSystemDEPPolicy");
135 pGetLogicalProcessorInformationEx = (void *) GetProcAddress(hkernel32, "GetLogicalProcessorInformationEx");
136}
NTSTATUS NTAPI NtUnmapViewOfSection(IN HANDLE ProcessHandle, IN PVOID BaseAddress)
Definition: section.c:3491
NTSTATUS NTAPI NtCreateSection(OUT PHANDLE SectionHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL, IN PLARGE_INTEGER MaximumSize OPTIONAL, IN ULONG SectionPageProtection OPTIONAL, IN ULONG AllocationAttributes, IN HANDLE FileHandle OPTIONAL)
Definition: section.c:3083
NTSTATUS NTAPI NtMapViewOfSection(_In_ HANDLE SectionHandle, _In_ HANDLE ProcessHandle, _Outptr_result_bytebuffer_(*ViewSize) _Pre_valid_ PVOID *BaseAddress, _In_ ULONG_PTR ZeroBits, _In_ SIZE_T CommitSize, _Inout_opt_ PLARGE_INTEGER SectionOffset, _Inout_ PSIZE_T ViewSize, _In_range_(ViewShare, ViewUnmap) SECTION_INHERIT InheritDisposition, _In_ ULONG AllocationType, _In_ ULONG Win32Protect)
Definition: section.c:3264
NTSYSAPI NTSTATUS NTAPI NtSetSystemInformation(IN INT SystemInformationClass, IN PVOID SystemInformation, IN ULONG SystemInformationLength)
EXTERN_C NTSTATUS WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG)
#define ULongToPtr(ul)
Definition: basetsd.h:86
NTSTATUS NTAPI NtSystemDebugControl(_In_ SYSDBG_COMMAND Command, _In_reads_bytes_(InputBufferLength) PVOID InputBuffer, _In_ ULONG InputBufferLength, _Out_writes_bytes_(OutputBufferLength) PVOID OutputBuffer, _In_ ULONG OutputBufferLength, _Out_opt_ PULONG ReturnLength)
Perform various queries to the kernel debugger.
Definition: dbgctrl.c:209
NTSTATUS NTAPI NtSetInformationDebugObject(IN HANDLE DebugHandle, IN DEBUGOBJECTINFOCLASS DebugObjectInformationClass, IN PVOID DebugInformation, IN ULONG DebugInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: dbgkobj.c:1921
NTSTATUS NTAPI NtCreateDebugObject(OUT PHANDLE DebugHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN ULONG Flags)
Definition: dbgkobj.c:1571
NTSTATUS NTAPI DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange, OUT PVOID Win32DebugEvent)
Definition: dbgui.c:61
VOID NTAPI DbgUiSetThreadDebugObject(HANDLE DebugObject)
Definition: dbgui.c:344
#define FALSE
Definition: types.h:117
#define IsWow64Process
Definition: compat.h:760
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
Definition: loader.c:812
#define NtCurrentTeb
static HINSTANCE hkernel32
Definition: process.c:68
#define NTDLL_GET_PROC(func)
Definition: info.c:79
static BOOL is_wow64
Definition: info.c:65
static BOOL old_wow64
Definition: info.c:66
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3402
NTSTATUS NTAPI NtReadVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, OUT PVOID Buffer, IN SIZE_T NumberOfBytesToRead, OUT PSIZE_T NumberOfBytesRead OPTIONAL)
Definition: virtual.c:2781
NTSTATUS NTAPI NtQueryVirtualMemory(IN HANDLE ProcessHandle, IN PVOID BaseAddress, IN MEMORY_INFORMATION_CLASS MemoryInformationClass, OUT PVOID MemoryInformation, IN SIZE_T MemoryInformationLength, OUT PSIZE_T ReturnLength)
Definition: virtual.c:4374
NTSTATUS NTAPI NtPowerInformation(IN POWER_INFORMATION_LEVEL PowerInformationLevel, IN PVOID InputBuffer OPTIONAL, IN ULONG InputBufferLength, OUT PVOID OutputBuffer OPTIONAL, IN ULONG OutputBufferLength)
Definition: power.c:901
NTSTATUS NTAPI NtQueryInformationThread(_In_ HANDLE ThreadHandle, _In_ THREADINFOCLASS ThreadInformationClass, _Out_writes_bytes_to_opt_(ThreadInformationLength, *ReturnLength) PVOID ThreadInformation, _In_ ULONG ThreadInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:2985
NTSTATUS NTAPI NtSetInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _In_reads_bytes_(ProcessInformationLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength)
Definition: query.c:1390
NTSTATUS NTAPI NtSetInformationThread(_In_ HANDLE ThreadHandle, _In_ THREADINFOCLASS ThreadInformationClass, _In_reads_bytes_(ThreadInformationLength) PVOID ThreadInformation, _In_ ULONG ThreadInformationLength)
Definition: query.c:2269
NTSTATUS NTAPI NtOpenThread(OUT PHANDLE ThreadHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId OPTIONAL)
Definition: thread.c:1013
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
ULONG64 LdrData
Definition: winternl.h:1047
ULONG64 Peb
Definition: winternl.h:1254
NTSYSAPI ULONG WINAPI NtGetCurrentProcessorNumber(void)
Definition: sysinfo.c:3062
NTSYSAPI NTSTATUS WINAPI NtQuerySystemInformationEx(SYSTEM_INFORMATION_CLASS, void *, ULONG, void *, ULONG, ULONG *)
NTSYSAPI HANDLE WINAPI DbgUiGetThreadDebugObject(void)
Definition: dbgui.c:333
NTSYSAPI NTSTATUS WINAPI RtlGetNativeSystemInformation(SYSTEM_INFORMATION_CLASS, void *, ULONG, ULONG *)

Referenced by START_TEST().

◆ NTSTATUS()

static NTSTATUS ( WINAPI pNtQuerySystemInformation)
static

◆ start_address_thread()

static DWORD WINAPI start_address_thread ( void arg)
static

Definition at line 3438 of file info.c.

3439{
3442 DWORD ret;
3443
3444 entry = NULL;
3445 ret = 0xdeadbeef;
3446 status = pNtQueryInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
3447 &entry, sizeof(entry), &ret);
3448 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
3449 ok(ret == sizeof(entry), "NtQueryInformationThread returned %lu bytes\n", ret);
3450 ok(entry == (void *)start_address_thread, "expected %p, got %p\n", start_address_thread, entry);
3451 return 0;
3452}
LONG NTSTATUS
Definition: precomp.h:26
@ ThreadQuerySetWin32StartAddress
Definition: compat.h:944
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
static DWORD WINAPI start_address_thread(void *arg)
Definition: info.c:3438
#define STATUS_SUCCESS
Definition: shellext.h:65
Definition: ps.c:97
HANDLE WINAPI GetCurrentThread(void)
Definition: proc.c:1146
void(CALLBACK * PRTL_THREAD_START_ROUTINE)(LPVOID)
Definition: winternl.h:3492

Referenced by start_address_thread(), and test_thread_start_address().

◆ START_TEST()

START_TEST ( info  )

Definition at line 4160 of file info.c.

4161{
4162 char **argv;
4163 int argc;
4164
4166
4168 if (argc >= 3)
4169 {
4170 if (strcmp(argv[2], "debuggee:dbgport") == 0) test_debuggee_dbgport(argc - 2, argv + 2);
4171 return; /* Child */
4172 }
4173
4174 /* NtQuerySystemInformation */
4195
4196 /* NtPowerInformation */
4199
4200 /* NtQueryInformationProcess */
4217
4218 /* NtQueryInformationThread */
4225
4226 test_affinity();
4228
4229 /* belongs to its own file */
4233
4240}
#define TRUE
Definition: types.h:120
MonoAssembly int argc
Definition: metahost.c:107
_ACRTIMP int __cdecl strcmp(const char *, const char *)
Definition: string.c:3319
static void test_query_performance(void)
Definition: info.c:446
static void test_debug_object(void)
Definition: info.c:3656
static void test_query_data_alignment(void)
Definition: info.c:3501
static void test_query_timeofday(void)
Definition: info.c:474
static void test_query_processor_power_info(void)
Definition: info.c:1683
static void test_query_process_vm(void)
Definition: info.c:1904
static void test_query_process_debug_flags(int argc, char **argv)
Definition: info.c:2580
static void test_process_instrumentation_callback(void)
Definition: info.c:3760
static void test_query_process_io(void)
Definition: info.c:2009
static void test_query_kerndebug(void)
Definition: info.c:1159
static void test_query_process_quota_limits(void)
Definition: info.c:2730
static void test_thread_lookup(void)
Definition: info.c:3528
static void test_query_process_debug_port_custom_dacl(int argc, char **argv)
Definition: info.c:2267
static void test_query_process_handlecount(void)
Definition: info.c:2337
static void test_readvirtualmemory(void)
Definition: info.c:2783
static void test_thread_ideal_processor(void)
Definition: info.c:3590
static void test_mapprotection(void)
Definition: info.c:2836
static void test_query_regquota(void)
Definition: info.c:1202
static void test_query_battery(void)
Definition: info.c:1638
static void test_query_procperf(void)
Definition: info.c:750
static void test_thread_start_address(void)
Definition: info.c:3454
static void test_query_process_priority(void)
Definition: info.c:2303
static void test_query_cache(void)
Definition: info.c:1045
static void test_process_id(void)
Definition: info.c:3978
static void test_NtGetCurrentProcessorNumber(void)
Definition: info.c:3351
static void test_query_firmware(void)
Definition: info.c:1580
static void test_time_adjustment(void)
Definition: info.c:1125
static void test_ThreadIsTerminated(void)
Definition: info.c:3843
static void test_queryvirtualmemory(void)
Definition: info.c:2985
static void test_query_handle_ex(void)
Definition: info.c:967
static void test_query_process_wow64(void)
Definition: info.c:1756
static void test_processor_idle_cycle_time(void)
Definition: info.c:4107
static void test_process_token(int argc, char **argv)
Definition: info.c:3901
static void InitFunctionPtrs(void)
Definition: info.c:91
static void test_query_basic(void)
Definition: info.c:138
static void test_query_handle(void)
Definition: info.c:879
static void test_query_cpusetinfo(void)
Definition: info.c:1497
static void test_system_debug_control(void)
Definition: info.c:3875
static void test_affinity(void)
Definition: info.c:3170
static void test_query_module(void)
Definition: info.c:817
static void test_query_process_times(void)
Definition: info.c:2041
static void test_query_cpu(void)
Definition: info.c:330
static void test_threadstack(void)
Definition: info.c:2922
static void test_query_process(BOOL extended)
Definition: info.c:519
static void test_query_interrupt(void)
Definition: info.c:1095
static void test_HideFromDebugger(void)
Definition: info.c:3294
static void test_query_logicalproc(void)
Definition: info.c:1220
static void test_query_process_basic(void)
Definition: info.c:1836
static void test_query_process_debug_port(int argc, char **argv)
Definition: info.c:2097
static void test_query_process_image_file_name(void)
Definition: info.c:2382
static void test_query_logicalprocex(void)
Definition: info.c:1262
static void test_ThreadEnableAlignmentFaultFixup(void)
Definition: info.c:3407
static void test_query_process_image_info(void)
Definition: info.c:2431
static void test_query_process_debug_object_handle(int argc, char **argv)
Definition: info.c:2473
static void test_thread_info(void)
Definition: info.c:3626
static void test_debuggee_dbgport(int argc, char **argv)
Definition: info.c:3802
#define argv
Definition: mplay32.c:18
int winetest_get_mainargs(char ***pargv)

◆ subtest_query_process_debug_port_custom_dacl()

static void subtest_query_process_debug_port_custom_dacl ( int  argc,
char **  argv,
ACCESS_MASK  access,
PSID  sid 
)
static

Definition at line 2182 of file info.c.

2183{
2184 HANDLE old_debug_obj, debug_obj;
2187 union {
2188 ACL acl;
2189 DWORD buffer[(sizeof(ACL) +
2191 sizeof(DWORD) - 1) / sizeof(DWORD)];
2192 } acl;
2193 char cmdline[MAX_PATH];
2196 DEBUG_EVENT ev;
2198 BOOL ret;
2199
2200 InitializeAcl(&acl.acl, sizeof(acl), ACL_REVISION);
2203 SetSecurityDescriptorDacl(&sd, TRUE, &acl.acl, FALSE);
2204
2207 ok(SUCCEEDED(status), "Failed to create debug object: %#010lx\n", status);
2208 if (FAILED(status)) return;
2209
2210 old_debug_obj = pDbgUiGetThreadDebugObject();
2211 pDbgUiSetThreadDebugObject(debug_obj);
2212
2213 sprintf(cmdline, "%s %s %s %lu", argv[0], argv[1], "debuggee:dbgport", access);
2214
2215 memset(&si, 0, sizeof(si));
2216 si.cb = sizeof(si);
2218 DEBUG_PROCESS, NULL, NULL, &si, &pi);
2219 ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
2220 if (!ret) goto close_debug_obj;
2221
2222 do
2223 {
2225 ok(ret, "WaitForDebugEvent failed, last error %#lx.\n", GetLastError());
2226 if (!ret) break;
2227
2229 ok(ret, "ContinueDebugEvent failed, last error %#lx.\n", GetLastError());
2230 if (!ret) break;
2232
2235 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2237 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2238
2239close_debug_obj:
2240 pDbgUiSetThreadDebugObject(old_debug_obj);
2241 NtClose(debug_obj);
2242}
FT_UInt sid
Definition: cffcmap.c:138
BOOL WINAPI InitializeAcl(PACL pAcl, DWORD nAclLength, DWORD dwAclRevision)
Definition: security.c:1006
BOOL WINAPI InitializeSecurityDescriptor(PSECURITY_DESCRIPTOR pSecurityDescriptor, DWORD dwRevision)
Definition: security.c:929
BOOL WINAPI AddAccessAllowedAce(PACL pAcl, DWORD dwAceRevision, DWORD AccessMask, PSID pSid)
Definition: security.c:1039
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI ContinueDebugEvent(IN DWORD dwProcessId, IN DWORD dwThreadId, IN DWORD dwContinueStatus)
Definition: debugger.c:413
BOOL WINAPI WaitForDebugEvent(IN LPDEBUG_EVENT lpDebugEvent, IN DWORD dwMilliseconds)
Definition: debugger.c:590
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(const char *app_name, char *cmd_line, SECURITY_ATTRIBUTES *process_attr, SECURITY_ATTRIBUTES *thread_attr, BOOL inherit, DWORD flags, void *env, const char *cur_dir, STARTUPINFOA *startup_info, PROCESS_INFORMATION *info)
Definition: process.c:686
GLuint buffer
Definition: glext.h:5915
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define EXIT_PROCESS_DEBUG_EVENT
Definition: minwinbase.h:37
#define sprintf
Definition: sprintf.c:45
static PROCESS_INFORMATION pi
Definition: debugger.c:2303
static SYSTEM_INFO si
Definition: virtual.c:39
static const WCHAR sd[]
Definition: suminfo.c:286
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:115
struct _ACL ACL
#define MAXIMUM_ALLOWED
Definition: nt_native.h:83
#define DBG_CONTINUE
Definition: ntstatus.h:98
#define offsetof(TYPE, MEMBER)
#define wait_child_process
Definition: test.h:159
#define memset(x, y, z)
Definition: compat.h:39
BOOL WINAPI SetSecurityDescriptorDacl(PSECURITY_DESCRIPTOR pSecurityDescriptor, BOOL bDaclPresent, PACL pDacl, BOOL bDaclDefaulted)
Definition: sec.c:262
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD dwDebugEventCode
Definition: minwinbase.h:196
DWORD dwThreadId
Definition: minwinbase.h:198
DWORD dwProcessId
Definition: minwinbase.h:197
Definition: cookie.c:202
#define DEBUG_PROCESS
Definition: winbase.h:180
#define DEBUG_KILL_ON_CLOSE
Definition: winternl.h:4377
#define SECURITY_DESCRIPTOR_REVISION
Definition: setypes.h:58
#define ACL_REVISION
Definition: setypes.h:39
#define SECURITY_MAX_SID_SIZE
Definition: setypes.h:486

Referenced by test_query_process_debug_port_custom_dacl().

◆ test_affinity()

static void test_affinity ( void  )
static

Definition at line 3170 of file info.c.

3171{
3174 DWORD_PTR proc_affinity, thread_affinity;
3177
3178 GetSystemInfo(&si);
3180 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3181 proc_affinity = pbi.AffinityMask;
3182 ok( proc_affinity == get_affinity_mask( si.dwNumberOfProcessors ), "Unexpected process affinity\n" );
3183 if (si.dwNumberOfProcessors < 8 * sizeof(DWORD_PTR))
3184 {
3185 proc_affinity = (DWORD_PTR)1 << si.dwNumberOfProcessors;
3186 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
3188 "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3189 }
3190 proc_affinity = 0;
3191 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
3193 "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3194
3195 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3196 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3197 ok( tbi.AffinityMask == get_affinity_mask( si.dwNumberOfProcessors ), "Unexpected thread affinity\n" );
3198 if (si.dwNumberOfProcessors < 8 * sizeof(DWORD_PTR))
3199 {
3200 thread_affinity = (DWORD_PTR)1 << si.dwNumberOfProcessors;
3201 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3203 "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3204 }
3205 thread_affinity = 0;
3206 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3208 "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3209
3210 thread_affinity = 1;
3211 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3212 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3213 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3214 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3215 ok( tbi.AffinityMask == 1, "Unexpected thread affinity\n" );
3216
3217 /* NOTE: Pre-Vista does not allow bits to be set that are higher than the highest set bit in process affinity mask */
3218 thread_affinity = (pbi.AffinityMask << 1) | pbi.AffinityMask;
3219 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3220 ok( broken(status == STATUS_INVALID_PARAMETER) || (status == STATUS_SUCCESS), "Expected STATUS_SUCCESS, got %08lx\n", status );
3221 if (status == STATUS_SUCCESS)
3222 {
3223 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3224 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3225 ok( tbi.AffinityMask == pbi.AffinityMask, "Unexpected thread affinity. Expected %Ix, got %Ix\n", pbi.AffinityMask, tbi.AffinityMask );
3226 }
3227
3228 thread_affinity = ~(DWORD_PTR)0 - 1;
3229 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3230 ok( broken(status == STATUS_INVALID_PARAMETER) || (status == STATUS_SUCCESS), "Expected STATUS_SUCCESS, got %08lx\n", status );
3231 if (status == STATUS_SUCCESS)
3232 {
3233 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3234 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3235 ok( tbi.AffinityMask == (pbi.AffinityMask & (~(DWORD_PTR)0 - 1)), "Unexpected thread affinity. Expected %Ix, got %Ix\n", pbi.AffinityMask & (~(DWORD_PTR)0 - 1), tbi.AffinityMask );
3236 }
3237
3238 /* NOTE: Pre-Vista does not recognize the "all processors" flag (all bits set) */
3239 thread_affinity = ~(DWORD_PTR)0;
3240 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3242 "Expected STATUS_SUCCESS, got %08lx\n", status);
3243
3244 if (si.dwNumberOfProcessors <= 1)
3245 {
3246 skip("only one processor, skipping affinity testing\n");
3247 return;
3248 }
3249
3250 /* Test thread affinity mask resulting from "all processors" flag */
3251 if (status == STATUS_SUCCESS)
3252 {
3253 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3254 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3255 ok( tbi.AffinityMask == get_affinity_mask( si.dwNumberOfProcessors ), "unexpected affinity %#Ix\n", tbi.AffinityMask );
3256 }
3257 else
3258 skip("Cannot test thread affinity mask for 'all processors' flag\n");
3259
3260 proc_affinity = 2;
3261 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
3262 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3264 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3265 proc_affinity = pbi.AffinityMask;
3266 ok( proc_affinity == 2, "Unexpected process affinity\n" );
3267 /* Setting the process affinity changes the thread affinity to match */
3268 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3269 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3270 ok( tbi.AffinityMask == 2, "Unexpected thread affinity\n" );
3271 /* The thread affinity is restricted to the process affinity */
3272 thread_affinity = 1;
3273 status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) );
3275 "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3276
3277 proc_affinity = get_affinity_mask( si.dwNumberOfProcessors );
3278 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) );
3279 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3280 /* Resetting the process affinity also resets the thread affinity */
3281 status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
3282 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3284 "Unexpected thread affinity\n" );
3285}
#define skip(...)
Definition: atltest.h:64
#define broken(x)
Definition: atltest.h:178
@ ProcessBasicInformation
Definition: cicbase.cpp:63
@ ThreadAffinityMask
Definition: compat.h:939
@ ThreadBasicInformation
Definition: compat.h:935
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:143
static DWORD_PTR get_affinity_mask(DWORD num_cpus)
Definition: info.c:73
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_writes_bytes_to_opt_(ProcessInformationLength, *ReturnLength) PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
Definition: query.c:211
DWORD dwNumberOfProcessors
Definition: winbase.h:902
KAFFINITY AffinityMask
Definition: compat.h:930
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
_Inout_ PERBANDINFO * pbi
Definition: winddi.h:3917
@ ProcessAffinityMask
Definition: winternl.h:1903

Referenced by START_TEST().

◆ test_debug_object()

static void test_debug_object ( void  )
static

Definition at line 3656 of file info.c.

3657{
3659 HANDLE handle;
3660 OBJECT_ATTRIBUTES attr = { sizeof(attr) };
3661 ULONG len, flag = 0;
3664
3665 status = pNtCreateDebugObject( &handle, DEBUG_ALL_ACCESS, &attr, 0 );
3666 ok( !status, "NtCreateDebugObject failed %lx\n", status );
3667 status = pNtSetInformationDebugObject( handle, 0, &flag, sizeof(ULONG), &len );
3668 ok( status == STATUS_INVALID_PARAMETER, "NtSetInformationDebugObject failed %lx\n", status );
3669 status = pNtSetInformationDebugObject( handle, 2, &flag, sizeof(ULONG), &len );
3670 ok( status == STATUS_INVALID_PARAMETER, "NtSetInformationDebugObject failed %lx\n", status );
3671 status = pNtSetInformationDebugObject( (HANDLE)0xdead, DebugObjectKillProcessOnExitInformation,
3672 &flag, sizeof(ULONG), &len );
3673 ok( status == STATUS_INVALID_HANDLE, "NtSetInformationDebugObject failed %lx\n", status );
3674
3675 len = 0xdead;
3676 status = pNtSetInformationDebugObject( handle, DebugObjectKillProcessOnExitInformation,
3677 &flag, sizeof(ULONG) + 1, &len );
3678 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationDebugObject failed %lx\n", status );
3679 ok( len == sizeof(ULONG), "wrong len %lu\n", len );
3680
3681 len = 0xdead;
3682 status = pNtSetInformationDebugObject( handle, DebugObjectKillProcessOnExitInformation,
3683 &flag, sizeof(ULONG) - 1, &len );
3684 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationDebugObject failed %lx\n", status );
3685 ok( len == sizeof(ULONG), "wrong len %lu\n", len );
3686
3687 len = 0xdead;
3688 status = pNtSetInformationDebugObject( handle, DebugObjectKillProcessOnExitInformation,
3689 &flag, sizeof(ULONG), &len );
3690 ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
3691 ok( !len, "wrong len %lu\n", len );
3692
3694 status = pNtSetInformationDebugObject( handle, DebugObjectKillProcessOnExitInformation,
3695 &flag, sizeof(ULONG), &len );
3696 ok( !status, "NtSetInformationDebugObject failed %lx\n", status );
3697 ok( !len, "wrong len %lu\n", len );
3698
3699 for (flag = 2; flag; flag <<= 1)
3700 {
3701 status = pNtSetInformationDebugObject( handle, DebugObjectKillProcessOnExitInformation,
3702 &flag, sizeof(ULONG), &len );
3703 ok( status == STATUS_INVALID_PARAMETER, "NtSetInformationDebugObject failed %lx\n", status );
3704 }
3705
3706 pNtClose( handle );
3707
3708 memset( &state, 0xdd, sizeof(state) );
3709 state.NewState = DbgIdle;
3710 memset( &event, 0xcc, sizeof(event) );
3711 status = pDbgUiConvertStateChangeStructure( &state, &event );
3712 ok( status == STATUS_UNSUCCESSFUL, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3713 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3714 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3715
3716 state.NewState = DbgReplyPending;
3717 memset( &event, 0xcc, sizeof(event) );
3718 status = pDbgUiConvertStateChangeStructure( &state, &event );
3719 ok( status == STATUS_UNSUCCESSFUL, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3720 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3721 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3722
3723 state.NewState = 11;
3724 memset( &event, 0xcc, sizeof(event) );
3725 status = pDbgUiConvertStateChangeStructure( &state, &event );
3726 ok( status == STATUS_UNSUCCESSFUL, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3727 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3728 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3729
3731 state.StateInfo.ExitProcess.ExitStatus = 0x123456;
3732 status = pDbgUiConvertStateChangeStructure( &state, &event );
3733 ok( !status, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3734 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3735 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3736 ok( event.u.ExitProcess.dwExitCode == 0x123456, "event not updated %lx\n", event.u.ExitProcess.dwExitCode );
3737
3738 memset( &state, 0xdd, sizeof(state) );
3740 status = pDbgUiConvertStateChangeStructure( &state, &event );
3741 ok( !status, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3742 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3743 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3744 ok( event.u.CreateProcessInfo.nDebugInfoSize == 0xdddddddd, "event not updated %lx\n", event.u.CreateProcessInfo.nDebugInfoSize );
3745 ok( event.u.CreateProcessInfo.lpThreadLocalBase == NULL, "event not updated %p\n", event.u.CreateProcessInfo.lpThreadLocalBase );
3746 ok( event.u.CreateProcessInfo.lpImageName == NULL, "event not updated %p\n", event.u.CreateProcessInfo.lpImageName );
3747 ok( event.u.CreateProcessInfo.fUnicode == TRUE, "event not updated %x\n", event.u.CreateProcessInfo.fUnicode );
3748
3749 memset( &state, 0xdd, sizeof(state) );
3750 state.NewState = DbgLoadDllStateChange;
3751 status = pDbgUiConvertStateChangeStructure( &state, &event );
3752 ok( !status, "DbgUiConvertStateChangeStructure failed %lx\n", status );
3753 ok( event.dwProcessId == 0xdddddddd, "event not updated %lx\n", event.dwProcessId );
3754 ok( event.dwThreadId == 0xdddddddd, "event not updated %lx\n", event.dwThreadId );
3755 ok( event.u.LoadDll.nDebugInfoSize == 0xdddddddd, "event not updated %lx\n", event.u.LoadDll.nDebugInfoSize );
3756 ok( PtrToUlong(event.u.LoadDll.lpImageName) == 0xdddddddd, "event not updated %p\n", event.u.LoadDll.lpImageName );
3757 ok( event.u.LoadDll.fUnicode == TRUE, "event not updated %x\n", event.u.LoadDll.fUnicode );
3758}
static int state
Definition: maze.c:121
#define STATUS_INVALID_HANDLE
Definition: d3dkmdt.h:40
@ DebugObjectKillProcessOnExitInformation
Definition: dbgktypes.h:58
@ DbgCreateProcessStateChange
Definition: dbgktypes.h:116
@ DbgExitProcessStateChange
Definition: dbgktypes.h:118
@ DbgIdle
Definition: dbgktypes.h:113
@ DbgLoadDllStateChange
Definition: dbgktypes.h:122
@ DbgReplyPending
Definition: dbgktypes.h:114
#define PtrToUlong(u)
Definition: config.h:107
struct _cl_event * event
Definition: glext.h:7739
GLenum GLsizei len
Definition: glext.h:6722
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean flag
Definition: glfuncs.h:52
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
#define DEBUG_ALL_ACCESS
Definition: winternl.h:4375

Referenced by START_TEST().

◆ test_debuggee_dbgport()

static void test_debuggee_dbgport ( int  argc,
char **  argv 
)
static

Definition at line 3802 of file info.c.

3803{
3804 NTSTATUS status, expect_status;
3805 DWORD_PTR debug_port = 0xdeadbeef;
3806 DWORD debug_flags = 0xdeadbeef;
3807 HANDLE handle;
3809
3810 if (argc < 2)
3811 {
3812 ok(0, "insufficient arguments for child process\n");
3813 return;
3814 }
3815
3816 access = strtoul(argv[1], NULL, 0);
3817 winetest_push_context("debug object access %08lx", access);
3818
3820 &debug_port, sizeof(debug_port), NULL );
3821 ok( !status, "NtQueryInformationProcess ProcessDebugPort failed, status %#lx.\n", status );
3822 ok( debug_port == ~(DWORD_PTR)0, "Expected port %#Ix, got %#Ix.\n", ~(DWORD_PTR)0, debug_port );
3823
3825 &debug_flags, sizeof(debug_flags), NULL );
3826 ok( !status, "NtQueryInformationProcess ProcessDebugFlags failed, status %#lx.\n", status );
3827
3828 expect_status = access ? STATUS_SUCCESS : STATUS_ACCESS_DENIED;
3830 &handle, sizeof(handle), NULL );
3831 ok( status == expect_status, "NtQueryInformationProcess ProcessDebugObjectHandle expected status %#lx, actual %#lx.\n", expect_status, status );
3832 if (SUCCEEDED( status )) NtClose( handle );
3833
3835}
@ ProcessDebugPort
Definition: cicbase.cpp:64
_ACRTIMP __msvcrt_ulong __cdecl strtoul(const char *, char **, int)
Definition: string.c:1859
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl void winetest_pop_context(void)
void __cdecl void __cdecl void __cdecl void __cdecl void __cdecl winetest_push_context(const char *fmt,...) __WINE_PRINTF_ATTR(1
Definition: test.h:537
ULONG ACCESS_MASK
Definition: nt_native.h:40
#define STATUS_ACCESS_DENIED
Definition: udferr_usr.h:145
@ ProcessDebugFlags
Definition: winternl.h:1913
@ ProcessDebugObjectHandle
Definition: winternl.h:1912

Referenced by START_TEST().

◆ test_HideFromDebugger()

static void test_HideFromDebugger ( void  )
static

Definition at line 3294 of file info.c.

3295{
3298 ULONG dummy;
3299
3300 dummy = 0;
3301 status = pNtSetInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, sizeof(ULONG) );
3302 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3303 dummy = 0;
3304 status = pNtSetInformationThread( GetCurrentThread(), ThreadHideFromDebugger, &dummy, 1 );
3305 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3306 status = pNtSetInformationThread( (HANDLE)0xdeadbeef, ThreadHideFromDebugger, NULL, 0 );
3307 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status );
3308 status = pNtSetInformationThread( GetCurrentThread(), ThreadHideFromDebugger, NULL, 0 );
3309 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3310 dummy = 0;
3313 {
3314 win_skip("ThreadHideFromDebugger not available\n");
3315 return;
3316 }
3317
3318 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3319 dummy = 0;
3321 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3322 dummy = 0;
3324 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3325 ok( dummy == 1, "Expected dummy == 1, got %08lx\n", dummy );
3326
3328 ok( stop_event != NULL, "CreateEvent failed\n" );
3330 ok( thread != INVALID_HANDLE_VALUE, "CreateThread failed with %ld\n", GetLastError() );
3331
3332 dummy = 0;
3334 ok( status == STATUS_SUCCESS, "got %#lx\n", status );
3335 ok( dummy == 0, "Expected dummy == 0, got %08lx\n", dummy );
3336
3337 status = pNtSetInformationThread( thread, ThreadHideFromDebugger, NULL, 0 );
3338 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3339
3340 dummy = 0;
3342 ok( status == STATUS_SUCCESS, "got %#lx\n", status );
3343 ok( dummy == 1, "Expected dummy == 1, got %08lx\n", dummy );
3344
3349}
static HANDLE thread
Definition: service.c:33
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
@ ThreadHideFromDebugger
Definition: compat.h:952
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:137
#define win_skip
Definition: minitest.h:67
static DWORD WINAPI hide_from_debugger_thread(void *arg)
Definition: info.c:3287
#define STATUS_INVALID_INFO_CLASS
Definition: ntstatus.h:333
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventA(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCSTR lpName OPTIONAL)
Definition: synch.c:573
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:669

Referenced by START_TEST().

◆ test_mapprotection()

static void test_mapprotection ( void  )
static

Definition at line 2836 of file info.c.

2837{
2838 HANDLE h;
2839 void* addr;
2841 ULONG oldflags, flagsize, flags = MEM_EXECUTE_OPTION_ENABLE;
2844 SIZE_T retlen, count;
2845 void (*f)(void);
2846 BOOL reset_flags = FALSE;
2847
2848 /* Switch to being a noexec unaware process */
2849 status = NtQueryInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &oldflags, sizeof (oldflags), &flagsize);
2851 {
2852 skip("Unable to query process execute flags on this platform\n");
2853 return;
2854 }
2855 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
2856 if (winetest_debug > 1) trace("Process execute flags %08lx\n", oldflags);
2857
2858 if (!(oldflags & MEM_EXECUTE_OPTION_ENABLE))
2859 {
2860 if (oldflags & MEM_EXECUTE_OPTION_PERMANENT)
2861 {
2862 skip("Unable to turn off noexec\n");
2863 return;
2864 }
2865
2866 if (pGetSystemDEPPolicy && pGetSystemDEPPolicy() == AlwaysOn)
2867 {
2868 skip("System policy requires noexec\n");
2869 return;
2870 }
2871
2872 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &flags, sizeof(flags) );
2873 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
2874 reset_flags = TRUE;
2875 }
2876
2877 size.u.LowPart = 0x2000;
2878 size.u.HighPart = 0;
2879 status = pNtCreateSection ( &h,
2881 NULL,
2882 &size,
2885 0
2886 );
2887 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2888
2889 offset.u.LowPart = 0;
2890 offset.u.HighPart = 0;
2891 count = 0x2000;
2892 addr = NULL;
2893 status = pNtMapViewOfSection ( h, GetCurrentProcess(), &addr, 0, 0, &offset, &count, ViewShare, 0, PAGE_READWRITE);
2894 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2895
2896#if defined(__x86_64__) || defined(__i386__)
2897 *(unsigned char*)addr = 0xc3; /* lret ... in both i386 and x86_64 */
2898#elif defined(__arm__)
2899 *(unsigned long*)addr = 0xe12fff1e; /* bx lr */
2900#elif defined(__aarch64__)
2901 *(unsigned long*)addr = 0xd65f03c0; /* ret */
2902#else
2903 ok(0, "Add a return opcode for your architecture or expect a crash in this test\n");
2904#endif
2905 if (winetest_debug > 1) trace("trying to execute code in the readwrite only mapped anon file...\n");
2906 f = addr;f();
2907 if (winetest_debug > 1) trace("...done.\n");
2908
2909 status = pNtQueryVirtualMemory( GetCurrentProcess(), addr, MemoryBasicInformation, &info, sizeof(info), &retlen );
2910 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2911 ok( retlen == sizeof(info), "Expected STATUS_SUCCESS, got %08lx\n", status);
2912 ok((info.Protect & ~PAGE_NOCACHE) == PAGE_READWRITE, "addr.Protect is not PAGE_READWRITE, but 0x%lx\n", info.Protect);
2913
2914 status = pNtUnmapViewOfSection( GetCurrentProcess(), (char *)addr + 0x1050 );
2915 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2916 pNtClose (h);
2917
2918 if (reset_flags)
2919 pNtSetInformationProcess( GetCurrentProcess(), ProcessExecuteFlags, &oldflags, sizeof(oldflags) );
2920}
#define SECTION_MAP_READ
Definition: compat.h:139
GLuint GLuint GLsizei count
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLintptr offset
Definition: glext.h:5920
GLfloat f
Definition: glext.h:7540
GLbitfield flags
Definition: glext.h:7161
GLenum const GLvoid * addr
Definition: glext.h:9621
GLfloat GLfloat GLfloat GLfloat h
Definition: glext.h:7723
#define f
Definition: ke_i.h:83
int winetest_debug
@ MemoryBasicInformation
Definition: mmtypes.h:183
#define MEM_EXECUTE_OPTION_PERMANENT
Definition: mmtypes.h:76
#define SEC_NOCACHE
Definition: mmtypes.h:101
#define SEC_COMMIT
Definition: mmtypes.h:100
#define MEM_EXECUTE_OPTION_ENABLE
Definition: mmtypes.h:74
#define SECTION_MAP_EXECUTE
Definition: nt_native.h:1293
#define SECTION_MAP_WRITE
Definition: nt_native.h:1291
#define PAGE_NOCACHE
Definition: nt_native.h:1314
#define PAGE_READWRITE
Definition: nt_native.h:1307
#define SECTION_QUERY
Definition: nt_native.h:1290
@ ViewShare
Definition: nt_native.h:1281
#define STANDARD_RIGHTS_REQUIRED
Definition: nt_native.h:63
ULONG_PTR SIZE_T
Definition: typedefs.h:80
@ ProcessExecuteFlags
Definition: winternl.h:1916

Referenced by START_TEST().

◆ test_NtGetCurrentProcessorNumber()

static void test_NtGetCurrentProcessorNumber ( void  )
static

Definition at line 3351 of file info.c.

3352{
3357 DWORD_PTR old_process_mask;
3358 DWORD_PTR old_thread_mask;
3359 DWORD_PTR new_mask;
3360 ULONG current_cpu;
3361 ULONG i;
3362
3363 if (!pNtGetCurrentProcessorNumber) {
3364 win_skip("NtGetCurrentProcessorNumber not available\n");
3365 return;
3366 }
3367
3368 GetSystemInfo(&si);
3369 current_cpu = pNtGetCurrentProcessorNumber();
3370 if (winetest_debug > 1) trace("dwNumberOfProcessors: %ld, current processor: %ld\n", si.dwNumberOfProcessors, current_cpu);
3371
3373 old_process_mask = pbi.AffinityMask;
3374 ok(status == STATUS_SUCCESS, "got 0x%lx (expected STATUS_SUCCESS)\n", status);
3375
3376 status = pNtQueryInformationThread(GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL);
3377 old_thread_mask = tbi.AffinityMask;
3378 ok(status == STATUS_SUCCESS, "got 0x%lx (expected STATUS_SUCCESS)\n", status);
3379
3380 /* allow the test to run on all processors */
3382 status = pNtSetInformationProcess(GetCurrentProcess(), ProcessAffinityMask, &new_mask, sizeof(new_mask));
3383 ok(status == STATUS_SUCCESS, "got 0x%lx (expected STATUS_SUCCESS)\n", status);
3384
3385 for (i = 0; i < si.dwNumberOfProcessors; i++)
3386 {
3387 new_mask = (DWORD_PTR)1 << i;
3388 status = pNtSetInformationThread(GetCurrentThread(), ThreadAffinityMask, &new_mask, sizeof(new_mask));
3389 ok(status == STATUS_SUCCESS, "%ld: got 0x%lx (expected STATUS_SUCCESS)\n", i, status);
3390
3391 status = pNtQueryInformationThread(GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL);
3392 ok(status == STATUS_SUCCESS, "%ld: got 0x%lx (expected STATUS_SUCCESS)\n", i, status);
3393
3394 current_cpu = pNtGetCurrentProcessorNumber();
3395 ok((current_cpu == i), "%ld (new_mask 0x%Ix): running on processor %ld (AffinityMask: 0x%Ix)\n",
3396 i, new_mask, current_cpu, tbi.AffinityMask);
3397 }
3398
3399 /* restore old values */
3400 status = pNtSetInformationProcess(GetCurrentProcess(), ProcessAffinityMask, &old_process_mask, sizeof(old_process_mask));
3401 ok(status == STATUS_SUCCESS, "got 0x%lx (expected STATUS_SUCCESS)\n", status);
3402
3403 status = pNtSetInformationThread(GetCurrentThread(), ThreadAffinityMask, &old_thread_mask, sizeof(old_thread_mask));
3404 ok(status == STATUS_SUCCESS, "got 0x%lx (expected STATUS_SUCCESS)\n", status);
3405}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248

Referenced by START_TEST().

◆ test_process_id()

static void test_process_id ( void  )
static

Definition at line 3978 of file info.c.

3979{
3980 char image_name_buffer[1024 * sizeof(WCHAR)];
3981 UNICODE_STRING *image_name = (UNICODE_STRING *)image_name_buffer;
3983 unsigned int i, length;
3984 DWORD pids[2048];
3985 WCHAR name[2048];
3988 ULONG len;
3989 BOOL bret;
3990
3992 sizeof(image_name_buffer), NULL );
3993 ok( !status, "got %#lx.\n", status );
3994 length = image_name->Length;
3995 image_name->Buffer[length] = 0;
3996
3997 len = 0xdeadbeef;
3998 status = pNtQuerySystemInformation( SystemProcessIdInformation, NULL, 0, &len );
4000 ok( len == sizeof(info) || (is_wow64 && len == 0xdeadbeef), "got %#lx.\n", len );
4001
4002 info.ProcessId = 0xdeadbeef;
4003 info.ImageName.Length = info.ImageName.MaximumLength = 0;
4004 info.ImageName.Buffer = NULL;
4005 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4006 ok( status == STATUS_INVALID_CID, "got %#lx.\n", status );
4007 ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length );
4008 ok( !info.ImageName.MaximumLength, "got %#x.\n", info.ImageName.MaximumLength );
4009
4010 info.ProcessId = GetCurrentProcessId();
4011 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4012 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx.\n", status );
4013 ok( len == sizeof(info), "got %#lx.\n", len );
4014 ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length );
4015 ok( info.ImageName.MaximumLength == length + 2 || (is_wow64 && !info.ImageName.MaximumLength),
4016 "got %#x.\n", info.ImageName.MaximumLength );
4017
4018 info.ImageName.MaximumLength = sizeof(name);
4019 len = 0xdeadbeef;
4020 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4021 ok( status == STATUS_ACCESS_VIOLATION, "got %#lx.\n", status );
4022 ok( len == sizeof(info), "got %#lx.\n", len );
4023 ok( info.ImageName.Length == length || (is_wow64 && !info.ImageName.Length),
4024 "got %u.\n", info.ImageName.Length );
4025 ok( info.ImageName.MaximumLength == length + 2 || (is_wow64 && !info.ImageName.Length),
4026 "got %#x.\n", info.ImageName.MaximumLength );
4027
4028 info.ProcessId = 0xdeadbeef;
4029 info.ImageName.MaximumLength = sizeof(name);
4030 info.ImageName.Buffer = name;
4031 info.ImageName.Length = 0;
4032 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4033 ok( status == STATUS_INVALID_CID, "got %#lx.\n", status );
4034 ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length );
4035 ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength );
4036 ok( info.ImageName.Buffer == name, "got %p, %p.\n", info.ImageName.Buffer, name );
4037
4038 info.ProcessId = 0;
4039 info.ImageName.MaximumLength = sizeof(name);
4040 info.ImageName.Buffer = name;
4041 info.ImageName.Length = 0;
4042 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4043 ok( status == STATUS_INVALID_CID, "got %#lx.\n", status );
4044 ok( !info.ImageName.Length, "got %#x.\n", info.ImageName.Length );
4045 ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength );
4046 ok( info.ImageName.Buffer == name, "got non NULL.\n" );
4047
4048 info.ProcessId = 0;
4049 info.ImageName.MaximumLength = sizeof(name);
4050 info.ImageName.Buffer = name;
4051 info.ImageName.Length = 4;
4052 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4053 ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status );
4054 ok( info.ImageName.Length == 4, "got %#x.\n", info.ImageName.Length );
4055 ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength );
4056 ok( info.ImageName.Buffer == name, "got non NULL.\n" );
4057
4058 info.ProcessId = GetCurrentProcessId();
4059 info.ImageName.MaximumLength = sizeof(name);
4060 info.ImageName.Buffer = name;
4061 info.ImageName.Length = 4;
4062 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), NULL );
4063 ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status );
4064 ok( info.ImageName.Length == 4, "got %#x.\n", info.ImageName.Length );
4065 ok( info.ImageName.MaximumLength == sizeof(name), "got %#x.\n", info.ImageName.MaximumLength );
4066
4067 info.ImageName.Length = 0;
4068 memset( name, 0xcc, sizeof(name) );
4069 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4070 ok( !status, "got %#lx.\n", status );
4071 ok( info.ImageName.Length == length, "got %#x.\n", info.ImageName.Length );
4072 ok( len == sizeof(info), "got %#lx.\n", len );
4073 ok( info.ImageName.MaximumLength == info.ImageName.Length + 2, "got %#x.\n", info.ImageName.MaximumLength );
4074 ok( !name[info.ImageName.Length / 2], "got %#x.\n", name[info.ImageName.Length / 2] );
4075
4076 ok( info.ImageName.Length == image_name->Length, "got %#x, %#x.\n", info.ImageName.Length, image_name->Length );
4077 ok( !wcscmp( name, image_name->Buffer ), "got %s, %s.\n", debugstr_w(name), debugstr_w(image_name->Buffer) );
4078
4079#if !defined (__REACTOS__) || (DLL_EXPORT_VERSION >= 0x601)
4080 bret = EnumProcesses( pids, sizeof(pids), &len );
4081 ok( bret, "got error %lu.\n", GetLastError() );
4082 for (i = 0; i < len / sizeof(*pids); ++i)
4083 {
4085 if (pids[i] && !process && GetLastError() != ERROR_ACCESS_DENIED)
4086 {
4087 /* process is gone already. */
4088 continue;
4089 }
4090 info.ProcessId = pids[i];
4091 info.ImageName.Length = 0;
4092 info.ImageName.MaximumLength = sizeof(name);
4093 info.ImageName.Buffer = name;
4094 status = pNtQuerySystemInformation( SystemProcessIdInformation, &info, sizeof(info), &len );
4095 ok( info.ImageName.Buffer == name || (!info.ImageName.MaximumLength && !info.ImageName.Length),
4096 "got %p, %p, pid %lu, lengh %u / %u.\n", info.ImageName.Buffer, name, pids[i],
4097 info.ImageName.Length, info.ImageName.MaximumLength );
4098 if (pids[i])
4099 ok( !status, "got %#lx, pid %lu.\n", status, pids[i] );
4100 else
4101 ok( status == STATUS_INVALID_CID, "got %#lx, pid %lu.\n", status, pids[i] );
4102 if (process) CloseHandle( process );
4103 }
4104#endif
4105}
@ ProcessImageFileName
Definition: cicbase.cpp:66
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
Definition: proc.c:1225
BOOL WINAPI EnumProcesses(DWORD *ids, DWORD count, DWORD *used)
Definition: debug.c:1204
_ACRTIMP int __cdecl wcscmp(const wchar_t *, const wchar_t *)
Definition: wcs.c:1972
#define STATUS_ACCESS_VIOLATION
#define debugstr_w
Definition: kernel32.h:32
#define PROCESS_QUERY_LIMITED_INFORMATION
Definition: security.c:89
@ SystemProcessIdInformation
Definition: extypes.h:307
#define STATUS_INVALID_CID
Definition: ntstatus.h:341
short WCHAR
Definition: pedump.c:58
Definition: name.c:39
DWORD WINAPI GetCurrentProcessId(void)
Definition: proc.c:1156

Referenced by START_TEST().

◆ test_process_instrumentation_callback()

static void test_process_instrumentation_callback ( void  )
static

Definition at line 3760 of file info.c.

3761{
3764
3767 || status == STATUS_NOT_SUPPORTED, "Got unexpected status %#lx.\n", status );
3769 {
3770 win_skip( "ProcessInstrumentationCallback is not supported.\n" );
3771 return;
3772 }
3773
3774 memset(&info, 0, sizeof(info));
3777 || broken( status == STATUS_INFO_LENGTH_MISMATCH ), "Got unexpected status %#lx.\n", status );
3778
3779 memset(&info, 0, sizeof(info));
3782 || broken( status == STATUS_PRIVILEGE_NOT_HELD ) /* some versions and machines before Win10 */,
3783 "Got unexpected status %#lx.\n", status );
3784
3785 if (status)
3786 {
3787 win_skip( "NtSetInformationProcess failed, skipping further tests.\n" );
3788 return;
3789 }
3790
3792 &info.Callback, sizeof(info.Callback) );
3793 ok( status == STATUS_SUCCESS, "got %#lx.\n", status );
3795 &info.Callback, sizeof(info.Callback) + 4 );
3796 ok( status == STATUS_SUCCESS, "got %#lx.\n", status );
3798 &info.Callback, sizeof(info.Callback) / 2 );
3799 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx.\n", status );
3800}
#define STATUS_PRIVILEGE_NOT_HELD
Definition: DriverTester.h:9
#define STATUS_NOT_SUPPORTED
Definition: d3dkmdt.h:48
@ ProcessInstrumentationCallback
Definition: winternl.h:1922

Referenced by START_TEST().

◆ test_process_token()

static void test_process_token ( int  argc,
char **  argv 
)
static

Definition at line 3901 of file info.c.

3902{
3903 STARTUPINFOA si = {.cb = sizeof(si)};
3904 PROCESS_ACCESS_TOKEN token_info = {0};
3905 TOKEN_STATISTICS stats1, stats2;
3906 HANDLE token, their_token;
3908 char cmdline[MAX_PATH];
3910 DWORD size;
3911 BOOL ret;
3912
3913 token_info.Thread = (HANDLE)0xdeadbeef;
3914
3915 sprintf( cmdline, "%s %s dummy", argv[0], argv[1] );
3916
3918 ok( ret, "got error %lu\n", GetLastError() );
3919
3920 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) - 1 );
3921 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status );
3922
3923 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
3924 ok( status == STATUS_INVALID_HANDLE, "got %#lx\n", status );
3925
3928 ok( ret, "got error %lu\n", GetLastError() );
3929
3930 token_info.Token = token;
3931 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
3933
3935 ok( ret, "got error %lu\n", GetLastError() );
3936 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
3937#ifdef __REACTOS__
3939 todo_wine ok( status == STATUS_BAD_TOKEN_TYPE, "got %#lx\n", status );
3940 else
3941#endif
3943 CloseHandle( token_info.Token );
3944
3946 ok( ret, "got error %lu\n", GetLastError() );
3947 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
3948 ok( status == STATUS_ACCESS_DENIED, "got %#lx\n", status );
3949 CloseHandle( token_info.Token );
3950
3952 ok(ret, "got error %lu\n", GetLastError());
3953 status = pNtSetInformationProcess( pi.hProcess, ProcessAccessToken, &token_info, sizeof(token_info) );
3954 ok( status == STATUS_SUCCESS, "got %#lx\n", status );
3955
3956 ret = OpenProcessToken( pi.hProcess, TOKEN_QUERY, &their_token );
3957 ok( ret, "got error %lu\n", GetLastError() );
3958
3959 /* The tokens should be the same. */
3960 ret = GetTokenInformation( token_info.Token, TokenStatistics, &stats1, sizeof(stats1), &size );
3961 ok( ret, "got error %lu\n", GetLastError() );
3962 ret = GetTokenInformation( their_token, TokenStatistics, &stats2, sizeof(stats2), &size );
3963 ok( ret, "got error %lu\n", GetLastError() );
3964 ok( !memcmp( &stats1.TokenId, &stats2.TokenId, sizeof(LUID) ), "expected same IDs\n" );
3965
3966 CloseHandle( token_info.Token );
3967 CloseHandle( their_token );
3968
3971 ok( !ret, "got %d\n", ret );
3972
3975 CloseHandle( token );
3976}
#define GetNTVersion()
Definition: apitest.h:17
BOOL WINAPI DuplicateTokenEx(IN HANDLE ExistingTokenHandle, IN DWORD dwDesiredAccess, IN LPSECURITY_ATTRIBUTES lpTokenAttributes OPTIONAL, IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, IN TOKEN_TYPE TokenType, OUT PHANDLE DuplicateTokenHandle)
Definition: security.c:3859
DWORD WINAPI ResumeThread(IN HANDLE hThread)
Definition: thread.c:567
_ACRTIMP int __cdecl memcmp(const void *, const void *, size_t)
Definition: string.c:2802
@ SecurityAnonymous
Definition: lsa.idl:55
#define todo_wine
Definition: minitest.h:80
@ TokenImpersonation
Definition: imports.h:274
@ TokenPrimary
Definition: imports.h:273
static const void void SIZE_T *static SIZE_T *static const OBJECT_ATTRIBUTES const LARGE_INTEGER HANDLE
Definition: info.c:49
#define READ_CONTROL
Definition: nt_native.h:58
#define STATUS_TOKEN_ALREADY_IN_USE
Definition: ntstatus.h:629
#define STATUS_BAD_TOKEN_TYPE
Definition: ntstatus.h:498
#define STATUS_BAD_IMPERSONATION_LEVEL
Definition: ntstatus.h:495
#define _WIN32_WINNT_WIN7
Definition: sdkddkver.h:28
#define CREATE_SUSPENDED
Definition: winbase.h:182
@ ProcessAccessToken
Definition: winternl.h:1891
#define TOKEN_DUPLICATE
Definition: setypes.h:938
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:942
#define TOKEN_QUERY
Definition: setypes.h:940
@ TokenStatistics
Definition: setypes.h:987
#define TOKEN_ASSIGN_PRIMARY
Definition: setypes.h:937
#define TOKEN_ADJUST_DEFAULT
Definition: setypes.h:944

Referenced by START_TEST().

◆ test_processor_idle_cycle_time()

static void test_processor_idle_cycle_time ( void  )
static

Definition at line 4107 of file info.c.

4108{
4109 unsigned int cpu_count = NtCurrentTeb()->Peb->NumberOfProcessors;
4110 ULONG64 buffer[64];
4112 USHORT group_id;
4113 ULONG size;
4114
4115 size = 0xdeadbeef;
4116 status = pNtQuerySystemInformation( SystemProcessorIdleCycleTimeInformation, NULL, 0, &size );
4117 ok( status == STATUS_BUFFER_TOO_SMALL, "got %#lx.\n", status );
4118 ok( size == cpu_count * sizeof(*buffer), "got %#lx.\n", size );
4119
4120 size = 0xdeadbeef;
4121 status = pNtQuerySystemInformation( SystemProcessorIdleCycleTimeInformation, buffer, 7, &size );
4122 ok( status == STATUS_BUFFER_TOO_SMALL, "got %#lx.\n", status );
4123 ok( size == cpu_count * sizeof(*buffer), "got %#lx.\n", size );
4124
4125 size = 0xdeadbeef;
4126 status = pNtQuerySystemInformation( SystemProcessorIdleCycleTimeInformation, NULL, sizeof(buffer), &size );
4127 ok( status == STATUS_ACCESS_VIOLATION, "got %#lx.\n", status );
4128 ok( size == 0xdeadbeef, "got %#lx.\n", size );
4129
4130 size = 0xdeadbeef;
4131 status = pNtQuerySystemInformation( SystemProcessorIdleCycleTimeInformation, buffer, sizeof(buffer), &size );
4132 ok( !status, "got %#lx.\n", status );
4133 ok( size == cpu_count * sizeof(*buffer), "got %#lx.\n", size );
4134
4135#ifdef __REACTOS__
4136 if (pNtQuerySystemInformationEx == NULL)
4137 {
4138 win_skip("NtQuerySystemInformationEx is not available.\n");
4139 return;
4140 }
4141#endif
4142
4143 memset( buffer, 0xcc, sizeof(buffer) );
4144 size = 0xdeadbeef;
4145 status = pNtQuerySystemInformationEx( SystemProcessorIdleCycleTimeInformation, NULL, 0, buffer, sizeof(buffer), &size );
4146 ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status );
4147 ok( size == 0xdeadbeef, "got %#lx.\n", size );
4148 group_id = 50;
4149 size = 0xdeadbeef;
4150 status = pNtQuerySystemInformationEx( SystemProcessorIdleCycleTimeInformation, &group_id, sizeof(group_id), buffer, sizeof(buffer), &size );
4151 ok( status == STATUS_INVALID_PARAMETER, "got %#lx.\n", status );
4152 ok( size == 0xdeadbeef, "got %#lx.\n", size );
4153 group_id = 0;
4154 size = 0xdeadbeef;
4155 status = pNtQuerySystemInformationEx( SystemProcessorIdleCycleTimeInformation, &group_id, sizeof(group_id), buffer, sizeof(buffer), &size );
4156 ok( status == STATUS_SUCCESS, "got %#lx.\n", status );
4157 ok( size == cpu_count * sizeof(*buffer), "got %#lx.\n", size );
4158}
unsigned __int64 ULONG64
Definition: imports.h:198
@ SystemProcessorIdleCycleTimeInformation
Definition: extypes.h:302
unsigned short USHORT
Definition: pedump.c:61
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:69

Referenced by START_TEST().

◆ test_query_basic()

static void test_query_basic ( void  )
static

Definition at line 138 of file info.c.

139{
142 SYSTEM_BASIC_INFORMATION sbi, sbi2, sbi3;
143
144 /* This test also covers some basic parameter testing that should be the same for
145 * every information class
146 */
147
148 /* Use a nonexistent info class */
149 status = pNtQuerySystemInformation(-1, NULL, 0, NULL);
151 "Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08lx\n", status);
152
153 /* Use an existing class but with a zero-length buffer */
154 status = pNtQuerySystemInformation(SystemBasicInformation, NULL, 0, NULL);
155 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
156
157 /* Use an existing class, correct length but no SystemInformation buffer */
158 status = pNtQuerySystemInformation(SystemBasicInformation, NULL, sizeof(sbi), NULL);
160 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_PARAMETER, got %08lx\n", status);
161
162 /* Use an existing class, correct length, a pointer to a buffer but no ReturnLength pointer */
163 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
164 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
165
166 /* Check a too large buffer size */
167 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi) * 2, &ReturnLength);
168 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
169
170 /* Finally some correct calls */
171 memset(&sbi, 0xcc, sizeof(sbi));
172 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
173 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
174 ok( sizeof(sbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
175
176 /* Check if we have some return values */
177 if (winetest_debug > 1) trace("Number of Processors : %d\n", sbi.NumberOfProcessors);
178 ok( sbi.NumberOfProcessors > 0, "Expected more than 0 processors, got %d\n", sbi.NumberOfProcessors);
179
180 memset(&sbi2, 0xcc, sizeof(sbi2));
181 status = pRtlGetNativeSystemInformation(SystemBasicInformation, &sbi2, sizeof(sbi2), &ReturnLength);
182 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status);
183 ok( sizeof(sbi2) == ReturnLength, "Unexpected length %lu.\n", ReturnLength);
184
185 ok( sbi.unknown == sbi2.unknown, "Expected unknown %#lx, got %#lx.\n", sbi.unknown, sbi2.unknown);
186 ok( sbi.KeMaximumIncrement == sbi2.KeMaximumIncrement, "Expected KeMaximumIncrement %lu, got %lu.\n",
187 sbi.KeMaximumIncrement, sbi2.KeMaximumIncrement);
188 ok( sbi.PageSize == sbi2.PageSize, "Expected PageSize field %lu, %lu.\n", sbi.PageSize, sbi2.PageSize);
189 ok( sbi.MmNumberOfPhysicalPages == sbi2.MmNumberOfPhysicalPages,
190 "Expected MmNumberOfPhysicalPages %lu, got %lu.\n",
191 sbi.MmNumberOfPhysicalPages, sbi2.MmNumberOfPhysicalPages);
192 ok( sbi.MmLowestPhysicalPage == sbi2.MmLowestPhysicalPage, "Expected MmLowestPhysicalPage %lu, got %lu.\n",
193 sbi.MmLowestPhysicalPage, sbi2.MmLowestPhysicalPage);
194 ok( sbi.MmHighestPhysicalPage == sbi2.MmHighestPhysicalPage, "Expected MmHighestPhysicalPage %lu, got %lu.\n",
195 sbi.MmHighestPhysicalPage, sbi2.MmHighestPhysicalPage);
196 /* Higher 32 bits of AllocationGranularity is sometimes garbage on Windows. */
198 "Expected AllocationGranularity %#Ix, got %#Ix.\n",
200 ok( sbi.LowestUserAddress == sbi2.LowestUserAddress, "Expected LowestUserAddress %p, got %p.\n",
201 sbi.LowestUserAddress, sbi2.LowestUserAddress);
203 "Expected ActiveProcessorsAffinityMask %#Ix, got %#Ix.\n",
205 ok( sbi.NumberOfProcessors == sbi2.NumberOfProcessors, "Expected NumberOfProcessors %u, got %u.\n",
207#ifdef _WIN64
208 ok( sbi.HighestUserAddress == sbi2.HighestUserAddress, "Expected HighestUserAddress %p, got %p.\n",
209 (void *)sbi.HighestUserAddress, (void *)sbi2.HighestUserAddress);
210#else
211 ok( sbi.HighestUserAddress == (void *)0x7ffeffff, "wrong limit %p\n", sbi.HighestUserAddress);
213 ok( sbi2.HighestUserAddress == (is_wow64 ? (void *)0xfffeffff : (void *)0x7ffeffff),
214 "wrong limit %p\n", sbi.HighestUserAddress);
215#endif
216
217 memset(&sbi3, 0xcc, sizeof(sbi3));
218 status = pNtQuerySystemInformation(SystemNativeBasicInformation, &sbi3, sizeof(sbi3), &ReturnLength);
219#ifdef _WIN64
221 if (!status)
222 {
223 ok( sizeof(sbi3) == ReturnLength, "Unexpected length %lu.\n", ReturnLength);
224 ok( !memcmp( &sbi2, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ),
225 "info is different\n" );
226 }
227#else
229 "got %08lx\n", status);
230 status = pRtlGetNativeSystemInformation( SystemNativeBasicInformation, &sbi3, sizeof(sbi3), &ReturnLength );
233 "failed %lx\n", status );
236 ok( !status == !is_wow64, "got wrong status %lx wow64 %u\n", status, is_wow64 );
237 if (!status)
238 {
239 ok( sizeof(sbi3) == ReturnLength, "Unexpected length %lu.\n", ReturnLength);
240 ok( !memcmp( &sbi2, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ),
241 "info is different\n" );
242 }
244 {
245 /* SystemNativeBasicInformation uses the 64-bit structure on Wow64 */
246 struct
247 {
250 ULONG PageSize;
254 ULONG64 AllocationGranularity;
255 ULONG64 LowestUserAddress;
256 ULONG64 HighestUserAddress;
257 ULONG64 ActiveProcessorsAffinityMask;
258 BYTE NumberOfProcessors;
259 } sbi64;
260
261 ok( ReturnLength == sizeof(sbi64), "len %lx\n", ReturnLength );
262 memset( &sbi64, 0xcc, sizeof(sbi64) );
263 ReturnLength = 0;
264 status = pRtlGetNativeSystemInformation( SystemNativeBasicInformation, &sbi64, sizeof(sbi64), &ReturnLength );
265 ok( !status, "failed %lx\n", status );
266 ok( ReturnLength == sizeof(sbi64), "len %lx\n", ReturnLength );
267
268 ok( sbi.unknown == sbi64.unknown, "unknown %#lx / %#lx\n", sbi.unknown, sbi64.unknown);
269 ok( sbi.KeMaximumIncrement == sbi64.KeMaximumIncrement, "KeMaximumIncrement %lu / %lu\n",
270 sbi.KeMaximumIncrement, sbi64.KeMaximumIncrement);
271 ok( sbi.PageSize == sbi64.PageSize, "PageSize %lu / %lu\n", sbi.PageSize, sbi64.PageSize);
272 ok( sbi.MmNumberOfPhysicalPages == sbi64.MmNumberOfPhysicalPages,
273 "MmNumberOfPhysicalPages %lu / %lu\n",
274 sbi.MmNumberOfPhysicalPages, sbi64.MmNumberOfPhysicalPages);
275 ok( sbi.MmLowestPhysicalPage == sbi64.MmLowestPhysicalPage, "MmLowestPhysicalPage %lu / %lu\n",
276 sbi.MmLowestPhysicalPage, sbi64.MmLowestPhysicalPage);
277 ok( sbi.MmHighestPhysicalPage == sbi64.MmHighestPhysicalPage, "MmHighestPhysicalPage %lu / %lu\n",
278 sbi.MmHighestPhysicalPage, sbi64.MmHighestPhysicalPage);
279 ok( sbi.AllocationGranularity == (ULONG_PTR)sbi64.AllocationGranularity,
280 "AllocationGranularity %#Ix / %#Ix\n", sbi.AllocationGranularity,
281 (ULONG_PTR)sbi64.AllocationGranularity);
282 ok( (ULONG_PTR)sbi.LowestUserAddress == sbi64.LowestUserAddress, "LowestUserAddress %p / %s\n",
283 sbi.LowestUserAddress, wine_dbgstr_longlong(sbi64.LowestUserAddress));
284 ok( sbi.ActiveProcessorsAffinityMask == sbi64.ActiveProcessorsAffinityMask,
285 "ActiveProcessorsAffinityMask %#Ix / %s\n",
286 sbi.ActiveProcessorsAffinityMask, wine_dbgstr_longlong(sbi64.ActiveProcessorsAffinityMask));
287 ok( sbi.NumberOfProcessors == sbi64.NumberOfProcessors, "NumberOfProcessors %u / %u\n",
288 sbi.NumberOfProcessors, sbi64.NumberOfProcessors);
289 ok( sbi64.HighestUserAddress == 0x7ffffffeffff, "wrong limit %s\n",
290 wine_dbgstr_longlong(sbi64.HighestUserAddress));
291 }
292#endif
293
294 memset(&sbi3, 0xcc, sizeof(sbi3));
295 status = pNtQuerySystemInformation(SystemEmulationBasicInformation, &sbi3, sizeof(sbi3), &ReturnLength);
296 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status);
297 ok( sizeof(sbi3) == ReturnLength, "Unexpected length %lu.\n", ReturnLength);
298 ok( !memcmp( &sbi, &sbi3, offsetof(SYSTEM_BASIC_INFORMATION,NumberOfProcessors)+1 ),
299 "info is different\n" );
300
301 for (i = 0; i < 256; i++)
302 {
303 NTSTATUS expect = pNtQuerySystemInformation( i, NULL, 0, &ReturnLength );
304 status = pRtlGetNativeSystemInformation( i, NULL, 0, &ReturnLength );
305 switch (i)
306 {
309 broken(status == STATUS_NOT_IMPLEMENTED) /* vista */, "%lu: %lx / %lx\n", i, status, expect );
310 break;
315 ok( status == expect, "%lu: %lx / %lx\n", i, status, expect );
316 break;
317 default:
318 if (is_wow64) /* only a few info classes are supported on Wow64 */
321 broken(status == STATUS_NOT_IMPLEMENTED), /* vista */
322 "%lu: %lx\n", i, status );
323 else
324 ok( status == expect, "%lu: %lx / %lx\n", i, status, expect );
325 break;
326 }
327 }
328}
_In_ PVOID _In_ ULONG _Out_ PVOID _In_ ULONG _Inout_ PULONG ReturnLength
#define expect(EXPECTED, GOT)
Definition: SystemMenu.c:483
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
@ SystemBasicInformation
Definition: ntddk_ex.h:11
PFN_NUMBER MmLowestPhysicalPage
Definition: meminit.c:30
PFN_NUMBER MmHighestPhysicalPage
Definition: meminit.c:31
#define todo_wine_if(is_todo)
Definition: minitest.h:81
static SYSTEM_BASIC_INFORMATION sbi
Definition: virtual.c:53
@ SystemEmulationBasicInformation
Definition: extypes.h:279
@ SystemEmulationProcessorInformation
Definition: extypes.h:280
@ SystemNativeBasicInformation
Definition: extypes.h:336
PFN_COUNT MmNumberOfPhysicalPages
Definition: init.c:48
ULONG KeMaximumIncrement
Definition: clock.c:20
KAFFINITY ActiveProcessorsAffinityMask
Definition: ntddk_ex.h:167
uint32_t ULONG_PTR
Definition: typedefs.h:65
@ SystemCpuInformation
Definition: winternl.h:2014
unsigned char BYTE
Definition: xxhash.c:193

Referenced by START_TEST().

◆ test_query_battery()

static void test_query_battery ( void  )
static

Definition at line 1638 of file info.c.

1639{
1642 DWORD time_left;
1643
1644 memset(&bs, 0x23, sizeof(bs));
1647 {
1648 skip("SystemBatteryState not implemented\n");
1649 return;
1650 }
1651 ok(status == STATUS_SUCCESS, "expected success\n");
1652
1653 if (winetest_debug > 1)
1654 {
1655 trace("Battery state:\n");
1656 trace("AcOnLine : %u\n", bs.AcOnLine);
1657 trace("BatteryPresent : %u\n", bs.BatteryPresent);
1658 trace("Charging : %u\n", bs.Charging);
1659 trace("Discharging : %u\n", bs.Discharging);
1660 trace("Tag : %u\n", bs.Tag);
1661 trace("MaxCapacity : %lu\n", bs.MaxCapacity);
1662 trace("RemainingCapacity : %lu\n", bs.RemainingCapacity);
1663 trace("Rate : %ld\n", (LONG)bs.Rate);
1664 trace("EstimatedTime : %lu\n", bs.EstimatedTime);
1665 trace("DefaultAlert1 : %lu\n", bs.DefaultAlert1);
1666 trace("DefaultAlert2 : %lu\n", bs.DefaultAlert2);
1667 }
1668
1669 ok(bs.MaxCapacity >= bs.RemainingCapacity,
1670 "expected MaxCapacity %lu to be greater than or equal to RemainingCapacity %lu\n",
1671 bs.MaxCapacity, bs.RemainingCapacity);
1672
1673 if (!bs.BatteryPresent)
1674 time_left = 0;
1675 else if (!bs.Charging && (LONG)bs.Rate < 0)
1676 time_left = 3600 * bs.RemainingCapacity / -(LONG)bs.Rate;
1677 else
1678 time_left = ~0u;
1679 ok(bs.EstimatedTime == time_left,
1680 "expected %lu minutes remaining got %lu minutes\n", time_left, bs.EstimatedTime);
1681}
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
static struct msdos_boot_sector bs
Definition: mkdosfs.c:539
@ SystemBatteryState
Definition: ntpoapi.h:72
long LONG
Definition: pedump.c:60

Referenced by START_TEST().

◆ test_query_cache()

static void test_query_cache ( void  )
static

Definition at line 1045 of file info.c.

1046{
1049 BYTE buffer[128];
1052 INT i;
1053
1055 for (i = sizeof(buffer); i>= expected; i--)
1056 {
1057 ReturnLength = 0xdeadbeef;
1058 status = pNtQuerySystemInformation(SystemFileCacheInformation, sci, i, &ReturnLength);
1059 ok(!status && (ReturnLength == expected),
1060 "%d: got 0x%lx and %lu (expected STATUS_SUCCESS and %lu)\n", i, status, ReturnLength, expected);
1061 }
1062
1063 /* buffer too small for the full result.
1064 Up to win7, the function succeeds with a partial result. */
1065 status = pNtQuerySystemInformation(SystemFileCacheInformation, sci, i, &ReturnLength);
1066 if (!status)
1067 {
1068 expected = 3 * sizeof(ULONG);
1069 for (; i>= expected; i--)
1070 {
1071 ReturnLength = 0xdeadbeef;
1072 status = pNtQuerySystemInformation(SystemFileCacheInformation, sci, i, &ReturnLength);
1073 ok(!status && (ReturnLength == expected),
1074 "%d: got 0x%lx and %lu (expected STATUS_SUCCESS and %lu)\n", i, status, ReturnLength, expected);
1075 }
1076 }
1077
1078 /* buffer too small for the result, this call will always fail */
1079 ReturnLength = 0xdeadbeef;
1080 status = pNtQuerySystemInformation(SystemFileCacheInformation, sci, i, &ReturnLength);
1082 ((ReturnLength == expected) || broken(!ReturnLength) || broken(ReturnLength == 0xfffffff0)),
1083 "%d: got 0x%lx and %lu (expected STATUS_INFO_LENGTH_MISMATCH and %lu)\n", i, status, ReturnLength, expected);
1084
1085 if (0) {
1086 /* this crashes on some vista / win7 machines */
1087 ReturnLength = 0xdeadbeef;
1088 status = pNtQuerySystemInformation(SystemFileCacheInformation, sci, 0, &ReturnLength);
1090 ((ReturnLength == expected) || broken(!ReturnLength) || broken(ReturnLength == 0xfffffff0)),
1091 "0: got 0x%lx and %lu (expected STATUS_INFO_LENGTH_MISMATCH and %lu)\n", status, ReturnLength, expected);
1092 }
1093}
@ SystemFileCacheInformation
Definition: ntddk_ex.h:32
BOOL expected
Definition: store.c:2000
int32_t INT
Definition: typedefs.h:58
struct _SYSTEM_CACHE_INFORMATION SYSTEM_CACHE_INFORMATION

Referenced by START_TEST().

◆ test_query_cpu()

static void test_query_cpu ( void  )
static

Definition at line 330 of file info.c.

331{
333 ULONG len, buffer[16];
335 SYSTEM_CPU_INFORMATION sci, sci2, sci3;
336
337 memset(&sci, 0xcc, sizeof(sci));
338 status = pNtQuerySystemInformation(SystemCpuInformation, &sci, sizeof(sci), &len);
339 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
340 ok( sizeof(sci) == len, "Inconsistent length %ld\n", len);
341
342 memset(&sci2, 0xcc, sizeof(sci2));
343 status = pRtlGetNativeSystemInformation(SystemCpuInformation, &sci2, sizeof(sci2), &len);
344 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status);
345 ok( sizeof(sci2) == len, "Unexpected length %lu.\n", len);
346
347 if (is_wow64)
348 {
349 ok( sci.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n",
353 "ProcessorArchitecture wrong %x\n", sci2.ProcessorArchitecture );
354 }
355 else
357 "ProcessorArchitecture differs %x / %x\n",
359
361 {
362 /* Check if we have some return values */
363 if (winetest_debug > 1) trace("Processor FeatureSet : %08lx\n", sci.ProcessorFeatureBits);
364 ok( sci.ProcessorFeatureBits != 0, "Expected some features for this processor, got %08lx\n",
366 }
367 ok( sci.ProcessorLevel == sci2.ProcessorLevel, "ProcessorLevel differs %x / %x\n",
368 sci.ProcessorLevel, sci2.ProcessorLevel );
369 ok( sci.ProcessorRevision == sci2.ProcessorRevision, "ProcessorRevision differs %x / %x\n",
371 ok( sci.MaximumProcessors == sci2.MaximumProcessors, "MaximumProcessors differs %x / %x\n",
373 ok( sci.ProcessorFeatureBits == sci2.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n",
375
376 memset(&sci3, 0xcc, sizeof(sci3));
377 status = pNtQuerySystemInformation(SystemEmulationProcessorInformation, &sci3, sizeof(sci3), &len);
378 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx.\n", status);
379 ok( sizeof(sci3) == len, "Unexpected length %lu.\n", len);
380
381#ifdef _WIN64
383 ok( sci3.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM, "ProcessorArchitecture wrong %x\n",
385 else
386 ok( sci3.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_INTEL, "ProcessorArchitecture wrong %x\n",
388#else
390 "ProcessorArchitecture differs %x / %x\n",
392#endif
393 ok( sci.ProcessorLevel == sci3.ProcessorLevel, "ProcessorLevel differs %x / %x\n",
394 sci.ProcessorLevel, sci3.ProcessorLevel );
395 ok( sci.ProcessorRevision == sci3.ProcessorRevision, "ProcessorRevision differs %x / %x\n",
397 ok( sci.MaximumProcessors == sci3.MaximumProcessors, "MaximumProcessors differs %x / %x\n",
399 ok( sci.ProcessorFeatureBits == sci3.ProcessorFeatureBits, "ProcessorFeatureBits differs %lx / %lx\n",
401
402 len = 0xdeadbeef;
403 status = pNtQuerySystemInformation( SystemProcessorFeaturesInformation, &features, sizeof(features), &len );
405 {
406 ok( !status, "SystemProcessorFeaturesInformation failed %lx\n", status );
407 ok( len == sizeof(features), "wrong len %lu\n", len );
408 ok( (ULONG)features.ProcessorFeatureBits == sci.ProcessorFeatureBits, "wrong bits %I64x / %lx\n",
410 }
411 else skip( "SystemProcessorFeaturesInformation is not supported\n" );
412
413 len = 0xdeadbeef;
414 status = pNtQuerySystemInformation( SystemProcessorBrandString, buffer, sizeof(buffer), &len );
415#ifdef __REACTOS__
417 {
418 ok(status == STATUS_INVALID_INFO_CLASS, "Unexpected status 0x%lx\n", status );
419 }
420 else
421#endif
423 {
424 ok( !status, "SystemProcessorBrandString failed %lx\n", status );
425 ok( len == 49, "wrong len %lu\n", len );
426 trace( "got %s len %u\n", debugstr_a( (char *)buffer ), lstrlenA( (char *)buffer ));
427
428 len = 0xdeadbeef;
429 status = pNtQuerySystemInformation( SystemProcessorBrandString, buffer, 49, &len );
430 ok( !status, "SystemProcessorBrandString failed %lx\n", status );
431 ok( len == 49, "wrong len %lu\n", len );
432
433 len = 0xdeadbeef;
434 status = pNtQuerySystemInformation( SystemProcessorBrandString, buffer, 48, &len );
435 ok( status == STATUS_INFO_LENGTH_MISMATCH, "SystemProcessorBrandString failed %lx\n", status );
436 ok( len == 49, "wrong len %lu\n", len );
437
438 len = 0xdeadbeef;
439 status = pNtQuerySystemInformation( SystemProcessorBrandString, (char *)buffer + 1, 49, &len );
440 ok( status == STATUS_DATATYPE_MISALIGNMENT, "SystemProcessorBrandString failed %lx\n", status );
441 ok( len == 0xdeadbeef, "wrong len %lu\n", len );
442 }
443 else skip( "SystemProcessorBrandString is not supported\n" );
444}
#define debugstr_a
Definition: kernel32.h:31
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
@ SystemProcessorBrandString
Definition: extypes.h:324
@ SystemProcessorFeaturesInformation
Definition: extypes.h:384
#define PROCESSOR_ARCHITECTURE_ARM
Definition: ketypes.h:110
#define PROCESSOR_ARCHITECTURE_AMD64
Definition: ketypes.h:114
#define PROCESSOR_ARCHITECTURE_INTEL
Definition: ketypes.h:105
#define STATUS_DATATYPE_MISALIGNMENT
Definition: ntstatus.h:263
#define _WIN32_WINNT_VISTA
Definition: sdkddkver.h:25
#define PROCESSOR_ARCHITECTURE_ARM64
Definition: winnt_old.h:503

Referenced by START_TEST().

◆ test_query_cpusetinfo()

static void test_query_cpusetinfo ( void  )
static

Definition at line 1497 of file info.c.

1498{
1500 unsigned int i, cpu_count;
1501 ULONG len, expected_len;
1505
1506 if (!pNtQuerySystemInformationEx)
1507 return;
1508
1509 GetSystemInfo(&si);
1510 cpu_count = si.dwNumberOfProcessors;
1511 expected_len = cpu_count * sizeof(*info);
1512
1514
1515 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, sizeof(process), NULL, 0, &len);
1517 {
1518 win_skip("SystemCpuSetInformation is not supported\n");
1519 return;
1520 }
1521
1522 ok(status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", status);
1523 ok(len == expected_len, "Got unexpected length %lu.\n", len);
1524
1525 len = 0xdeadbeef;
1526 status = pNtQuerySystemInformation(SystemCpuSetInformation, NULL, 0, &len);
1528 "Got unexpected status %#lx.\n", status);
1529 ok(len == 0xdeadbeef, "Got unexpected len %lu.\n", len);
1530
1531 len = 0xdeadbeef;
1532 process = (HANDLE)0xdeadbeef;
1533 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, sizeof(process), NULL, 0, &len);
1534 ok(status == STATUS_INVALID_HANDLE, "Got unexpected status %#lx.\n", status);
1535 ok(len == 0xdeadbeef, "Got unexpected length %lu.\n", len);
1536
1537 len = 0xdeadbeef;
1538 process = NULL;
1539 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, 4 * sizeof(process), NULL, 0, &len);
1540 ok((status == STATUS_INVALID_PARAMETER && len == 0xdeadbeef)
1541 || (status == STATUS_BUFFER_TOO_SMALL && len == expected_len),
1542 "Got unexpected status %#lx, length %lu.\n", status, len);
1543
1544 len = 0xdeadbeef;
1545 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, NULL, sizeof(process), NULL, 0, &len);
1546 ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#lx.\n", status);
1547 ok(len == 0xdeadbeef, "Got unexpected length %lu.\n", len);
1548
1549 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, sizeof(process), NULL, 0, &len);
1550 ok(status == STATUS_BUFFER_TOO_SMALL, "Got unexpected status %#lx.\n", status);
1551 ok(len == expected_len, "Got unexpected length %lu.\n", len);
1552
1553 len = 0xdeadbeef;
1554 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, sizeof(process), NULL,
1555 expected_len, &len);
1556 ok(status == STATUS_ACCESS_VIOLATION, "Got unexpected status %#lx.\n", status);
1557 ok(len == 0xdeadbeef, "Got unexpected length %lu.\n", len);
1558
1559 info = malloc(expected_len);
1560 len = 0;
1561 status = pNtQuerySystemInformationEx(SystemCpuSetInformation, &process, sizeof(process), info, expected_len, &len);
1562 ok(status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status);
1563 ok(len == expected_len, "Got unexpected length %lu.\n", len);
1564
1565 for (i = 0; i < cpu_count; ++i)
1566 {
1568
1569 ok(d->Size == sizeof(*d), "Got unexpected size %lu, i %u.\n", d->Size, i);
1570 ok(d->Type == CpuSetInformation, "Got unexpected type %u, i %u.\n", d->Type, i);
1571 ok(d->CpuSet.Id == 0x100 + i, "Got unexpected Id %#lx, i %u.\n", d->CpuSet.Id, i);
1572 ok(!d->CpuSet.Group, "Got unexpected Group %u, i %u.\n", d->CpuSet.Group, i);
1573 ok(d->CpuSet.LogicalProcessorIndex == i, "Got unexpected LogicalProcessorIndex %u, i %u.\n",
1574 d->CpuSet.LogicalProcessorIndex, i);
1575 ok(!d->CpuSet.AllFlags, "Got unexpected AllFlags %#x, i %u.\n", d->CpuSet.AllFlags, i);
1576 }
1577 free(info);
1578}
#define free
Definition: debug_ros.c:5
#define malloc
Definition: debug_ros.c:4
#define d
Definition: ke_i.h:81
@ SystemCpuSetInformation
Definition: extypes.h:408
@ CpuSetInformation
Definition: ketypes.h:129
SYSTEM_CPU_SET_INFORMATION
Definition: ketypes.h:168

Referenced by START_TEST().

◆ test_query_data_alignment()

static void test_query_data_alignment ( void  )
static

Definition at line 3501 of file info.c.

3502{
3504 ULONG len;
3506 DWORD value;
3507
3508 value = 0xdeadbeef;
3509 status = pNtQuerySystemInformation(SystemRecommendedSharedDataAlignment, &value, sizeof(value), &len);
3510 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3511 ok(sizeof(value) == len, "Inconsistent length %lu\n", len);
3512
3513 pRtlGetNativeSystemInformation(SystemCpuInformation, &sci, sizeof(sci), &len);
3514 switch (sci.ProcessorArchitecture)
3515 {
3517 ok(value == 32, "Expected 32, got %lu\n", value);
3518 break;
3520 ok(value == 128, "Expected 128, got %lu\n", value);
3521 break;
3522 default:
3523 ok(value == 64, "Expected 64, got %lu\n", value);
3524 break;
3525 }
3526}
@ SystemRecommendedSharedDataAlignment
Definition: extypes.h:275
Definition: pdh_main.c:96

Referenced by START_TEST().

◆ test_query_firmware()

static void test_query_firmware ( void  )
static

Definition at line 1580 of file info.c.

1581{
1582 static const ULONG min_sfti_len = FIELD_OFFSET(SYSTEM_FIRMWARE_TABLE_INFORMATION, TableBuffer);
1583 ULONG len1, len2;
1586
1587 sfti = HeapAlloc(GetProcessHeap(), 0, sizeof(*sfti));
1588 ok(!!sfti, "Failed to allocate memory\n");
1589
1590 sfti->ProviderSignature = 0;
1591 sfti->Action = 0;
1592 sfti->TableID = 0;
1593
1594 status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len - 1, &len1);
1596 "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1597 if (len1 == 0) /* xp, 2003 */
1598 {
1599 win_skip("SystemFirmwareTableInformation is not available\n");
1600 HeapFree(GetProcessHeap(), 0, sfti);
1601 return;
1602 }
1603 ok(len1 == min_sfti_len, "Expected length %lu, got %lu\n", min_sfti_len, len1);
1604
1605 status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len, &len1);
1606 ok(status == STATUS_NOT_IMPLEMENTED, "Expected STATUS_NOT_IMPLEMENTED, got %08lx\n", status);
1607 ok(len1 == 0, "Expected length 0, got %lu\n", len1);
1608
1609 sfti->ProviderSignature = RSMB;
1611
1612 status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, min_sfti_len, &len1);
1613#ifdef __REACTOS__
1615 {
1616 win_skip("SystemFirmwareTableInformation not available\n");
1617 HeapFree(GetProcessHeap(), 0, sfti);
1618 return;
1619 }
1620#endif
1621 ok(status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08lx\n", status);
1622 ok(len1 >= min_sfti_len, "Expected length >= %lu, got %lu\n", min_sfti_len, len1);
1623 ok(sfti->TableBufferLength == len1 - min_sfti_len,
1624 "Expected length %lu, got %lu\n", len1 - min_sfti_len, sfti->TableBufferLength);
1625
1626 sfti = HeapReAlloc(GetProcessHeap(), 0, sfti, len1);
1627 ok(!!sfti, "Failed to allocate memory\n");
1628
1629 status = pNtQuerySystemInformation(SystemFirmwareTableInformation, sfti, len1, &len2);
1630 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1631 ok(len2 == len1, "Expected length %lu, got %lu\n", len1, len2);
1632 ok(sfti->TableBufferLength == len1 - min_sfti_len,
1633 "Expected length %lu, got %lu\n", len1 - min_sfti_len, sfti->TableBufferLength);
1634
1635 HeapFree(GetProcessHeap(), 0, sfti);
1636}
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
#define RSMB
Definition: info.c:89
@ SystemFirmwareTableInformation
Definition: extypes.h:293
SYSTEM_FIRMWARE_TABLE_ACTION Action
Definition: winternl.h:3224
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
#define STATUS_INVALID_DEVICE_REQUEST
Definition: udferr_usr.h:138
@ SystemFirmwareTable_Get
Definition: winternl.h:3216

Referenced by START_TEST().

◆ test_query_handle()

static void test_query_handle ( void  )
static

Definition at line 879 of file info.c.

880{
882 ULONG ExpectedLength, ReturnLength;
883 ULONG SystemInformationLength = sizeof(SYSTEM_HANDLE_INFORMATION);
884 SYSTEM_HANDLE_INFORMATION* shi = HeapAlloc(GetProcessHeap(), 0, SystemInformationLength);
886 BOOL found, ret;
887 INT i;
888
890 ok( EventHandle != NULL, "CreateEventA failed %lu\n", GetLastError() );
893 ok(ret, "got error %lu\n", GetLastError());
894
895 /* Request the needed length : a SystemInformationLength greater than one struct sets ReturnLength */
896 ReturnLength = 0xdeadbeef;
897 status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
898 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
899 ok( ReturnLength != 0xdeadbeef, "Expected valid ReturnLength\n" );
900
901 SystemInformationLength = ReturnLength;
902 shi = HeapReAlloc(GetProcessHeap(), 0, shi , SystemInformationLength);
903 memset(shi, 0x55, SystemInformationLength);
904
905 ReturnLength = 0xdeadbeef;
906 status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
907 while (status == STATUS_INFO_LENGTH_MISMATCH) /* Vista / 2008 */
908 {
909 SystemInformationLength *= 2;
910 shi = HeapReAlloc(GetProcessHeap(), 0, shi, SystemInformationLength);
911 memset(shi, 0x55, SystemInformationLength);
912 status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
913 }
914 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
915 ExpectedLength = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION, Handle[shi->Count]);
916 ok( ReturnLength == ExpectedLength || broken(ReturnLength == ExpectedLength - sizeof(DWORD)), /* Vista / 2008 */
917 "Expected length %lu, got %lu\n", ExpectedLength, ReturnLength );
918 ok( shi->Count > 1, "Expected more than 1 handle, got %lu\n", shi->Count );
919 ok( shi->Handle[1].HandleValue != 0x5555 || broken( shi->Handle[1].HandleValue == 0x5555 ), /* Vista / 2008 */
920 "Uninitialized second handle\n" );
921 if (shi->Handle[1].HandleValue == 0x5555)
922 {
923 win_skip("Skipping broken SYSTEM_HANDLE_INFORMATION\n");
925 goto done;
926 }
927
928 found = FALSE;
929 for (i = 0; i < shi->Count; i++)
930 {
931 if (shi->Handle[i].OwnerPid == GetCurrentProcessId() &&
933 {
935 "got attributes %#x\n", shi->Handle[i].HandleFlags);
936 found = TRUE;
937 break;
938 }
939 }
940 ok( found, "Expected to find event handle %p (pid %lx) in handle list\n", EventHandle, GetCurrentProcessId() );
941
943 ok(ret, "got error %lu\n", GetLastError());
945
946 ReturnLength = 0xdeadbeef;
947 status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
948 while (status == STATUS_INFO_LENGTH_MISMATCH) /* Vista / 2008 */
949 {
950 SystemInformationLength *= 2;
951 shi = HeapReAlloc(GetProcessHeap(), 0, shi, SystemInformationLength);
952 status = pNtQuerySystemInformation(SystemHandleInformation, shi, SystemInformationLength, &ReturnLength);
953 }
954 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
955 for (i = 0, found = FALSE; i < shi->Count && !found; i++)
956 found = (shi->Handle[i].OwnerPid == GetCurrentProcessId()) &&
958 ok( !found, "Unexpectedly found event handle in handle list\n" );
959
960 status = pNtQuerySystemInformation(SystemHandleInformation, NULL, SystemInformationLength, &ReturnLength);
961 ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status );
962
963done:
964 HeapFree( GetProcessHeap(), 0, shi);
965}
#define OBJ_PROTECT_CLOSE
BOOL WINAPI SetHandleInformation(IN HANDLE hObject, IN DWORD dwMask, IN DWORD dwFlags)
Definition: handle.c:78
@ SystemHandleInformation
Definition: ntddk_ex.h:27
ULONG Handle
Definition: gdb_input.c:15
struct _SYSTEM_HANDLE_INFORMATION SYSTEM_HANDLE_INFORMATION
#define OBJ_INHERIT
Definition: winternl.h:225
BYTE HandleFlags
Definition: winternl.h:3036
USHORT HandleValue
Definition: winternl.h:3037
ULONG OwnerPid
Definition: winternl.h:3034
SYSTEM_HANDLE_ENTRY Handle[1]
Definition: winternl.h:3044
#define HANDLE_FLAG_PROTECT_FROM_CLOSE
Definition: winbase.h:289
#define HANDLE_FLAG_INHERIT
Definition: winbase.h:288
_Out_ PHANDLE EventHandle
Definition: iofuncs.h:857

Referenced by START_TEST().

◆ test_query_handle_ex()

static void test_query_handle_ex ( void  )
static

Definition at line 967 of file info.c.

968{
970 ULONG size, expect_size;
972 unsigned int i;
974 BOOL found, ret;
975
976 event = CreateEventA(NULL, FALSE, FALSE, NULL);
977 ok(event != NULL, "failed to create event, error %lu\n", GetLastError());
980 ok(ret, "got error %lu\n", GetLastError());
981
982 size = 0;
983 status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, sizeof(SYSTEM_HANDLE_INFORMATION_EX), &size);
984 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status);
985 ok(size > sizeof(SYSTEM_HANDLE_INFORMATION_EX), "got size %lu\n", size);
986
988 {
989 info = realloc(info, size);
990 status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
991 }
992 ok(!status, "got %#lx\n", status);
993 expect_size = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles[info->NumberOfHandles]);
994 ok(size == expect_size, "expected size %lu, got %lu\n", expect_size, size);
995 ok(info->NumberOfHandles > 1, "got %Iu handles\n", info->NumberOfHandles);
996
997 found = FALSE;
998 for (i = 0; i < info->NumberOfHandles; ++i)
999 {
1000 if (info->Handles[i].UniqueProcessId == GetCurrentProcessId()
1001 && (HANDLE)info->Handles[i].HandleValue == event)
1002 {
1003 ok(info->Handles[i].HandleAttributes == (OBJ_INHERIT | OBJ_PROTECT_CLOSE),
1004 "got flags %#lx\n", info->Handles[i].HandleAttributes);
1005 ok(info->Handles[i].GrantedAccess == EVENT_ALL_ACCESS, "got access %#lx\n", info->Handles[i].GrantedAccess);
1006 found = TRUE;
1007 }
1008 ok(!info->Handles[i].CreatorBackTraceIndex, "got backtrace index %u\n", info->Handles[i].CreatorBackTraceIndex);
1009 }
1010 ok(found, "event handle not found\n");
1011
1013 ok(ret, "got error %lu\n", GetLastError());
1015
1016 status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
1018 {
1019 info = realloc(info, size);
1020 status = pNtQuerySystemInformation(SystemExtendedHandleInformation, info, size, &size);
1021 }
1022 ok(!status, "got %#lx\n", status);
1023 expect_size = FIELD_OFFSET(SYSTEM_HANDLE_INFORMATION_EX, Handles[info->NumberOfHandles]);
1024 ok(size == expect_size, "expected size %lu, got %lu\n", expect_size, size);
1025 ok(info->NumberOfHandles > 1, "got %Iu handles\n", info->NumberOfHandles);
1026
1027 found = FALSE;
1028 for (i = 0; i < info->NumberOfHandles; ++i)
1029 {
1030 if (info->Handles[i].UniqueProcessId == GetCurrentProcessId()
1031 && (HANDLE)info->Handles[i].HandleValue == event)
1032 {
1033 found = TRUE;
1034 break;
1035 }
1036 }
1037 ok(!found, "event handle found\n");
1038
1039 status = pNtQuerySystemInformation(SystemExtendedHandleInformation, NULL, sizeof(SYSTEM_HANDLE_INFORMATION_EX), &size);
1040 ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status );
1041
1042 free(info);
1043}
#define realloc
Definition: debug_ros.c:6
#define EVENT_ALL_ACCESS
Definition: isotest.c:82
@ SystemExtendedHandleInformation
Definition: extypes.h:281

Referenced by START_TEST().

◆ test_query_interrupt()

static void test_query_interrupt ( void  )
static

Definition at line 1095 of file info.c.

1096{
1099 ULONG NeededLength;
1102
1103 /* Find out the number of processors */
1104 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
1105 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1106 NeededLength = sbi.NumberOfProcessors * sizeof(SYSTEM_INTERRUPT_INFORMATION);
1107
1108 sii = HeapAlloc(GetProcessHeap(), 0, NeededLength);
1109
1110 status = pNtQuerySystemInformation(SystemInterruptInformation, sii, 0, &ReturnLength);
1111 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1112 ok(ReturnLength == NeededLength, "got %lu\n", ReturnLength);
1113
1114 /* Try it for all processors */
1115 status = pNtQuerySystemInformation(SystemInterruptInformation, sii, NeededLength, &ReturnLength);
1116 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1117
1118 /* Windows XP and W2K3 (and others?) always return 0 for the ReturnLength
1119 * No test added for this as it's highly unlikely that an app depends on this
1120 */
1121
1122 HeapFree( GetProcessHeap(), 0, sii);
1123}
@ SystemInterruptInformation
Definition: ntddk_ex.h:34
struct _SYSTEM_INTERRUPT_INFORMATION SYSTEM_INTERRUPT_INFORMATION

Referenced by START_TEST().

◆ test_query_kerndebug()

static void test_query_kerndebug ( void  )
static

Definition at line 1159 of file info.c.

1160{
1163 /* some Windows version expect alignment */
1166
1167 status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, 0, &ReturnLength);
1169
1170 status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi), &ReturnLength);
1172 ok( sizeof(skdi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1173
1174 status = pNtQuerySystemInformation(SystemKernelDebuggerInformation, &skdi, sizeof(skdi) + 2, &ReturnLength);
1176 ok( sizeof(skdi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1177
1178 status = pNtQuerySystemInformation(SystemKernelDebuggerInformationEx, &skdi_ex, 0, &ReturnLength);
1180 || status == STATUS_NOT_IMPLEMENTED /* before win7 */
1181 || status == STATUS_INVALID_INFO_CLASS /* wow64 on Win10 */,
1183
1185 {
1186 win_skip( "NtQuerySystemInformation(SystemKernelDebuggerInformationEx) is not implemented.\n" );
1187 }
1188 else
1189 {
1190 status = pNtQuerySystemInformation(SystemKernelDebuggerInformationEx, &skdi_ex,
1191 sizeof(skdi_ex), &ReturnLength);
1192 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1193 ok( sizeof(skdi_ex) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1194
1195 status = pNtQuerySystemInformation(SystemKernelDebuggerInformationEx, &skdi_ex,
1196 sizeof(skdi_ex) + 2, &ReturnLength);
1197 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1198 ok( sizeof(skdi_ex) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1199 }
1200}
BOOLEAN Expected
#define DECLSPEC_ALIGN(x)
Definition: corecrt.h:141
@ SystemKernelDebuggerInformation
Definition: ntddk_ex.h:46
GLdouble n
Definition: glext.h:7729
if(dx< 0)
Definition: linetemp.h:194
@ SystemKernelDebuggerInformationEx
Definition: extypes.h:379
ActualNumberDriverObjects * sizeof(PDRIVER_OBJECT)) PDRIVER_OBJECT *DriverObjectList

Referenced by START_TEST().

◆ test_query_logicalproc()

static void test_query_logicalproc ( void  )
static

Definition at line 1220 of file info.c.

1221{
1223 ULONG len, i, proc_no;
1226
1227 GetSystemInfo(&si);
1228
1229 status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, NULL, 0, &len);
1230 if (status == STATUS_INVALID_INFO_CLASS) /* wow64 win8+, arm64 */
1231 {
1232 skip("SystemLogicalProcessorInformation is not supported\n");
1233 return;
1234 }
1235 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1236 ok(len%sizeof(*slpi) == 0, "Incorrect length %ld\n", len);
1237
1238 slpi = HeapAlloc(GetProcessHeap(), 0, len);
1239 status = pNtQuerySystemInformation(SystemLogicalProcessorInformation, slpi, len, &len);
1240 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1241
1242 proc_no = 0;
1243 for(i=0; i<len/sizeof(*slpi); i++) {
1244 switch(slpi[i].Relationship) {
1246 /* Get number of logical processors */
1247 for(; slpi[i].ProcessorMask; slpi[i].ProcessorMask /= 2)
1248 proc_no += slpi[i].ProcessorMask%2;
1249 break;
1250 default:
1251 break;
1252 }
1253 }
1254 ok(proc_no > 0, "No processors were found\n");
1255 if(si.dwNumberOfProcessors <= 32)
1256 ok(proc_no == si.dwNumberOfProcessors, "Incorrect number of logical processors: %ld, expected %ld\n",
1257 proc_no, si.dwNumberOfProcessors);
1258
1259 HeapFree(GetProcessHeap(), 0, slpi);
1260}
@ SystemLogicalProcessorInformation
Definition: extypes.h:290
@ RelationProcessorCore
Definition: ketypes.h:82

Referenced by START_TEST().

◆ test_query_logicalprocex()

static void test_query_logicalprocex ( void  )
static

Definition at line 1262 of file info.c.

1263{
1264 static const char * const names[] = { "Core", "NumaNode", "Cache", "Package", "Group", "Die", "NumaNodeEx", "Module" };
1265 SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *infoex, *infoex_public, *infoex_core, *infoex_numa, *infoex_cache,
1266 *infoex_package, *infoex_group, *infoex_die, *infoex_numa_ex,
1267 *infoex_module, *ex;
1268 DWORD relationship, len, len_public, len_core, len_numa, len_cache, len_package, len_group, len_die, len_numa_ex,
1269 len_module, len_union, ret_len;
1270 unsigned int i, j;
1272 BOOL ret;
1273
1274 if (!pNtQuerySystemInformationEx)
1275 return;
1276
1277 len = 0;
1278 relationship = RelationAll;
1279 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len);
1280 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1281 ok(len > 0, "got %lu\n", len);
1282
1283 len_core = 0;
1284 relationship = RelationProcessorCore;
1285 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_core);
1286 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1287 ok(len_core > 0, "got %lu\n", len_core);
1288
1289 len_numa = 0;
1290 relationship = RelationNumaNode;
1291 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_numa);
1292 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1293 ok(len_numa > 0, "got %lu\n", len_numa);
1294
1295 len_cache = 0;
1296 relationship = RelationCache;
1297 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_cache);
1298 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1299 ok(len_cache > 0, "got %lu\n", len_cache);
1300
1301 len_package = 0;
1302 relationship = RelationProcessorPackage;
1303 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_package);
1304 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1305 ok(len_package > 0, "got %lu\n", len_package);
1306
1307 len_group = 0;
1308 relationship = RelationGroup;
1309 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_group);
1310 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got 0x%08lx\n", status);
1311 ok(len_group > 0, "got %lu\n", len_group);
1312
1313 relationship = RelationProcessorDie;
1314 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_die);
1316 "got 0x%08lx\n", status);
1317
1318 len_numa_ex = 0;
1319 relationship = RelationNumaNodeEx;
1320 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_numa_ex);
1322 "got 0x%08lx\n", status);
1323
1324 len_module = 0;
1325 relationship = RelationProcessorModule;
1326 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), NULL, 0, &len_module);
1328 "got 0x%08lx\n", status);
1329
1330 len_public = 0;
1331 ret = pGetLogicalProcessorInformationEx(RelationAll, NULL, &len_public);
1332 ok(!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "got %d, error %ld\n", ret, GetLastError());
1333 ok(len == len_public, "got %lu, expected %lu\n", len_public, len);
1334
1336 infoex_public = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_public);
1337 infoex_core = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_core);
1338 infoex_numa = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_numa);
1339 infoex_cache = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_cache);
1340 infoex_package = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_package);
1341 infoex_group = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_group);
1342 infoex_die = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_die);
1343 infoex_numa_ex = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_numa_ex);
1344 infoex_module = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len_module);
1345
1346 relationship = RelationAll;
1347 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex, len, &ret_len);
1348 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1349 ok(ret_len == len, "got %08lx expected %08lx\n", ret_len, len);
1350
1351 ret = pGetLogicalProcessorInformationEx(RelationAll, infoex_public, &len_public);
1352 ok(ret, "got %d, error %ld\n", ret, GetLastError());
1353 ok(!memcmp(infoex, infoex_public, len), "returned info data mismatch\n");
1354
1355 /* Test for RelationAll. */
1356 for (i = 0; status == STATUS_SUCCESS && i < len; )
1357 {
1358 ex = (void *)(((char *)infoex) + i);
1359 ok(ex->Size, "%u: got size 0\n", i);
1360
1361 if (winetest_debug <= 1)
1362 {
1363 i += ex->Size;
1364 continue;
1365 }
1366
1367 trace("infoex[%u].Size: %lu\n", i, ex->Size);
1368 switch (ex->Relationship)
1369 {
1374 trace("infoex[%u].Relationship: 0x%x (%s)\n", i, ex->Relationship, names[ex->Relationship]);
1375 trace("infoex[%u].Processor.Flags: 0x%x\n", i, ex->Processor.Flags);
1376 trace("infoex[%u].Processor.EfficiencyClass: 0x%x\n", i, ex->Processor.EfficiencyClass);
1377 trace("infoex[%u].Processor.GroupCount: 0x%x\n", i, ex->Processor.GroupCount);
1378 for (j = 0; j < ex->Processor.GroupCount; ++j)
1379 {
1380 trace("infoex[%u].Processor.GroupMask[%u].Mask: 0x%Ix\n", i, j, ex->Processor.GroupMask[j].Mask);
1381 trace("infoex[%u].Processor.GroupMask[%u].Group: 0x%x\n", i, j, ex->Processor.GroupMask[j].Group);
1382 }
1383 break;
1384 case RelationNumaNode:
1385 case RelationNumaNodeEx:
1386 trace("infoex[%u].Relationship: 0x%x (%s)\n", i, ex->Relationship, names[ex->Relationship]);
1387 trace("infoex[%u].NumaNode.NodeNumber: 0x%lx\n", i, ex->NumaNode.NodeNumber);
1388 trace("infoex[%u].NumaNode.GroupMask.Mask: 0x%Ix\n", i, ex->NumaNode.GroupMask.Mask);
1389 trace("infoex[%u].NumaNode.GroupMask.Group: 0x%x\n", i, ex->NumaNode.GroupMask.Group);
1390 break;
1391 case RelationCache:
1392 trace("infoex[%u].Relationship: 0x%x (Cache)\n", i, ex->Relationship);
1393 trace("infoex[%u].Cache.Level: 0x%x\n", i, ex->Cache.Level);
1394 trace("infoex[%u].Cache.Associativity: 0x%x\n", i, ex->Cache.Associativity);
1395 trace("infoex[%u].Cache.LineSize: 0x%x\n", i, ex->Cache.LineSize);
1396 trace("infoex[%u].Cache.CacheSize: 0x%lx\n", i, ex->Cache.CacheSize);
1397 trace("infoex[%u].Cache.Type: 0x%x\n", i, ex->Cache.Type);
1398 trace("infoex[%u].Cache.GroupMask.Mask: 0x%Ix\n", i, ex->Cache.GroupMask.Mask);
1399 trace("infoex[%u].Cache.GroupMask.Group: 0x%x\n", i, ex->Cache.GroupMask.Group);
1400 break;
1401 case RelationGroup:
1402 trace("infoex[%u].Relationship: 0x%x (Group)\n", i, ex->Relationship);
1403 trace("infoex[%u].Group.MaximumGroupCount: 0x%x\n", i, ex->Group.MaximumGroupCount);
1404 trace("infoex[%u].Group.ActiveGroupCount: 0x%x\n", i, ex->Group.ActiveGroupCount);
1405 for (j = 0; j < ex->Group.ActiveGroupCount; ++j)
1406 {
1407 trace("infoex[%u].Group.GroupInfo[%u].MaximumProcessorCount: 0x%x\n", i, j, ex->Group.GroupInfo[j].MaximumProcessorCount);
1408 trace("infoex[%u].Group.GroupInfo[%u].ActiveProcessorCount: 0x%x\n", i, j, ex->Group.GroupInfo[j].ActiveProcessorCount);
1409 trace("infoex[%u].Group.GroupInfo[%u].ActiveProcessorMask: 0x%Ix\n", i, j, ex->Group.GroupInfo[j].ActiveProcessorMask);
1410 }
1411 break;
1412 default:
1413 ok(0, "Got invalid relationship value: 0x%x\n", ex->Relationship);
1414 break;
1415 }
1416
1417 i += ex->Size;
1418 }
1419
1420 /* Test Relationship filtering. */
1421
1422 relationship = RelationProcessorCore;
1423 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_core, len_core, &len_core);
1424 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1425
1426 for (i = 0; status == STATUS_SUCCESS && i < len_core;)
1427 {
1428 ex = (void *)(((char*)infoex_core) + i);
1429 ok(ex->Size, "%u: got size 0\n", i);
1430 ok(ex->Relationship == RelationProcessorCore, "%u: got relationship %#x\n", i, ex->Relationship);
1431 i += ex->Size;
1432 }
1433
1434 relationship = RelationNumaNode;
1435 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_numa, len_numa, &len_numa);
1436 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1437
1438 for (i = 0; status == STATUS_SUCCESS && i < len_numa;)
1439 {
1440 ex = (void *)(((char*)infoex_numa) + i);
1441 ok(ex->Size, "%u: got size 0\n", i);
1442 ok(ex->Relationship == RelationNumaNode, "%u: got relationship %#x\n", i, ex->Relationship);
1443 i += ex->Size;
1444 }
1445
1446 relationship = RelationCache;
1447 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_cache, len_cache, &len_cache);
1448 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1449
1450 for (i = 0; status == STATUS_SUCCESS && i < len_cache;)
1451 {
1452 ex = (void *)(((char*)infoex_cache) + i);
1453 ok(ex->Size, "%u: got size 0\n", i);
1454 ok(ex->Relationship == RelationCache, "%u: got relationship %#x\n", i, ex->Relationship);
1455 i += ex->Size;
1456 }
1457
1458 relationship = RelationProcessorPackage;
1459 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_package, len_package, &len_package);
1460 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1461
1462 for (i = 0; status == STATUS_SUCCESS && i < len_package;)
1463 {
1464 ex = (void *)(((char*)infoex_package) + i);
1465 ok(ex->Size, "%u: got size 0\n", i);
1466 ok(ex->Relationship == RelationProcessorPackage, "%u: got relationship %#x\n", i, ex->Relationship);
1467 i += ex->Size;
1468 }
1469
1470 relationship = RelationGroup;
1471 status = pNtQuerySystemInformationEx(SystemLogicalProcessorInformationEx, &relationship, sizeof(relationship), infoex_group, len_group, &len_group);
1472 ok(status == STATUS_SUCCESS, "got 0x%08lx\n", status);
1473
1474 for (i = 0; status == STATUS_SUCCESS && i < len_group;)
1475 {
1476 ex = (void *)(((char *)infoex_group) + i);
1477 ok(ex->Size, "%u: got size 0\n", i);
1478 ok(ex->Relationship == RelationGroup, "%u: got relationship %#x\n", i, ex->Relationship);
1479 i += ex->Size;
1480 }
1481
1482 len_union = len_core + len_numa + len_cache + len_package + len_group + len_module;
1483 ok(len == len_union, "Expected %lu, got %lu\n", len, len_union);
1484
1485 HeapFree(GetProcessHeap(), 0, infoex);
1486 HeapFree(GetProcessHeap(), 0, infoex_public);
1487 HeapFree(GetProcessHeap(), 0, infoex_core);
1488 HeapFree(GetProcessHeap(), 0, infoex_numa);
1489 HeapFree(GetProcessHeap(), 0, infoex_cache);
1490 HeapFree(GetProcessHeap(), 0, infoex_package);
1491 HeapFree(GetProcessHeap(), 0, infoex_group);
1492 HeapFree(GetProcessHeap(), 0, infoex_die);
1493 HeapFree(GetProcessHeap(), 0, infoex_numa_ex);
1494 HeapFree(GetProcessHeap(), 0, infoex_module);
1495}
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
GLuint GLuint * names
Definition: glext.h:11545
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
static JOBOBJECTINFOCLASS LPVOID DWORD LPDWORD ret_len
Definition: process.c:81
Definition: comerr.c:44
@ SystemLogicalProcessorInformationEx
Definition: winternl.h:2122
@ RelationProcessorModule
Definition: ketypes.h:89
@ RelationNumaNode
Definition: ketypes.h:83
@ RelationNumaNodeEx
Definition: ketypes.h:88
@ RelationCache
Definition: ketypes.h:84
@ RelationGroup
Definition: ketypes.h:86
@ RelationProcessorDie
Definition: ketypes.h:87
@ RelationProcessorPackage
Definition: ketypes.h:85
@ RelationAll
Definition: ketypes.h:90

Referenced by START_TEST().

◆ test_query_module()

static void test_query_module ( void  )
static

Definition at line 817 of file info.c.

818{
822 ULONG size, i;
823 char *buffer;
824
825 status = pNtQuerySystemInformation(SystemModuleInformation, NULL, 0, &size);
826 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status);
827 ok(size > 0, "expected nonzero size\n");
828
829 info = malloc(size);
830 status = pNtQuerySystemInformation(SystemModuleInformation, info, size, &size);
831 ok(!status, "got %#lx\n", status);
832
833 ok(info->ModulesCount > 0, "Expected some modules to be loaded\n");
834
835 for (i = 0; i < info->ModulesCount; i++)
836 {
838
839 ok(module->LoadOrderIndex == i, "%lu: got index %u\n", i, module->LoadOrderIndex);
840 ok(module->ImageBaseAddress || is_wow64, "%lu: got NULL address for %s\n", i, module->Name);
841 ok(module->ImageSize, "%lu: got 0 size\n", i);
842 ok(module->LoadCount, "%lu: got 0 load count\n", i);
843 }
844
845 free(info);
846
847 status = pNtQuerySystemInformation(SystemModuleInformationEx, NULL, 0, &size);
849 {
850 win_skip("SystemModuleInformationEx is not supported.\n");
851 return;
852 }
853 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx\n", status);
854 ok(size > 0, "expected nonzero size\n");
855
856 buffer = malloc(size);
857 status = pNtQuerySystemInformation(SystemModuleInformationEx, buffer, size, &size);
858 ok(!status, "got %#lx\n", status);
859
860 infoex = (const void *)buffer;
861 for (i = 0; infoex->NextOffset; i++)
862 {
864
865 ok(module->LoadOrderIndex == i, "%lu: got index %u\n", i, module->LoadOrderIndex);
866 ok(module->ImageBaseAddress || is_wow64, "%lu: got NULL address for %s\n", i, module->Name);
867 ok(module->ImageSize, "%lu: got 0 size\n", i);
868 ok(module->LoadCount, "%lu: got 0 load count\n", i);
869
870 infoex = (const void *)((const char *)infoex + infoex->NextOffset);
871 }
872 ok(((char *)infoex - buffer) + sizeof(infoex->NextOffset) == size,
873 "got size %lu, null terminator %Iu\n", size, (char *)infoex - buffer);
874
875 free(buffer);
876
877}
@ SystemModuleInformation
Definition: ntddk_ex.h:22
@ SystemModuleInformationEx
Definition: extypes.h:296
RTL_PROCESS_MODULE_INFORMATION BaseInfo
Definition: rtltypes.h:1018

Referenced by START_TEST().

◆ test_query_performance()

static void test_query_performance ( void  )
static

Definition at line 446 of file info.c.

447{
452
453 status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, 0, &ReturnLength);
454 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
455
456 status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size, &ReturnLength);
458 {
459 /* size is larger on wow64 under w2k8/win7 */
460 size += 16;
461 status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size, &ReturnLength);
462 }
463 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
464 ok( ReturnLength == size, "Inconsistent length %ld\n", ReturnLength);
465
466 status = pNtQuerySystemInformation(SystemPerformanceInformation, buffer, size + 2, &ReturnLength);
467 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
468 ok( ReturnLength == size || ReturnLength == size + 2 /* win8+ */,
469 "Inconsistent length %ld\n", ReturnLength);
470
471 /* Not return values yet, as struct members are unknown */
472}
#define SystemPerformanceInformation
Definition: memtest.h:87
struct _SYSTEM_PERFORMANCE_INFORMATION SYSTEM_PERFORMANCE_INFORMATION
uint64_t ULONGLONG
Definition: typedefs.h:67

Referenced by START_TEST().

◆ test_query_process()

static void test_query_process ( BOOL  extended)
static

Definition at line 519 of file info.c.

520{
522 DWORD last_pid;
524 int i = 0, k = 0;
530
531 /* Copy of our winternl.h structure turned into a private one */
532 typedef struct _SYSTEM_PROCESS_INFORMATION_PRIVATE {
533 ULONG NextEntryOffset;
534 DWORD dwThreadCount;
535 LARGE_INTEGER WorkingSetPrivateSize;
536 ULONG HardFaultCount;
537 ULONG NumberOfThreadsHighWatermark;
539 FILETIME ftCreationTime;
540 FILETIME ftUserTime;
541 FILETIME ftKernelTime;
542 UNICODE_STRING ProcessName;
543 DWORD dwBasePriority;
544 HANDLE UniqueProcessId;
545 HANDLE ParentProcessId;
548 ULONG_PTR UniqueProcessKey;
549 VM_COUNTERS_EX vmCounters;
550 IO_COUNTERS ioCounters;
552 } SYSTEM_PROCESS_INFORMATION_PRIVATE;
553
554 BOOL is_process_wow64 = FALSE, current_process_found = FALSE;
555 SYSTEM_PROCESS_INFORMATION_PRIVATE *spi, *spi_buf;
558 void *expected_address;
559 ULONG thread_info_size;
560
561 if (extended)
562 {
564 thread_info_size = sizeof(SYSTEM_EXTENDED_THREAD_INFORMATION);
565 }
566 else
567 {
569 thread_info_size = sizeof(SYSTEM_THREAD_INFORMATION);
570 }
571
572 /* test ReturnLength */
573 ReturnLength = 0;
574 status = pNtQuerySystemInformation( info_class, NULL, 0, &ReturnLength);
575 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH got %08lx\n", status);
576 ok( ReturnLength > 0, "got 0 length\n" );
577
578 /* W2K3 and later returns the needed length, the rest returns 0. */
579 if (!ReturnLength)
580 {
581 win_skip( "Zero return length, skipping tests." );
582 return;
583 }
584
585 winetest_push_context( "extended %d", extended );
586
587 spi_buf = HeapAlloc(GetProcessHeap(), 0, ReturnLength);
588 status = pNtQuerySystemInformation(info_class, spi_buf, ReturnLength, &ReturnLength);
589
590 /* Sometimes new process or threads appear between the call and increase the size,
591 * otherwise the previously returned buffer size should be sufficient. */
593 "Expected STATUS_SUCCESS, got %08lx\n", status );
594
595 spi = spi_buf;
596
597 for (;;)
598 {
600 DWORD j;
601
602 winetest_push_context( "i %u (%s)", i, debugstr_w(spi->ProcessName.Buffer) );
603
604 i++;
605
606 last_pid = (DWORD_PTR)spi->UniqueProcessId;
607 ok( !(last_pid & 3), "Unexpected PID low bits: %p\n", spi->UniqueProcessId );
608
609 if (last_pid == GetCurrentProcessId())
610 current_process_found = TRUE;
611
612 if (extended && is_wow64 && spi->UniqueProcessId)
613 {
615 cid.UniqueProcess = spi->UniqueProcessId;
616 cid.UniqueThread = 0;
619 "Got unexpected status %#lx, pid %p.\n", status, spi->UniqueProcessId );
620
621 if (!status)
622 {
624
626 ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
627 is_process_wow64 = !!info;
628 NtClose( handle );
629 }
630 }
631
632 for (j = 0; j < spi->dwThreadCount; j++)
633 {
634 ti = (SYSTEM_EXTENDED_THREAD_INFORMATION *)((BYTE *)spi->ti + j * thread_info_size);
635
636 k++;
637 ok ( ti->ThreadInfo.ClientId.UniqueProcess == spi->UniqueProcessId,
638 "The owning pid of the thread (%p) doesn't equal the pid (%p) of the process\n",
639 ti->ThreadInfo.ClientId.UniqueProcess, spi->UniqueProcessId );
640
642 ok( !(tid & 3), "Unexpected TID low bits: %p\n", ti->ThreadInfo.ClientId.UniqueThread );
643
644 if (extended)
645 {
646 todo_wine ok( !!ti->StackBase, "Got NULL StackBase.\n" );
647 todo_wine ok( !!ti->StackLimit, "Got NULL StackLimit.\n" );
648#ifdef __REACTOS__
649 if ((GetNTVersion() >= _WIN32_WINNT_VISTA) && !is_reactos()) // Broken on Win 2003
650#endif
651 ok( !!ti->Win32StartAddress, "Got NULL Win32StartAddress.\n" );
652
653 cid.UniqueProcess = 0;
654 cid.UniqueThread = ti->ThreadInfo.ClientId.UniqueThread;
655
658 if (!status)
659 {
661
662 status = pNtQueryInformationThread( handle, ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
663 ok( status == STATUS_SUCCESS, "Got unexpected status %#lx.\n", status );
664 expected_address = tbi.TebBaseAddress;
665 if (is_wow64 && is_process_wow64)
666 expected_address = (BYTE *)expected_address - 0x2000;
667#ifdef __REACTOS__
668 if ((GetNTVersion() < _WIN32_WINNT_VISTA) && !is_reactos()) // Broken on Win 2003
669 expected_address = NULL;
670#endif
671 if (!is_wow64 && !is_process_wow64 && !tbi.TebBaseAddress)
672 win_skip( "Could not get TebBaseAddress, thread %lu.\n", j );
673 else
674 ok( ti->TebBase == expected_address || (is_wow64 && !expected_address && !!ti->TebBase),
675 "Got unexpected TebBase %p, expected %p.\n", ti->TebBase, expected_address );
676
677 NtClose( handle );
678 }
679 }
680 }
681
682 if (!spi->NextEntryOffset)
683 {
685 break;
686 }
687 one_before_last_pid = last_pid;
688
689 spi = (SYSTEM_PROCESS_INFORMATION_PRIVATE*)((char*)spi + spi->NextEntryOffset);
691 }
692 ok( current_process_found, "Test process not found.\n" );
693 if (winetest_debug > 1) trace("%u processes, %u threads\n", i, k);
694
695 if (one_before_last_pid == 0) one_before_last_pid = last_pid;
696
697 HeapFree( GetProcessHeap(), 0, spi_buf);
698
699#ifdef __REACTOS__
701 {
702 win_skip("Skipping ClientId tests on pre-NT6.\n");
703 }
704 else
705 {
706#endif
707 for (i = 1; i < 4; ++i)
708 {
710 cid.UniqueProcess = ULongToHandle(GetCurrentProcessId() + i);
711 cid.UniqueThread = 0;
712
714 ok( status == STATUS_SUCCESS || broken( status == STATUS_ACCESS_DENIED ) /* wxppro */,
715 "NtOpenProcess returned:%lx\n", status );
716 if (status != STATUS_SUCCESS) continue;
717
719 ok( status == STATUS_SUCCESS, "NtQueryInformationProcess returned:%lx\n", status );
720 ok( pbi.UniqueProcessId == GetCurrentProcessId(),
721 "Expected pid %p, got %p\n", ULongToHandle(GetCurrentProcessId()), ULongToHandle(pbi.UniqueProcessId) );
722
723 NtClose( handle );
724 }
725
726 for (i = 1; i < 4; ++i)
727 {
729 cid.UniqueProcess = 0;
730 cid.UniqueThread = ULongToHandle(GetCurrentThreadId() + i);
731
733 ok( status == STATUS_SUCCESS || broken( status == STATUS_ACCESS_DENIED ) /* wxppro */,
734 "NtOpenThread returned:%lx\n", status );
735 if (status != STATUS_SUCCESS) continue;
736
737 status = pNtQueryInformationThread( handle, ThreadBasicInformation, &tbi, sizeof(tbi), NULL );
738 ok( status == STATUS_SUCCESS, "NtQueryInformationThread returned:%lx\n", status );
740 "Expected tid %p, got %p\n", ULongToHandle(GetCurrentThreadId()), tbi.ClientId.UniqueThread );
741
742 NtClose( handle );
743 }
744#ifdef __REACTOS__
745 }
746#endif
748}
#define ULongToHandle(h)
Definition: basetsd.h:75
@ ProcessWow64Information
Definition: cicbase.cpp:65
ULONG SessionId
Definition: dllmain.c:28
@ SystemProcessInformation
Definition: ntddk_ex.h:16
enum _SYSTEM_INFORMATION_CLASS SYSTEM_INFORMATION_CLASS
#define THREAD_QUERY_INFORMATION
Definition: pstypes.h:145
static TfClientId tid
static TfClientId cid
#define THREAD_QUERY_LIMITED_INFORMATION
Definition: security.c:106
static DWORD one_before_last_pid
Definition: info.c:71
int k
Definition: mpi.c:3369
struct _SYSTEM_THREAD_INFORMATION SYSTEM_THREAD_INFORMATION
@ SystemExtendedProcessInformation
Definition: extypes.h:274
static void ULONG *static PIO_STATUS_BLOCK void ULONG FS_INFORMATION_CLASS info_class
Definition: pipe.c:102
NTSTATUS NTAPI NtOpenProcess(OUT PHANDLE ProcessHandle, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, IN PCLIENT_ID ClientId)
Definition: process.c:1440
HANDLE UniqueThread
Definition: compat.h:826
HANDLE UniqueProcess
Definition: compat.h:825
SYSTEM_THREAD_INFORMATION ThreadInfo
Definition: winternl.h:2547
ULONG CycleTime
Definition: svw_pata.c:43
static ULONG HandleCount
Definition: uefidisk.c:67
DWORD WINAPI GetCurrentThreadId(void)
Definition: thread.c:459
struct _SYSTEM_EXTENDED_THREAD_INFORMATION SYSTEM_EXTENDED_THREAD_INFORMATION

Referenced by START_TEST().

◆ test_query_process_basic()

static void test_query_process_basic ( void  )
static

Definition at line 1836 of file info.c.

1837{
1840
1841 typedef struct _PROCESS_BASIC_INFORMATION_PRIVATE {
1843 PPEB PebBaseAddress;
1844 DWORD_PTR AffinityMask;
1845 DWORD_PTR BasePriority;
1846 ULONG_PTR UniqueProcessId;
1847 ULONG_PTR InheritedFromUniqueProcessId;
1849
1851
1852 /* This test also covers some basic parameter testing that should be the same for
1853 * every information class
1854 */
1855
1858 "Expected STATUS_INVALID_INFO_CLASS or STATUS_NOT_IMPLEMENTED, got %08lx\n", status);
1859
1861 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1862
1865 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08lx\n", status);
1866
1868 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
1869
1871 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1872
1874 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1875
1877 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1878 ok( sizeof(pbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1879
1881 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1882 ok( sizeof(pbi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1883
1884 if (winetest_debug > 1) trace("ProcessID : %Ix\n", pbi.UniqueProcessId);
1885 ok( pbi.UniqueProcessId > 0, "Expected a ProcessID > 0, got 0\n");
1886}
_In_ NTSTATUS ExitStatus
Definition: psfuncs.h:868

Referenced by START_TEST().

◆ test_query_process_debug_flags()

static void test_query_process_debug_flags ( int  argc,
char **  argv 
)
static

Definition at line 2580 of file info.c.

2581{
2582 static const DWORD test_flags[] = { DEBUG_PROCESS,
2586 DWORD debug_flags = 0xdeadbeef;
2587 char cmdline[MAX_PATH];
2589 STARTUPINFOA si = { 0 };
2591 DEBUG_EVENT ev;
2592 DWORD result;
2593 BOOL ret;
2594 int i, j;
2595
2596 /* test invalid arguments */
2599 "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2600
2603 "Expected STATUS_INVALID_HANDLE, got %#lx.\n", status);
2604
2606 NULL, sizeof(debug_flags), NULL);
2607 ok(status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %#lx.\n", status);
2608
2610 &debug_flags, sizeof(debug_flags), NULL);
2612 "Expected STATUS_INVALID_HANDLE, got %#lx.\n", status);
2613
2615 &debug_flags, sizeof(debug_flags) - 1, NULL);
2616 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2617
2619 &debug_flags, sizeof(debug_flags) + 1, NULL);
2620 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2621
2622 /* test ProcessDebugFlags of current process */
2624 &debug_flags, sizeof(debug_flags), NULL);
2625 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2626 ok(debug_flags == TRUE, "Expected flag TRUE, got %lx.\n", debug_flags);
2627
2628 for (i = 0; i < ARRAY_SIZE(test_flags); i++)
2629 {
2630 DWORD expected_flags = !(test_flags[i] & DEBUG_ONLY_THIS_PROCESS);
2631 sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
2632
2633 si.cb = sizeof(si);
2634 ret = CreateProcessA(NULL, cmdline, NULL, NULL, FALSE, test_flags[i], NULL, NULL, &si, &pi);
2635 ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
2636
2637 if (!(test_flags[i] & (DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS)))
2638 {
2639 /* test ProcessDebugFlags before attaching with debugger */
2641 &debug_flags, sizeof(debug_flags), NULL);
2642 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2643 ok(debug_flags == TRUE, "Expected flag TRUE, got %lx.\n", debug_flags);
2644
2646 ok(ret, "DebugActiveProcess failed, last error %#lx.\n", GetLastError());
2647 expected_flags = FALSE;
2648 }
2649
2650 /* test ProcessDebugFlags after attaching with debugger */
2652 &debug_flags, sizeof(debug_flags), NULL);
2653 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2654 ok(debug_flags == expected_flags, "Expected flag %lx, got %lx.\n", expected_flags, debug_flags);
2655
2656 if (!(test_flags[i] & CREATE_SUSPENDED))
2657 {
2658 /* Continue a couple of times to make sure the process is fully initialized,
2659 * otherwise Windows XP deadlocks in the following DebugActiveProcess(). */
2660 for (;;)
2661 {
2662 ret = WaitForDebugEvent(&ev, 1000);
2663 ok(ret, "WaitForDebugEvent failed, last error %#lx.\n", GetLastError());
2664 if (!ret) break;
2665
2666 if (ev.dwDebugEventCode == LOAD_DLL_DEBUG_EVENT) break;
2667
2669 ok(ret, "ContinueDebugEvent failed, last error %#lx.\n", GetLastError());
2670 if (!ret) break;
2671 }
2672
2674 ok(result == 0, "Expected 0, got %lu.\n", result);
2675 }
2676
2678 ok(ret, "DebugActiveProcessStop failed, last error %#lx.\n", GetLastError());
2679
2680 /* test ProcessDebugFlags after detaching debugger */
2682 &debug_flags, sizeof(debug_flags), NULL);
2683 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2684 ok(debug_flags == expected_flags, "Expected flag %lx, got %lx.\n", expected_flags, debug_flags);
2685
2687 ok(ret, "DebugActiveProcess failed, last error %#lx.\n", GetLastError());
2688
2689 /* test ProcessDebugFlags after re-attaching debugger */
2691 &debug_flags, sizeof(debug_flags), NULL);
2692 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2693 ok(debug_flags == FALSE, "Expected flag FALSE, got %lx.\n", debug_flags);
2694
2696 todo_wine ok(result == 2, "Expected 2, got %lu.\n", result);
2697
2698 /* Wait until the process is terminated. On Windows XP the process randomly
2699 * gets stuck in a non-continuable exception, so stop after 100 iterations.
2700 * On Windows 2003, the debugged process disappears (or stops?) without
2701 * any EXIT_PROCESS_DEBUG_EVENT after a couple of events. */
2702 for (j = 0; j < 100; j++)
2703 {
2704 ret = WaitForDebugEvent(&ev, 1000);
2706 "WaitForDebugEvent failed, last error %#lx.\n", GetLastError());
2707 if (!ret) break;
2708
2710
2712 ok(ret, "ContinueDebugEvent failed, last error %#lx.\n", GetLastError());
2713 if (!ret) break;
2714 }
2715 ok(j < 100 || broken(j >= 100) /* Win XP */, "Expected less than 100 debug events.\n");
2716
2717 /* test ProcessDebugFlags after process has terminated */
2719 &debug_flags, sizeof(debug_flags), NULL);
2720 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2721 ok(debug_flags == FALSE, "Expected flag FALSE, got %lx.\n", debug_flags);
2722
2724 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2726 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2727 }
2728}
#define ARRAY_SIZE(A)
Definition: main.h:20
BOOL WINAPI DebugActiveProcessStop(IN DWORD dwProcessId)
Definition: debugger.c:486
BOOL WINAPI DebugActiveProcess(IN DWORD dwProcessId)
Definition: debugger.c:445
DWORD WINAPI SuspendThread(IN HANDLE hThread)
Definition: thread.c:642
GLuint64EXT * result
Definition: glext.h:11304
#define LOAD_DLL_DEBUG_EVENT
Definition: minwinbase.h:38
#define DEBUG_ONLY_THIS_PROCESS
Definition: winbase.h:181
#define ERROR_SEM_TIMEOUT
Definition: winerror.h:315

Referenced by START_TEST().

◆ test_query_process_debug_object_handle()

static void test_query_process_debug_object_handle ( int  argc,
char **  argv 
)
static

Definition at line 2473 of file info.c.

2474{
2475 char cmdline[MAX_PATH];
2476 STARTUPINFOA si = {0};
2478 BOOL ret;
2479 HANDLE debug_object;
2481 ULONG len;
2482
2483 sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
2484
2485 si.cb = sizeof(si);
2487 NULL, &si, &pi);
2488 ok(ret, "CreateProcess failed with last error %lu\n", GetLastError());
2489 if (!ret) return;
2490
2491 len = 0xdeadbeef;
2494 "Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08lx\n",
2495 status);
2496 ok(len == 0xdeadbeef || broken(len == 0xfffffffc || len == 0xffc), /* wow64 */
2497 "len set to %lx\n", len );
2498
2499 len = 0xdeadbeef;
2502 status == STATUS_ACCESS_VIOLATION, /* XP */
2503 "Expected NtQueryInformationProcess to return STATUS_INVALID_HANDLE, got 0x%08lx\n", status);
2504 ok(len == 0xdeadbeef || broken(len == 0xfffffffc || len == 0xffc), /* wow64 */
2505 "len set to %lx\n", len );
2506
2508 ProcessDebugObjectHandle, NULL, sizeof(debug_object), &len);
2510 "Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08lx\n", status);
2511 ok(len == 0xdeadbeef || broken(len == 0xfffffffc || len == 0xffc), /* wow64 */
2512 "len set to %lx\n", len );
2513
2515 &debug_object, sizeof(debug_object), NULL);
2517 "Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08lx\n", status);
2518
2519 len = 0xdeadbeef;
2521 ProcessDebugObjectHandle, &debug_object, sizeof(debug_object) - 1, &len);
2523 "Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08lx\n", status);
2524 ok(len == 0xdeadbeef || broken(len == 0xfffffffc || len == 0xffc), /* wow64 */
2525 "len set to %lx\n", len );
2526
2527 len = 0xdeadbeef;
2529 ProcessDebugObjectHandle, &debug_object, sizeof(debug_object) + 1, &len);
2531 "Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08lx\n", status);
2532 ok(len == 0xdeadbeef || broken(len == 0xfffffffc || len == 0xffc), /* wow64 */
2533 "len set to %lx\n", len );
2534
2535 len = 0xdeadbeef;
2536 debug_object = (HANDLE)0xdeadbeef;
2538 ProcessDebugObjectHandle, &debug_object,
2539 sizeof(debug_object), &len);
2541 "Expected NtQueryInformationProcess to return STATUS_PORT_NOT_SET, got 0x%08lx\n", status);
2542 ok(debug_object == NULL ||
2543 broken(debug_object == (HANDLE)0xdeadbeef), /* Wow64 */
2544 "Expected debug object handle to be NULL, got %p\n", debug_object);
2545 ok(len == sizeof(debug_object), "len set to %lx\n", len );
2546
2547 len = 0xdeadbeef;
2548 debug_object = (HANDLE)0xdeadbeef;
2550 &debug_object, sizeof(debug_object), &len);
2552 "Expected NtQueryInformationProcess to return STATUS_SUCCESS, got 0x%08lx\n", status);
2553 ok(debug_object != NULL,
2554 "Expected debug object handle to be non-NULL, got %p\n", debug_object);
2555 ok(len == sizeof(debug_object), "len set to %lx\n", len );
2556 status = NtClose( debug_object );
2557 ok( !status, "NtClose failed %lx\n", status );
2558
2559 for (;;)
2560 {
2561 DEBUG_EVENT ev;
2562
2564 ok(ret, "WaitForDebugEvent failed with last error %lu\n", GetLastError());
2565 if (!ret) break;
2566
2568
2570 ok(ret, "ContinueDebugEvent failed with last error %lu\n", GetLastError());
2571 if (!ret) break;
2572 }
2573
2575 ok(ret, "CloseHandle failed with last error %lu\n", GetLastError());
2577 ok(ret, "CloseHandle failed with last error %lu\n", GetLastError());
2578}
#define STATUS_PORT_NOT_SET
Definition: ntstatus.h:1022

Referenced by START_TEST().

◆ test_query_process_debug_port()

static void test_query_process_debug_port ( int  argc,
char **  argv 
)
static

Definition at line 2097 of file info.c.

2098{
2099 DWORD_PTR debug_port = 0xdeadbeef;
2100 char cmdline[MAX_PATH];
2102 STARTUPINFOA si = { 0 };
2104 BOOL ret;
2105 ULONG len;
2106
2107 sprintf(cmdline, "%s %s %s", argv[0], argv[1], "debuggee");
2108
2109 si.cb = sizeof(si);
2111 ok(ret, "CreateProcess failed, last error %#lx.\n", GetLastError());
2112 if (!ret) return;
2113
2115 NULL, 0, NULL);
2116 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2117
2119 NULL, sizeof(debug_port), NULL);
2120 ok(status == STATUS_INVALID_HANDLE || status == STATUS_ACCESS_VIOLATION /* XP */, "got %#lx\n", status);
2121
2123 NULL, sizeof(debug_port), NULL);
2124 ok(status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %#lx.\n", status);
2125
2126 len = 0xdeadbeef;
2128 &debug_port, sizeof(debug_port), &len);
2129 ok(status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %#lx.\n", status);
2130 ok(len == 0xdeadbeef || broken(len != sizeof(debug_port)), /* wow64 */
2131 "len set to %lx\n", len );
2132
2133 len = 0xdeadbeef;
2135 &debug_port, sizeof(debug_port) - 1, &len);
2136 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2137 ok(len == 0xdeadbeef || broken(len != sizeof(debug_port)), /* wow64 */
2138 "len set to %lx\n", len );
2139
2140 len = 0xdeadbeef;
2142 &debug_port, sizeof(debug_port) + 1, &len);
2143 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %#lx.\n", status);
2144 ok(len == 0xdeadbeef || broken(len != sizeof(debug_port)), /* wow64 */
2145 "len set to %lx\n", len );
2146
2147 len = 0xdeadbeef;
2149 &debug_port, sizeof(debug_port), &len);
2150 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2151 ok(debug_port == 0, "Expected port 0, got %#Ix.\n", debug_port);
2152 ok(len == sizeof(debug_port), "len set to %lx\n", len );
2153
2154 len = 0xdeadbeef;
2156 &debug_port, sizeof(debug_port), &len);
2157 ok(!status, "NtQueryInformationProcess failed, status %#lx.\n", status);
2158 ok(debug_port == ~(DWORD_PTR)0, "Expected port %#Ix, got %#Ix.\n", ~(DWORD_PTR)0, debug_port);
2159 ok(len == sizeof(debug_port), "len set to %lx\n", len );
2160
2161 for (;;)
2162 {
2163 DEBUG_EVENT ev;
2164
2166 ok(ret, "WaitForDebugEvent failed, last error %#lx.\n", GetLastError());
2167 if (!ret) break;
2168
2170
2172 ok(ret, "ContinueDebugEvent failed, last error %#lx.\n", GetLastError());
2173 if (!ret) break;
2174 }
2175
2177 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2179 ok(ret, "CloseHandle failed, last error %#lx.\n", GetLastError());
2180}

Referenced by START_TEST().

◆ test_query_process_debug_port_custom_dacl()

static void test_query_process_debug_port_custom_dacl ( int  argc,
char **  argv 
)
static

Definition at line 2267 of file info.c.

2268{
2269 static const ACCESS_MASK all_access_masks[] = {
2273 };
2274 TOKEN_OWNER *owner;
2275 int i;
2276
2277 if (!pDbgUiSetThreadDebugObject)
2278 {
2279 win_skip("DbgUiGetThreadDebugObject not found\n");
2280 return;
2281 }
2282
2283 if (!pDbgUiGetThreadDebugObject)
2284 {
2285 win_skip("DbgUiSetThreadDebugObject not found\n");
2286 return;
2287 }
2288
2289 owner = get_current_owner();
2290
2291 for (i = 0; i < ARRAY_SIZE(all_access_masks); i++)
2292 {
2293 ACCESS_MASK access = all_access_masks[i];
2294
2295 winetest_push_context("debug object access %08lx", access);
2298 }
2299
2300 HeapFree(GetProcessHeap(), 0, owner);
2301}
static TOKEN_OWNER * get_current_owner(void)
Definition: info.c:2244
static void subtest_query_process_debug_port_custom_dacl(int argc, char **argv, ACCESS_MASK access, PSID sid)
Definition: info.c:2182
#define SYNCHRONIZE
Definition: nt_native.h:61
#define GENERIC_ALL
Definition: nt_native.h:92
PSID Owner
Definition: setypes.h:1040

Referenced by START_TEST().

◆ test_query_process_handlecount()

static void test_query_process_handlecount ( void  )
static

Definition at line 2337 of file info.c.

2338{
2341 DWORD handlecount;
2342 BYTE buffer[2 * sizeof(DWORD)];
2344
2347 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08lx\n", status);
2348
2349 status = NtQueryInformationProcess(NULL, ProcessHandleCount, &handlecount, sizeof(handlecount), NULL);
2350 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2351
2353 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2354
2356 if (!process)
2357 {
2358 trace("Could not open process with ID : %ld, error : %lu. Going to use current one.\n", one_before_last_pid, GetLastError());
2360 }
2361 else
2362 if (winetest_debug > 1) trace("ProcessHandleCount for process with ID : %ld\n", one_before_last_pid);
2363
2364 status = NtQueryInformationProcess( process, ProcessHandleCount, &handlecount, sizeof(handlecount), &ReturnLength);
2365 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2366 ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
2368
2371 "Expected STATUS_INFO_LENGTH_MISMATCH or STATUS_SUCCESS, got %08lx\n", status);
2372 ok( sizeof(handlecount) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
2373
2374 /* Check if we have some return values */
2375 if (winetest_debug > 1) trace("HandleCount : %ld\n", handlecount);
2376 todo_wine
2377 {
2378 ok( handlecount > 0, "Expected some handles, got 0\n");
2379 }
2380}
#define PROCESS_QUERY_INFORMATION
Definition: pstypes.h:162
#define DWORD
Definition: nt_native.h:44
@ ProcessHandleCount
Definition: winternl.h:1902

Referenced by START_TEST().

◆ test_query_process_image_file_name()

static void test_query_process_image_file_name ( void  )
static

Definition at line 2382 of file info.c.

2383{
2384 static const WCHAR deviceW[] = {'\\','D','e','v','i','c','e','\\'};
2387 UNICODE_STRING image_file_name;
2389
2390 status = NtQueryInformationProcess(NULL, ProcessImageFileName, &image_file_name, sizeof(image_file_name), NULL);
2391 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2392
2394 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2395
2396 status = NtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileName, &image_file_name, sizeof(image_file_name), &ReturnLength);
2397 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2398
2401 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2402 todo_wine
2403 ok(!memcmp(buffer->Buffer, deviceW, sizeof(deviceW)),
2404 "Expected image name to begin with \\Device\\, got %s\n",
2405 wine_dbgstr_wn(buffer->Buffer, buffer->Length / sizeof(WCHAR)));
2406 free(buffer);
2407
2408 status = NtQueryInformationProcess(NULL, ProcessImageFileNameWin32, &image_file_name, sizeof(image_file_name), NULL);
2410 {
2411 win_skip("ProcessImageFileNameWin32 is not supported\n");
2412 return;
2413 }
2414 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2415
2417 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2418
2419 status = NtQueryInformationProcess( GetCurrentProcess(), ProcessImageFileNameWin32, &image_file_name, sizeof(image_file_name), &ReturnLength);
2420 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2421
2424 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2425 ok(memcmp(buffer->Buffer, deviceW, sizeof(deviceW)),
2426 "Expected image name not to begin with \\Device\\, got %s\n",
2427 wine_dbgstr_wn(buffer->Buffer, buffer->Length / sizeof(WCHAR)));
2428 free(buffer);
2429}
static const WCHAR deviceW[]
#define wine_dbgstr_wn
Definition: testlist.c:2
@ ProcessImageFileNameWin32
Definition: winternl.h:1925

Referenced by START_TEST().

◆ test_query_process_image_info()

static void test_query_process_image_info ( void  )
static

Definition at line 2431 of file info.c.

2432{
2436 ULONG len;
2437
2440 "got %08lx\n", status);
2441
2443 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status);
2444
2446 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status);
2447
2448 memset( &info, 0xcc, sizeof(info) );
2450 ok( status == STATUS_SUCCESS, "got %08lx\n", status);
2451 ok( len == sizeof(info), "wrong len %lu\n", len );
2452
2453 ok( info.MajorSubsystemVersion == nt->OptionalHeader.MajorSubsystemVersion,
2454 "wrong major version %x/%x\n",
2455 info.MajorSubsystemVersion, nt->OptionalHeader.MajorSubsystemVersion );
2456 ok( info.MinorSubsystemVersion == nt->OptionalHeader.MinorSubsystemVersion,
2457 "wrong minor version %x/%x\n",
2458 info.MinorSubsystemVersion, nt->OptionalHeader.MinorSubsystemVersion );
2459 ok( info.MajorOperatingSystemVersion == nt->OptionalHeader.MajorOperatingSystemVersion ||
2460 broken( !info.MajorOperatingSystemVersion ), /* <= win8 */
2461 "wrong major OS version %x/%x\n",
2462 info.MajorOperatingSystemVersion, nt->OptionalHeader.MajorOperatingSystemVersion );
2463#ifdef __REACTOS__
2465 ok( info.MinorOperatingSystemVersion == 0, "wrong minor version %x/%x\n", info.MinorOperatingSystemVersion, 0 );
2466 else
2467#endif
2468 ok( info.MinorOperatingSystemVersion == nt->OptionalHeader.MinorOperatingSystemVersion,
2469 "wrong minor OS version %x/%x\n",
2470 info.MinorOperatingSystemVersion, nt->OptionalHeader.MinorOperatingSystemVersion );
2471}
PIMAGE_NT_HEADERS nt
Definition: delayimp.cpp:445
#define RtlImageNtHeader
Definition: compat.h:806
PPEB Peb
Definition: dllmain.c:27
IMAGE_OPTIONAL_HEADER32 OptionalHeader
Definition: ntddk_ex.h:184
WORD MinorOperatingSystemVersion
Definition: ntddk_ex.h:161
WORD MajorOperatingSystemVersion
Definition: ntddk_ex.h:160
PVOID ImageBaseAddress
Definition: ntddk_ex.h:245
@ ProcessImageInformation
Definition: winternl.h:1919

Referenced by START_TEST().

◆ test_query_process_io()

static void test_query_process_io ( void  )
static

Definition at line 2009 of file info.c.

2010{
2013 IO_COUNTERS pii;
2014
2017 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08lx\n", status);
2018
2020 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2021
2023 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2024
2026 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2027 ok( sizeof(pii) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
2028
2030 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2031 ok( sizeof(pii) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
2032
2033 /* Check if we have some return values */
2034 if (winetest_debug > 1) trace("OtherOperationCount : 0x%s\n", wine_dbgstr_longlong(pii.OtherOperationCount));
2035 todo_wine
2036 {
2037 ok( pii.OtherOperationCount > 0, "Expected an OtherOperationCount > 0\n");
2038 }
2039}
ULONGLONG OtherOperationCount
Definition: pstypes.h:85
@ ProcessIoCounters
Definition: winternl.h:1884

Referenced by START_TEST().

◆ test_query_process_priority()

static void test_query_process_priority ( void  )
static

Definition at line 2303 of file info.c.

2304{
2307 DWORD orig_priority;
2309 BOOL ret;
2310
2313 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
2314
2316 ok(status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2317
2319 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2320
2322 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2323
2324 orig_priority = GetPriorityClass(GetCurrentProcess());
2326 ok(ret, "Failed to set priority class: %lu\n", GetLastError());
2327
2329 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2330 ok(priority[0].PriorityClass == PROCESS_PRIOCLASS_BELOW_NORMAL,
2331 "Expected PROCESS_PRIOCLASS_BELOW_NORMAL, got %u\n", priority[0].PriorityClass);
2332
2333 ret = SetPriorityClass(GetCurrentProcess(), orig_priority);
2334 ok(ret, "Failed to reset priority class: %lu\n", GetLastError());
2335}
DWORD WINAPI GetPriorityClass(IN HANDLE hProcess)
Definition: proc.c:1507
BOOL WINAPI SetPriorityClass(IN HANDLE hProcess, IN DWORD dwPriorityClass)
Definition: proc.c:1542
static int priority
Definition: timer.c:163
#define BELOW_NORMAL_PRIORITY_CLASS
Definition: winbase.h:194
@ ProcessPriorityClass
Definition: winternl.h:1900
#define PROCESS_PRIOCLASS_BELOW_NORMAL
Definition: winternl.h:2757

Referenced by START_TEST().

◆ test_query_process_quota_limits()

static void test_query_process_quota_limits ( void  )
static

Definition at line 2730 of file info.c.

2731{
2732 QUOTA_LIMITS qlimits;
2735 ULONG ret_len;
2736
2738 ok(status == STATUS_INVALID_HANDLE, "NtQueryInformationProcess failed, status %#lx.\n", status);
2739
2740 status = NtQueryInformationProcess(NULL, ProcessQuotaLimits, &qlimits, sizeof(qlimits), NULL);
2741 ok(status == STATUS_INVALID_HANDLE, "NtQueryInformationProcess failed, status %#lx.\n", status);
2742
2745 ok(status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryInformationProcess failed, status %#lx.\n", status);
2746
2747 memset(&qlimits, 0, sizeof(qlimits));
2748 status = NtQueryInformationProcess( process, ProcessQuotaLimits, &qlimits, sizeof(qlimits), &ret_len);
2749 ok(status == STATUS_SUCCESS, "NtQueryInformationProcess failed, status %#lx.\n", status);
2750 ok(sizeof(qlimits) == ret_len, "len set to %lx\n", ret_len);
2751 ok(qlimits.MinimumWorkingSetSize == 204800,"Expected MinimumWorkingSetSize = 204800, got %s\n",
2753 ok(qlimits.MaximumWorkingSetSize == 1413120,"Expected MaximumWorkingSetSize = 1413120, got %s\n",
2755 ok(qlimits.PagefileLimit == ~0,"Expected PagefileLimit = ~0, got %s\n",
2757 ok(qlimits.TimeLimit.QuadPart == ~0,"Expected TimeLimit = ~0, got %s\n",
2759
2760 if (winetest_debug > 1)
2761 {
2762 trace("Quota Limits:\n");
2763 trace("PagedPoolLimit: %s\n", wine_dbgstr_longlong(qlimits.PagedPoolLimit));
2764 trace("NonPagedPoolLimit: %s\n", wine_dbgstr_longlong(qlimits.NonPagedPoolLimit));
2765 }
2766
2767 memset(&qlimits, 0, sizeof(qlimits));
2768 status = NtQueryInformationProcess( process, ProcessQuotaLimits, &qlimits, sizeof(qlimits) * 2, &ret_len);
2769 ok(status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryInformationProcess failed, status %#lx.\n", status);
2770 ok(sizeof(qlimits) == ret_len, "len set to %lx\n", ret_len);
2771
2772 memset(&qlimits, 0, sizeof(qlimits));
2773 status = NtQueryInformationProcess( process, ProcessQuotaLimits, &qlimits, sizeof(qlimits) - 1, &ret_len);
2774 ok(status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryInformationProcess failed, status %#lx.\n", status);
2775 ok(sizeof(qlimits) == ret_len, "len set to %lx\n", ret_len);
2776
2777 memset(&qlimits, 0, sizeof(qlimits));
2778 status = NtQueryInformationProcess( process, ProcessQuotaLimits, &qlimits, sizeof(qlimits) + 1, &ret_len);
2779 ok(status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryInformationProcess failed, status %#lx.\n", status);
2780 ok(sizeof(qlimits) == ret_len, "len set to %lx\n", ret_len);
2781}
INT64 MaximumWorkingSetSize
Definition: lsa.idl:290
INT64 NonPagedPoolLimit
Definition: lsa.idl:288
LARGE_INTEGER TimeLimit
Definition: lsa.idl:292
INT64 MinimumWorkingSetSize
Definition: lsa.idl:289
INT64 PagefileLimit
Definition: lsa.idl:291
INT64 PagedPoolLimit
Definition: lsa.idl:287
LONGLONG QuadPart
Definition: typedefs.h:114
@ ProcessQuotaLimits
Definition: winternl.h:1883

Referenced by START_TEST().

◆ test_query_process_times()

static void test_query_process_times ( void  )
static

Definition at line 2041 of file info.c.

2042{
2046 SYSTEMTIME UTC, Local;
2047 KERNEL_USER_TIMES spti;
2048
2051 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08lx\n", status);
2052
2053 status = NtQueryInformationProcess(NULL, ProcessTimes, &spti, sizeof(spti), NULL);
2054 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2055
2057 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2058
2060 if (!process)
2061 {
2062 if (winetest_debug > 1) trace("Could not open process with ID : %ld, error : %lu. Going to use current one.\n", one_before_last_pid, GetLastError());
2064 }
2065 else
2066 trace("ProcessTimes for process with ID : %ld\n", one_before_last_pid);
2067
2069 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2070 ok( sizeof(spti) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
2072
2073 FileTimeToSystemTime((const FILETIME *)&spti.CreateTime, &UTC);
2075 if (winetest_debug > 1) trace("CreateTime : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
2076 Local.wHour, Local.wMinute, Local.wSecond);
2077
2078 FileTimeToSystemTime((const FILETIME *)&spti.ExitTime, &UTC);
2080 if (winetest_debug > 1) trace("ExitTime : %02d/%02d/%04d %02d:%02d:%02d\n", Local.wMonth, Local.wDay, Local.wYear,
2081 Local.wHour, Local.wMinute, Local.wSecond);
2082
2083 FileTimeToSystemTime((const FILETIME *)&spti.KernelTime, &Local);
2084 if (winetest_debug > 1) trace("KernelTime : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
2085
2086 FileTimeToSystemTime((const FILETIME *)&spti.UserTime, &Local);
2087 if (winetest_debug > 1) trace("UserTime : %02d:%02d:%02d.%03d\n", Local.wHour, Local.wMinute, Local.wSecond, Local.wMilliseconds);
2088
2090 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
2091 ok( sizeof(spti) == ReturnLength ||
2092 ReturnLength == 0 /* vista */ ||
2093 broken(is_wow64), /* returns garbage on wow64 */
2094 "Inconsistent length %ld\n", ReturnLength);
2095}
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:183
BOOL WINAPI SystemTimeToTzSpecificLocalTime(CONST TIME_ZONE_INFORMATION *lpTimeZoneInformation, CONST SYSTEMTIME *lpUniversalTime, LPSYSTEMTIME lpLocalTime)
Definition: timezone.c:377
LARGE_INTEGER UserTime
Definition: winternl.h:2377
LARGE_INTEGER CreateTime
Definition: winternl.h:2374
LARGE_INTEGER KernelTime
Definition: winternl.h:2376
LARGE_INTEGER ExitTime
Definition: winternl.h:2375
WORD wMilliseconds
Definition: minwinbase.h:263
WORD wSecond
Definition: minwinbase.h:262
WORD wMinute
Definition: minwinbase.h:261
@ ProcessTimes
Definition: winternl.h:1886

Referenced by START_TEST().

◆ test_query_process_vm()

static void test_query_process_vm ( void  )
static

Definition at line 1904 of file info.c.

1905{
1908 VM_COUNTERS_EX pvi;
1910 SIZE_T prev_size;
1911 const SIZE_T alloc_size = 16 * 1024 * 1024;
1912 void *ptr;
1913
1916 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE(W2K3), got %08lx\n", status);
1917
1919 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
1920
1922 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1923
1925 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1926 ok( ReturnLength == sizeof(VM_COUNTERS), "Inconsistent length %ld\n", ReturnLength);
1927
1929 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1930 todo_wine ok( ReturnLength == sizeof(VM_COUNTERS), "wrong size %ld\n", ReturnLength);
1931
1932 /* Check if we have some return values */
1933 if (winetest_debug > 1)
1934 dump_vm_counters("VM counters for GetCurrentProcess", &pvi);
1935 ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
1936 ok( pvi.PagefileUsage > 0, "Expected a PagefileUsage > 0\n");
1937
1940 ok( status == STATUS_ACCESS_DENIED, "Expected STATUS_ACCESS_DENIED, got %08lx\n", status);
1942
1945 ok( status == STATUS_SUCCESS || broken(!process) /* XP */, "Expected STATUS_SUCCESS, got %08lx\n", status);
1947
1948 memset(&pvi, 0, sizeof(pvi));
1951 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1952 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
1953
1954 /* Check if we have some return values */
1955 if (winetest_debug > 1)
1956 dump_vm_counters("VM counters for GetCurrentProcessId", &pvi);
1957 ok( pvi.WorkingSetSize > 0, "Expected a WorkingSetSize > 0\n");
1958 ok( pvi.PagefileUsage > 0, "Expected a PagefileUsage > 0\n");
1959
1961
1962 /* Check if we have real counters */
1964 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1965 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
1966 prev_size = pvi.VirtualSize;
1967 if (winetest_debug > 1)
1968 dump_vm_counters("VM counters before VirtualAlloc", &pvi);
1970 ok( ptr != NULL, "VirtualAlloc failed, err %lu\n", GetLastError());
1972 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1973 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
1974 if (winetest_debug > 1)
1975 dump_vm_counters("VM counters after VirtualAlloc", &pvi);
1976 todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size,
1977 "Expected to be greater than %Iu, got %Iu\n", prev_size + alloc_size, pvi.VirtualSize);
1979
1981 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1982 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
1983 prev_size = pvi.VirtualSize;
1984 if (winetest_debug > 1)
1985 dump_vm_counters("VM counters before VirtualAlloc", &pvi);
1987 ok( ptr != NULL, "VirtualAlloc failed, err %lu\n", GetLastError());
1989 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1990 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
1991 if (winetest_debug > 1)
1992 dump_vm_counters("VM counters after VirtualAlloc(MEM_RESERVE)", &pvi);
1993 todo_wine ok( pvi.VirtualSize >= prev_size + alloc_size,
1994 "Expected to be greater than %Iu, got %Iu\n", prev_size + alloc_size, pvi.VirtualSize);
1995 prev_size = pvi.VirtualSize;
1996
1997 ptr = VirtualAlloc(ptr, alloc_size, MEM_COMMIT, PAGE_READWRITE);
1998 ok( ptr != NULL, "VirtualAlloc failed, err %lu\n", GetLastError());
2000 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2001 ok( pvi.PrivateUsage == pvi.PagefileUsage, "wrong value %Iu/%Iu\n", pvi.PrivateUsage, pvi.PagefileUsage );
2002 if (winetest_debug > 1)
2003 dump_vm_counters("VM counters after VirtualAlloc(MEM_COMMIT)", &pvi);
2004 ok( pvi.VirtualSize == prev_size,
2005 "Expected to equal to %Iu, got %Iu\n", prev_size, pvi.VirtualSize);
2007}
#define PROCESS_VM_READ
Definition: pstypes.h:157
static PVOID ptr
Definition: dispmode.c:27
static void dump_vm_counters(const char *header, const VM_COUNTERS_EX *pvi)
Definition: info.c:1888
#define MEM_RESERVE
Definition: nt_native.h:1317
#define MEM_RELEASE
Definition: nt_native.h:1319
#define MEM_COMMIT
Definition: nt_native.h:1316
SIZE_T PrivateUsage
Definition: winternl.h:3157
LPVOID NTAPI VirtualAlloc(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD flAllocationType, IN DWORD flProtect)
Definition: virtmem.c:65
BOOL NTAPI VirtualFree(IN LPVOID lpAddress, IN SIZE_T dwSize, IN DWORD dwFreeType)
Definition: virtmem.c:119
@ ProcessVmCounters
Definition: winternl.h:1885

Referenced by START_TEST().

◆ test_query_process_wow64()

static void test_query_process_wow64 ( void  )
static

Definition at line 1756 of file info.c.

1757{
1760 ULONG_PTR pbi[2], dummy;
1761
1762 memset(&dummy, 0xcc, sizeof(dummy));
1763
1764 /* Do not give a handle and buffer */
1766 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1767
1768 /* Use a correct info class and buffer size, but still no handle and buffer */
1771 "Expected STATUS_ACCESS_VIOLATION or STATUS_INVALID_HANDLE, got %08lx\n", status);
1772
1773 /* Use a correct info class, buffer size and handle, but no buffer */
1775 ok( status == STATUS_ACCESS_VIOLATION , "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
1776
1777 /* Use a correct info class, buffer and buffer size, but no handle */
1778 pbi[0] = pbi[1] = dummy;
1780 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
1781 ok( pbi[0] == dummy, "pbi[0] changed to %Ix\n", pbi[0]);
1782 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1783
1784 /* Use a greater buffer size */
1785 pbi[0] = pbi[1] = dummy;
1787 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1788 ok( pbi[0] == dummy, "pbi[0] changed to %Ix\n", pbi[0]);
1789 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1790
1791 /* Use no ReturnLength */
1792 pbi[0] = pbi[1] = dummy;
1794 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1795 ok( is_wow64 == (pbi[0] != 0), "is_wow64 %x, pbi[0] %Ix\n", is_wow64, pbi[0]);
1796 if (is_wow64)
1797 ok( (void *)pbi[0] == NtCurrentTeb()->Peb, "pbi[0] %Ix / %p\n", pbi[0], NtCurrentTeb()->Peb);
1798 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1799 /* Test written size on 64 bit by checking high 32 bit buffer */
1800 if (sizeof(ULONG_PTR) > sizeof(DWORD))
1801 {
1802 DWORD *ptr = (DWORD *)pbi;
1803 ok( ptr[1] != (DWORD)dummy, "ptr[1] unchanged!\n");
1804 }
1805
1806 /* Finally some correct calls */
1807 pbi[0] = pbi[1] = dummy;
1808 ReturnLength = 0xdeadbeef;
1810 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1811 ok( is_wow64 == (pbi[0] != 0), "is_wow64 %x, pbi[0] %Ix\n", is_wow64, pbi[0]);
1812 if (is_wow64)
1813 ok( (void *)pbi[0] == NtCurrentTeb()->Peb, "pbi[0] %Ix / %p\n", pbi[0], NtCurrentTeb()->Peb);
1814 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1815 ok( ReturnLength == sizeof(ULONG_PTR), "Inconsistent length %ld\n", ReturnLength);
1816
1817 /* Everything is correct except a too small buffer size */
1818 pbi[0] = pbi[1] = dummy;
1819 ReturnLength = 0xdeadbeef;
1821 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1822 ok( pbi[0] == dummy, "pbi[0] changed to %Ix\n", pbi[0]);
1823 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1824 ok( ReturnLength == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", ReturnLength);
1825
1826 /* Everything is correct except a too large buffer size */
1827 pbi[0] = pbi[1] = dummy;
1828 ReturnLength = 0xdeadbeef;
1830 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1831 ok( pbi[0] == dummy, "pbi[0] changed to %Ix\n", pbi[0]);
1832 ok( pbi[1] == dummy, "pbi[1] changed to %Ix\n", pbi[1]);
1833 ok( ReturnLength == 0xdeadbeef, "Expected 0xdeadbeef, got %ld\n", ReturnLength);
1834}

Referenced by START_TEST().

◆ test_query_processor_power_info()

static void test_query_processor_power_info ( void  )
static

Definition at line 1683 of file info.c.

1684{
1687 ULONG size;
1689 int i;
1690
1691 GetSystemInfo(&si);
1693 ppi = HeapAlloc(GetProcessHeap(), 0, size);
1694
1695 /* If size < (sizeof(PROCESSOR_POWER_INFORMATION) * NumberOfProcessors), Win7 returns
1696 * STATUS_BUFFER_TOO_SMALL. WinXP returns STATUS_SUCCESS for any value of size. It copies as
1697 * many whole PROCESSOR_POWER_INFORMATION structures that there is room for. Even if there is
1698 * not enough room for one structure, WinXP still returns STATUS_SUCCESS having done nothing.
1699 *
1700 * If ppi == NULL, Win7 returns STATUS_INVALID_PARAMETER while WinXP returns STATUS_SUCCESS
1701 * and does nothing.
1702 *
1703 * The same behavior is seen with CallNtPowerInformation (in powrprof.dll).
1704 */
1705
1706 if (si.dwNumberOfProcessors > 1)
1707 {
1708 for(i = 0; i < si.dwNumberOfProcessors; i++)
1709 ppi[i].Number = 0xDEADBEEF;
1710
1711 /* Call with a buffer size that is large enough to hold at least one but not large
1712 * enough to hold them all. This will be STATUS_SUCCESS on WinXP but not on Win7 */
1713 status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, size - sizeof(PROCESSOR_POWER_INFORMATION));
1714 if (status == STATUS_SUCCESS)
1715 {
1716 /* lax version found on older Windows like WinXP */
1717 ok( (ppi[si.dwNumberOfProcessors - 2].Number != 0xDEADBEEF) &&
1718 (ppi[si.dwNumberOfProcessors - 1].Number == 0xDEADBEEF),
1719 "Expected all but the last record to be overwritten.\n");
1720
1721 status = pNtPowerInformation(ProcessorInformation, 0, 0, 0, size);
1722 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1723
1724 for(i = 0; i < si.dwNumberOfProcessors; i++)
1725 ppi[i].Number = 0xDEADBEEF;
1726 status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, sizeof(PROCESSOR_POWER_INFORMATION) - 1);
1727 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1728 for(i = 0; i < si.dwNumberOfProcessors; i++)
1729 if (ppi[i].Number != 0xDEADBEEF) break;
1730 ok( i == si.dwNumberOfProcessors, "Expected untouched buffer\n");
1731 }
1732 else
1733 {
1734 /* picky version found on newer Windows like Win7 */
1735 ok( ppi[1].Number == 0xDEADBEEF, "Expected untouched buffer.\n");
1736 ok( status == STATUS_BUFFER_TOO_SMALL, "Expected STATUS_BUFFER_TOO_SMALL, got %08lx\n", status);
1737
1738 status = pNtPowerInformation(ProcessorInformation, 0, 0, 0, size);
1739 ok( status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, "Got %08lx\n", status);
1740
1741 status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, 0);
1743 }
1744 }
1745 else
1746 {
1747 skip("Test needs more than one processor.\n");
1748 }
1749
1750 status = pNtPowerInformation(ProcessorInformation, 0, 0, ppi, size);
1751 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1752
1753 HeapFree(GetProcessHeap(), 0, ppi);
1754}
_In_ ULONG Number
Definition: haltypes.h:1872
struct _PROCESSOR_POWER_INFORMATION PROCESSOR_POWER_INFORMATION
@ ProcessorInformation
Definition: ntpoapi.h:78

Referenced by START_TEST().

◆ test_query_procperf()

static void test_query_procperf ( void  )
static

Definition at line 750 of file info.c.

751{
754 ULONG NeededLength;
757
758 /* Find out the number of processors */
759 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), &ReturnLength);
760 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
762
763 sppi = HeapAlloc(GetProcessHeap(), 0, NeededLength);
764
765 status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, 0, &ReturnLength);
766 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
767
768 /* Try it for 1 processor */
769 sppi->KernelTime.QuadPart = 0xdeaddead;
770 sppi->UserTime.QuadPart = 0xdeaddead;
771 sppi->IdleTime.QuadPart = 0xdeaddead;
772 status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi,
774 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
776 "Inconsistent length %ld\n", ReturnLength);
777 ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
778 ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
779 ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
780
781 /* Try it for all processors */
782 sppi->KernelTime.QuadPart = 0xdeaddead;
783 sppi->UserTime.QuadPart = 0xdeaddead;
784 sppi->IdleTime.QuadPart = 0xdeaddead;
785 status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength, &ReturnLength);
786 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
787 ok( NeededLength == ReturnLength, "Inconsistent length (%ld) <-> (%ld)\n", NeededLength, ReturnLength);
788 ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
789 ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
790 ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
791
792 /* A too large given buffer size */
793 sppi = HeapReAlloc(GetProcessHeap(), 0, sppi , NeededLength + 2);
794 sppi->KernelTime.QuadPart = 0xdeaddead;
795 sppi->UserTime.QuadPart = 0xdeaddead;
796 sppi->IdleTime.QuadPart = 0xdeaddead;
797 status = pNtQuerySystemInformation(SystemProcessorPerformanceInformation, sppi, NeededLength + 2, &ReturnLength);
799 "Expected STATUS_SUCCESS or STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
800 ok( NeededLength == ReturnLength, "Inconsistent length (%ld) <-> (%ld)\n", NeededLength, ReturnLength);
801 if (status == STATUS_SUCCESS)
802 {
803 ok (sppi->KernelTime.QuadPart != 0xdeaddead, "KernelTime unchanged\n");
804 ok (sppi->UserTime.QuadPart != 0xdeaddead, "UserTime unchanged\n");
805 ok (sppi->IdleTime.QuadPart != 0xdeaddead, "IdleTime unchanged\n");
806 }
807 else /* vista and 2008 */
808 {
809 ok (sppi->KernelTime.QuadPart == 0xdeaddead, "KernelTime changed\n");
810 ok (sppi->UserTime.QuadPart == 0xdeaddead, "UserTime changed\n");
811 ok (sppi->IdleTime.QuadPart == 0xdeaddead, "IdleTime changed\n");
812 }
813
814 HeapFree( GetProcessHeap(), 0, sppi);
815}
@ SystemProcessorPerformanceInformation
Definition: ntddk_ex.h:19
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION

Referenced by START_TEST().

◆ test_query_regquota()

static void test_query_regquota ( void  )
static

Definition at line 1202 of file info.c.

1203{
1207
1208 status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, 0, &ReturnLength);
1209 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
1210
1211 status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi), &ReturnLength);
1212 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1213 ok( sizeof(srqi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1214
1215 status = pNtQuerySystemInformation(SystemRegistryQuotaInformation, &srqi, sizeof(srqi) + 2, &ReturnLength);
1216 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
1217 ok( sizeof(srqi) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
1218}
@ SystemRegistryQuotaInformation
Definition: ntddk_ex.h:48

Referenced by START_TEST().

◆ test_query_timeofday()

static void test_query_timeofday ( void  )
static

Definition at line 474 of file info.c.

475{
478
479 /* Copy of our winternl.h structure turned into a private one */
480 typedef struct _SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE {
481 LARGE_INTEGER liKeBootTime;
482 LARGE_INTEGER liKeSystemTime;
483 LARGE_INTEGER liExpTimeZoneBias;
484 ULONG uCurrentTimeZoneId;
485 DWORD dwUnknown1[5];
486 } SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE;
487
488 SYSTEM_TIMEOFDAY_INFORMATION_PRIVATE sti;
489
490 status = pNtQuerySystemInformation( SystemTimeOfDayInformation, &sti, 0, &ReturnLength );
491 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
492 ok( 0 == ReturnLength, "ReturnLength should be 0, it is (%ld)\n", ReturnLength);
493
494 sti.uCurrentTimeZoneId = 0xdeadbeef;
495 status = pNtQuerySystemInformation( SystemTimeOfDayInformation, &sti, 24, &ReturnLength );
496 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
497 ok( 24 == ReturnLength, "ReturnLength should be 24, it is (%ld)\n", ReturnLength);
498 ok( 0xdeadbeef == sti.uCurrentTimeZoneId, "This part of the buffer should not have been filled\n");
499
500 sti.uCurrentTimeZoneId = 0xdeadbeef;
501 status = pNtQuerySystemInformation( SystemTimeOfDayInformation, &sti, 32, &ReturnLength );
502 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
503 ok( 32 == ReturnLength, "ReturnLength should be 32, it is (%ld)\n", ReturnLength);
504 ok( 0xdeadbeef != sti.uCurrentTimeZoneId, "Buffer should have been partially filled\n");
505
506 status = pNtQuerySystemInformation( SystemTimeOfDayInformation, &sti, 49, &ReturnLength );
507 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
508 ok( ReturnLength == 0 || ReturnLength == sizeof(sti) /* vista */,
509 "ReturnLength should be 0, it is (%ld)\n", ReturnLength);
510
511 status = pNtQuerySystemInformation( SystemTimeOfDayInformation, &sti, sizeof(sti), &ReturnLength );
512 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
513 ok( sizeof(sti) == ReturnLength, "Inconsistent length %ld\n", ReturnLength);
514
515 /* Check if we have some return values */
516 if (winetest_debug > 1) trace("uCurrentTimeZoneId : (%ld)\n", sti.uCurrentTimeZoneId);
517}
@ SystemTimeOfDayInformation
Definition: ntddk_ex.h:14

Referenced by START_TEST().

◆ test_queryvirtualmemory()

static void test_queryvirtualmemory ( void  )
static

Definition at line 2985 of file info.c.

2986{
2988 SIZE_T readcount, prev;
2989 static const char teststring[] = "test string";
2990 static char datatestbuf[42] = "abc";
2991 static char rwtestbuf[42];
2993 char stackbuf[42];
2995 void *user_shared_data = (void *)0x7ffe0000;
2996 void *buffer[256];
2999
3000 module = GetModuleHandleA( "ntdll.dll" );
3001 status = pNtQueryVirtualMemory(NtCurrentProcess(), module, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3002 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3003 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3004 ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
3005 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
3006 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%x\n", mbi.State, MEM_COMMIT);
3007 ok (mbi.Protect == PAGE_READONLY, "mbi.Protect is 0x%lx, expected 0x%x\n", mbi.Protect, PAGE_READONLY);
3008 ok (mbi.Type == MEM_IMAGE, "mbi.Type is 0x%lx, expected 0x%x\n", mbi.Type, MEM_IMAGE);
3009
3010 module = GetModuleHandleA( "ntdll.dll" );
3011 status = pNtQueryVirtualMemory(NtCurrentProcess(), pNtQueryVirtualMemory, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3012 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3013 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3014 ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
3015 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
3016 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%x\n", mbi.State, MEM_COMMIT);
3017 ok (mbi.Protect == PAGE_EXECUTE_READ, "mbi.Protect is 0x%lx, expected 0x%x\n", mbi.Protect, PAGE_EXECUTE_READ);
3018
3019 status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3020 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3021 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3023 "mbi.AllocationProtect is 0x%lx\n", mbi.AllocationProtect);
3024 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%x\n", mbi.State, MEM_COMMIT);
3026 "mbi.Protect is 0x%lx\n", mbi.Protect);
3027
3028 status = pNtQueryVirtualMemory(NtCurrentProcess(), stackbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3029 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3030 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3031 ok (mbi.AllocationProtect == PAGE_READWRITE, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_READWRITE);
3032 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%x\n", mbi.State, MEM_COMMIT);
3033 ok (mbi.Protect == PAGE_READWRITE, "mbi.Protect is 0x%lx, expected 0x%x\n", mbi.Protect, PAGE_READWRITE);
3034
3036 status = pNtQueryVirtualMemory(NtCurrentProcess(), teststring, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3037 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3038 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3039 ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
3040 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
3041 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%X\n", mbi.State, MEM_COMMIT);
3042 ok (mbi.Protect == PAGE_READONLY, "mbi.Protect is 0x%lx, expected 0x%X\n", mbi.Protect, PAGE_READONLY);
3043
3044 status = pNtQueryVirtualMemory(NtCurrentProcess(), datatestbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3045 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3046 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3047 ok (mbi.AllocationBase == module, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, module);
3048 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
3049 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%X\n", mbi.State, MEM_COMMIT);
3051 "mbi.Protect is 0x%lx\n", mbi.Protect);
3052
3053 status = pNtQueryVirtualMemory(NtCurrentProcess(), rwtestbuf, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3054 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3055 ok( readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3056 if (mbi.AllocationBase == module)
3057 {
3058 ok (mbi.AllocationProtect == PAGE_EXECUTE_WRITECOPY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_EXECUTE_WRITECOPY);
3059 ok (mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%X\n", mbi.State, MEM_COMMIT);
3061 "mbi.Protect is 0x%lx\n", mbi.Protect);
3062 }
3063 else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */
3064
3065 status = pNtQueryVirtualMemory(NtCurrentProcess(), user_shared_data, MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
3066 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3067 ok(readcount == sizeof(MEMORY_BASIC_INFORMATION), "Expected to read %d bytes, got %Id\n",(int)sizeof(MEMORY_BASIC_INFORMATION),readcount);
3068 ok(mbi.AllocationBase == user_shared_data, "mbi.AllocationBase is 0x%p, expected 0x%p\n", mbi.AllocationBase, user_shared_data);
3069 ok(mbi.AllocationProtect == PAGE_READONLY, "mbi.AllocationProtect is 0x%lx, expected 0x%x\n", mbi.AllocationProtect, PAGE_READONLY);
3070 ok(mbi.State == MEM_COMMIT, "mbi.State is 0x%lx, expected 0x%X\n", mbi.State, MEM_COMMIT);
3071 ok(mbi.Protect == PAGE_READONLY, "mbi.Protect is 0x%lx\n", mbi.Protect);
3072 ok(mbi.Type == MEM_PRIVATE, "mbi.Type is 0x%lx, expected 0x%x\n", mbi.Type, MEM_PRIVATE);
3073 ok(mbi.RegionSize == 0x1000, "mbi.RegionSize is 0x%Ix, expected 0x%x\n", mbi.RegionSize, 0x1000);
3074
3075 /* check error code when addr is higher than user space limit */
3076 status = pNtQuerySystemInformation(SystemBasicInformation, &sbi, sizeof(sbi), NULL);
3077 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3078 status = pNtQueryVirtualMemory(NtCurrentProcess(), sbi.LowestUserAddress, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
3079 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3080 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)sbi.LowestUserAddress-1, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
3081 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3082 status = pNtQueryVirtualMemory(NtCurrentProcess(), sbi.HighestUserAddress, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
3083 ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
3084 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)sbi.HighestUserAddress+1, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
3085 ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3086 status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)~0, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
3087 ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08lx\n", status);
3088
3089 /* check error code when len is less than MEMORY_BASIC_INFORMATION size */
3090 status = pNtQueryVirtualMemory(NtCurrentProcess(), GetProcessHeap(), MemoryBasicInformation, &mbi, sizeof(MEMORY_BASIC_INFORMATION) - 1, &readcount);
3091 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status);
3092
3093 module = GetModuleHandleA( "ntdll.dll" );
3094 memset(buffer, 0xcc, sizeof(buffer));
3095 readcount = 0xdeadbeef;
3097 name, sizeof(*name) + 16, &readcount);
3098 ok(status == STATUS_BUFFER_OVERFLOW, "got %08lx\n", status);
3099 ok(name->SectionFileName.Length == 0xcccc || broken(!name->SectionFileName.Length), /* vista64 */
3100 "Wrong len %u\n", name->SectionFileName.Length);
3101 ok(readcount > sizeof(*name), "Wrong count %Iu\n", readcount);
3102
3103 memset(buffer, 0xcc, sizeof(buffer));
3104 readcount = 0xdeadbeef;
3105 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)module + 1234, MemoryMappedFilenameInformation,
3106 name, sizeof(buffer), &readcount);
3107 ok(status == STATUS_SUCCESS, "got %08lx\n", status);
3108 ok(name->SectionFileName.Buffer == (WCHAR *)(name + 1), "Wrong ptr %p/%p\n",
3109 name->SectionFileName.Buffer, name + 1 );
3110 ok(name->SectionFileName.Length != 0xcccc, "Wrong len %u\n", name->SectionFileName.Length);
3111 ok(name->SectionFileName.MaximumLength == name->SectionFileName.Length + sizeof(WCHAR),
3112 "Wrong maxlen %u/%u\n", name->SectionFileName.MaximumLength, name->SectionFileName.Length);
3113 ok(readcount == sizeof(name->SectionFileName) + name->SectionFileName.MaximumLength,
3114 "Wrong count %Iu/%u\n", readcount, name->SectionFileName.MaximumLength);
3115 ok( !name->SectionFileName.Buffer[name->SectionFileName.Length / sizeof(WCHAR)],
3116 "buffer not null-terminated\n" );
3117
3118 memset(buffer, 0xcc, sizeof(buffer));
3119 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)module + 1234, MemoryMappedFilenameInformation,
3120 name, sizeof(buffer), NULL);
3121 ok(status == STATUS_SUCCESS, "got %08lx\n", status);
3122
3123 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)module + 1234, MemoryMappedFilenameInformation,
3124 NULL, sizeof(buffer), NULL);
3125 ok(status == STATUS_ACCESS_VIOLATION, "got %08lx\n", status);
3126
3127 memset(buffer, 0xcc, sizeof(buffer));
3128 prev = readcount;
3129 readcount = 0xdeadbeef;
3130 status = pNtQueryVirtualMemory(NtCurrentProcess(), (char *)module + 321, MemoryMappedFilenameInformation,
3131 name, sizeof(*name) - 1, &readcount);
3132 ok(status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status);
3133 ok(name->SectionFileName.Length == 0xcccc, "Wrong len %u\n", name->SectionFileName.Length);
3134 ok(readcount == prev, "Wrong count %Iu\n", readcount);
3135
3136 memset(buffer, 0xcc, sizeof(buffer));
3137 readcount = 0xdeadbeef;
3138 status = pNtQueryVirtualMemory((HANDLE)0xdead, (char *)module + 1234, MemoryMappedFilenameInformation,
3139 name, sizeof(buffer), &readcount);
3140 ok(status == STATUS_INVALID_HANDLE, "got %08lx\n", status);
3141 ok(readcount == 0xdeadbeef || broken(readcount == 1024 + sizeof(*name)), /* wow64 */
3142 "Wrong count %Iu\n", readcount);
3143
3144 memset(buffer, 0xcc, sizeof(buffer));
3145 readcount = 0xdeadbeef;
3147 name, sizeof(buffer), &readcount);
3148 ok(status == STATUS_INVALID_ADDRESS, "got %08lx\n", status);
3149 ok(name->SectionFileName.Length == 0xcccc, "Wrong len %u\n", name->SectionFileName.Length);
3150 ok(readcount == 0xdeadbeef || broken(readcount == 1024 + sizeof(*name)), /* wow64 */
3151 "Wrong count %Iu\n", readcount);
3152
3153 readcount = 0xdeadbeef;
3154 status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)0x1234, MemoryMappedFilenameInformation,
3155 name, sizeof(buffer), &readcount);
3156 ok(status == STATUS_INVALID_ADDRESS, "got %08lx\n", status);
3157 ok(name->SectionFileName.Length == 0xcccc, "Wrong len %u\n", name->SectionFileName.Length);
3158 ok(readcount == 0xdeadbeef || broken(readcount == 1024 + sizeof(*name)), /* wow64 */
3159 "Wrong count %Iu\n", readcount);
3160
3161 readcount = 0xdeadbeef;
3162 status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)0x1234, MemoryMappedFilenameInformation,
3163 name, sizeof(*name) - 1, &readcount);
3164 ok(status == STATUS_INVALID_ADDRESS, "got %08lx\n", status);
3165 ok(name->SectionFileName.Length == 0xcccc, "Wrong len %u\n", name->SectionFileName.Length);
3166 ok(readcount == 0xdeadbeef || broken(readcount == 15), /* wow64 */
3167 "Wrong count %Iu\n", readcount);
3168}
#define PAGE_READONLY
Definition: compat.h:138
static const struct _KUSER_SHARED_DATA * user_shared_data
Definition: sync.c:43
#define MEM_IMAGE
Definition: mmtypes.h:89
#define PAGE_WRITECOPY
Definition: nt_native.h:1308
#define PAGE_EXECUTE_READ
Definition: nt_native.h:1310
#define MEM_PRIVATE
Definition: nt_native.h:1321
#define NtCurrentProcess()
Definition: nt_native.h:1660
#define PAGE_EXECUTE_WRITECOPY
Definition: nt_native.h:1312
#define PAGE_EXECUTE_READWRITE
Definition: nt_native.h:1311
#define STATUS_INVALID_ADDRESS
Definition: ntstatus.h:651
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
@ MemoryMappedFilenameInformation
Definition: winternl.h:2387

Referenced by START_TEST().

◆ test_readvirtualmemory()

static void test_readvirtualmemory ( void  )
static

Definition at line 2783 of file info.c.

2784{
2787 SIZE_T readcount;
2788 static const char teststring[] = "test string";
2789 char buffer[12];
2790
2792 ok(process != 0, "Expected to be able to open own process for reading memory\n");
2793
2794 /* normal operation */
2795 status = pNtReadVirtualMemory(process, teststring, buffer, 12, &readcount);
2796 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2797 ok( readcount == 12, "Expected to read 12 bytes, got %Id\n",readcount);
2798 ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
2799
2800 /* no number of bytes */
2801 memset(buffer, 0, 12);
2802 status = pNtReadVirtualMemory(process, teststring, buffer, 12, NULL);
2803 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2804 ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
2805
2806 /* illegal remote address */
2807 todo_wine{
2808 status = pNtReadVirtualMemory(process, (void *) 0x1234, buffer, 12, &readcount);
2809 ok( status == STATUS_PARTIAL_COPY, "Expected STATUS_PARTIAL_COPY, got %08lx\n", status);
2811 ok( readcount == 0, "Expected to read 0 bytes, got %Id\n",readcount);
2812 }
2813
2814 /* 0 handle */
2815 status = pNtReadVirtualMemory(0, teststring, buffer, 12, &readcount);
2816 ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status);
2817 ok( readcount == 0, "Expected to read 0 bytes, got %Id\n",readcount);
2818
2819 /* pseudo handle for current process*/
2820 memset(buffer, 0, 12);
2821 status = pNtReadVirtualMemory((HANDLE)-1, teststring, buffer, 12, &readcount);
2822 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2823 ok( readcount == 12, "Expected to read 12 bytes, got %Id\n",readcount);
2824 ok( strcmp(teststring, buffer) == 0, "Expected read memory to be the same as original memory\n");
2825
2826 /* illegal local address */
2827 status = pNtReadVirtualMemory(process, teststring, (void *)0x1234, 12, &readcount);
2829 "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
2831 ok( readcount == 0, "Expected to read 0 bytes, got %Id\n",readcount);
2832
2834}
#define STATUS_PARTIAL_COPY
Definition: ntstatus.h:273

Referenced by START_TEST().

◆ test_system_debug_control()

static void test_system_debug_control ( void  )
static

Definition at line 3875 of file info.c.

3876{
3878 int class;
3879
3880 for (class = 0; class < SysDbgMaxInfoClass; ++class)
3881 {
3882#ifdef __REACTOS__
3883 if ((class == SysDbgBreakPoint) && is_reactos()) continue; // Don't break into the kernel debugger!
3884 if ((class == SysDbgDisableKernelDebugger) && is_reactos()) continue; // Don't disable the kernel debugger!
3885#endif
3886 status = pNtSystemDebugControl( class, NULL, 0, NULL, 0, NULL );
3887 if (is_wow64)
3888 {
3889 /* Most of the calls return STATUS_NOT_IMPLEMENTED on wow64. */
3891 "class %d, got %#lx.\n", class, status );
3892 }
3893 else
3894 {
3896 "class %d, got %#lx.\n", class, status );
3897 }
3898 }
3899}
#define STATUS_DEBUGGER_INACTIVE
Definition: debugger.c:34
@ SysDbgBreakPoint
Definition: kdtypes.h:68
@ SysDbgDisableKernelDebugger
Definition: kdtypes.h:84
@ SysDbgMaxInfoClass
Definition: winternl.h:3856

Referenced by START_TEST().

◆ test_thread_ideal_processor()

static void test_thread_ideal_processor ( void  )
static

Definition at line 3590 of file info.c.

3591{
3592 ULONG number, len;
3593 PROCESSOR_NUMBER processor;
3595
3596 number = 0;
3597 status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
3598 ok(NT_SUCCESS(status), "Unexpected status %#lx.\n", status);
3599
3600 number = 64 + 1;
3601 status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
3602 ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status);
3603
3604 number = 0;
3605 status = pNtSetInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number) );
3606 ok(!status, "Unexpected status %#lx.\n", status);
3607
3608 status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessor, &number, sizeof(number), &len );
3609 ok(status == STATUS_INVALID_INFO_CLASS, "Unexpected status %#lx.\n", status);
3610
3611 status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessorEx, &processor, sizeof(processor) + 1, &len );
3612#ifdef __REACTOS__
3614#else
3615 ok(status == STATUS_INFO_LENGTH_MISMATCH, "Unexpected status %#lx.\n", status);
3616#endif
3617
3618 status = pNtQueryInformationThread( GetCurrentThread(), ThreadIdealProcessorEx, &processor, sizeof(processor), &len );
3619#ifdef __REACTOS__
3620 ok(status == (GetNTVersion() >= _WIN32_WINNT_WIN7 ? STATUS_SUCCESS : STATUS_INVALID_INFO_CLASS), "Unexpected status %#lx.\n", status);
3621#else
3622 ok(status == STATUS_SUCCESS, "Unexpected status %#lx.\n", status);
3623#endif
3624}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
@ ThreadIdealProcessorEx
Definition: compat.h:968
@ ThreadIdealProcessor
Definition: compat.h:948
static unsigned int number
Definition: dsound.c:1479
PROCESSOR_NUMBER
Definition: ntbasedef.h:654

Referenced by START_TEST().

◆ test_thread_info()

static void test_thread_info ( void  )
static

Definition at line 3626 of file info.c.

3627{
3629 ULONG len, data;
3630
3631 len = 0xdeadbeef;
3632 data = 0xcccccccc;
3633 status = pNtQueryInformationThread( GetCurrentThread(), ThreadAmILastThread,
3634 &data, sizeof(data), &len );
3635 ok( !status, "failed %lx\n", status );
3636 ok( data == 0 || data == 1, "wrong data %lx\n", data );
3637 ok( len == sizeof(data), "wrong len %lu\n", len );
3638
3639 len = 0xdeadbeef;
3640 data = 0xcccccccc;
3641 status = pNtQueryInformationThread( GetCurrentThread(), ThreadAmILastThread,
3642 &data, sizeof(data) - 1, &len );
3643 ok( status == STATUS_INFO_LENGTH_MISMATCH, "failed %lx\n", status );
3644 ok( data == 0xcccccccc, "wrong data %lx\n", data );
3645 ok( len == 0xdeadbeef, "wrong len %lu\n", len );
3646
3647 len = 0xdeadbeef;
3648 data = 0xcccccccc;
3649 status = pNtQueryInformationThread( GetCurrentThread(), ThreadAmILastThread,
3650 &data, sizeof(data) + 1, &len );
3651 ok( status == STATUS_INFO_LENGTH_MISMATCH, "failed %lx\n", status );
3652 ok( data == 0xcccccccc, "wrong data %lx\n", data );
3653 ok( len == 0xdeadbeef, "wrong len %lu\n", len );
3654}
@ ThreadAmILastThread
Definition: compat.h:947
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950

Referenced by START_TEST().

◆ test_thread_lookup()

static void test_thread_lookup ( void  )
static

Definition at line 3528 of file info.c.

3529{
3530 OBJECT_BASIC_INFORMATION obj_info;
3533 CLIENT_ID cid;
3534 HANDLE handle;
3536
3538 cid.UniqueProcess = ULongToHandle(GetCurrentProcessId());
3539 cid.UniqueThread = ULongToHandle(GetCurrentThreadId());
3540 status = pNtOpenThread(&handle, THREAD_QUERY_INFORMATION, &attr, &cid);
3541 ok(!status, "NtOpenThread returned %#lx\n", status);
3542 status = pNtOpenThread((HANDLE *)0xdeadbee0, THREAD_QUERY_INFORMATION, &attr, &cid);
3543 ok( status == STATUS_ACCESS_VIOLATION, "NtOpenThread returned %#lx\n", status);
3544
3545 status = pNtQueryObject(handle, ObjectBasicInformation, &obj_info, sizeof(obj_info), NULL);
3546 ok(!status, "NtQueryObject returned: %#lx\n", status);
3548 || broken(obj_info.GrantedAccess == THREAD_QUERY_INFORMATION), /* winxp */
3549 "GrantedAccess = %lx\n", obj_info.GrantedAccess);
3550
3551 status = pNtQueryInformationThread(handle, ThreadBasicInformation, &info, sizeof(info), NULL);
3552 ok(!status, "NtQueryInformationThread returned %#lx\n", status);
3553 ok(info.ClientId.UniqueProcess == ULongToHandle(GetCurrentProcessId()),
3554 "UniqueProcess = %p expected %lx\n", info.ClientId.UniqueProcess, GetCurrentProcessId());
3555 ok(info.ClientId.UniqueThread == ULongToHandle(GetCurrentThreadId()),
3556 "UniqueThread = %p expected %lx\n", info.ClientId.UniqueThread, GetCurrentThreadId());
3557 pNtClose(handle);
3558
3559 cid.UniqueProcess = 0;
3560 cid.UniqueThread = ULongToHandle(GetCurrentThreadId());
3561 status = pNtOpenThread(&handle, THREAD_QUERY_INFORMATION, &attr, &cid);
3562 ok(!status, "NtOpenThread returned %#lx\n", status);
3563 status = pNtQueryInformationThread(handle, ThreadBasicInformation, &info, sizeof(info), NULL);
3564 ok(!status, "NtQueryInformationThread returned %#lx\n", status);
3565 ok(info.ClientId.UniqueProcess == ULongToHandle(GetCurrentProcessId()),
3566 "UniqueProcess = %p expected %lx\n", info.ClientId.UniqueProcess, GetCurrentProcessId());
3567 ok(info.ClientId.UniqueThread == ULongToHandle(GetCurrentThreadId()),
3568 "UniqueThread = %p expected %lx\n", info.ClientId.UniqueThread, GetCurrentThreadId());
3569 pNtClose(handle);
3570
3571 cid.UniqueProcess = ULongToHandle(0xdeadbeef);
3572 cid.UniqueThread = ULongToHandle(GetCurrentThreadId());
3573 handle = (HANDLE)0xdeadbeef;
3575 todo_wine
3576 ok(status == STATUS_INVALID_CID, "NtOpenThread returned %#lx\n", status);
3577 todo_wine
3578 ok( !handle || broken(handle == (HANDLE)0xdeadbeef) /* vista */, "handle set %p\n", handle );
3579 if (!status) pNtClose(handle);
3580
3581 cid.UniqueProcess = 0;
3582 cid.UniqueThread = ULongToHandle(0xdeadbeef);
3583 handle = (HANDLE)0xdeadbeef;
3584 status = pNtOpenThread(&handle, THREAD_QUERY_INFORMATION, &attr, &cid);
3586 "NtOpenThread returned %#lx\n", status);
3587 ok( !handle || broken(handle == (HANDLE)0xdeadbeef) /* vista */, "handle set %p\n", handle );
3588}
@ ObjectBasicInformation
Definition: DriverTester.h:54
ACCESS_MASK GrantedAccess
Definition: winternl.h:2680

Referenced by START_TEST().

◆ test_thread_start_address()

static void test_thread_start_address ( void  )
static

Definition at line 3454 of file info.c.

3455{
3456 PRTL_THREAD_START_ROUTINE entry, expected_entry;
3459 HANDLE thread;
3460 void *module;
3461 DWORD ret;
3462
3464 ok(module != NULL, "expected non-NULL address for module\n");
3466 ok(nt != NULL, "expected non-NULL address for NT header\n");
3467
3468 entry = NULL;
3469 ret = 0xdeadbeef;
3470 status = pNtQueryInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
3471 &entry, sizeof(entry), &ret);
3472 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
3473 ok(ret == sizeof(entry), "NtQueryInformationThread returned %lu bytes\n", ret);
3474 expected_entry = (void *)((char *)module + nt->OptionalHeader.AddressOfEntryPoint);
3475 ok(entry == expected_entry, "expected %p, got %p\n", expected_entry, entry);
3476
3477 entry = (void *)0xdeadbeef;
3478 status = pNtSetInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
3479 &entry, sizeof(entry));
3480 ok(status == STATUS_SUCCESS || status == STATUS_INVALID_PARAMETER, /* >= Vista */
3481 "expected STATUS_SUCCESS or STATUS_INVALID_PARAMETER, got %08lx\n", status);
3482
3483 if (status == STATUS_SUCCESS)
3484 {
3485 entry = NULL;
3486 ret = 0xdeadbeef;
3487 status = pNtQueryInformationThread(GetCurrentThread(), ThreadQuerySetWin32StartAddress,
3488 &entry, sizeof(entry), &ret);
3489 ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08lx\n", status);
3490 ok(ret == sizeof(entry), "NtQueryInformationThread returned %lu bytes\n", ret);
3491 ok(entry == (void *)0xdeadbeef, "expected 0xdeadbeef, got %p\n", entry);
3492 }
3493
3495 ok(thread != INVALID_HANDLE_VALUE, "CreateThread failed with %ld\n", GetLastError());
3497 ok(ret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %lu\n", ret);
3499}
#define WAIT_OBJECT_0
Definition: winbase.h:383

Referenced by START_TEST().

◆ test_ThreadEnableAlignmentFaultFixup()

static void test_ThreadEnableAlignmentFaultFixup ( void  )
static

Definition at line 3407 of file info.c.

3408{
3410 ULONG dummy;
3411
3412 dummy = 0;
3414 ok( status == STATUS_INVALID_INFO_CLASS, "Expected STATUS_INVALID_INFO_CLASS, got %08lx\n", status );
3416 ok( status == STATUS_INVALID_INFO_CLASS, "Expected STATUS_INVALID_INFO_CLASS, got %08lx\n", status );
3417
3418 dummy = 1;
3419 status = pNtSetInformationThread( GetCurrentThread(), ThreadEnableAlignmentFaultFixup, &dummy, sizeof(ULONG) );
3420 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3421 status = pNtSetInformationThread( (HANDLE)0xdeadbeef, ThreadEnableAlignmentFaultFixup, NULL, 0 );
3422 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3423 status = pNtSetInformationThread( (HANDLE)0xdeadbeef, ThreadEnableAlignmentFaultFixup, NULL, 1 );
3424 ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status );
3425 status = pNtSetInformationThread( (HANDLE)0xdeadbeef, ThreadEnableAlignmentFaultFixup, &dummy, 1 );
3426 todo_wine ok( status == STATUS_INVALID_HANDLE, "Expected STATUS_INVALID_HANDLE, got %08lx\n", status );
3427 status = pNtSetInformationThread( GetCurrentProcess(), ThreadEnableAlignmentFaultFixup, &dummy, 1 );
3428 todo_wine ok( status == STATUS_OBJECT_TYPE_MISMATCH, "Expected STATUS_OBJECT_TYPE_MISMATCH, got %08lx\n", status );
3429 dummy = 1;
3430 status = pNtSetInformationThread( GetCurrentThread(), ThreadEnableAlignmentFaultFixup, &dummy, 1 );
3431 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status );
3432
3433 dummy = 0;
3434 status = pNtSetInformationThread( GetCurrentProcess(), ThreadEnableAlignmentFaultFixup, &dummy, 8 );
3435 ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx\n", status );
3436}
#define STATUS_OBJECT_TYPE_MISMATCH
Definition: d3dkmdt.h:46
@ ThreadEnableAlignmentFaultFixup
Definition: compat.h:942

Referenced by START_TEST().

◆ test_ThreadIsTerminated()

static void test_ThreadIsTerminated ( void  )
static

Definition at line 3843 of file info.c.

3844{
3846 ULONG terminated;
3848
3851 ok( thread != INVALID_HANDLE_VALUE, "failed, error %ld\n", GetLastError() );
3852
3853 status = pNtQueryInformationThread( thread, ThreadIsTerminated, &terminated, sizeof(terminated) * 2, NULL );
3854 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %#lx.\n", status );
3855
3856 terminated = 0xdeadbeef;
3857 status = pNtQueryInformationThread( thread, ThreadIsTerminated, &terminated, sizeof(terminated), NULL );
3858 ok( !status, "got %#lx.\n", status );
3859 ok( !terminated, "got %lu.\n", terminated );
3860
3863
3864 status = pNtQueryInformationThread( thread, ThreadIsTerminated, &terminated, sizeof(terminated), NULL );
3865 ok( !status, "got %#lx.\n", status );
3866 ok( terminated == 1, "got %lu.\n", terminated );
3867
3870
3871 status = pNtQueryInformationThread( thread, ThreadIsTerminated, &terminated, sizeof(terminated), NULL );
3872 ok( status == STATUS_INVALID_HANDLE, "got %#lx.\n", status );
3873}
@ ThreadIsTerminated
Definition: compat.h:955
static DWORD WINAPI test_ThreadIsTerminated_thread(void *stop_event)
Definition: info.c:3837
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:587

Referenced by START_TEST().

◆ test_ThreadIsTerminated_thread()

static DWORD WINAPI test_ThreadIsTerminated_thread ( void stop_event)
static

Definition at line 3837 of file info.c.

3838{
3840 return STATUS_PENDING;
3841}
#define STATUS_PENDING
Definition: telnetd.h:14

Referenced by test_ThreadIsTerminated().

◆ test_threadstack()

static void test_threadstack ( void  )
static

Definition at line 2922 of file info.c.

2923{
2924 PROCESS_STACK_ALLOCATION_INFORMATION info = { 0x100000, 0, (void *)0xdeadbeef };
2927 SIZE_T retlen;
2929
2930 info.ReserveSize = 0x100000;
2931 info.StackBase = (void *)0xdeadbeef;
2932 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation, &info, sizeof(info) );
2933 ok( !status, "NtSetInformationProcess failed %08lx\n", status );
2934 ok( info.StackBase != (void *)0xdeadbeef, "stackbase not set\n" );
2935
2936 status = pNtQueryVirtualMemory( GetCurrentProcess(), info.StackBase, MemoryBasicInformation,
2937 &meminfo, sizeof(meminfo), &retlen );
2938 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2939 ok( retlen == sizeof(meminfo), "Expected STATUS_SUCCESS, got %08lx\n", status);
2940 ok( meminfo.AllocationBase == info.StackBase, "wrong base %p/%p\n",
2941 meminfo.AllocationBase, info.StackBase );
2942 ok( meminfo.RegionSize == info.ReserveSize, "wrong size %Ix/%Ix\n",
2943 meminfo.RegionSize, info.ReserveSize );
2944 ok( meminfo.State == MEM_RESERVE, "wrong state %lx\n", meminfo.State );
2945 ok( meminfo.Protect == 0, "wrong protect %lx\n", meminfo.Protect );
2946 ok( meminfo.Type == MEM_PRIVATE, "wrong type %lx\n", meminfo.Type );
2947
2948 info_ex.AllocInfo = info;
2949 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation,
2950 &info_ex, sizeof(info_ex) );
2952 {
2953 ok( !status, "NtSetInformationProcess failed %08lx\n", status );
2954 ok( info_ex.AllocInfo.StackBase != info.StackBase, "stackbase not set\n" );
2955 status = pNtQueryVirtualMemory( GetCurrentProcess(), info_ex.AllocInfo.StackBase,
2956 MemoryBasicInformation, &meminfo, sizeof(meminfo), &retlen );
2957 ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08lx\n", status);
2958 ok( retlen == sizeof(meminfo), "Expected STATUS_SUCCESS, got %08lx\n", status);
2959 ok( meminfo.AllocationBase == info_ex.AllocInfo.StackBase, "wrong base %p/%p\n",
2960 meminfo.AllocationBase, info_ex.AllocInfo.StackBase );
2961 ok( meminfo.RegionSize == info_ex.AllocInfo.ReserveSize, "wrong size %Ix/%Ix\n",
2962 meminfo.RegionSize, info_ex.AllocInfo.ReserveSize );
2963 ok( meminfo.State == MEM_RESERVE, "wrong state %lx\n", meminfo.State );
2964 ok( meminfo.Protect == 0, "wrong protect %lx\n", meminfo.Protect );
2965 ok( meminfo.Type == MEM_PRIVATE, "wrong type %lx\n", meminfo.Type );
2966 VirtualFree( info_ex.AllocInfo.StackBase, 0, MEM_FREE );
2967 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation,
2968 &info, sizeof(info) - 1 );
2969 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationProcess failed %08lx\n", status );
2970 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation,
2971 &info, sizeof(info) + 1 );
2972 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationProcess failed %08lx\n", status );
2973 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation,
2974 &info_ex, sizeof(info_ex) - 1 );
2975 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationProcess failed %08lx\n", status );
2976 status = pNtSetInformationProcess( GetCurrentProcess(), ProcessThreadStackAllocation,
2977 &info_ex, sizeof(info_ex) + 1 );
2978 ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtSetInformationProcess failed %08lx\n", status );
2979 }
2980 else win_skip( "ProcessThreadStackAllocation ex not supported\n" );
2981
2982 VirtualFree( info.StackBase, 0, MEM_FREE );
2983}
#define MEM_FREE
Definition: nt_native.h:1320
PROCESS_STACK_ALLOCATION_INFORMATION AllocInfo
Definition: winternl.h:2783
@ ProcessThreadStackAllocation
Definition: winternl.h:1923

Referenced by START_TEST().

◆ test_time_adjustment()

static void test_time_adjustment ( void  )
static

Definition at line 1125 of file info.c.

1126{
1130 ULONG len;
1131
1132 memset( &query, 0xcc, sizeof(query) );
1133 status = pNtQuerySystemInformation( SystemTimeAdjustmentInformation, &query, sizeof(query), &len );
1134 ok( status == STATUS_SUCCESS, "got %08lx\n", status );
1135 ok( len == sizeof(query) || broken(!len) /* winxp */, "wrong len %lu\n", len );
1136 ok( query.TimeAdjustmentDisabled == TRUE || query.TimeAdjustmentDisabled == FALSE,
1137 "wrong value %x\n", query.TimeAdjustmentDisabled );
1138
1139 status = pNtQuerySystemInformation( SystemTimeAdjustmentInformation, &query, sizeof(query)-1, &len );
1140 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status );
1141 ok( len == sizeof(query) || broken(!len) /* winxp */, "wrong len %lu\n", len );
1142
1143 status = pNtQuerySystemInformation( SystemTimeAdjustmentInformation, &query, sizeof(query)+1, &len );
1144 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status );
1145 ok( len == sizeof(query) || broken(!len) /* winxp */, "wrong len %lu\n", len );
1146
1147 adjust.TimeAdjustment = query.TimeAdjustment;
1148 adjust.TimeAdjustmentDisabled = query.TimeAdjustmentDisabled;
1149 status = pNtSetSystemInformation( SystemTimeAdjustmentInformation, &adjust, sizeof(adjust) );
1150 ok( status == STATUS_SUCCESS || status == STATUS_PRIVILEGE_NOT_HELD, "got %08lx\n", status );
1151 status = pNtSetSystemInformation( SystemTimeAdjustmentInformation, &adjust, sizeof(adjust)-1 );
1152 todo_wine
1153 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status );
1154 status = pNtSetSystemInformation( SystemTimeAdjustmentInformation, &adjust, sizeof(adjust)+1 );
1155 todo_wine
1156 ok( status == STATUS_INFO_LENGTH_MISMATCH, "got %08lx\n", status );
1157}
@ SystemTimeAdjustmentInformation
Definition: ntddk_ex.h:39
BOOLEAN TimeAdjustmentDisabled
Definition: winternl.h:3210

Referenced by START_TEST().

◆ ULONG()

static ULONG ( WINAPI pNtGetCurrentProcessorNumber)
static

◆ void()

static void ( WINAPI pDbgUiSetThreadDebugObject)
static

Variable Documentation

◆ ACCESS_MASK

Definition at line 49 of file info.c.

◆ DEBUGOBJECTINFOCLASS

Definition at line 59 of file info.c.

◆ HANDLE

◆ is_wow64

◆ LPCVOID

Definition at line 48 of file info.c.

◆ MEMORY_INFORMATION_CLASS

Definition at line 48 of file info.c.

◆ OBJECT_INFORMATION_CLASS

◆ old_wow64

BOOL old_wow64
static

Definition at line 66 of file info.c.

Referenced by InitFunctionPtrs(), and test_query_basic().

◆ one_before_last_pid

DWORD one_before_last_pid = 0
static

◆ PROCESSINFOCLASS

Definition at line 45 of file info.c.

◆ PULONG

Definition at line 39 of file info.c.

◆ PVOID

Definition at line 39 of file info.c.

◆ SECTION_INHERIT

Definition at line 50 of file info.c.

◆ SIZE_T

Definition at line 47 of file info.c.

◆ THREADINFOCLASS

Definition at line 44 of file info.c.

◆ ULONG

Definition at line 39 of file info.c.

◆ ULONG_PTR

Definition at line 50 of file info.c.