From dc531c457cf7505f364bb545af322b3f8c324f16 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 15 Jul 2017 20:38:36 +0200 Subject: [PATCH] Added patch to implement FreePhysicalMemory in Win32_OperatingSystem wbemprox class. --- patches/patchinstall.sh | 19 ++++++ ...ePhysicalMemory-to-Win32_OperatingSy.patch | 65 +++++++++++++++++++ .../wbemprox-Win32_OperatingSystem/definition | 1 + 3 files changed, 85 insertions(+) create mode 100644 patches/wbemprox-Win32_OperatingSystem/0001-wbemprox-Add-FreePhysicalMemory-to-Win32_OperatingSy.patch create mode 100644 patches/wbemprox-Win32_OperatingSystem/definition diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 433b29eb..7ea10e3c 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -406,6 +406,7 @@ patch_enable_all () enable_vulkan_Vulkan_Implementation="$1" enable_wbemdisp_ISWbemSecurity="$1" enable_wbemprox_Printer="$1" + enable_wbemprox_Win32_OperatingSystem="$1" enable_wbemprox_Win32_VideoController="$1" enable_wevtapi_EvtNext="$1" enable_widl_SLTG_Typelib_Support="$1" @@ -1471,6 +1472,9 @@ patch_enable () wbemprox-Printer) enable_wbemprox_Printer="$2" ;; + wbemprox-Win32_OperatingSystem) + enable_wbemprox_Win32_OperatingSystem="$2" + ;; wbemprox-Win32_VideoController) enable_wbemprox_Win32_VideoController="$2" ;; @@ -8603,6 +8607,21 @@ if test "$enable_wbemprox_Printer" -eq 1; then ) >> "$patchlist" fi +# Patchset wbemprox-Win32_OperatingSystem +# | +# | This patchset fixes the following Wine bugs: +# | * [#43357] Add FreePhysicalMemory to Win32_OperatingSystem +# | +# | Modified files: +# | * dlls/wbemprox/builtin.c +# | +if test "$enable_wbemprox_Win32_OperatingSystem" -eq 1; then + patch_apply wbemprox-Win32_OperatingSystem/0001-wbemprox-Add-FreePhysicalMemory-to-Win32_OperatingSy.patch + ( + printf '%s\n' '+ { "Michael Müller", "wbemprox: Add FreePhysicalMemory to Win32_OperatingSystem.", 1 },'; + ) >> "$patchlist" +fi + # Patchset wbemprox-Win32_VideoController # | # | Modified files: diff --git a/patches/wbemprox-Win32_OperatingSystem/0001-wbemprox-Add-FreePhysicalMemory-to-Win32_OperatingSy.patch b/patches/wbemprox-Win32_OperatingSystem/0001-wbemprox-Add-FreePhysicalMemory-to-Win32_OperatingSy.patch new file mode 100644 index 00000000..b4077d60 --- /dev/null +++ b/patches/wbemprox-Win32_OperatingSystem/0001-wbemprox-Add-FreePhysicalMemory-to-Win32_OperatingSy.patch @@ -0,0 +1,65 @@ +From 0292273cd4f45b3bc5988302211b4a15de7e9473 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Michael=20M=C3=BCller?= +Date: Sat, 15 Jul 2017 20:36:44 +0200 +Subject: wbemprox: Add FreePhysicalMemory to Win32_OperatingSystem. + +--- + dlls/wbemprox/builtin.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +diff --git a/dlls/wbemprox/builtin.c b/dlls/wbemprox/builtin.c +index 70907bf1d4d..942574275b0 100644 +--- a/dlls/wbemprox/builtin.c ++++ b/dlls/wbemprox/builtin.c +@@ -229,6 +229,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[] = +@@ -563,6 +565,7 @@ static const struct column col_os[] = + { prop_systemdirectoryW, CIM_STRING|COL_FLAG_DYNAMIC }, + { prop_totalvirtualmemorysizeW, CIM_UINT64 }, + { prop_totalvisiblememorysizeW, CIM_UINT64 }, ++ { prop_freephysicalmemoryW, CIM_UINT64 }, + { prop_versionW, CIM_STRING|COL_FLAG_DYNAMIC } + }; + static const struct column col_param[] = +@@ -967,6 +970,7 @@ struct record_operatingsystem + const WCHAR *systemdirectory; + UINT64 totalvirtualmemorysize; + UINT64 totalvisiblememorysize; ++ UINT64 freephysicalmemory; + const WCHAR *version; + }; + struct record_param +@@ -1340,6 +1344,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; +@@ -2930,6 +2943,7 @@ static enum fill_status fill_os( struct table *table, const struct expr *cond ) + rec->systemdirectory = get_systemdirectory(); + rec->totalvirtualmemorysize = get_total_physical_memory() / 1024; + rec->totalvisiblememorysize = rec->totalvirtualmemorysize; ++ rec->freephysicalmemory = get_available_physical_memory() / 1024; + rec->version = get_osversion( &ver ); + if (!match_row( table, row, cond, &status )) free_row_values( table, row ); + else row++; +-- +2.13.1 + diff --git a/patches/wbemprox-Win32_OperatingSystem/definition b/patches/wbemprox-Win32_OperatingSystem/definition new file mode 100644 index 00000000..f9d0b70f --- /dev/null +++ b/patches/wbemprox-Win32_OperatingSystem/definition @@ -0,0 +1 @@ +Fixes: [43357] Add FreePhysicalMemory to Win32_OperatingSystem