mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 12:02:02 +00:00
Create a branch for header work.
svn path=/branches/header-work/; revision=45691
This commit is contained in:
parent
14fe274b1c
commit
9ea495ba33
19538 changed files with 0 additions and 1063950 deletions
47
base/applications/sc/delete.c
Normal file
47
base/applications/sc/delete.c
Normal file
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
* PROJECT: ReactOS Services
|
||||
* LICENSE: GPL - See COPYING in the top level directory
|
||||
* FILE: base/system/sc/delete.c
|
||||
* PURPOSE: Delete a service
|
||||
* COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
|
||||
*
|
||||
*/
|
||||
|
||||
#include "sc.h"
|
||||
|
||||
BOOL Delete(LPCTSTR ServiceName)
|
||||
{
|
||||
SC_HANDLE hSCManager = NULL;
|
||||
SC_HANDLE hSc = NULL;
|
||||
|
||||
#ifdef SCDBG
|
||||
_tprintf(_T("service to delete - %s\n\n"), ServiceName);
|
||||
#endif
|
||||
|
||||
hSCManager = OpenSCManager(NULL,
|
||||
NULL,
|
||||
SC_MANAGER_CONNECT);
|
||||
if (hSCManager != NULL)
|
||||
{
|
||||
hSc = OpenService(hSCManager, ServiceName, DELETE);
|
||||
if (hSc != NULL)
|
||||
{
|
||||
if (DeleteService(hSc))
|
||||
{
|
||||
_tprintf(_T("[SC] DeleteService SUCCESS\n"));
|
||||
|
||||
CloseServiceHandle(hSc);
|
||||
CloseServiceHandle(hSCManager);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ReportLastError();
|
||||
|
||||
if (hSc) CloseServiceHandle(hSc);
|
||||
if (hSCManager) CloseServiceHandle(hSCManager);
|
||||
|
||||
return FALSE;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue