[ros-diffs] [gedmurphy] 29502: use ChangeListViewText to fill out the service info

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Thu Oct 11 14:21:06 CEST 2007


Author: gedmurphy
Date: Thu Oct 11 16:21:06 2007
New Revision: 29502

URL: http://svn.reactos.org/svn/reactos?rev=29502&view=rev
Log:
use ChangeListViewText to fill out the service info

Modified:
    trunk/reactos/base/applications/mscutils/servman/listview.c

Modified: trunk/reactos/base/applications/mscutils/servman/listview.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/servman/listview.c?rev=29502&r1=29501&r2=29502&view=diff
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/listview.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/listview.c Thu Oct 11 16:21:06 2007
@@ -229,9 +229,7 @@
 RefreshServiceList(PMAIN_WND_INFO Info)
 {
     ENUM_SERVICE_STATUS_PROCESS *pService;
-    LPTSTR lpDescription;
     LVITEM lvItem;
-    TCHAR szStatus[64];
     DWORD NumServices;
     DWORD Index;
 
@@ -246,7 +244,7 @@
     {
         for (Index = 0; Index < NumServices; Index++)
         {
-            LPQUERY_SERVICE_CONFIG pServiceConfig;
+            INT i;
 
             pService = &Info->pAllServices[Index];
 
@@ -261,75 +259,10 @@
             /* add it to the listview */
             lvItem.iItem = ListView_InsertItem(Info->hListView, &lvItem);
 
-            /* set the description */
-            if ((lpDescription = GetServiceDescription(pService->lpServiceName)))
-            {
-                lvItem.pszText = lpDescription;
-                lvItem.iSubItem = LVDESC;
-                SendMessage(Info->hListView,
-                            LVM_SETITEMTEXT,
-                            lvItem.iItem,
-                            (LPARAM)&lvItem);
-
-                HeapFree(ProcessHeap,
-                         0,
-                         lpDescription);
-            }
-
-            /* set the status */
-            if (pService->ServiceStatusProcess.dwCurrentState == SERVICE_RUNNING)
-            {
-                LoadString(hInstance,
-                           IDS_SERVICES_STARTED,
-                           szStatus,
-                           sizeof(szStatus) / sizeof(TCHAR));
-                lvItem.pszText = szStatus;
-                lvItem.iSubItem = LVSTATUS;
-                SendMessage(Info->hListView,
-                            LVM_SETITEMTEXT,
-                            lvItem.iItem,
-                            (LPARAM)&lvItem);
-            }
-
-            pServiceConfig = GetServiceConfig(pService->lpServiceName);
-            if (pServiceConfig)
-            {
-                DWORD StringId = 0;
-                LPTSTR lpStartup;
-
-                /* set the startup type */
-                switch (pServiceConfig->dwStartType)
-                {
-                    case 2: StringId = IDS_SERVICES_AUTO; break;
-                    case 3: StringId = IDS_SERVICES_MAN; break;
-                    case 4: StringId = IDS_SERVICES_DIS; break;
-                }
-
-                if (StringId)
-                    AllocAndLoadString(&lpStartup,
-                                       hInstance,
-                                       StringId);
-
-                lvItem.pszText = lpStartup;
-                lvItem.iSubItem = LVSTARTUP;
-                SendMessage(Info->hListView,
-                            LVM_SETITEMTEXT,
-                            lvItem.iItem,
-                            (LPARAM)&lvItem);
-
-                LocalFree(lpStartup);
-
-                /* set Log On As */
-                lvItem.pszText = pServiceConfig->lpServiceStartName;
-                lvItem.iSubItem = LVLOGONAS;
-                SendMessage(Info->hListView,
-                            LVM_SETITEMTEXT,
-                            lvItem.iItem,
-                            (LPARAM)&lvItem);
-
-                HeapFree(ProcessHeap,
-                         0,
-                         pServiceConfig);
+            /* fill out all the column data */
+            for (i = LVDESC; i <= LVLOGONAS; i++)
+            {
+                ChangeListViewText(Info, pService, i);
             }
         }
 




More information about the Ros-diffs mailing list