Author: greatlrd Date: Fri Dec 1 20:36:07 2006 New Revision: 25012
URL: http://svn.reactos.org/svn/reactos?rev=25012&view=rev Log: Colin Finck (mail at colinfinck dot de) patch to sysdm (id=1161) fixing truncate of string and making allot better layout of the system info.
See issue #1858 for more details.
Modified: trunk/reactos/dll/cpl/sysdm/en.rc trunk/reactos/dll/cpl/sysdm/general.c trunk/reactos/dll/cpl/sysdm/resource.h
Modified: trunk/reactos/dll/cpl/sysdm/en.rc URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/en.rc?rev=250... ============================================================================== --- trunk/reactos/dll/cpl/sysdm/en.rc (original) +++ trunk/reactos/dll/cpl/sysdm/en.rc Fri Dec 1 20:36:07 2006 @@ -11,10 +11,11 @@ LTEXT "Version ", IDC_STATIC, 10, 153, 25, 9 LTEXT REACTOS_STR_PRODUCT_VERSION, IDC_STATIC, 35, 153, 91, 9 LTEXT "Machine:", IDC_STATIC, 124, 132, 34, 9 - LTEXT "", IDC_PROCESSORMANUFACTURER, 130, 144, 118, 9 - LTEXT "", IDC_PROCESSOR, 130, 153, 118, 9 - LTEXT "", IDC_PROCESSORSPEED, 130, 162, 118, 9 - LTEXT "", IDC_SYSTEMMEMORY, 130, 171, 118, 9 + LTEXT "", IDC_MACHINELINE1, 130, 144, 118, 9 + LTEXT "", IDC_MACHINELINE2, 130, 153, 118, 9 + LTEXT "", IDC_MACHINELINE3, 130, 162, 118, 9 + LTEXT "", IDC_MACHINELINE4, 130, 171, 118, 9 + LTEXT "", IDC_MACHINELINE5, 130, 180, 118, 9 LTEXT "Visit the ReactOS Homepage", IDC_ROSHOMEPAGE_LINK, 20, 200, 93, 8 PUSHBUTTON "View licence...", IDC_LICENCE, 170, 199, 78, 13 END
Modified: trunk/reactos/dll/cpl/sysdm/general.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/general.c?rev... ============================================================================== --- trunk/reactos/dll/cpl/sysdm/general.c (original) +++ trunk/reactos/dll/cpl/sysdm/general.c Fri Dec 1 20:36:07 2006 @@ -5,6 +5,7 @@ * PURPOSE: General System Information * COPYRIGHT: Copyright Thomas Weidenmueller w3seek@reactos.org * Copyright 2006 Ged Murphy gedmurphy@gmail.com + * Copyright 2006 Colin Finck mail@colinfinck.de * */
@@ -110,16 +111,21 @@ } }
-static VOID -SetProcName(HWND hwnd, - HKEY hKey, - LPTSTR Value, - UINT uID) +static INT +SetProcNameString(HWND hwnd, + HKEY hKey, + LPTSTR Value, + UINT uID1, + UINT uID2) { LPTSTR lpBuf = NULL; DWORD BufSize = 0; DWORD Type; - + INT Ret = 0; + TCHAR szBuf[31]; + TCHAR* szLastSpace; + INT LastSpace = 0; + if (RegQueryValueEx(hKey, Value, NULL, @@ -129,8 +135,8 @@ { lpBuf = HeapAlloc(GetProcessHeap(), 0, - BufSize); - if (!lpBuf) return; + BufSize); + if (!lpBuf) return 0;
if (RegQueryValueEx(hKey, Value, @@ -139,15 +145,56 @@ (PBYTE)lpBuf, &BufSize) == ERROR_SUCCESS) { - SetDlgItemText(hwnd, - uID, - lpBuf + _tcsspn(lpBuf, _T(" "))); + if(BufSize > ((30 + 1) * sizeof(TCHAR))) + { + /* Wrap the Processor Name String like XP does: * + * - Take the first 30 characters and look for the last space. * + * Then wrap the string after this space. * + * - If no space is found, wrap the string after character 30. * + * * + * For example the Processor Name String of a Pentium 4 is right-aligned. * + * With this wrapping the first line looks centered. */ + + _tcsncpy(szBuf, lpBuf, 30); + szLastSpace = _tcsrchr(szBuf, ' '); + + if(szLastSpace == 0) + LastSpace = 30; + else + LastSpace = (szLastSpace - szBuf); + + _tcsncpy(szBuf, lpBuf, LastSpace); + szBuf[LastSpace] = 0; + + SetDlgItemText(hwnd, + uID1, + szBuf); + + SetDlgItemText(hwnd, + uID2, + lpBuf+LastSpace+1); + + /* Return the number of used lines */ + Ret = 2; + } + else + { + SetDlgItemText(hwnd, + uID1, + lpBuf); + + Ret = 1; + } }
HeapFree(GetProcessHeap(), 0, lpBuf); - } + + return Ret; + } + + return 0; }
static VOID @@ -193,6 +240,7 @@ MEMORYSTATUSEX MemStat; TCHAR Buf[32]; INT Ret = 0; + INT CurMachineLine = IDC_MACHINELINE1;
/* Get Processor information * @@ -209,17 +257,21 @@ SetRegTextData(hwnd, hKey, _T("VendorIdentifier"), - IDC_PROCESSORMANUFACTURER); - - SetProcName(hwnd, - hKey, - _T("ProcessorNameString"), - IDC_PROCESSOR); - + CurMachineLine); + CurMachineLine++; + + Ret = SetProcNameString(hwnd, + hKey, + _T("ProcessorNameString"), + CurMachineLine, + CurMachineLine+1); + CurMachineLine += Ret; + SetProcSpeed(hwnd, hKey, _T("~MHz"), - IDC_PROCESSORSPEED); + CurMachineLine); + CurMachineLine++; }
@@ -279,7 +331,7 @@ if (Ret) { SetDlgItemText(hwnd, - IDC_SYSTEMMEMORY, + CurMachineLine, Buf); } } @@ -363,3 +415,6 @@ }
+ + +
Modified: trunk/reactos/dll/cpl/sysdm/resource.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/resource.h?re... ============================================================================== --- trunk/reactos/dll/cpl/sysdm/resource.h (original) +++ trunk/reactos/dll/cpl/sysdm/resource.h Fri Dec 1 20:36:07 2006 @@ -22,13 +22,14 @@
/* propsheet - general */ #define IDD_PROPPAGEGENERAL 100 -#define IDC_PROCESSORMANUFACTURER 101 -#define IDC_PROCESSOR 102 -#define IDC_PROCESSORSPEED 103 -#define IDC_SYSTEMMEMORY 104 -#define IDC_LICENCE 105 -#define IDC_ROSIMG 106 -#define IDC_ROSHOMEPAGE_LINK 107 +#define IDC_MACHINELINE1 101 +#define IDC_MACHINELINE2 102 +#define IDC_MACHINELINE3 103 +#define IDC_MACHINELINE4 104 +#define IDC_MACHINELINE5 105 +#define IDC_LICENCE 106 +#define IDC_ROSIMG 107 +#define IDC_ROSHOMEPAGE_LINK 108
/* propsheet - computer name */