2004-06-13 20:04:56 +00:00
|
|
|
/* $Id: sysinfo.c,v 1.13 2004/06/13 20:04:56 navaraf Exp $
|
2000-04-25 23:22:57 +00:00
|
|
|
*
|
|
|
|
* reactos/lib/kernel32/misc/sysinfo.c
|
|
|
|
*
|
|
|
|
*/
|
2003-01-15 21:24:36 +00:00
|
|
|
#include <k32.h>
|
2000-04-25 23:22:57 +00:00
|
|
|
|
2003-01-15 21:24:36 +00:00
|
|
|
#define NDEBUG
|
2004-01-23 21:16:04 +00:00
|
|
|
#include "../include/debug.h"
|
2002-09-08 10:23:54 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
#define PV_NT351 0x00030033
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2000-04-25 23:22:57 +00:00
|
|
|
VOID
|
|
|
|
STDCALL
|
|
|
|
GetSystemInfo (
|
|
|
|
LPSYSTEM_INFO Si
|
|
|
|
)
|
|
|
|
{
|
|
|
|
SYSTEM_BASIC_INFORMATION Sbi;
|
|
|
|
SYSTEM_PROCESSOR_INFORMATION Spi;
|
|
|
|
DWORD ProcessVersion;
|
|
|
|
NTSTATUS Status;
|
|
|
|
|
|
|
|
RtlZeroMemory (Si, sizeof (SYSTEM_INFO));
|
|
|
|
Status = NtQuerySystemInformation (
|
|
|
|
SystemBasicInformation, /* 0 */
|
|
|
|
& Sbi,
|
|
|
|
sizeof Sbi, /* 44 */
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
Status = NtQuerySystemInformation (
|
|
|
|
SystemProcessorInformation, /* 1 */
|
|
|
|
& Spi,
|
|
|
|
sizeof Spi, /* 12 */
|
|
|
|
0
|
|
|
|
);
|
|
|
|
if (STATUS_SUCCESS != Status)
|
|
|
|
{
|
|
|
|
SetLastErrorByStatus (Status);
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* PROCESSOR_ARCHITECTURE_INTEL 0
|
|
|
|
* PROCESSOR_ARCHITECTURE_MIPS 1
|
|
|
|
* PROCESSOR_ARCHITECTURE_ALPHA 2
|
|
|
|
* PROCESSOR_ARCHITECTURE_PPC 3
|
|
|
|
* PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
|
|
|
|
*/
|
2004-06-13 20:04:56 +00:00
|
|
|
Si->wProcessorArchitecture = Spi.ProcessorArchitecture;
|
2000-04-25 23:22:57 +00:00
|
|
|
/* For future use: always zero */
|
2004-06-13 20:04:56 +00:00
|
|
|
Si->wReserved = 0;
|
2003-07-17 16:57:39 +00:00
|
|
|
Si->dwPageSize = Sbi.PhysicalPageSize;
|
|
|
|
Si->lpMinimumApplicationAddress = (PVOID)Sbi.LowestUserAddress;
|
|
|
|
Si->lpMaximumApplicationAddress = (PVOID)Sbi.HighestUserAddress;
|
|
|
|
Si->dwActiveProcessorMask = Sbi.ActiveProcessors;
|
|
|
|
Si->dwNumberOfProcessors = Sbi.NumberProcessors;
|
2000-04-25 23:22:57 +00:00
|
|
|
/*
|
2001-02-10 22:01:50 +00:00
|
|
|
* Compatibility (no longer relevant):
|
2000-04-25 23:22:57 +00:00
|
|
|
* PROCESSOR_INTEL_386 386
|
|
|
|
* PROCESSOR_INTEL_486 486
|
|
|
|
* PROCESSOR_INTEL_PENTIUM 586
|
|
|
|
* PROCESSOR_MIPS_R4000 4000
|
|
|
|
* PROCESSOR_ALPHA_21064 21064
|
|
|
|
*/
|
2000-11-04 13:52:12 +00:00
|
|
|
switch (Spi.ProcessorArchitecture)
|
2000-04-25 23:22:57 +00:00
|
|
|
{
|
2001-02-10 22:01:50 +00:00
|
|
|
case PROCESSOR_ARCHITECTURE_INTEL:
|
|
|
|
switch (Spi.ProcessorLevel)
|
|
|
|
{
|
|
|
|
case 3:
|
|
|
|
Si->dwProcessorType = PROCESSOR_INTEL_386;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
Si->dwProcessorType = PROCESSOR_INTEL_486;
|
|
|
|
break;
|
|
|
|
case 5:
|
|
|
|
Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
/* FIXME: P2, P3, P4...? */
|
|
|
|
Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROCESSOR_ARCHITECTURE_MIPS:
|
|
|
|
Si->dwProcessorType = PROCESSOR_MIPS_R4000;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case PROCESSOR_ARCHITECTURE_ALPHA:
|
|
|
|
Si->dwProcessorType = PROCESSOR_ALPHA_21064;
|
|
|
|
break;
|
2004-05-31 11:41:14 +00:00
|
|
|
|
|
|
|
case PROCESSOR_ARCHITECTURE_IA64:
|
|
|
|
Si->dwProcessorType = PROCESSOR_INTEL_IA64;
|
|
|
|
break;
|
|
|
|
|
2001-02-10 22:01:50 +00:00
|
|
|
case PROCESSOR_ARCHITECTURE_PPC:
|
2004-03-09 16:35:15 +00:00
|
|
|
switch (Spi.ProcessorLevel)
|
2004-05-31 11:41:14 +00:00
|
|
|
{
|
|
|
|
case 1:
|
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_601;
|
|
|
|
break;
|
2004-03-09 16:35:15 +00:00
|
|
|
case 3:
|
2004-05-31 11:41:14 +00:00
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_603;
|
|
|
|
break;
|
|
|
|
case 4:
|
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_604;
|
|
|
|
break;
|
|
|
|
case 6:
|
|
|
|
/* PPC 603+ */
|
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_603;
|
|
|
|
break;
|
|
|
|
case 9:
|
|
|
|
/* PPC 604+ */
|
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_604;
|
|
|
|
break;
|
|
|
|
case 20:
|
|
|
|
Si->dwProcessorType = PROCESSOR_PPC_620;
|
|
|
|
break;
|
|
|
|
default:
|
2004-03-09 16:35:15 +00:00
|
|
|
Si->dwProcessorType = -1;
|
|
|
|
}
|
2000-04-25 23:22:57 +00:00
|
|
|
break;
|
2001-02-10 22:01:50 +00:00
|
|
|
|
2000-04-25 23:22:57 +00:00
|
|
|
}
|
2001-02-10 22:01:50 +00:00
|
|
|
/* Once hardcoded to 64kb */
|
2000-11-04 13:52:12 +00:00
|
|
|
Si->dwAllocationGranularity = Sbi.AllocationGranularity;
|
2001-02-10 22:01:50 +00:00
|
|
|
/* */
|
|
|
|
Si->wProcessorLevel = Spi.ProcessorLevel;
|
2000-11-04 13:52:12 +00:00
|
|
|
Si->wProcessorRevision = Spi.ProcessorRevision;
|
2000-04-25 23:22:57 +00:00
|
|
|
/*
|
|
|
|
* Get the version of Windows on which
|
|
|
|
* the process expects to run.
|
|
|
|
*/
|
|
|
|
ProcessVersion = GetProcessVersion (0); /* current process */
|
2001-02-10 22:01:50 +00:00
|
|
|
/* In NT 3.1 and 3.5 these fields were always zero. */
|
2000-04-25 23:22:57 +00:00
|
|
|
if (PV_NT351 > ProcessVersion)
|
|
|
|
{
|
|
|
|
Si->wProcessorLevel = 0;
|
|
|
|
Si->wProcessorRevision = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2003-07-10 18:50:51 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* @unimplemented
|
|
|
|
*/
|
2003-02-12 03:44:20 +00:00
|
|
|
BOOL STDCALL
|
|
|
|
IsProcessorFeaturePresent(DWORD ProcessorFeature)
|
|
|
|
{
|
|
|
|
if (ProcessorFeature >= PROCESSOR_FEATURES_MAX)
|
|
|
|
return(FALSE);
|
|
|
|
|
|
|
|
return((BOOL)SharedUserData->ProcessorFeatures[ProcessorFeature]);
|
|
|
|
}
|
2000-04-25 23:22:57 +00:00
|
|
|
|
|
|
|
/* EOF */
|