ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

sysinfo.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Win32 Base API
00003  * LICENSE:         See COPYING in the top level directory
00004  * FILE:            dll/win32/kernel32/client/sysinfo.c
00005  * PURPOSE:         System Information Functions
00006  * PROGRAMMERS:     Emanuele Aliberti
00007  *                  Christoph von Wittich
00008  *                  Thomas Weidenmueller
00009  *                  Gunnar Andre Dalsnes
00010  */
00011 
00012 /* INCLUDES *******************************************************************/
00013 
00014 #include <k32.h>
00015 
00016 #define NDEBUG
00017 #include <debug.h>
00018 
00019 #define PV_NT351 0x00030033
00020 
00021 /* PRIVATE FUNCTIONS **********************************************************/
00022 
00023 VOID
00024 WINAPI
00025 GetSystemInfoInternal(IN PSYSTEM_BASIC_INFORMATION BasicInfo,
00026                       IN PSYSTEM_PROCESSOR_INFORMATION ProcInfo,
00027                       OUT LPSYSTEM_INFO SystemInfo)
00028 {
00029     RtlZeroMemory(SystemInfo, sizeof (SYSTEM_INFO));
00030     SystemInfo->wProcessorArchitecture = ProcInfo->ProcessorArchitecture;
00031     SystemInfo->wReserved = 0;
00032     SystemInfo->dwPageSize = BasicInfo->PageSize;
00033     SystemInfo->lpMinimumApplicationAddress = (PVOID)BasicInfo->MinimumUserModeAddress;
00034     SystemInfo->lpMaximumApplicationAddress = (PVOID)BasicInfo->MaximumUserModeAddress;
00035     SystemInfo->dwActiveProcessorMask = BasicInfo->ActiveProcessorsAffinityMask;
00036     SystemInfo->dwNumberOfProcessors = BasicInfo->NumberOfProcessors;
00037     SystemInfo->wProcessorLevel = ProcInfo->ProcessorLevel;
00038     SystemInfo->wProcessorRevision = ProcInfo->ProcessorRevision;
00039     SystemInfo->dwAllocationGranularity = BasicInfo->AllocationGranularity;
00040 
00041     switch (ProcInfo->ProcessorArchitecture)
00042     {
00043         case PROCESSOR_ARCHITECTURE_INTEL:
00044             switch (ProcInfo->ProcessorLevel)
00045             {
00046                 case 3:
00047                     SystemInfo->dwProcessorType = PROCESSOR_INTEL_386;
00048                     break;
00049                 case 4:
00050                     SystemInfo->dwProcessorType = PROCESSOR_INTEL_486;
00051                     break;
00052                 default:
00053                     SystemInfo->dwProcessorType = PROCESSOR_INTEL_PENTIUM;
00054             }
00055             break;
00056 
00057         case PROCESSOR_ARCHITECTURE_AMD64:
00058             SystemInfo->dwProcessorType = PROCESSOR_AMD_X8664;
00059             break;
00060 
00061         case PROCESSOR_ARCHITECTURE_IA64:
00062             SystemInfo->dwProcessorType = PROCESSOR_INTEL_IA64;
00063             break;
00064 
00065         default:
00066             SystemInfo->dwProcessorType = 0;
00067             break;
00068     }
00069 
00070     if (PV_NT351 > GetProcessVersion(0))
00071     {
00072         SystemInfo->wProcessorLevel = 0;
00073         SystemInfo->wProcessorRevision = 0;
00074     }
00075 }
00076 
00077 /* PUBLIC FUNCTIONS ***********************************************************/
00078 
00079 /*
00080  * @implemented
00081  */
00082 SIZE_T
00083 WINAPI
00084 GetLargePageMinimum(VOID)
00085 {
00086     return SharedUserData->LargePageMinimum;
00087 }
00088 
00089 /*
00090  * @implemented
00091  */
00092 VOID
00093 WINAPI
00094 GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
00095 {
00096     SYSTEM_BASIC_INFORMATION BasicInfo;
00097     SYSTEM_PROCESSOR_INFORMATION ProcInfo;
00098     NTSTATUS Status;
00099 
00100     Status = NtQuerySystemInformation(SystemBasicInformation,
00101                                       &BasicInfo,
00102                                       sizeof(BasicInfo),
00103                                       0);
00104     if (!NT_SUCCESS(Status)) return;
00105                                   
00106     Status = NtQuerySystemInformation(SystemProcessorInformation,
00107                                       &ProcInfo,
00108                                       sizeof(ProcInfo),
00109                                       0);
00110     if (!NT_SUCCESS(Status)) return;
00111     
00112     GetSystemInfoInternal(&BasicInfo, &ProcInfo, lpSystemInfo);
00113 }
00114 
00115 /*
00116  * @implemented
00117  */
00118 BOOL
00119 WINAPI
00120 IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
00121 {
00122     if (ProcessorFeature >= PROCESSOR_FEATURE_MAX) return FALSE;
00123     return ((BOOL)SharedUserData->ProcessorFeatures[ProcessorFeature]);
00124 }
00125 
00126 /*
00127  * @implemented
00128  */
00129 BOOL
00130 WINAPI
00131 GetSystemRegistryQuota(OUT PDWORD pdwQuotaAllowed,
00132                        OUT PDWORD pdwQuotaUsed)
00133 {
00134     SYSTEM_REGISTRY_QUOTA_INFORMATION QuotaInfo;
00135     ULONG BytesWritten;
00136     NTSTATUS Status;
00137 
00138     Status = NtQuerySystemInformation(SystemRegistryQuotaInformation,
00139                                       &QuotaInfo,
00140                                       sizeof(QuotaInfo),
00141                                       &BytesWritten);
00142     if (NT_SUCCESS(Status))
00143     {
00144       if (pdwQuotaAllowed) *pdwQuotaAllowed = QuotaInfo.RegistryQuotaAllowed;
00145       if (pdwQuotaUsed) *pdwQuotaUsed = QuotaInfo.RegistryQuotaUsed;
00146       return TRUE;
00147     }
00148 
00149     BaseSetLastNTError(Status);
00150     return FALSE;
00151 }
00152 
00153 /*
00154  * @implemented
00155  */
00156 VOID
00157 WINAPI
00158 GetNativeSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
00159 {
00160     SYSTEM_BASIC_INFORMATION BasicInfo;
00161     SYSTEM_PROCESSOR_INFORMATION ProcInfo;
00162     NTSTATUS Status;
00163 
00164     /* FIXME: Should be SystemNativeBasicInformation */
00165     Status = NtQuerySystemInformation(SystemBasicInformation,
00166                                       &BasicInfo,
00167                                       sizeof(BasicInfo),
00168                                       0);
00169     if (!NT_SUCCESS(Status)) return;
00170                                   
00171     /* FIXME: Should be SystemNativeProcessorInformation */
00172     Status = NtQuerySystemInformation(SystemProcessorInformation,
00173                                       &ProcInfo,
00174                                       sizeof(ProcInfo),
00175                                       0);
00176     if (!NT_SUCCESS(Status)) return;
00177     
00178     GetSystemInfoInternal(&BasicInfo, &ProcInfo, lpSystemInfo);
00179 }
00180 
00181 /*
00182  * @implemented
00183  */
00184 BOOL
00185 WINAPI
00186 GetLogicalProcessorInformation(OUT PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,
00187                                IN OUT PDWORD ReturnLength)
00188 {
00189     NTSTATUS Status;
00190 
00191     if (!ReturnLength)
00192     {
00193         SetLastError(ERROR_INVALID_PARAMETER);
00194         return FALSE;
00195     }
00196 
00197     Status = NtQuerySystemInformation(SystemLogicalProcessorInformation,
00198                                       Buffer,
00199                                       *ReturnLength,
00200                                       ReturnLength);
00201 
00202     /* Normalize the error to what Win32 expects */
00203     if (Status == STATUS_INFO_LENGTH_MISMATCH) Status = STATUS_BUFFER_TOO_SMALL;
00204     if (!NT_SUCCESS(Status))
00205     {
00206         BaseSetLastNTError(Status);
00207         return FALSE;
00208     }
00209 
00210     return TRUE;
00211 }
00212 
00213 /*
00214  * @unimplemented
00215  */
00216 BOOL
00217 WINAPI
00218 GetNumaHighestNodeNumber(OUT PULONG HighestNodeNumber)
00219 {
00220     STUB;
00221     return 0;
00222 }
00223 
00224 /*
00225  * @unimplemented
00226  */
00227 BOOL
00228 WINAPI
00229 GetNumaNodeProcessorMask(IN UCHAR Node,
00230                          OUT PULONGLONG ProcessorMask)
00231 {
00232     STUB;
00233     return 0;
00234 }
00235 
00236 /*
00237  * @unimplemented
00238  */
00239 BOOL
00240 WINAPI
00241 GetNumaProcessorNode(IN UCHAR Processor,
00242                      OUT PUCHAR NodeNumber)
00243 {
00244     STUB;
00245     return 0;
00246 }
00247 
00248 /*
00249  * @unimplemented
00250  */
00251 BOOL
00252 WINAPI
00253 GetNumaAvailableMemoryNode(IN UCHAR Node,
00254                            OUT PULONGLONG AvailableBytes)
00255 {
00256     STUB;
00257     return FALSE;
00258 }
00259 
00260 /*
00261  * @unimplemented
00262  */
00263 DWORD
00264 WINAPI
00265 GetFirmwareEnvironmentVariableW(IN LPCWSTR lpName,
00266                                 IN LPCWSTR lpGuid,
00267                                 IN PVOID pValue,
00268                                 IN DWORD nSize)
00269 {
00270     STUB;
00271     return 0;
00272 }
00273 
00274 /*
00275  * @unimplemented
00276  */
00277 BOOL
00278 WINAPI
00279 SetFirmwareEnvironmentVariableW(IN LPCWSTR lpName,
00280                                 IN LPCWSTR lpGuid,
00281                                 IN PVOID pValue,
00282                                 IN DWORD nSize)
00283 {
00284     STUB;
00285     return 0;
00286 }
00287 
00288 /*
00289  * @unimplemented
00290  */
00291 DWORD
00292 WINAPI
00293 GetFirmwareEnvironmentVariableA(IN LPCSTR lpName,
00294                                 IN LPCSTR lpGuid,
00295                                 IN PVOID pValue,
00296                                 IN DWORD nSize)
00297 {
00298     STUB;
00299     return 0;
00300 }
00301 
00302 /*
00303  * @unimplemented
00304  */
00305 BOOL
00306 WINAPI
00307 SetFirmwareEnvironmentVariableA(IN LPCSTR lpName,
00308                                 IN LPCSTR lpGuid,
00309                                 IN PVOID pValue,
00310                                 IN DWORD nSize)
00311 {
00312     STUB;
00313     return 0;
00314 }
00315 
00316 /*
00317  * @unimplemented
00318  */
00319 UINT
00320 WINAPI
00321 EnumSystemFirmwareTables(IN DWORD FirmwareTableProviderSignature,
00322                          OUT PVOID pFirmwareTableBuffer,
00323                          IN DWORD BufferSize)
00324 {
00325     STUB;
00326     return 0;
00327 }
00328 
00329 /*
00330  * @unimplemented
00331  */
00332 UINT
00333 WINAPI
00334 GetSystemFirmwareTable(IN DWORD FirmwareTableProviderSignature,
00335                        IN DWORD FirmwareTableID,
00336                        OUT PVOID pFirmwareTableBuffer,
00337                        IN DWORD BufferSize)
00338 {
00339     STUB;
00340     return 0;
00341 }
00342 
00343 /*
00344  * @unimplemented
00345  */
00346 BOOL
00347 WINAPI
00348 GetSystemFileCacheSize(OUT PSIZE_T lpMinimumFileCacheSize,
00349                        OUT PSIZE_T lpMaximumFileCacheSize,
00350                        OUT PDWORD lpFlags)
00351 {
00352     STUB;
00353     return FALSE;
00354 }
00355 
00356 /*
00357  * @unimplemented
00358  */
00359 BOOL
00360 WINAPI
00361 SetSystemFileCacheSize(IN SIZE_T MinimumFileCacheSize,
00362                        IN SIZE_T MaximumFileCacheSize,
00363                        IN DWORD Flags)
00364 {
00365     STUB;
00366     return FALSE;
00367 }

Generated on Sun May 27 2012 04:24:31 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.