Commit 5071a287 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Implement SystemEmulation* information classes.

parent 0e64e056
......@@ -2161,11 +2161,14 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
switch (class)
{
case SystemNativeBasicInformation: /* 114 */
if (!is_win64) return STATUS_INVALID_INFO_CLASS;
/* fall through */
case SystemBasicInformation: /* 0 */
{
SYSTEM_BASIC_INFORMATION sbi;
virtual_get_system_info( &sbi );
virtual_get_system_info( &sbi, FALSE );
len = sizeof(sbi);
if (size == len)
{
......@@ -2659,6 +2662,37 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
break;
}
case SystemEmulationBasicInformation: /* 62 */
{
SYSTEM_BASIC_INFORMATION sbi;
virtual_get_system_info( &sbi, !!NtCurrentTeb()->WowTebOffset );
len = sizeof(sbi);
if (size == len)
{
if (!info) ret = STATUS_ACCESS_VIOLATION;
else memcpy( info, &sbi, len);
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
break;
}
case SystemEmulationProcessorInformation: /* 63 */
if (size >= (len = sizeof(cpu_info)))
{
SYSTEM_CPU_INFORMATION cpu = cpu_info;
if (is_win64)
{
if (cpu_info.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64)
cpu.ProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
else if (cpu_info.ProcessorArchitecture == PROCESSOR_ARCHITECTURE_ARM64)
cpu.ProcessorArchitecture = PROCESSOR_ARCHITECTURE_ARM;
}
memcpy(info, &cpu, len);
}
else ret = STATUS_INFO_LENGTH_MISMATCH;
break;
case SystemExtendedHandleInformation: /* 64 */
{
struct handle_info *handle_info;
......
......@@ -198,7 +198,7 @@ extern void *anon_mmap_fixed( void *start, size_t size, int prot, int flags ) DE
extern void *anon_mmap_alloc( size_t size, int prot ) DECLSPEC_HIDDEN;
extern void virtual_init(void) DECLSPEC_HIDDEN;
extern ULONG_PTR get_system_affinity_mask(void) DECLSPEC_HIDDEN;
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info ) DECLSPEC_HIDDEN;
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 ) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_map_builtin_module( HANDLE mapping, void **module, SIZE_T *size,
SECTION_IMAGE_INFORMATION *info, WORD machine, BOOL prefer_native ) DECLSPEC_HIDDEN;
extern NTSTATUS virtual_create_builtin_view( void *module, const UNICODE_STRING *nt_name,
......
......@@ -2682,7 +2682,7 @@ ULONG_PTR get_system_affinity_mask(void)
/***********************************************************************
* virtual_get_system_info
*/
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info, BOOL wow64 )
{
#if defined(HAVE_STRUCT_SYSINFO_TOTALRAM) && defined(HAVE_STRUCT_SYSINFO_MEM_UNIT)
struct sysinfo sinfo;
......@@ -2707,9 +2707,19 @@ void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
info->MmNumberOfPhysicalPages = info->MmHighestPhysicalPage - info->MmLowestPhysicalPage;
info->AllocationGranularity = granularity_mask + 1;
info->LowestUserAddress = (void *)0x10000;
info->HighestUserAddress = (char *)user_space_limit - 1;
info->ActiveProcessorsAffinityMask = get_system_affinity_mask();
info->NumberOfProcessors = peb->NumberOfProcessors;
#ifdef _WIN64
if (wow64)
{
if (main_image_info.ImageCharacteristics & IMAGE_FILE_LARGE_ADDRESS_AWARE)
info->HighestUserAddress = (char *)0xc0000000 - 1;
else
info->HighestUserAddress = (char *)0x7fff0000 - 1;
return;
}
#endif
info->HighestUserAddress = (char *)user_space_limit - 1;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment