diff --git a/reactos/base/applications/mscutils/servman/mainwnd.c b/reactos/base/applications/mscutils/servman/mainwnd.c index 8d0ba98be68..58c71688342 100644 --- a/reactos/base/applications/mscutils/servman/mainwnd.c +++ b/reactos/base/applications/mscutils/servman/mainwnd.c @@ -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); diff --git a/reactos/base/applications/mscutils/servman/precomp.h b/reactos/base/applications/mscutils/servman/precomp.h index 43516c04928..9533bb921ba 100644 --- a/reactos/base/applications/mscutils/servman/precomp.h +++ b/reactos/base/applications/mscutils/servman/precomp.h @@ -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); diff --git a/reactos/base/applications/mscutils/servman/progress.c b/reactos/base/applications/mscutils/servman/progress.c index 74b944a256a..1948ef66204 100644 --- a/reactos/base/applications/mscutils/servman/progress.c +++ b/reactos/base/applications/mscutils/servman/progress.c @@ -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), diff --git a/reactos/base/applications/mscutils/servman/propsheet_general.c b/reactos/base/applications/mscutils/servman/propsheet_general.c index fe8029a48ea..c1852e6e048 100644 --- a/reactos/base/applications/mscutils/servman/propsheet_general.c +++ b/reactos/base/applications/mscutils/servman/propsheet_general.c @@ -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;