make GedMurphy happy
[reactos.git] / reactos / subsys / system / servman / query.c
index 7cfb2e2..af643ab 100644 (file)
@@ -32,6 +32,9 @@ RefreshServiceList(VOID)
     TCHAR szStatus[128];\r
     DWORD NumServices = 0;\r
     DWORD Index;\r
+    LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");\r
+\r
+    ListView_DeleteAllItems(hListView);\r
 \r
     NumServices = GetServiceList();\r
 \r
@@ -39,11 +42,11 @@ RefreshServiceList(VOID)
     {\r
         HICON hiconItem;     /* icon for list-view items */\r
         HIMAGELIST hSmall;   /* image list for other views */\r
-        TCHAR buf[40];\r
+        TCHAR buf[300];\r
 \r
         /* Create the icon image lists */\r
         hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON),\r
-            GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 1);\r
+            GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR16, 1, 1);\r
 \r
         /* Add an icon to each image list */\r
         hiconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0);\r
@@ -53,7 +56,7 @@ RefreshServiceList(VOID)
 \r
         /* set the number of services in the status bar */\r
         LoadString(hInstance, IDS_SERVICES_NUM_SERVICES, szNumServices, 32);\r
-        _stprintf(buf, szNumServices, NumServices);\r
+        _sntprintf(buf, 300, szNumServices, NumServices);\r
         SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)buf);\r
 \r
 \r
@@ -67,7 +70,7 @@ RefreshServiceList(VOID)
             DWORD dwValueSize;\r
 \r
              /* open the registry key for the service */\r
-            _stprintf(buf, _T("System\\CurrentControlSet\\Services\\%s"),\r
+            _sntprintf(buf, 300, Path,\r
                       pServiceStatus[Index].lpServiceName);\r
 \r
             if( RegOpenKeyEx(HKEY_LOCAL_MACHINE,\r
@@ -85,14 +88,8 @@ RefreshServiceList(VOID)
 \r
             ZeroMemory(&item, sizeof(LV_ITEM));\r
             item.mask = LVIF_TEXT;\r
-            item.iImage = 0;\r
             item.pszText = pServiceStatus[Index].lpDisplayName;\r
-            /*_tcsncpy(item.pszText,\r
-                    pServiceStatus[Index].lpDisplayName,                    \r
-                    sizeof(pServiceStatus[Index].lpDisplayName));*/\r
-\r
             item.iItem = ListView_GetItemCount(hListView);\r
-            item.lParam = 0;\r
             item.iItem = ListView_InsertItem(hListView, &item);\r
 \r
             \r
@@ -137,7 +134,12 @@ RefreshServiceList(VOID)
 \r
                 HeapFree(GetProcessHeap(), 0, Description);\r
             }\r
-            \r
+            else\r
+            {\r
+                item.pszText = '\0';\r
+                item.iSubItem = 1;\r
+                SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);\r
+            }            \r
 \r
 \r
             /* set the status */\r