2 * PROJECT: ReactOS Services
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: base/applications/mscutils/servman/delete.c
5 * PURPOSE: Delete an existing service
6 * COPYRIGHT: Copyright 2006-2007 Ged Murphy <gedmurphy@reactos.org>
13 DoDeleteService(PMAIN_WND_INFO Info
,
20 hSCManager
= OpenSCManager(NULL
,
22 SC_MANAGER_ALL_ACCESS
);
25 hSc
= OpenService(hSCManager
,
26 Info
->pCurrentService
->lpServiceName
,
30 if (DeleteService(hSc
))
34 /* report success to user */
35 if (AllocAndLoadString(&lpSuccess
,
39 DisplayString(lpSuccess
);
49 CloseServiceHandle(hSc
);
52 CloseServiceHandle(hSCManager
);
60 DeleteDialogProc(HWND hDlg
,
65 PMAIN_WND_INFO Info
= NULL
;
68 /* Get the window context */
69 Info
= (PMAIN_WND_INFO
)GetWindowLongPtr(hDlg
,
71 if (Info
== NULL
&& message
!= WM_INITDIALOG
)
82 Info
= (PMAIN_WND_INFO
)lParam
;
85 SetWindowLongPtr(hDlg
,
89 hIcon
= (HICON
)LoadImage(hInstance
,
90 MAKEINTRESOURCE(IDI_SM_ICON
),
104 SendDlgItemMessage(hDlg
,
108 (LPARAM
)Info
->pCurrentService
->lpDisplayName
);
110 lpDescription
= GetServiceDescription(Info
->pCurrentService
->lpServiceName
);
113 SendDlgItemMessage(hDlg
,
117 (LPARAM
)lpDescription
);
118 HeapFree(ProcessHeap
,
131 switch (LOWORD(wParam
))
135 if (DoDeleteService(Info
, hDlg
))
137 (void)ListView_DeleteItem(Info
->hListView
,
139 UpdateServiceCount(Info
);