mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 23:12:56 +00:00
[SERVMAN]
Track changes to the general and and recovery pages. CORE-12743 svn path=/trunk/; revision=74349
This commit is contained in:
parent
dd0e23b691
commit
60f3172c4f
2 changed files with 175 additions and 65 deletions
|
@ -9,6 +9,14 @@
|
||||||
|
|
||||||
#include "precomp.h"
|
#include "precomp.h"
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct _PAGEDATA
|
||||||
|
{
|
||||||
|
PSERVICEPROPSHEET dlgInfo;
|
||||||
|
BOOL bPageChanged;
|
||||||
|
} PAGEDATA, *PPAGEDATA;
|
||||||
|
|
||||||
|
|
||||||
static VOID
|
static VOID
|
||||||
SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
SetButtonStates(PSERVICEPROPSHEET dlgInfo,
|
||||||
HWND hwndDlg)
|
HWND hwndDlg)
|
||||||
|
@ -184,8 +192,8 @@ InitGeneralPage(PSERVICEPROPSHEET dlgInfo,
|
||||||
0,
|
0,
|
||||||
(LPARAM)pServiceConfig->lpBinaryPathName);
|
(LPARAM)pServiceConfig->lpBinaryPathName);
|
||||||
HeapFree(ProcessHeap,
|
HeapFree(ProcessHeap,
|
||||||
0,
|
0,
|
||||||
pServiceConfig);
|
pServiceConfig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -197,10 +205,7 @@ InitGeneralPage(PSERVICEPROPSHEET dlgInfo,
|
||||||
|
|
||||||
if (dlgInfo->Info->bIsUserAnAdmin)
|
if (dlgInfo->Info->bIsUserAnAdmin)
|
||||||
{
|
{
|
||||||
HWND hEdit = GetDlgItem(hwndDlg,
|
EnableWindow(GetDlgItem(hwndDlg, IDC_EDIT), TRUE);
|
||||||
IDC_EDIT);
|
|
||||||
EnableWindow(hEdit,
|
|
||||||
TRUE);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -257,12 +262,12 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
WPARAM wParam,
|
WPARAM wParam,
|
||||||
LPARAM lParam)
|
LPARAM lParam)
|
||||||
{
|
{
|
||||||
PSERVICEPROPSHEET dlgInfo;
|
PPAGEDATA pPageData;
|
||||||
|
|
||||||
/* Get the window context */
|
/* Get the window context */
|
||||||
dlgInfo = (PSERVICEPROPSHEET)GetWindowLongPtr(hwndDlg,
|
pPageData = (PPAGEDATA)GetWindowLongPtr(hwndDlg,
|
||||||
GWLP_USERDATA);
|
GWLP_USERDATA);
|
||||||
if (dlgInfo == NULL && uMsg != WM_INITDIALOG)
|
if (pPageData == NULL && uMsg != WM_INITDIALOG)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
@ -270,26 +275,36 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
switch (uMsg)
|
switch (uMsg)
|
||||||
{
|
{
|
||||||
case WM_INITDIALOG:
|
case WM_INITDIALOG:
|
||||||
{
|
pPageData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PAGEDATA));
|
||||||
dlgInfo = (PSERVICEPROPSHEET)(((LPPROPSHEETPAGE)lParam)->lParam);
|
if (pPageData != NULL)
|
||||||
if (dlgInfo != NULL)
|
|
||||||
{
|
{
|
||||||
SetWindowLongPtr(hwndDlg,
|
SetWindowLongPtr(hwndDlg,
|
||||||
GWLP_USERDATA,
|
GWLP_USERDATA,
|
||||||
(LONG_PTR)dlgInfo);
|
(LONG_PTR)pPageData);
|
||||||
InitGeneralPage(dlgInfo, hwndDlg);
|
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
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:
|
case WM_COMMAND:
|
||||||
switch(LOWORD(wParam))
|
switch(LOWORD(wParam))
|
||||||
{
|
{
|
||||||
case IDC_START_TYPE:
|
case IDC_START_TYPE:
|
||||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||||
|
{
|
||||||
|
pPageData->bPageChanged = TRUE;
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
break;
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case IDC_START:
|
case IDC_START:
|
||||||
{
|
{
|
||||||
|
@ -300,90 +315,89 @@ GeneralPageProc(HWND hwndDlg,
|
||||||
lpStartParams = szStartParams;
|
lpStartParams = szStartParams;
|
||||||
|
|
||||||
RunActionWithProgress(hwndDlg,
|
RunActionWithProgress(hwndDlg,
|
||||||
dlgInfo->pService->lpServiceName,
|
pPageData->dlgInfo->pService->lpServiceName,
|
||||||
dlgInfo->pService->lpDisplayName,
|
pPageData->dlgInfo->pService->lpDisplayName,
|
||||||
ACTION_START,
|
ACTION_START,
|
||||||
lpStartParams);
|
lpStartParams);
|
||||||
|
|
||||||
UpdateServiceStatus(dlgInfo->pService);
|
UpdateServiceStatus(pPageData->dlgInfo->pService);
|
||||||
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
|
ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
SetButtonStates(pPageData->dlgInfo, hwndDlg);
|
||||||
SetServiceStatusText(dlgInfo, hwndDlg);
|
SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case IDC_STOP:
|
case IDC_STOP:
|
||||||
RunActionWithProgress(hwndDlg,
|
RunActionWithProgress(hwndDlg,
|
||||||
dlgInfo->pService->lpServiceName,
|
pPageData->dlgInfo->pService->lpServiceName,
|
||||||
dlgInfo->pService->lpDisplayName,
|
pPageData->dlgInfo->pService->lpDisplayName,
|
||||||
ACTION_STOP,
|
ACTION_STOP,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
UpdateServiceStatus(dlgInfo->pService);
|
UpdateServiceStatus(pPageData->dlgInfo->pService);
|
||||||
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
|
ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
SetButtonStates(pPageData->dlgInfo, hwndDlg);
|
||||||
SetServiceStatusText(dlgInfo, hwndDlg);
|
SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_PAUSE:
|
case IDC_PAUSE:
|
||||||
RunActionWithProgress(hwndDlg,
|
RunActionWithProgress(hwndDlg,
|
||||||
dlgInfo->pService->lpServiceName,
|
pPageData->dlgInfo->pService->lpServiceName,
|
||||||
dlgInfo->pService->lpDisplayName,
|
pPageData->dlgInfo->pService->lpDisplayName,
|
||||||
ACTION_PAUSE,
|
ACTION_PAUSE,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
UpdateServiceStatus(dlgInfo->pService);
|
UpdateServiceStatus(pPageData->dlgInfo->pService);
|
||||||
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
|
ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
SetButtonStates(pPageData->dlgInfo, hwndDlg);
|
||||||
SetServiceStatusText(dlgInfo, hwndDlg);
|
SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_RESUME:
|
case IDC_RESUME:
|
||||||
RunActionWithProgress(hwndDlg,
|
RunActionWithProgress(hwndDlg,
|
||||||
dlgInfo->pService->lpServiceName,
|
pPageData->dlgInfo->pService->lpServiceName,
|
||||||
dlgInfo->pService->lpDisplayName,
|
pPageData->dlgInfo->pService->lpDisplayName,
|
||||||
ACTION_RESUME,
|
ACTION_RESUME,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
UpdateServiceStatus(dlgInfo->pService);
|
UpdateServiceStatus(pPageData->dlgInfo->pService);
|
||||||
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
|
ChangeListViewText(pPageData->dlgInfo->Info, pPageData->dlgInfo->pService, LVSTATUS);
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
SetButtonStates(pPageData->dlgInfo, hwndDlg);
|
||||||
SetServiceStatusText(dlgInfo, hwndDlg);
|
SetServiceStatusText(pPageData->dlgInfo, hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case IDC_EDIT:
|
case IDC_EDIT:
|
||||||
{
|
SendDlgItemMessage(hwndDlg, IDC_DISP_NAME, EM_SETREADONLY, FALSE, 0);
|
||||||
HWND hName, hDesc, hExePath;
|
SendDlgItemMessage(hwndDlg, IDC_DESCRIPTION, EM_SETREADONLY, FALSE, 0);
|
||||||
|
SendDlgItemMessage(hwndDlg, IDC_EXEPATH, EM_SETREADONLY, FALSE, 0);
|
||||||
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;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
|
case IDC_DISP_NAME:
|
||||||
|
case IDC_DESCRIPTION:
|
||||||
|
case IDC_EXEPATH:
|
||||||
case IDC_START_PARAM:
|
case IDC_START_PARAM:
|
||||||
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
|
{
|
||||||
|
pPageData->bPageChanged = TRUE;
|
||||||
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WM_NOTIFY:
|
case WM_NOTIFY:
|
||||||
|
switch (((LPNMHDR)lParam)->code)
|
||||||
{
|
{
|
||||||
LPNMHDR lpnm = (LPNMHDR)lParam;
|
case PSN_APPLY:
|
||||||
|
if (pPageData->bPageChanged)
|
||||||
switch (lpnm->code)
|
{
|
||||||
{
|
SaveDlgInfo(pPageData->dlgInfo, hwndDlg);
|
||||||
case PSN_APPLY:
|
SetButtonStates(pPageData->dlgInfo, hwndDlg);
|
||||||
SaveDlgInfo(dlgInfo, hwndDlg);
|
pPageData->bPageChanged = FALSE;
|
||||||
SetButtonStates(dlgInfo, hwndDlg);
|
}
|
||||||
break;
|
break;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
@ -15,7 +15,7 @@ typedef struct _RECOVERYDATA
|
||||||
{
|
{
|
||||||
ENUM_SERVICE_STATUS_PROCESS *pService;
|
ENUM_SERVICE_STATUS_PROCESS *pService;
|
||||||
LPSERVICE_FAILURE_ACTIONS pServiceFailure;
|
LPSERVICE_FAILURE_ACTIONS pServiceFailure;
|
||||||
|
BOOL bChanged;
|
||||||
} RECOVERYDATA, *PRECOVERYDATA;
|
} RECOVERYDATA, *PRECOVERYDATA;
|
||||||
|
|
||||||
static
|
static
|
||||||
|
@ -367,6 +367,74 @@ BrowseFile(
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
INT_PTR
|
INT_PTR
|
||||||
CALLBACK
|
CALLBACK
|
||||||
RecoveryPageProc(
|
RecoveryPageProc(
|
||||||
|
@ -423,6 +491,26 @@ RecoveryPageProc(
|
||||||
if (HIWORD(wParam) == CBN_SELCHANGE)
|
if (HIWORD(wParam) == CBN_SELCHANGE)
|
||||||
{
|
{
|
||||||
UpdateFailureActions(hwndDlg, pRecoveryData);
|
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);
|
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -430,6 +518,9 @@ RecoveryPageProc(
|
||||||
case IDC_BROWSE_PROGRAM:
|
case IDC_BROWSE_PROGRAM:
|
||||||
BrowseFile(hwndDlg);
|
BrowseFile(hwndDlg);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case IDC_RESTART_OPTIONS:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -437,6 +528,11 @@ RecoveryPageProc(
|
||||||
switch (((LPNMHDR)lParam)->code)
|
switch (((LPNMHDR)lParam)->code)
|
||||||
{
|
{
|
||||||
case PSN_APPLY:
|
case PSN_APPLY:
|
||||||
|
if (pRecoveryData->bChanged)
|
||||||
|
{
|
||||||
|
SetFailureActions(hwndDlg);
|
||||||
|
pRecoveryData->bChanged = FALSE;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue