Author: weiden
Date: Tue Oct 3 20:25:13 2006
New Revision: 24374
URL:
http://svn.reactos.org/svn/reactos?rev=24374&view=rev
Log:
Fix displaying the size of the RAM
Modified:
trunk/reactos/dll/cpl/sysdm/en.rc
trunk/reactos/dll/cpl/sysdm/general.c
trunk/reactos/dll/cpl/sysdm/precomp.h
trunk/reactos/dll/cpl/sysdm/resource.h
trunk/reactos/dll/cpl/sysdm/sysdm.rbuild
Modified: trunk/reactos/dll/cpl/sysdm/en.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/en.rc?rev=24…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/en.rc (original)
+++ trunk/reactos/dll/cpl/sysdm/en.rc Tue Oct 3 20:25:13 2006
@@ -283,4 +283,8 @@
BEGIN
IDS_CPLSYSTEMNAME "System"
IDS_CPLSYSTEMDESCRIPTION "See information about your computer and change various
system and hardware settings."
-END
+ IDS_MEGABYTE "MB of RAM"
+ IDS_GIGABYTE "GB of RAM"
+ IDS_TERABYTE "TB of RAM"
+ IDS_PETABYTE "PB of RAM"
+END
Modified: trunk/reactos/dll/cpl/sysdm/general.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/general.c?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/general.c (original)
+++ trunk/reactos/dll/cpl/sysdm/general.c Tue Oct 3 20:25:13 2006
@@ -131,12 +131,12 @@
{
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,16 +145,14 @@
}
}
-
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 *
@@ -187,14 +185,56 @@
/* Get total physical RAM */
MemStat.dwLength = sizeof(MemStat);
- GlobalMemoryStatus(&MemStat);
-
- 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 (GlobalMemoryStatusEx(&MemStat))
+ {
+ TCHAR szStr[32];
+ double dTotalPhys;
+ UINT i = 0;
+ static const UINT uStrId[] = {
+ IDS_MEGABYTE,
+ IDS_GIGABYTE,
+ IDS_TERABYTE,
+ IDS_PETABYTE
+ };
+
+ 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)
{
Modified: trunk/reactos/dll/cpl/sysdm/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/precomp.h?re…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/precomp.h (original)
+++ trunk/reactos/dll/cpl/sysdm/precomp.h Tue Oct 3 20:25:13 2006
@@ -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);
Modified: trunk/reactos/dll/cpl/sysdm/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/resource.h?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/resource.h (original)
+++ trunk/reactos/dll/cpl/sysdm/resource.h Tue Oct 3 20:25:13 2006
@@ -13,6 +13,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 */
Modified: trunk/reactos/dll/cpl/sysdm/sysdm.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/sysdm.rbuild…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/sysdm.rbuild (original)
+++ trunk/reactos/dll/cpl/sysdm/sysdm.rbuild Tue Oct 3 20:25:13 2006
@@ -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>