Author: gedmurphy
Date: Mon Aug 27 23:31:09 2007
New Revision: 28612
URL:
http://svn.reactos.org/svn/reactos?rev=28612&view=rev
Log:
- update the stored service status after attempting to change it
- add functionality for changing the list view text and use it to change the status text
- various other bits and bobs
Modified:
trunk/reactos/base/applications/mscutils/servman/control.c
trunk/reactos/base/applications/mscutils/servman/delete.c
trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc
trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc
trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc
trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc
trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc
trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc
trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc
trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc
trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc
trunk/reactos/base/applications/mscutils/servman/mainwnd.c
trunk/reactos/base/applications/mscutils/servman/precomp.h
trunk/reactos/base/applications/mscutils/servman/propsheet.c
trunk/reactos/base/applications/mscutils/servman/query.c
trunk/reactos/base/applications/mscutils/servman/reg.c
trunk/reactos/base/applications/mscutils/servman/resource.h
trunk/reactos/base/applications/mscutils/servman/start.c
Modified: trunk/reactos/base/applications/mscutils/servman/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/control.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/control.c Mon Aug 27 23:31:09 2007
@@ -1,9 +1,9 @@
/*
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
- * FILE: base/applications/mscutils/servman/control
+ * FILE: base/applications/mscutils/servman/control.c
* PURPOSE: Stops, pauses and resumes a service
- * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy(a)gmail.com>
+ * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy(a)reactos.org>
*
*/
@@ -41,7 +41,7 @@
/* open handle to the service */
hSc = OpenService(hSCManager,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
SC_MANAGER_ALL_ACCESS);
if (hSc == NULL)
{
@@ -138,7 +138,7 @@
HWND hProgDlg;
hProgDlg = CreateProgressDialog(Info->hMainWnd,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
IDS_PROGRESS_INFO_STOP);
if (hProgDlg)
{
@@ -158,7 +158,7 @@
HWND hProgDlg;
hProgDlg = CreateProgressDialog(Info->hMainWnd,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
IDS_PROGRESS_INFO_PAUSE);
if (hProgDlg)
{
@@ -178,7 +178,7 @@
HWND hProgDlg;
hProgDlg = CreateProgressDialog(Info->hMainWnd,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
IDS_PROGRESS_INFO_RESUME);
if (hProgDlg)
{
Modified: trunk/reactos/base/applications/mscutils/servman/delete.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/delete.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/delete.c Mon Aug 27 23:31:09 2007
@@ -28,7 +28,7 @@
/* get a handle to the service requested for deleting */
hSc = OpenService(hSCManager,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
DELETE);
if (hSc == NULL)
{
@@ -87,7 +87,7 @@
IDC_DEL_NAME,
WM_SETTEXT,
0,
- (LPARAM)Info->CurrentService->lpDisplayName);
+ (LPARAM)Info->pCurrentService->lpDisplayName);
item.mask = LVIF_TEXT;
Modified: trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/bg-BG.rc Mon Aug 27 23:31:09
2007
@@ -146,7 +146,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Äà", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Íå", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Íå", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/de-DE.rc Mon Aug 27 23:31:09
2007
@@ -143,7 +143,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Ja", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Nein", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Nein", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/en-US.rc Mon Aug 27 23:31:09
2007
@@ -143,7 +143,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Yes", IDOK, 26, 129, 54, 13
- PUSHBUTTON "No", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "No", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/fr-FR.rc Mon Aug 27 23:31:09
2007
@@ -144,7 +144,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Oui", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Non", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Non", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/id-ID.rc Mon Aug 27 23:31:09
2007
@@ -143,7 +143,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Ya", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Tidak", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Tidak", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/it-IT.rc Mon Aug 27 23:31:09
2007
@@ -143,7 +143,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Si", IDOK, 26, 129, 54, 13
- PUSHBUTTON "No", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "No", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/pl-PL.rc Mon Aug 27 23:31:09
2007
@@ -150,7 +150,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Tak", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Nie", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Nie", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/ru-RU.rc Mon Aug 27 23:31:09
2007
@@ -142,7 +142,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "Äà", IDOK, 26, 129, 54, 13
- PUSHBUTTON "Íåò", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "Íåò", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc (original)
+++ trunk/reactos/base/applications/mscutils/servman/lang/th-TH.rc Mon Aug 27 23:31:09
2007
@@ -152,7 +152,7 @@
LTEXT "", IDC_DEL_NAME, 15, 53, 160, 15
EDITTEXT IDC_DEL_DESC, 6, 73, 174, 48, WS_CHILD | WS_VISIBLE | WS_VSCROLL |
WS_EX_STATICEDGE | ES_MULTILINE | ES_READONLY
PUSHBUTTON "ãªè", IDOK, 26, 129, 54, 13
- PUSHBUTTON "äÁèãªè", IDCANCEL, 102, 129, 54, 13
+ DEFPUSHBUTTON "äÁèãªè", IDCANCEL, 102, 129, 54, 13
END
IDD_DLG_HELP_OPTIONS DIALOGEX 6,6,200,150
Modified: trunk/reactos/base/applications/mscutils/servman/mainwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/mainwnd.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/mainwnd.c Mon Aug 27 23:31:09 2007
@@ -8,6 +8,12 @@
*/
#include "precomp.h"
+
+#define LVNAME 0
+#define LVDESC 1
+#define LVSTATUS 2
+#define LVSTARTUP 3
+#define LVLOGONAS 4
static const TCHAR szMainWndClass[] = TEXT("ServManWndClass");
@@ -136,6 +142,73 @@
}
}
+static VOID
+ChangeListViewText(PMAIN_WND_INFO Info,
+ UINT Column)
+{
+ LVITEM item;
+
+ item.iItem = Info->SelectedItem;
+ item.iSubItem = Column;
+
+ switch (Column)
+ {
+ case LVNAME:
+
+ break;
+
+ case LVDESC:
+ {
+ LPTSTR lpDescription;
+
+ lpDescription = GetDescription(Info->pCurrentService->lpServiceName);
+
+ item.pszText = lpDescription;
+ SendMessage(Info->hListView,
+ LVM_SETITEMTEXT,
+ item.iItem,
+ (LPARAM) &item);
+
+ HeapFree(ProcessHeap,
+ 0,
+ lpDescription);
+ }
+ break;
+
+ case LVSTATUS:
+ {
+ TCHAR szStatus[64];
+
+ if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState ==
SERVICE_RUNNING)
+ {
+ LoadString(hInstance,
+ IDS_SERVICES_STARTED,
+ szStatus,
+ sizeof(szStatus) / sizeof(TCHAR));
+ }
+ else
+ {
+ szStatus[0] = 0;
+ }
+
+ item.pszText = szStatus;
+ SendMessage(Info->hListView,
+ LVM_SETITEMTEXT,
+ item.iItem,
+ (LPARAM) &item);
+ }
+ break;
+
+ case LVSTARTUP:
+
+ break;
+
+ case LVLOGONAS:
+
+ break;
+ }
+}
+
VOID SetMenuAndButtonStates(PMAIN_WND_INFO Info)
{
@@ -163,8 +236,8 @@
EnableMenuItem(hMainMenu, ID_DELETE, MF_ENABLED);
EnableMenuItem(Info->hShortcutMenu, ID_DELETE, MF_ENABLED);
- Flags = Info->CurrentService->ServiceStatusProcess.dwControlsAccepted;
- State = Info->CurrentService->ServiceStatusProcess.dwCurrentState;
+ Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
+ State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
if (State == SERVICE_STOPPED)
{
@@ -369,9 +442,8 @@
lvc.fmt = LVCFMT_LEFT;
/* Add columns to the list-view */
-
/* name */
- lvc.iSubItem = 0;
+ lvc.iSubItem = LVNAME;
lvc.cx = 150;
LoadString(hInstance,
IDS_FIRSTCOLUMN,
@@ -383,7 +455,7 @@
&lvc);
/* description */
- lvc.iSubItem = 1;
+ lvc.iSubItem = LVDESC;
lvc.cx = 240;
LoadString(hInstance,
IDS_SECONDCOLUMN,
@@ -395,7 +467,7 @@
&lvc);
/* status */
- lvc.iSubItem = 2;
+ lvc.iSubItem = LVSTATUS;
lvc.cx = 55;
LoadString(hInstance,
IDS_THIRDCOLUMN,
@@ -407,7 +479,7 @@
&lvc);
/* startup type */
- lvc.iSubItem = 3;
+ lvc.iSubItem = LVSTARTUP;
lvc.cx = 80;
LoadString(hInstance,
IDS_FOURTHCOLUMN,
@@ -419,7 +491,7 @@
&lvc);
/* logon as */
- lvc.iSubItem = 4;
+ lvc.iSubItem = LVLOGONAS;
lvc.cx = 100;
LoadString(hInstance,
IDS_FITHCOLUMN,
@@ -509,7 +581,7 @@
Info->SelectedItem = pnmv->iItem;
/* get pointer to selected service */
- Info->CurrentService = GetSelectedService(Info);
+ Info->pCurrentService = GetSelectedService(Info);
/* alter options for the service */
SetMenuAndButtonStates(Info);
@@ -518,7 +590,7 @@
SendMessage(Info->hStatus,
SB_SETTEXT,
1,
- (LPARAM)Info->CurrentService->lpDisplayName);
+ (LPARAM)Info->pCurrentService->lpDisplayName);
/* show the properties button */
SendMessage(Info->hTool,
@@ -613,7 +685,7 @@
case ID_DELETE:
{
- if (Info->CurrentService->ServiceStatusProcess.dwCurrentState !=
SERVICE_RUNNING)
+ if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState !=
SERVICE_RUNNING)
{
DialogBoxParam(hInstance,
MAKEINTRESOURCE(IDD_DLG_DELETE),
@@ -640,22 +712,8 @@
{
if (DoStart(Info))
{
- LVITEM item;
- TCHAR szStatus[64];
-
- LoadString(hInstance,
- IDS_SERVICES_STARTED,
- szStatus,
- sizeof(szStatus) / sizeof(TCHAR));
- item.pszText = szStatus;
- item.iItem = Info->SelectedItem;
- item.iSubItem = 2;
- SendMessage(Info->hListView,
- LVM_SETITEMTEXT,
- item.iItem,
- (LPARAM) &item);
-
- Info->CurrentService->ServiceStatusProcess.dwCurrentState =
SERVICE_RUNNING;
+ UpdateServiceStatus(Info->pCurrentService);
+ ChangeListViewText(Info, LVSTATUS);
SetMenuAndButtonStates(Info);
SetFocus(Info->hListView);
}
@@ -665,17 +723,8 @@
case ID_STOP:
if (DoStop(Info))
{
- LVITEM item;
-
- item.pszText = 0;
- item.iItem = Info->SelectedItem;
- item.iSubItem = 2;
- SendMessage(Info->hListView,
- LVM_SETITEMTEXT,
- item.iItem,
- (LPARAM) &item);
-
- Info->CurrentService->ServiceStatusProcess.dwCurrentState =
SERVICE_STOPPED;
+ UpdateServiceStatus(Info->pCurrentService);
+ ChangeListViewText(Info, LVSTATUS);
SetMenuAndButtonStates(Info);
SetFocus(Info->hListView);
}
@@ -692,22 +741,11 @@
case ID_RESTART:
if (DoStop(Info))
{
- if(!DoStart(Info))
- {
- LVITEM item;
-
- item.pszText = 0;
- item.iItem = Info->SelectedItem;
- item.iSubItem = 2;
- SendMessage(Info->hListView,
- LVM_SETITEMTEXT,
- item.iItem,
- (LPARAM) &item);
-
- Info->CurrentService->ServiceStatusProcess.dwCurrentState =
SERVICE_STOPPED;
- SetMenuAndButtonStates(Info);
- SetFocus(Info->hListView);
- }
+ DoStart(Info);
+ UpdateServiceStatus(Info->pCurrentService);
+ ChangeListViewText(Info, LVSTATUS);
+ SetMenuAndButtonStates(Info);
+ SetFocus(Info->hListView);
}
break;
Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/precomp.h (original)
+++ trunk/reactos/base/applications/mscutils/servman/precomp.h Mon Aug 27 23:31:09 2007
@@ -26,7 +26,7 @@
int nCmdShow;
ENUM_SERVICE_STATUS_PROCESS *pAllServices;
- ENUM_SERVICE_STATUS_PROCESS *CurrentService; /* Stores the current selected service
*/
+ ENUM_SERVICE_STATUS_PROCESS *pCurrentService;
INT SelectedItem;/* selection number in the list view */
BOOL bDlgOpen;
@@ -59,9 +59,6 @@
/* start */
BOOL DoStart(PMAIN_WND_INFO Info);
-/* stop */
-
-
/* control */
BOOL DoStop(PMAIN_WND_INFO Info);
BOOL DoPause(PMAIN_WND_INFO Info);
@@ -76,6 +73,7 @@
ENUM_SERVICE_STATUS_PROCESS* GetSelectedService(PMAIN_WND_INFO Info);
LPTSTR GetExecutablePath(PMAIN_WND_INFO Info);
BOOL RefreshServiceList(PMAIN_WND_INFO Info);
+BOOL UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService);
/* reg */
BOOL SetDescription(LPTSTR, LPTSTR);
Modified: trunk/reactos/base/applications/mscutils/servman/propsheet.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/propsheet.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/propsheet.c Mon Aug 27 23:31:09 2007
@@ -16,8 +16,8 @@
HWND hButton;
DWORD Flags, State;
- Flags = Info->CurrentService->ServiceStatusProcess.dwControlsAccepted;
- State = Info->CurrentService->ServiceStatusProcess.dwCurrentState;
+ Flags = Info->pCurrentService->ServiceStatusProcess.dwControlsAccepted;
+ State = Info->pCurrentService->ServiceStatusProcess.dwCurrentState;
if (State == SERVICE_STOPPED)
{
@@ -64,7 +64,7 @@
_sntprintf(KeyBuf,
sizeof(KeyBuf) / sizeof(TCHAR),
Path,
- Info->CurrentService->lpServiceName);
+ Info->pCurrentService->lpServiceName);
RegOpenKeyEx(HKEY_LOCAL_MACHINE,
KeyBuf,
@@ -118,17 +118,17 @@
IDC_SERV_NAME,
WM_SETTEXT,
0,
- (LPARAM)Info->CurrentService->lpServiceName);
+ (LPARAM)Info->pCurrentService->lpServiceName);
/* set the display name */
SendDlgItemMessage(hwndDlg,
IDC_DISP_NAME,
WM_SETTEXT,
0,
- (LPARAM)Info->CurrentService->lpDisplayName);
+ (LPARAM)Info->pCurrentService->lpDisplayName);
/* set the description */
- if ((lpDescription = GetDescription(Info->CurrentService->lpServiceName)))
+ if ((lpDescription = GetDescription(Info->pCurrentService->lpServiceName)))
{
SendDlgItemMessage(hwndDlg,
IDC_DESCRIPTION,
@@ -161,7 +161,7 @@
SetStartupType(Info, hwndDlg);
/* set service status */
- if (Info->CurrentService->ServiceStatusProcess.dwCurrentState ==
SERVICE_RUNNING)
+ if (Info->pCurrentService->ServiceStatusProcess.dwCurrentState ==
SERVICE_RUNNING)
{
TCHAR szServiceStatus[32];
@@ -407,7 +407,7 @@
psh.hwndParent = Info->hMainWnd;
psh.hInstance = hInstance;
psh.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_SM_ICON));
- psh.pszCaption = Info->CurrentService->lpDisplayName;
+ psh.pszCaption = Info->pCurrentService->lpDisplayName;
psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
psh.nStartPage = 0;
psh.pfnCallback = AddEditButton;
Modified: trunk/reactos/base/applications/mscutils/servman/query.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/query.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/query.c Mon Aug 27 23:31:09 2007
@@ -49,7 +49,7 @@
/* get a handle to the service requested for starting */
hSc = OpenService(hSCManager,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
SERVICE_QUERY_CONFIG);
if (hSc == NULL)
{
@@ -169,6 +169,40 @@
BOOL
+UpdateServiceStatus(ENUM_SERVICE_STATUS_PROCESS* pService)
+{
+ SC_HANDLE hScm;
+ BOOL bRet = FALSE;
+
+ hScm = OpenSCManager(NULL,
+ NULL,
+ SC_MANAGER_ENUMERATE_SERVICE);
+ if (hScm != INVALID_HANDLE_VALUE)
+ {
+ SC_HANDLE hService;
+
+ hService = OpenService(hScm,
+ pService->lpServiceName,
+ SERVICE_QUERY_STATUS);
+ if (hService)
+ {
+ DWORD size;
+
+ QueryServiceStatusEx(hService,
+ SC_STATUS_PROCESS_INFO,
+ (LPBYTE)&pService->ServiceStatusProcess,
+ sizeof(*pService),
+ &size);
+
+ bRet = TRUE;
+ }
+ }
+
+ return bRet;
+}
+
+
+BOOL
RefreshServiceList(PMAIN_WND_INFO Info)
{
ENUM_SERVICE_STATUS_PROCESS *pService;
Modified: trunk/reactos/base/applications/mscutils/servman/reg.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/reg.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/reg.c Mon Aug 27 23:31:09 2007
@@ -2,104 +2,100 @@
* PROJECT: ReactOS Services
* LICENSE: GPL - See COPYING in the top level directory
* FILE: base/applications/mscutils/servman/reg.c
- * PURPOSE: Query service information
- * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy(a)reactos.org>
+ * PURPOSE: functions for querying a services registry key
+ * COPYRIGHT: Copyright 2007 Ged Murphy <gedmurphy(a)reactos.org>
*
*/
#include "precomp.h"
-/* Sets the service description in the registry */
-BOOL SetDescription(LPTSTR ServiceName, LPTSTR Description)
+static HKEY
+OpenServiceKey(LPTSTR lpServiceName)
+{
+ HKEY hKey = NULL;
+ LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
+ TCHAR buf[300];
+
+ _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, lpServiceName);
+ if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
+ buf,
+ 0,
+ KEY_READ,
+ &hKey) == ERROR_SUCCESS)
+ {
+ return hKey;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+BOOL
+SetDescription(LPTSTR lpServiceName,
+ LPTSTR lpDescription)
{
HKEY hKey;
- LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
- TCHAR buf[300];
TCHAR szBuf[MAX_PATH];
- LONG val;
+ BOOL bRet = FALSE;
+ hKey = OpenServiceKey(lpServiceName);
+ if (hKey)
+ {
+ if (RegSetValueEx(hKey,
+ _T("Description"),
+ 0,
+ REG_SZ,
+ (LPBYTE)lpDescription,
+ (DWORD)(_tcslen(szBuf) + 1 ) * sizeof(TCHAR)) == ERROR_SUCCESS)
+ {
+ bRet = TRUE;
+ }
- /* open the registry key for the service */
- _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, ServiceName);
- RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- buf,
- 0,
- KEY_WRITE,
- &hKey);
+ RegCloseKey(hKey);
+ }
-
- if ((val = RegSetValueEx(hKey,
- _T("Description"),
- 0,
- REG_SZ,
- (LPBYTE)Description,
- (DWORD)lstrlen(szBuf)+1)) != ERROR_SUCCESS)
- {
- //GetError(val);
- return FALSE;
- }
-
-
- RegCloseKey(hKey);
- return TRUE;
+ return bRet;
}
-
-/* Retrives the service description from the registry */
LPTSTR
GetDescription(LPTSTR lpServiceName)
{
HKEY hKey;
LPTSTR lpDescription = NULL;
DWORD dwValueSize = 0;
- LONG ret;
- LPCTSTR Path = _T("System\\CurrentControlSet\\Services\\%s");
- TCHAR buf[300];
- /* open the registry key for the service */
- _sntprintf(buf, sizeof(buf) / sizeof(TCHAR), Path, lpServiceName);
- RegOpenKeyEx(HKEY_LOCAL_MACHINE,
- buf,
- 0,
- KEY_READ,
- &hKey);
-
- ret = RegQueryValueEx(hKey,
- _T("Description"),
- NULL,
- NULL,
- NULL,
- &dwValueSize);
- if (ret != ERROR_SUCCESS && ret != ERROR_FILE_NOT_FOUND && ret !=
ERROR_INVALID_HANDLE)
+ hKey = OpenServiceKey(lpServiceName);
+ if (hKey)
{
- RegCloseKey(hKey);
- return FALSE;
- }
-
- if (ret != ERROR_FILE_NOT_FOUND)
- {
- lpDescription = HeapAlloc(ProcessHeap,
- HEAP_ZERO_MEMORY,
- dwValueSize);
- if (lpDescription == NULL)
+ if (RegQueryValueEx(hKey,
+ _T("Description"),
+ NULL,
+ NULL,
+ NULL,
+ &dwValueSize) == ERROR_SUCCESS)
{
- RegCloseKey(hKey);
- return FALSE;
+ lpDescription = HeapAlloc(ProcessHeap,
+ 0,
+ dwValueSize);
+ if (lpDescription)
+ {
+ if(RegQueryValueEx(hKey,
+ _T("Description"),
+ NULL,
+ NULL,
+ (LPBYTE)lpDescription,
+ &dwValueSize) != ERROR_SUCCESS)
+ {
+ HeapFree(ProcessHeap,
+ 0,
+ lpDescription);
+ }
+ }
}
- if(RegQueryValueEx(hKey,
- _T("Description"),
- NULL,
- NULL,
- (LPBYTE)lpDescription,
- &dwValueSize))
- {
- HeapFree(ProcessHeap,
- 0,
- lpDescription);
- RegCloseKey(hKey);
- }
+ RegCloseKey(hKey);
}
return lpDescription;
Modified: trunk/reactos/base/applications/mscutils/servman/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/resource.h (original)
+++ trunk/reactos/base/applications/mscutils/servman/resource.h Mon Aug 27 23:31:09 2007
@@ -172,5 +172,3 @@
#define IDS_PROGRESS_INFO_STOP 7005
#define IDS_PROGRESS_INFO_PAUSE 7006
#define IDS_PROGRESS_INFO_RESUME 7007
-
-
Modified: trunk/reactos/base/applications/mscutils/servman/start.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/start.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/start.c Mon Aug 27 23:31:09 2007
@@ -32,7 +32,7 @@
/* get a handle to the service requested for starting */
hSc = OpenService(hSCManager,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
SERVICE_ALL_ACCESS);
if (hSc == NULL)
{
@@ -130,7 +130,7 @@
BOOL bRet = FALSE;
hProgDlg = CreateProgressDialog(Info->hMainWnd,
- Info->CurrentService->lpServiceName,
+ Info->pCurrentService->lpServiceName,
IDS_PROGRESS_INFO_START);
if (hProgDlg)