[SERVICES]

First step to support control sets.

svn path=/trunk/; revision=56848
This commit is contained in:
Eric Kohl 2012-07-07 18:17:59 +00:00
parent ef482f8abd
commit 847f94cf76
4 changed files with 118 additions and 0 deletions

View file

@ -9,6 +9,7 @@ add_rpc_files(server ${REACTOS_SOURCE_DIR}/include/reactos/idl/svcctl.idl)
list(APPEND SOURCE
config.c
controlset.c
database.c
driver.c
groupdb.c

View file

@ -0,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 */

View file

@ -403,6 +403,13 @@ wWinMain(HINSTANCE hInstance,
/* 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)

View file

@ -115,6 +115,11 @@ ScmReadDependencies(HKEY hServiceKey,
DWORD *lpdwDependenciesLength);
/* controlset.c */
BOOL ScmGetControlSetValues(VOID);
/* database.c */
DWORD ScmCreateServiceDatabase(VOID);