Module: wine Branch: stable Commit: 2427fb6adce04bb6750f665641dc84cccbb4fc2f URL: https://source.winehq.org/git/wine.git/?a=commit;h=2427fb6adce04bb6750f66564...
Author: Michael Müller michael@fds-team.de Date: Fri Mar 2 11:54:57 2018 +0100
wbemprox: Add FreePhysicalMemory to Win32_OperatingSystem.
Signed-off-by: Hans Leidekker hans@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org (cherry picked from commit fe6127dc679606b70ad7a6fedf9b021d61038086) Signed-off-by: Michael Stefaniuc mstefani@winehq.org
---
dlls/wbemprox/builtin.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)
diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c index dd5b9ac..c356524 100644 --- a/dlls/wbemprox/builtin.c +++ b/dlls/wbemprox/builtin.c @@ -225,6 +225,8 @@ static const WCHAR prop_flavorW[] = {'F','l','a','v','o','r',0}; static const WCHAR prop_freespaceW[] = {'F','r','e','e','S','p','a','c','e',0}; +static const WCHAR prop_freephysicalmemoryW[] = + {'F','r','e','e','P','h','y','s','i','c','a','l','M','e','m','o','r','y',0}; static const WCHAR prop_handleW[] = {'H','a','n','d','l','e',0}; static const WCHAR prop_horizontalresolutionW[] = @@ -539,6 +541,7 @@ static const struct column col_os[] = { prop_codesetW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_countrycodeW, CIM_STRING|COL_FLAG_DYNAMIC }, { prop_csdversionW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_freephysicalmemoryW, CIM_UINT64 }, { prop_installdateW, CIM_DATETIME }, { prop_lastbootuptimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, { prop_localdatetimeW, CIM_DATETIME|COL_FLAG_DYNAMIC }, @@ -939,6 +942,7 @@ struct record_operatingsystem const WCHAR *codeset; const WCHAR *countrycode; const WCHAR *csdversion; + UINT64 freephysicalmemory; const WCHAR *installdate; const WCHAR *lastbootuptime; const WCHAR *localdatetime; @@ -1322,6 +1326,15 @@ static UINT64 get_total_physical_memory(void) return status.ullTotalPhys; }
+static UINT64 get_available_physical_memory(void) +{ + MEMORYSTATUSEX status; + + status.dwLength = sizeof(status); + if (!GlobalMemoryStatusEx( &status )) return 1024 * 1024 * 1024; + return status.ullAvailPhys; +} + static WCHAR *get_computername(void) { WCHAR *ret; @@ -2892,6 +2905,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond ) rec->codeset = get_codeset(); rec->countrycode = get_countrycode(); rec->csdversion = ver.szCSDVersion[0] ? heap_strdupW( ver.szCSDVersion ) : NULL; + rec->freephysicalmemory = get_available_physical_memory() / 1024; rec->installdate = os_installdateW; rec->lastbootuptime = get_lastbootuptime(); rec->localdatetime = get_localdatetime();