Author: ekohl
Date: Sat Jul 7 18:17:59 2012
New Revision: 56848
URL:
http://svn.reactos.org/svn/reactos?rev=56848&view=rev
Log:
[SERVICES]
First step to support control sets.
Added:
trunk/reactos/base/system/services/controlset.c (with props)
Modified:
trunk/reactos/base/system/services/CMakeLists.txt
trunk/reactos/base/system/services/services.c
trunk/reactos/base/system/services/services.h
Modified: trunk/reactos/base/system/services/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/CMake…
==============================================================================
--- trunk/reactos/base/system/services/CMakeLists.txt [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/CMakeLists.txt [iso-8859-1] Sat Jul 7 18:17:59
2012
@@ -9,6 +9,7 @@
list(APPEND SOURCE
config.c
+ controlset.c
database.c
driver.c
groupdb.c
Added: trunk/reactos/base/system/services/controlset.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/contr…
==============================================================================
--- trunk/reactos/base/system/services/controlset.c (added)
+++ trunk/reactos/base/system/services/controlset.c [iso-8859-1] Sat Jul 7 18:17:59 2012
@@ -1,0 +1,105 @@
+/*
+ * PROJECT: ReactOS Service Control Manager
+ * LICENSE: GPL - See COPYING in the top level directory
+ * FILE: base/system/services/controlset.c
+ * PURPOSE: Control Set Management
+ * COPYRIGHT: Copyright 2012 Eric Kohl
+ *
+ */
+
+/* INCLUDES *****************************************************************/
+
+#include "services.h"
+
+#define NDEBUG
+#include <debug.h>
+
+
+/* GLOBALS *******************************************************************/
+
+static DWORD dwCurrentControlSet;
+static DWORD dwDefaultControlSet;
+static DWORD dwFailedControlSet;
+static DWORD dwLastKnownGoodControlSet;
+
+
+/* FUNCTIONS *****************************************************************/
+
+BOOL
+ScmGetControlSetValues(VOID)
+{
+ HKEY hSelectKey;
+ DWORD dwType;
+ DWORD dwSize;
+ LONG lError;
+
+ DPRINT("ScmGetControlSetValues() called\n");
+
+ lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"System\\Select",
+ 0,
+ KEY_READ,
+ &hSelectKey);
+ if (lError != ERROR_SUCCESS)
+ return FALSE;
+
+ dwSize = sizeof(DWORD);
+ lError = RegQueryValueExW(hSelectKey,
+ L"Current",
+ 0,
+ &dwType,
+ (LPBYTE)&dwCurrentControlSet,
+ &dwSize);
+ if (lError != ERROR_SUCCESS)
+ {
+ dwCurrentControlSet = 0;
+ }
+
+ dwSize = sizeof(DWORD);
+ lError = RegQueryValueExW(hSelectKey,
+ L"Default",
+ 0,
+ &dwType,
+ (LPBYTE)&dwDefaultControlSet,
+ &dwSize);
+ if (lError != ERROR_SUCCESS)
+ {
+ dwDefaultControlSet = 0;
+ }
+
+ dwSize = sizeof(DWORD);
+ lError = RegQueryValueExW(hSelectKey,
+ L"Failed",
+ 0,
+ &dwType,
+ (LPBYTE)&dwFailedControlSet,
+ &dwSize);
+ if (lError != ERROR_SUCCESS)
+ {
+ dwFailedControlSet = 0;
+ }
+
+ dwSize = sizeof(DWORD);
+ lError = RegQueryValueExW(hSelectKey,
+ L"LastKnownGood",
+ 0,
+ &dwType,
+ (LPBYTE)&dwLastKnownGoodControlSet,
+ &dwSize);
+ if (lError != ERROR_SUCCESS)
+ {
+ dwLastKnownGoodControlSet = 0;
+ }
+
+ RegCloseKey(hSelectKey);
+
+ DPRINT("ControlSets:\n");
+ DPRINT("Current: %lu\n", dwCurrentControlSet);
+ DPRINT("Default: %lu\n", dwDefaultControlSet);
+ DPRINT("Failed: %lu\n", dwFailedControlSet);
+ DPRINT("LastKnownGood: %lu\n", dwLastKnownGoodControlSet);
+
+ return TRUE;
+}
+
+/* EOF */
Propchange: trunk/reactos/base/system/services/controlset.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: trunk/reactos/base/system/services/controlset.c
------------------------------------------------------------------------------
svn:keywords = author date id revision
Modified: trunk/reactos/base/system/services/services.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.c [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.c [iso-8859-1] Sat Jul 7 18:17:59 2012
@@ -403,6 +403,13 @@
/* FIXME: more initialization */
+ /* Read the control set values */
+ if (!ScmGetControlSetValues())
+ {
+ DPRINT1("SERVICES: failed to read the control set values\n");
+ goto done;
+ }
+
/* Create the service database */
dwError = ScmCreateServiceDatabase();
if (dwError != ERROR_SUCCESS)
Modified: trunk/reactos/base/system/services/services.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/system/services/servi…
==============================================================================
--- trunk/reactos/base/system/services/services.h [iso-8859-1] (original)
+++ trunk/reactos/base/system/services/services.h [iso-8859-1] Sat Jul 7 18:17:59 2012
@@ -115,6 +115,11 @@
DWORD *lpdwDependenciesLength);
+/* controlset.c */
+
+BOOL ScmGetControlSetValues(VOID);
+
+
/* database.c */
DWORD ScmCreateServiceDatabase(VOID);