5 #define PHAPPAPI __declspec(dllexport)
19 #include "../resource.h"
21 #define KPH_ERROR_MESSAGE (L"KProcessHacker does not support your operating system " \
22 L"or could not be loaded. Make sure Process Hacker is running " \
23 L"with administrative privileges.")
94 _In_ HWND DialogWindowHandle
101 _In_ HWND DialogWindowHandle
155 _In_ HANDLE ProcessHandle,
160 _In_ HANDLE ProcessHandle
164 _In_ PWSTR PackageFullName
199 _In_ HANDLE ProcessHandle,
228 _Out_ PPH_KNOWN_PROCESS_COMMAND_LINE KnownCommandLine
235 _In_ WNDENUMPROC Callback,
241 _In_opt_ HANDLE ProcessHandle
246 _In_ SC_HANDLE ServiceHandle
281 _In_ BOOLEAN UseShellExecute,
282 _In_opt_ PWSTR ErrorMessage
289 _Inout_ PPH_SYMBOL_PROVIDER SymbolProvider
302 _Inout_ LPNMLVGETINFOTIP GetInfoTip,
310 _In_ HWND ListViewHandle
316 _In_ HWND ListViewHandle
320 #define PH_LIST_VIEW_CTRL_C_BEHAVIOR 0x1
321 #define PH_LIST_VIEW_CTRL_A_BEHAVIOR 0x2
322 #define PH_LIST_VIEW_DEFAULT_1_BEHAVIORS (PH_LIST_VIEW_CTRL_C_BEHAVIOR | PH_LIST_VIEW_CTRL_A_BEHAVIOR)
326 _In_ HWND ListViewHandle,
335 _In_ HWND ListViewHandle,
346 _In_ HWND WindowHandle,
347 _In_ ULONG OpacityPercent
350 #define PH_OPACITY_TO_ID(Opacity) (ID_OPACITY_10 + (10 - (Opacity) / 10) - 1)
351 #define PH_ID_TO_OPACITY(Id) (100 - (((Id) - ID_OPACITY_10) + 1) * 10)
358 _In_opt_ PWSTR PositionSettingName,
359 _In_opt_ PWSTR SizeSettingName,
360 _In_ HWND WindowHandle
367 _In_opt_ PWSTR PositionSettingName,
368 _In_opt_ PWSTR SizeSettingName,
369 _In_ HWND WindowHandle
377 _In_ HWND ListViewHandle
385 _In_ HWND ListViewHandle
399 _Out_opt_ PULONG MajorVersion,
400 _Out_opt_ PULONG MinorVersion,
401 _Reserved_ PULONG Reserved,
402 _Out_opt_ PULONG RevisionNumber
412 #define PH_SHELL_APP_PROPAGATE_PARAMETERS 0x1
413 #define PH_SHELL_APP_PROPAGATE_PARAMETERS_IGNORE_VISIBILITY 0x2
414 #define PH_SHELL_APP_PROPAGATE_PARAMETERS_FORCE_SETTINGS 0x4
421 _In_opt_ PWSTR Parameters,
422 _In_ ULONG ShowWindowType,
425 _In_opt_ ULONG Timeout,
426 _Out_opt_ PHANDLE ProcessHandle
432 _In_opt_ PWSTR FileName,
433 _In_opt_ PWSTR Parameters,
434 _In_ ULONG ShowWindowType,
437 _In_opt_ ULONG Timeout,
438 _Out_opt_ PHANDLE ProcessHandle
458 #define PH_TN_COLUMN_MENU_HIDE_COLUMN_ID ((ULONG)-1)
459 #define PH_TN_COLUMN_MENU_CHOOSE_COLUMNS_ID ((ULONG)-2)
460 #define PH_TN_COLUMN_MENU_SIZE_COLUMN_TO_FIT_ID ((ULONG)-3)
461 #define PH_TN_COLUMN_MENU_SIZE_ALL_COLUMNS_TO_FIT_ID ((ULONG)-4)
462 #define PH_TN_COLUMN_MENU_RESET_SORT_ID ((ULONG)-5)
468 _Inout_ PPH_TN_COLUMN_MENU_DATA Data
472 #define PH_TN_COLUMN_MENU_NO_VISIBILITY 0x1
473 #define PH_TN_COLUMN_MENU_SHOW_RESET_SORT 0x2
476 _Inout_ PPH_TN_COLUMN_MENU_DATA Data,
485 _Inout_ PPH_TN_COLUMN_MENU_DATA Data
492 _In_ PPH_TN_COLUMN_MENU_DATA Data
504 _In_opt_ PVOID Context
517 _Out_ PPH_TN_FILTER_SUPPORT Support,
518 _In_ HWND TreeNewHandle,
526 _In_ PPH_TN_FILTER_SUPPORT Support
533 _In_ PPH_TN_FILTER_SUPPORT Support,
535 _In_opt_ PVOID Context
542 _In_ PPH_TN_FILTER_SUPPORT Support,
543 _In_ PPH_TN_FILTER_ENTRY Entry
550 _In_ PPH_TN_FILTER_SUPPORT Support,
558 _In_ PPH_TN_FILTER_SUPPORT Support
571 _In_ ULONG InsertAfterId,
572 _In_ HWND TreeNewHandle,
585 #define PH_LOAD_SHARED_IMAGE(Name, Type) LoadImage(PhInstanceHandle, (Name), (Type), 0, 0, LR_SHARED)
592 _In_ PWSTR ContextName
601 LPPROPSHEETPAGE propSheetPage = (LPPROPSHEETPAGE)lParam;
603 context = (PVOID)propSheetPage->lParam;
604 SetProp(hwndDlg, ContextName, (HANDLE)context);
609 context = (PVOID)GetProp(hwndDlg, ContextName);
610 RemoveProp(hwndDlg, ContextName);
615 context = (PVOID)GetProp(hwndDlg, ContextName);
625 #define PH_MAINWND_CLASSNAME L"ProcessHacker" // phapppub
627 #ifndef PH_MAINWND_PRIVATE
632 #define WM_PH_FIRST (WM_APP + 99)
633 #define WM_PH_ACTIVATE (WM_APP + 99)
634 #define PH_ACTIVATE_REPLY 0x1119
636 #define WM_PH_PROCESS_ADDED (WM_APP + 101)
637 #define WM_PH_PROCESS_MODIFIED (WM_APP + 102)
638 #define WM_PH_PROCESS_REMOVED (WM_APP + 103)
639 #define WM_PH_PROCESSES_UPDATED (WM_APP + 104)
641 #define WM_PH_SERVICE_ADDED (WM_APP + 105)
642 #define WM_PH_SERVICE_MODIFIED (WM_APP + 106)
643 #define WM_PH_SERVICE_REMOVED (WM_APP + 107)
644 #define WM_PH_SERVICES_UPDATED (WM_APP + 108)
646 #define WM_PH_NETWORK_ITEM_ADDED (WM_APP + 109)
647 #define WM_PH_NETWORK_ITEM_MODIFIED (WM_APP + 110)
648 #define WM_PH_NETWORK_ITEM_REMOVED (WM_APP + 111)
649 #define WM_PH_NETWORK_ITEMS_UPDATED (WM_APP + 112)
652 #define WM_PH_SHOW_PROCESS_PROPERTIES (WM_APP + 120)
653 #define WM_PH_DESTROY (WM_APP + 121)
654 #define WM_PH_SAVE_ALL_SETTINGS (WM_APP + 122)
655 #define WM_PH_PREPARE_FOR_EARLY_SHUTDOWN (WM_APP + 123)
656 #define WM_PH_CANCEL_EARLY_SHUTDOWN (WM_APP + 124)
658 #define WM_PH_DELAYED_LOAD_COMPLETED (WM_APP + 125)
659 #define WM_PH_NOTIFY_ICON_MESSAGE (WM_APP + 126)
661 #define WM_PH_TOGGLE_VISIBLE (WM_APP + 127)
662 #define WM_PH_SHOW_MEMORY_EDITOR (WM_APP + 128)
663 #define WM_PH_SHOW_MEMORY_RESULTS (WM_APP + 129)
664 #define WM_PH_SELECT_TAB_PAGE (WM_APP + 130)
665 #define WM_PH_GET_CALLBACK_LAYOUT_PADDING (WM_APP + 131)
666 #define WM_PH_INVALIDATE_LAYOUT_PADDING (WM_APP + 132)
667 #define WM_PH_SELECT_PROCESS_NODE (WM_APP + 133)
668 #define WM_PH_SELECT_SERVICE_ITEM (WM_APP + 134)
669 #define WM_PH_SELECT_NETWORK_ITEM (WM_APP + 135)
671 #define WM_PH_UPDATE_FONT (WM_APP + 136)
672 #define WM_PH_GET_FONT (WM_APP + 137)
674 #define WM_PH_INVOKE (WM_APP + 138)
675 #define WM_PH_ADD_MENU_ITEM (WM_APP + 139)
676 #define WM_PH_ADD_TAB_PAGE (WM_APP + 140)
677 #define WM_PH_REFRESH (WM_APP + 141)
678 #define WM_PH_GET_UPDATE_AUTOMATICALLY (WM_APP + 142)
679 #define WM_PH_SET_UPDATE_AUTOMATICALLY (WM_APP + 143)
681 #define WM_PH_ICON_CLICK (WM_APP + 144)
682 #define WM_PH_LAST (WM_APP + 144)
685 #define ProcessHacker_ShowProcessProperties(hWnd, ProcessItem) \
686 SendMessage(hWnd, WM_PH_SHOW_PROCESS_PROPERTIES, 0, (LPARAM)(ProcessItem))
687 #define ProcessHacker_Destroy(hWnd) \
688 SendMessage(hWnd, WM_PH_DESTROY, 0, 0)
689 #define ProcessHacker_SaveAllSettings(hWnd) \
690 SendMessage(hWnd, WM_PH_SAVE_ALL_SETTINGS, 0, 0)
691 #define ProcessHacker_PrepareForEarlyShutdown(hWnd) \
692 SendMessage(hWnd, WM_PH_PREPARE_FOR_EARLY_SHUTDOWN, 0, 0)
693 #define ProcessHacker_CancelEarlyShutdown(hWnd) \
694 SendMessage(hWnd, WM_PH_CANCEL_EARLY_SHUTDOWN, 0, 0)
695 #define ProcessHacker_ToggleVisible(hWnd, AlwaysShow) \
696 SendMessage(hWnd, WM_PH_TOGGLE_VISIBLE, (WPARAM)(AlwaysShow), 0)
697 #define ProcessHacker_ShowMemoryEditor(hWnd, ShowMemoryEditor) \
698 PostMessage(hWnd, WM_PH_SHOW_MEMORY_EDITOR, 0, (LPARAM)(ShowMemoryEditor))
699 #define ProcessHacker_ShowMemoryResults(hWnd, ShowMemoryResults) \
700 PostMessage(hWnd, WM_PH_SHOW_MEMORY_RESULTS, 0, (LPARAM)(ShowMemoryResults))
701 #define ProcessHacker_SelectTabPage(hWnd, Index) \
702 SendMessage(hWnd, WM_PH_SELECT_TAB_PAGE, (WPARAM)(Index), 0)
703 #define ProcessHacker_GetCallbackLayoutPadding(hWnd) \
704 ((PPH_CALLBACK)SendMessage(hWnd, WM_PH_GET_CALLBACK_LAYOUT_PADDING, 0, 0))
705 #define ProcessHacker_InvalidateLayoutPadding(hWnd) \
706 SendMessage(hWnd, WM_PH_INVALIDATE_LAYOUT_PADDING, 0, 0)
707 #define ProcessHacker_SelectProcessNode(hWnd, ProcessNode) \
708 SendMessage(hWnd, WM_PH_SELECT_PROCESS_NODE, 0, (LPARAM)(ProcessNode))
709 #define ProcessHacker_SelectServiceItem(hWnd, ServiceItem) \
710 SendMessage(hWnd, WM_PH_SELECT_SERVICE_ITEM, 0, (LPARAM)(ServiceItem))
711 #define ProcessHacker_SelectNetworkItem(hWnd, NetworkItem) \
712 SendMessage(hWnd, WM_PH_SELECT_NETWORK_ITEM, 0, (LPARAM)(NetworkItem))
713 #define ProcessHacker_Invoke(hWnd, Function, Parameter) \
714 PostMessage(hWnd, WM_PH_INVOKE, (WPARAM)(Parameter), (LPARAM)(Function))
715 #define ProcessHacker_AddMenuItem(hWnd, AddMenuItem) \
716 ((ULONG_PTR)SendMessage(hWnd, WM_PH_ADD_MENU_ITEM, 0, (LPARAM)(AddMenuItem)))
717 #define ProcessHacker_AddTabPage(hWnd, TabPage) \
718 ((PPH_ADDITIONAL_TAB_PAGE)SendMessage(hWnd, WM_PH_ADD_TAB_PAGE, 0, (LPARAM)(TabPage)))
719 #define ProcessHacker_Refresh(hWnd) \
720 SendMessage(hWnd, WM_PH_REFRESH, 0, 0)
721 #define ProcessHacker_GetUpdateAutomatically(hWnd) \
722 ((BOOLEAN)SendMessage(hWnd, WM_PH_GET_UPDATE_AUTOMATICALLY, 0, 0))
723 #define ProcessHacker_SetUpdateAutomatically(hWnd, Value) \
724 SendMessage(hWnd, WM_PH_SET_UPDATE_AUTOMATICALLY, (WPARAM)(Value), 0)
726 #define ProcessHacker_IconClick(hWnd) \
727 SendMessage(hWnd, WM_PH_ICON_CLICK, 0, 0)
768 _In_ PVOID Parameter1,
769 _In_ PVOID Parameter2,
770 _In_ PVOID Parameter3,
790 #define PH_NOTIFY_MINIMUM 0x1
791 #define PH_NOTIFY_PROCESS_CREATE 0x1
792 #define PH_NOTIFY_PROCESS_DELETE 0x2
793 #define PH_NOTIFY_SERVICE_CREATE 0x4
794 #define PH_NOTIFY_SERVICE_DELETE 0x8
795 #define PH_NOTIFY_SERVICE_START 0x10
796 #define PH_NOTIFY_SERVICE_STOP 0x20
797 #define PH_NOTIFY_MAXIMUM 0x40
798 #define PH_NOTIFY_VALID_MASK 0x3f
806 _In_ PWSTR DbgHelpPath
880 #define PH_PROCESS_PROPCONTEXT_MAXPAGES 20
913 PPH_PROCESS_PROPCONTEXT
916 _In_ HWND ParentWindowHandle,
922 _Inout_ PPH_PROCESS_PROPCONTEXT PropContext
930 _Inout_ PPH_PROCESS_PROPCONTEXT PropContext,
938 _Inout_ PPH_PROCESS_PROPCONTEXT PropContext,
939 _In_
_Assume_refs_(1) PPH_PROCESS_PROPPAGECONTEXT PropPageContext
946 _Inout_ PPH_PROCESS_PROPCONTEXT PropContext,
947 _In_ HPROPSHEETPAGE PropSheetPageHandle
951 PPH_PROCESS_PROPPAGECONTEXT
954 _In_ LPCWSTR Template,
955 _In_ DLGPROC DlgProc,
956 _In_opt_ PVOID Context
960 PPH_PROCESS_PROPPAGECONTEXT
963 _In_opt_ PVOID InstanceHandle,
964 _In_ LPCWSTR Template,
965 _In_ DLGPROC DlgProc,
966 _In_opt_ PVOID Context
976 _Out_ LPPROPSHEETPAGE *PropSheetPage,
977 _Out_ PPH_PROCESS_PROPPAGECONTEXT *PropPageContext,
988 #define PH_PROP_PAGE_TAB_CONTROL_PARENT ((PPH_LAYOUT_ITEM)0x1)
1011 _In_ PPH_PROCESS_PROPPAGECONTEXT PropPageContext
1014 if (!PropPageContext->LayoutInitialized)
1029 _In_ PPH_PROCESS_PROPPAGECONTEXT PropPageContext
1033 PropPageContext->LayoutInitialized =
TRUE;
1040 _In_ PPH_PROCESS_PROPCONTEXT Context
1046 #define PH_LOG_ENTRY_PROCESS_FIRST 1
1047 #define PH_LOG_ENTRY_PROCESS_CREATE 1
1048 #define PH_LOG_ENTRY_PROCESS_DELETE 2
1049 #define PH_LOG_ENTRY_PROCESS_LAST 2
1051 #define PH_LOG_ENTRY_SERVICE_FIRST 3
1052 #define PH_LOG_ENTRY_SERVICE_CREATE 3
1053 #define PH_LOG_ENTRY_SERVICE_DELETE 4
1054 #define PH_LOG_ENTRY_SERVICE_START 5
1055 #define PH_LOG_ENTRY_SERVICE_STOP 6
1056 #define PH_LOG_ENTRY_SERVICE_CONTINUE 7
1057 #define PH_LOG_ENTRY_SERVICE_PAUSE 8
1058 #define PH_LOG_ENTRY_SERVICE_LAST 8
1060 #define PH_LOG_ENTRY_MESSAGE 9 // phapppub
1089 #ifndef PH_LOG_PRIVATE
1106 _In_opt_ HANDLE ParentProcessId,
1129 _In_ PPH_LOG_ENTRY Entry
1160 _In_ BOOLEAN ConnectOnly
1169 _In_ BOOLEAN ConnectOnly
1228 _In_ ULONG SessionId
1236 _In_ ULONG SessionId
1244 _In_ ULONG SessionId
1253 _In_ ULONG NumberOfProcesses
1270 _In_ ULONG NumberOfProcesses
1279 _In_ ULONG NumberOfProcesses
1304 _In_ ULONG NumberOfProcesses
1338 _In_ ULONG NumberOfProcesses,
1339 _In_ ULONG IoPriority
1348 _In_ ULONG PagePriority
1357 _In_ ULONG NumberOfProcesses,
1358 _In_ ULONG PriorityClass
1415 _In_ ULONG NumberOfConnections
1424 _In_ ULONG NumberOfThreads
1434 _In_ ULONG NumberOfThreads
1443 _In_ ULONG NumberOfThreads
1452 _In_ ULONG NumberOfThreads
1461 _In_ ULONG ThreadPriorityWin32
1470 _In_ ULONG IoPriority
1479 _In_ ULONG PagePriority
1508 _In_ ULONG NumberOfHandles,
1519 _In_ ULONG Attributes
1527 _Out_opt_ PULONG ValidToTickCount
1545 _In_ HANDLE ThreadId,
1546 _In_ PPH_SYMBOL_PROVIDER SymbolProvider
1559 _In_ HWND ParentWindowHandle
1569 _In_ HWND ParentWindowHandle,
1579 _In_ HWND ParentWindowHandle,
1580 _In_ ULONG_PTR AffinityMask,
1581 _Out_ PULONG_PTR NewAffinityMask
1587 #define PH_CONTROL_TYPE_TREE_NEW 1
1590 _In_ HWND ParentWindowHandle,
1591 _In_ HWND ControlHandle,
1598 #define PH_CHOICE_DIALOG_SAVED_CHOICES 10
1600 #define PH_CHOICE_DIALOG_CHOICE 0x0
1601 #define PH_CHOICE_DIALOG_USER_CHOICE 0x1
1602 #define PH_CHOICE_DIALOG_PASSWORD 0x2
1603 #define PH_CHOICE_DIALOG_TYPE_MASK 0x3
1609 _In_ HWND ParentWindowHandle,
1612 _In_opt_ PWSTR *Choices,
1613 _In_opt_ ULONG NumberOfChoices,
1614 _In_opt_ PWSTR Option,
1617 _Inout_opt_ PBOOLEAN SelectedOption,
1618 _In_opt_ PWSTR SavedChoicesSettingName
1629 _In_ HWND ParentWindowHandle,
1644 _In_ HWND ParentWindowHandle,
1657 _In_ HWND ParentWindowHandle,
1665 _In_ HWND ParentWindowHandle,
1672 _In_ HWND ParentWindowHandle,
1679 _In_ HWND ParentWindowHandle,
1681 _In_opt_ PVOID Context,
1682 _In_opt_ PWSTR Title
1687 _In_opt_ PVOID Context,
1688 _In_opt_ DLGPROC HookProc
1699 #define PH_MEMORY_EDITOR_UNMAP_VIEW_OF_SECTION 0x1
1703 _In_ PVOID BaseAddress,
1704 _In_ SIZE_T RegionSize,
1705 _In_ ULONG SelectOffset,
1706 _In_ ULONG SelectLength,
1714 _In_ HWND ParentWindowHandle,
1715 _In_opt_
VOID (NTAPI *RegisterDialog)(HWND),
1716 _In_opt_
VOID (NTAPI *UnregisterDialog)(HWND)
1722 _In_ HWND ParentWindowHandle,
1737 _In_ HWND ParentWindowHandle,
1744 _In_ HWND ParentWindowHandle,
1752 _In_opt_ PVOID Context
1757 _In_opt_ PVOID Context
1762 _In_opt_ PVOID Context
1767 _In_opt_ PVOID Context
1772 _In_opt_ PVOID Context
1777 _In_opt_ PVOID Context
1783 _In_ HWND ParentWindowHandle
1789 _In_ HWND ParentWindowHandle
1795 _In_ HWND ParentWindowHandle
1805 _In_ HWND ParentWindowHandle,
1828 _In_ HWND ParentWindowHandle,
1833 _In_ PPH_RUNAS_SERVICE_PARAMETERS Parameters
1843 _In_opt_ PWSTR UserName,
1844 _In_opt_ PWSTR Password,
1845 _In_opt_ ULONG LogonType,
1846 _In_opt_ HANDLE ProcessIdWithToken,
1847 _In_ ULONG SessionId,
1848 _In_ PWSTR DesktopName,
1849 _In_ BOOLEAN UseLinkedToken
1858 _In_ PPH_RUNAS_SERVICE_PARAMETERS Parameters
1864 _In_ HWND ParentWindowHandle,
1865 _In_ ULONG SessionId
1871 _In_ HWND ParentWindowHandle,
1872 _In_ ULONG SessionId
1878 _In_ HWND ParentWindowHandle,
1879 _In_ ULONG SessionId
1885 _In_ HWND ParentWindowHandle
1891 #define WM_PH_SET_LIST_VIEW_SETTINGS (WM_APP + 701)
1897 _In_ HWND ParentWindowHandle,
1899 _In_ ULONG NumberOfServices
1906 _In_ HWND ParentWindowHandle,
1913 _In_ HWND ParentWindowHandle,
1920 _In_ HWND ParentWindowHandle,
1922 _In_ HANDLE ThreadId,
1929 _In_ ULONG Attributes
1933 _In_ ULONG Attributes
1937 _In_ HWND ParentWindowHandle,
1939 _In_opt_ PVOID Context,
1940 _In_opt_ PWSTR Title
1945 _In_opt_ PVOID Context,
1946 _In_opt_ DLGPROC HookProc