dxdiagn: Add a physical memory display string property to the DxDiag_SystemInfo conta...
authorAndrew Nguyen <anguyen@codeweavers.com>
Mon, 4 Apr 2011 01:55:58 +0000 (20:55 -0500)
committerAlexandre Julliard <julliard@winehq.org>
Mon, 4 Apr 2011 11:16:02 +0000 (13:16 +0200)
dlls/dxdiagn/provider.c
dlls/dxdiagn/tests/container.c

index 0004d0f06baa32beb7a628a6e4bc38b59f9e0e2f..88e62607b756705c5fea09b03f02f9f715d550d1 100644 (file)
@@ -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);
index 6c6928cbbe0dd25ed7f61ba3bc7ebdf7e35dbd5d..5430a4471b6aa9f78c5f57e1cd967f20cf98030d 100644 (file)
@@ -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;