3 * reactos/lib/kernel32/misc/sysinfo.c
9 #include <kernel32/kernel32.h>
12 #define PV_NT351 0x00030033
20 SYSTEM_BASIC_INFORMATION Sbi;
21 SYSTEM_PROCESSOR_INFORMATION Spi;
25 RtlZeroMemory (Si, sizeof (SYSTEM_INFO));
26 Status = NtQuerySystemInformation (
27 SystemBasicInformation, /* 0 */
32 if (STATUS_SUCCESS != Status)
34 SetLastErrorByStatus (Status);
37 Status = NtQuerySystemInformation (
38 SystemProcessorInformation, /* 1 */
43 if (STATUS_SUCCESS != Status)
45 SetLastErrorByStatus (Status);
49 * PROCESSOR_ARCHITECTURE_INTEL 0
50 * PROCESSOR_ARCHITECTURE_MIPS 1
51 * PROCESSOR_ARCHITECTURE_ALPHA 2
52 * PROCESSOR_ARCHITECTURE_PPC 3
53 * PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
55 Si->u.s.wProcessorArchitecture = Spi.ProcessorArchitecture;
56 /* For future use: always zero */
57 Si->u.s.wReserved = 0;
58 Si->dwPageSize = Sbi.PageSize;
59 Si->lpMinimumApplicationAddress = (PVOID)Sbi.MinimumUserModeAddress;
60 Si->lpMaximumApplicationAddress = (PVOID)Sbi.MaximumUserModeAddress;
61 Si->dwActiveProcessorMask = Sbi.ActiveProcessorsAffinityMask;
62 Si->dwNumberOfProcessors = Sbi.NumberOfProcessors;
64 * Compatibility (no longer relevant):
65 * PROCESSOR_INTEL_386 386
66 * PROCESSOR_INTEL_486 486
67 * PROCESSOR_INTEL_PENTIUM 586
68 * PROCESSOR_MIPS_R4000 4000
69 * PROCESSOR_ALPHA_21064 21064
71 switch (Spi.ProcessorArchitecture)
73 case PROCESSOR_ARCHITECTURE_INTEL:
74 switch (Spi.ProcessorLevel)
77 Si->dwProcessorType = PROCESSOR_INTEL_386;
80 Si->dwProcessorType = PROCESSOR_INTEL_486;
83 Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
86 /* FIXME: P2, P3, P4...? */
87 Si->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
91 case PROCESSOR_ARCHITECTURE_MIPS:
92 Si->dwProcessorType = PROCESSOR_MIPS_R4000;
95 case PROCESSOR_ARCHITECTURE_ALPHA:
96 Si->dwProcessorType = PROCESSOR_ALPHA_21064;
99 case PROCESSOR_ARCHITECTURE_PPC:
100 Si->dwProcessorType = -1; /* FIXME: what value? */
104 /* Once hardcoded to 64kb */
105 Si->dwAllocationGranularity = Sbi.AllocationGranularity;
107 Si->wProcessorLevel = Spi.ProcessorLevel;
108 Si->wProcessorRevision = Spi.ProcessorRevision;
110 * Get the version of Windows on which
111 * the process expects to run.
113 ProcessVersion = GetProcessVersion (0); /* current process */
114 /* In NT 3.1 and 3.5 these fields were always zero. */
115 if (PV_NT351 > ProcessVersion)
117 Si->wProcessorLevel = 0;
118 Si->wProcessorRevision = 0;
123 IsProcessorFeaturePresent(DWORD ProcessorFeature)
125 if (ProcessorFeature >= PROCESSOR_FEATURES_MAX)
128 return((BOOL)SharedUserData->ProcessorFeatures[ProcessorFeature]);