ReactOS 0.4.16-dev-197-g92996da
delete.c File Reference
#include "precomp.h"
Include dependency graph for delete.c:

Go to the source code of this file.

Functions

static BOOL DoDeleteService (PMAIN_WND_INFO Info, HWND hDlg)
 
INT_PTR CALLBACK DeleteDialogProc (HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
 

Function Documentation

◆ DeleteDialogProc()

INT_PTR CALLBACK DeleteDialogProc ( HWND  hDlg,
UINT  message,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 57 of file delete.c.

61{
64
65 /* Get the window context */
68 if (Info == NULL && message != WM_INITDIALOG)
69 {
70 return FALSE;
71 }
72
73 switch (message)
74 {
75 case WM_INITDIALOG:
76 {
77 LPWSTR lpDescription;
78
80 if (Info != NULL)
81 {
84 (LONG_PTR)Info);
85
89 16,
90 16,
91 0);
92 if (hIcon)
93 {
94 SendMessageW(hDlg,
95 WM_SETICON,
97 (LPARAM)hIcon);
99 }
100
104 0,
105 (LPARAM)Info->pCurrentService->lpDisplayName);
106
107 lpDescription = GetServiceDescription(Info->pCurrentService->lpServiceName);
108 if (lpDescription)
109 {
113 0,
114 (LPARAM)lpDescription);
116 0,
117 lpDescription);
118 }
119
120 return TRUE;
121 }
122
123 return FALSE;
124 }
125
126 case WM_COMMAND:
127 {
128 switch (LOWORD(wParam))
129 {
130 case IDOK:
131 {
132 if (DoDeleteService(Info, hDlg))
133 {
134 (void)ListView_DeleteItem(Info->hListView,
135 Info->SelectedItem);
137 }
138 EndDialog(hDlg,
139 LOWORD(wParam));
140 return TRUE;
141 }
142
143 case IDCANCEL:
144 {
145 EndDialog(hDlg,
146 LOWORD(wParam));
147 return TRUE;
148 }
149 }
150 }
151 }
152
153 return FALSE;
154}
static BOOL DoDeleteService(PMAIN_WND_INFO Info, HWND hDlg)
Definition: delete.c:13
VOID UpdateServiceCount(PMAIN_WND_INFO Info)
Definition: mainwnd.c:125
HANDLE ProcessHeap
Definition: servman.c:15
struct _MAIN_WND_INFO * PMAIN_WND_INFO
LPWSTR GetServiceDescription(LPWSTR lpServiceName)
Definition: query.c:135
#define IDC_DEL_NAME
Definition: resource.h:197
#define IDI_SM_ICON
Definition: resource.h:64
#define IDC_DEL_DESC
Definition: resource.h:198
HINSTANCE hInstance
Definition: charmap.c:19
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define HeapFree(x, y, z)
Definition: compat.h:735
static HICON
Definition: imagelist.c:80
HICON hIcon
Definition: msconfig.c:44
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define LOWORD(l)
Definition: pedump.c:82
#define ListView_DeleteItem(hwnd, i)
Definition: commctrl.h:2416
Definition: tftpd.h:60
#define ICON_SMALL
Definition: tnclass.cpp:48
#define GetWindowLongPtr
Definition: treelist.c:73
#define GWLP_USERDATA
Definition: treelist.c:63
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
Definition: wdfchildlist.h:690
LONG_PTR LPARAM
Definition: windef.h:208
#define IDCANCEL
Definition: winuser.h:834
#define IMAGE_ICON
Definition: winuser.h:212
#define WM_COMMAND
Definition: winuser.h:1743
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE hInst, _In_ LPCWSTR name, _In_ UINT type, _In_ int cx, _In_ int cy, _In_ UINT fuLoad)
Definition: cursoricon.c:2255
#define WM_INITDIALOG
Definition: winuser.h:1742
#define IDOK
Definition: winuser.h:833
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define WM_SETTEXT
Definition: winuser.h:1620
#define SetWindowLongPtrW
Definition: winuser.h:5358
#define MAKEINTRESOURCE
Definition: winuser.h:591
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
Definition: cursoricon.c:2105
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by MainWndCommand().

◆ DoDeleteService()

static BOOL DoDeleteService ( PMAIN_WND_INFO  Info,
HWND  hDlg 
)
static

Definition at line 13 of file delete.c.

15{
16 SC_HANDLE hSCManager;
17 SC_HANDLE hSc;
18 BOOL bRet = FALSE;
19
21 NULL,
23 if (hSCManager)
24 {
26 Info->pCurrentService->lpServiceName,
27 DELETE);
28 if (hSc)
29 {
30 if (DeleteService(hSc))
31 {
32 LPWSTR lpSuccess;
33
34 /* report success to user */
35 if (AllocAndLoadString(&lpSuccess,
38 {
39 DisplayString(lpSuccess);
40
41 LocalFree(lpSuccess);
42 }
43
44 bRet = TRUE;
45 }
46
48 }
49
51 }
52
53 return bRet;
54}
INT AllocAndLoadString(OUT LPTSTR *lpTarget, IN HINSTANCE hInst, IN UINT uID)
Definition: misc.c:59
VOID DisplayString(LPWSTR Msg)
Definition: misc.c:211
#define IDS_DELETE_SUCCESS
Definition: resource.h:200
unsigned int BOOL
Definition: ntddk_ex.h:94
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594
#define DELETE
Definition: nt_native.h:57
SC_HANDLE hSCManager
Definition: sc.c:12
BOOL WINAPI DeleteService(SC_HANDLE hService)
Definition: scm.c:921
SC_HANDLE WINAPI OpenSCManagerW(LPCWSTR lpMachineName, LPCWSTR lpDatabaseName, DWORD dwDesiredAccess)
Definition: scm.c:2068
SC_HANDLE WINAPI OpenServiceW(SC_HANDLE hSCManager, LPCWSTR lpServiceName, DWORD dwDesiredAccess)
Definition: scm.c:2160
BOOL WINAPI CloseServiceHandle(SC_HANDLE hSCObject)
Definition: scm.c:580
#define SC_MANAGER_ALL_ACCESS
Definition: winsvc.h:13

Referenced by DeleteDialogProc().