[SERVMAN]

- Allow params to be passed through the progress dialog
- PAss the start params

svn path=/trunk/; revision=67099
This commit is contained in:
Ged Murphy 2015-04-08 18:14:16 +00:00
parent 16cf1d284d
commit d73995a7ce
4 changed files with 38 additions and 38 deletions

View file

@ -475,7 +475,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
RunActionWithProgress(Info->hMainWnd,
Info->pCurrentService->lpServiceName,
Info->pCurrentService->lpDisplayName,
ACTION_START);
ACTION_START,
NULL); //FIXME: Add start params
UpdateServiceStatus(Info->pCurrentService);
ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
@ -489,7 +490,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
RunActionWithProgress(Info->hMainWnd,
Info->pCurrentService->lpServiceName,
Info->pCurrentService->lpDisplayName,
ACTION_STOP);
ACTION_STOP,
NULL);
UpdateServiceStatus(Info->pCurrentService);
ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
@ -502,7 +504,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
RunActionWithProgress(Info->hMainWnd,
Info->pCurrentService->lpServiceName,
Info->pCurrentService->lpDisplayName,
ACTION_PAUSE);
ACTION_PAUSE,
NULL);
UpdateServiceStatus(Info->pCurrentService);
ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
@ -514,7 +517,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
RunActionWithProgress(Info->hMainWnd,
Info->pCurrentService->lpServiceName,
Info->pCurrentService->lpDisplayName,
ACTION_RESUME);
ACTION_RESUME,
NULL);
UpdateServiceStatus(Info->pCurrentService);
ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);
@ -526,7 +530,8 @@ MainWndCommand(PMAIN_WND_INFO Info,
RunActionWithProgress(Info->hMainWnd,
Info->pCurrentService->lpServiceName,
Info->pCurrentService->lpDisplayName,
ACTION_RESTART);
ACTION_RESTART,
NULL);
UpdateServiceStatus(Info->pCurrentService);
ChangeListViewText(Info, Info->pCurrentService, LVSTATUS);

View file

@ -104,7 +104,7 @@ BOOL DoControlService(LPWSTR ServiceName, HWND hProgress, DWORD Control);
/* progress.c */
#define DEFAULT_STEP 0
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action);
BOOL RunActionWithProgress(HWND hParent, LPWSTR ServiceName, LPWSTR DisplayName, UINT Action, PVOID Param);
VOID IncrementProgressBar(HANDLE hProgress, UINT NewPos);
VOID CompleteProgressBar(HANDLE hProgress);

View file

@ -20,6 +20,7 @@ typedef struct _PROGRESS_DATA
ULONG Action;
BOOL StopDepends;
LPWSTR ServiceList;
PVOID Param;
} PROGRESS_DATA, *PPROGRESS_DATA;
@ -75,7 +76,7 @@ unsigned int __stdcall ActionThread(void* Param)
/* Start the service */
if (DoStartService(ProgressData->ServiceName,
ProgressData->hProgress,
NULL))
ProgressData->Param))
{
/* We're done, slide the progress bar up to the top */
CompleteProgressBar(ProgressData->hProgress);
@ -322,7 +323,8 @@ BOOL
RunActionWithProgress(HWND hParent,
LPWSTR ServiceName,
LPWSTR DisplayName,
UINT Action)
UINT Action,
PVOID Param)
{
PROGRESS_DATA ProgressData;
LPWSTR ServiceList;
@ -357,6 +359,7 @@ RunActionWithProgress(HWND hParent,
ProgressData.Action = Action;
ProgressData.StopDepends = StopDepends;
ProgressData.ServiceList = ServiceList;
ProgressData.Param = Param;
Result = DialogBoxParamW(hInstance,
MAKEINTRESOURCEW(IDD_DLG_PROGRESS),

View file

@ -247,26 +247,6 @@ SaveDlgInfo(PSERVICEPROPSHEET dlgInfo,
}
}
static
VOID
OnStart(HWND hwndDlg,
PSERVICEPROPSHEET dlgInfo)
{
WCHAR szStartParams[256];
LPWSTR lpStartParams = NULL;
if (GetDlgItemText(hwndDlg, IDC_START_PARAM, szStartParams, 256) > 0)
lpStartParams = szStartParams;
//if (DoStart(dlgInfo->Info, lpStartParams))
{
UpdateServiceStatus(dlgInfo->pService);
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
SetButtonStates(dlgInfo, hwndDlg);
SetServiceStatusText(dlgInfo, hwndDlg);
}
}
/*
* General Property dialog callback.
* Controls messages to the General dialog
@ -312,52 +292,64 @@ GeneralPageProc(HWND hwndDlg,
break;
case IDC_START:
{
WCHAR szStartParams[256];
LPWSTR lpStartParams = NULL;
if (GetDlgItemText(hwndDlg, IDC_START_PARAM, szStartParams, 256) > 0)
lpStartParams = szStartParams;
RunActionWithProgress(hwndDlg,
dlgInfo->pService->lpServiceName,
dlgInfo->pService->lpDisplayName,
ACTION_START);
ACTION_START,
lpStartParams);
UpdateServiceStatus(dlgInfo->pService);
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
SetButtonStates(dlgInfo, hwndDlg);
SetServiceStatusText(dlgInfo, hwndDlg);
break;
break;
}
case IDC_STOP:
RunActionWithProgress(hwndDlg,
dlgInfo->pService->lpServiceName,
dlgInfo->pService->lpDisplayName,
ACTION_STOP);
ACTION_STOP,
NULL);
UpdateServiceStatus(dlgInfo->pService);
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
SetButtonStates(dlgInfo, hwndDlg);
SetServiceStatusText(dlgInfo, hwndDlg);
break;
break;
case IDC_PAUSE:
RunActionWithProgress(hwndDlg,
dlgInfo->pService->lpServiceName,
dlgInfo->pService->lpDisplayName,
ACTION_PAUSE);
ACTION_PAUSE,
NULL);
UpdateServiceStatus(dlgInfo->pService);
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
SetButtonStates(dlgInfo, hwndDlg);
SetServiceStatusText(dlgInfo, hwndDlg);
break;
break;
case IDC_RESUME:
RunActionWithProgress(hwndDlg,
dlgInfo->pService->lpServiceName,
dlgInfo->pService->lpDisplayName,
ACTION_RESUME);
ACTION_RESUME,
NULL);
UpdateServiceStatus(dlgInfo->pService);
ChangeListViewText(dlgInfo->Info, dlgInfo->pService, LVSTATUS);
SetButtonStates(dlgInfo, hwndDlg);
SetServiceStatusText(dlgInfo, hwndDlg);
break;
break;
case IDC_EDIT:
{
@ -370,12 +362,12 @@ GeneralPageProc(HWND hwndDlg,
SendMessage(hName, EM_SETREADONLY, FALSE, 0);
SendMessage(hDesc, EM_SETREADONLY, FALSE, 0);
SendMessage(hExePath, EM_SETREADONLY, FALSE, 0);
break;
}
break;
case IDC_START_PARAM:
PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
break;
break;
}
break;