Author: ekohl
Date: Mon Apr 17 12:48:51 2017
New Revision: 74349
URL:
http://svn.reactos.org/svn/reactos?rev=74349&view=rev
Log:
[SERVMAN]
Track changes to the general and and recovery pages.
CORE-12743
Modified:
trunk/reactos/base/applications/mscutils/servman/propsheet_general.c
trunk/reactos/base/applications/mscutils/servman/propsheet_recovery.c
Modified: trunk/reactos/base/applications/mscutils/servman/propsheet_general.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/propsheet_general.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/servman/propsheet_general.c [iso-8859-1] Mon
Apr 17 12:48:51 2017
@@ -8,6 +8,14 @@
*/
#include "precomp.h"
+
+
+typedef struct _PAGEDATA
+{
+ PSERVICEPROPSHEET dlgInfo;
+ BOOL bPageChanged;
+} PAGEDATA, *PPAGEDATA;
+
static VOID
SetButtonStates(PSERVICEPROPSHEET dlgInfo,
@@ -184,8 +192,8 @@
0,
(LPARAM)pServiceConfig->lpBinaryPathName);
HeapFree(ProcessHeap,
- 0,
- pServiceConfig);
+ 0,
+ pServiceConfig);
}
@@ -197,10 +205,7 @@
if (dlgInfo->Info->bIsUserAnAdmin)
{
- HWND hEdit = GetDlgItem(hwndDlg,
- IDC_EDIT);
- EnableWindow(hEdit,
- TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), TRUE);
}
}
@@ -257,12 +262,12 @@
WPARAM wParam,
LPARAM lParam)
{
- PSERVICEPROPSHEET dlgInfo;
+ PPAGEDATA pPageData;
/* Get the window context */
- dlgInfo = (PSERVICEPROPSHEET)GetWindowLongPtr(hwndDlg,
- GWLP_USERDATA);
- if (dlgInfo == NULL && uMsg != WM_INITDIALOG)
+ pPageData = (PPAGEDATA)GetWindowLongPtr(hwndDlg,
+ GWLP_USERDATA);
+ if (pPageData == NULL && uMsg != WM_INITDIALOG)
{
return FALSE;
}
@@ -270,26 +275,36 @@
switch (uMsg)
{
case WM_INITDIALOG:
- {
- dlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
- if (dlgInfo != NULL)
+ pPageData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PAGEDATA));
+ if (pPageData != NULL)
{
SetWindowLongPtr(hwndDlg,
GWLP_USERDATA,
- (LONG_PTR)dlgInfo);
- InitGeneralPage(dlgInfo, hwndDlg);
- SetButtonStates(dlgInfo, hwndDlg);
+ (LONG_PTR)pPageData);
+
+ pPageData->dlgInfo =
(PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
+ if (pPageData->dlgInfo != NULL)
+ {
+ InitGeneralPage(pPageData->dlgInfo, hwndDlg);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ }
}
- }
- break;
+ break;
+
+ case WM_DESTROY:
+ HeapFree(GetProcessHeap(), 0, pPageData);
+ break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_START_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE)
+ {
+ pPageData->bPageChanged = TRUE;
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
- break;
+ }
+ break;
case IDC_START:
{
@@ -300,90 +315,89 @@
lpStartParams = szStartParams;
RunActionWithProgress(hwndDlg,
- dlgInfo->pService->lpServiceName,
- dlgInfo->pService->lpDisplayName,
+
pPageData->dlgInfo->pService->lpServiceName,
+
pPageData->dlgInfo->pService->lpDisplayName,
ACTION_START,
lpStartParams);
- UpdateServiceStatus(dlgInfo->pService);
- ChangeListViewText(dlgInfo->Info, dlgInfo->pService,
LVSTATUS);
- SetButtonStates(dlgInfo, hwndDlg);
- SetServiceStatusText(dlgInfo, hwndDlg);
+ UpdateServiceStatus(pPageData->dlgInfo->pService);
+ ChangeListViewText(pPageData->dlgInfo->Info,
pPageData->dlgInfo->pService, LVSTATUS);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
break;
}
case IDC_STOP:
RunActionWithProgress(hwndDlg,
- dlgInfo->pService->lpServiceName,
- dlgInfo->pService->lpDisplayName,
+
pPageData->dlgInfo->pService->lpServiceName,
+
pPageData->dlgInfo->pService->lpDisplayName,
ACTION_STOP,
NULL);
- UpdateServiceStatus(dlgInfo->pService);
- ChangeListViewText(dlgInfo->Info, dlgInfo->pService,
LVSTATUS);
- SetButtonStates(dlgInfo, hwndDlg);
- SetServiceStatusText(dlgInfo, hwndDlg);
+ UpdateServiceStatus(pPageData->dlgInfo->pService);
+ ChangeListViewText(pPageData->dlgInfo->Info,
pPageData->dlgInfo->pService, LVSTATUS);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
break;
case IDC_PAUSE:
RunActionWithProgress(hwndDlg,
- dlgInfo->pService->lpServiceName,
- dlgInfo->pService->lpDisplayName,
+
pPageData->dlgInfo->pService->lpServiceName,
+
pPageData->dlgInfo->pService->lpDisplayName,
ACTION_PAUSE,
NULL);
- UpdateServiceStatus(dlgInfo->pService);
- ChangeListViewText(dlgInfo->Info, dlgInfo->pService,
LVSTATUS);
- SetButtonStates(dlgInfo, hwndDlg);
- SetServiceStatusText(dlgInfo, hwndDlg);
+ UpdateServiceStatus(pPageData->dlgInfo->pService);
+ ChangeListViewText(pPageData->dlgInfo->Info,
pPageData->dlgInfo->pService, LVSTATUS);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
break;
case IDC_RESUME:
RunActionWithProgress(hwndDlg,
- dlgInfo->pService->lpServiceName,
- dlgInfo->pService->lpDisplayName,
+
pPageData->dlgInfo->pService->lpServiceName,
+
pPageData->dlgInfo->pService->lpDisplayName,
ACTION_RESUME,
NULL);
- UpdateServiceStatus(dlgInfo->pService);
- ChangeListViewText(dlgInfo->Info, dlgInfo->pService,
LVSTATUS);
- SetButtonStates(dlgInfo, hwndDlg);
- SetServiceStatusText(dlgInfo, hwndDlg);
+ UpdateServiceStatus(pPageData->dlgInfo->pService);
+ ChangeListViewText(pPageData->dlgInfo->Info,
pPageData->dlgInfo->pService, LVSTATUS);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
break;
case IDC_EDIT:
- {
- HWND hName, hDesc, hExePath;
-
- hName = GetDlgItem(hwndDlg, IDC_DISP_NAME);
- hDesc = GetDlgItem(hwndDlg, IDC_DESCRIPTION);
- hExePath = GetDlgItem(hwndDlg, IDC_EXEPATH);
-
- SendMessage(hName, EM_SETREADONLY, FALSE, 0);
- SendMessage(hDesc, EM_SETREADONLY, FALSE, 0);
- SendMessage(hExePath, EM_SETREADONLY, FALSE, 0);
- break;
- }
-
+ SendDlgItemMessage(hwndDlg, IDC_DISP_NAME, EM_SETREADONLY, FALSE,
0);
+ SendDlgItemMessage(hwndDlg, IDC_DESCRIPTION, EM_SETREADONLY, FALSE,
0);
+ SendDlgItemMessage(hwndDlg, IDC_EXEPATH, EM_SETREADONLY, FALSE, 0);
+ break;
+
+ case IDC_DISP_NAME:
+ case IDC_DESCRIPTION:
+ case IDC_EXEPATH:
case IDC_START_PARAM:
- PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ if (HIWORD(wParam) == EN_CHANGE)
+ {
+ pPageData->bPageChanged = TRUE;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
break;
}
break;
case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code)
{
- LPNMHDR lpnm = (LPNMHDR)lParam;
-
- switch (lpnm->code)
- {
- case PSN_APPLY:
- SaveDlgInfo(dlgInfo, hwndDlg);
- SetButtonStates(dlgInfo, hwndDlg);
- break;
- }
+ case PSN_APPLY:
+ if (pPageData->bPageChanged)
+ {
+ SaveDlgInfo(pPageData->dlgInfo, hwndDlg);
+ SetButtonStates(pPageData->dlgInfo, hwndDlg);
+ pPageData->bPageChanged = FALSE;
+ }
+ break;
}
- break;
+ break;
}
return FALSE;
Modified: trunk/reactos/base/applications/mscutils/servman/propsheet_recovery.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/propsheet_recovery.c [iso-8859-1]
(original)
+++ trunk/reactos/base/applications/mscutils/servman/propsheet_recovery.c [iso-8859-1] Mon
Apr 17 12:48:51 2017
@@ -15,7 +15,7 @@
{
ENUM_SERVICE_STATUS_PROCESS *pService;
LPSERVICE_FAILURE_ACTIONS pServiceFailure;
-
+ BOOL bChanged;
} RECOVERYDATA, *PRECOVERYDATA;
static
@@ -364,6 +364,74 @@
0,
(LPARAM)szFile);
}
+}
+
+
+static
+VOID
+SetFailureActions(
+ HWND hwndDlg)
+{
+ SERVICE_FAILURE_ACTIONS FailureActions;
+ BOOL bRestartService = FALSE;
+ BOOL bRunProgram = FALSE;
+ BOOL bRebootComputer = FALSE;
+ INT id, index;
+
+ ZeroMemory(&FailureActions, sizeof(FailureActions));
+
+ /* Count the number of valid failure actions */
+ for (id = IDC_FIRST_FAILURE; id <= IDC_SUBSEQUENT_FAILURES; id++)
+ {
+ index = SendDlgItemMessageW(hwndDlg,
+ id,
+ CB_GETCURSEL,
+ 0,
+ 0);
+ switch (index)
+ {
+ case 1: /* Restart Service */
+ bRestartService = TRUE;
+ FailureActions.cActions++;
+ break;
+
+ case 2: /* Run Program */
+ bRunProgram = TRUE;
+ FailureActions.cActions++;
+ break;
+
+ case 3: /* Reboot Computer */
+ bRebootComputer = TRUE;
+ FailureActions.cActions++;
+ break;
+ }
+ }
+
+ if (bRestartService)
+ {
+ // IDC_RESTART_TIME
+ }
+
+ if (bRunProgram)
+ {
+ // IDC_RESTART_TIME
+ }
+
+ if (bRebootComputer)
+ {
+ // IDC_RESTART_TIME
+ }
+
+
+#if 0
+typedef struct _SERVICE_FAILURE_ACTIONS {
+ DWORD dwResetPeriod;
+ LPTSTR lpRebootMsg;
+ LPTSTR lpCommand;
+ DWORD cActions;
+ SC_ACTION *lpsaActions;
+} SERVICE_FAILURE_ACTIONS, *LPSERVICE_FAILURE_ACTIONS;
+#endif
}
@@ -423,13 +491,36 @@
if (HIWORD(wParam) == CBN_SELCHANGE)
{
UpdateFailureActions(hwndDlg, pRecoveryData);
+ pRecoveryData->bChanged = TRUE;
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
}
break;
+ case IDC_RESET_TIME:
+ case IDC_RESTART_TIME:
+ case IDC_PROGRAM:
+ case IDC_PARAMETERS:
+ if (HIWORD(wParam) == EN_CHANGE)
+ {
+ pRecoveryData->bChanged = TRUE;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+
+ case IDC_ADD_FAILCOUNT:
+ if (HIWORD(wParam) == BN_CLICKED)
+ {
+ pRecoveryData->bChanged = TRUE;
+ PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
+ }
+ break;
+
case IDC_BROWSE_PROGRAM:
BrowseFile(hwndDlg);
break;
+
+ case IDC_RESTART_OPTIONS:
+ break;
}
break;
@@ -437,6 +528,11 @@
switch (((LPNMHDR)lParam)->code)
{
case PSN_APPLY:
+ if (pRecoveryData->bChanged)
+ {
+ SetFailureActions(hwndDlg);
+ pRecoveryData->bChanged = FALSE;
+ }
break;
}
break;