Hans Leidekker : wbemprox: Implement Win32_ComputerSystem. TotalPhysicalMemory.

Alexandre Julliard julliard at winehq.org
Wed Jun 27 19:14:00 CDT 2012


Module: wine
Branch: master
Commit: 0c899bf440d6f76cc17e5ed0993fbd7b71056742
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=0c899bf440d6f76cc17e5ed0993fbd7b71056742

Author: Hans Leidekker <hans at codeweavers.com>
Date:   Wed Jun 27 11:35:45 2012 +0200

wbemprox: Implement Win32_ComputerSystem.TotalPhysicalMemory.

---

 dlls/wbemprox/builtin.c |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c
index a41679a..a40fff6 100644
--- a/dlls/wbemprox/builtin.c
+++ b/dlls/wbemprox/builtin.c
@@ -99,7 +99,10 @@ static const WCHAR prop_systemdirectoryW[] =
     {'S','y','s','t','e','m','D','i','r','e','c','t','o','r','y',0};
 static const WCHAR prop_threadcountW[] =
     {'T','h','r','e','a','d','C','o','u','n','t',0};
+static const WCHAR prop_totalphysicalmemoryW[] =
+    {'T','o','t','a','l','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0};
 
+/* column definitions must be kept in sync with record structures below */
 static const struct column col_bios[] =
 {
     { prop_descriptionW,  CIM_STRING },
@@ -113,7 +116,8 @@ static const struct column col_compsys[] =
     { prop_manufacturerW,         CIM_STRING },
     { prop_modelW,                CIM_STRING },
     { prop_numlogicalprocessorsW, CIM_UINT32 },
-    { prop_numprocessorsW,        CIM_UINT32 }
+    { prop_numprocessorsW,        CIM_UINT32 },
+    { prop_totalphysicalmemoryW,  CIM_UINT64 }
 };
 static const struct column col_networkadapter[] =
 {
@@ -195,6 +199,7 @@ struct record_computersystem
     const WCHAR *model;
     UINT32       num_logical_processors;
     UINT32       num_processors;
+    UINT64       total_physical_memory;
 };
 struct record_networkadapter
 {
@@ -247,6 +252,15 @@ static UINT get_processor_count(void)
     return info.NumberOfProcessors;
 }
 
+static UINT64 get_total_physical_memory(void)
+{
+    MEMORYSTATUSEX status;
+
+    status.dwLength = sizeof(status);
+    if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024;
+    return status.ullTotalPhys;
+}
+
 static void fill_compsys( struct table *table )
 {
     struct record_computersystem *rec;
@@ -259,6 +273,7 @@ static void fill_compsys( struct table *table )
     rec->model                  = compsys_modelW;
     rec->num_logical_processors = get_processor_count();
     rec->num_processors         = rec->num_logical_processors;
+    rec->total_physical_memory  = get_total_physical_memory();
 
     TRACE("created 1 row\n");
     table->num_rows = 1;




More information about the wine-cvs mailing list