2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/servman/stop.c
5 * PURPOSE: Stops running a service
6 * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
13 DoStop(PMAIN_WND_INFO Info
)
15 SC_HANDLE hSCManager
= NULL
;
17 LPQUERY_SERVICE_CONFIG lpServiceConfig
= NULL
;
19 DWORD BytesNeeded
= 0;
22 hSCManager
= OpenSCManager(NULL
,
24 SC_MANAGER_ENUMERATE_SERVICE
);
25 if (hSCManager
== NULL
)
31 hSc
= OpenService(hSCManager
,
32 Info
->pCurrentService
->lpServiceName
,
33 SERVICE_QUERY_CONFIG
);
36 if (!QueryServiceConfig(hSc
,
41 if (GetLastError() == ERROR_INSUFFICIENT_BUFFER
)
43 lpServiceConfig
= (LPQUERY_SERVICE_CONFIG
)HeapAlloc(ProcessHeap
,
46 if (lpServiceConfig
== NULL
)
49 if (QueryServiceConfig(hSc
,
55 if (lpServiceConfig
->lpDependencies
)
59 _sntprintf(str
, 499, _T("%s depends on this service, implement the dialog to allow closing of other services"),
60 lpServiceConfig
->lpDependencies
);
61 MessageBox(NULL
, str
, NULL
, 0);
63 //FIXME: open 'stop other services' box
68 hProgDlg
= CreateProgressDialog(Info
->hMainWnd
,
69 Info
->pCurrentService
->lpServiceName
,
70 IDS_PROGRESS_INFO_STOP
);
75 SERVICE_CONTROL_STOP
);
77 DestroyWindow(hProgDlg
);
85 lpServiceConfig
= NULL
;
92 if (hSCManager
!= NULL
)
93 CloseServiceHandle(hSCManager
);
95 CloseServiceHandle(hSc
);