Added patch to implement FreePhysicalMemory in Win32_OperatingSystem wbemprox class.

This commit is contained in:
Sebastian Lackner 2017-07-15 20:38:36 +02:00
parent 08cd599f17
commit dc531c457c
3 changed files with 85 additions and 0 deletions

View File

@ -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:

View File

@ -0,0 +1,65 @@
From 0292273cd4f45b3bc5988302211b4a15de7e9473 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
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

View File

@ -0,0 +1 @@
Fixes: [43357] Add FreePhysicalMemory to Win32_OperatingSystem