Author: gedmurphy Date: Tue Jan 5 20:19:06 2010 New Revision: 44955
URL: http://svn.reactos.org/svn/reactos?rev=44955&view=rev Log: Display all service dependants which need stopping
Modified: trunk/reactos/base/applications/mscutils/servman/precomp.h trunk/reactos/base/applications/mscutils/servman/stop.c trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c
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 [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/precomp.h [iso-8859-1] Tue Jan 5 20:19:06 2010 @@ -43,6 +43,8 @@ BOOL bDlgOpen; BOOL bInMenuLoop; BOOL bIsUserAnAdmin; + + PVOID pTag;
} MAIN_WND_INFO, *PMAIN_WND_INFO;
Modified: trunk/reactos/base/applications/mscutils/servman/stop.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/stop.c [iso-8859-1] Tue Jan 5 20:19:06 2010 @@ -119,6 +119,7 @@ HWND hProgress; LPWSTR lpServiceList; BOOL bRet = FALSE; + BOOL bStop = TRUE;
if (pInfo) { @@ -129,33 +130,44 @@ lpServiceList = GetListOfServicesToStop(pInfo->pCurrentService->lpServiceName); if (lpServiceList) { + /* Tag the service list to the main wnd info */ + pInfo->pTag = (PVOID)lpServiceList; + /* List them and ask the user if they want to stop them */ if (DialogBoxParamW(hInstance, - MAKEINTRESOURCEW(IDD_DLG_DEPEND_STOP), - pInfo->hMainWnd, - StopDependsDialogProc, - (LPARAM)lpServiceList) == IDOK) + MAKEINTRESOURCEW(IDD_DLG_DEPEND_STOP), + pInfo->hMainWnd, + StopDependsDialogProc, + (LPARAM)pInfo) == IDOK) { /* Stop all the dependant services */ StopDependantServices(pInfo, pInfo->pCurrentService->lpServiceName); } + else + { + /* Don't stop the main service if the user selected not to */ + bStop = FALSE; + } } }
- /* Create a progress window to track the progress of the stopping service */ - hProgress = CreateProgressDialog(pInfo->hMainWnd, - pInfo->pCurrentService->lpServiceName, - IDS_PROGRESS_INFO_STOP); + if (bStop) + { + /* Create a progress window to track the progress of the stopping service */ + hProgress = CreateProgressDialog(pInfo->hMainWnd, + pInfo->pCurrentService->lpServiceName, + IDS_PROGRESS_INFO_STOP);
- /* Stop the requested service */ - bRet = StopService(pInfo, - pInfo->pCurrentService->lpServiceName, - hProgress); + /* Stop the requested service */ + bRet = StopService(pInfo, + pInfo->pCurrentService->lpServiceName, + hProgress);
- if (hProgress) - { - /* Complete and destroy the progress bar */ - DestroyProgressDialog(hProgress, TRUE); + if (hProgress) + { + /* Complete and destroy the progress bar */ + DestroyProgressDialog(hProgress, TRUE); + } } }
Modified: trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils/... ============================================================================== --- trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c [iso-8859-1] (original) +++ trunk/reactos/base/applications/mscutils/servman/stop_dependencies.c [iso-8859-1] Tue Jan 5 20:19:06 2010 @@ -125,10 +125,49 @@ }
+static VOID +AddServiceNamesToStop(HWND hServiceListBox, + LPWSTR lpServiceList) +{ + LPQUERY_SERVICE_CONFIG lpServiceConfig; + LPWSTR lpStr; + + lpStr = lpServiceList; + + /* Loop through all the services in the list */ + while (TRUE) + { + /* Break when we hit the double null */ + if (*lpStr == L'\0' && *(lpStr + 1) == L'\0') + break; + + /* If this isn't our first time in the loop we'll + have been left on a null char */ + if (*lpStr == L'\0') + lpStr++; + + /* Get the service's display name */ + lpServiceConfig = GetServiceConfig(lpStr); + if (lpServiceConfig) + { + /* Add the service to the listbox */ + SendMessageW(hServiceListBox, + LB_ADDSTRING, + 0, + (LPARAM)lpServiceConfig->lpDisplayName); + } + + /* Move onto the next string */ + while (*lpStr != L'\0') + lpStr++; + } +} + static BOOL DoInitDependsDialog(PMAIN_WND_INFO pInfo, HWND hDlg) { + HWND hServiceListBox; LPWSTR lpPartialStr, lpStr; DWORD fullLen; HICON hIcon = NULL; @@ -196,8 +235,14 @@ lpPartialStr); }
- /* FIXME: Load the list of services which need stopping */ - + /* Display the list of services which need stopping */ + hServiceListBox = GetDlgItem(hDlg, + IDC_STOP_DEPENDS_LB); + if (hServiceListBox) + { + AddServiceNamesToStop(hServiceListBox, + (LPWSTR)pInfo->pTag); + } }
return bRet;