ntdll: Return more correct information for SystemBasicInformation and GetSystemInfo.

This commit is contained in:
Alexandre Julliard 2008-11-03 13:23:48 +01:00
parent 4ee2d9d8eb
commit 3d6313c9ce
4 changed files with 29 additions and 18 deletions

View File

@ -367,6 +367,7 @@ VOID WINAPI GetSystemInfo(
{
static int cache = 0;
static SYSTEM_INFO cachedsi;
SYSTEM_BASIC_INFORMATION sbi;
TRACE("si=0x%p\n", si);
if (cache) {
@ -375,19 +376,19 @@ VOID WINAPI GetSystemInfo(
}
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 ...
* FIXME: perhaps overridable with precompiler flags?
*/
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.dwNumberOfProcessors = 1;
cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
cachedsi.dwAllocationGranularity = 0x10000;
cachedsi.wProcessorLevel = 5; /* 586 */
cachedsi.wProcessorRevision = 0;

View File

@ -708,17 +708,7 @@ NTSTATUS WINAPI NtQuerySystemInformation(
{
SYSTEM_BASIC_INFORMATION sbi;
sbi.dwUnknown1 = 0;
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 */
virtual_get_system_info( &sbi );
len = sizeof(sbi);
if ( Length == len)

View File

@ -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] );
/* 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 void virtual_clear_thread_stack(void);
extern BOOL virtual_handle_stack_fault( void *addr );

View File

@ -1233,6 +1233,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
*/