add plugins-extra
This commit is contained in:
2
plugins-extra/TaskbarExtPlugin/CHANGELOG.txt
Normal file
2
plugins-extra/TaskbarExtPlugin/CHANGELOG.txt
Normal file
@@ -0,0 +1,2 @@
|
||||
1.0
|
||||
* Initial release
|
||||
133
plugins-extra/TaskbarExtPlugin/TaskbarExtPlugin.rc
Normal file
133
plugins-extra/TaskbarExtPlugin/TaskbarExtPlugin.rc
Normal file
@@ -0,0 +1,133 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "winres.h"
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// English (Australia) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENA)
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_AUS
|
||||
#pragma code_page(1252)
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,0
|
||||
PRODUCTVERSION 1,0,0,0
|
||||
FILEFLAGSMASK 0x17L
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x2L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "0c0904b0"
|
||||
BEGIN
|
||||
VALUE "CompanyName", "dmex"
|
||||
VALUE "FileDescription", "Taskbar Extensions Plugin for Process Hacker"
|
||||
VALUE "FileVersion", "1.0"
|
||||
VALUE "InternalName", "dmex.TaskbarExtPlugin"
|
||||
VALUE "LegalCopyright", "Licensed under the GNU GPL, v3."
|
||||
VALUE "OriginalFilename", "TaskbarExtPlugin.dll"
|
||||
VALUE "ProductName", "Taskbar Extensions Plugin for Process Hacker"
|
||||
VALUE "ProductVersion", "1.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0xc09, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_OPTIONS DIALOGEX 0, 0, 187, 56
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
EXSTYLE WS_EX_APPWINDOW
|
||||
CAPTION "Options"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
PUSHBUTTON "Cancel",IDCANCEL,131,35,50,14
|
||||
COMBOBOX IDC_GRAPH_TYPE,7,17,173,30,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "Select Graph to show on the Taskbar:",IDC_STATIC,7,5,122,8
|
||||
DEFPUSHBUTTON "Ok",IDOK,79,35,50,14
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_OPTIONS, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 180
|
||||
TOPMARGIN, 5
|
||||
BOTTOMMARGIN, 49
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""winres.h""\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDB_APPLICATION_BMP BITMAP "resources\\application.bmp"
|
||||
IDB_APPLICATION_GO_BMP BITMAP "resources\\application_go.bmp"
|
||||
IDB_CHART_LINE_BMP BITMAP "resources\\chart_line.bmp"
|
||||
IDB_FIND_BMP BITMAP "resources\\find.bmp"
|
||||
#endif // English (Australia) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
119
plugins-extra/TaskbarExtPlugin/TaskbarExtPlugin.vcxproj
Normal file
119
plugins-extra/TaskbarExtPlugin/TaskbarExtPlugin.vcxproj
Normal file
@@ -0,0 +1,119 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Debug|x64">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|x64">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>x64</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{58E266DF-088C-470D-9EC8-403B40042373}</ProjectGuid>
|
||||
<RootNamespace>TaskbarExtPlugin</RootNamespace>
|
||||
<Keyword>Win32Proj</Keyword>
|
||||
<ProjectName>TaskbarExtPlugin</ProjectName>
|
||||
<WindowsTargetPlatformVersion>10.0.14393.0</WindowsTargetPlatformVersion>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
||||
<CharacterSet>Unicode</CharacterSet>
|
||||
<PlatformToolset>v140</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ExtraPlugins.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ExtraPlugins.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ExtraPlugins.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
<Import Project="..\ExtraPlugins.props" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Debug32</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<LibraryPath>$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Release64</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<LibraryPath>$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86;C:\Users\AirDog46\Downloads\processhacker-2.39-src\bin\Release32</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<ClCompile>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<ClCompile>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<TreatWarningAsError>false</TreatWarningAsError>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c" />
|
||||
<ClCompile Include="notifico.c" />
|
||||
<ClCompile Include="options.c" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="main.h" />
|
||||
<ClInclude Include="resource.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TaskbarExtPlugin.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CHANGELOG.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="resources\application.bmp" />
|
||||
<Image Include="resources\application_go.bmp" />
|
||||
<Image Include="resources\chart_line.bmp" />
|
||||
<Image Include="resources\find.bmp" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
</Project>
|
||||
@@ -0,0 +1,55 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<ClInclude Include="resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="main.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="CHANGELOG.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{425a0fc8-1446-4937-8041-dbe97bcbebc4}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{cb9a1b81-72f0-4b16-974c-dda6e1ab96ab}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{2a3c08d8-713f-4933-93e3-9a8ce42807ca}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="TaskbarExtPlugin.rc">
|
||||
<Filter>Resource Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="main.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="notifico.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="options.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Image Include="resources\application.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="resources\application_go.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="resources\chart_line.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
<Image Include="resources\find.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</Image>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
282
plugins-extra/TaskbarExtPlugin/main.c
Normal file
282
plugins-extra/TaskbarExtPlugin/main.c
Normal file
@@ -0,0 +1,282 @@
|
||||
/*
|
||||
* Process Hacker Extra Plugins -
|
||||
* Taskbar Extensions
|
||||
*
|
||||
* Copyright (C) 2015 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
PPH_PLUGIN PluginInstance;
|
||||
static PH_CALLBACK_REGISTRATION PluginLoadCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION PluginUnloadCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION PluginShowOptionsCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION MainWindowShowingCallbackRegistration;
|
||||
static PH_CALLBACK_REGISTRATION ProcessesUpdatedCallbackRegistration;
|
||||
|
||||
static TASKBAR_ICON TaskbarIconType = TASKBAR_ICON_NONE;
|
||||
static ULONG ProcessesUpdatedCount = 0;
|
||||
static BOOLEAN TaskbarButtonsCreated = FALSE;
|
||||
static UINT TaskbarButtonCreatedMsgId = 0;
|
||||
static ITaskbarList3* TaskbarListClass = NULL;
|
||||
static HICON BlackIcon = NULL;
|
||||
static HIMAGELIST ButtonsImageList = NULL;
|
||||
static THUMBBUTTON ButtonsArray[4] = { 0 }; // maximum 8
|
||||
|
||||
VOID NTAPI ProcessesUpdatedCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
HICON overlayIcon = NULL;
|
||||
ULONG taskbarIconType = TASKBAR_ICON_NONE;
|
||||
PH_PLUGIN_SYSTEM_STATISTICS statistics;
|
||||
|
||||
ProcessesUpdatedCount++;
|
||||
|
||||
if (ProcessesUpdatedCount < 2)
|
||||
return;
|
||||
|
||||
taskbarIconType = PhGetIntegerSetting(SETTING_NAME_TASKBAR_ICON_TYPE);
|
||||
|
||||
// Check if we need to clear the icon...
|
||||
if (taskbarIconType != TaskbarIconType && taskbarIconType == TASKBAR_ICON_NONE)
|
||||
{
|
||||
// Clear the icon...
|
||||
if (TaskbarListClass)
|
||||
{
|
||||
ITaskbarList3_SetOverlayIcon(TaskbarListClass, PhMainWndHandle, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
TaskbarIconType = taskbarIconType;
|
||||
|
||||
PhPluginGetSystemStatistics(&statistics);
|
||||
|
||||
switch (TaskbarIconType)
|
||||
{
|
||||
case TASKBAR_ICON_CPU_HISTORY:
|
||||
overlayIcon = PhUpdateIconCpuHistory(statistics);
|
||||
break;
|
||||
case TASKBAR_ICON_IO_HISTORY:
|
||||
overlayIcon = PhUpdateIconIoHistory(statistics);
|
||||
break;
|
||||
case TASKBAR_ICON_COMMIT_HISTORY:
|
||||
overlayIcon = PhUpdateIconCommitHistory(statistics);
|
||||
break;
|
||||
case TASKBAR_ICON_PHYSICAL_HISTORY:
|
||||
overlayIcon = PhUpdateIconPhysicalHistory(statistics);
|
||||
break;
|
||||
case TASKBAR_ICON_CPU_USAGE:
|
||||
overlayIcon = PhUpdateIconCpuUsage(statistics);
|
||||
break;
|
||||
}
|
||||
|
||||
if (overlayIcon)
|
||||
{
|
||||
if (TaskbarListClass)
|
||||
{
|
||||
ITaskbarList3_SetOverlayIcon(TaskbarListClass, PhMainWndHandle, overlayIcon, NULL);
|
||||
}
|
||||
|
||||
DestroyIcon(overlayIcon);
|
||||
}
|
||||
}
|
||||
|
||||
LRESULT CALLBACK MainWndSubclassProc(
|
||||
_In_ HWND hWnd,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam,
|
||||
_In_ UINT_PTR uIdSubclass,
|
||||
_In_ ULONG_PTR dwRefData
|
||||
)
|
||||
{
|
||||
if (uMsg == TaskbarButtonCreatedMsgId)
|
||||
{
|
||||
if (!TaskbarButtonsCreated)
|
||||
{
|
||||
BlackIcon = PhGetBlackIcon();
|
||||
ButtonsImageList = ImageList_Create(16, 16, ILC_COLOR32 | ILC_MASK, 0, 0);
|
||||
ImageList_SetImageCount(ButtonsImageList, 4);
|
||||
PhSetImageListBitmap(ButtonsImageList, 0, PluginInstance->DllBase, MAKEINTRESOURCE(IDB_CHART_LINE_BMP));
|
||||
PhSetImageListBitmap(ButtonsImageList, 1, PluginInstance->DllBase, MAKEINTRESOURCE(IDB_FIND_BMP));
|
||||
PhSetImageListBitmap(ButtonsImageList, 2, PluginInstance->DllBase, MAKEINTRESOURCE(IDB_APPLICATION_BMP));
|
||||
PhSetImageListBitmap(ButtonsImageList, 3, PluginInstance->DllBase, MAKEINTRESOURCE(IDB_APPLICATION_GO_BMP));
|
||||
|
||||
ButtonsArray[0].dwMask = THB_FLAGS | THB_BITMAP | THB_TOOLTIP;
|
||||
ButtonsArray[0].dwFlags = THBF_ENABLED | THBF_DISMISSONCLICK;
|
||||
ButtonsArray[0].iId = PHAPP_ID_VIEW_SYSTEMINFORMATION;
|
||||
ButtonsArray[0].iBitmap = 0;
|
||||
wcsncpy_s(ButtonsArray[0].szTip, ARRAYSIZE(ButtonsArray[0].szTip), L"System Information", _TRUNCATE);
|
||||
|
||||
ButtonsArray[1].dwMask = THB_FLAGS | THB_BITMAP | THB_TOOLTIP;
|
||||
ButtonsArray[1].dwFlags = THBF_ENABLED | THBF_DISMISSONCLICK;
|
||||
ButtonsArray[1].iId = PHAPP_ID_HACKER_FINDHANDLESORDLLS;
|
||||
ButtonsArray[1].iBitmap = 1;
|
||||
wcsncpy_s(ButtonsArray[1].szTip, ARRAYSIZE(ButtonsArray[1].szTip), L"Find Handles or DLLs", _TRUNCATE);
|
||||
|
||||
ButtonsArray[2].dwMask = THB_FLAGS | THB_BITMAP | THB_TOOLTIP;
|
||||
ButtonsArray[2].dwFlags = THBF_ENABLED | THBF_DISMISSONCLICK;
|
||||
ButtonsArray[2].iId = PHAPP_ID_HELP_LOG;
|
||||
ButtonsArray[2].iBitmap = 2;
|
||||
wcsncpy_s(ButtonsArray[2].szTip, ARRAYSIZE(ButtonsArray[2].szTip), L"Application Log", _TRUNCATE);
|
||||
|
||||
ButtonsArray[3].dwMask = THB_FLAGS | THB_BITMAP | THB_TOOLTIP;
|
||||
ButtonsArray[3].dwFlags = THBF_ENABLED | THBF_DISMISSONCLICK;
|
||||
ButtonsArray[3].iId = PHAPP_ID_TOOLS_INSPECTEXECUTABLEFILE;
|
||||
ButtonsArray[3].iBitmap = 3;
|
||||
wcsncpy_s(ButtonsArray[3].szTip, ARRAYSIZE(ButtonsArray[3].szTip), L"Inspect Executable File", _TRUNCATE);
|
||||
|
||||
TaskbarButtonsCreated = TRUE;
|
||||
}
|
||||
|
||||
if (TaskbarListClass)
|
||||
{
|
||||
// Set the ThumbBar image list
|
||||
ITaskbarList3_ThumbBarSetImageList(TaskbarListClass, PhMainWndHandle, ButtonsImageList);
|
||||
// Set the ThumbBar buttons array
|
||||
ITaskbarList3_ThumbBarAddButtons(TaskbarListClass, PhMainWndHandle, ARRAYSIZE(ButtonsArray), ButtonsArray);
|
||||
|
||||
if (TaskbarIconType != TASKBAR_ICON_NONE)
|
||||
{
|
||||
// Set the initial ThumbBar icon
|
||||
ITaskbarList3_SetOverlayIcon(TaskbarListClass, PhMainWndHandle, BlackIcon, NULL);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return DefSubclassProc(hWnd, uMsg, wParam, lParam);
|
||||
}
|
||||
|
||||
VOID NTAPI LoadCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
// Update settings
|
||||
TaskbarIconType = PhGetIntegerSetting(SETTING_NAME_TASKBAR_ICON_TYPE);
|
||||
|
||||
// Get the TaskbarButtonCreated Id
|
||||
TaskbarButtonCreatedMsgId = RegisterWindowMessage(L"TaskbarButtonCreated");
|
||||
|
||||
// Allow the TaskbarButtonCreated message to pass through UIPI.
|
||||
ChangeWindowMessageFilter(TaskbarButtonCreatedMsgId, MSGFLT_ALLOW);
|
||||
// Allow WM_COMMAND messages to pass through UIPI (Required for ThumbBar buttons if elevated...TODO: Review security.)
|
||||
ChangeWindowMessageFilter(WM_COMMAND, MSGFLT_ALLOW);
|
||||
|
||||
// Set the process-wide AppUserModelID
|
||||
SetCurrentProcessExplicitAppUserModelID(L"ProcessHacker2");
|
||||
|
||||
if (SUCCEEDED(CoCreateInstance(&CLSID_TaskbarList, NULL, CLSCTX_INPROC_SERVER, &IID_ITaskbarList3, &TaskbarListClass)))
|
||||
{
|
||||
if (!SUCCEEDED(ITaskbarList3_HrInit(TaskbarListClass)))
|
||||
{
|
||||
ITaskbarList3_Release(TaskbarListClass);
|
||||
TaskbarListClass = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
PhRegisterCallback(&PhProcessesUpdatedEvent, ProcessesUpdatedCallback, NULL, &ProcessesUpdatedCallbackRegistration);
|
||||
}
|
||||
|
||||
VOID NTAPI UnloadCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
NOTHING;
|
||||
}
|
||||
|
||||
VOID NTAPI ShowOptionsCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
ShowOptionsDialog((HWND)Parameter);
|
||||
}
|
||||
|
||||
VOID NTAPI MainWindowShowingCallback(
|
||||
_In_opt_ PVOID Parameter,
|
||||
_In_opt_ PVOID Context
|
||||
)
|
||||
{
|
||||
SetWindowSubclass(PhMainWndHandle, MainWndSubclassProc, 0, 0);
|
||||
}
|
||||
|
||||
LOGICAL DllMain(
|
||||
_In_ HINSTANCE Instance,
|
||||
_In_ ULONG Reason,
|
||||
_Reserved_ PVOID Reserved
|
||||
)
|
||||
{
|
||||
switch (Reason)
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
{
|
||||
PPH_PLUGIN_INFORMATION info;
|
||||
PH_SETTING_CREATE settings[] =
|
||||
{
|
||||
{ IntegerSettingType, SETTING_NAME_TASKBAR_ICON_TYPE, L"1" }
|
||||
};
|
||||
|
||||
if (WindowsVersion < WINDOWS_7)
|
||||
break;
|
||||
|
||||
PluginInstance = PhRegisterPlugin(PLUGIN_NAME, Instance, &info);
|
||||
|
||||
if (!PluginInstance)
|
||||
return FALSE;
|
||||
|
||||
info->DisplayName = L"Taskbar Extensions";
|
||||
info->Author = L"dmex";
|
||||
info->Description = L"Plugin for Taskbar ThumbBar buttons and Overlay icon support.";
|
||||
info->HasOptions = TRUE;
|
||||
|
||||
PhRegisterCallback(
|
||||
PhGetPluginCallback(PluginInstance, PluginCallbackLoad),
|
||||
LoadCallback,
|
||||
NULL,
|
||||
&PluginLoadCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetPluginCallback(PluginInstance, PluginCallbackUnload),
|
||||
UnloadCallback,
|
||||
NULL,
|
||||
&PluginUnloadCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetPluginCallback(PluginInstance, PluginCallbackShowOptions),
|
||||
ShowOptionsCallback,
|
||||
NULL,
|
||||
&PluginShowOptionsCallbackRegistration
|
||||
);
|
||||
PhRegisterCallback(
|
||||
PhGetGeneralCallback(GeneralCallbackMainWindowShowing),
|
||||
MainWindowShowingCallback,
|
||||
NULL,
|
||||
&MainWindowShowingCallbackRegistration
|
||||
);
|
||||
|
||||
PhAddSettings(settings, ARRAYSIZE(settings));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
78
plugins-extra/TaskbarExtPlugin/main.h
Normal file
78
plugins-extra/TaskbarExtPlugin/main.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* Process Hacker Extra Plugins -
|
||||
* Taskbar Extensions
|
||||
*
|
||||
* Copyright (C) 2015 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef _TB_EXT_H_
|
||||
#define _TB_EXT_H_
|
||||
|
||||
#define PLUGIN_NAME L"dmex.TaskbarExtPlugin"
|
||||
#define SETTING_NAME_TASKBAR_ICON_TYPE (PLUGIN_NAME L".IconType")
|
||||
|
||||
#define CINTERFACE
|
||||
#define COBJMACROS
|
||||
#include "phdk.h"
|
||||
#include <phappresource.h>
|
||||
#include "resource.h"
|
||||
|
||||
#include <Shobjidl.h>
|
||||
|
||||
typedef enum _TASKBAR_ICON
|
||||
{
|
||||
TASKBAR_ICON_NONE,
|
||||
TASKBAR_ICON_CPU_HISTORY,
|
||||
TASKBAR_ICON_IO_HISTORY,
|
||||
TASKBAR_ICON_COMMIT_HISTORY,
|
||||
TASKBAR_ICON_PHYSICAL_HISTORY,
|
||||
TASKBAR_ICON_CPU_USAGE,
|
||||
} TASKBAR_ICON;
|
||||
|
||||
extern PPH_PLUGIN PluginInstance;
|
||||
extern TASKBAR_ICON TaskbarIconType;
|
||||
|
||||
VOID ShowOptionsDialog(
|
||||
_In_ HWND ParentHandle
|
||||
);
|
||||
|
||||
HICON PhGetBlackIcon(
|
||||
VOID
|
||||
);
|
||||
|
||||
HICON PhUpdateIconCpuHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
);
|
||||
|
||||
HICON PhUpdateIconIoHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
);
|
||||
|
||||
HICON PhUpdateIconCommitHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
);
|
||||
|
||||
HICON PhUpdateIconPhysicalHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
);
|
||||
|
||||
HICON PhUpdateIconCpuUsage(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
);
|
||||
|
||||
#endif _TB_EXT_H_
|
||||
464
plugins-extra/TaskbarExtPlugin/notifico.c
Normal file
464
plugins-extra/TaskbarExtPlugin/notifico.c
Normal file
@@ -0,0 +1,464 @@
|
||||
/*
|
||||
* Process Hacker Extra Plugins -
|
||||
* Taskbar Extensions
|
||||
*
|
||||
* Copyright (C) 2015-2016 dmex
|
||||
* Copyright (C) 2011-2013 wj32
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
typedef struct _PH_NF_BITMAP
|
||||
{
|
||||
BOOLEAN Initialized;
|
||||
HDC Hdc;
|
||||
BITMAPINFOHEADER Header;
|
||||
HBITMAP Bitmap;
|
||||
PVOID Bits;
|
||||
} PH_NF_BITMAP, *PPH_NF_BITMAP;
|
||||
|
||||
static PH_NF_BITMAP PhDefaultBitmapContext = { 0 };
|
||||
static PH_NF_BITMAP PhBlackBitmapContext = { 0 };
|
||||
static HBITMAP PhBlackBitmap = NULL;
|
||||
static HICON PhBlackIcon = NULL;
|
||||
|
||||
static VOID PhBeginBitmap2(
|
||||
_Inout_ PPH_NF_BITMAP Context,
|
||||
_Out_ PULONG Width,
|
||||
_Out_ PULONG Height,
|
||||
_Out_ HBITMAP *Bitmap,
|
||||
_Out_opt_ PVOID *Bits,
|
||||
_Out_ HDC *Hdc,
|
||||
_Out_ HBITMAP *OldBitmap
|
||||
)
|
||||
{
|
||||
if (!Context->Initialized)
|
||||
{
|
||||
HDC hdc;
|
||||
|
||||
hdc = CreateIC(L"DISPLAY", NULL, NULL, NULL);
|
||||
Context->Hdc = CreateCompatibleDC(hdc);
|
||||
|
||||
memset(&Context->Header, 0, sizeof(BITMAPINFOHEADER));
|
||||
Context->Header.biSize = sizeof(BITMAPINFOHEADER);
|
||||
Context->Header.biWidth = 16;
|
||||
Context->Header.biHeight = 16;
|
||||
Context->Header.biPlanes = 1;
|
||||
Context->Header.biBitCount = 32;
|
||||
Context->Bitmap = CreateDIBSection(hdc, (BITMAPINFO*)&Context->Header, DIB_RGB_COLORS, &Context->Bits, NULL, 0);
|
||||
|
||||
DeleteDC(hdc);
|
||||
|
||||
Context->Initialized = TRUE;
|
||||
}
|
||||
|
||||
*Width = 16;
|
||||
*Height = 16;
|
||||
*Bitmap = Context->Bitmap;
|
||||
if (Bits) *Bits = Context->Bits;
|
||||
*Hdc = Context->Hdc;
|
||||
*OldBitmap = SelectObject(Context->Hdc, Context->Bitmap);
|
||||
}
|
||||
|
||||
static VOID PhBeginBitmap(
|
||||
_Out_ PULONG Width,
|
||||
_Out_ PULONG Height,
|
||||
_Out_ HBITMAP *Bitmap,
|
||||
_Out_opt_ PVOID *Bits,
|
||||
_Out_ HDC *Hdc,
|
||||
_Out_ HBITMAP *OldBitmap
|
||||
)
|
||||
{
|
||||
PhBeginBitmap2(&PhDefaultBitmapContext, Width, Height, Bitmap, Bits, Hdc, OldBitmap);
|
||||
}
|
||||
|
||||
static HICON PhBitmapToIcon(
|
||||
_In_ HBITMAP Bitmap
|
||||
)
|
||||
{
|
||||
ICONINFO iconInfo;
|
||||
|
||||
PhGetBlackIcon();
|
||||
|
||||
iconInfo.fIcon = TRUE;
|
||||
iconInfo.xHotspot = 0;
|
||||
iconInfo.yHotspot = 0;
|
||||
iconInfo.hbmMask = PhBlackBitmap;
|
||||
iconInfo.hbmColor = Bitmap;
|
||||
|
||||
return CreateIconIndirect(&iconInfo);
|
||||
}
|
||||
|
||||
HICON PhGetBlackIcon(
|
||||
VOID
|
||||
)
|
||||
{
|
||||
if (!PhBlackIcon)
|
||||
{
|
||||
ULONG width;
|
||||
ULONG height;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
ICONINFO iconInfo;
|
||||
|
||||
PhBeginBitmap2(&PhBlackBitmapContext, &width, &height, &PhBlackBitmap, &bits, &hdc, &oldBitmap);
|
||||
memset(bits, 0, width * height * sizeof(ULONG));
|
||||
|
||||
iconInfo.fIcon = TRUE;
|
||||
iconInfo.xHotspot = 0;
|
||||
iconInfo.yHotspot = 0;
|
||||
iconInfo.hbmMask = PhBlackBitmap;
|
||||
iconInfo.hbmColor = PhBlackBitmap;
|
||||
PhBlackIcon = CreateIconIndirect(&iconInfo);
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
}
|
||||
|
||||
return PhBlackIcon;
|
||||
}
|
||||
|
||||
HICON PhUpdateIconCpuHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
)
|
||||
{
|
||||
static PH_GRAPH_DRAW_INFO drawInfo =
|
||||
{
|
||||
16,
|
||||
16,
|
||||
PH_GRAPH_USE_LINE_2,
|
||||
2,
|
||||
RGB(0x00, 0x00, 0x00),
|
||||
16,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
ULONG maxDataCount;
|
||||
ULONG lineDataCount;
|
||||
PFLOAT lineData1;
|
||||
PFLOAT lineData2;
|
||||
HBITMAP bitmap;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
HICON icon;
|
||||
|
||||
// Icon
|
||||
PhBeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
|
||||
maxDataCount = drawInfo.Width / 2 + 1;
|
||||
lineData1 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
lineData2 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
|
||||
lineDataCount = min(maxDataCount, Statistics.CpuKernelHistory->Count);
|
||||
PhCopyCircularBuffer_FLOAT(Statistics.CpuKernelHistory, lineData1, lineDataCount);
|
||||
PhCopyCircularBuffer_FLOAT(Statistics.CpuUserHistory, lineData2, lineDataCount);
|
||||
|
||||
drawInfo.LineDataCount = lineDataCount;
|
||||
drawInfo.LineData1 = lineData1;
|
||||
drawInfo.LineData2 = lineData2;
|
||||
drawInfo.LineColor1 = PhGetIntegerSetting(L"ColorCpuKernel");
|
||||
drawInfo.LineColor2 = PhGetIntegerSetting(L"ColorCpuUser");
|
||||
drawInfo.LineBackColor1 = PhHalveColorBrightness(drawInfo.LineColor1);
|
||||
drawInfo.LineBackColor2 = PhHalveColorBrightness(drawInfo.LineColor2);
|
||||
|
||||
if (bits)
|
||||
PhDrawGraphDirect(hdc, bits, &drawInfo);
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
icon = PhBitmapToIcon(bitmap);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
HICON PhUpdateIconIoHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
)
|
||||
{
|
||||
static PH_GRAPH_DRAW_INFO drawInfo =
|
||||
{
|
||||
16,
|
||||
16,
|
||||
PH_GRAPH_USE_LINE_2,
|
||||
2,
|
||||
RGB(0x00, 0x00, 0x00),
|
||||
16,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
ULONG maxDataCount;
|
||||
ULONG lineDataCount;
|
||||
PFLOAT lineData1;
|
||||
PFLOAT lineData2;
|
||||
FLOAT max;
|
||||
ULONG i;
|
||||
HBITMAP bitmap;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
HICON icon;
|
||||
|
||||
// Icon
|
||||
PhBeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
|
||||
maxDataCount = drawInfo.Width / 2 + 1;
|
||||
lineData1 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
lineData2 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
|
||||
lineDataCount = min(maxDataCount, Statistics.IoReadHistory->Count);
|
||||
max = 1024 * 1024; // minimum scaling of 1 MB.
|
||||
|
||||
for (i = 0; i < lineDataCount; i++)
|
||||
{
|
||||
lineData1[i] = (FLOAT)PhGetItemCircularBuffer_ULONG64(Statistics.IoReadHistory, i)
|
||||
+ (FLOAT)PhGetItemCircularBuffer_ULONG64(Statistics.IoOtherHistory, i);
|
||||
lineData2[i] = (FLOAT)PhGetItemCircularBuffer_ULONG64(Statistics.IoWriteHistory, i);
|
||||
|
||||
if (max < lineData1[i] + lineData2[i])
|
||||
max = lineData1[i] + lineData2[i];
|
||||
}
|
||||
|
||||
PhDivideSinglesBySingle(lineData1, max, lineDataCount);
|
||||
PhDivideSinglesBySingle(lineData2, max, lineDataCount);
|
||||
|
||||
drawInfo.LineDataCount = lineDataCount;
|
||||
drawInfo.LineData1 = lineData1;
|
||||
drawInfo.LineData2 = lineData2;
|
||||
drawInfo.LineColor1 = PhGetIntegerSetting(L"ColorIoReadOther");
|
||||
drawInfo.LineColor2 = PhGetIntegerSetting(L"ColorIoWrite");
|
||||
drawInfo.LineBackColor1 = PhHalveColorBrightness(drawInfo.LineColor1);
|
||||
drawInfo.LineBackColor2 = PhHalveColorBrightness(drawInfo.LineColor2);
|
||||
|
||||
if (bits)
|
||||
PhDrawGraphDirect(hdc, bits, &drawInfo);
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
icon = PhBitmapToIcon(bitmap);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
HICON PhUpdateIconCommitHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
)
|
||||
{
|
||||
static PH_GRAPH_DRAW_INFO drawInfo =
|
||||
{
|
||||
16,
|
||||
16,
|
||||
0,
|
||||
2,
|
||||
RGB(0x00, 0x00, 0x00),
|
||||
16,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
ULONG maxDataCount;
|
||||
ULONG lineDataCount;
|
||||
PFLOAT lineData1;
|
||||
ULONG i;
|
||||
HBITMAP bitmap;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
HICON icon;
|
||||
|
||||
// Icon
|
||||
PhBeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
|
||||
maxDataCount = drawInfo.Width / 2 + 1;
|
||||
lineData1 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
|
||||
lineDataCount = min(maxDataCount, Statistics.CommitHistory->Count);
|
||||
|
||||
for (i = 0; i < lineDataCount; i++)
|
||||
lineData1[i] = (FLOAT)PhGetItemCircularBuffer_ULONG(Statistics.CommitHistory, i);
|
||||
|
||||
PhDivideSinglesBySingle(lineData1, (FLOAT)Statistics.Performance->CommitLimit, lineDataCount);
|
||||
|
||||
drawInfo.LineDataCount = lineDataCount;
|
||||
drawInfo.LineData1 = lineData1;
|
||||
drawInfo.LineColor1 = PhGetIntegerSetting(L"ColorPrivate");
|
||||
drawInfo.LineBackColor1 = PhHalveColorBrightness(drawInfo.LineColor1);
|
||||
|
||||
if (bits)
|
||||
PhDrawGraphDirect(hdc, bits, &drawInfo);
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
icon = PhBitmapToIcon(bitmap);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
HICON PhUpdateIconPhysicalHistory(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
)
|
||||
{
|
||||
static PH_GRAPH_DRAW_INFO drawInfo =
|
||||
{
|
||||
16,
|
||||
16,
|
||||
0,
|
||||
2,
|
||||
RGB(0x00, 0x00, 0x00),
|
||||
16,
|
||||
NULL,
|
||||
NULL,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
0
|
||||
};
|
||||
ULONG maxDataCount;
|
||||
ULONG lineDataCount;
|
||||
PFLOAT lineData1;
|
||||
ULONG i;
|
||||
HBITMAP bitmap;
|
||||
PVOID bits;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
HICON icon;
|
||||
|
||||
// Icon
|
||||
PhBeginBitmap(&drawInfo.Width, &drawInfo.Height, &bitmap, &bits, &hdc, &oldBitmap);
|
||||
maxDataCount = drawInfo.Width / 2 + 1;
|
||||
lineData1 = _alloca(maxDataCount * sizeof(FLOAT));
|
||||
|
||||
lineDataCount = min(maxDataCount, Statistics.CommitHistory->Count);
|
||||
|
||||
for (i = 0; i < lineDataCount; i++)
|
||||
lineData1[i] = (FLOAT)PhGetItemCircularBuffer_ULONG(Statistics.PhysicalHistory, i);
|
||||
|
||||
PhDivideSinglesBySingle(lineData1, (FLOAT)PhSystemBasicInformation.NumberOfPhysicalPages, lineDataCount);
|
||||
|
||||
drawInfo.LineDataCount = lineDataCount;
|
||||
drawInfo.LineData1 = lineData1;
|
||||
drawInfo.LineColor1 = PhGetIntegerSetting(L"ColorPhysical");
|
||||
drawInfo.LineBackColor1 = PhHalveColorBrightness(drawInfo.LineColor1);
|
||||
|
||||
if (bits)
|
||||
PhDrawGraphDirect(hdc, bits, &drawInfo);
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
icon = PhBitmapToIcon(bitmap);
|
||||
|
||||
return icon;
|
||||
}
|
||||
|
||||
HICON PhUpdateIconCpuUsage(
|
||||
_In_ PH_PLUGIN_SYSTEM_STATISTICS Statistics
|
||||
)
|
||||
{
|
||||
ULONG width;
|
||||
ULONG height;
|
||||
HBITMAP bitmap;
|
||||
HDC hdc;
|
||||
HBITMAP oldBitmap;
|
||||
HICON icon;
|
||||
|
||||
// Icon
|
||||
PhBeginBitmap(&width, &height, &bitmap, NULL, &hdc, &oldBitmap);
|
||||
|
||||
// This stuff is copied from CpuUsageIcon.cs (PH 1.x).
|
||||
{
|
||||
COLORREF kColor = PhGetIntegerSetting(L"ColorCpuKernel");
|
||||
COLORREF uColor = PhGetIntegerSetting(L"ColorCpuUser");
|
||||
COLORREF kbColor = PhHalveColorBrightness(kColor);
|
||||
COLORREF ubColor = PhHalveColorBrightness(uColor);
|
||||
FLOAT k = Statistics.CpuKernelUsage;
|
||||
FLOAT u = Statistics.CpuUserUsage;
|
||||
LONG kl = (LONG)(k * height);
|
||||
LONG ul = (LONG)(u * height);
|
||||
RECT rect;
|
||||
HBRUSH dcBrush;
|
||||
HBRUSH dcPen;
|
||||
POINT points[2];
|
||||
|
||||
dcBrush = GetStockObject(DC_BRUSH);
|
||||
dcPen = GetStockObject(DC_PEN);
|
||||
rect.left = 0;
|
||||
rect.top = 0;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
SetDCBrushColor(hdc, RGB(0x00, 0x00, 0x00));
|
||||
FillRect(hdc, &rect, dcBrush);
|
||||
|
||||
// Draw the base line.
|
||||
if (kl + ul == 0)
|
||||
{
|
||||
SelectObject(hdc, dcPen);
|
||||
SetDCPenColor(hdc, uColor);
|
||||
points[0].x = 0;
|
||||
points[0].y = height - 1;
|
||||
points[1].x = width;
|
||||
points[1].y = height - 1;
|
||||
Polyline(hdc, points, 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
rect.left = 0;
|
||||
rect.top = height - ul - kl;
|
||||
rect.right = width;
|
||||
rect.bottom = height - kl;
|
||||
SetDCBrushColor(hdc, ubColor);
|
||||
FillRect(hdc, &rect, dcBrush);
|
||||
|
||||
points[0].x = 0;
|
||||
points[0].y = height - 1 - ul - kl;
|
||||
if (points[0].y < 0) points[0].y = 0;
|
||||
points[1].x = width;
|
||||
points[1].y = points[0].y;
|
||||
SelectObject(hdc, dcPen);
|
||||
SetDCPenColor(hdc, uColor);
|
||||
Polyline(hdc, points, 2);
|
||||
|
||||
if (kl != 0)
|
||||
{
|
||||
rect.left = 0;
|
||||
rect.top = height - kl;
|
||||
rect.right = width;
|
||||
rect.bottom = height;
|
||||
SetDCBrushColor(hdc, kbColor);
|
||||
FillRect(hdc, &rect, dcBrush);
|
||||
|
||||
points[0].x = 0;
|
||||
points[0].y = height - 1 - kl;
|
||||
if (points[0].y < 0) points[0].y = 0;
|
||||
points[1].x = width;
|
||||
points[1].y = points[0].y;
|
||||
SelectObject(hdc, dcPen);
|
||||
SetDCPenColor(hdc, kColor);
|
||||
Polyline(hdc, points, 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SelectObject(hdc, oldBitmap);
|
||||
icon = PhBitmapToIcon(bitmap);
|
||||
|
||||
return icon;
|
||||
}
|
||||
139
plugins-extra/TaskbarExtPlugin/options.c
Normal file
139
plugins-extra/TaskbarExtPlugin/options.c
Normal file
@@ -0,0 +1,139 @@
|
||||
/*
|
||||
* Process Hacker Extra Plugins -
|
||||
* Taskbar Extensions
|
||||
*
|
||||
* Copyright (C) 2015 dmex
|
||||
*
|
||||
* This file is part of Process Hacker.
|
||||
*
|
||||
* Process Hacker is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Process Hacker is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with Process Hacker. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "main.h"
|
||||
|
||||
static PH_KEY_VALUE_PAIR GraphTypePairs[] =
|
||||
{
|
||||
{ L"None", (PVOID)TASKBAR_ICON_NONE },
|
||||
{ L"CPU History", (PVOID)TASKBAR_ICON_CPU_HISTORY },
|
||||
{ L"CPU Usage", (PVOID)TASKBAR_ICON_CPU_USAGE },
|
||||
{ L"I/O History", (PVOID)TASKBAR_ICON_IO_HISTORY },
|
||||
{ L"Commit History", (PVOID)TASKBAR_ICON_COMMIT_HISTORY },
|
||||
{ L"Physical Memory History", (PVOID)TASKBAR_ICON_PHYSICAL_HISTORY },
|
||||
};
|
||||
|
||||
static WCHAR *GraphTypeStrings[] =
|
||||
{
|
||||
L"None",
|
||||
L"CPU History",
|
||||
L"CPU Usage",
|
||||
L"I/O History",
|
||||
L"Commit History",
|
||||
L"Physical Memory History"
|
||||
};
|
||||
|
||||
PWSTR GraphTypeGetTypeString(
|
||||
_In_ ULONG SidType
|
||||
)
|
||||
{
|
||||
PWSTR string;
|
||||
|
||||
if (PhFindStringSiKeyValuePairs(
|
||||
GraphTypePairs,
|
||||
sizeof(GraphTypePairs),
|
||||
SidType,
|
||||
&string
|
||||
))
|
||||
{
|
||||
return string;
|
||||
}
|
||||
|
||||
return L"None";
|
||||
}
|
||||
|
||||
ULONG GraphTypeGetTypeInteger(
|
||||
_In_ PWSTR SidType
|
||||
)
|
||||
{
|
||||
ULONG integer;
|
||||
|
||||
if (PhFindIntegerSiKeyValuePairs(
|
||||
GraphTypePairs,
|
||||
sizeof(GraphTypePairs),
|
||||
SidType,
|
||||
&integer
|
||||
))
|
||||
{
|
||||
return integer;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT_PTR CALLBACK OptionsDlgProc(
|
||||
_In_ HWND hwndDlg,
|
||||
_In_ UINT uMsg,
|
||||
_In_ WPARAM wParam,
|
||||
_In_ LPARAM lParam
|
||||
)
|
||||
{
|
||||
switch (uMsg)
|
||||
{
|
||||
case WM_INITDIALOG:
|
||||
{
|
||||
HWND graphTypeHandle;
|
||||
|
||||
graphTypeHandle = GetDlgItem(hwndDlg, IDC_GRAPH_TYPE);
|
||||
|
||||
PhCenterWindow(hwndDlg, GetParent(hwndDlg));
|
||||
|
||||
PhAddComboBoxStrings(graphTypeHandle, GraphTypeStrings, ARRAYSIZE(GraphTypeStrings));
|
||||
PhSelectComboBoxString(graphTypeHandle, GraphTypeGetTypeString(PhGetIntegerSetting(SETTING_NAME_TASKBAR_ICON_TYPE)), FALSE);
|
||||
}
|
||||
break;
|
||||
case WM_COMMAND:
|
||||
{
|
||||
switch (LOWORD(wParam))
|
||||
{
|
||||
case IDCANCEL:
|
||||
EndDialog(hwndDlg, IDCANCEL);
|
||||
break;
|
||||
case IDOK:
|
||||
{
|
||||
PPH_STRING graphTypeString;
|
||||
|
||||
graphTypeString = PhAutoDereferenceObject(PhGetWindowText(GetDlgItem(hwndDlg, IDC_GRAPH_TYPE)));
|
||||
PhSetIntegerSetting(SETTING_NAME_TASKBAR_ICON_TYPE, GraphTypeGetTypeInteger(graphTypeString->Buffer));
|
||||
|
||||
EndDialog(hwndDlg, IDOK);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
VOID ShowOptionsDialog(
|
||||
_In_ HWND ParentHandle
|
||||
)
|
||||
{
|
||||
DialogBox(
|
||||
PluginInstance->DllBase,
|
||||
MAKEINTRESOURCE(IDD_OPTIONS),
|
||||
ParentHandle,
|
||||
OptionsDlgProc
|
||||
);
|
||||
}
|
||||
21
plugins-extra/TaskbarExtPlugin/resource.h
Normal file
21
plugins-extra/TaskbarExtPlugin/resource.h
Normal file
@@ -0,0 +1,21 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Visual C++ generated include file.
|
||||
// Used by TaskbarExtPlugin.rc
|
||||
//
|
||||
#define IDD_OPTIONS 101
|
||||
#define IDB_APPLICATION_BMP 102
|
||||
#define IDB_APPLICATION_GO_BMP 103
|
||||
#define IDB_CHART_LINE_BMP 104
|
||||
#define IDB_FIND_BMP 105
|
||||
#define IDC_GRAPH_TYPE 1001
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 106
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||
#define _APS_NEXT_SYMED_VALUE 106
|
||||
#endif
|
||||
#endif
|
||||
BIN
plugins-extra/TaskbarExtPlugin/resources/application.bmp
Normal file
BIN
plugins-extra/TaskbarExtPlugin/resources/application.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
plugins-extra/TaskbarExtPlugin/resources/application_go.bmp
Normal file
BIN
plugins-extra/TaskbarExtPlugin/resources/application_go.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
plugins-extra/TaskbarExtPlugin/resources/chart_line.bmp
Normal file
BIN
plugins-extra/TaskbarExtPlugin/resources/chart_line.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
plugins-extra/TaskbarExtPlugin/resources/find.bmp
Normal file
BIN
plugins-extra/TaskbarExtPlugin/resources/find.bmp
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
Reference in New Issue
Block a user