1 /* $Id: sysinfo.c,v 1.3 2001/02/10 22:01:50 ea Exp $
3 * reactos/lib/kernel32/misc/sysinfo.c
8 #include <kernel32/kernel32.h>
9 #include <kernel32/error.h>
11 #define WIN32_LEAN_AND_MEAN
15 #define PV_NT351 0x00030033
23 SYSTEM_BASIC_INFORMATION Sbi
;
24 SYSTEM_PROCESSOR_INFORMATION Spi
;
28 RtlZeroMemory (Si
, sizeof (SYSTEM_INFO
));
29 Status
= NtQuerySystemInformation (
30 SystemBasicInformation
, /* 0 */
35 if (STATUS_SUCCESS
!= Status
)
37 SetLastErrorByStatus (Status
);
40 Status
= NtQuerySystemInformation (
41 SystemProcessorInformation
, /* 1 */
46 if (STATUS_SUCCESS
!= Status
)
48 SetLastErrorByStatus (Status
);
52 * PROCESSOR_ARCHITECTURE_INTEL 0
53 * PROCESSOR_ARCHITECTURE_MIPS 1
54 * PROCESSOR_ARCHITECTURE_ALPHA 2
55 * PROCESSOR_ARCHITECTURE_PPC 3
56 * PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
58 Si
->u
.s
.wProcessorArchitecture
= Spi
.ProcessorArchitecture
;
59 /* For future use: always zero */
60 Si
->u
.s
.wReserved
= 0;
61 Si
->dwPageSize
= Sbi
.PageSize
;
62 Si
->lpMinimumApplicationAddress
= (PVOID
)Sbi
.MinimumUserModeAddress
;
63 Si
->lpMaximumApplicationAddress
= (PVOID
)Sbi
.MaximumUserModeAddress
;
64 Si
->dwActiveProcessorMask
= Sbi
.ActiveProcessorsAffinityMask
;
65 Si
->dwNumberOfProcessors
= Sbi
.NumberOfProcessors
;
67 * Compatibility (no longer relevant):
68 * PROCESSOR_INTEL_386 386
69 * PROCESSOR_INTEL_486 486
70 * PROCESSOR_INTEL_PENTIUM 586
71 * PROCESSOR_MIPS_R4000 4000
72 * PROCESSOR_ALPHA_21064 21064
74 switch (Spi
.ProcessorArchitecture
)
76 case PROCESSOR_ARCHITECTURE_INTEL
:
77 switch (Spi
.ProcessorLevel
)
80 Si
->dwProcessorType
= PROCESSOR_INTEL_386
;
83 Si
->dwProcessorType
= PROCESSOR_INTEL_486
;
86 Si
->dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
89 /* FIXME: P2, P3, P4...? */
90 Si
->dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
94 case PROCESSOR_ARCHITECTURE_MIPS
:
95 Si
->dwProcessorType
= PROCESSOR_MIPS_R4000
;
98 case PROCESSOR_ARCHITECTURE_ALPHA
:
99 Si
->dwProcessorType
= PROCESSOR_ALPHA_21064
;
102 case PROCESSOR_ARCHITECTURE_PPC
:
103 Si
->dwProcessorType
= -1; /* FIXME: what value? */
107 /* Once hardcoded to 64kb */
108 Si
->dwAllocationGranularity
= Sbi
.AllocationGranularity
;
110 Si
->wProcessorLevel
= Spi
.ProcessorLevel
;
111 Si
->wProcessorRevision
= Spi
.ProcessorRevision
;
113 * Get the version of Windows on which
114 * the process expects to run.
116 ProcessVersion
= GetProcessVersion (0); /* current process */
117 /* In NT 3.1 and 3.5 these fields were always zero. */
118 if (PV_NT351
> ProcessVersion
)
120 Si
->wProcessorLevel
= 0;
121 Si
->wProcessorRevision
= 0;