3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS system libraries
5 * FILE: dll/win32/kernel32/misc/sysinfo.c
6 * PURPOSE: SystemInfo functions
7 * PROGRAMMER: Emanuele Aliberti
8 * Christoph von Wittich
10 * Gunnar Andre Dalsnes
21 #define PV_NT351 0x00030033
28 GetLargePageMinimum(VOID
)
30 return SharedUserData
->LargePageMinimum
;
42 SYSTEM_BASIC_INFORMATION Sbi
;
43 SYSTEM_PROCESSOR_INFORMATION Spi
;
47 RtlZeroMemory (Si
, sizeof (SYSTEM_INFO
));
48 Status
= NtQuerySystemInformation (
49 SystemBasicInformation
, /* 0 */
54 if (STATUS_SUCCESS
!= Status
)
56 SetLastErrorByStatus (Status
);
59 Status
= NtQuerySystemInformation (
60 SystemProcessorInformation
, /* 1 */
65 if (STATUS_SUCCESS
!= Status
)
67 SetLastErrorByStatus (Status
);
71 * PROCESSOR_ARCHITECTURE_INTEL 0
72 * PROCESSOR_ARCHITECTURE_MIPS 1
73 * PROCESSOR_ARCHITECTURE_ALPHA 2
74 * PROCESSOR_ARCHITECTURE_PPC 3
75 * PROCESSOR_ARCHITECTURE_UNKNOWN 0xFFFF
77 Si
->wProcessorArchitecture
= Spi
.ProcessorArchitecture
;
78 /* For future use: always zero */
80 Si
->dwPageSize
= Sbi
.PageSize
;
81 Si
->lpMinimumApplicationAddress
= (PVOID
)Sbi
.MinimumUserModeAddress
;
82 Si
->lpMaximumApplicationAddress
= (PVOID
)Sbi
.MaximumUserModeAddress
;
83 Si
->dwActiveProcessorMask
= Sbi
.ActiveProcessorsAffinityMask
;
84 Si
->dwNumberOfProcessors
= Sbi
.NumberOfProcessors
;
86 * Compatibility (no longer relevant):
87 * PROCESSOR_INTEL_386 386
88 * PROCESSOR_INTEL_486 486
89 * PROCESSOR_INTEL_PENTIUM 586
90 * PROCESSOR_MIPS_R4000 4000
91 * PROCESSOR_ALPHA_21064 21064
93 switch (Spi
.ProcessorArchitecture
)
95 case PROCESSOR_ARCHITECTURE_INTEL
:
96 switch (Spi
.ProcessorLevel
)
99 Si
->dwProcessorType
= PROCESSOR_INTEL_386
;
102 Si
->dwProcessorType
= PROCESSOR_INTEL_486
;
105 Si
->dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
108 /* FIXME: P2, P3, P4...? */
109 Si
->dwProcessorType
= PROCESSOR_INTEL_PENTIUM
;
113 case PROCESSOR_ARCHITECTURE_MIPS
:
114 Si
->dwProcessorType
= PROCESSOR_MIPS_R4000
;
117 case PROCESSOR_ARCHITECTURE_ALPHA
:
118 Si
->dwProcessorType
= PROCESSOR_ALPHA_21064
;
121 case PROCESSOR_ARCHITECTURE_IA64
:
122 Si
->dwProcessorType
= PROCESSOR_INTEL_IA64
;
125 case PROCESSOR_ARCHITECTURE_PPC
:
126 switch (Spi
.ProcessorLevel
)
129 Si
->dwProcessorType
= PROCESSOR_PPC_601
;
132 Si
->dwProcessorType
= PROCESSOR_PPC_603
;
135 Si
->dwProcessorType
= PROCESSOR_PPC_604
;
139 Si
->dwProcessorType
= PROCESSOR_PPC_603
;
143 Si
->dwProcessorType
= PROCESSOR_PPC_604
;
146 Si
->dwProcessorType
= PROCESSOR_PPC_620
;
149 Si
->dwProcessorType
= 0;
154 /* Once hardcoded to 64kb */
155 Si
->dwAllocationGranularity
= Sbi
.AllocationGranularity
;
157 Si
->wProcessorLevel
= Spi
.ProcessorLevel
;
158 Si
->wProcessorRevision
= Spi
.ProcessorRevision
;
160 * Get the version of Windows on which
161 * the process expects to run.
163 ProcessVersion
= GetProcessVersion (0); /* current process */
164 /* In NT 3.1 and 3.5 these fields were always zero. */
165 if (PV_NT351
> ProcessVersion
)
167 Si
->wProcessorLevel
= 0;
168 Si
->wProcessorRevision
= 0;
177 IsProcessorFeaturePresent(DWORD ProcessorFeature
)
179 if (ProcessorFeature
>= PROCESSOR_FEATURE_MAX
)
182 return((BOOL
)SharedUserData
->ProcessorFeatures
[ProcessorFeature
]);
191 GetSystemRegistryQuota(PDWORD pdwQuotaAllowed
,
194 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi
;
198 Status
= NtQuerySystemInformation(SystemRegistryQuotaInformation
,
202 if(NT_SUCCESS(Status
))
204 if(pdwQuotaAllowed
!= NULL
)
206 *pdwQuotaAllowed
= srqi
.RegistryQuotaAllowed
;
208 if(pdwQuotaUsed
!= NULL
)
210 *pdwQuotaUsed
= srqi
.RegistryQuotaUsed
;
216 SetLastErrorByStatus(Status
);
226 LPSYSTEM_INFO lpSystemInfo
229 //FIXME: GetNativeSystemInfo should return always the real Hardware Processorarchitecture
230 // in case a Program is running in 32bit Mode on AMD64
231 // GetSystemInfo should return PROCESSOR_ARCHITECTURE_INTEL and
232 // GetNativeSystemInfo should return PROCESSOR_ARCHITECTURE_AMD64
233 GetSystemInfo(lpSystemInfo
);
241 GetLogicalProcessorInformation(OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer
,
242 IN OUT PDWORD ReturnLength
)
248 SetLastError(ERROR_INVALID_PARAMETER
);
252 Status
= NtQuerySystemInformation(SystemLogicalProcessorInformation
,
257 if (!NT_SUCCESS(Status
))
260 * When NtQuerySystemInformation says STATUS_INFO_LENGTH_MISMATCH,
261 * return ERROR_INSUFFICIENT_BUFFER instead of ERROR_BAD_LENGTH.
263 SetLastErrorByStatus(Status
== STATUS_INFO_LENGTH_MISMATCH
264 ? STATUS_BUFFER_TOO_SMALL