28 _In_opt_ PVOID Parameter,
33 _In_opt_ PVOID Parameter,
38 _In_opt_ PVOID Parameter,
43 _In_opt_ PVOID Parameter,
48 _In_opt_ PVOID Parameter,
53 _In_opt_ PVOID Parameter,
67 _In_ HINSTANCE Instance,
69 _Reserved_ PVOID Reserved
74 case DLL_PROCESS_ATTACH:
85 info->
Description = L
"Extends service management capabilities.";
86 info->
Url = L
"http://processhacker.sf.net/forums/viewtopic.php?t=1113";
95 &PluginLoadCallbackRegistration
101 &PluginShowOptionsCallbackRegistration
107 &PluginMenuItemCallbackRegistration
114 &ProcessMenuInitializingCallbackRegistration
120 &ServicePropertiesInitializingCallbackRegistration
126 &ServiceMenuInitializingCallbackRegistration
145 _In_opt_ PVOID Parameter,
153 _In_opt_ PVOID Parameter,
161 _In_opt_ PVOID Parameter,
162 _In_opt_ PVOID Context
167 switch (menuItem->
Id)
198 SC_HANDLE serviceHandle;
199 ULONG win32Result = 0;
204 CloseServiceHandle(serviceHandle);
208 win32Result = GetLastError();
211 if (win32Result != 0)
225 static int __cdecl ServiceForServicesMenuCompare(
226 _In_
const void *elem1,
227 _In_
const void *elem2
237 _In_opt_ PVOID Parameter,
238 _In_opt_ PVOID Context
245 menuInfo->
u.
Process.NumberOfProcesses == 1 &&
246 menuInfo->
u.
Process.Processes[0]->ServiceList &&
247 menuInfo->
u.
Process.Processes[0]->ServiceList->Count != 0
252 ULONG enumerationKey;
259 processItem = menuInfo->
u.
Process.Processes[0];
284 if (serviceList->
Count != 1)
291 for (i = 0; i < serviceList->
Count; i++)
300 serviceItem = serviceList->
Items[i];
304 if (serviceList->
Count == 1)
312 if (serviceList->
Count == 1)
315 servicesMenuItem = serviceMenuItem;
327 #define SET_MENU_ITEM_ENABLED(MenuItem, Enabled) if (!(Enabled)) (MenuItem)->Flags |= PH_EMENU_DISABLED;
329 switch (serviceItem->
State)
331 case SERVICE_RUNNING:
351 case SERVICE_STOPPED:
358 case SERVICE_START_PENDING:
359 case SERVICE_CONTINUE_PENDING:
360 case SERVICE_PAUSE_PENDING:
361 case SERVICE_STOP_PENDING:
379 if (serviceList->
Count != 1)
390 if (!priorityMenuItem)
393 if (priorityMenuItem)
403 _In_opt_ PVOID Parameter,
404 _In_opt_ PVOID Context
408 PROPSHEETPAGE propSheetPage;
411 serviceItem = objectProperties->
Parameter;
416 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
417 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
418 propSheetPage.hInstance = PluginInstance->
DllBase;
419 propSheetPage.lParam = (LPARAM)serviceItem;
421 if (!(serviceItem->
Flags & SERVICE_RUNS_IN_SYSTEM_PROCESS))
434 objectProperties->
Pages[objectProperties->
NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
440 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
441 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
442 propSheetPage.dwFlags = PSP_USETITLE;
443 propSheetPage.hInstance = PluginInstance->
DllBase;
444 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_SRVLIST);
445 propSheetPage.pszTitle = L
"Dependencies";
447 propSheetPage.lParam = (LPARAM)serviceItem;
448 objectProperties->
Pages[objectProperties->
NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
454 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
455 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
456 propSheetPage.dwFlags = PSP_USETITLE;
457 propSheetPage.hInstance = PluginInstance->
DllBase;
458 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_SRVLIST);
459 propSheetPage.pszTitle = L
"Dependents";
461 propSheetPage.lParam = (LPARAM)serviceItem;
462 objectProperties->
Pages[objectProperties->
NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
468 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
469 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
470 propSheetPage.dwFlags = PSP_USETITLE;
471 propSheetPage.hInstance = PluginInstance->
DllBase;
473 propSheetPage.pszTitle = L
"Triggers";
475 propSheetPage.lParam = (LPARAM)serviceItem;
476 objectProperties->
Pages[objectProperties->
NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
482 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
483 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
484 propSheetPage.dwFlags = PSP_USETITLE;
485 propSheetPage.hInstance = PluginInstance->
DllBase;
486 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_SRVOTHER);
487 propSheetPage.pszTitle = L
"Other";
489 propSheetPage.lParam = (LPARAM)serviceItem;
490 objectProperties->
Pages[objectProperties->
NumberOfPages++] = CreatePropertySheetPage(&propSheetPage);
495 _In_opt_ PVOID Parameter,
496 _In_opt_ PVOID Context
501 ULONG indexOfMenuItem;
504 menuInfo->
u.
Service.NumberOfServices == 1 &&
505 (menuInfo->
u.
Service.Services[0]->State == SERVICE_RUNNING || menuInfo->
u.
Service.Services[0]->State == SERVICE_PAUSED)
515 indexOfMenuItem = -1;