Author: gedmurphy
Date: Thu Oct 11 13:07:38 2007
New Revision: 29489
URL:
http://svn.reactos.org/svn/reactos?rev=29489&view=rev
Log:
add some old code I had floating around. no real in functionality
Added:
trunk/reactos/base/applications/mscutils/servman/stop.c (with props)
Modified:
trunk/reactos/base/applications/mscutils/servman/control.c
trunk/reactos/base/applications/mscutils/servman/precomp.h
trunk/reactos/base/applications/mscutils/servman/servman.rbuild
Modified: trunk/reactos/base/applications/mscutils/servman/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/control.c (original)
+++ trunk/reactos/base/applications/mscutils/servman/control.c Thu Oct 11 13:07:38 2007
@@ -9,7 +9,7 @@
#include "precomp.h"
-static BOOL
+BOOL
Control(PMAIN_WND_INFO Info,
HWND hProgDlg,
DWORD Control)
@@ -114,25 +114,6 @@
}
-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 @@
return ret;
}
+
BOOL DoResume(PMAIN_WND_INFO Info)
{
BOOL ret = FALSE;
@@ -173,4 +155,3 @@
return ret;
}
-
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 (original)
+++ trunk/reactos/base/applications/mscutils/servman/precomp.h Thu Oct 11 13:07:38 2007
@@ -75,6 +75,7 @@
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);
Modified: trunk/reactos/base/applications/mscutils/servman/servman.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/mscutils…
==============================================================================
--- trunk/reactos/base/applications/mscutils/servman/servman.rbuild (original)
+++ trunk/reactos/base/applications/mscutils/servman/servman.rbuild Thu Oct 11 13:07:38
2007
@@ -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>
Added: 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 (added)
+++ trunk/reactos/base/applications/mscutils/servman/stop.c Thu Oct 11 13:07:38 2007
@@ -1,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(a)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;
+}
Propchange: trunk/reactos/base/applications/mscutils/servman/stop.c
------------------------------------------------------------------------------
svn:eol-style = native