mirror of
https://github.com/reactos/reactos.git
synced 2025-02-24 01:15:09 +00:00
Fix displaying the size of the RAM
svn path=/trunk/; revision=24374
This commit is contained in:
parent
30189808bf
commit
7b5fcdd9fa
5 changed files with 62 additions and 16 deletions
|
@ -283,4 +283,8 @@ STRINGTABLE DISCARDABLE
|
|||
BEGIN
|
||||
IDS_CPLSYSTEMNAME "System"
|
||||
IDS_CPLSYSTEMDESCRIPTION "See information about your computer and change various system and hardware settings."
|
||||
IDS_MEGABYTE "MB of RAM"
|
||||
IDS_GIGABYTE "GB of RAM"
|
||||
IDS_TERABYTE "TB of RAM"
|
||||
IDS_PETABYTE "PB of RAM"
|
||||
END
|
||||
|
|
|
@ -131,12 +131,12 @@ SetProcSpeed(HWND hwnd,
|
|||
{
|
||||
if (dwBuf < 1000)
|
||||
{
|
||||
wsprintf(szBuf, _T("%lu MHz"), dwBuf);
|
||||
_stprintf(szBuf, _T("%lu MHz"), dwBuf);
|
||||
}
|
||||
else
|
||||
{
|
||||
double flt = dwBuf / 1000.0;
|
||||
wsprintf(szBuf, _T("%l GHz"), flt);
|
||||
_stprintf(szBuf, _T("%l GHz"), flt);
|
||||
}
|
||||
|
||||
SetDlgItemText(hwnd,
|
||||
|
@ -145,18 +145,16 @@ SetProcSpeed(HWND hwnd,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
static VOID
|
||||
GetSystemInformation(HWND hwnd)
|
||||
{
|
||||
HKEY hKey;
|
||||
TCHAR ProcKey[] = _T("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
|
||||
MEMORYSTATUS MemStat;
|
||||
MEMORYSTATUSEX MemStat;
|
||||
TCHAR Buf[32];
|
||||
INT Ret = 0;
|
||||
|
||||
|
||||
|
||||
/* Get Processor information *
|
||||
* although undocumented, this information is being pulled
|
||||
* directly out of the registry instead of via setupapi as it
|
||||
|
@ -187,14 +185,56 @@ GetSystemInformation(HWND hwnd)
|
|||
|
||||
/* Get total physical RAM */
|
||||
MemStat.dwLength = sizeof(MemStat);
|
||||
GlobalMemoryStatus(&MemStat);
|
||||
if (GlobalMemoryStatusEx(&MemStat))
|
||||
{
|
||||
TCHAR szStr[32];
|
||||
double dTotalPhys;
|
||||
UINT i = 0;
|
||||
static const UINT uStrId[] = {
|
||||
IDS_MEGABYTE,
|
||||
IDS_GIGABYTE,
|
||||
IDS_TERABYTE,
|
||||
IDS_PETABYTE
|
||||
};
|
||||
|
||||
if (MemStat.dwTotalPhys < KB_DIV)
|
||||
Ret = wsprintf(Buf, _T("%luKB of RAM"), MemStat.dwTotalPhys/KB_DIV);
|
||||
else if (MemStat.dwTotalPhys >= KB_DIV && MemStat.dwTotalPhys < GB_DIV)
|
||||
Ret = wsprintf(Buf, _T("%luMB of RAM"), MemStat.dwTotalPhys/MB_DIV);
|
||||
else if (MemStat.dwTotalPhys > GB_DIV)
|
||||
Ret = wsprintf(Buf, _T("%luGB of RAM"), MemStat.dwTotalPhys/GB_DIV);
|
||||
if (MemStat.ullTotalPhys > 1024 * 1024 * 1024)
|
||||
{
|
||||
/* We're dealing with GBs or more */
|
||||
MemStat.ullTotalPhys /= 1024 * 1024;
|
||||
i++;
|
||||
|
||||
if (MemStat.ullTotalPhys > 1024 * 1024)
|
||||
{
|
||||
/* We're dealing with TBs or more */
|
||||
MemStat.ullTotalPhys /= 1024;
|
||||
i++;
|
||||
|
||||
if (MemStat.ullTotalPhys > 1024 * 1024)
|
||||
{
|
||||
/* We're dealing with PBs or more */
|
||||
|
||||
MemStat.ullTotalPhys /= 1024;
|
||||
i++;
|
||||
|
||||
dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
|
||||
}
|
||||
else
|
||||
dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
|
||||
}
|
||||
else
|
||||
dTotalPhys = (double)MemStat.ullTotalPhys / 1024;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We're daling with MBs */
|
||||
dTotalPhys = (double)MemStat.ullTotalPhys / 1024 / 1024;
|
||||
}
|
||||
|
||||
if (LoadString(hApplet, uStrId[i], szStr, sizeof(szStr) / sizeof(szStr[0])))
|
||||
{
|
||||
Ret = _stprintf(Buf, _T("%.2f %s"), dTotalPhys, szStr);
|
||||
}
|
||||
}
|
||||
|
||||
if (Ret)
|
||||
{
|
||||
|
|
|
@ -11,9 +11,6 @@
|
|||
#include "resource.h"
|
||||
|
||||
#define NUM_APPLETS (1)
|
||||
#define KB_DIV 1024
|
||||
#define MB_DIV 1048576
|
||||
#define GB_DIV 1.0737e9
|
||||
|
||||
typedef LONG (CALLBACK *APPLET_INITPROC)(VOID);
|
||||
|
||||
|
|
|
@ -14,6 +14,11 @@
|
|||
#define IDS_CPLSYSTEMNAME 60
|
||||
#define IDS_CPLSYSTEMDESCRIPTION 61
|
||||
|
||||
#define IDS_MEGABYTE 62
|
||||
#define IDS_GIGABYTE 63
|
||||
#define IDS_TERABYTE 64
|
||||
#define IDS_PETABYTE 65
|
||||
|
||||
|
||||
/* propsheet - general */
|
||||
#define IDD_PROPPAGEGENERAL 100
|
||||
|
|
|
@ -8,12 +8,12 @@
|
|||
<define name="WINVER">0x501</define>
|
||||
<library>kernel32</library>
|
||||
<library>advapi32</library>
|
||||
<library>msvcrt</library>
|
||||
<library>user32</library>
|
||||
<library>gdi32</library>
|
||||
<library>comctl32</library>
|
||||
<library>netapi32</library>
|
||||
<library>ntdll</library>
|
||||
<library>msvcrt</library>
|
||||
<library>msimg32</library>
|
||||
<library>shell32</library>
|
||||
<file>advanced.c</file>
|
||||
|
|
Loading…
Reference in a new issue