list services

svn path=/trunk/; revision=19126
This commit is contained in:
Christoph von Wittich 2005-11-10 22:46:41 +00:00
parent 700e92d770
commit 12c0917529
5 changed files with 89 additions and 19 deletions

View file

@ -34,12 +34,13 @@ IDD_SERVICES_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
CONTROL "List1",IDC_SERVICES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
CONTROL "List1",IDC_SERVICES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_TAB_GENERAL "Allgemein"
IDS_TAB_SYSTEM "SYSTEM.INI"
IDS_TAB_FREELDR "FREELDR.INI"
IDS_TAB_SERVICES "Dienste"
IDS_TAB_STARTUP "Systemstart"

View file

@ -34,12 +34,13 @@ IDD_SERVICES_PAGE DIALOG DISCARDABLE 0, 0, 362, 175
STYLE DS_CONTROL | WS_CHILD | WS_CLIPCHILDREN
FONT 8, "Tahoma"
BEGIN
CONTROL "List1",IDC_SERVICES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
CONTROL "List1",IDC_SERVICES_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP, 2, 1, 360, 168
END
STRINGTABLE DISCARDABLE
BEGIN
IDS_TAB_GENERAL "General"
IDS_TAB_SYSTEM "SYSTEM.INI"
IDS_TAB_FREELDR "FREELDR.INI"
IDS_TAB_SERVICES "Services"
IDS_TAB_STARTUP "Startup"

View file

@ -23,30 +23,36 @@ BOOL OnCreate(HWND hWnd)
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 0, &item);
LoadString(hInst, IDS_TAB_FREELDR, szTemp, 256);
LoadString(hInst, IDS_TAB_SYSTEM, szTemp, 256);
memset(&item, 0, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 1, &item);
LoadString(hInst, IDS_TAB_SERVICES, szTemp, 256);
LoadString(hInst, IDS_TAB_FREELDR, szTemp, 256);
memset(&item, 0, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 2, &item);
LoadString(hInst, IDS_TAB_STARTUP, szTemp, 256);
LoadString(hInst, IDS_TAB_SERVICES, szTemp, 256);
memset(&item, 0, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 3, &item);
LoadString(hInst, IDS_TAB_TOOLS, szTemp, 256);
LoadString(hInst, IDS_TAB_STARTUP, szTemp, 256);
memset(&item, 0, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 4, &item);
LoadString(hInst, IDS_TAB_TOOLS, szTemp, 256);
memset(&item, 0, sizeof(TCITEM));
item.mask = TCIF_TEXT;
item.pszText = szTemp;
TabCtrl_InsertItem(hTabWnd, 5, &item);
return TRUE;
}
@ -61,28 +67,35 @@ void MsConfig_OnTabWndSelChange(void)
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 1: //Freeldr
case 1: //SYSTEM.INI
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_SHOW);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 2: //Services
case 2: //Freeldr
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_SHOW);
ShowWindow(hServicesPage, SW_HIDE);
//BringWindowToTop(hFreeLdrPage);
break;
case 3: //Services
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_SHOW);
//BringWindowToTop(hFreeLdrPage);
BringWindowToTop(hServicesPage);
break;
case 3: //startup
case 4: //startup
ShowWindow(hToolsPage, SW_HIDE);
ShowWindow(hStartupPage, SW_SHOW);
//ShowWindow(hFreeLdrPage, SW_HIDE);
ShowWindow(hServicesPage, SW_HIDE);
BringWindowToTop(hStartupPage);
break;
case 4: //Tools
case 5: //Tools
ShowWindow(hToolsPage, SW_SHOW);
ShowWindow(hStartupPage, SW_HIDE);
//ShowWindow(hFreeLdrPage, SW_HIDE);

View file

@ -14,10 +14,11 @@
#define IDC_STARTUP_LIST 1008
#define IDS_TAB_TOOLS 2001
#define IDS_TAB_FREELDR 2002
#define IDS_TAB_STARTUP 2003
#define IDS_TAB_SERVICES 2004
#define IDS_TAB_GENERAL 2005
#define IDS_TAB_SYSTEM 2002
#define IDS_TAB_FREELDR 2003
#define IDS_TAB_STARTUP 2004
#define IDS_TAB_SERVICES 2005
#define IDS_TAB_GENERAL 2006
#define IDS_TOOLS_COLUMN_NAME 2010
#define IDS_TOOLS_COLUMN_DESCR 2011

View file

@ -4,6 +4,8 @@ HWND hServicesPage;
HWND hServicesListCtrl;
HWND hServicesDialog;
void GetServices ( void );
INT_PTR CALLBACK
ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
@ -28,7 +30,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
LoadString(hInst, IDS_SERVICES_COLUMN_SERVICE, szTemp, 256);
column.pszText = szTemp;
column.cx = 150;
column.cx = 200;
ListView_InsertColumn(hServicesListCtrl, 0, &column);
column.mask = LVCF_TEXT | LVCF_WIDTH;
@ -43,8 +45,60 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
column.cx = 70;
ListView_InsertColumn(hServicesListCtrl, 2, &column);
GetServices();
return TRUE;
}
return 0;
}
void
GetServices ( void )
{
HKEY hKey, hSubKey;
DWORD dwSubKeys, dwKeyLength;
DWORD dwType, dwDataLength;
size_t Index;
TCHAR lpKeyName[MAX_KEY_LENGTH];
TCHAR lpSubKey[MAX_KEY_LENGTH];
TCHAR DisplayName[MAX_VALUE_NAME];
TCHAR ObjectName[MAX_VALUE_NAME];
TCHAR lpServicesKey[MAX_KEY_LENGTH] = _T("SYSTEM\\CurrentControlSet\\Services");
LV_ITEM item;
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpServicesKey, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
{
if (RegQueryInfoKey(hKey, NULL, NULL, NULL, &dwSubKeys, NULL, NULL, NULL, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
for (Index = 0; Index < dwSubKeys; Index++)
{
dwKeyLength = MAX_KEY_LENGTH;
if (RegEnumKeyEx(hKey, Index, lpKeyName, &dwKeyLength, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
{
_tcscpy(lpSubKey, lpServicesKey);
_tcscat(lpSubKey, _T("\\"));
_tcscat(lpSubKey, lpKeyName);
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, lpSubKey, 0, KEY_READ, &hSubKey) == ERROR_SUCCESS)
{
dwDataLength = MAX_VALUE_NAME;
if (RegQueryValueEx(hSubKey, _T("ObjectName"), NULL, &dwType, (LPBYTE)ObjectName, &dwDataLength) == ERROR_SUCCESS)
{
dwDataLength = MAX_VALUE_NAME;
if (RegQueryValueEx(hSubKey, _T("DisplayName"), NULL, &dwType, (LPBYTE)DisplayName, &dwDataLength) == ERROR_SUCCESS)
{
memset(&item, 0, sizeof(LV_ITEM));
item.mask = LVIF_TEXT;
item.iImage = 0;
item.pszText = DisplayName;
item.iItem = ListView_GetItemCount(hServicesListCtrl);
item.lParam = 0;
ListView_InsertItem(hServicesListCtrl, &item);
}
}
}
}
}
}
RegCloseKey(hKey);
}
}