diff --git a/reactos/subsys/system/servman/En.rc b/reactos/subsys/system/servman/En.rc index e5b16ac6caf..98c5f482022 100644 --- a/reactos/subsys/system/servman/En.rc +++ b/reactos/subsys/system/servman/En.rc @@ -82,6 +82,9 @@ BEGIN IDS_SERVICES_STATUS_STOPPED "Stopped" IDS_SERVICES_YES "Yes" IDS_SERVICES_UNKNOWN "Unknown" + IDS_SERVICES_AUTO "Automatic" + IDS_SERVICES_MAN "Manual" + IDS_SERVICES_DIS "Disabled" END STRINGTABLE DISCARDABLE diff --git a/reactos/subsys/system/servman/query.c b/reactos/subsys/system/servman/query.c index 96458353eb4..687aab3296d 100644 --- a/reactos/subsys/system/servman/query.c +++ b/reactos/subsys/system/servman/query.c @@ -47,25 +47,17 @@ RefreshServiceList(VOID) _stprintf(buf, szNumServices, NumServices); SendMessage(hStatus, SB_SETTEXT, 0, (LPARAM)buf); + for (Index = 0; Index < NumServices; Index++) { HKEY hKey = NULL; - TCHAR Description[5000]; - DWORD Size = 5000; - - /* set the display name */ - - 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 */ + LPTSTR Description = NULL; + LONG ret; + LPTSTR LogOnAs = NULL; + DWORD StartUp = 0; + DWORD dwValueSize; + /* open the registry key for the service */ _stprintf(buf, _T("System\\CurrentControlSet\\Services\\%s"), pServiceStatus[Index].lpServiceName); @@ -79,16 +71,59 @@ RefreshServiceList(VOID) return FALSE; } - RegQueryValueEx(hKey, - _T("Description"), - NULL, - NULL, - (LPBYTE)Description, - &Size); - item.pszText = Description; - item.iSubItem = 1; - SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + /* set the display name */ + + 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; + ret = RegQueryValueEx(hKey, + _T("Description"), + NULL, + NULL, + NULL, + &dwValueSize); + if (ret != ERROR_SUCCESS && ret != ERROR_FILE_NOT_FOUND) + { + RegCloseKey(hKey); + return FALSE; + } + + if (ret != ERROR_FILE_NOT_FOUND) + { + Description = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwValueSize); + if (Description == NULL) + { + RegCloseKey(hKey); + return FALSE; + } + if(RegQueryValueEx(hKey, + _T("Description"), + NULL, + NULL, + (LPBYTE)Description, + &dwValueSize)) + { + HeapFree(GetProcessHeap(), 0, Description); + RegCloseKey(hKey); + return FALSE; + } + + item.pszText = Description; + item.iSubItem = 1; + SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + + HeapFree(GetProcessHeap(), 0, Description); + } + /* set the status */ @@ -106,8 +141,87 @@ RefreshServiceList(VOID) item.iSubItem = 2; SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); } - } - } + + /* set the startup type */ + + dwValueSize = sizeof(DWORD); + if (RegQueryValueEx(hKey, + _T("Start"), + NULL, + NULL, + (LPBYTE)StartUp, + &dwValueSize)) + { + RegCloseKey(hKey); + return FALSE; + } + + if (StartUp == 0x02) + { + LoadString(hInstance, IDS_SERVICES_AUTO, szStatus, 128); + item.pszText = szStatus; + item.iSubItem = 2; + 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; + 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; + SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + } + + + + /* set Log On As */ + + dwValueSize = 0; + if (RegQueryValueEx(hKey, + _T("ObjectName"), + NULL, + NULL, + NULL, + &dwValueSize)) + { + RegCloseKey(hKey); + return FALSE; + } + + LogOnAs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwValueSize); + if (LogOnAs == NULL) + { + RegCloseKey(hKey); + return FALSE; + } + if(RegQueryValueEx(hKey, + _T("ObjectName"), + NULL, + NULL, + (LPBYTE)LogOnAs, + &dwValueSize)) + { + HeapFree(GetProcessHeap(), 0, LogOnAs); + RegCloseKey(hKey); + return FALSE; + } + + item.pszText = LogOnAs; + item.iSubItem = 4; + SendMessage(hListView, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item); + + HeapFree(GetProcessHeap(), 0, LogOnAs); + + RegCloseKey(hKey); + + } + } return TRUE; } diff --git a/reactos/subsys/system/servman/res/system.ico b/reactos/subsys/system/servman/res/system.ico index cc3fb03ac2b..7e69845c23a 100644 Binary files a/reactos/subsys/system/servman/res/system.ico and b/reactos/subsys/system/servman/res/system.ico differ diff --git a/reactos/subsys/system/servman/resource.h b/reactos/subsys/system/servman/resource.h index 72ae8e50c01..f2c2c4e23f0 100644 --- a/reactos/subsys/system/servman/resource.h +++ b/reactos/subsys/system/servman/resource.h @@ -43,7 +43,10 @@ #define IDS_SERVICES_STATUS_STOPPED 5001 #define IDS_SERVICES_YES 5002 #define IDS_SERVICES_UNKNOWN 5003 -#define IDS_SERVICES_NUM_SERVICES 5004 +#define IDS_SERVICES_AUTO 5004 +#define IDS_SERVICES_MAN 5005 +#define IDS_SERVICES_DIS 5006 +#define IDS_SERVICES_NUM_SERVICES 5010 #define IDB_START 50 #define IDI_SM_ICON 51