30 _In_opt_ PVOID Parameter,
35 _In_opt_ PVOID Parameter,
40 _In_opt_ PVOID Parameter,
103 _In_ HINSTANCE Instance,
105 _Reserved_ PVOID Reserved
110 case DLL_PROCESS_ATTACH:
122 info->
Url = L
"http://processhacker.sf.net/forums/viewtopic.php?t=1112";
129 &PluginLoadCallbackRegistration
135 &PluginShowOptionsCallbackRegistration
142 &NotifyEventCallbackRegistration
180 for (i = 0; i < FilterList->Count; i++)
193 for (i = 0; i < Source->Count; i++)
217 length = String->Length / 2;
222 for (i = 0; i < length; i++)
224 if (String->Buffer[i] ==
'\\')
230 switch (String->Buffer[i])
287 for (i = 0; i < FilterList->Count; i++)
302 for (j = 0; j < length; j++)
320 _In_opt_ PVOID Parameter,
343 _In_opt_ PVOID Parameter,
344 _In_opt_ PVOID Context
347 PROPSHEETHEADER propSheetHeader = {
sizeof(propSheetHeader) };
348 PROPSHEETPAGE propSheetPage;
349 HPROPSHEETPAGE pages[4];
351 propSheetHeader.dwFlags =
355 propSheetHeader.hwndParent = (HWND)Parameter;
356 propSheetHeader.pszCaption = L
"Extended Notifications";
357 propSheetHeader.nPages = 0;
358 propSheetHeader.nStartPage = 0;
359 propSheetHeader.phpage = pages;
362 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
363 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
364 propSheetPage.hInstance = PluginInstance->
DllBase;
367 pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
370 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
371 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
372 propSheetPage.hInstance = PluginInstance->
DllBase;
373 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_SERVICES);
375 pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
378 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
379 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
380 propSheetPage.hInstance = PluginInstance->
DllBase;
381 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_LOGGING);
383 pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
386 memset(&propSheetPage, 0,
sizeof(PROPSHEETPAGE));
387 propSheetPage.dwSize =
sizeof(PROPSHEETPAGE);
388 propSheetPage.hInstance = PluginInstance->
DllBase;
389 propSheetPage.pszTemplate = MAKEINTRESOURCE(
IDD_GROWL);
391 pages[propSheetHeader.nPages++] = CreatePropertySheetPage(&propSheetPage);
393 PropertySheet(&propSheetHeader);
407 for (i = 0; i < FilterList->Count; i++)
416 *FilterType = entry->
Type;
422 *FilterType = entry->
Type;
431 _In_opt_ PVOID Parameter,
432 _In_opt_ PVOID Context
439 BOOLEAN found =
FALSE;
443 switch (notifyEvent->
Type)
479 static BOOLEAN registered =
FALSE;
481 if (!Force && registered)
502 if (NotifyEvent->Handled)
505 switch (NotifyEvent->Type)
508 processItem = NotifyEvent->Parameter;
520 L
"The process %s (%lu) was started by %s.",
523 parentProcessItem ? parentProcessItem->
ProcessName->
Buffer : L
"an unknown process"
526 if (parentProcessItem)
531 processItem = NotifyEvent->Parameter;
543 serviceItem = NotifyEvent->Parameter;
548 message =
PhFormatString(L
"The service %s (%s) has been created.",
555 serviceItem = NotifyEvent->Parameter;
560 message =
PhFormatString(L
"The service %s (%s) has been deleted.",
567 serviceItem = NotifyEvent->Parameter;
572 message =
PhFormatString(L
"The service %s (%s) has been started.",
579 serviceItem = NotifyEvent->Parameter;
584 message =
PhFormatString(L
"The service %s (%s) has been stopped.",
600 NotifyEvent->Handled =
TRUE;
614 return STATUS_SUCCESS;
631 for (i = 0; i < FilterList->Count; i++)
637 ListBox_AddString(ListBox, string->
Buffer);
645 static LRESULT CALLBACK TextBoxSubclassProc(
650 _In_ UINT_PTR uIdSubclass,
651 _In_ ULONG_PTR dwRefData
657 RemoveWindowSubclass(hWnd, TextBoxSubclassProc, uIdSubclass);
661 if (wParam == VK_RETURN)
662 return DLGC_WANTALLKEYS;
667 if (wParam == VK_RETURN)
676 return DefSubclassProc(hWnd, uMsg, wParam, lParam);
687 i = ListBox_GetCurSel(ListBox);
688 count = ListBox_GetCount(ListBox);
690 EnableWindow(GetDlgItem(hwndDlg,
IDC_REMOVE), i != LB_ERR);
691 EnableWindow(GetDlgItem(hwndDlg,
IDC_MOVEUP), i != LB_ERR && i != 0);
692 EnableWindow(GetDlgItem(hwndDlg,
IDC_MOVEDOWN), i != LB_ERR && i != count - 1);
708 SetWindowSubclass(GetDlgItem(hwndDlg,
IDC_TEXT), TextBoxSubclassProc, 0, 0);
710 Button_SetCheck(GetDlgItem(hwndDlg,
IDC_INCLUDE), BST_CHECKED);
717 switch (LOWORD(wParam))
721 if (HIWORD(wParam) == LBN_SELCHANGE)
725 i = ListBox_GetCurSel(ListBox);
731 entry = FilterList->Items[i];
760 for (i = 0; i < FilterList->Count; i++)
762 entry = FilterList->Items[i];
770 if (i == FilterList->Count)
780 ListBox_InsertString(ListBox, 0, entryString->
Buffer);
783 ListBox_SetCurSel(ListBox, 0);
791 ListBox_DeleteString(ListBox, i);
793 ListBox_InsertString(ListBox, i, entryString->
Buffer);
796 ListBox_SetCurSel(ListBox, i);
799 SetFocus(GetDlgItem(hwndDlg,
IDC_TEXT));
800 Edit_SetSel(GetDlgItem(hwndDlg,
IDC_TEXT), 0, -1);
810 i = ListBox_GetCurSel(ListBox);
814 entry = FilterList->Items[i];
817 ListBox_DeleteString(ListBox, i);
819 if (i >= FilterList->Count)
820 i = FilterList->Count - 1;
822 ListBox_SetCurSel(ListBox, i);
834 i = ListBox_GetCurSel(ListBox);
836 if (i != LB_ERR && i != 0)
838 entry = FilterList->Items[i];
843 ListBox_DeleteString(ListBox, i);
845 ListBox_InsertString(ListBox, i - 1, entryString->
Buffer);
849 ListBox_SetCurSel(ListBox, i);
861 i = ListBox_GetCurSel(ListBox);
863 if (i != LB_ERR && i != FilterList->Count - 1)
865 entry = FilterList->Items[i];
870 ListBox_DeleteString(ListBox, i);
872 ListBox_InsertString(ListBox, i + 1, entryString->
Buffer);
876 ListBox_SetCurSel(ListBox, i);
900 GetDlgItem(hwndDlg,
IDC_LIST), EditingProcessFilterList))
917 EditingProcessFilterList = NULL;
922 switch (LOWORD(wParam))
930 LPNMHDR header = (LPNMHDR)lParam;
932 switch (header->code)
945 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
964 GetDlgItem(hwndDlg,
IDC_LIST), EditingServiceFilterList))
981 EditingServiceFilterList = NULL;
986 switch (LOWORD(wParam))
994 LPNMHDR header = (LPNMHDR)lParam;
996 switch (header->code)
1009 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
1036 switch (LOWORD(wParam))
1042 { L
"Log files (*.txt;*.log)", L
"*.txt;*.log" },
1043 { L
"All files (*.*)", L
"*.*" }
1070 LPNMHDR header = (LPNMHDR)lParam;
1072 switch (header->code)
1078 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);
1111 LPNMHDR header = (LPNMHDR)lParam;
1113 switch (header->code)
1115 case PSN_QUERYINITIALFOCUS:
1117 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, (LONG_PTR)GetDlgItem(hwndDlg,
IDC_ENABLEGROWL));
1127 SetWindowLongPtr(hwndDlg, DWLP_MSGRESULT, PSNRET_NOERROR);