mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[SERVICES]
First step to support control sets. svn path=/trunk/; revision=56848
This commit is contained in:
parent
ef482f8abd
commit
847f94cf76
4 changed files with 118 additions and 0 deletions
|
@ -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
|
||||
|
|
105
reactos/base/system/services/controlset.c
Normal file
105
reactos/base/system/services/controlset.c
Normal 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 */
|
|
@ -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)
|
||||
|
|
|
@ -115,6 +115,11 @@ ScmReadDependencies(HKEY hServiceKey,
|
|||
DWORD *lpdwDependenciesLength);
|
||||
|
||||
|
||||
/* controlset.c */
|
||||
|
||||
BOOL ScmGetControlSetValues(VOID);
|
||||
|
||||
|
||||
/* database.c */
|
||||
|
||||
DWORD ScmCreateServiceDatabase(VOID);
|
||||
|
|
Loading…
Reference in a new issue