X-Git-Url: https://git.reactos.org/?p=reactos.git;a=blobdiff_plain;f=reactos%2Fsubsys%2Fsystem%2Fservman%2Fquery.c;h=523b223770d09ac43fca6287651d91d488d77182;hp=687aab3296d5fe89cca97afe09a4fd6cfeeb5f5e;hb=9cfeba8d37e1c5fe3458ccedc6fb0d91e8e75682;hpb=fa930470a4f689432b22c3f0fbe07528f36d992b diff --git a/reactos/subsys/system/servman/query.c b/reactos/subsys/system/servman/query.c index 687aab3296d..523b223770d 100644 --- a/reactos/subsys/system/servman/query.c +++ b/reactos/subsys/system/servman/query.c @@ -1,3 +1,12 @@ +/* + * PROJECT: ReactOS Services + * LICENSE: GPL - See COPYING in the top level directory + * FILE: subsys/system/servman/query.c + * PURPOSE: Query service information + * COPYRIGHT: Copyright 2005 Ged Murphy + * + */ + #include "servman.h" extern HINSTANCE hInstance; @@ -18,11 +27,14 @@ VOID FreeMemory(VOID) BOOL RefreshServiceList(VOID) { - LV_ITEM item; + LVITEM item; TCHAR szNumServices[32]; TCHAR szStatus[128]; DWORD NumServices = 0; DWORD Index; + LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s"); + + ListView_DeleteAllItems(hListView); NumServices = GetServiceList(); @@ -30,11 +42,11 @@ RefreshServiceList(VOID) { HICON hiconItem; /* icon for list-view items */ HIMAGELIST hSmall; /* image list for other views */ - TCHAR buf[40]; + TCHAR buf[300]; /* Create the icon image lists */ hSmall = ImageList_Create(GetSystemMetrics(SM_CXSMICON), - GetSystemMetrics(SM_CYSMICON), ILC_MASK, 1, 1); + GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR16, 1, 1); /* Add an icon to each image list */ hiconItem = LoadImage(hInstance, MAKEINTRESOURCE(IDI_SM_ICON), IMAGE_ICON, 16, 16, 0); @@ -44,7 +56,7 @@ RefreshServiceList(VOID) /* set the number of services in the status bar */ LoadString(hInstance, IDS_SERVICES_NUM_SERVICES, szNumServices, 32); - _stprintf(buf, szNumServices, NumServices); + _sntprintf(buf, 300, szNumServices, NumServices); SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)buf); @@ -58,7 +70,7 @@ RefreshServiceList(VOID) DWORD dwValueSize; /* open the registry key for the service */ - _stprintf(buf, _T("System\\CurrentControlSet\\Services\\%s"), + _sntprintf(buf, 300, Path, pServiceStatus[Index].lpServiceName); if( RegOpenKeyEx(HKEY_LOCAL_MACHINE, @@ -76,12 +88,11 @@ RefreshServiceList(VOID) ZeroMemory(&item, sizeof(LV_ITEM)); item.mask = LVIF_TEXT; - //item.iImage = 0; item.pszText = pServiceStatus[Index].lpDisplayName; item.iItem = ListView_GetItemCount(hListView); - //item.lParam = 0; item.iItem = ListView_InsertItem(hListView, &item); + /* set the description */ dwValueSize = 0; @@ -123,7 +134,12 @@ RefreshServiceList(VOID) HeapFree(GetProcessHeap(), 0, Description); } - + else + { + item.pszText = '\0'; + item.iSubItem = 1; + SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + } /* set the status */ @@ -149,7 +165,7 @@ RefreshServiceList(VOID) _T("Start"), NULL, NULL, - (LPBYTE)StartUp, + (LPBYTE)&StartUp, &dwValueSize)) { RegCloseKey(hKey); @@ -160,21 +176,21 @@ RefreshServiceList(VOID) { LoadString(hInstance, IDS_SERVICES_AUTO, szStatus, 128); item.pszText = szStatus; - item.iSubItem = 2; + item.iSubItem = 3; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); } else if (StartUp == 0x03) { LoadString(hInstance, IDS_SERVICES_MAN, szStatus, 128); item.pszText = szStatus; - item.iSubItem = 2; + item.iSubItem = 3; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); } else if (StartUp == 0x04) { LoadString(hInstance, IDS_SERVICES_DIS, szStatus, 128); item.pszText = szStatus; - item.iSubItem = 2; + item.iSubItem = 3; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); }