Process Hacker
main.c File Reference
#include <phdk.h>
#include <phappresource.h>
#include <windowsx.h>
#include "db.h"
#include "resource.h"

Go to the source code of this file.

Macros

#define INTENT_PROCESS_COMMENT   0x1
 
#define INTENT_PROCESS_PRIORITY_CLASS   0x2
 
#define INTENT_PROCESS_IO_PRIORITY   0x4
 
#define PROCESS_PRIORITY_SAVE_ID   1
 
#define PROCESS_PRIORITY_SAVE_FOR_THIS_COMMAND_LINE_ID   2
 
#define PROCESS_IO_PRIORITY_SAVE_ID   3
 
#define PROCESS_IO_PRIORITY_SAVE_FOR_THIS_COMMAND_LINE_ID   4
 
#define COMMENT_COLUMN_ID   1
 

Typedefs

typedef struct _PROCESS_EXTENSION PROCESS_EXTENSION
 
typedef struct _PROCESS_EXTENSION * PPROCESS_EXTENSION
 
typedef struct
_PROCESS_COMMENT_PAGE_CONTEXT 
PROCESS_COMMENT_PAGE_CONTEXT
 
typedef struct
_PROCESS_COMMENT_PAGE_CONTEXT * 
PPROCESS_COMMENT_PAGE_CONTEXT
 
typedef struct _SERVICE_EXTENSION SERVICE_EXTENSION
 
typedef struct _SERVICE_EXTENSION * PSERVICE_EXTENSION
 
typedef struct
_SERVICE_COMMENT_PAGE_CONTEXT 
SERVICE_COMMENT_PAGE_CONTEXT
 
typedef struct
_SERVICE_COMMENT_PAGE_CONTEXT * 
PSERVICE_COMMENT_PAGE_CONTEXT
 

Functions

INT_PTR CALLBACK OptionsDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
INT_PTR CALLBACK ProcessCommentPageDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
INT_PTR CALLBACK ServiceCommentPageDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
BOOLEAN MatchDbObjectIntent (_In_ PDB_OBJECT Object, _In_ ULONG Intent)
 
PDB_OBJECT FindDbObjectForProcess (_In_ PPH_PROCESS_ITEM ProcessItem, _In_ ULONG Intent)
 
VOID DeleteDbObjectForProcessIfUnused (_In_ PDB_OBJECT Object)
 
ULONG GetProcessIoPriority (_In_ HANDLE ProcessId)
 
ULONG GetPriorityClassFromId (_In_ ULONG Id)
 
ULONG GetIoPriorityFromId (_In_ ULONG Id)
 
VOID NTAPI LoadCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID NTAPI UnloadCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID NTAPI ShowOptionsCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID NTAPI MenuItemCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID NTAPI MenuHookCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID InvalidateProcessComments (VOID)
 
VOID UpdateProcessComment (_In_ PPH_PROCESS_NODE Node, _In_ PPROCESS_EXTENSION Extension)
 
VOID InvalidateServiceComments (VOID)
 
VOID UpdateServiceComment (_In_ PPH_SERVICE_NODE Node, _In_ PSERVICE_EXTENSION Extension)
 
VOID TreeNewMessageCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID MainWindowShowingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID ProcessPropertiesInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID AddSavePriorityMenuItemsAndHook (_In_ PPH_PLUGIN_MENU_INFORMATION MenuInfo, _In_ PPH_PROCESS_ITEM ProcessItem, _In_ BOOLEAN UseSelectionForHook)
 
VOID ProcessMenuInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
LONG NTAPI ProcessCommentSortFunction (_In_ PVOID Node1, _In_ PVOID Node2, _In_ ULONG SubId, _In_ PVOID Context)
 
VOID ProcessTreeNewInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID ServicePropertiesInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
LONG NTAPI ServiceCommentSortFunction (_In_ PVOID Node1, _In_ PVOID Node2, _In_ ULONG SubId, _In_ PVOID Context)
 
VOID ServiceTreeNewInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID MiListSectionMenuInitializingCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID ProcessModifiedCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID ProcessesUpdatedCallback (_In_opt_ PVOID Parameter, _In_opt_ PVOID Context)
 
VOID ProcessItemCreateCallback (_In_ PVOID Object, _In_ PH_EM_OBJECT_TYPE ObjectType, _In_ PVOID Extension)
 
VOID ProcessItemDeleteCallback (_In_ PVOID Object, _In_ PH_EM_OBJECT_TYPE ObjectType, _In_ PVOID Extension)
 
VOID ServiceItemCreateCallback (_In_ PVOID Object, _In_ PH_EM_OBJECT_TYPE ObjectType, _In_ PVOID Extension)
 
VOID ServiceItemDeleteCallback (_In_ PVOID Object, _In_ PH_EM_OBJECT_TYPE ObjectType, _In_ PVOID Extension)
 
LOGICAL DllMain (_In_ HINSTANCE Instance, _In_ ULONG Reason, _Reserved_ PVOID Reserved)
 

Variables

PPH_PLUGIN PluginInstance
 
PH_CALLBACK_REGISTRATION PluginLoadCallbackRegistration
 
PH_CALLBACK_REGISTRATION PluginUnloadCallbackRegistration
 
PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration
 
PH_CALLBACK_REGISTRATION PluginMenuItemCallbackRegistration
 
PH_CALLBACK_REGISTRATION PluginMenuHookCallbackRegistration
 
PH_CALLBACK_REGISTRATION TreeNewMessageCallbackRegistration
 
PH_CALLBACK_REGISTRATION MainWindowShowingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ProcessPropertiesInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ServicePropertiesInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ProcessMenuInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ProcessTreeNewInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ServiceTreeNewInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION MiListSectionMenuInitializingCallbackRegistration
 
PH_CALLBACK_REGISTRATION ProcessModifiedCallbackRegistration
 
PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration
 
HWND ProcessTreeNewHandle
 
LIST_ENTRY ProcessListHead = { &ProcessListHead, &ProcessListHead }
 
PH_QUEUED_LOCK ProcessListLock = PH_QUEUED_LOCK_INIT
 
HWND ServiceTreeNewHandle
 
LIST_ENTRY ServiceListHead = { &ServiceListHead, &ServiceListHead }
 
PH_QUEUED_LOCK ServiceListLock = PH_QUEUED_LOCK_INIT
 

Macro Definition Documentation

#define COMMENT_COLUMN_ID   1

Definition at line 38 of file main.c.

#define INTENT_PROCESS_COMMENT   0x1

Definition at line 29 of file main.c.

#define INTENT_PROCESS_IO_PRIORITY   0x4

Definition at line 31 of file main.c.

#define INTENT_PROCESS_PRIORITY_CLASS   0x2

Definition at line 30 of file main.c.

#define PROCESS_IO_PRIORITY_SAVE_FOR_THIS_COMMAND_LINE_ID   4

Definition at line 36 of file main.c.

#define PROCESS_IO_PRIORITY_SAVE_ID   3

Definition at line 35 of file main.c.

#define PROCESS_PRIORITY_SAVE_FOR_THIS_COMMAND_LINE_ID   2

Definition at line 34 of file main.c.

#define PROCESS_PRIORITY_SAVE_ID   1

Definition at line 33 of file main.c.

Typedef Documentation

typedef struct _PROCESS_COMMENT_PAGE_CONTEXT * PPROCESS_COMMENT_PAGE_CONTEXT
typedef struct _PROCESS_EXTENSION * PPROCESS_EXTENSION
typedef struct _PROCESS_COMMENT_PAGE_CONTEXT PROCESS_COMMENT_PAGE_CONTEXT
typedef struct _PROCESS_EXTENSION PROCESS_EXTENSION
typedef struct _SERVICE_COMMENT_PAGE_CONTEXT * PSERVICE_COMMENT_PAGE_CONTEXT
typedef struct _SERVICE_EXTENSION * PSERVICE_EXTENSION
typedef struct _SERVICE_COMMENT_PAGE_CONTEXT SERVICE_COMMENT_PAGE_CONTEXT
typedef struct _SERVICE_EXTENSION SERVICE_EXTENSION

Function Documentation

VOID AddSavePriorityMenuItemsAndHook ( _In_ PPH_PLUGIN_MENU_INFORMATION  MenuInfo,
_In_ PPH_PROCESS_ITEM  ProcessItem,
_In_ BOOLEAN  UseSelectionForHook 
)

Definition at line 634 of file main.c.

VOID DeleteDbObjectForProcessIfUnused ( _In_ PDB_OBJECT  Object)

Definition at line 141 of file main.c.

LOGICAL DllMain ( _In_ HINSTANCE  Instance,
_In_ ULONG  Reason,
_Reserved_ PVOID  Reserved 
)

Definition at line 950 of file main.c.

PDB_OBJECT FindDbObjectForProcess ( _In_ PPH_PROCESS_ITEM  ProcessItem,
_In_ ULONG  Intent 
)

Definition at line 122 of file main.c.

ULONG GetIoPriorityFromId ( _In_ ULONG  Id)

Definition at line 201 of file main.c.

ULONG GetPriorityClassFromId ( _In_ ULONG  Id)

Definition at line 178 of file main.c.

ULONG GetProcessIoPriority ( _In_ HANDLE  ProcessId)

Definition at line 151 of file main.c.

VOID InvalidateProcessComments ( VOID  )

Definition at line 457 of file main.c.

VOID InvalidateServiceComments ( VOID  )

Definition at line 507 of file main.c.

VOID NTAPI LoadCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 220 of file main.c.

VOID MainWindowShowingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 613 of file main.c.

BOOLEAN MatchDbObjectIntent ( _In_ PDB_OBJECT  Object,
_In_ ULONG  Intent 
)

Definition at line 112 of file main.c.

VOID NTAPI MenuHookCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 370 of file main.c.

VOID NTAPI MenuItemCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 271 of file main.c.

VOID MiListSectionMenuInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 796 of file main.c.

INT_PTR CALLBACK OptionsDlgProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)

Definition at line 47 of file options.c.

INT_PTR CALLBACK ProcessCommentPageDlgProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)

Definition at line 1090 of file main.c.

LONG NTAPI ProcessCommentSortFunction ( _In_ PVOID  Node1,
_In_ PVOID  Node2,
_In_ ULONG  SubId,
_In_ PVOID  Context 
)

Definition at line 702 of file main.c.

VOID ProcessesUpdatedCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 817 of file main.c.

VOID ProcessItemCreateCallback ( _In_ PVOID  Object,
_In_ PH_EM_OBJECT_TYPE  ObjectType,
_In_ PVOID  Extension 
)

Definition at line 888 of file main.c.

VOID ProcessItemDeleteCallback ( _In_ PVOID  Object,
_In_ PH_EM_OBJECT_TYPE  ObjectType,
_In_ PVOID  Extension 
)

Definition at line 905 of file main.c.

VOID ProcessMenuInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 689 of file main.c.

VOID ProcessModifiedCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 806 of file main.c.

VOID ProcessPropertiesInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 621 of file main.c.

VOID ProcessTreeNewInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 720 of file main.c.

INT_PTR CALLBACK ServiceCommentPageDlgProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)

Definition at line 1280 of file main.c.

LONG NTAPI ServiceCommentSortFunction ( _In_ PVOID  Node1,
_In_ PVOID  Node2,
_In_ ULONG  SubId,
_In_ PVOID  Context 
)

Definition at line 760 of file main.c.

VOID ServiceItemCreateCallback ( _In_ PVOID  Object,
_In_ PH_EM_OBJECT_TYPE  ObjectType,
_In_ PVOID  Extension 
)

Definition at line 920 of file main.c.

VOID ServiceItemDeleteCallback ( _In_ PVOID  Object,
_In_ PH_EM_OBJECT_TYPE  ObjectType,
_In_ PVOID  Extension 
)

Definition at line 935 of file main.c.

VOID ServicePropertiesInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 738 of file main.c.

VOID ServiceTreeNewInitializingCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 778 of file main.c.

VOID NTAPI ShowOptionsCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 258 of file main.c.

VOID TreeNewMessageCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 557 of file main.c.

VOID NTAPI UnloadCallback ( _In_opt_ PVOID  Parameter,
_In_opt_ PVOID  Context 
)

Definition at line 250 of file main.c.

VOID UpdateProcessComment ( _In_ PPH_PROCESS_NODE  Node,
_In_ PPROCESS_EXTENSION  Extension 
)

Definition at line 481 of file main.c.

VOID UpdateServiceComment ( _In_ PPH_SERVICE_NODE  Node,
_In_ PSERVICE_EXTENSION  Extension 
)

Definition at line 531 of file main.c.

Variable Documentation

PH_CALLBACK_REGISTRATION MainWindowShowingCallbackRegistration

Definition at line 94 of file main.c.

PH_CALLBACK_REGISTRATION MiListSectionMenuInitializingCallbackRegistration

Definition at line 100 of file main.c.

PPH_PLUGIN PluginInstance

Definition at line 87 of file main.c.

PH_CALLBACK_REGISTRATION PluginLoadCallbackRegistration

Definition at line 88 of file main.c.

PH_CALLBACK_REGISTRATION PluginMenuHookCallbackRegistration

Definition at line 92 of file main.c.

PH_CALLBACK_REGISTRATION PluginMenuItemCallbackRegistration

Definition at line 91 of file main.c.

PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration

Definition at line 90 of file main.c.

PH_CALLBACK_REGISTRATION PluginUnloadCallbackRegistration

Definition at line 89 of file main.c.

PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration

Definition at line 102 of file main.c.

LIST_ENTRY ProcessListHead = { &ProcessListHead, &ProcessListHead }

Definition at line 105 of file main.c.

Definition at line 106 of file main.c.

PH_CALLBACK_REGISTRATION ProcessMenuInitializingCallbackRegistration

Definition at line 97 of file main.c.

PH_CALLBACK_REGISTRATION ProcessModifiedCallbackRegistration

Definition at line 101 of file main.c.

PH_CALLBACK_REGISTRATION ProcessPropertiesInitializingCallbackRegistration

Definition at line 95 of file main.c.

HWND ProcessTreeNewHandle

Definition at line 104 of file main.c.

PH_CALLBACK_REGISTRATION ProcessTreeNewInitializingCallbackRegistration

Definition at line 98 of file main.c.

LIST_ENTRY ServiceListHead = { &ServiceListHead, &ServiceListHead }

Definition at line 109 of file main.c.

Definition at line 110 of file main.c.

PH_CALLBACK_REGISTRATION ServicePropertiesInitializingCallbackRegistration

Definition at line 96 of file main.c.

HWND ServiceTreeNewHandle

Definition at line 108 of file main.c.

PH_CALLBACK_REGISTRATION ServiceTreeNewInitializingCallbackRegistration

Definition at line 99 of file main.c.

PH_CALLBACK_REGISTRATION TreeNewMessageCallbackRegistration

Definition at line 93 of file main.c.