Commit 3d6313c9 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Return more correct information for SystemBasicInformation and GetSystemInfo.

parent 4ee2d9d8
...@@ -367,6 +367,7 @@ VOID WINAPI GetSystemInfo( ...@@ -367,6 +367,7 @@ VOID WINAPI GetSystemInfo(
{ {
static int cache = 0; static int cache = 0;
static SYSTEM_INFO cachedsi; static SYSTEM_INFO cachedsi;
SYSTEM_BASIC_INFORMATION sbi;
TRACE("si=0x%p\n", si); TRACE("si=0x%p\n", si);
if (cache) { if (cache) {
...@@ -375,19 +376,19 @@ VOID WINAPI GetSystemInfo( ...@@ -375,19 +376,19 @@ VOID WINAPI GetSystemInfo(
} }
memset(PF,0,sizeof(PF)); memset(PF,0,sizeof(PF));
NtQuerySystemInformation( SystemBasicInformation, &sbi, sizeof(sbi), NULL );
cachedsi.dwPageSize = sbi.uPageSize;
cachedsi.lpMinimumApplicationAddress = sbi.pLowestUserAddress;
cachedsi.lpMaximumApplicationAddress = sbi.pMmHighestUserAddress;
cachedsi.dwNumberOfProcessors = sbi.uKeActiveProcessors;
cachedsi.dwAllocationGranularity = sbi.uAllocationGranularity;
/* choose sensible defaults ... /* choose sensible defaults ...
* FIXME: perhaps overridable with precompiler flags? * FIXME: perhaps overridable with precompiler flags?
*/ */
cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL; cachedsi.u.s.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.dwPageSize = getpagesize();
/* FIXME: the two entries below should be computed somehow... */
cachedsi.lpMinimumApplicationAddress = (void *)0x00010000;
cachedsi.lpMaximumApplicationAddress = (void *)0x7FFEFFFF;
cachedsi.dwActiveProcessorMask = 0; cachedsi.dwActiveProcessorMask = 0;
cachedsi.dwNumberOfProcessors = 1;
cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM; cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
cachedsi.dwAllocationGranularity = 0x10000;
cachedsi.wProcessorLevel = 5; /* 586 */ cachedsi.wProcessorLevel = 5; /* 586 */
cachedsi.wProcessorRevision = 0; cachedsi.wProcessorRevision = 0;
......
...@@ -708,17 +708,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( ...@@ -708,17 +708,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{ {
SYSTEM_BASIC_INFORMATION sbi; SYSTEM_BASIC_INFORMATION sbi;
sbi.dwUnknown1 = 0; virtual_get_system_info( &sbi );
sbi.uKeMaximumIncrement = 0;
sbi.uPageSize = 1024; /* FIXME */
sbi.uMmNumberOfPhysicalPages = 12345; /* FIXME */
sbi.uMmLowestPhysicalPage = 0; /* FIXME */
sbi.uMmHighestPhysicalPage = 12345; /* FIXME */
sbi.uAllocationGranularity = 65536; /* FIXME */
sbi.pLowestUserAddress = 0; /* FIXME */
sbi.pMmHighestUserAddress = (void*)~0; /* FIXME */
sbi.uKeActiveProcessors = 1; /* FIXME */
sbi.bKeNumberProcessors = 1; /* FIXME */
len = sizeof(sbi); len = sizeof(sbi);
if ( Length == len) if ( Length == len)
......
...@@ -135,6 +135,7 @@ extern NTSTATUS DIR_get_unix_cwd( char **cwd ); ...@@ -135,6 +135,7 @@ extern NTSTATUS DIR_get_unix_cwd( char **cwd );
extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ); extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] );
/* virtual memory */ /* virtual memory */
extern void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info );
extern NTSTATUS virtual_alloc_thread_stack( void *base, SIZE_T stack_size ); extern NTSTATUS virtual_alloc_thread_stack( void *base, SIZE_T stack_size );
extern void virtual_clear_thread_stack(void); extern void virtual_clear_thread_stack(void);
extern BOOL virtual_handle_stack_fault( void *addr ); extern BOOL virtual_handle_stack_fault( void *addr );
......
...@@ -1234,6 +1234,25 @@ void virtual_init_threading(void) ...@@ -1234,6 +1234,25 @@ void virtual_init_threading(void)
/*********************************************************************** /***********************************************************************
* virtual_get_system_info
*/
void virtual_get_system_info( SYSTEM_BASIC_INFORMATION *info )
{
info->dwUnknown1 = 0;
info->uKeMaximumIncrement = 0; /* FIXME */
info->uPageSize = page_size;
info->uMmLowestPhysicalPage = 1;
info->uMmHighestPhysicalPage = 0x7fffffff / page_size;
info->uMmNumberOfPhysicalPages = info->uMmHighestPhysicalPage - info->uMmLowestPhysicalPage;
info->uAllocationGranularity = get_mask(0) + 1;
info->pLowestUserAddress = (void *)0x10000;
info->pMmHighestUserAddress = (char *)user_space_limit - 1;
info->uKeActiveProcessors = NtCurrentTeb()->Peb->NumberOfProcessors;
info->bKeNumberProcessors = info->uKeActiveProcessors;
}
/***********************************************************************
* virtual_alloc_thread_stack * virtual_alloc_thread_stack
*/ */
NTSTATUS virtual_alloc_thread_stack( void *base, SIZE_T size ) NTSTATUS virtual_alloc_thread_stack( void *base, SIZE_T size )
......
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