Process Hacker
actions.c File Reference
#include <phapp.h>
#include <settings.h>
#include <kphuser.h>
#include <phsvccl.h>
#include <winsta.h>
#include <iphlpapi.h>

Go to the source code of this file.

Typedefs

typedef DWORD(WINAPI * _SetTcpEntry )(_In_ PMIB_TCPROW pTcpRow)
 

Functions

HRESULT CALLBACK PhpElevateActionCallbackProc (_In_ HWND hwnd, _In_ UINT uNotification, _In_ WPARAM wParam, _In_ LPARAM lParam, _In_ LONG_PTR dwRefData)
 
BOOLEAN PhpShowElevatePrompt (_In_ HWND hWnd, _In_ PWSTR Message, _In_ NTSTATUS Status, _Out_ PINT Button)
 
BOOLEAN PhpShowErrorAndElevateAction (_In_ HWND hWnd, _In_ PWSTR Message, _In_ NTSTATUS Status, _In_ PWSTR Command, _Out_ PBOOLEAN Success)
 Shows an error, prompts for elevation, and executes a command.
 
BOOLEAN PhpShowErrorAndConnectToPhSvc (_In_ HWND hWnd, _In_ PWSTR Message, _In_ NTSTATUS Status, _Out_ PBOOLEAN Connected)
 Shows an error, prompts for elevation, and connects to phsvc.
 
BOOLEAN PhUiConnectToPhSvc (_In_opt_ HWND hWnd, _In_ BOOLEAN ConnectOnly)
 Connects to phsvc.
 
VOID PhpGetPhSvcPortName (_In_ PH_PHSVC_MODE Mode, _Out_ PUNICODE_STRING PortName)
 
BOOLEAN PhpStartPhSvcProcess (_In_opt_ HWND hWnd, _In_ PH_PHSVC_MODE Mode)
 
BOOLEAN PhUiConnectToPhSvcEx (_In_opt_ HWND hWnd, _In_ PH_PHSVC_MODE Mode, _In_ BOOLEAN ConnectOnly)
 Connects to phsvc.
 
VOID PhUiDisconnectFromPhSvc (VOID)
 Disconnects from phsvc.
 
BOOLEAN PhUiLockComputer (_In_ HWND hWnd)
 
BOOLEAN PhUiLogoffComputer (_In_ HWND hWnd)
 
BOOLEAN PhUiSleepComputer (_In_ HWND hWnd)
 
BOOLEAN PhUiHibernateComputer (_In_ HWND hWnd)
 
BOOLEAN PhUiRestartComputer (_In_ HWND hWnd, _In_ ULONG Flags)
 
BOOLEAN PhUiShutdownComputer (_In_ HWND hWnd, _In_ ULONG Flags)
 
BOOLEAN PhUiConnectSession (_In_ HWND hWnd, _In_ ULONG SessionId)
 
BOOLEAN PhUiDisconnectSession (_In_ HWND hWnd, _In_ ULONG SessionId)
 
BOOLEAN PhUiLogoffSession (_In_ HWND hWnd, _In_ ULONG SessionId)
 
BOOLEAN PhUiTerminateProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses)
 
BOOLEAN PhpUiTerminateTreeProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process, _In_ PVOID Processes, _Inout_ PBOOLEAN Success)
 
BOOLEAN PhUiTerminateTreeProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiSuspendProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses)
 
BOOLEAN PhUiResumeProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses)
 
BOOLEAN PhUiRestartProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiDebugProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiReduceWorkingSetProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses)
 
BOOLEAN PhUiSetVirtualizationProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process, _In_ BOOLEAN Enable)
 
BOOLEAN PhUiDetachFromDebuggerProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiInjectDllProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiSetIoPriorityProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses, _In_ ULONG IoPriority)
 
BOOLEAN PhUiSetPagePriorityProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process, _In_ ULONG PagePriority)
 
BOOLEAN PhUiSetPriorityProcesses (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM *Processes, _In_ ULONG NumberOfProcesses, _In_ ULONG PriorityClass)
 
BOOLEAN PhUiSetDepStatusProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiSetProtectionProcess (_In_ HWND hWnd, _In_ PPH_PROCESS_ITEM Process)
 
BOOLEAN PhUiStartService (_In_ HWND hWnd, _In_ PPH_SERVICE_ITEM Service)
 
BOOLEAN PhUiContinueService (_In_ HWND hWnd, _In_ PPH_SERVICE_ITEM Service)
 
BOOLEAN PhUiPauseService (_In_ HWND hWnd, _In_ PPH_SERVICE_ITEM Service)
 
BOOLEAN PhUiStopService (_In_ HWND hWnd, _In_ PPH_SERVICE_ITEM Service)
 
BOOLEAN PhUiDeleteService (_In_ HWND hWnd, _In_ PPH_SERVICE_ITEM Service)
 
BOOLEAN PhUiCloseConnections (_In_ HWND hWnd, _In_ PPH_NETWORK_ITEM *Connections, _In_ ULONG NumberOfConnections)
 
BOOLEAN PhUiTerminateThreads (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM *Threads, _In_ ULONG NumberOfThreads)
 
BOOLEAN PhUiForceTerminateThreads (_In_ HWND hWnd, _In_ HANDLE ProcessId, _In_ PPH_THREAD_ITEM *Threads, _In_ ULONG NumberOfThreads)
 
BOOLEAN PhUiSuspendThreads (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM *Threads, _In_ ULONG NumberOfThreads)
 
BOOLEAN PhUiResumeThreads (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM *Threads, _In_ ULONG NumberOfThreads)
 
BOOLEAN PhUiSetPriorityThread (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM Thread, _In_ ULONG ThreadPriorityWin32)
 
BOOLEAN PhUiSetIoPriorityThread (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM Thread, _In_ ULONG IoPriority)
 
BOOLEAN PhUiSetPagePriorityThread (_In_ HWND hWnd, _In_ PPH_THREAD_ITEM Thread, _In_ ULONG PagePriority)
 
BOOLEAN PhUiUnloadModule (_In_ HWND hWnd, _In_ HANDLE ProcessId, _In_ PPH_MODULE_ITEM Module)
 
BOOLEAN PhUiFreeMemory (_In_ HWND hWnd, _In_ HANDLE ProcessId, _In_ PPH_MEMORY_ITEM MemoryItem, _In_ BOOLEAN Free)
 
BOOLEAN PhUiCloseHandles (_In_ HWND hWnd, _In_ HANDLE ProcessId, _In_ PPH_HANDLE_ITEM *Handles, _In_ ULONG NumberOfHandles, _In_ BOOLEAN Warn)
 
BOOLEAN PhUiSetAttributesHandle (_In_ HWND hWnd, _In_ HANDLE ProcessId, _In_ PPH_HANDLE_ITEM Handle, _In_ ULONG Attributes)
 

Typedef Documentation

typedef DWORD(WINAPI * _SetTcpEntry)(_In_ PMIB_TCPROW pTcpRow)

Definition at line 37 of file actions.c.

Function Documentation

HRESULT CALLBACK PhpElevateActionCallbackProc ( _In_ HWND  hwnd,
_In_ UINT  uNotification,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam,
_In_ LONG_PTR  dwRefData 
)

Definition at line 53 of file actions.c.

VOID PhpGetPhSvcPortName ( _In_ PH_PHSVC_MODE  Mode,
_Out_ PUNICODE_STRING  PortName 
)

Definition at line 297 of file actions.c.

BOOLEAN PhpShowElevatePrompt ( _In_ HWND  hWnd,
_In_ PWSTR  Message,
_In_ NTSTATUS  Status,
_Out_ PINT  Button 
)

Definition at line 71 of file actions.c.

BOOLEAN PhpShowErrorAndConnectToPhSvc ( _In_ HWND  hWnd,
_In_ PWSTR  Message,
_In_ NTSTATUS  Status,
_Out_ PBOOLEAN  Connected 
)

Shows an error, prompts for elevation, and connects to phsvc.

Parameters
hWndThe window to display user interface components on.
MessageA message describing the operation that failed.
StatusA NTSTATUS value.
ConnectedA variable which receives TRUE if the user elevated the action and phsvc was started, or FALSE if the user cancelled elevation. If the value is TRUE, you need to perform any necessary phsvc calls and use PhUiDisconnectFromPhSvc() to disconnect from phsvc.
Returns
TRUE if the user was prompted for elevation, otherwise FALSE, in which case you need to show your own error message.

Definition at line 233 of file actions.c.

BOOLEAN PhpShowErrorAndElevateAction ( _In_ HWND  hWnd,
_In_ PWSTR  Message,
_In_ NTSTATUS  Status,
_In_ PWSTR  Command,
_Out_ PBOOLEAN  Success 
)

Shows an error, prompts for elevation, and executes a command.

Parameters
hWndThe window to display user interface components on.
MessageA message describing the operation that failed.
StatusA NTSTATUS value.
CommandThe arguments to pass to the new instance of the application, if required.
SuccessA variable which receives TRUE if the elevated action succeeded or FALSE if the action failed.
Returns
TRUE if the user was prompted for elevation, otherwise FALSE, in which case you need to show your own error message.

Definition at line 141 of file actions.c.

BOOLEAN PhpStartPhSvcProcess ( _In_opt_ HWND  hWnd,
_In_ PH_PHSVC_MODE  Mode 
)

Definition at line 319 of file actions.c.

BOOLEAN PhpUiTerminateTreeProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process,
_In_ PVOID  Processes,
_Inout_ PBOOLEAN  Success 
)

Definition at line 1048 of file actions.c.

BOOLEAN PhUiCloseConnections ( _In_ HWND  hWnd,
_In_ PPH_NETWORK_ITEM Connections,
_In_ ULONG  NumberOfConnections 
)

Definition at line 2392 of file actions.c.

BOOLEAN PhUiCloseHandles ( _In_ HWND  hWnd,
_In_ HANDLE  ProcessId,
_In_ PPH_HANDLE_ITEM Handles,
_In_ ULONG  NumberOfHandles,
_In_ BOOLEAN  Warn 
)

Definition at line 3255 of file actions.c.

BOOLEAN PhUiConnectSession ( _In_ HWND  hWnd,
_In_ ULONG  SessionId 
)

Definition at line 621 of file actions.c.

BOOLEAN PhUiConnectToPhSvc ( _In_opt_ HWND  hWnd,
_In_ BOOLEAN  ConnectOnly 
)

Connects to phsvc.

Parameters
hWndThe window to display user interface components on.
ConnectOnlyTRUE to only try to connect to phsvc, otherwise FALSE to try to elevate and start phsvc if the initial connection attempt failed.

Definition at line 289 of file actions.c.

BOOLEAN PhUiConnectToPhSvcEx ( _In_opt_ HWND  hWnd,
_In_ PH_PHSVC_MODE  Mode,
_In_ BOOLEAN  ConnectOnly 
)

Connects to phsvc.

Parameters
hWndThe window to display user interface components on.
ModeThe type of phsvc instance to connect to.
ConnectOnlyTRUE to only try to connect to phsvc, otherwise FALSE to try to elevate and start phsvc if the initial connection attempt failed.

Definition at line 398 of file actions.c.

BOOLEAN PhUiContinueService ( _In_ HWND  hWnd,
_In_ PPH_SERVICE_ITEM  Service 
)

Definition at line 2171 of file actions.c.

BOOLEAN PhUiDebugProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1417 of file actions.c.

BOOLEAN PhUiDeleteService ( _In_ HWND  hWnd,
_In_ PPH_SERVICE_ITEM  Service 
)

Definition at line 2330 of file actions.c.

BOOLEAN PhUiDetachFromDebuggerProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1622 of file actions.c.

VOID PhUiDisconnectFromPhSvc ( VOID  )

Disconnects from phsvc.

Definition at line 493 of file actions.c.

BOOLEAN PhUiDisconnectSession ( _In_ HWND  hWnd,
_In_ ULONG  SessionId 
)

Definition at line 676 of file actions.c.

BOOLEAN PhUiForceTerminateThreads ( _In_ HWND  hWnd,
_In_ HANDLE  ProcessId,
_In_ PPH_THREAD_ITEM Threads,
_In_ ULONG  NumberOfThreads 
)

Definition at line 2616 of file actions.c.

BOOLEAN PhUiFreeMemory ( _In_ HWND  hWnd,
_In_ HANDLE  ProcessId,
_In_ PPH_MEMORY_ITEM  MemoryItem,
_In_ BOOLEAN  Free 
)

Definition at line 3105 of file actions.c.

BOOLEAN PhUiHibernateComputer ( _In_ HWND  hWnd)

Definition at line 550 of file actions.c.

BOOLEAN PhUiInjectDllProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1677 of file actions.c.

BOOLEAN PhUiLockComputer ( _In_ HWND  hWnd)

Definition at line 507 of file actions.c.

BOOLEAN PhUiLogoffComputer ( _In_ HWND  hWnd)

Definition at line 519 of file actions.c.

BOOLEAN PhUiLogoffSession ( _In_ HWND  hWnd,
_In_ ULONG  SessionId 
)

Definition at line 689 of file actions.c.

BOOLEAN PhUiPauseService ( _In_ HWND  hWnd,
_In_ PPH_SERVICE_ITEM  Service 
)

Definition at line 2224 of file actions.c.

BOOLEAN PhUiReduceWorkingSetProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses 
)

Definition at line 1515 of file actions.c.

BOOLEAN PhUiRestartComputer ( _In_ HWND  hWnd,
_In_ ULONG  Flags 
)

Definition at line 569 of file actions.c.

BOOLEAN PhUiRestartProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1302 of file actions.c.

BOOLEAN PhUiResumeProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses 
)

Definition at line 1229 of file actions.c.

BOOLEAN PhUiResumeThreads ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM Threads,
_In_ ULONG  NumberOfThreads 
)

Definition at line 2747 of file actions.c.

BOOLEAN PhUiSetAttributesHandle ( _In_ HWND  hWnd,
_In_ HANDLE  ProcessId,
_In_ PPH_HANDLE_ITEM  Handle,
_In_ ULONG  Attributes 
)

Definition at line 3335 of file actions.c.

BOOLEAN PhUiSetDepStatusProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1902 of file actions.c.

BOOLEAN PhUiSetIoPriorityProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses,
_In_ ULONG  IoPriority 
)

Definition at line 1733 of file actions.c.

BOOLEAN PhUiSetIoPriorityThread ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM  Thread,
_In_ ULONG  IoPriority 
)

Definition at line 2841 of file actions.c.

BOOLEAN PhUiSetPagePriorityProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process,
_In_ ULONG  PagePriority 
)

Definition at line 1799 of file actions.c.

BOOLEAN PhUiSetPagePriorityThread ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM  Thread,
_In_ ULONG  PagePriority 
)

Definition at line 2895 of file actions.c.

BOOLEAN PhUiSetPriorityProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses,
_In_ ULONG  PriorityClass 
)

Definition at line 1833 of file actions.c.

BOOLEAN PhUiSetPriorityThread ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM  Thread,
_In_ ULONG  ThreadPriorityWin32 
)

Definition at line 2810 of file actions.c.

BOOLEAN PhUiSetProtectionProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 2024 of file actions.c.

BOOLEAN PhUiSetVirtualizationProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process,
_In_ BOOLEAN  Enable 
)

Definition at line 1563 of file actions.c.

BOOLEAN PhUiShutdownComputer ( _In_ HWND  hWnd,
_In_ ULONG  Flags 
)

Definition at line 591 of file actions.c.

BOOLEAN PhUiSleepComputer ( _In_ HWND  hWnd)

Definition at line 531 of file actions.c.

BOOLEAN PhUiStartService ( _In_ HWND  hWnd,
_In_ PPH_SERVICE_ITEM  Service 
)

Definition at line 2120 of file actions.c.

BOOLEAN PhUiStopService ( _In_ HWND  hWnd,
_In_ PPH_SERVICE_ITEM  Service 
)

Definition at line 2277 of file actions.c.

BOOLEAN PhUiSuspendProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses 
)

Definition at line 1156 of file actions.c.

BOOLEAN PhUiSuspendThreads ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM Threads,
_In_ ULONG  NumberOfThreads 
)

Definition at line 2684 of file actions.c.

BOOLEAN PhUiTerminateProcesses ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM Processes,
_In_ ULONG  NumberOfProcesses 
)

Definition at line 971 of file actions.c.

BOOLEAN PhUiTerminateThreads ( _In_ HWND  hWnd,
_In_ PPH_THREAD_ITEM Threads,
_In_ ULONG  NumberOfThreads 
)

Definition at line 2543 of file actions.c.

BOOLEAN PhUiTerminateTreeProcess ( _In_ HWND  hWnd,
_In_ PPH_PROCESS_ITEM  Process 
)

Definition at line 1116 of file actions.c.

BOOLEAN PhUiUnloadModule ( _In_ HWND  hWnd,
_In_ HANDLE  ProcessId,
_In_ PPH_MODULE_ITEM  Module 
)

Definition at line 2929 of file actions.c.