3 * reactos/lib/kernel32/misc/sysinfo.c
9 #include "../include/debug.h"
12 #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
->wProcessorArchitecture
= Spi
.ProcessorArchitecture
;
59 /* For future use: always zero */
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_IA64
:
103 Si
->dwProcessorType
= PROCESSOR_INTEL_IA64
;
106 case PROCESSOR_ARCHITECTURE_PPC
:
107 switch (Spi
.ProcessorLevel
)
110 Si
->dwProcessorType
= PROCESSOR_PPC_601
;
113 Si
->dwProcessorType
= PROCESSOR_PPC_603
;
116 Si
->dwProcessorType
= PROCESSOR_PPC_604
;
120 Si
->dwProcessorType
= PROCESSOR_PPC_603
;
124 Si
->dwProcessorType
= PROCESSOR_PPC_604
;
127 Si
->dwProcessorType
= PROCESSOR_PPC_620
;
130 Si
->dwProcessorType
= -1;
135 /* Once hardcoded to 64kb */
136 Si
->dwAllocationGranularity
= Sbi
.AllocationGranularity
;
138 Si
->wProcessorLevel
= Spi
.ProcessorLevel
;
139 Si
->wProcessorRevision
= Spi
.ProcessorRevision
;
141 * Get the version of Windows on which
142 * the process expects to run.
144 ProcessVersion
= GetProcessVersion (0); /* current process */
145 /* In NT 3.1 and 3.5 these fields were always zero. */
146 if (PV_NT351
> ProcessVersion
)
148 Si
->wProcessorLevel
= 0;
149 Si
->wProcessorRevision
= 0;
158 IsProcessorFeaturePresent(DWORD ProcessorFeature
)
160 if (ProcessorFeature
>= PROCESSOR_FEATURE_MAX
)
163 return((BOOL
)SharedUserData
->ProcessorFeatures
[ProcessorFeature
]);
172 GetSystemRegistryQuota(PDWORD pdwQuotaAllowed
,
175 SYSTEM_REGISTRY_QUOTA_INFORMATION srqi
;
179 Status
= NtQuerySystemInformation(SystemRegistryQuotaInformation
,
183 if(NT_SUCCESS(Status
))
185 if(pdwQuotaAllowed
!= NULL
)
187 *pdwQuotaAllowed
= srqi
.RegistryQuotaAllowed
;
189 if(pdwQuotaUsed
!= NULL
)
191 *pdwQuotaUsed
= srqi
.RegistryQuotaUsed
;
197 SetLastErrorByStatus(Status
);
207 LPSYSTEM_INFO lpSystemInfo
210 //FIXME: GetNativeSystemInfo should return always the real Hardware Processorarchitecture
211 // in case a Program is running in 32bit Mode on AMD64
212 // GetSystemInfo should return PROCESSOR_ARCHITECTURE_INTEL and
213 // GetNativeSystemInfo should return PROCESSOR_ARCHITECTURE_AMD64
214 GetSystemInfo(lpSystemInfo
);