28 typedef struct _SERVICE_LIST_CONTEXT
30 HWND ServiceListHandle;
35 _In_ SC_HANDLE ServiceHandle,
44 ULONG servicesReturned;
47 State = SERVICE_STATE_ALL;
50 buffer = PhAllocate(bufferSize);
52 if (!(result = EnumDependentServices(
61 if (GetLastError() == ERROR_MORE_DATA)
64 bufferSize = returnLength;
65 buffer = PhAllocate(bufferSize);
67 result = EnumDependentServices(
84 *Count = servicesReturned;
89 static VOID EspLayoutServiceListControl(
91 _In_ HWND ServiceListHandle
97 MapWindowPoints(NULL, hwndDlg, (POINT *)&rect, 2);
103 rect.right - rect.left,
104 rect.bottom - rect.top,
118 if (uMsg == WM_INITDIALOG)
123 SetProp(hwndDlg, L
"Context", (HANDLE)context);
129 if (uMsg == WM_DESTROY)
130 RemoveProp(hwndDlg, L
"Context");
140 LPPROPSHEETPAGE propSheetPage = (LPPROPSHEETPAGE)lParam;
142 HWND serviceListHandle;
144 SC_HANDLE serviceHandle;
145 ULONG win32Result = 0;
146 BOOLEAN success =
FALSE;
149 SetDlgItemText(hwndDlg,
IDC_MESSAGE, L
"This service depends on the following services:");
156 LPQUERY_SERVICE_CONFIG serviceConfig;
163 dependency = serviceConfig->lpDependencies;
169 ULONG dependencyLength;
175 if (dependencyLength == 0)
178 if (dependency[0] == SC_GROUP_IDENTIFIER)
185 dependency += dependencyLength + 1;
192 context->ServiceListHandle = serviceListHandle;
193 EspLayoutServiceListControl(hwndDlg, serviceListHandle);
194 ShowWindow(serviceListHandle, SW_SHOW);
201 win32Result = GetLastError();
204 CloseServiceHandle(serviceHandle);
208 win32Result = GetLastError();
229 if (context->ServiceListHandle)
230 EspLayoutServiceListControl(hwndDlg, context->ServiceListHandle);
247 if (uMsg == WM_INITDIALOG)
252 SetProp(hwndDlg, L
"Context", (HANDLE)context);
258 if (uMsg == WM_DESTROY)
259 RemoveProp(hwndDlg, L
"Context");
269 LPPROPSHEETPAGE propSheetPage = (LPPROPSHEETPAGE)lParam;
271 HWND serviceListHandle;
273 SC_HANDLE serviceHandle;
274 ULONG win32Result = 0;
275 BOOLEAN success =
FALSE;
278 SetDlgItemText(hwndDlg,
IDC_MESSAGE, L
"The following services depend on this service:");
285 LPENUM_SERVICE_STATUS dependentServices;
286 ULONG numberOfDependentServices;
296 for (i = 0; i < numberOfDependentServices; i++)
305 context->ServiceListHandle = serviceListHandle;
306 EspLayoutServiceListControl(hwndDlg, serviceListHandle);
307 ShowWindow(serviceListHandle, SW_SHOW);
310 PhFree(dependentServices);
314 win32Result = GetLastError();
317 CloseServiceHandle(serviceHandle);
321 win32Result = GetLastError();
342 if (context->ServiceListHandle)
343 EspLayoutServiceListControl(hwndDlg, context->ServiceListHandle);