Add improved performance for plugin window extensions

This commit is contained in:
dmex
2020-09-27 21:55:23 +10:00
parent 7d9d0bc98c
commit 11c11152c4
27 changed files with 452 additions and 352 deletions
+3 -3
View File
@@ -1607,9 +1607,9 @@ INT_PTR CALLBACK PhpFindObjectsDlgProc(
if (processNode = PhFindProcessNode(handleObjectNode->ProcessId))
{
ProcessHacker_SelectTabPage(PhMainWndHandle, 0);
ProcessHacker_SelectProcessNode(PhMainWndHandle, processNode);
ProcessHacker_ToggleVisible(PhMainWndHandle, TRUE);
ProcessHacker_SelectTabPage(0);
ProcessHacker_SelectProcessNode(processNode);
ProcessHacker_ToggleVisible(TRUE);
}
}
}
+1 -1
View File
@@ -434,7 +434,7 @@ INT_PTR CALLBACK PhpHiddenProcessesDlgProc(
if (processItem = PhpCreateProcessItemForHiddenProcess(entry))
{
ProcessHacker_ShowProcessProperties(PhMainWndHandle, processItem);
ProcessHacker_ShowProcessProperties(processItem);
PhDereferenceObject(processItem);
}
else
+3 -3
View File
@@ -201,7 +201,7 @@ VOID PhShowHandleObjectProperties1(
if (targetProcessItem)
{
ProcessHacker_ShowProcessProperties(PhMainWndHandle, targetProcessItem);
ProcessHacker_ShowProcessProperties(targetProcessItem);
PhDereferenceObject(targetProcessItem);
}
else
@@ -293,7 +293,7 @@ VOID PhShowHandleObjectProperties1(
showMemoryEditor->SelectLength = 0;
showMemoryEditor->Title = sectionName ? PhConcatStrings2(L"Section - ", sectionName->Buffer) : PhCreateString(L"Section");
showMemoryEditor->Flags = PH_MEMORY_EDITOR_UNMAP_VIEW_OF_SECTION;
ProcessHacker_ShowMemoryEditor(PhMainWndHandle, showMemoryEditor);
ProcessHacker_ShowMemoryEditor(showMemoryEditor);
}
else
{
@@ -374,7 +374,7 @@ VOID PhShowHandleObjectProperties1(
propContext = PhCreateProcessPropContext(NULL, targetProcessItem);
PhDereferenceObject(targetProcessItem);
PhSetSelectThreadIdProcessPropContext(propContext, clientId.UniqueThread);
ProcessHacker_Invoke(PhMainWndHandle, PhpShowProcessPropContext, propContext);
ProcessHacker_Invoke(PhpShowProcessPropContext, propContext);
}
else
{
+83 -69
View File
@@ -7,82 +7,96 @@ extern BOOLEAN PhMainWndExiting;
#define WM_PH_FIRST (WM_APP + 99)
#define WM_PH_ACTIVATE (WM_APP + 99)
#define PH_ACTIVATE_REPLY 0x1119
// begin_phapppub
#define WM_PH_SHOW_PROCESS_PROPERTIES (WM_APP + 120)
#define WM_PH_DESTROY (WM_APP + 121)
#define WM_PH_SAVE_ALL_SETTINGS (WM_APP + 122)
#define WM_PH_PREPARE_FOR_EARLY_SHUTDOWN (WM_APP + 123)
#define WM_PH_CANCEL_EARLY_SHUTDOWN (WM_APP + 124)
// end_phapppub
#define WM_PH_DELAYED_LOAD_COMPLETED (WM_APP + 125)
#define WM_PH_NOTIFY_ICON_MESSAGE (WM_APP + 126)
// begin_phapppub
#define WM_PH_TOGGLE_VISIBLE (WM_APP + 127)
#define WM_PH_SHOW_MEMORY_EDITOR (WM_APP + 128)
#define WM_PH_SHOW_MEMORY_RESULTS (WM_APP + 129)
#define WM_PH_SELECT_TAB_PAGE (WM_APP + 130)
#define WM_PH_GET_CALLBACK_LAYOUT_PADDING (WM_APP + 131)
#define WM_PH_INVALIDATE_LAYOUT_PADDING (WM_APP + 132)
#define WM_PH_SELECT_PROCESS_NODE (WM_APP + 133)
#define WM_PH_SELECT_SERVICE_ITEM (WM_APP + 134)
#define WM_PH_SELECT_NETWORK_ITEM (WM_APP + 135)
#define WM_PH_UPDATE_FONT (WM_APP + 136)
#define WM_PH_GET_FONT (WM_APP + 137)
// end_phapppub
// begin_phapppub
#define WM_PH_INVOKE (WM_APP + 138)
// WM_PH_DEPRECATED (WM_APP + 139)
#define WM_PH_CREATE_TAB_PAGE (WM_APP + 140)
#define WM_PH_REFRESH (WM_APP + 141)
#define WM_PH_GET_UPDATE_AUTOMATICALLY (WM_APP + 142)
#define WM_PH_SET_UPDATE_AUTOMATICALLY (WM_APP + 143)
// end_phapppub
#define WM_PH_ICON_CLICK (WM_APP + 144)
#define WM_PH_LAST (WM_APP + 144)
#define WM_PH_INVOKE (WM_APP + 145)
#define WM_PH_CALLBACK (WM_APP + 146)
#define WM_PH_LAST (WM_APP + 146)
// begin_phapppub
#define ProcessHacker_ShowProcessProperties(hWnd, ProcessItem) \
SendMessage(hWnd, WM_PH_SHOW_PROCESS_PROPERTIES, 0, (LPARAM)(ProcessItem))
#define ProcessHacker_Destroy(hWnd) \
SendMessage(hWnd, WM_PH_DESTROY, 0, 0)
#define ProcessHacker_SaveAllSettings(hWnd) \
SendMessage(hWnd, WM_PH_SAVE_ALL_SETTINGS, 0, 0)
#define ProcessHacker_PrepareForEarlyShutdown(hWnd) \
SendMessage(hWnd, WM_PH_PREPARE_FOR_EARLY_SHUTDOWN, 0, 0)
#define ProcessHacker_CancelEarlyShutdown(hWnd) \
SendMessage(hWnd, WM_PH_CANCEL_EARLY_SHUTDOWN, 0, 0)
#define ProcessHacker_ToggleVisible(hWnd, AlwaysShow) \
SendMessage(hWnd, WM_PH_TOGGLE_VISIBLE, (WPARAM)(AlwaysShow), 0)
#define ProcessHacker_ShowMemoryEditor(hWnd, ShowMemoryEditor) \
PostMessage(hWnd, WM_PH_SHOW_MEMORY_EDITOR, 0, (LPARAM)(ShowMemoryEditor))
#define ProcessHacker_ShowMemoryResults(hWnd, ShowMemoryResults) \
PostMessage(hWnd, WM_PH_SHOW_MEMORY_RESULTS, 0, (LPARAM)(ShowMemoryResults))
#define ProcessHacker_SelectTabPage(hWnd, Index) \
SendMessage(hWnd, WM_PH_SELECT_TAB_PAGE, (WPARAM)(Index), 0)
#define ProcessHacker_GetCallbackLayoutPadding(hWnd) \
((PPH_CALLBACK)SendMessage(hWnd, WM_PH_GET_CALLBACK_LAYOUT_PADDING, 0, 0))
#define ProcessHacker_InvalidateLayoutPadding(hWnd) \
SendMessage(hWnd, WM_PH_INVALIDATE_LAYOUT_PADDING, 0, 0)
#define ProcessHacker_SelectProcessNode(hWnd, ProcessNode) \
SendMessage(hWnd, WM_PH_SELECT_PROCESS_NODE, 0, (LPARAM)(ProcessNode))
#define ProcessHacker_SelectServiceItem(hWnd, ServiceItem) \
SendMessage(hWnd, WM_PH_SELECT_SERVICE_ITEM, 0, (LPARAM)(ServiceItem))
#define ProcessHacker_SelectNetworkItem(hWnd, NetworkItem) \
SendMessage(hWnd, WM_PH_SELECT_NETWORK_ITEM, 0, (LPARAM)(NetworkItem))
#define ProcessHacker_Invoke(hWnd, Function, Parameter) \
PostMessage(hWnd, WM_PH_INVOKE, (WPARAM)(Parameter), (LPARAM)(Function))
#define ProcessHacker_CreateTabPage(hWnd, Template) \
((struct _PH_MAIN_TAB_PAGE *)SendMessage(hWnd, WM_PH_CREATE_TAB_PAGE, 0, (LPARAM)(Template)))
#define ProcessHacker_Refresh(hWnd) \
SendMessage(hWnd, WM_PH_REFRESH, 0, 0)
#define ProcessHacker_GetUpdateAutomatically(hWnd) \
((BOOLEAN)SendMessage(hWnd, WM_PH_GET_UPDATE_AUTOMATICALLY, 0, 0))
#define ProcessHacker_SetUpdateAutomatically(hWnd, Value) \
SendMessage(hWnd, WM_PH_SET_UPDATE_AUTOMATICALLY, (WPARAM)(Value), 0)
typedef enum _PH_MAINWINDOW_CALLBACK_TYPE
{
PH_MAINWINDOW_CALLBACK_TYPE_DESTROY,
PH_MAINWINDOW_CALLBACK_TYPE_SHOW_PROPERTIES,
PH_MAINWINDOW_CALLBACK_TYPE_SAVE_ALL_SETTINGS,
PH_MAINWINDOW_CALLBACK_TYPE_PREPARE_FOR_EARLY_SHUTDOWN,
PH_MAINWINDOW_CALLBACK_TYPE_CANCEL_EARLY_SHUTDOWN,
PH_MAINWINDOW_CALLBACK_TYPE_TOGGLE_VISIBLE,
PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_EDITOR,
PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_RESULTS,
PH_MAINWINDOW_CALLBACK_TYPE_SELECT_TAB_PAGE,
PH_MAINWINDOW_CALLBACK_TYPE_GET_CALLBACK_LAYOUT_PADDING,
PH_MAINWINDOW_CALLBACK_TYPE_INVALIDATE_LAYOUT_PADDING,
PH_MAINWINDOW_CALLBACK_TYPE_SELECT_PROCESS_NODE,
PH_MAINWINDOW_CALLBACK_TYPE_SELECT_SERVICE_ITEM,
PH_MAINWINDOW_CALLBACK_TYPE_SELECT_NETWORK_ITEM,
PH_MAINWINDOW_CALLBACK_TYPE_UPDATE_FONT,
PH_MAINWINDOW_CALLBACK_TYPE_GET_FONT,
PH_MAINWINDOW_CALLBACK_TYPE_INVOKE,
PH_MAINWINDOW_CALLBACK_TYPE_REFRESH,
PH_MAINWINDOW_CALLBACK_TYPE_CREATE_TAB_PAGE,
PH_MAINWINDOW_CALLBACK_TYPE_GET_UPDATE_AUTOMATICALLY,
PH_MAINWINDOW_CALLBACK_TYPE_SET_UPDATE_AUTOMATICALLY,
PH_MAINWINDOW_CALLBACK_TYPE_ICON_CLICK,
} PH_MAINWINDOW_CALLBACK_TYPE;
PHAPPAPI
PVOID
NTAPI
PhPluginInvokeWindowCallback(
_In_ PH_MAINWINDOW_CALLBACK_TYPE Event,
_In_opt_ PVOID wparam,
_In_opt_ PVOID lparam
);
#define ProcessHacker_Destroy() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_DESTROY, 0, 0)
#define ProcessHacker_ShowProcessProperties(ProcessItem) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SHOW_PROPERTIES, 0, (PVOID)(ULONG_PTR)(ProcessItem))
#define ProcessHacker_SaveAllSettings() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SAVE_ALL_SETTINGS, 0, 0)
#define ProcessHacker_PrepareForEarlyShutdown() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_PREPARE_FOR_EARLY_SHUTDOWN, 0, 0)
#define ProcessHacker_CancelEarlyShutdown() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_CANCEL_EARLY_SHUTDOWN, 0, 0)
#define ProcessHacker_ToggleVisible(AlwaysShow) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_TOGGLE_VISIBLE, (PVOID)(ULONG_PTR)(AlwaysShow), 0)
#define ProcessHacker_ShowMemoryEditor(ShowMemoryEditor) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_EDITOR, 0, (PVOID)(ULONG_PTR)(ShowMemoryEditor))
#define ProcessHacker_ShowMemoryResults(ShowMemoryResults) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_RESULTS, 0, (PVOID)(ULONG_PTR)(ShowMemoryResults))
#define ProcessHacker_SelectTabPage(Index) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SELECT_TAB_PAGE, (PVOID)(ULONG_PTR)(Index), 0)
#define ProcessHacker_GetCallbackLayoutPadding() \
((PPH_CALLBACK)PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_GET_CALLBACK_LAYOUT_PADDING, 0, 0))
#define ProcessHacker_InvalidateLayoutPadding() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_INVALIDATE_LAYOUT_PADDING, 0, 0)
#define ProcessHacker_SelectProcessNode(ProcessNode) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SELECT_PROCESS_NODE, 0, (PVOID)(ULONG_PTR)(ProcessNode))
#define ProcessHacker_SelectServiceItem(ServiceItem) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SELECT_SERVICE_ITEM, 0, (PVOID)(ULONG_PTR)(ServiceItem))
#define ProcessHacker_SelectNetworkItem(NetworkItem) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SELECT_NETWORK_ITEM, 0, (PVOID)(ULONG_PTR)(NetworkItem))
#define ProcessHacker_UpdateFont() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_UPDATE_FONT, 0, 0)
#define ProcessHacker_GetFont() \
((HFONT)PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_GET_FONT, 0, 0))
#define ProcessHacker_Invoke(Function, Parameter) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_INVOKE, (PVOID)(ULONG_PTR)(Parameter), (PVOID)(ULONG_PTR)(Function))
#define ProcessHacker_CreateTabPage(Template) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_CREATE_TAB_PAGE, 0, (PVOID)(ULONG_PTR)(Template))
#define ProcessHacker_Refresh() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_REFRESH, 0, 0)
#define ProcessHacker_GetUpdateAutomatically() \
((BOOLEAN)PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_GET_UPDATE_AUTOMATICALLY, 0, 0))
#define ProcessHacker_SetUpdateAutomatically(Value) \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_SET_UPDATE_AUTOMATICALLY, (PVOID)(ULONG_PTR)(Value), 0)
// end_phapppub
#define ProcessHacker_IconClick(hWnd) \
SendMessage(hWnd, WM_PH_ICON_CLICK, 0, 0)
#define ProcessHacker_IconClick() \
PhPluginInvokeWindowCallback(PH_MAINWINDOW_CALLBACK_TYPE_ICON_CLICK, 0, 0)
typedef struct _PH_SHOW_MEMORY_EDITOR
{
+286 -195
View File
@@ -64,10 +64,9 @@ ULONG PhMwpNotifyIconNotifyMask = 0;
ULONG PhMwpLastNotificationType = 0;
PH_MWP_NOTIFICATION_DETAILS PhMwpLastNotificationDetails;
static BOOLEAN NeedsMaximize = FALSE;
static BOOLEAN AlwaysOnTop = FALSE;
static BOOLEAN NeedsMaximize = FALSE;
static BOOLEAN DelayedLoadCompleted = FALSE;
static PH_CALLBACK_DECLARE(LayoutPaddingCallback);
static RECT LayoutPadding = { 0, 0, 0, 0 };
static BOOLEAN LayoutPaddingValid = TRUE;
@@ -607,7 +606,7 @@ VOID PhMwpOnCommand(
}
else if (PhGetIntegerSetting(L"CloseOnEscape"))
{
ProcessHacker_Destroy(WindowHandle);
ProcessHacker_Destroy();
}
}
break;
@@ -623,7 +622,7 @@ VOID PhMwpOnCommand(
break;
case ID_HACKER_SHOWDETAILSFORALLPROCESSES:
{
ProcessHacker_PrepareForEarlyShutdown(WindowHandle);
ProcessHacker_PrepareForEarlyShutdown();
if (PhShellProcessHacker(
WindowHandle,
@@ -635,11 +634,11 @@ VOID PhMwpOnCommand(
NULL
))
{
ProcessHacker_Destroy(WindowHandle);
ProcessHacker_Destroy();
}
else
{
ProcessHacker_CancelEarlyShutdown(WindowHandle);
ProcessHacker_CancelEarlyShutdown();
}
}
break;
@@ -731,7 +730,7 @@ VOID PhMwpOnCommand(
PhMwpExecuteComputerCommand(WindowHandle, Id);
break;
case ID_HACKER_EXIT:
ProcessHacker_Destroy(WindowHandle);
ProcessHacker_Destroy();
break;
case ID_VIEW_SYSTEMINFORMATION:
PhShowSystemInformationDialog(NULL);
@@ -1530,7 +1529,7 @@ VOID PhMwpOnCommand(
{
PhMwpSelectPage(PhMwpServicesPage->Index);
SetFocus(PhMwpServiceTreeNewHandle);
ProcessHacker_SelectServiceItem(WindowHandle, serviceItem);
ProcessHacker_SelectServiceItem(serviceItem);
PhDereferenceObject(serviceItem);
}
@@ -1803,161 +1802,11 @@ ULONG_PTR PhMwpOnUserMessage(
}
}
break;
case WM_PH_SHOW_PROCESS_PROPERTIES:
{
PhMwpShowProcessProperties((PPH_PROCESS_ITEM)LParam);
}
break;
case WM_PH_DESTROY:
{
DestroyWindow(WindowHandle);
}
break;
case WM_PH_SAVE_ALL_SETTINGS:
{
PhMwpSaveSettings(WindowHandle);
}
break;
case WM_PH_PREPARE_FOR_EARLY_SHUTDOWN:
{
PhMwpSaveSettings(WindowHandle);
PhMainWndEarlyExit = TRUE;
}
break;
case WM_PH_CANCEL_EARLY_SHUTDOWN:
{
PhMainWndEarlyExit = FALSE;
}
break;
case WM_PH_DELAYED_LOAD_COMPLETED:
{
// Nothing
}
break;
case WM_PH_NOTIFY_ICON_MESSAGE:
{
PhNfForwardMessage(WindowHandle, WParam, LParam);
}
break;
case WM_PH_TOGGLE_VISIBLE:
{
PhMwpActivateWindow(WindowHandle, !WParam);
}
break;
case WM_PH_SHOW_MEMORY_EDITOR:
{
PPH_SHOW_MEMORY_EDITOR showMemoryEditor = (PPH_SHOW_MEMORY_EDITOR)LParam;
PhShowMemoryEditorDialog(
showMemoryEditor->OwnerWindow,
showMemoryEditor->ProcessId,
showMemoryEditor->BaseAddress,
showMemoryEditor->RegionSize,
showMemoryEditor->SelectOffset,
showMemoryEditor->SelectLength,
showMemoryEditor->Title,
showMemoryEditor->Flags
);
PhClearReference(&showMemoryEditor->Title);
PhFree(showMemoryEditor);
}
break;
case WM_PH_SHOW_MEMORY_RESULTS:
{
PPH_SHOW_MEMORY_RESULTS showMemoryResults = (PPH_SHOW_MEMORY_RESULTS)LParam;
PhShowMemoryResultsDialog(
showMemoryResults->ProcessId,
showMemoryResults->Results
);
PhDereferenceMemoryResults(
(PPH_MEMORY_RESULT *)showMemoryResults->Results->Items,
showMemoryResults->Results->Count
);
PhDereferenceObject(showMemoryResults->Results);
PhFree(showMemoryResults);
}
break;
case WM_PH_SELECT_TAB_PAGE:
{
ULONG index = (ULONG)WParam;
PhMwpSelectPage(index);
if (CurrentPage->WindowHandle)
SetFocus(CurrentPage->WindowHandle);
}
break;
case WM_PH_GET_CALLBACK_LAYOUT_PADDING:
{
return (ULONG_PTR)&LayoutPaddingCallback;
}
break;
case WM_PH_INVALIDATE_LAYOUT_PADDING:
{
LayoutPaddingValid = FALSE;
}
break;
case WM_PH_SELECT_PROCESS_NODE:
{
PhSelectAndEnsureVisibleProcessNode((PPH_PROCESS_NODE)LParam);
}
break;
case WM_PH_SELECT_SERVICE_ITEM:
{
PPH_SERVICE_NODE serviceNode;
PhMwpNeedServiceTreeList();
// For compatibility, LParam is a service item, not node.
if (serviceNode = PhFindServiceNode((PPH_SERVICE_ITEM)LParam))
{
PhSelectAndEnsureVisibleServiceNode(serviceNode);
}
}
break;
case WM_PH_SELECT_NETWORK_ITEM:
{
PPH_NETWORK_NODE networkNode;
PhMwpNeedNetworkTreeList();
// For compatibility, LParam is a network item, not node.
if (networkNode = PhFindNetworkNode((PPH_NETWORK_ITEM)LParam))
{
PhSelectAndEnsureVisibleNetworkNode(networkNode);
}
}
break;
case WM_PH_UPDATE_FONT:
{
PPH_STRING fontHexString;
LOGFONT font;
fontHexString = PhaGetStringSetting(L"Font");
if (
fontHexString->Length / sizeof(WCHAR) / 2 == sizeof(LOGFONT) &&
PhHexStringToBuffer(&fontHexString->sr, (PUCHAR)&font)
)
{
HFONT newFont;
newFont = CreateFontIndirect(&font);
if (newFont)
{
if (PhTreeWindowFont)
DeleteFont(PhTreeWindowFont);
PhTreeWindowFont = newFont;
PhMwpNotifyAllPages(MainTabPageFontChanged, newFont, NULL);
}
}
}
break;
case WM_PH_GET_FONT:
return (ULONG_PTR)GetWindowFont(PhMwpProcessTreeNewHandle);
case WM_PH_INVOKE:
{
VOID (NTAPI *function)(PVOID);
@@ -1966,32 +1815,13 @@ ULONG_PTR PhMwpOnUserMessage(
function((PVOID)WParam);
}
break;
case WM_PH_CREATE_TAB_PAGE:
case WM_PH_CALLBACK:
{
return (ULONG_PTR)PhMwpCreatePage((PPH_MAIN_TAB_PAGE)LParam);
}
break;
case WM_PH_REFRESH:
{
SendMessage(WindowHandle, WM_COMMAND, ID_VIEW_REFRESH, 0);
}
break;
case WM_PH_GET_UPDATE_AUTOMATICALLY:
{
return PhMwpUpdateAutomatically;
}
break;
case WM_PH_SET_UPDATE_AUTOMATICALLY:
{
if (!!WParam != PhMwpUpdateAutomatically)
{
SendMessage(WindowHandle, WM_COMMAND, ID_VIEW_UPDATEAUTOMATICALLY, 0);
}
}
break;
case WM_PH_ICON_CLICK:
{
PhMwpActivateWindow(WindowHandle, !!PhGetIntegerSetting(L"IconTogglesVisibility"));
PVOID (NTAPI *function)(PVOID);
function = (PVOID)LParam;
return (ULONG_PTR)function((PVOID)WParam);
}
break;
}
@@ -2033,7 +1863,7 @@ VOID PhMwpLoadSettings(
PhNfLoadStage1();
if (customFont->Length / sizeof(WCHAR) / 2 == sizeof(LOGFONT))
SendMessage(WindowHandle, WM_PH_UPDATE_FONT, 0, 0);
ProcessHacker_UpdateFont();
PhMwpNotifyAllPages(MainTabPageLoadSettings, NULL, NULL);
}
@@ -2911,6 +2741,8 @@ VOID PhMwpNotifyTabControl(
_In_ NMHDR *Header
)
{
#pragma warning(push)
#pragma warning(disable:26454) // disable Windows SDK warning (dmex)
if (Header->code == TCN_SELCHANGING)
{
OldTabIndex = TabCtrl_GetCurSel(TabControlHandle);
@@ -2919,6 +2751,7 @@ VOID PhMwpNotifyTabControl(
{
PhMwpSelectionChangedTabControl(OldTabIndex);
}
#pragma warning(pop)
}
VOID PhMwpSelectionChangedTabControl(
@@ -2993,9 +2826,7 @@ PPH_MAIN_TAB_PAGE PhMwpCreatePage(
PPH_STRING name;
HDWP deferHandle;
page = PhAllocate(sizeof(PH_MAIN_TAB_PAGE));
memset(page, 0, sizeof(PH_MAIN_TAB_PAGE));
page = PhAllocateZero(sizeof(PH_MAIN_TAB_PAGE));
page->Name = Template->Name;
page->Flags = Template->Flags;
page->Callback = Template->Callback;
@@ -3190,7 +3021,7 @@ BOOLEAN PhHandleMiniProcessMenuItem(
PhUiRestartProcess(PhMainWndHandle, processItem);
break;
case ID_PROCESS_PROPERTIES:
ProcessHacker_ShowProcessProperties(PhMainWndHandle, processItem);
ProcessHacker_ShowProcessProperties(processItem);
break;
}
@@ -3422,7 +3253,7 @@ VOID PhShowIconContextMenu(
switch (item->Id)
{
case ID_ICON_SHOWHIDEPROCESSHACKER:
SendMessage(PhMainWndHandle, WM_PH_TOGGLE_VISIBLE, 0, 0);
ProcessHacker_ToggleVisible(FALSE);
break;
case ID_ICON_SYSTEMINFORMATION:
SendMessage(PhMainWndHandle, WM_COMMAND, ID_VIEW_SYSTEMINFORMATION, 0);
@@ -3457,9 +3288,9 @@ VOID PhShowDetailsForIconNotification(
if (processNode = PhFindProcessNode(PhMwpLastNotificationDetails.ProcessId))
{
ProcessHacker_SelectTabPage(PhMainWndHandle, PhMwpProcessesPage->Index);
ProcessHacker_SelectProcessNode(PhMainWndHandle, processNode);
ProcessHacker_ToggleVisible(PhMainWndHandle, TRUE);
ProcessHacker_SelectTabPage(PhMwpProcessesPage->Index);
ProcessHacker_SelectProcessNode(processNode);
ProcessHacker_ToggleVisible(TRUE);
}
}
break;
@@ -3472,9 +3303,9 @@ VOID PhShowDetailsForIconNotification(
if (PhMwpLastNotificationDetails.ServiceName &&
(serviceItem = PhReferenceServiceItem(PhMwpLastNotificationDetails.ServiceName->Buffer)))
{
ProcessHacker_SelectTabPage(PhMainWndHandle, PhMwpServicesPage->Index);
ProcessHacker_SelectServiceItem(PhMainWndHandle, serviceItem);
ProcessHacker_ToggleVisible(PhMainWndHandle, TRUE);
ProcessHacker_SelectTabPage(PhMwpServicesPage->Index);
ProcessHacker_SelectServiceItem(serviceItem);
ProcessHacker_ToggleVisible(TRUE);
PhDereferenceObject(serviceItem);
}
@@ -3497,6 +3328,134 @@ VOID PhMwpClearLastNotificationDetails(
memset(&PhMwpLastNotificationDetails, 0, sizeof(PhMwpLastNotificationDetails));
}
// Window plugin extensions (dmex)
VOID PhMwpInvokeShowMemoryEditorDialog(
_In_ PVOID Parameter
)
{
PPH_SHOW_MEMORY_EDITOR showMemoryEditor = (PPH_SHOW_MEMORY_EDITOR)Parameter;
PhShowMemoryEditorDialog(
showMemoryEditor->OwnerWindow,
showMemoryEditor->ProcessId,
showMemoryEditor->BaseAddress,
showMemoryEditor->RegionSize,
showMemoryEditor->SelectOffset,
showMemoryEditor->SelectLength,
showMemoryEditor->Title,
showMemoryEditor->Flags
);
PhClearReference(&showMemoryEditor->Title);
PhFree(showMemoryEditor);
}
VOID PhMwpInvokeShowMemoryResultsDialog(
_In_ PVOID Parameter
)
{
PPH_SHOW_MEMORY_RESULTS showMemoryResults = (PPH_SHOW_MEMORY_RESULTS)Parameter;
PhShowMemoryResultsDialog(
showMemoryResults->ProcessId,
showMemoryResults->Results
);
PhDereferenceMemoryResults(
(PPH_MEMORY_RESULT*)showMemoryResults->Results->Items,
showMemoryResults->Results->Count
);
PhDereferenceObject(showMemoryResults->Results);
PhFree(showMemoryResults);
}
VOID PhMwpInvokeUpdateWindowFont(
_In_ PVOID Parameter
)
{
PPH_STRING fontHexString;
LOGFONT font;
fontHexString = PhaGetStringSetting(L"Font");
if (
fontHexString->Length / sizeof(WCHAR) / 2 == sizeof(LOGFONT) &&
PhHexStringToBuffer(&fontHexString->sr, (PUCHAR)&font)
)
{
HFONT newFont;
newFont = CreateFontIndirect(&font);
if (newFont)
{
if (PhTreeWindowFont)
DeleteFont(PhTreeWindowFont);
PhTreeWindowFont = newFont;
PhMwpNotifyAllPages(MainTabPageFontChanged, newFont, NULL);
}
}
SendMessage(PhMainWndHandle, WM_PH_UPDATE_FONT, 0, 0);
}
VOID PhMwpInvokePrepareEarlyExit(
_In_ PVOID Parameter
)
{
PhMwpSaveSettings(PhMainWndHandle);
PhMainWndEarlyExit = TRUE;
}
VOID PhMwpInvokeActivateWindow(
_In_ BOOLEAN Toggle
)
{
PhMwpActivateWindow(PhMainWndHandle, Toggle);
}
VOID PhMwpInvokeSelectTabPage(
_In_ PVOID Parameter
)
{
ULONG index = PtrToUlong(Parameter);
PhMwpSelectPage(index);
if (CurrentPage->WindowHandle)
SetFocus(CurrentPage->WindowHandle);
}
VOID PhMwpInvokeSelectServiceItem(
_In_ PPH_SERVICE_ITEM ServiceItem
)
{
PPH_SERVICE_NODE serviceNode;
PhMwpNeedServiceTreeList();
// For compatibility, LParam is a service item, not node.
if (serviceNode = PhFindServiceNode(ServiceItem))
{
PhSelectAndEnsureVisibleServiceNode(serviceNode);
}
}
VOID PhMwpInvokeSelectNetworkItem(
_In_ PPH_NETWORK_ITEM NetworkItem
)
{
PPH_NETWORK_NODE networkNode;
PhMwpNeedNetworkTreeList();
// For compatibility, LParam is a service item, not node.
if (networkNode = PhFindNetworkNode(NetworkItem))
{
PhSelectAndEnsureVisibleNetworkNode(networkNode);
}
}
BOOLEAN PhMwpPluginNotifyEvent(
_In_ ULONG Type,
_In_ PVOID Parameter
@@ -3512,3 +3471,135 @@ BOOLEAN PhMwpPluginNotifyEvent(
return notifyEvent.Handled;
}
PVOID PhPluginInvokeWindowCallback(
_In_ PH_MAINWINDOW_CALLBACK_TYPE Event,
_In_opt_ PVOID wparam,
_In_opt_ PVOID lparam
)
{
switch (Event)
{
case PH_MAINWINDOW_CALLBACK_TYPE_DESTROY:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)PhMainWndHandle, (LPARAM)DestroyWindow);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SHOW_PROPERTIES:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)lparam, (LPARAM)PhMwpShowProcessProperties);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SAVE_ALL_SETTINGS:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)PhMainWndHandle, (LPARAM)PhMwpSaveSettings);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_PREPARE_FOR_EARLY_SHUTDOWN:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, 0, (LPARAM)PhMwpInvokePrepareEarlyExit);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_CANCEL_EARLY_SHUTDOWN:
{
PhMainWndEarlyExit = FALSE;
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_TOGGLE_VISIBLE:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)!(BOOLEAN)wparam, (LPARAM)PhMwpInvokeActivateWindow);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_ICON_CLICK:
{
BOOLEAN visibility = !!PhGetIntegerSetting(L"IconTogglesVisibility");
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)visibility, (LPARAM)PhMwpInvokeActivateWindow);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_EDITOR:
{
PPH_SHOW_MEMORY_EDITOR showMemoryEditor = (PPH_SHOW_MEMORY_EDITOR)lparam;
PostMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)showMemoryEditor, (LPARAM)PhMwpInvokeShowMemoryEditorDialog);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SHOW_MEMORY_RESULTS:
{
PPH_SHOW_MEMORY_RESULTS showMemoryResults = (PPH_SHOW_MEMORY_RESULTS)lparam;
PostMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)showMemoryResults, (LPARAM)PhMwpInvokeShowMemoryResultsDialog);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SELECT_TAB_PAGE:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)wparam, (LPARAM)PhMwpInvokeSelectTabPage);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_GET_CALLBACK_LAYOUT_PADDING:
{
return (PVOID)&LayoutPaddingCallback;
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_INVALIDATE_LAYOUT_PADDING:
{
LayoutPaddingValid = FALSE;
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SELECT_PROCESS_NODE:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)lparam, (LPARAM)PhSelectAndEnsureVisibleProcessNode);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SELECT_SERVICE_ITEM:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)lparam, (LPARAM)PhMwpInvokeSelectServiceItem);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SELECT_NETWORK_ITEM:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)lparam, (LPARAM)PhMwpInvokeSelectNetworkItem);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_UPDATE_FONT:
{
SendMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)lparam, (LPARAM)PhMwpInvokeUpdateWindowFont);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_GET_FONT:
{
return (PVOID)GetWindowFont(PhMwpProcessTreeNewHandle);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_INVOKE:
{
PostMessage(PhMainWndHandle, WM_PH_INVOKE, (WPARAM)wparam, (LPARAM)lparam);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_REFRESH:
{
SendMessage(PhMainWndHandle, WM_COMMAND, ID_VIEW_REFRESH, 0);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_CREATE_TAB_PAGE:
{
return (PVOID)SendMessage(PhMainWndHandle, WM_PH_CALLBACK, (WPARAM)lparam, (LPARAM)PhMwpCreatePage);
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_GET_UPDATE_AUTOMATICALLY:
{
return (PVOID)PhMwpUpdateAutomatically;
}
break;
case PH_MAINWINDOW_CALLBACK_TYPE_SET_UPDATE_AUTOMATICALLY:
{
if (!!((BOOLEAN)wparam) != PhMwpUpdateAutomatically)
{
SendMessage(PhMainWndHandle, WM_COMMAND, ID_VIEW_UPDATEAUTOMATICALLY, 0);
}
}
break;
}
return NULL;
}
+4 -2
View File
@@ -611,7 +611,8 @@ INT_PTR CALLBACK PhpMemoryResultsDlgProc(
showMemoryEditor->RegionSize = basicInfo.RegionSize;
showMemoryEditor->SelectOffset = (ULONG)((ULONG_PTR)result->Address - (ULONG_PTR)basicInfo.BaseAddress);
showMemoryEditor->SelectLength = (ULONG)result->Length;
ProcessHacker_ShowMemoryEditor(PhMainWndHandle, showMemoryEditor);
ProcessHacker_ShowMemoryEditor(showMemoryEditor);
}
NtClose(processHandle);
@@ -685,7 +686,8 @@ INT_PTR CALLBACK PhpMemoryResultsDlgProc(
showMemoryEditor->RegionSize = basicInfo.RegionSize;
showMemoryEditor->SelectOffset = (ULONG)((ULONG_PTR)result->Address - (ULONG_PTR)basicInfo.BaseAddress);
showMemoryEditor->SelectLength = (ULONG)result->Length;
ProcessHacker_ShowMemoryEditor(PhMainWndHandle, showMemoryEditor);
ProcessHacker_ShowMemoryEditor(showMemoryEditor);
}
NtClose(processHandle);
+1 -4
View File
@@ -543,10 +543,7 @@ VOID PhShowMemoryStringDialog(
showMemoryResults->Results = context.Results;
PhReferenceObject(context.Results);
ProcessHacker_ShowMemoryResults(
PhMainWndHandle,
showMemoryResults
);
ProcessHacker_ShowMemoryResults(showMemoryResults);
}
PhDereferenceObject(context.Results);
+3 -3
View File
@@ -1018,7 +1018,7 @@ VOID PhMipRefresh(
)
{
if (PhMipPinned)
ProcessHacker_Refresh(PhMainWndHandle);
ProcessHacker_Refresh();
PostMessage(PhMipWindow, MIP_MSG_UPDATE, 0, 0);
}
@@ -1927,8 +1927,8 @@ VOID PhMipHandleListSectionCommand(
PhPinMiniInformation(MiniInfoActivePinType, -1, 0, 0, NULL, NULL);
PhPinMiniInformation(MiniInfoHoverPinType, -1, 0, 0, NULL, NULL);
ProcessHacker_ToggleVisible(PhMainWndHandle, TRUE);
ProcessHacker_SelectTabPage(PhMainWndHandle, 0);
ProcessHacker_ToggleVisible(TRUE);
ProcessHacker_SelectTabPage(0);
PhSelectAndEnsureVisibleProcessNodes((PPH_PROCESS_NODE*)nodes->Items, nodes->Count);
PhDereferenceObject(nodes);
}
+1 -1
View File
@@ -380,7 +380,7 @@ VOID NTAPI PhMwpNetworkItemsUpdatedHandler(
_In_opt_ PVOID Context
)
{
ProcessHacker_Invoke(PhMainWndHandle, PhMwpOnNetworkItemsUpdated, PhGetRunIdProvider(&PhMwpNetworkProviderRegistration));
ProcessHacker_Invoke(PhMwpOnNetworkItemsUpdated, PhGetRunIdProvider(&PhMwpNetworkProviderRegistration));
}
VOID PhMwpOnNetworkItemsUpdated(
+1 -1
View File
@@ -857,7 +857,7 @@ VOID NTAPI PhMwpProcessesUpdatedHandler(
_In_opt_ PVOID Context
)
{
ProcessHacker_Invoke(PhMainWndHandle, PhMwpOnProcessesUpdated, PhGetRunIdProvider(&PhMwpProcessProviderRegistration));
ProcessHacker_Invoke(PhMwpOnProcessesUpdated, PhGetRunIdProvider(&PhMwpProcessProviderRegistration));
}
VOID PhMwpOnProcessAdded(
+1 -1
View File
@@ -395,7 +395,7 @@ VOID NTAPI PhMwpServicesUpdatedHandler(
_In_opt_ PVOID Context
)
{
ProcessHacker_Invoke(PhMainWndHandle, PhMwpOnServicesUpdated, PhGetRunIdProvider(&PhMwpServiceProviderRegistration));
ProcessHacker_Invoke(PhMwpOnServicesUpdated, PhGetRunIdProvider(&PhMwpServiceProviderRegistration));
}
VOID PhMwpOnServiceAdded(
+3 -3
View File
@@ -334,7 +334,7 @@ VOID PhNfForwardMessage(
{
if (PhGetIntegerSetting(L"IconSingleClick"))
{
ProcessHacker_IconClick(WindowHandle);
ProcessHacker_IconClick();
PhNfpDisableHover();
}
else
@@ -386,7 +386,7 @@ VOID PhNfForwardMessage(
PhNfpDisableHover();
}
ProcessHacker_IconClick(WindowHandle);
ProcessHacker_IconClick();
}
}
break;
@@ -406,7 +406,7 @@ VOID PhNfForwardMessage(
case NIN_KEYSELECT:
// HACK: explorer seems to send two NIN_KEYSELECT messages when the user selects the icon and presses ENTER.
if (GetForegroundWindow() != WindowHandle)
ProcessHacker_IconClick(WindowHandle);
ProcessHacker_IconClick();
break;
case NIN_BALLOONUSERCLICK:
PhShowDetailsForIconNotification();
+8 -8
View File
@@ -380,7 +380,7 @@ INT_PTR CALLBACK PhOptionsDialogProc(
L""
) == IDYES)
{
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
ProcessHacker_PrepareForEarlyShutdown();
PhResetSettings();
@@ -396,7 +396,7 @@ INT_PTR CALLBACK PhOptionsDialogProc(
0,
NULL
);
ProcessHacker_Destroy(PhMainWndHandle);
ProcessHacker_Destroy();
}
}
break;
@@ -1076,7 +1076,7 @@ static VOID PhpOptionsNotifyChangeCallback(
)
{
PhUpdateCachedSettings();
ProcessHacker_SaveAllSettings(PhMainWndHandle);
ProcessHacker_SaveAllSettings();
PhInvalidateAllProcessNodes();
PhReloadSettingsProcessTreeList();
PhSiNotifyChangeSettings();
@@ -1093,7 +1093,7 @@ static VOID PhpOptionsNotifyChangeCallback(
L"Do you want to restart Process Hacker now?"
) == IDYES)
{
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
ProcessHacker_PrepareForEarlyShutdown();
PhShellProcessHacker(
PhMainWndHandle,
L"-v",
@@ -1103,7 +1103,7 @@ static VOID PhpOptionsNotifyChangeCallback(
0,
NULL
);
ProcessHacker_Destroy(PhMainWndHandle);
ProcessHacker_Destroy();
}
}
}
@@ -1171,7 +1171,7 @@ static VOID PhpAdvancedPageSave(
ListView_GetCheckState(listViewHandle, PHP_OPTIONS_INDEX_START_HIDDEN) == BST_CHECKED
);
ProcessHacker_Invoke(PhMainWndHandle, PhpOptionsNotifyChangeCallback, NULL);
ProcessHacker_Invoke(PhpOptionsNotifyChangeCallback, NULL);
}
static NTSTATUS PhpElevateAdvancedThreadStart(
@@ -1293,7 +1293,7 @@ INT_PTR CALLBACK PhpOptionsGeneralDlgProc(
if (NewFontSelection)
{
PhSetStringSetting2(L"Font", &NewFontSelection->sr);
PostMessage(PhMainWndHandle, WM_PH_UPDATE_FONT, 0, 0);
ProcessHacker_UpdateFont();
}
PhpAdvancedPageSave(hwndDlg);
@@ -1324,7 +1324,7 @@ INT_PTR CALLBACK PhpOptionsGeneralDlgProc(
// Can't get LOGFONT from the existing setting, probably
// because the user hasn't ever chosen a font before.
// Set the font to something familiar.
GetObject((HFONT)SendMessage(PhMainWndHandle, WM_PH_GET_FONT, 0, 0), sizeof(LOGFONT), &font);
GetObject(ProcessHacker_GetFont(), sizeof(LOGFONT), &font);
}
memset(&chooseFont, 0, sizeof(CHOOSEFONT));
+2 -2
View File
@@ -240,7 +240,7 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
if (context->Record->FileName)
{
PhShellExecuteUserString(
PhMainWndHandle,
hwndDlg,
L"FileBrowseExecutable",
context->Record->FileName->Buffer,
FALSE,
@@ -255,7 +255,7 @@ INT_PTR CALLBACK PhpProcessRecordDlgProc(
if (processItem = PhReferenceProcessItemForRecord(context->Record))
{
ProcessHacker_ShowProcessProperties(PhMainWndHandle, processItem);
ProcessHacker_ShowProcessProperties(processItem);
PhDereferenceObject(processItem);
}
else
+3 -2
View File
@@ -508,7 +508,7 @@ INT_PTR CALLBACK PhpProcessMemoryDlgProc(
showMemoryEditor->SelectOffset = ULONG_MAX;
showMemoryEditor->SelectLength = 0;
ProcessHacker_ShowMemoryEditor(PhMainWndHandle, showMemoryEditor);
ProcessHacker_ShowMemoryEditor(showMemoryEditor);
}
}
break;
@@ -790,7 +790,8 @@ INT_PTR CALLBACK PhpProcessMemoryDlgProc(
showMemoryEditor->RegionSize = memoryItem->RegionSize;
showMemoryEditor->SelectOffset = (ULONG)((ULONG_PTR)address - (ULONG_PTR)memoryItem->BaseAddress);
showMemoryEditor->SelectLength = 0;
ProcessHacker_ShowMemoryEditor(PhMainWndHandle, showMemoryEditor);
ProcessHacker_ShowMemoryEditor(showMemoryEditor);
break;
}
else
+2 -2
View File
@@ -577,12 +577,12 @@ VOID PhSipOnCommand(
break;
case IDC_REFRESH:
{
ProcessHacker_Refresh(PhMainWndHandle);
ProcessHacker_Refresh();
}
break;
case IDC_PAUSE:
{
ProcessHacker_SetUpdateAutomatically(PhMainWndHandle, !ProcessHacker_GetUpdateAutomatically(PhMainWndHandle));
ProcessHacker_SetUpdateAutomatically(!ProcessHacker_GetUpdateAutomatically());
}
break;
case IDC_MAXSCREEN:
+2 -2
View File
@@ -42,8 +42,8 @@ VOID NTAPI MenuItemCallback(
{
case ID_SERVICE_GOTOSERVICE:
{
ProcessHacker_SelectTabPage(menuItem->OwnerWindow, 1);
ProcessHacker_SelectServiceItem(menuItem->OwnerWindow, (PPH_SERVICE_ITEM)menuItem->Context);
ProcessHacker_SelectTabPage(1);
ProcessHacker_SelectServiceItem((PPH_SERVICE_ITEM)menuItem->Context);
}
break;
case ID_SERVICE_START:
+7 -7
View File
@@ -65,7 +65,7 @@ VOID EtInitializeDiskTab(
memset(&page, 0, sizeof(PH_MAIN_TAB_PAGE));
PhInitializeStringRef(&page.Name, L"Disk");
page.Callback = EtpDiskPageCallback;
DiskPage = ProcessHacker_CreateTabPage(PhMainWndHandle, &page);
DiskPage = ProcessHacker_CreateTabPage(&page);
if (ToolStatusInterface)
{
@@ -933,7 +933,7 @@ VOID EtHandleDiskCommand(
if ((processNode = PhFindProcessNode(diskItem->ProcessId)) &&
processNode->ProcessItem->CreateTime.QuadPart == diskItem->ProcessRecord->CreateTime.QuadPart)
{
ProcessHacker_SelectTabPage(PhMainWndHandle, 0);
ProcessHacker_SelectTabPage(0);
PhSelectAndEnsureVisibleProcessNode(processNode);
}
else
@@ -943,7 +943,7 @@ VOID EtHandleDiskCommand(
}
else
{
PhShowError2(PhMainWndHandle, L"Unable to select the process.", L"%s", L"The process does not exist.");
PhShowError2(WindowHandle, L"Unable to select the process.", L"%s", L"The process does not exist.");
}
PhDereferenceObject(diskItem);
@@ -968,7 +968,7 @@ VOID EtHandleDiskCommand(
PhMoveReference(&fileName, PhSubstring(fileName, 0, streamIndex));
}
PhShellExploreFile(PhMainWndHandle, fileName->Buffer);
PhShellExploreFile(WindowHandle, fileName->Buffer);
PhDereferenceObject(fileName);
}
}
@@ -999,7 +999,7 @@ VOID EtHandleDiskCommand(
if (PhDoesFileExistsWin32(PhGetString(fileName)))
{
PhShellExecuteUserString(
PhMainWndHandle,
WindowHandle,
L"ProgramInspectExecutables",
fileName->Buffer,
FALSE,
@@ -1029,7 +1029,7 @@ VOID EtHandleDiskCommand(
PhMoveReference(&fileName, PhSubstring(fileName, 0, streamIndex));
}
PhShellProperties(PhMainWndHandle, fileName->Buffer);
PhShellProperties(WindowHandle, fileName->Buffer);
PhDereferenceObject(fileName);
}
}
@@ -1167,7 +1167,7 @@ VOID NTAPI EtpDiskItemsUpdatedHandler(
_In_opt_ PVOID Context
)
{
ProcessHacker_Invoke(PhMainWndHandle, EtpOnDiskItemsUpdated, EtRunCount);
ProcessHacker_Invoke(EtpOnDiskItemsUpdated, EtRunCount);
}
VOID NTAPI EtpOnDiskItemsUpdated(
+1 -1
View File
@@ -263,7 +263,7 @@ VOID NTAPI MenuItemCallback(
}
break;
case MAINMENU_ACTION_GEOIP_UPDATE:
ShowGeoIPUpdateDialog(NULL);
ShowGeoIPUpdateDialog();
break;
}
}
+1 -1
View File
@@ -320,7 +320,7 @@ NTSTATUS GeoIPUpdateThread(
);
VOID ShowGeoIPUpdateDialog(
_In_opt_ HWND Parent
VOID
);
// pages.c
+2 -2
View File
@@ -109,7 +109,7 @@ HRESULT CALLBACK RestartDbTaskDialogCallbackProc(
{
if ((INT)wParam == IDYES)
{
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
ProcessHacker_PrepareForEarlyShutdown();
PhShellProcessHacker(
PhMainWndHandle,
NULL,
@@ -119,7 +119,7 @@ HRESULT CALLBACK RestartDbTaskDialogCallbackProc(
0,
NULL
);
ProcessHacker_Destroy(PhMainWndHandle);
ProcessHacker_Destroy();
}
}
break;
+5 -5
View File
@@ -619,7 +619,7 @@ NTSTATUS GeoIPUpdateDialogThread(
//info.hwnd = Parameter;
//info.lpVerb = L"runas";
//
//ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
//ProcessHacker_PrepareForEarlyShutdown();
//
//if (ShellExecuteEx(&info))
//{
@@ -642,7 +642,7 @@ NTSTATUS GeoIPUpdateDialogThread(
// NULL
// );
//
// ProcessHacker_Destroy(PhMainWndHandle);
// ProcessHacker_Destroy();
// }
// }
//
@@ -650,19 +650,19 @@ NTSTATUS GeoIPUpdateDialogThread(
//}
//else
//{
// ProcessHacker_CancelEarlyShutdown(PhMainWndHandle);
// ProcessHacker_CancelEarlyShutdown();
//}
}
VOID ShowGeoIPUpdateDialog(
_In_opt_ HWND Parent
VOID
)
{
if (!UpdateDialogThreadHandle)
{
if (!NT_SUCCESS(PhCreateThreadEx(&UpdateDialogThreadHandle, GeoIPUpdateDialogThread, NULL)))
{
PhShowError(PhMainWndHandle, L"%s", L"Unable to create the window.");
PhShowError(NULL, L"%s", L"Unable to create the window.");
return;
}
+3 -3
View File
@@ -201,9 +201,9 @@ VOID NTAPI MenuItemCallback(
if (SUCCEEDED(TaskDialogIndirect(&config, &result, NULL, NULL)) && result == IDYES)
{
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
ProcessHacker_PrepareForEarlyShutdown();
PhShellProcessHacker(
PhMainWndHandle,
menuItem->OwnerWindow,
L"-v",
SW_SHOW,
0,
@@ -211,7 +211,7 @@ VOID NTAPI MenuItemCallback(
0,
NULL
);
ProcessHacker_Destroy(PhMainWndHandle);
ProcessHacker_Destroy();
}
}
}
+13 -20
View File
@@ -1142,8 +1142,8 @@ LRESULT CALLBACK MainWndSubclassProc(
if (processNode)
{
ProcessHacker_SelectTabPage(hWnd, 0);
ProcessHacker_SelectProcessNode(hWnd, processNode);
ProcessHacker_SelectTabPage(0);
ProcessHacker_SelectProcessNode(processNode);
}
switch (TargetingMode)
@@ -1218,7 +1218,7 @@ LRESULT CALLBACK MainWndSubclassProc(
break;
case WM_SIZE:
// Resize PH main window client-area.
ProcessHacker_InvalidateLayoutPadding(hWnd);
ProcessHacker_InvalidateLayoutPadding();
break;
case WM_SETTINGCHANGE:
{
@@ -1282,13 +1282,13 @@ LRESULT CALLBACK MainWndSubclassProc(
// Let Process Hacker perform the default processing.
CallWindowProc(MainWindowHookProc, hWnd, uMsg, wParam, lParam);
if (newFont = (HFONT)SendMessage(hWnd, WM_PH_GET_FONT, 0, 0))
if (newFont = ProcessHacker_GetFont())
{
if (ToolStatusWindowFont) DeleteFont(ToolStatusWindowFont);
ToolStatusWindowFont = newFont;
if (ToolbarWindowFont) DeleteFont(ToolbarWindowFont);
ToolbarWindowFont = newFont;
SetWindowFont(ToolBarHandle, ToolStatusWindowFont, TRUE);
SetWindowFont(StatusBarHandle, ToolStatusWindowFont, TRUE);
SetWindowFont(ToolBarHandle, ToolbarWindowFont, TRUE);
SetWindowFont(StatusBarHandle, ToolbarWindowFont, TRUE);
ToolbarLoadSettings();
}
@@ -1311,7 +1311,7 @@ VOID NTAPI MainWindowShowingCallback(
{
PhRegisterMessageLoopFilter(MessageLoopFilter, NULL);
PhRegisterCallback(
ProcessHacker_GetCallbackLayoutPadding(PhMainWndHandle),
ProcessHacker_GetCallbackLayoutPadding(),
LayoutPaddingCallback,
NULL,
&LayoutPaddingCallbackRegistration
@@ -1384,10 +1384,11 @@ VOID NTAPI LoadCallback(
)
{
ToolStatusConfig.Flags = PhGetIntegerSetting(SETTING_NAME_TOOLSTATUS_CONFIG);
DisplayStyle = (TOOLBAR_DISPLAY_STYLE)PhGetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE);
SearchBoxDisplayMode = (SEARCHBOX_DISPLAY_MODE)PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE);
DisplayStyle = PhGetIntegerSetting(SETTING_NAME_TOOLBARDISPLAYSTYLE);
SearchBoxDisplayMode = PhGetIntegerSetting(SETTING_NAME_SEARCHBOXDISPLAYMODE);
EnableThemeSupport = !!PhGetIntegerSetting(L"EnableThemeSupport");
UpdateGraphs = !PhGetIntegerSetting(L"StartHidden");
TabInfoHashtable = PhCreateSimpleHashtable(3);
ToolbarGraphsInitialize();
}
@@ -1541,7 +1542,6 @@ LOGICAL DllMain(
PH_SETTING_CREATE settings[] =
{
{ IntegerSettingType, SETTING_NAME_TOOLSTATUS_CONFIG, L"1F" },
{ IntegerSettingType, SETTING_NAME_TOOLBAR_THEME, L"0" },
{ IntegerSettingType, SETTING_NAME_TOOLBARDISPLAYSTYLE, L"1" },
{ IntegerSettingType, SETTING_NAME_SEARCHBOXDISPLAYMODE, L"0" },
{ StringSettingType, SETTING_NAME_REBAR_CONFIG, L"" },
@@ -1622,14 +1622,7 @@ LOGICAL DllMain(
&NetworkTreeNewInitializingCallbackRegistration
);
PhAddSettings(settings, ARRAYSIZE(settings));
AcceleratorTable = LoadAccelerators(
Instance,
MAKEINTRESOURCE(IDR_MAINWND_ACCEL)
);
TabInfoHashtable = PhCreateSimpleHashtable(3);
PhAddSettings(settings, RTL_NUMBER_OF(settings));
}
break;
}
+8 -5
View File
@@ -25,7 +25,7 @@
SIZE ToolBarImageSize = { 16, 16 };
HIMAGELIST ToolBarImageList = NULL;
HFONT ToolStatusWindowFont = NULL;
HFONT ToolbarWindowFont = NULL;
TBBUTTON ToolbarButtons[MAX_TOOLBAR_ITEMS] =
{
// Default toolbar buttons (displayed)
@@ -116,10 +116,10 @@ VOID RebarLoadSettings(
HFONT newFont;
if (newFont = (HFONT)SendMessage(PhMainWndHandle, WM_PH_GET_FONT, 0, 0))
if (newFont = ProcessHacker_GetFont())
{
if (ToolStatusWindowFont) DeleteFont(ToolStatusWindowFont);
ToolStatusWindowFont = newFont;
if (ToolbarWindowFont) DeleteFont(ToolbarWindowFont);
ToolbarWindowFont = newFont;
}
}
@@ -161,7 +161,7 @@ VOID RebarLoadSettings(
// Configure the toolbar imagelist.
SendMessage(ToolBarHandle, TB_SETIMAGELIST, 0, (LPARAM)ToolBarImageList);
// Configure the toolbar font.
SetWindowFont(ToolBarHandle, ToolStatusWindowFont, FALSE);
SetWindowFont(ToolBarHandle, ToolbarWindowFont, FALSE);
// Resize the toolbar.
SendMessage(ToolBarHandle, TB_AUTOSIZE, 0, 0);
@@ -207,6 +207,9 @@ VOID RebarLoadSettings(
NULL
);
// Configure the statusbar font.
SetWindowFont(StatusBarHandle, ToolbarWindowFont, FALSE);
if (StatusBarHandle && PhGetIntegerSetting(L"EnableThemeSupport"))
{
PhInitializeWindowThemeStatusBar(StatusBarHandle);
+2 -3
View File
@@ -41,7 +41,7 @@
#define SETTING_NAME_TOOLBAR_CONFIG (PLUGIN_NAME L".ToolbarButtonConfig")
#define SETTING_NAME_TOOLBAR_GRAPH_CONFIG (PLUGIN_NAME L".ToolbarGraphConfig")
#define SETTING_NAME_STATUSBAR_CONFIG (PLUGIN_NAME L".StatusbarConfig")
#define SETTING_NAME_TOOLBAR_THEME (PLUGIN_NAME L".ToolbarTheme")
//#define SETTING_NAME_TOOLBAR_THEME (PLUGIN_NAME L".ToolbarTheme")
#define SETTING_NAME_TOOLBARDISPLAYSTYLE (PLUGIN_NAME L".ToolbarDisplayStyle")
#define SETTING_NAME_SEARCHBOXDISPLAYMODE (PLUGIN_NAME L".SearchBoxDisplayMode")
@@ -143,6 +143,7 @@ extern PH_PLUGIN_SYSTEM_STATISTICS SystemStatistics;
extern HIMAGELIST ToolBarImageList;
extern TBBUTTON ToolbarButtons[MAX_TOOLBAR_ITEMS];
extern HFONT ToolbarWindowFont;
extern PPH_PLUGIN PluginInstance;
extern PPH_TN_FILTER_ENTRY ProcessTreeFilterEntry;
@@ -442,6 +443,4 @@ BOOLEAN CreateSearchboxControl(
VOID
);
extern HFONT ToolStatusWindowFont;
#endif
+3 -3
View File
@@ -141,18 +141,18 @@ HRESULT CALLBACK FinalTaskDialogCallbackProc(
info.hwnd = hwndDlg;
info.fMask = SEE_MASK_NOASYNC | SEE_MASK_FLAG_NO_UI | SEE_MASK_NOZONECHECKS;
ProcessHacker_PrepareForEarlyShutdown(PhMainWndHandle);
ProcessHacker_PrepareForEarlyShutdown();
if (ShellExecuteEx(&info))
{
ProcessHacker_Destroy(PhMainWndHandle);
ProcessHacker_Destroy();
}
else
{
ULONG errorCode = GetLastError();
// Install failed, cancel the shutdown.
ProcessHacker_CancelEarlyShutdown(PhMainWndHandle);
ProcessHacker_CancelEarlyShutdown();
// Show error dialog.
if (errorCode != ERROR_CANCELLED) // Ignore UAC decline.