ReactOS 0.4.15-dev-7788-g1ad9096
delete.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/sc/delete.c
5 * PURPOSE: Delete a service
6 * COPYRIGHT: Copyright 2005 - 2006 Ged Murphy <gedmurphy@gmail.com>
7 *
8 */
9
10#include "sc.h"
11
13{
14 SC_HANDLE hSCManager = NULL;
15 SC_HANDLE hSc = NULL;
16 BOOL bRet = TRUE;
17
18#ifdef SCDBG
19 _tprintf(_T("service to delete - %s\n\n"), ServiceName);
20#endif
21
23 NULL,
25 if (hSCManager == NULL)
26 {
27 _tprintf(_T("[SC] OpenSCManager FAILED %lu:\n\n"), GetLastError());
28 bRet = FALSE;
29 goto done;
30 }
31
33 if (hSc == NULL)
34 {
35 _tprintf(_T("[SC] OpenService FAILED %lu:\n\n"), GetLastError());
36 bRet = FALSE;
37 goto done;
38 }
39
40 if (!DeleteService(hSc))
41 {
42 _tprintf(_T("[SC] DeleteService FAILED %lu:\n\n"), GetLastError());
43 bRet = FALSE;
44 goto done;
45 }
46
47 _tprintf(_T("[SC] DeleteService SUCCESS\n\n"));
48
49done:
50 if (bRet == FALSE)
52
53 if (hSc)
55
56 if (hSCManager)
58
59 return bRet;
60}
BOOL Delete(LPCTSTR ServiceName)
Definition: delete.c:12
static WCHAR ServiceName[]
Definition: browser.c:19
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define _tprintf
Definition: tchar.h:506
DWORD ReportLastError(void)
Definition: loadlib.c:67
#define DELETE
Definition: nt_native.h:57
SC_HANDLE hSCManager
Definition: sc.c:12
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:921
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define _T(x)
Definition: vfdio.h:22
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define OpenSCManager
Definition: winsvc.h:575
#define SC_MANAGER_CONNECT
Definition: winsvc.h:14
#define OpenService
Definition: winsvc.h:576
const CHAR * LPCTSTR
Definition: xmlstorage.h:193