Andrew Nguyen : dxdiagn: Add a physical memory display string property to the DxDiag_SystemInfo container .

Alexandre Julliard julliard at winehq.org
Mon Apr 4 10:10:54 CDT 2011


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

Author: Andrew Nguyen <anguyen at codeweavers.com>
Date:   Sun Apr  3 20:55:58 2011 -0500

dxdiagn: Add a physical memory display string property to the DxDiag_SystemInfo container.

---

 dlls/dxdiagn/provider.c        |   11 ++++++++++-
 dlls/dxdiagn/tests/container.c |    2 ++
 2 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 0004d0f..88e6260 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -533,14 +533,17 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
     static const WCHAR dwOSBuildNumber[] = {'d','w','O','S','B','u','i','l','d','N','u','m','b','e','r',0};
     static const WCHAR dwOSPlatformID[] = {'d','w','O','S','P','l','a','t','f','o','r','m','I','D',0};
     static const WCHAR szCSDVersion[] = {'s','z','C','S','D','V','e','r','s','i','o','n',0};
+    static const WCHAR szPhysicalMemoryEnglish[] = {'s','z','P','h','y','s','i','c','a','l','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
     static const WCHAR szMachineNameLocalized[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','L','o','c','a','l','i','z','e','d',0};
     static const WCHAR szMachineNameEnglish[] = {'s','z','M','a','c','h','i','n','e','N','a','m','e','E','n','g','l','i','s','h',0};
 
+    static const WCHAR physmem_fmtW[] = {'%','u','M','B',' ','R','A','M',0};
+
     HRESULT hr;
     MEMORYSTATUSEX msex;
     OSVERSIONINFOW info;
     DWORD count;
-    WCHAR buffer[MAX_PATH], computer_name[MAX_COMPUTERNAME_LENGTH + 1];
+    WCHAR buffer[MAX_PATH], computer_name[MAX_COMPUTERNAME_LENGTH + 1], print_buf[200];
 
     hr = add_ui4_property(node, dwDirectXVersionMajor, 9);
     if (FAILED(hr))
@@ -612,6 +615,12 @@ static HRESULT build_systeminfo_tree(IDxDiagContainerImpl_Container *node)
     if (FAILED(hr))
         return hr;
 
+    /* FIXME: Roundoff should not be done with truncated division. */
+    snprintfW(print_buf, sizeof(print_buf)/sizeof(WCHAR), physmem_fmtW, (DWORD)(msex.ullTotalPhys / (1024 * 1024)));
+    hr = add_bstr_property(node, szPhysicalMemoryEnglish, print_buf);
+    if (FAILED(hr))
+        return hr;
+
     GetWindowsDirectoryW(buffer, MAX_PATH);
 
     hr = add_bstr_property(node, szWindowsDir, buffer);
diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c
index 6c6928c..5430a44 100644
--- a/dlls/dxdiagn/tests/container.c
+++ b/dlls/dxdiagn/tests/container.c
@@ -788,6 +788,7 @@ static void test_DxDiag_SystemInfo(void)
     static const WCHAR szLanguagesEnglish[] = {'s','z','L','a','n','g','u','a','g','e','s','E','n','g','l','i','s','h',0};
     static const WCHAR szTimeLocalized[] = {'s','z','T','i','m','e','L','o','c','a','l','i','z','e','d',0};
     static const WCHAR szTimeEnglish[] = {'s','z','T','i','m','e','E','n','g','l','i','s','h',0};
+    static const WCHAR szPhysicalMemoryEnglish[] = {'s','z','P','h','y','s','i','c','a','l','M','e','m','o','r','y','E','n','g','l','i','s','h',0};
 
     static const struct
     {
@@ -818,6 +819,7 @@ static void test_DxDiag_SystemInfo(void)
         {szLanguagesEnglish, VT_BSTR},
         {szTimeLocalized, VT_BSTR},
         {szTimeEnglish, VT_BSTR},
+        {szPhysicalMemoryEnglish, VT_BSTR},
     };
 
     HRESULT hr;




More information about the wine-cvs mailing list