mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 12:45:16 +00:00
- Shutdown services when the SCM is terminated
- Add basic code for shutting down of the SCM - Fix the headers svn path=/trunk/; revision=28902
This commit is contained in:
parent
7106e65cde
commit
2784609696
|
@ -1,5 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* config.c
|
* PROJECT: ReactOS Service Control Manager
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: base/system/services/config.c
|
||||||
|
* PURPOSE: Service configuration interface
|
||||||
|
* COPYRIGHT: Copyright 2005 Eric Kohl
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
|
@ -1,25 +1,11 @@
|
||||||
/*
|
/*
|
||||||
*
|
* PROJECT: ReactOS Service Control Manager
|
||||||
* service control manager
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
*
|
* FILE: base/system/services/database.c
|
||||||
* ReactOS Operating System
|
* PURPOSE: Database control interface
|
||||||
*
|
* COPYRIGHT: Copyright 2002-2006 Eric Kohl
|
||||||
* --------------------------------------------------------------------
|
* Copyright 2006 Hervé Poussineau <hpoussin@reactos.org>
|
||||||
*
|
* Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
|
||||||
* This software is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this software; see the file COPYING.LIB. If not, write
|
|
||||||
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
|
|
||||||
* MA 02139, USA.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -439,6 +425,18 @@ ScmCreateServiceDatabase(VOID)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ScmShutdownServiceDatabase(VOID)
|
||||||
|
{
|
||||||
|
DPRINT("ScmShutdownServiceDatabase() called\n");
|
||||||
|
|
||||||
|
ScmDeleteMarkedServices();
|
||||||
|
RtlDeleteResource(&DatabaseLock);
|
||||||
|
|
||||||
|
DPRINT("ScmShutdownServiceDatabase() done\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static NTSTATUS
|
static NTSTATUS
|
||||||
ScmCheckDriver(PSERVICE Service)
|
ScmCheckDriver(PSERVICE Service)
|
||||||
{
|
{
|
||||||
|
@ -1000,4 +998,32 @@ ScmAutoStartServices(VOID)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
VOID
|
||||||
|
ScmAutoShutdownServices(VOID)
|
||||||
|
{
|
||||||
|
PLIST_ENTRY ServiceEntry;
|
||||||
|
PSERVICE CurrentService;
|
||||||
|
SERVICE_STATUS ServiceStatus;
|
||||||
|
|
||||||
|
DPRINT("ScmAutoShutdownServices() called\n");
|
||||||
|
|
||||||
|
ServiceEntry = ServiceListHead.Flink;
|
||||||
|
while (ServiceEntry != &ServiceListHead)
|
||||||
|
{
|
||||||
|
CurrentService = CONTAINING_RECORD(ServiceEntry, SERVICE, ServiceListEntry);
|
||||||
|
|
||||||
|
if (CurrentService->Status.dwCurrentState == SERVICE_RUNNING ||
|
||||||
|
CurrentService->Status.dwCurrentState == SERVICE_START_PENDING)
|
||||||
|
{
|
||||||
|
/* shutdown service */
|
||||||
|
ScmControlService(CurrentService, SERVICE_CONTROL_STOP, &ServiceStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
ServiceEntry = ServiceEntry->Flink;
|
||||||
|
}
|
||||||
|
|
||||||
|
DPRINT("ScmGetBootAndSystemDriverState() done\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* driver.c
|
* PROJECT: ReactOS Service Control Manager
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: base/system/services/driver.c
|
||||||
|
* PURPOSE: Driver control interface
|
||||||
|
* COPYRIGHT: Copyright 2005-2006 Eric Kohl
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* groupdb.c
|
* PROJECT: ReactOS Service Control Manager
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: base/system/services/groupdb.c
|
||||||
|
* PURPOSE: Service group control interface
|
||||||
|
* COPYRIGHT: Copyright 2005 Eric Kohl
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES *****************************************************************/
|
/* INCLUDES *****************************************************************/
|
||||||
|
|
|
@ -1,5 +1,12 @@
|
||||||
/*
|
/*
|
||||||
|
* PROJECT: ReactOS Service Control Manager
|
||||||
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
|
* FILE: base/system/services/rpcserver.c
|
||||||
|
* PURPOSE: RPC server interface for the advapi32 calls
|
||||||
|
* COPYRIGHT: Copyright 2005-2006 Eric Kohl
|
||||||
|
* Copyright 2006-2007 Hervé Poussineau <hpoussin@reactos.org>
|
||||||
|
* Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
|
||||||
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* INCLUDES ****************************************************************/
|
/* INCLUDES ****************************************************************/
|
||||||
|
|
|
@ -1,24 +1,10 @@
|
||||||
/*
|
/*
|
||||||
* service control manager
|
* PROJECT: ReactOS Service Control Manager
|
||||||
*
|
* LICENSE: GPL - See COPYING in the top level directory
|
||||||
* ReactOS Operating System
|
* FILE: base/system/services/services.c
|
||||||
*
|
* PURPOSE: Main SCM controller
|
||||||
* --------------------------------------------------------------------
|
* COPYRIGHT: Copyright 2001-2005 Eric Kohl
|
||||||
*
|
* Copyright 2007 Ged Murphy <gedmurphy@reactos.org>
|
||||||
* This software is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License as
|
|
||||||
* published by the Free Software Foundation; either version 2 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This software is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
* Library General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this software; see the file COPYING.LIB. If not, write
|
|
||||||
* to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge,
|
|
||||||
* MA 02139, USA.
|
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -298,7 +284,8 @@ ShutdownHandlerRoutine(DWORD dwCtrlType)
|
||||||
DPRINT1("Shutdown event received!\n");
|
DPRINT1("Shutdown event received!\n");
|
||||||
ScmShutdown = TRUE;
|
ScmShutdown = TRUE;
|
||||||
|
|
||||||
/* FIXME: Shut all services down */
|
ScmAutoShutdownServices();
|
||||||
|
ScmShutdownServiceDatabase();
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -378,6 +365,8 @@ WinMain(HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
CloseHandle(hScmStartEvent);
|
||||||
|
|
||||||
DPRINT("SERVICES: Finished.\n");
|
DPRINT("SERVICES: Finished.\n");
|
||||||
|
|
||||||
ExitThread(0);
|
ExitThread(0);
|
||||||
|
|
|
@ -94,8 +94,10 @@ DWORD ScmReadString(HKEY hServiceKey,
|
||||||
/* database.c */
|
/* database.c */
|
||||||
|
|
||||||
DWORD ScmCreateServiceDatabase(VOID);
|
DWORD ScmCreateServiceDatabase(VOID);
|
||||||
|
VOID ScmShutdownServiceDatabase(VOID);
|
||||||
VOID ScmGetBootAndSystemDriverState(VOID);
|
VOID ScmGetBootAndSystemDriverState(VOID);
|
||||||
VOID ScmAutoStartServices(VOID);
|
VOID ScmAutoStartServices(VOID);
|
||||||
|
VOID ScmAutoShutdownServices(VOID);
|
||||||
DWORD ScmStartService(PSERVICE Service,
|
DWORD ScmStartService(PSERVICE Service,
|
||||||
LPWSTR lpArgs);
|
LPWSTR lpArgs);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue