mirror of
https://github.com/reactos/reactos.git
synced 2024-10-07 01:44:21 +00:00
add some old code I had floating around. no real in functionality
svn path=/trunk/; revision=29489
This commit is contained in:
parent
4bcdb4d441
commit
3a5583c86f
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "precomp.h"
|
||||
|
||||
static BOOL
|
||||
BOOL
|
||||
Control(PMAIN_WND_INFO Info,
|
||||
HWND hProgDlg,
|
||||
DWORD Control)
|
||||
|
@ -114,25 +114,6 @@ Control(PMAIN_WND_INFO Info,
|
|||
|
||||
}
|
||||
|
||||
BOOL DoStop(PMAIN_WND_INFO Info)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
HWND hProgDlg;
|
||||
|
||||
hProgDlg = CreateProgressDialog(Info->hMainWnd,
|
||||
Info->pCurrentService->lpServiceName,
|
||||
IDS_PROGRESS_INFO_STOP);
|
||||
if (hProgDlg)
|
||||
{
|
||||
ret = Control(Info,
|
||||
hProgDlg,
|
||||
SERVICE_CONTROL_STOP);
|
||||
|
||||
DestroyWindow(hProgDlg);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL DoPause(PMAIN_WND_INFO Info)
|
||||
{
|
||||
|
@ -154,6 +135,7 @@ BOOL DoPause(PMAIN_WND_INFO Info)
|
|||
return ret;
|
||||
}
|
||||
|
||||
|
||||
BOOL DoResume(PMAIN_WND_INFO Info)
|
||||
{
|
||||
BOOL ret = FALSE;
|
||||
|
@ -173,4 +155,3 @@ BOOL DoResume(PMAIN_WND_INFO Info)
|
|||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,6 +75,7 @@ BOOL CreateListView(PMAIN_WND_INFO Info);
|
|||
BOOL DoStart(PMAIN_WND_INFO Info);
|
||||
|
||||
/* control */
|
||||
BOOL Control(PMAIN_WND_INFO Info, HWND hProgDlg, DWORD Control);
|
||||
BOOL DoStop(PMAIN_WND_INFO Info);
|
||||
BOOL DoPause(PMAIN_WND_INFO Info);
|
||||
BOOL DoResume(PMAIN_WND_INFO Info);
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<file>query.c</file>
|
||||
<file>servman.c</file>
|
||||
<file>start.c</file>
|
||||
<file>stop.c</file>
|
||||
</compilationunit>
|
||||
<file>servman.rc</file>
|
||||
<pch>precomp.h</pch>
|
||||
|
|
96
reactos/base/applications/mscutils/servman/stop.c
Normal file
96
reactos/base/applications/mscutils/servman/stop.c
Normal file
|
@ -0,0 +1,96 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/applications/mscutils/servman/stop.c
|
||||
* PURPOSE: Stops running a service
|
||||
* COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "precomp.h"
|
||||
|
||||
BOOL
|
||||
DoStop(PMAIN_WND_INFO Info)
|
||||
{
|
||||
SC_HANDLE hSCManager = NULL;
|
||||
SC_HANDLE hSc = NULL;
|
||||
LPQUERY_SERVICE_CONFIG lpServiceConfig = NULL;
|
||||
HWND hProgDlg;
|
||||
DWORD BytesNeeded = 0;
|
||||
BOOL ret = FALSE;
|
||||
|
||||
hSCManager = OpenSCManager(NULL,
|
||||
NULL,
|
||||
SC_MANAGER_ENUMERATE_SERVICE);
|
||||
if (hSCManager == NULL)
|
||||
{
|
||||
GetError();
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hSc = OpenService(hSCManager,
|
||||
Info->pCurrentService->lpServiceName,
|
||||
SERVICE_QUERY_CONFIG);
|
||||
if (hSc)
|
||||
{
|
||||
if (!QueryServiceConfig(hSc,
|
||||
lpServiceConfig,
|
||||
0,
|
||||
&BytesNeeded))
|
||||
{
|
||||
if (GetLastError() == ERROR_INSUFFICIENT_BUFFER)
|
||||
{
|
||||
lpServiceConfig = (LPQUERY_SERVICE_CONFIG)HeapAlloc(ProcessHeap,
|
||||
0,
|
||||
BytesNeeded);
|
||||
if (lpServiceConfig == NULL)
|
||||
goto cleanup;
|
||||
|
||||
if (QueryServiceConfig(hSc,
|
||||
lpServiceConfig,
|
||||
BytesNeeded,
|
||||
&BytesNeeded))
|
||||
{
|
||||
if (lpServiceConfig->lpDependencies)
|
||||
{
|
||||
TCHAR str[500];
|
||||
|
||||
_sntprintf(str, 499, _T("%s depends on this service, implement the dialog to allow closing of other services"),
|
||||
lpServiceConfig->lpDependencies);
|
||||
MessageBox(NULL, str, NULL, 0);
|
||||
|
||||
//FIXME: open 'stop other services' box
|
||||
}
|
||||
else
|
||||
{
|
||||
hProgDlg = CreateProgressDialog(Info->hMainWnd,
|
||||
Info->pCurrentService->lpServiceName,
|
||||
IDS_PROGRESS_INFO_STOP);
|
||||
if (hProgDlg)
|
||||
{
|
||||
ret = Control(Info,
|
||||
hProgDlg,
|
||||
SERVICE_CONTROL_STOP);
|
||||
|
||||
DestroyWindow(hProgDlg);
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(ProcessHeap,
|
||||
0,
|
||||
lpServiceConfig);
|
||||
|
||||
lpServiceConfig = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
cleanup:
|
||||
if (hSCManager != NULL)
|
||||
CloseServiceHandle(hSCManager);
|
||||
if (hSc != NULL)
|
||||
CloseServiceHandle(hSc);
|
||||
|
||||
return ret;
|
||||
}
|
Loading…
Reference in a new issue